Update prebuilt Clang to r365631c1 from Android.
The version we had was segfaulting.
Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/include/lldb/API/LLDB.h b/linux-x64/clang/include/lldb/API/LLDB.h
new file mode 100644
index 0000000..0806ab7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/LLDB.h
@@ -0,0 +1,80 @@
+//===-- LLDB.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_LLDB_h_
+#define LLDB_LLDB_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBAttachInfo.h"
+#include "lldb/API/SBBlock.h"
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBBreakpointName.h"
+#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBCommunication.h"
+#include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDeclaration.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBEvent.h"
+#include "lldb/API/SBExecutionContext.h"
+#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFileSpecList.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBFunction.h"
+#include "lldb/API/SBHostOS.h"
+#include "lldb/API/SBInstruction.h"
+#include "lldb/API/SBInstructionList.h"
+#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBLaunchInfo.h"
+#include "lldb/API/SBLineEntry.h"
+#include "lldb/API/SBListener.h"
+#include "lldb/API/SBMemoryRegionInfo.h"
+#include "lldb/API/SBMemoryRegionInfoList.h"
+#include "lldb/API/SBModule.h"
+#include "lldb/API/SBModuleSpec.h"
+#include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBProcessInfo.h"
+#include "lldb/API/SBQueue.h"
+#include "lldb/API/SBQueueItem.h"
+#include "lldb/API/SBReproducer.h"
+#include "lldb/API/SBSection.h"
+#include "lldb/API/SBSourceManager.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBStructuredData.h"
+#include "lldb/API/SBSymbol.h"
+#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBSymbolContextList.h"
+#include "lldb/API/SBTarget.h"
+#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"
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeNameSpecifier.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
+#include "lldb/API/SBUnixSignals.h"
+#include "lldb/API/SBValue.h"
+#include "lldb/API/SBValueList.h"
+#include "lldb/API/SBVariablesOptions.h"
+#include "lldb/API/SBWatchpoint.h"
+
+#endif // LLDB_LLDB_h_
diff --git a/linux-x64/clang/include/lldb/API/SBAddress.h b/linux-x64/clang/include/lldb/API/SBAddress.h
new file mode 100644
index 0000000..2874a36
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBAddress.h
@@ -0,0 +1,130 @@
+//===-- SBAddress.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBAddress_h_
+#define LLDB_SBAddress_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBModule.h"
+
+namespace lldb {
+
+class LLDB_API SBAddress {
+public:
+ SBAddress();
+
+ SBAddress(const lldb::SBAddress &rhs);
+
+ SBAddress(lldb::SBSection section, lldb::addr_t offset);
+
+ // Create an address by resolving a load address using the supplied target
+ SBAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
+
+ ~SBAddress();
+
+ const lldb::SBAddress &operator=(const lldb::SBAddress &rhs);
+
+ explicit operator bool() const;
+
+ // operator== is a free function
+
+ bool operator!=(const SBAddress &rhs) const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ addr_t GetFileAddress() const;
+
+ addr_t GetLoadAddress(const lldb::SBTarget &target) const;
+
+ void SetAddress(lldb::SBSection section, lldb::addr_t offset);
+
+ void SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target);
+ bool OffsetAddress(addr_t offset);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ // The following queries can lookup symbol information for a given address.
+ // An address might refer to code or data from an existing module, or it
+ // might refer to something on the stack or heap. The following functions
+ // will only return valid values if the address has been resolved to a code
+ // or data address using "void SBAddress::SetLoadAddress(...)" or
+ // "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
+ lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);
+
+ // The following functions grab individual objects for a given address and
+ // are less efficient if you want more than one symbol related objects. Use
+ // one of the following when you want multiple debug symbol related objects
+ // for an address:
+ // lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t
+ // resolve_scope);
+ // lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const
+ // SBAddress &addr, uint32_t resolve_scope);
+ // One or more bits from the SymbolContextItem enumerations can be logically
+ // OR'ed together to more efficiently retrieve multiple symbol objects.
+
+ lldb::SBSection GetSection();
+
+ lldb::addr_t GetOffset();
+
+ lldb::SBModule GetModule();
+
+ lldb::SBCompileUnit GetCompileUnit();
+
+ lldb::SBFunction GetFunction();
+
+ lldb::SBBlock GetBlock();
+
+ lldb::SBSymbol GetSymbol();
+
+ lldb::SBLineEntry GetLineEntry();
+
+protected:
+ friend class SBBlock;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBLineEntry;
+ friend class SBInstruction;
+ friend class SBModule;
+ friend class SBSection;
+ friend class SBSymbol;
+ friend class SBSymbolContext;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBThreadPlan;
+ friend class SBValue;
+ friend class SBQueueItem;
+
+ lldb_private::Address *operator->();
+
+ const lldb_private::Address *operator->() const;
+
+ friend bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs);
+
+ lldb_private::Address *get();
+
+ lldb_private::Address &ref();
+
+ const lldb_private::Address &ref() const;
+
+ SBAddress(const lldb_private::Address *lldb_object_ptr);
+
+ void SetAddress(const lldb_private::Address *lldb_object_ptr);
+
+private:
+ std::unique_ptr<lldb_private::Address> m_opaque_up;
+};
+
+bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs);
+
+} // namespace lldb
+
+#endif // LLDB_SBAddress_h_
diff --git a/linux-x64/clang/include/lldb/API/SBAttachInfo.h b/linux-x64/clang/include/lldb/API/SBAttachInfo.h
new file mode 100644
index 0000000..3c20a08
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBAttachInfo.h
@@ -0,0 +1,177 @@
+//===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBAttachInfo_h_
+#define LLDB_SBAttachInfo_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBTarget;
+
+class LLDB_API SBAttachInfo {
+public:
+ SBAttachInfo();
+
+ SBAttachInfo(lldb::pid_t pid);
+
+ /// Attach to a process by name.
+ ///
+ /// This function implies that a future call to SBTarget::Attach(...)
+ /// will be synchronous.
+ ///
+ /// \param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// \param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ SBAttachInfo(const char *path, bool wait_for);
+
+ /// Attach to a process by name.
+ ///
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// \param[in] path
+ /// A full or partial name for the process to attach to.
+ ///
+ /// \param[in] wait_for
+ /// If \b false, attach to an existing process whose name matches.
+ /// If \b true, then wait for the next process whose name matches.
+ ///
+ /// \param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ SBAttachInfo(const char *path, bool wait_for, bool async);
+
+ SBAttachInfo(const SBAttachInfo &rhs);
+
+ ~SBAttachInfo();
+
+ SBAttachInfo &operator=(const SBAttachInfo &rhs);
+
+ lldb::pid_t GetProcessID();
+
+ void SetProcessID(lldb::pid_t pid);
+
+ void SetExecutable(const char *path);
+
+ void SetExecutable(lldb::SBFileSpec exe_file);
+
+ bool GetWaitForLaunch();
+
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// This function implies that a call to SBTarget::Attach(...) will
+ /// be synchronous.
+ ///
+ /// \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.
+ void SetWaitForLaunch(bool b);
+
+ /// Set attach by process name settings.
+ ///
+ /// Designed to be used after a call to SBAttachInfo::SetExecutable().
+ /// Future calls to SBTarget::Attach(...) will be synchronous or
+ /// asynchronous depending on the \a async argument.
+ ///
+ /// \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.
+ ///
+ /// \param[in] async
+ /// If \b false, then the SBTarget::Attach(...) call will be a
+ /// synchronous call with no way to cancel the attach in
+ /// progress.
+ /// If \b true, then the SBTarget::Attach(...) function will
+ /// return immediately and clients are expected to wait for a
+ /// process eStateStopped event if a suitable process is
+ /// eventually found. If the client wants to cancel the event,
+ /// SBProcess::Stop() can be called and an eStateExited process
+ /// event will be delivered.
+ void SetWaitForLaunch(bool b, bool async);
+
+ bool GetIgnoreExisting();
+
+ void SetIgnoreExisting(bool b);
+
+ uint32_t GetResumeCount();
+
+ void SetResumeCount(uint32_t c);
+
+ const char *GetProcessPluginName();
+
+ void SetProcessPluginName(const char *plugin_name);
+
+ uint32_t GetUserID();
+
+ uint32_t GetGroupID();
+
+ bool UserIDIsValid();
+
+ bool GroupIDIsValid();
+
+ void SetUserID(uint32_t uid);
+
+ void SetGroupID(uint32_t gid);
+
+ uint32_t GetEffectiveUserID();
+
+ uint32_t GetEffectiveGroupID();
+
+ bool EffectiveUserIDIsValid();
+
+ bool EffectiveGroupIDIsValid();
+
+ void SetEffectiveUserID(uint32_t uid);
+
+ void SetEffectiveGroupID(uint32_t gid);
+
+ lldb::pid_t GetParentProcessID();
+
+ void SetParentProcessID(lldb::pid_t pid);
+
+ bool ParentProcessIDIsValid();
+
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// 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.
+ SBListener GetListener();
+
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ void SetListener(SBListener &listener);
+
+protected:
+ friend class SBTarget;
+
+ lldb_private::ProcessAttachInfo &ref();
+
+ ProcessAttachInfoSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBAttachInfo_h_
diff --git a/linux-x64/clang/include/lldb/API/SBBlock.h b/linux-x64/clang/include/lldb/API/SBBlock.h
new file mode 100644
index 0000000..0ca92ff
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBBlock.h
@@ -0,0 +1,95 @@
+//===-- SBBlock.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBlock_h_
+#define LLDB_SBBlock_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBTarget.h"
+#include "lldb/API/SBValueList.h"
+
+namespace lldb {
+
+class LLDB_API SBBlock {
+public:
+ SBBlock();
+
+ SBBlock(const lldb::SBBlock &rhs);
+
+ ~SBBlock();
+
+ const lldb::SBBlock &operator=(const lldb::SBBlock &rhs);
+
+ bool IsInlined() const;
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetInlinedName() const;
+
+ lldb::SBFileSpec GetInlinedCallSiteFile() const;
+
+ uint32_t GetInlinedCallSiteLine() const;
+
+ uint32_t GetInlinedCallSiteColumn() const;
+
+ lldb::SBBlock GetParent();
+
+ lldb::SBBlock GetSibling();
+
+ lldb::SBBlock GetFirstChild();
+
+ uint32_t GetNumRanges();
+
+ lldb::SBAddress GetRangeStartAddress(uint32_t idx);
+
+ lldb::SBAddress GetRangeEndAddress(uint32_t idx);
+
+ uint32_t GetRangeIndexForBlockAddress(lldb::SBAddress block_addr);
+
+ lldb::SBValueList GetVariables(lldb::SBFrame &frame, bool arguments,
+ bool locals, bool statics,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
+ bool locals, bool statics);
+ /// Get the inlined block that contains this block.
+ ///
+ /// \return
+ /// If this block is inlined, it will return this block, else
+ /// parent blocks will be searched to see if any contain this
+ /// block and are themselves inlined. An invalid SBBlock will
+ /// be returned if this block nor any parent blocks are inlined
+ /// function blocks.
+ lldb::SBBlock GetContainingInlinedBlock();
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBSymbolContext;
+
+ lldb_private::Block *GetPtr();
+
+ void SetPtr(lldb_private::Block *lldb_object_ptr);
+
+ SBBlock(lldb_private::Block *lldb_object_ptr);
+
+ void AppendVariables(bool can_create, bool get_parent_variables,
+ lldb_private::VariableList *var_list);
+
+ lldb_private::Block *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBlock_h_
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpoint.h b/linux-x64/clang/include/lldb/API/SBBreakpoint.h
new file mode 100644
index 0000000..75c0e69
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBBreakpoint.h
@@ -0,0 +1,181 @@
+//===-- SBBreakpoint.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBreakpoint_h_
+#define LLDB_SBBreakpoint_h_
+
+#include "lldb/API/SBDefines.h"
+
+class SBBreakpointListImpl;
+
+namespace lldb {
+
+class LLDB_API SBBreakpoint {
+public:
+
+ SBBreakpoint();
+
+ SBBreakpoint(const lldb::SBBreakpoint &rhs);
+
+ SBBreakpoint(const lldb::BreakpointSP &bp_sp);
+
+ ~SBBreakpoint();
+
+ const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
+
+ // Tests to see if the opaque breakpoint object in this object matches the
+ // opaque breakpoint object in "rhs".
+ bool operator==(const lldb::SBBreakpoint &rhs);
+
+ bool operator!=(const lldb::SBBreakpoint &rhs);
+
+ break_id_t GetID() const;
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void ClearAllBreakpointSites();
+
+ lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
+
+ lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
+
+ lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
+
+ lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
+
+ void SetEnabled(bool enable);
+
+ bool IsEnabled();
+
+ void SetOneShot(bool one_shot);
+
+ bool IsOneShot() const;
+
+ bool IsInternal();
+
+ uint32_t GetHitCount() const;
+
+ void SetIgnoreCount(uint32_t count);
+
+ uint32_t GetIgnoreCount() const;
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ void SetCallback(SBBreakpointHitCallback callback, void *baton);
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ bool AddName(const char *new_name);
+
+ void RemoveName(const char *name_to_remove);
+
+ bool MatchesName(const char *name);
+
+ void GetNames(SBStringList &names);
+
+ size_t GetNumResolvedLocations() const;
+
+ size_t GetNumLocations() const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool GetDescription(lldb::SBStream &description, bool include_locations);
+
+ static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
+
+ static lldb::BreakpointEventType
+ GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBBreakpointLocation
+ GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
+ uint32_t loc_idx);
+
+ static uint32_t
+ GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
+
+ bool IsHardware() const;
+
+ // Can only be called from a ScriptedBreakpointResolver...
+ SBError
+ AddLocation(SBAddress &address);
+
+private:
+ friend class SBBreakpointList;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
+ friend class SBTarget;
+
+ lldb::BreakpointSP GetSP() const;
+
+ lldb::BreakpointWP m_opaque_wp;
+};
+
+class LLDB_API SBBreakpointList {
+public:
+ SBBreakpointList(SBTarget &target);
+
+ ~SBBreakpointList();
+
+ size_t GetSize() const;
+
+ SBBreakpoint GetBreakpointAtIndex(size_t idx);
+
+ SBBreakpoint FindBreakpointByID(lldb::break_id_t);
+
+ void Append(const SBBreakpoint &sb_bkpt);
+
+ bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
+
+ void AppendByID(lldb::break_id_t id);
+
+ void Clear();
+
+protected:
+ friend class SBTarget;
+
+ void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
+
+private:
+ std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBreakpoint_h_
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h b/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h
new file mode 100644
index 0000000..085bed9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h
@@ -0,0 +1,100 @@
+//===-- SBBreakpointLocation.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBreakpointLocation_h_
+#define LLDB_SBBreakpointLocation_h_
+
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBBreakpointLocation {
+public:
+ SBBreakpointLocation();
+
+ SBBreakpointLocation(const lldb::SBBreakpointLocation &rhs);
+
+ ~SBBreakpointLocation();
+
+ const lldb::SBBreakpointLocation &
+ operator=(const lldb::SBBreakpointLocation &rhs);
+
+ break_id_t GetID();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBAddress GetAddress();
+
+ lldb::addr_t GetLoadAddress();
+
+ void SetEnabled(bool enabled);
+
+ bool IsEnabled();
+
+ uint32_t GetHitCount();
+
+ uint32_t GetIgnoreCount();
+
+ void SetIgnoreCount(uint32_t n);
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ bool IsResolved();
+
+ bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
+
+ SBBreakpoint GetBreakpoint();
+
+ SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
+
+private:
+ friend class SBBreakpoint;
+ friend class SBBreakpointCallbackBaton;
+
+ void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
+ BreakpointLocationSP GetSP() const;
+
+ lldb::BreakpointLocationWP m_opaque_wp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBreakpointLocation_h_
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpointName.h b/linux-x64/clang/include/lldb/API/SBBreakpointName.h
new file mode 100644
index 0000000..018238b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBBreakpointName.h
@@ -0,0 +1,119 @@
+//===-- SBBreakpointName.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBreakpointName_h_
+#define LLDB_SBBreakpointName_h_
+
+#include "lldb/API/SBDefines.h"
+
+class SBBreakpointNameImpl;
+
+namespace lldb {
+
+class LLDB_API SBBreakpointName {
+public:
+// typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
+// SBThread &thread,
+// lldb::SBBreakpointLocation &location);
+
+ SBBreakpointName();
+
+ SBBreakpointName(SBTarget &target, const char *name);
+
+ SBBreakpointName(SBBreakpoint &bkpt, const char *name);
+
+ SBBreakpointName(const lldb::SBBreakpointName &rhs);
+
+ ~SBBreakpointName();
+
+ const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs);
+
+ // Tests to see if the opaque breakpoint object in this object matches the
+ // opaque breakpoint object in "rhs".
+ bool operator==(const lldb::SBBreakpointName &rhs);
+
+ bool operator!=(const lldb::SBBreakpointName &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName() const;
+
+ void SetEnabled(bool enable);
+
+ bool IsEnabled();
+
+ void SetOneShot(bool one_shot);
+
+ bool IsOneShot() const;
+
+ void SetIgnoreCount(uint32_t count);
+
+ uint32_t GetIgnoreCount() const;
+
+ void SetCondition(const char *condition);
+
+ const char *GetCondition();
+
+ void SetAutoContinue(bool auto_continue);
+
+ bool GetAutoContinue();
+
+ void SetThreadID(lldb::tid_t sb_thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ void SetCallback(SBBreakpointHitCallback callback, void *baton);
+
+ void SetScriptCallbackFunction(const char *callback_function_name);
+
+ void SetCommandLineCommands(SBStringList &commands);
+
+ bool GetCommandLineCommands(SBStringList &commands);
+
+ SBError SetScriptCallbackBody(const char *script_body_text);
+
+ const char *GetHelpString() const;
+ void SetHelpString(const char *help_string);
+
+ bool GetAllowList() const;
+ void SetAllowList(bool value);
+
+ bool GetAllowDelete();
+ void SetAllowDelete(bool value);
+
+ bool GetAllowDisable();
+ void SetAllowDisable(bool value);
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBTarget;
+
+ lldb_private::BreakpointName *GetBreakpointName() const;
+ void UpdateName(lldb_private::BreakpointName &bp_name);
+
+ std::unique_ptr<SBBreakpointNameImpl> m_impl_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBreakpointName_h_
diff --git a/linux-x64/clang/include/lldb/API/SBBroadcaster.h b/linux-x64/clang/include/lldb/API/SBBroadcaster.h
new file mode 100644
index 0000000..fc5e888
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBBroadcaster.h
@@ -0,0 +1,84 @@
+//===-- SBBroadcaster.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBBroadcaster_h_
+#define LLDB_SBBroadcaster_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBBroadcaster {
+public:
+ SBBroadcaster();
+
+ SBBroadcaster(const char *name);
+
+ SBBroadcaster(const SBBroadcaster &rhs);
+
+ const SBBroadcaster &operator=(const SBBroadcaster &rhs);
+
+ ~SBBroadcaster();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ void BroadcastEventByType(uint32_t event_type, bool unique = false);
+
+ void BroadcastEvent(const lldb::SBEvent &event, bool unique = false);
+
+ void AddInitialEventsToListener(const lldb::SBListener &listener,
+ uint32_t requested_events);
+
+ uint32_t AddListener(const lldb::SBListener &listener, uint32_t event_mask);
+
+ const char *GetName() const;
+
+ bool EventTypeHasListeners(uint32_t event_type);
+
+ bool RemoveListener(const lldb::SBListener &listener,
+ uint32_t event_mask = UINT32_MAX);
+
+ // This comparison is checking if the internal opaque pointer value is equal
+ // to that in "rhs".
+ bool operator==(const lldb::SBBroadcaster &rhs) const;
+
+ // This comparison is checking if the internal opaque pointer value is not
+ // equal to that in "rhs".
+ bool operator!=(const lldb::SBBroadcaster &rhs) const;
+
+ // This comparison is checking if the internal opaque pointer value is less
+ // than that in "rhs" so SBBroadcaster objects can be contained in ordered
+ // containers.
+ bool operator<(const lldb::SBBroadcaster &rhs) const;
+
+protected:
+ friend class SBCommandInterpreter;
+ friend class SBCommunication;
+ friend class SBEvent;
+ friend class SBListener;
+ friend class SBProcess;
+ friend class SBTarget;
+
+ SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns);
+
+ lldb_private::Broadcaster *get() const;
+
+ void reset(lldb_private::Broadcaster *broadcaster, bool owns);
+
+private:
+ lldb::BroadcasterSP m_opaque_sp;
+ lldb_private::Broadcaster *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBBroadcaster_h_
diff --git a/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h b/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h
new file mode 100644
index 0000000..6c80e8e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h
@@ -0,0 +1,305 @@
+//===-- SBCommandInterpreter.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBCommandInterpreter_h_
+#define LLDB_SBCommandInterpreter_h_
+
+#include <memory>
+
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBCommandInterpreterRunOptions {
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+public:
+ SBCommandInterpreterRunOptions();
+ ~SBCommandInterpreterRunOptions();
+
+ bool GetStopOnContinue() const;
+
+ void SetStopOnContinue(bool);
+
+ bool GetStopOnError() const;
+
+ void SetStopOnError(bool);
+
+ bool GetStopOnCrash() const;
+
+ void SetStopOnCrash(bool);
+
+ bool GetEchoCommands() const;
+
+ void SetEchoCommands(bool);
+
+ bool GetEchoCommentCommands() const;
+
+ void SetEchoCommentCommands(bool echo);
+
+ bool GetPrintResults() const;
+
+ void SetPrintResults(bool);
+
+ bool GetAddToHistory() const;
+
+ void SetAddToHistory(bool);
+
+private:
+ lldb_private::CommandInterpreterRunOptions *get() const;
+
+ lldb_private::CommandInterpreterRunOptions &ref() const;
+
+ // This is set in the constructor and will always be valid.
+ mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions>
+ m_opaque_up;
+};
+
+class SBCommandInterpreter {
+public:
+ enum {
+ eBroadcastBitThreadShouldExit = (1 << 0),
+ eBroadcastBitResetPrompt = (1 << 1),
+ eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
+ eBroadcastBitAsynchronousOutputData = (1 << 3),
+ eBroadcastBitAsynchronousErrorData = (1 << 4)
+ };
+
+ SBCommandInterpreter(const lldb::SBCommandInterpreter &rhs);
+
+ ~SBCommandInterpreter();
+
+ const lldb::SBCommandInterpreter &
+ operator=(const lldb::SBCommandInterpreter &rhs);
+
+ static const char *
+ GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
+
+ static const char *
+ GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type);
+
+ static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool CommandExists(const char *cmd);
+
+ bool AliasExists(const char *cmd);
+
+ lldb::SBBroadcaster GetBroadcaster();
+
+ static const char *GetBroadcasterClass();
+
+ bool HasCommands();
+
+ bool HasAliases();
+
+ bool HasAliasOptions();
+
+ lldb::SBProcess GetProcess();
+
+ lldb::SBDebugger GetDebugger();
+
+ lldb::SBCommand AddMultiwordCommand(const char *name, const char *help);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax);
+
+ void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result);
+
+ void
+ SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result);
+
+ lldb::ReturnStatus HandleCommand(const char *command_line,
+ lldb::SBCommandReturnObject &result,
+ bool add_to_history = false);
+
+ lldb::ReturnStatus HandleCommand(const char *command_line,
+ SBExecutionContext &exe_ctx,
+ SBCommandReturnObject &result,
+ bool add_to_history = false);
+
+ void HandleCommandsFromFile(lldb::SBFileSpec &file,
+ lldb::SBExecutionContext &override_context,
+ lldb::SBCommandInterpreterRunOptions &options,
+ lldb::SBCommandReturnObject result);
+
+ // The pointer based interface is not useful in SWIG, since the cursor &
+ // last_char arguments are string pointers INTO current_line and you can't do
+ // that in a scripting language interface in general...
+
+ // In either case, the way this works is that the you give it a line and
+ // cursor position in the line. The function will return the number of
+ // completions. The matches list will contain number_of_completions + 1
+ // elements. The first element is the common substring after the cursor
+ // position for all the matches. The rest of the elements are the matches.
+ // The first element is useful if you are emulating the common shell behavior
+ // where the tab completes to the string that is common among all the
+ // matches, then you should first check if the first element is non-empty,
+ // and if so just insert it and move the cursor to the end of the insertion.
+ // The next tab will return an empty common substring, and a list of choices
+ // (if any), at which point you should display the choices and let the user
+ // type further to disambiguate.
+
+ int HandleCompletion(const char *current_line, const char *cursor,
+ const char *last_char, int match_start_point,
+ int max_return_elements, lldb::SBStringList &matches);
+
+ int HandleCompletion(const char *current_line, uint32_t cursor_pos,
+ int match_start_point, int max_return_elements,
+ lldb::SBStringList &matches);
+
+ // Same as HandleCompletion, but also fills out `descriptions` with
+ // descriptions for each match.
+ int HandleCompletionWithDescriptions(
+ const char *current_line, const char *cursor, const char *last_char,
+ int match_start_point, int max_return_elements,
+ lldb::SBStringList &matches, lldb::SBStringList &descriptions);
+
+ int HandleCompletionWithDescriptions(const char *current_line,
+ uint32_t cursor_pos,
+ int match_start_point,
+ int max_return_elements,
+ lldb::SBStringList &matches,
+ lldb::SBStringList &descriptions);
+
+ bool WasInterrupted() const;
+
+ // Catch commands before they execute by registering a callback that will get
+ // called when the command gets executed. This allows GUI or command line
+ // interfaces to intercept a command and stop it from happening
+ bool SetCommandOverrideCallback(const char *command_name,
+ lldb::CommandOverrideCallback callback,
+ void *baton);
+
+ SBCommandInterpreter(
+ lldb_private::CommandInterpreter *interpreter_ptr =
+ nullptr); // Access using SBDebugger::GetCommandInterpreter();
+
+ /// Return true if the command interpreter is the active IO handler.
+ ///
+ /// This indicates that any input coming into the debugger handles will
+ /// go to the command interpreter and will result in LLDB command line
+ /// commands being executed.
+ bool IsActive();
+
+ /// Get the string that needs to be written to the debugger stdin file
+ /// handle when a control character is typed.
+ ///
+ /// Some GUI programs will intercept "control + char" sequences and want
+ /// to have them do what normally would happen when using a real
+ /// terminal, so this function allows GUI programs to emulate this
+ /// functionality.
+ ///
+ /// \param[in] ch
+ /// The character that was typed along with the control key
+ ///
+ /// \return
+ /// The string that should be written into the file handle that is
+ /// feeding the input stream for the debugger, or nullptr if there is
+ /// no string for this control key.
+ const char *GetIOHandlerControlSequence(char ch);
+
+ bool GetPromptOnQuit();
+
+ void SetPromptOnQuit(bool b);
+
+ /// Sets whether the command interpreter should allow custom exit codes
+ /// for the 'quit' command.
+ void AllowExitCodeOnQuit(bool allow);
+
+ /// Returns true if the user has called the 'quit' command with a custom exit
+ /// code.
+ bool HasCustomQuitExitCode();
+
+ /// Returns the exit code that the user has specified when running the
+ /// 'quit' command. Returns 0 if the user hasn't called 'quit' at all or
+ /// without a custom exit code.
+ int GetQuitStatus();
+
+ /// Resolve the command just as HandleCommand would, expanding abbreviations
+ /// and aliases. If successful, result->GetOutput has the full expansion.
+ void ResolveCommand(const char *command_line, SBCommandReturnObject &result);
+
+protected:
+ lldb_private::CommandInterpreter &ref();
+
+ lldb_private::CommandInterpreter *get();
+
+ void reset(lldb_private::CommandInterpreter *);
+
+private:
+ friend class SBDebugger;
+
+ lldb_private::CommandInterpreter *m_opaque_ptr;
+};
+
+class SBCommandPluginInterface {
+public:
+ virtual ~SBCommandPluginInterface() = default;
+
+ virtual bool DoExecute(lldb::SBDebugger /*debugger*/, char ** /*command*/,
+ lldb::SBCommandReturnObject & /*result*/) {
+ return false;
+ }
+};
+
+class SBCommand {
+public:
+ SBCommand();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ const char *GetName();
+
+ const char *GetHelp();
+
+ const char *GetHelpLong();
+
+ void SetHelp(const char *);
+
+ void SetHelpLong(const char *);
+
+ uint32_t GetFlags();
+
+ void SetFlags(uint32_t flags);
+
+ lldb::SBCommand AddMultiwordCommand(const char *name,
+ const char *help = nullptr);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help = nullptr);
+
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax);
+
+private:
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+ SBCommand(lldb::CommandObjectSP cmd_sp);
+
+ lldb::CommandObjectSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBCommandInterpreter_h_
diff --git a/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h b/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h
new file mode 100644
index 0000000..2877afb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h
@@ -0,0 +1,109 @@
+//===-- SBCommandReturnObject.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBCommandReturnObject_h_
+#define LLDB_SBCommandReturnObject_h_
+
+#include <stdio.h>
+
+#include <memory>
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBCommandReturnObject {
+public:
+ SBCommandReturnObject();
+
+ SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
+
+ ~SBCommandReturnObject();
+
+ const lldb::SBCommandReturnObject &
+ operator=(const lldb::SBCommandReturnObject &rhs);
+
+ SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
+
+ lldb_private::CommandReturnObject *Release();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetOutput();
+
+ const char *GetError();
+
+ size_t PutOutput(FILE *fh);
+
+ size_t GetOutputSize();
+
+ size_t GetErrorSize();
+
+ size_t PutError(FILE *fh);
+
+ void Clear();
+
+ lldb::ReturnStatus GetStatus();
+
+ void SetStatus(lldb::ReturnStatus status);
+
+ bool Succeeded();
+
+ bool HasResult();
+
+ void AppendMessage(const char *message);
+
+ void AppendWarning(const char *message);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ // deprecated, these two functions do not take ownership of file handle
+ void SetImmediateOutputFile(FILE *fh);
+
+ void SetImmediateErrorFile(FILE *fh);
+
+ void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
+
+ void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
+
+ void PutCString(const char *string, int len = -1);
+
+ size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+ const char *GetOutput(bool only_if_no_immediate);
+
+ const char *GetError(bool only_if_no_immediate);
+
+ void SetError(lldb::SBError &error,
+ const char *fallback_error_cstr = nullptr);
+
+ void SetError(const char *error_cstr);
+
+protected:
+ friend class SBCommandInterpreter;
+ friend class SBOptions;
+
+ lldb_private::CommandReturnObject *operator->() const;
+
+ lldb_private::CommandReturnObject *get() const;
+
+ lldb_private::CommandReturnObject &operator*() const;
+
+ lldb_private::CommandReturnObject &ref() const;
+
+ void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
+
+private:
+ std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBCommandReturnObject_h_
diff --git a/linux-x64/clang/include/lldb/API/SBCommunication.h b/linux-x64/clang/include/lldb/API/SBCommunication.h
new file mode 100644
index 0000000..5b803fc
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBCommunication.h
@@ -0,0 +1,83 @@
+//===-- SBCommunication.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBCommunication_h_
+#define LLDB_SBCommunication_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBError.h"
+
+namespace lldb {
+
+class LLDB_API SBCommunication {
+public:
+ FLAGS_ANONYMOUS_ENUM(){
+ eBroadcastBitDisconnected =
+ (1 << 0), ///< Sent when the communications connection is lost.
+ eBroadcastBitReadThreadGotBytes =
+ (1 << 1), ///< Sent by the read thread when bytes become available.
+ eBroadcastBitReadThreadDidExit =
+ (1
+ << 2), ///< Sent by the read thread when it exits to inform clients.
+ eBroadcastBitReadThreadShouldExit =
+ (1 << 3), ///< Sent by clients that need to cancel the read thread.
+ eBroadcastBitPacketAvailable =
+ (1 << 4), ///< Sent when data received makes a complete packet.
+ eAllEventBits = 0xffffffff};
+
+ typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
+ size_t src_len);
+
+ SBCommunication();
+ SBCommunication(const char *broadcaster_name);
+ ~SBCommunication();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBBroadcaster GetBroadcaster();
+
+ static const char *GetBroadcasterClass();
+
+ lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd);
+
+ lldb::ConnectionStatus Connect(const char *url);
+
+ lldb::ConnectionStatus Disconnect();
+
+ bool IsConnected() const;
+
+ bool GetCloseOnEOF();
+
+ void SetCloseOnEOF(bool b);
+
+ size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
+ lldb::ConnectionStatus &status);
+
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status);
+
+ bool ReadThreadStart();
+
+ bool ReadThreadStop();
+
+ bool ReadThreadIsRunning();
+
+ bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
+ void *callback_baton);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SBCommunication);
+
+ lldb_private::Communication *m_opaque;
+ bool m_opaque_owned;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBCommunication_h_
diff --git a/linux-x64/clang/include/lldb/API/SBCompileUnit.h b/linux-x64/clang/include/lldb/API/SBCompileUnit.h
new file mode 100644
index 0000000..b6b1382
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBCompileUnit.h
@@ -0,0 +1,95 @@
+//===-- SBCompileUnit.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBCompileUnit_h_
+#define LLDB_SBCompileUnit_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+
+namespace lldb {
+
+class LLDB_API SBCompileUnit {
+public:
+ SBCompileUnit();
+
+ SBCompileUnit(const lldb::SBCompileUnit &rhs);
+
+ ~SBCompileUnit();
+
+ const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBFileSpec GetFileSpec() const;
+
+ uint32_t GetNumLineEntries() const;
+
+ lldb::SBLineEntry GetLineEntryAtIndex(uint32_t idx) const;
+
+ uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
+ lldb::SBFileSpec *inline_file_spec) const;
+
+ uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
+ lldb::SBFileSpec *inline_file_spec,
+ bool exact) const;
+
+ SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
+
+ uint32_t GetNumSupportFiles() const;
+
+ uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
+ bool full);
+
+ /// Get all types matching \a type_mask from debug info in this
+ /// compile unit.
+ ///
+ /// \param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this compile
+ /// unit.
+ ///
+ /// \return
+ /// A list of types in this compile unit that match \a type_mask
+ lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
+
+ lldb::LanguageType GetLanguage();
+
+ bool operator==(const lldb::SBCompileUnit &rhs) const;
+
+ bool operator!=(const lldb::SBCompileUnit &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSymbolContext;
+ friend class SBModule;
+
+ SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
+
+ const lldb_private::CompileUnit *operator->() const;
+
+ const lldb_private::CompileUnit &operator*() const;
+
+ lldb_private::CompileUnit *get();
+
+ void reset(lldb_private::CompileUnit *lldb_object_ptr);
+
+ lldb_private::CompileUnit *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBCompileUnit_h_
diff --git a/linux-x64/clang/include/lldb/API/SBData.h b/linux-x64/clang/include/lldb/API/SBData.h
new file mode 100644
index 0000000..886fe82
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBData.h
@@ -0,0 +1,155 @@
+//===-- SBData.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBData_h_
+#define LLDB_SBData_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBData {
+public:
+ SBData();
+
+ SBData(const SBData &rhs);
+
+ const SBData &operator=(const SBData &rhs);
+
+ ~SBData();
+
+ uint8_t GetAddressByteSize();
+
+ void SetAddressByteSize(uint8_t addr_byte_size);
+
+ void Clear();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ size_t GetByteSize();
+
+ lldb::ByteOrder GetByteOrder();
+
+ void SetByteOrder(lldb::ByteOrder endian);
+
+ float GetFloat(lldb::SBError &error, lldb::offset_t offset);
+
+ double GetDouble(lldb::SBError &error, lldb::offset_t offset);
+
+ long double GetLongDouble(lldb::SBError &error, lldb::offset_t offset);
+
+ lldb::addr_t GetAddress(lldb::SBError &error, lldb::offset_t offset);
+
+ uint8_t GetUnsignedInt8(lldb::SBError &error, lldb::offset_t offset);
+
+ uint16_t GetUnsignedInt16(lldb::SBError &error, lldb::offset_t offset);
+
+ uint32_t GetUnsignedInt32(lldb::SBError &error, lldb::offset_t offset);
+
+ uint64_t GetUnsignedInt64(lldb::SBError &error, lldb::offset_t offset);
+
+ int8_t GetSignedInt8(lldb::SBError &error, lldb::offset_t offset);
+
+ int16_t GetSignedInt16(lldb::SBError &error, lldb::offset_t offset);
+
+ int32_t GetSignedInt32(lldb::SBError &error, lldb::offset_t offset);
+
+ int64_t GetSignedInt64(lldb::SBError &error, lldb::offset_t offset);
+
+ const char *GetString(lldb::SBError &error, lldb::offset_t offset);
+
+ size_t ReadRawData(lldb::SBError &error, lldb::offset_t offset, void *buf,
+ size_t size);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
+
+ // it would be nice to have SetData(SBError, const void*, size_t) when
+ // endianness and address size can be inferred from the existing
+ // DataExtractor, but having two SetData() signatures triggers a SWIG bug
+ // where the typemap isn't applied before resolving the overload, and thus
+ // the right function never gets called
+ void SetData(lldb::SBError &error, const void *buf, size_t size,
+ lldb::ByteOrder endian, uint8_t addr_size);
+
+ // see SetData() for why we don't have Append(const void* buf, size_t size)
+ bool Append(const SBData &rhs);
+
+ static lldb::SBData CreateDataFromCString(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ const char *data);
+
+ // in the following CreateData*() and SetData*() prototypes, the two
+ // parameters array and array_len should not be renamed or rearranged,
+ // because doing so will break the SWIG typemap
+ static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ uint64_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromUInt32Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ uint32_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromSInt64Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ int64_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromSInt32Array(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ int32_t *array,
+ size_t array_len);
+
+ static lldb::SBData CreateDataFromDoubleArray(lldb::ByteOrder endian,
+ uint32_t addr_byte_size,
+ double *array,
+ size_t array_len);
+
+ bool SetDataFromCString(const char *data);
+
+ bool SetDataFromUInt64Array(uint64_t *array, size_t array_len);
+
+ bool SetDataFromUInt32Array(uint32_t *array, size_t array_len);
+
+ bool SetDataFromSInt64Array(int64_t *array, size_t array_len);
+
+ bool SetDataFromSInt32Array(int32_t *array, size_t array_len);
+
+ bool SetDataFromDoubleArray(double *array, size_t array_len);
+
+protected:
+ // Mimic shared pointer...
+ lldb_private::DataExtractor *get() const;
+
+ lldb_private::DataExtractor *operator->() const;
+
+ lldb::DataExtractorSP &operator*();
+
+ const lldb::DataExtractorSP &operator*() const;
+
+ SBData(const lldb::DataExtractorSP &data_sp);
+
+ void SetOpaque(const lldb::DataExtractorSP &data_sp);
+
+private:
+ friend class SBInstruction;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBTarget;
+ friend class SBValue;
+
+ lldb::DataExtractorSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBData_h_
diff --git a/linux-x64/clang/include/lldb/API/SBDebugger.h b/linux-x64/clang/include/lldb/API/SBDebugger.h
new file mode 100644
index 0000000..417cead
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBDebugger.h
@@ -0,0 +1,297 @@
+//===-- SBDebugger.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBDebugger_h_
+#define LLDB_SBDebugger_h_
+
+#include <stdio.h>
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBPlatform.h"
+
+namespace lldb {
+
+class LLDB_API SBInputReader {
+public:
+ SBInputReader() = default;
+ ~SBInputReader() = default;
+
+ SBError Initialize(lldb::SBDebugger &sb_debugger,
+ unsigned long (*callback)(void *, lldb::SBInputReader *,
+ lldb::InputReaderAction,
+ char const *, unsigned long),
+ void *a, lldb::InputReaderGranularity b, char const *c,
+ char const *d, bool e);
+ void SetIsDone(bool);
+ bool IsActive() const;
+};
+
+class LLDB_API SBDebugger {
+public:
+ SBDebugger();
+
+ SBDebugger(const lldb::SBDebugger &rhs);
+
+ SBDebugger(const lldb::DebuggerSP &debugger_sp);
+
+ ~SBDebugger();
+
+ lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs);
+
+ static void Initialize();
+
+ static lldb::SBError InitializeWithErrorHandling();
+
+ static void Terminate();
+
+ // Deprecated, use the one that takes a source_init_files bool.
+ static lldb::SBDebugger Create();
+
+ static lldb::SBDebugger Create(bool source_init_files);
+
+ static lldb::SBDebugger Create(bool source_init_files,
+ lldb::LogOutputCallback log_callback,
+ void *baton);
+
+ static void Destroy(lldb::SBDebugger &debugger);
+
+ static void MemoryPressureDetected();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ void SetAsync(bool b);
+
+ bool GetAsync();
+
+ void SkipLLDBInitFiles(bool b);
+
+ void SkipAppInitFiles(bool b);
+
+ void SetInputFileHandle(FILE *f, bool transfer_ownership);
+
+ void SetOutputFileHandle(FILE *f, bool transfer_ownership);
+
+ void SetErrorFileHandle(FILE *f, bool transfer_ownership);
+
+ FILE *GetInputFileHandle();
+
+ FILE *GetOutputFileHandle();
+
+ FILE *GetErrorFileHandle();
+
+ void SaveInputTerminalState();
+
+ void RestoreInputTerminalState();
+
+ lldb::SBCommandInterpreter GetCommandInterpreter();
+
+ void HandleCommand(const char *command);
+
+ lldb::SBListener GetListener();
+
+ void HandleProcessEvent(const lldb::SBProcess &process,
+ const lldb::SBEvent &event, FILE *out, FILE *err);
+
+ lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
+ const char *platform_name,
+ bool add_dependent_modules, lldb::SBError &error);
+
+ lldb::SBTarget CreateTargetWithFileAndTargetTriple(const char *filename,
+ const char *target_triple);
+
+ lldb::SBTarget CreateTargetWithFileAndArch(const char *filename,
+ const char *archname);
+
+ lldb::SBTarget CreateTarget(const char *filename);
+
+ lldb::SBTarget GetDummyTarget();
+
+ // Return true if target is deleted from the target list of the debugger.
+ bool DeleteTarget(lldb::SBTarget &target);
+
+ lldb::SBTarget GetTargetAtIndex(uint32_t idx);
+
+ uint32_t GetIndexOfTarget(lldb::SBTarget target);
+
+ lldb::SBTarget FindTargetWithProcessID(pid_t pid);
+
+ lldb::SBTarget FindTargetWithFileAndArch(const char *filename,
+ const char *arch);
+
+ uint32_t GetNumTargets();
+
+ lldb::SBTarget GetSelectedTarget();
+
+ void SetSelectedTarget(SBTarget &target);
+
+ lldb::SBPlatform GetSelectedPlatform();
+
+ void SetSelectedPlatform(lldb::SBPlatform &platform);
+
+ /// Get the number of currently active platforms.
+ uint32_t GetNumPlatforms();
+
+ /// Get one of the currently active platforms.
+ lldb::SBPlatform GetPlatformAtIndex(uint32_t idx);
+
+ /// Get the number of available platforms.
+ ///
+ /// The return value should match the number of entries output by the
+ /// "platform list" command.
+ uint32_t GetNumAvailablePlatforms();
+
+ /// Get the name and description of one of the available platforms.
+ ///
+ /// \param[in] idx
+ /// Zero-based index of the platform for which info should be retrieved,
+ /// must be less than the value returned by GetNumAvailablePlatforms().
+ lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx);
+
+ lldb::SBSourceManager GetSourceManager();
+
+ // REMOVE: just for a quick fix, need to expose platforms through
+ // SBPlatform from this class.
+ lldb::SBError SetCurrentPlatform(const char *platform_name);
+
+ bool SetCurrentPlatformSDKRoot(const char *sysroot);
+
+ // FIXME: Once we get the set show stuff in place, the driver won't need
+ // an interface to the Set/Get UseExternalEditor.
+ bool SetUseExternalEditor(bool input);
+
+ bool GetUseExternalEditor();
+
+ bool SetUseColor(bool use_color);
+
+ bool GetUseColor() const;
+
+ static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
+
+ static bool SetDefaultArchitecture(const char *arch_name);
+
+ lldb::ScriptLanguage GetScriptingLanguage(const char *script_language_name);
+
+ static const char *GetVersionString();
+
+ static const char *StateAsCString(lldb::StateType state);
+
+ static SBStructuredData GetBuildConfiguration();
+
+ static bool StateIsRunningState(lldb::StateType state);
+
+ static bool StateIsStoppedState(lldb::StateType state);
+
+ bool EnableLog(const char *channel, const char **categories);
+
+ void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
+
+ // DEPRECATED
+ void DispatchInput(void *baton, const void *data, size_t data_len);
+
+ void DispatchInput(const void *data, size_t data_len);
+
+ void DispatchInputInterrupt();
+
+ void DispatchInputEndOfFile();
+
+ void PushInputReader(lldb::SBInputReader &reader);
+
+ const char *GetInstanceName();
+
+ static SBDebugger FindDebuggerWithID(int id);
+
+ static lldb::SBError SetInternalVariable(const char *var_name,
+ const char *value,
+ const char *debugger_instance_name);
+
+ static lldb::SBStringList
+ GetInternalVariableValue(const char *var_name,
+ const char *debugger_instance_name);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ uint32_t GetTerminalWidth() const;
+
+ void SetTerminalWidth(uint32_t term_width);
+
+ lldb::user_id_t GetID();
+
+ const char *GetPrompt() const;
+
+ void SetPrompt(const char *prompt);
+
+ const char *GetReproducerPath() const;
+
+ lldb::ScriptLanguage GetScriptLanguage() const;
+
+ void SetScriptLanguage(lldb::ScriptLanguage script_lang);
+
+ bool GetCloseInputOnEOF() const;
+
+ void SetCloseInputOnEOF(bool b);
+
+ SBTypeCategory GetCategory(const char *category_name);
+
+ SBTypeCategory GetCategory(lldb::LanguageType lang_type);
+
+ SBTypeCategory CreateCategory(const char *category_name);
+
+ bool DeleteCategory(const char *category_name);
+
+ uint32_t GetNumCategories();
+
+ SBTypeCategory GetCategoryAtIndex(uint32_t);
+
+ SBTypeCategory GetDefaultCategory();
+
+ SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
+
+ SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
+
+ SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
+
+ SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
+
+ void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
+
+ void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
+ SBCommandInterpreterRunOptions &options,
+ int &num_errors, bool &quit_requested,
+ bool &stopped_for_crash);
+
+ SBError RunREPL(lldb::LanguageType language, const char *repl_options);
+
+private:
+ friend class SBCommandInterpreter;
+ friend class SBInputReader;
+ friend class SBListener;
+ friend class SBProcess;
+ friend class SBSourceManager;
+ friend class SBTarget;
+
+ lldb::SBTarget FindTargetWithLLDBProcess(const lldb::ProcessSP &processSP);
+
+ void reset(const lldb::DebuggerSP &debugger_sp);
+
+ lldb_private::Debugger *get() const;
+
+ lldb_private::Debugger &ref() const;
+
+ const lldb::DebuggerSP &get_sp() const;
+
+ lldb::DebuggerSP m_opaque_sp;
+
+}; // class SBDebugger
+
+} // namespace lldb
+
+#endif // LLDB_SBDebugger_h_
diff --git a/linux-x64/clang/include/lldb/API/SBDeclaration.h b/linux-x64/clang/include/lldb/API/SBDeclaration.h
new file mode 100644
index 0000000..d2b423e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBDeclaration.h
@@ -0,0 +1,71 @@
+//===-- SBDeclaration.h -------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBDeclaration_h_
+#define LLDB_SBDeclaration_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+
+namespace lldb {
+
+class LLDB_API SBDeclaration {
+public:
+ SBDeclaration();
+
+ SBDeclaration(const lldb::SBDeclaration &rhs);
+
+ ~SBDeclaration();
+
+ const lldb::SBDeclaration &operator=(const lldb::SBDeclaration &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBFileSpec GetFileSpec() const;
+
+ uint32_t GetLine() const;
+
+ uint32_t GetColumn() const;
+
+ void SetFileSpec(lldb::SBFileSpec filespec);
+
+ void SetLine(uint32_t line);
+
+ void SetColumn(uint32_t column);
+
+ bool operator==(const lldb::SBDeclaration &rhs) const;
+
+ bool operator!=(const lldb::SBDeclaration &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ lldb_private::Declaration *get();
+
+private:
+ friend class SBValue;
+
+ const lldb_private::Declaration *operator->() const;
+
+ lldb_private::Declaration &ref();
+
+ const lldb_private::Declaration &ref() const;
+
+ SBDeclaration(const lldb_private::Declaration *lldb_object_ptr);
+
+ void SetDeclaration(const lldb_private::Declaration &lldb_object_ref);
+
+ std::unique_ptr<lldb_private::Declaration> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBDeclaration_h_
diff --git a/linux-x64/clang/include/lldb/API/SBDefines.h b/linux-x64/clang/include/lldb/API/SBDefines.h
new file mode 100644
index 0000000..838c84c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBDefines.h
@@ -0,0 +1,101 @@
+//===-- SBDefines.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBDefines_h_
+#define LLDB_SBDefines_h_
+
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+#include "lldb/lldb-versioning.h"
+
+// Forward Declarations
+namespace lldb {
+
+class LLDB_API SBAddress;
+class LLDB_API SBBlock;
+class LLDB_API SBBreakpoint;
+class LLDB_API SBBreakpointLocation;
+class LLDB_API SBBreakpointName;
+class LLDB_API SBBreakpointNameImpl;
+class LLDB_API SBBroadcaster;
+class LLDB_API SBCommand;
+class LLDB_API SBCommandInterpreter;
+class LLDB_API SBCommandInterpreterRunOptions;
+class LLDB_API SBCommandPluginInterface;
+class LLDB_API SBCommandReturnObject;
+class LLDB_API SBCommunication;
+class LLDB_API SBCompileUnit;
+class LLDB_API SBData;
+class LLDB_API SBDebugger;
+class LLDB_API SBDeclaration;
+class LLDB_API SBError;
+class LLDB_API SBEvent;
+class LLDB_API SBEventList;
+class LLDB_API SBExecutionContext;
+class LLDB_API SBExpressionOptions;
+class LLDB_API SBFileSpec;
+class LLDB_API SBFileSpecList;
+class LLDB_API SBFrame;
+class LLDB_API SBFunction;
+class LLDB_API SBHostOS;
+class LLDB_API SBInstruction;
+class LLDB_API SBInstructionList;
+class LLDB_API SBLanguageRuntime;
+class LLDB_API SBLaunchInfo;
+class LLDB_API SBLineEntry;
+class LLDB_API SBListener;
+class LLDB_API SBMemoryRegionInfo;
+class LLDB_API SBMemoryRegionInfoList;
+class LLDB_API SBModule;
+class LLDB_API SBModuleSpec;
+class LLDB_API SBModuleSpecList;
+class LLDB_API SBProcess;
+class LLDB_API SBProcessInfo;
+class LLDB_API SBQueue;
+class LLDB_API SBQueueItem;
+class LLDB_API SBSection;
+class LLDB_API SBSourceManager;
+class LLDB_API SBStream;
+class LLDB_API SBStringList;
+class LLDB_API SBStructuredData;
+class LLDB_API SBSymbol;
+class LLDB_API SBSymbolContext;
+class LLDB_API SBSymbolContextList;
+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;
+class LLDB_API SBTypeEnumMemberList;
+class LLDB_API SBTypeFilter;
+class LLDB_API SBTypeFormat;
+class LLDB_API SBTypeMemberFunction;
+class LLDB_API SBTypeNameSpecifier;
+class LLDB_API SBTypeSummary;
+class LLDB_API SBTypeSummaryOptions;
+class LLDB_API SBTypeSynthetic;
+class LLDB_API SBTypeList;
+class LLDB_API SBValue;
+class LLDB_API SBValueList;
+class LLDB_API SBVariablesOptions;
+class LLDB_API SBWatchpoint;
+class LLDB_API SBUnixSignals;
+
+typedef bool (*SBBreakpointHitCallback)(void *baton, SBProcess &process,
+ SBThread &thread,
+ lldb::SBBreakpointLocation &location);
+}
+
+#endif // LLDB_SBDefines_h_
diff --git a/linux-x64/clang/include/lldb/API/SBError.h b/linux-x64/clang/include/lldb/API/SBError.h
new file mode 100644
index 0000000..b076f87
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBError.h
@@ -0,0 +1,92 @@
+//===-- SBError.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBError_h_
+#define LLDB_SBError_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBError {
+public:
+ SBError();
+
+ SBError(const lldb::SBError &rhs);
+
+ ~SBError();
+
+ const SBError &operator=(const lldb::SBError &rhs);
+
+ const char *GetCString() const;
+
+ void Clear();
+
+ bool Fail() const;
+
+ bool Success() const;
+
+ uint32_t GetError() const;
+
+ lldb::ErrorType GetType() const;
+
+ void SetError(uint32_t err, lldb::ErrorType type);
+
+ void SetErrorToErrno();
+
+ void SetErrorToGenericError();
+
+ void SetErrorString(const char *err_str);
+
+ int SetErrorStringWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
+ friend class SBCommandReturnObject;
+ friend class SBCommunication;
+ friend class SBData;
+ friend class SBDebugger;
+ friend class SBHostOS;
+ friend class SBPlatform;
+ friend class SBProcess;
+ friend class SBReproducer;
+ friend class SBStructuredData;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBTrace;
+ friend class SBValue;
+ friend class SBWatchpoint;
+
+ lldb_private::Status *get();
+
+ lldb_private::Status *operator->();
+
+ const lldb_private::Status &operator*() const;
+
+ lldb_private::Status &ref();
+
+ void SetError(const lldb_private::Status &lldb_error);
+
+private:
+ std::unique_ptr<lldb_private::Status> m_opaque_up;
+
+ void CreateIfNeeded();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBError_h_
diff --git a/linux-x64/clang/include/lldb/API/SBEvent.h b/linux-x64/clang/include/lldb/API/SBEvent.h
new file mode 100644
index 0000000..d297cbe
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBEvent.h
@@ -0,0 +1,87 @@
+//===-- SBEvent.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBEvent_h_
+#define LLDB_SBEvent_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+#include <vector>
+
+namespace lldb {
+
+class SBBroadcaster;
+
+class LLDB_API SBEvent {
+public:
+ SBEvent();
+
+ SBEvent(const lldb::SBEvent &rhs);
+
+ // Make an event that contains a C string.
+ SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len);
+
+ SBEvent(lldb::EventSP &event_sp);
+
+ SBEvent(lldb_private::Event *event_sp);
+
+ ~SBEvent();
+
+ const SBEvent &operator=(const lldb::SBEvent &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetDataFlavor();
+
+ uint32_t GetType() const;
+
+ lldb::SBBroadcaster GetBroadcaster() const;
+
+ const char *GetBroadcasterClass() const;
+
+ bool BroadcasterMatchesPtr(const lldb::SBBroadcaster *broadcaster);
+
+ bool BroadcasterMatchesRef(const lldb::SBBroadcaster &broadcaster);
+
+ void Clear();
+
+ static const char *GetCStringFromEvent(const lldb::SBEvent &event);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+protected:
+ friend class SBListener;
+ friend class SBBroadcaster;
+ friend class SBBreakpoint;
+ friend class SBDebugger;
+ friend class SBProcess;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBWatchpoint;
+
+ lldb::EventSP &GetSP() const;
+
+ void reset(lldb::EventSP &event_sp);
+
+ void reset(lldb_private::Event *event);
+
+ lldb_private::Event *get() const;
+
+private:
+ mutable lldb::EventSP m_event_sp;
+ mutable lldb_private::Event *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBEvent_h_
diff --git a/linux-x64/clang/include/lldb/API/SBExecutionContext.h b/linux-x64/clang/include/lldb/API/SBExecutionContext.h
new file mode 100644
index 0000000..45c0b1b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBExecutionContext.h
@@ -0,0 +1,63 @@
+//===-- SBExecutionContext.h -----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBExecutionContext_h_
+#define LLDB_SBExecutionContext_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+#include <vector>
+
+namespace lldb {
+
+class LLDB_API SBExecutionContext {
+ friend class SBCommandInterpreter;
+
+public:
+ SBExecutionContext();
+
+ SBExecutionContext(const lldb::SBExecutionContext &rhs);
+
+ SBExecutionContext(lldb::ExecutionContextRefSP exe_ctx_ref_sp);
+
+ SBExecutionContext(const lldb::SBTarget &target);
+
+ SBExecutionContext(const lldb::SBProcess &process);
+
+ SBExecutionContext(lldb::SBThread thread); // can't be a const& because
+ // SBThread::get() isn't itself a
+ // const function
+
+ SBExecutionContext(const lldb::SBFrame &frame);
+
+ ~SBExecutionContext();
+
+ const SBExecutionContext &operator=(const lldb::SBExecutionContext &rhs);
+
+ SBTarget GetTarget() const;
+
+ SBProcess GetProcess() const;
+
+ SBThread GetThread() const;
+
+ SBFrame GetFrame() const;
+
+protected:
+ void reset(lldb::ExecutionContextRefSP &event_sp);
+
+ lldb_private::ExecutionContextRef *get() const;
+
+private:
+ mutable lldb::ExecutionContextRefSP m_exe_ctx_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBExecutionContext_h_
diff --git a/linux-x64/clang/include/lldb/API/SBExpressionOptions.h b/linux-x64/clang/include/lldb/API/SBExpressionOptions.h
new file mode 100644
index 0000000..04cd74f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBExpressionOptions.h
@@ -0,0 +1,115 @@
+//===-- SBExpressionOptions.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBExpressionOptions_h_
+#define LLDB_SBExpressionOptions_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <vector>
+
+namespace lldb {
+
+class LLDB_API SBExpressionOptions {
+public:
+ SBExpressionOptions();
+
+ SBExpressionOptions(const lldb::SBExpressionOptions &rhs);
+
+ ~SBExpressionOptions();
+
+ const SBExpressionOptions &operator=(const lldb::SBExpressionOptions &rhs);
+
+ bool GetCoerceResultToId() const;
+
+ void SetCoerceResultToId(bool coerce = true);
+
+ bool GetUnwindOnError() const;
+
+ void SetUnwindOnError(bool unwind = true);
+
+ bool GetIgnoreBreakpoints() const;
+
+ void SetIgnoreBreakpoints(bool ignore = true);
+
+ lldb::DynamicValueType GetFetchDynamicValue() const;
+
+ void SetFetchDynamicValue(
+ lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+
+ uint32_t GetTimeoutInMicroSeconds() const;
+
+ // Set the timeout for the expression, 0 means wait forever.
+ void SetTimeoutInMicroSeconds(uint32_t timeout = 0);
+
+ uint32_t GetOneThreadTimeoutInMicroSeconds() const;
+
+ // Set the timeout for running on one thread, 0 means use the default
+ // behavior. If you set this higher than the overall timeout, you'll get an
+ // error when you try to run the expression.
+ void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);
+
+ bool GetTryAllThreads() const;
+
+ void SetTryAllThreads(bool run_others = true);
+
+ bool GetStopOthers() const;
+
+ void SetStopOthers(bool stop_others = true);
+
+ bool GetTrapExceptions() const;
+
+ void SetTrapExceptions(bool trap_exceptions = true);
+
+ void SetLanguage(lldb::LanguageType language);
+
+ void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
+
+ bool GetGenerateDebugInfo();
+
+ void SetGenerateDebugInfo(bool b = true);
+
+ bool GetSuppressPersistentResult();
+
+ void SetSuppressPersistentResult(bool b = false);
+
+ const char *GetPrefix() const;
+
+ void SetPrefix(const char *prefix);
+
+ void SetAutoApplyFixIts(bool b = true);
+
+ bool GetAutoApplyFixIts();
+
+ bool GetTopLevel();
+
+ void SetTopLevel(bool b = true);
+
+ // Gets whether we will JIT an expression if it cannot be interpreted
+ bool GetAllowJIT();
+
+ // Sets whether we will JIT an expression if it cannot be interpreted
+ void SetAllowJIT(bool allow);
+
+protected:
+ lldb_private::EvaluateExpressionOptions *get() const;
+
+ lldb_private::EvaluateExpressionOptions &ref() const;
+
+ friend class SBFrame;
+ friend class SBValue;
+ friend class SBTarget;
+
+private:
+ // This auto_pointer is made in the constructor and is always valid.
+ mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBExpressionOptions_h_
diff --git a/linux-x64/clang/include/lldb/API/SBFileSpec.h b/linux-x64/clang/include/lldb/API/SBFileSpec.h
new file mode 100644
index 0000000..2714977
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBFileSpec.h
@@ -0,0 +1,95 @@
+//===-- SBFileSpec.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBFileSpec_h_
+#define LLDB_SBFileSpec_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBFileSpec {
+public:
+ SBFileSpec();
+
+ SBFileSpec(const lldb::SBFileSpec &rhs);
+
+ SBFileSpec(const char *path); // Deprecated, use SBFileSpec (const char *path,
+ // bool resolve)
+
+ SBFileSpec(const char *path, bool resolve);
+
+ ~SBFileSpec();
+
+ const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
+
+ explicit operator bool() const;
+
+ bool operator==(const SBFileSpec &rhs) const;
+
+ bool operator!=(const SBFileSpec &rhs) const;
+
+ bool IsValid() const;
+
+ bool Exists() const;
+
+ bool ResolveExecutableLocation();
+
+ const char *GetFilename() const;
+
+ const char *GetDirectory() const;
+
+ void SetFilename(const char *filename);
+
+ void SetDirectory(const char *directory);
+
+ uint32_t GetPath(char *dst_path, size_t dst_len) const;
+
+ static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+ void AppendPathComponent(const char *file_or_directory);
+
+private:
+ friend class SBAttachInfo;
+ friend class SBBlock;
+ friend class SBCommandInterpreter;
+ friend class SBCompileUnit;
+ friend class SBDeclaration;
+ friend class SBFileSpecList;
+ friend class SBHostOS;
+ friend class SBLaunchInfo;
+ friend class SBLineEntry;
+ friend class SBModule;
+ friend class SBModuleSpec;
+ friend class SBPlatform;
+ friend class SBProcess;
+ friend class SBProcessInfo;
+ friend class SBSourceManager;
+ friend class SBTarget;
+ friend class SBThread;
+
+ SBFileSpec(const lldb_private::FileSpec &fspec);
+
+ void SetFileSpec(const lldb_private::FileSpec &fspec);
+
+ const lldb_private::FileSpec *operator->() const;
+
+ const lldb_private::FileSpec *get() const;
+
+ const lldb_private::FileSpec &operator*() const;
+
+ const lldb_private::FileSpec &ref() const;
+
+ std::unique_ptr<lldb_private::FileSpec> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBFileSpec_h_
diff --git a/linux-x64/clang/include/lldb/API/SBFileSpecList.h b/linux-x64/clang/include/lldb/API/SBFileSpecList.h
new file mode 100644
index 0000000..5a13150
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBFileSpecList.h
@@ -0,0 +1,57 @@
+//===-- SBFileSpecList.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBFileSpecList_h_
+#define LLDB_SBFileSpecList_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBFileSpecList {
+public:
+ SBFileSpecList();
+
+ SBFileSpecList(const lldb::SBFileSpecList &rhs);
+
+ ~SBFileSpecList();
+
+ const SBFileSpecList &operator=(const lldb::SBFileSpecList &rhs);
+
+ uint32_t GetSize() const;
+
+ bool GetDescription(SBStream &description) const;
+
+ void Append(const SBFileSpec &sb_file);
+
+ bool AppendIfUnique(const SBFileSpec &sb_file);
+
+ void Clear();
+
+ uint32_t FindFileIndex(uint32_t idx, const SBFileSpec &sb_file, bool full);
+
+ const SBFileSpec GetFileSpecAtIndex(uint32_t idx) const;
+
+private:
+ friend class SBTarget;
+
+ const lldb_private::FileSpecList *operator->() const;
+
+ const lldb_private::FileSpecList *get() const;
+
+ const lldb_private::FileSpecList &operator*() const;
+
+ const lldb_private::FileSpecList &ref() const;
+
+ std::unique_ptr<lldb_private::FileSpecList> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBFileSpecList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBFrame.h b/linux-x64/clang/include/lldb/API/SBFrame.h
new file mode 100644
index 0000000..b213f89
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBFrame.h
@@ -0,0 +1,205 @@
+//===-- SBFrame.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBFrame_h_
+#define LLDB_SBFrame_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBValueList.h"
+
+namespace lldb {
+
+class LLDB_API SBFrame {
+public:
+ SBFrame();
+
+ SBFrame(const lldb::SBFrame &rhs);
+
+ const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
+
+ ~SBFrame();
+
+ bool IsEqual(const lldb::SBFrame &that) const;
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint32_t GetFrameID() const;
+
+ lldb::addr_t GetCFA() const;
+
+ lldb::addr_t GetPC() const;
+
+ bool SetPC(lldb::addr_t new_pc);
+
+ lldb::addr_t GetSP() const;
+
+ lldb::addr_t GetFP() const;
+
+ lldb::SBAddress GetPCAddress() const;
+
+ lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
+
+ lldb::SBModule GetModule() const;
+
+ lldb::SBCompileUnit GetCompileUnit() const;
+
+ lldb::SBFunction GetFunction() const;
+
+ lldb::SBSymbol GetSymbol() const;
+
+ /// Gets the deepest block that contains the frame PC.
+ ///
+ /// See also GetFrameBlock().
+ lldb::SBBlock GetBlock() const;
+
+ /// Get the appropriate function name for this frame. Inlined functions in
+ /// LLDB are represented by Blocks that have inlined function information, so
+ /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
+ /// This function will return the appropriate function, symbol or inlined
+ /// function name for the frame.
+ ///
+ /// This function returns:
+ /// - the name of the inlined function (if there is one)
+ /// - the name of the concrete function (if there is one)
+ /// - the name of the symbol (if there is one)
+ /// - NULL
+ ///
+ /// See also IsInlined().
+ const char *GetFunctionName();
+
+ // Get an appropriate function name for this frame that is suitable for
+ // display to a user
+ 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.
+ ///
+ /// See also GetFunctionName().
+ bool IsInlined();
+
+ bool IsInlined() const;
+
+ bool IsArtificial();
+
+ bool IsArtificial() const;
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue EvaluateExpression(const char *expr);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ lldb::DynamicValueType use_dynamic,
+ bool unwind_on_error);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options);
+
+ /// Gets the lexical block that defines the stack frame. Another way to think
+ /// of this is it will return the block that contains all of the variables
+ /// for a stack frame. Inlined functions are represented as SBBlock objects
+ /// that have inlined function information: the name of the inlined function,
+ /// where it was called from. The block that is returned will be the first
+ /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
+ /// the scope of the frame. When a function contains no inlined functions,
+ /// this will be the top most lexical block that defines the function.
+ /// When a function has inlined functions and the PC is currently
+ /// in one of those inlined functions, this method will return the inlined
+ /// block that defines this frame. If the PC isn't currently in an inlined
+ /// function, the lexical block that defines the function is returned.
+ lldb::SBBlock GetFrameBlock() const;
+
+ lldb::SBLineEntry GetLineEntry() const;
+
+ lldb::SBThread GetThread() const;
+
+ const char *Disassemble() const;
+
+ void Clear();
+
+ bool operator==(const lldb::SBFrame &rhs) const;
+
+ bool operator!=(const lldb::SBFrame &rhs) const;
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
+ bool in_scope_only);
+
+ lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
+ bool in_scope_only,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
+
+ lldb::SBValueList GetRegisters();
+
+ lldb::SBValue FindRegister(const char *name);
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue FindVariable(const char *var_name);
+
+ lldb::SBValue FindVariable(const char *var_name,
+ lldb::DynamicValueType use_dynamic);
+
+ // Find a value for a variable expression path like "rect.origin.x" or
+ // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
+ // expression result and is not a constant object like
+ // SBFrame::EvaluateExpression(...) returns, but a child object of the
+ // variable value.
+ lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
+ DynamicValueType use_dynamic);
+
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue GetValueForVariablePath(const char *var_path);
+
+ /// Find variables, register sets, registers, or persistent variables using
+ /// the frame as the scope.
+ ///
+ /// NB. This function does not look up ivars in the function object pointer.
+ /// To do that use GetValueForVariablePath.
+ ///
+ /// The version that doesn't supply a 'use_dynamic' value will use the
+ /// target's default.
+ lldb::SBValue FindValue(const char *name, ValueType value_type);
+
+ lldb::SBValue FindValue(const char *name, ValueType value_type,
+ lldb::DynamicValueType use_dynamic);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ SBFrame(const lldb::StackFrameSP &lldb_object_sp);
+
+protected:
+ friend class SBBlock;
+ friend class SBExecutionContext;
+ friend class SBInstruction;
+ friend class SBThread;
+ friend class SBValue;
+
+ lldb::StackFrameSP GetFrameSP() const;
+
+ void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
+
+ lldb::ExecutionContextRefSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBFrame_h_
diff --git a/linux-x64/clang/include/lldb/API/SBFunction.h b/linux-x64/clang/include/lldb/API/SBFunction.h
new file mode 100644
index 0000000..43f01d7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBFunction.h
@@ -0,0 +1,82 @@
+//===-- SBFunction.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBFunction_h_
+#define LLDB_SBFunction_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBInstructionList.h"
+
+namespace lldb {
+
+class LLDB_API SBFunction {
+public:
+ SBFunction();
+
+ SBFunction(const lldb::SBFunction &rhs);
+
+ const lldb::SBFunction &operator=(const lldb::SBFunction &rhs);
+
+ ~SBFunction();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName() const;
+
+ const char *GetDisplayName() const;
+
+ const char *GetMangledName() const;
+
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
+
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
+ const char *flavor);
+
+ lldb::SBAddress GetStartAddress();
+
+ lldb::SBAddress GetEndAddress();
+
+ const char *GetArgumentName(uint32_t arg_idx);
+
+ uint32_t GetPrologueByteSize();
+
+ lldb::SBType GetType();
+
+ lldb::SBBlock GetBlock();
+
+ lldb::LanguageType GetLanguage();
+
+ bool GetIsOptimized();
+
+ bool operator==(const lldb::SBFunction &rhs) const;
+
+ bool operator!=(const lldb::SBFunction &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ lldb_private::Function *get();
+
+ void reset(lldb_private::Function *lldb_object_ptr);
+
+private:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSymbolContext;
+
+ SBFunction(lldb_private::Function *lldb_object_ptr);
+
+ lldb_private::Function *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBFunction_h_
diff --git a/linux-x64/clang/include/lldb/API/SBHostOS.h b/linux-x64/clang/include/lldb/API/SBHostOS.h
new file mode 100644
index 0000000..ecd7920
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBHostOS.h
@@ -0,0 +1,44 @@
+//===-- SBHostOS.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBHostOS_h_
+#define LLDB_SBHostOS_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+
+namespace lldb {
+
+class LLDB_API SBHostOS {
+public:
+ static lldb::SBFileSpec GetProgramFileSpec();
+
+ static lldb::SBFileSpec GetLLDBPythonPath();
+
+ static lldb::SBFileSpec GetLLDBPath(lldb::PathType path_type);
+
+ static lldb::SBFileSpec GetUserHomeDirectory();
+
+ static void ThreadCreated(const char *name);
+
+ static lldb::thread_t ThreadCreate(const char *name,
+ lldb::thread_func_t thread_function,
+ void *thread_arg, lldb::SBError *err);
+
+ static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
+
+ static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+ static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
+ lldb::SBError *err);
+
+private:
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBHostOS_h_
diff --git a/linux-x64/clang/include/lldb/API/SBInstruction.h b/linux-x64/clang/include/lldb/API/SBInstruction.h
new file mode 100644
index 0000000..0bb5877
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBInstruction.h
@@ -0,0 +1,85 @@
+//===-- SBInstruction.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBInstruction_h_
+#define LLDB_SBInstruction_h_
+
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+
+// There's a lot to be fixed here, but need to wait for underlying insn
+// implementation to be revised & settle down first.
+
+class InstructionImpl;
+
+namespace lldb {
+
+class LLDB_API SBInstruction {
+public:
+ SBInstruction();
+
+ SBInstruction(const SBInstruction &rhs);
+
+ const SBInstruction &operator=(const SBInstruction &rhs);
+
+ ~SBInstruction();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ SBAddress GetAddress();
+
+ const char *GetMnemonic(lldb::SBTarget target);
+
+ const char *GetOperands(lldb::SBTarget target);
+
+ const char *GetComment(lldb::SBTarget target);
+
+ lldb::SBData GetData(lldb::SBTarget target);
+
+ size_t GetByteSize();
+
+ bool DoesBranch();
+
+ bool HasDelaySlot();
+
+ bool CanSetBreakpoint();
+
+ void Print(FILE *out);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
+
+ bool DumpEmulation(const char *triple); // triple is to specify the
+ // architecture, e.g. 'armv6' or
+ // 'armv7-apple-ios'
+
+ bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
+
+protected:
+ friend class SBInstructionList;
+
+ SBInstruction(const lldb::DisassemblerSP &disasm_sp,
+ const lldb::InstructionSP &inst_sp);
+
+ void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
+ const lldb::InstructionSP &inst_sp);
+
+ lldb::InstructionSP GetOpaque();
+
+private:
+ std::shared_ptr<InstructionImpl> m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBInstruction_h_
diff --git a/linux-x64/clang/include/lldb/API/SBInstructionList.h b/linux-x64/clang/include/lldb/API/SBInstructionList.h
new file mode 100644
index 0000000..4434d50
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBInstructionList.h
@@ -0,0 +1,66 @@
+//===-- SBInstructionList.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBInstructionList_h_
+#define LLDB_SBInstructionList_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+
+namespace lldb {
+
+class LLDB_API SBInstructionList {
+public:
+ SBInstructionList();
+
+ SBInstructionList(const SBInstructionList &rhs);
+
+ const SBInstructionList &operator=(const SBInstructionList &rhs);
+
+ ~SBInstructionList();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ size_t GetSize();
+
+ 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);
+
+ void Print(FILE *out);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool DumpEmulationForAllInstructions(const char *triple);
+
+protected:
+ friend class SBFunction;
+ friend class SBSymbol;
+ friend class SBTarget;
+
+ void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
+
+private:
+ lldb::DisassemblerSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBInstructionList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h b/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h
new file mode 100644
index 0000000..d28c441
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h
@@ -0,0 +1,25 @@
+//===-- SBLanguageRuntime.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBLanguageRuntime_h_
+#define LLDB_SBLanguageRuntime_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBLanguageRuntime {
+public:
+ static lldb::LanguageType GetLanguageTypeFromString(const char *string);
+
+ static const char *GetNameForLanguageType(lldb::LanguageType language);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBLanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/API/SBLaunchInfo.h b/linux-x64/clang/include/lldb/API/SBLaunchInfo.h
new file mode 100644
index 0000000..c7b381f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBLaunchInfo.h
@@ -0,0 +1,149 @@
+//===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBLaunchInfo_h_
+#define LLDB_SBLaunchInfo_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb_private {
+class SBLaunchInfoImpl;
+}
+
+namespace lldb {
+
+class SBPlatform;
+class SBTarget;
+
+class LLDB_API SBLaunchInfo {
+public:
+ SBLaunchInfo(const char **argv);
+
+ ~SBLaunchInfo();
+
+ lldb::pid_t GetProcessID();
+
+ uint32_t GetUserID();
+
+ uint32_t GetGroupID();
+
+ bool UserIDIsValid();
+
+ bool GroupIDIsValid();
+
+ void SetUserID(uint32_t uid);
+
+ void SetGroupID(uint32_t gid);
+
+ SBFileSpec GetExecutableFile();
+
+ /// Set the executable file that will be used to launch the process and
+ /// optionally set it as the first argument in the argument vector.
+ ///
+ /// This only needs to be specified if clients wish to carefully control
+ /// the exact path will be used to launch a binary. If you create a
+ /// target with a symlink, that symlink will get resolved in the target
+ /// and the resolved path will get used to launch the process. Calling
+ /// this function can help you still launch your process using the
+ /// path of your choice.
+ ///
+ /// If this function is not called prior to launching with
+ /// SBTarget::Launch(...), the target will use the resolved executable
+ /// path that was used to create the target.
+ ///
+ /// \param[in] exe_file
+ /// The override path to use when launching the executable.
+ ///
+ /// \param[in] add_as_first_arg
+ /// If true, then the path will be inserted into the argument vector
+ /// prior to launching. Otherwise the argument vector will be left
+ /// alone.
+ void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg);
+
+ /// 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
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ SBListener GetListener();
+
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ void SetListener(SBListener &listener);
+
+ uint32_t GetNumArguments();
+
+ const char *GetArgumentAtIndex(uint32_t idx);
+
+ void SetArguments(const char **argv, bool append);
+
+ uint32_t GetNumEnvironmentEntries();
+
+ const char *GetEnvironmentEntryAtIndex(uint32_t idx);
+
+ void SetEnvironmentEntries(const char **envp, bool append);
+
+ void Clear();
+
+ const char *GetWorkingDirectory() const;
+
+ void SetWorkingDirectory(const char *working_dir);
+
+ uint32_t GetLaunchFlags();
+
+ void SetLaunchFlags(uint32_t flags);
+
+ const char *GetProcessPluginName();
+
+ void SetProcessPluginName(const char *plugin_name);
+
+ const char *GetShell();
+
+ void SetShell(const char *path);
+
+ bool GetShellExpandArguments();
+
+ void SetShellExpandArguments(bool expand);
+
+ uint32_t GetResumeCount();
+
+ void SetResumeCount(uint32_t c);
+
+ bool AddCloseFileAction(int fd);
+
+ bool AddDuplicateFileAction(int fd, int dup_fd);
+
+ bool AddOpenFileAction(int fd, const char *path, bool read, bool write);
+
+ bool AddSuppressFileAction(int fd, bool read, bool write);
+
+ void SetLaunchEventData(const char *data);
+
+ const char *GetLaunchEventData() const;
+
+ bool GetDetachOnError() const;
+
+ void SetDetachOnError(bool enable);
+
+protected:
+ friend class SBPlatform;
+ friend class SBTarget;
+
+ const lldb_private::ProcessLaunchInfo &ref() const;
+ void set_ref(const lldb_private::ProcessLaunchInfo &info);
+
+ std::shared_ptr<lldb_private::SBLaunchInfoImpl> m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBLaunchInfo_h_
diff --git a/linux-x64/clang/include/lldb/API/SBLineEntry.h b/linux-x64/clang/include/lldb/API/SBLineEntry.h
new file mode 100644
index 0000000..855c28d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBLineEntry.h
@@ -0,0 +1,78 @@
+//===-- SBLineEntry.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBLineEntry_h_
+#define LLDB_SBLineEntry_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+
+namespace lldb {
+
+class LLDB_API SBLineEntry {
+public:
+ SBLineEntry();
+
+ SBLineEntry(const lldb::SBLineEntry &rhs);
+
+ ~SBLineEntry();
+
+ const lldb::SBLineEntry &operator=(const lldb::SBLineEntry &rhs);
+
+ lldb::SBAddress GetStartAddress() const;
+
+ lldb::SBAddress GetEndAddress() const;
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBFileSpec GetFileSpec() const;
+
+ uint32_t GetLine() const;
+
+ uint32_t GetColumn() const;
+
+ void SetFileSpec(lldb::SBFileSpec filespec);
+
+ void SetLine(uint32_t line);
+
+ void SetColumn(uint32_t column);
+
+ bool operator==(const lldb::SBLineEntry &rhs) const;
+
+ bool operator!=(const lldb::SBLineEntry &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ lldb_private::LineEntry *get();
+
+private:
+ friend class SBAddress;
+ friend class SBCompileUnit;
+ friend class SBFrame;
+ friend class SBSymbolContext;
+
+ const lldb_private::LineEntry *operator->() const;
+
+ lldb_private::LineEntry &ref();
+
+ const lldb_private::LineEntry &ref() const;
+
+ SBLineEntry(const lldb_private::LineEntry *lldb_object_ptr);
+
+ void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref);
+
+ std::unique_ptr<lldb_private::LineEntry> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBLineEntry_h_
diff --git a/linux-x64/clang/include/lldb/API/SBListener.h b/linux-x64/clang/include/lldb/API/SBListener.h
new file mode 100644
index 0000000..21aface
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBListener.h
@@ -0,0 +1,108 @@
+//===-- SBListener.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBListener_h_
+#define LLDB_SBListener_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBListener {
+public:
+ SBListener();
+
+ SBListener(const char *name);
+
+ SBListener(const SBListener &rhs);
+
+ ~SBListener();
+
+ const lldb::SBListener &operator=(const lldb::SBListener &rhs);
+
+ void AddEvent(const lldb::SBEvent &event);
+
+ void Clear();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint32_t StartListeningForEventClass(SBDebugger &debugger,
+ const char *broadcaster_class,
+ uint32_t event_mask);
+
+ bool StopListeningForEventClass(SBDebugger &debugger,
+ const char *broadcaster_class,
+ uint32_t event_mask);
+
+ uint32_t StartListeningForEvents(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_mask);
+
+ bool StopListeningForEvents(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_mask);
+
+ // Returns true if an event was received, false if we timed out.
+ bool WaitForEvent(uint32_t num_seconds, lldb::SBEvent &event);
+
+ bool WaitForEventForBroadcaster(uint32_t num_seconds,
+ const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
+
+ bool WaitForEventForBroadcasterWithType(
+ uint32_t num_seconds, const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_type_mask, lldb::SBEvent &sb_event);
+
+ bool PeekAtNextEvent(lldb::SBEvent &sb_event);
+
+ bool PeekAtNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
+
+ bool
+ PeekAtNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_type_mask,
+ lldb::SBEvent &sb_event);
+
+ bool GetNextEvent(lldb::SBEvent &sb_event);
+
+ bool GetNextEventForBroadcaster(const lldb::SBBroadcaster &broadcaster,
+ lldb::SBEvent &sb_event);
+
+ bool
+ GetNextEventForBroadcasterWithType(const lldb::SBBroadcaster &broadcaster,
+ uint32_t event_type_mask,
+ lldb::SBEvent &sb_event);
+
+ bool HandleBroadcastEvent(const lldb::SBEvent &event);
+
+protected:
+ friend class SBAttachInfo;
+ friend class SBBroadcaster;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+ friend class SBLaunchInfo;
+ friend class SBTarget;
+
+ SBListener(const lldb::ListenerSP &listener_sp);
+
+ lldb::ListenerSP GetSP();
+
+private:
+ lldb_private::Listener *operator->() const;
+
+ lldb_private::Listener *get() const;
+
+ void reset(lldb::ListenerSP listener_sp);
+
+ lldb::ListenerSP m_opaque_sp;
+ lldb_private::Listener *m_unused_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBListener_h_
diff --git a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h
new file mode 100644
index 0000000..2a9ae94
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h
@@ -0,0 +1,98 @@
+//===-- SBMemoryRegionInfo.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBMemoryRegionInfo_h_
+#define LLDB_SBMemoryRegionInfo_h_
+
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBMemoryRegionInfo {
+public:
+ SBMemoryRegionInfo();
+
+ SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
+
+ ~SBMemoryRegionInfo();
+
+ const lldb::SBMemoryRegionInfo &
+ operator=(const lldb::SBMemoryRegionInfo &rhs);
+
+ void Clear();
+
+ /// Get the base address of this memory range.
+ ///
+ /// \return
+ /// The base address of this memory range.
+ lldb::addr_t GetRegionBase();
+
+ /// Get the end address of this memory range.
+ ///
+ /// \return
+ /// The base address of this memory range.
+ lldb::addr_t GetRegionEnd();
+
+ /// Check if this memory address is marked readable to the process.
+ ///
+ /// \return
+ /// true if this memory address is marked readable
+ bool IsReadable();
+
+ /// Check if this memory address is marked writable to the process.
+ ///
+ /// \return
+ /// true if this memory address is marked writable
+ bool IsWritable();
+
+ /// Check if this memory address is marked executable to the process.
+ ///
+ /// \return
+ /// true if this memory address is marked executable
+ bool IsExecutable();
+
+ /// Check if this memory address is mapped into the process address
+ /// space.
+ ///
+ /// \return
+ /// true if this memory address is in the process address space.
+ bool IsMapped();
+
+ /// Returns the name of the memory region mapped at the given
+ /// address.
+ ///
+ /// \return
+ /// In case of memory mapped files it is the absolute path of
+ /// the file otherwise it is a name associated with the memory
+ /// region. If no name can be determined the returns nullptr.
+ const char *GetName();
+
+ bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
+
+ bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBProcess;
+ friend class SBMemoryRegionInfoList;
+
+ lldb_private::MemoryRegionInfo &ref();
+
+ const lldb_private::MemoryRegionInfo &ref() const;
+
+ // Unused.
+ SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
+
+ lldb::MemoryRegionInfoUP m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBMemoryRegionInfo_h_
diff --git a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h
new file mode 100644
index 0000000..5592efe
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h
@@ -0,0 +1,55 @@
+//===-- SBMemoryRegionInfoList.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBMemoryRegionInfoList_h_
+#define LLDB_SBMemoryRegionInfoList_h_
+
+#include "lldb/API/SBDefines.h"
+
+class MemoryRegionInfoListImpl;
+
+namespace lldb {
+
+class LLDB_API SBMemoryRegionInfoList {
+public:
+ SBMemoryRegionInfoList();
+
+ SBMemoryRegionInfoList(const lldb::SBMemoryRegionInfoList &rhs);
+
+ const SBMemoryRegionInfoList &operator=(const SBMemoryRegionInfoList &rhs);
+
+ ~SBMemoryRegionInfoList();
+
+ uint32_t GetSize() const;
+
+ bool GetMemoryRegionAtIndex(uint32_t idx, SBMemoryRegionInfo ®ion_info);
+
+ void Append(lldb::SBMemoryRegionInfo ®ion);
+
+ void Append(lldb::SBMemoryRegionInfoList ®ion_list);
+
+ void Clear();
+
+protected:
+ const MemoryRegionInfoListImpl *operator->() const;
+
+ const MemoryRegionInfoListImpl &operator*() const;
+
+private:
+ friend class SBProcess;
+
+ lldb_private::MemoryRegionInfos &ref();
+
+ const lldb_private::MemoryRegionInfos &ref() const;
+
+ std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBMemoryRegionInfoList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBModule.h b/linux-x64/clang/include/lldb/API/SBModule.h
new file mode 100644
index 0000000..d2b6a18
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBModule.h
@@ -0,0 +1,309 @@
+//===-- SBModule.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBModule_h_
+#define LLDB_SBModule_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBSection.h"
+#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBValueList.h"
+
+namespace lldb {
+
+class LLDB_API SBModule {
+public:
+ SBModule();
+
+ SBModule(const SBModule &rhs);
+
+ SBModule(const SBModuleSpec &module_spec);
+
+ const SBModule &operator=(const SBModule &rhs);
+
+ SBModule(lldb::SBProcess &process, lldb::addr_t header_addr);
+
+ ~SBModule();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ /// Get const accessor for the module file specification.
+ ///
+ /// This function returns the file for the module on the host system
+ /// that is running LLDB. This can differ from the path on the
+ /// platform since we might be doing remote debugging.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ lldb::SBFileSpec GetFileSpec() const;
+
+ /// Get accessor for the module platform file specification.
+ ///
+ /// Platform file refers to the path of the module as it is known on
+ /// the remote system on which it is being debugged. For local
+ /// debugging this is always the same as Module::GetFileSpec(). But
+ /// remote debugging might mention a file '/usr/lib/liba.dylib'
+ /// which might be locally downloaded and cached. In this case the
+ /// platform file could be something like:
+ /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
+ /// The file could also be cached in a local developer kit directory.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ lldb::SBFileSpec GetPlatformFileSpec() const;
+
+ bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file);
+
+ /// Get accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// \return
+ /// A file specification object.
+ lldb::SBFileSpec GetRemoteInstallFileSpec();
+
+ /// Set accessor for the remote install path for a module.
+ ///
+ /// When debugging to a remote platform by connecting to a remote
+ /// platform, the install path of the module can be set. If the
+ /// install path is set, every time the process is about to launch
+ /// the target will install this module on the remote platform prior
+ /// to launching.
+ ///
+ /// If \a file specifies a full path to an install location, the
+ /// module will be installed to this path. If the path is relative
+ /// (no directory specified, or the path is partial like "usr/lib"
+ /// or "./usr/lib", then the install path will be resolved using
+ /// the platform's current working directory as the base path.
+ ///
+ /// \param[in] file
+ /// A file specification object.
+ bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file);
+
+ lldb::ByteOrder GetByteOrder();
+
+ uint32_t GetAddressByteSize();
+
+ const char *GetTriple();
+
+ const uint8_t *GetUUIDBytes() const;
+
+ const char *GetUUIDString() const;
+
+ bool operator==(const lldb::SBModule &rhs) const;
+
+ bool operator!=(const lldb::SBModule &rhs) const;
+
+ lldb::SBSection FindSection(const char *sect_name);
+
+ lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr);
+
+ lldb::SBSymbolContext
+ ResolveSymbolContextForAddress(const lldb::SBAddress &addr,
+ uint32_t resolve_scope);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ uint32_t GetNumCompileUnits();
+
+ lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
+
+ /// Find compile units related to *this module and passed source
+ /// file.
+ ///
+ /// \param[in] sb_file_spec
+ /// A lldb::SBFileSpec object that contains source file
+ /// specification.
+ ///
+ /// \return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ lldb::SBSymbolContextList
+ FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
+
+ size_t GetNumSymbols();
+
+ lldb::SBSymbol GetSymbolAtIndex(size_t idx);
+
+ lldb::SBSymbol FindSymbol(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ lldb::SBSymbolContextList FindSymbols(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ size_t GetNumSections();
+
+ lldb::SBSection GetSectionAtIndex(size_t idx);
+ /// Find functions by name.
+ ///
+ /// \param[in] name
+ /// The name of the function we are looking for.
+ ///
+ /// \param[in] name_type_mask
+ /// A logical OR of one or more FunctionNameType enum bits that
+ /// indicate what kind of names should be used when doing the
+ /// lookup. Bits include fully qualified names, base names,
+ /// C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
+ /// \return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ lldb::SBSymbolContextList
+ FindFunctions(const char *name,
+ uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
+
+ /// Find global and static variables by name.
+ ///
+ /// \param[in] target
+ /// A valid SBTarget instance representing the debuggee.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// \return
+ /// A list of matched variables in an SBValueList.
+ lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target,
+ const char *name, uint32_t max_matches);
+
+ /// Find the first global (or static) variable by name.
+ ///
+ /// \param[in] target
+ /// A valid SBTarget instance representing the debuggee.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \return
+ /// An SBValue that gets filled in with the found variable (if any).
+ lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target,
+ const char *name);
+
+ lldb::SBType FindFirstType(const char *name);
+
+ lldb::SBTypeList FindTypes(const char *type);
+
+ /// Get a type using its type ID.
+ ///
+ /// Each symbol file reader will assign different user IDs to their
+ /// types, but it is sometimes useful when debugging type issues to
+ /// be able to grab a type using its type ID.
+ ///
+ /// For DWARF debug info, the type ID is the DIE offset.
+ ///
+ /// \param[in] uid
+ /// The type user ID.
+ ///
+ /// \return
+ /// An SBType for the given type ID, or an empty SBType if the
+ /// type was not found.
+ lldb::SBType GetTypeByID(lldb::user_id_t uid);
+
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ /// Get all types matching \a type_mask from debug info in this
+ /// module.
+ ///
+ /// \param[in] type_mask
+ /// A bitfield that consists of one or more bits logically OR'ed
+ /// together from the lldb::TypeClass enumeration. This allows
+ /// you to request only structure types, or only class, struct
+ /// and union types. Passing in lldb::eTypeClassAny will return
+ /// all types found in the debug information for this module.
+ ///
+ /// \return
+ /// A list of types in this module that match \a type_mask
+ lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
+
+ /// Get the module version numbers.
+ ///
+ /// Many object files have a set of version numbers that describe
+ /// the version of the executable or shared library. Typically there
+ /// are major, minor and build, but there may be more. This function
+ /// will extract the versions from object files if they are available.
+ ///
+ /// If \a versions is NULL, or if \a num_versions is 0, the return
+ /// value will indicate how many version numbers are available in
+ /// this object file. Then a subsequent call can be made to this
+ /// function with a value of \a versions and \a num_versions that
+ /// has enough storage to store some or all version numbers.
+ ///
+ /// \param[out] versions
+ /// A pointer to an array of uint32_t types that is \a num_versions
+ /// long. If this value is NULL, the return value will indicate
+ /// how many version numbers are required for a subsequent call
+ /// to this function so that all versions can be retrieved. If
+ /// the value is non-NULL, then at most \a num_versions of the
+ /// existing versions numbers will be filled into \a versions.
+ /// If there is no version information available, \a versions
+ /// will be filled with \a num_versions UINT32_MAX values
+ /// and zero will be returned.
+ ///
+ /// \param[in] num_versions
+ /// The maximum number of entries to fill into \a versions. If
+ /// this value is zero, then the return value will indicate
+ /// how many version numbers there are in total so another call
+ /// to this function can be make with adequate storage in
+ /// \a versions to get all of the version numbers. If \a
+ /// num_versions is less than the actual number of version
+ /// numbers in this object file, only \a num_versions will be
+ /// filled into \a versions (if \a versions is non-NULL).
+ ///
+ /// \return
+ /// This function always returns the number of version numbers
+ /// that this object file has regardless of the number of
+ /// version numbers that were copied into \a versions.
+ uint32_t GetVersion(uint32_t *versions, uint32_t num_versions);
+
+ /// Get accessor for the symbol file specification.
+ ///
+ /// When debugging an object file an additional debug information can
+ /// be provided in separate file. Therefore if you debugging something
+ /// like '/usr/lib/liba.dylib' then debug information can be located
+ /// in folder like '/usr/lib/liba.dylib.dSYM/'.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ lldb::SBFileSpec GetSymbolFileSpec() const;
+
+ lldb::SBAddress GetObjectFileHeaderAddress() const;
+ lldb::SBAddress GetObjectFileEntryPointAddress() const;
+
+private:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBSection;
+ friend class SBSymbolContext;
+ friend class SBTarget;
+
+ explicit SBModule(const lldb::ModuleSP &module_sp);
+
+ ModuleSP GetSP() const;
+
+ void SetSP(const ModuleSP &module_sp);
+
+ lldb::ModuleSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBModule_h_
diff --git a/linux-x64/clang/include/lldb/API/SBModuleSpec.h b/linux-x64/clang/include/lldb/API/SBModuleSpec.h
new file mode 100644
index 0000000..29b3117
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBModuleSpec.h
@@ -0,0 +1,122 @@
+//===-- SBModuleSpec.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBModuleSpec_h_
+#define LLDB_SBModuleSpec_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+
+namespace lldb {
+
+class LLDB_API SBModuleSpec {
+public:
+ SBModuleSpec();
+
+ SBModuleSpec(const SBModuleSpec &rhs);
+
+ ~SBModuleSpec();
+
+ const SBModuleSpec &operator=(const SBModuleSpec &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ /// Get const accessor for the module file.
+ ///
+ /// This function returns the file for the module on the host system
+ /// that is running LLDB. This can differ from the path on the
+ /// platform since we might be doing remote debugging.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ lldb::SBFileSpec GetFileSpec();
+
+ void SetFileSpec(const lldb::SBFileSpec &fspec);
+
+ /// Get accessor for the module platform file.
+ ///
+ /// Platform file refers to the path of the module as it is known on
+ /// the remote system on which it is being debugged. For local
+ /// debugging this is always the same as Module::GetFileSpec(). But
+ /// remote debugging might mention a file '/usr/lib/liba.dylib'
+ /// which might be locally downloaded and cached. In this case the
+ /// platform file could be something like:
+ /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
+ /// The file could also be cached in a local developer kit directory.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ lldb::SBFileSpec GetPlatformFileSpec();
+
+ void SetPlatformFileSpec(const lldb::SBFileSpec &fspec);
+
+ lldb::SBFileSpec GetSymbolFileSpec();
+
+ void SetSymbolFileSpec(const lldb::SBFileSpec &fspec);
+
+ const char *GetObjectName();
+
+ void SetObjectName(const char *name);
+
+ const char *GetTriple();
+
+ void SetTriple(const char *triple);
+
+ const uint8_t *GetUUIDBytes();
+
+ size_t GetUUIDLength();
+
+ bool SetUUIDBytes(const uint8_t *uuid, size_t uuid_len);
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBModuleSpecList;
+ friend class SBModule;
+ friend class SBTarget;
+
+ std::unique_ptr<lldb_private::ModuleSpec> m_opaque_up;
+};
+
+class SBModuleSpecList {
+public:
+ SBModuleSpecList();
+
+ SBModuleSpecList(const SBModuleSpecList &rhs);
+
+ ~SBModuleSpecList();
+
+ SBModuleSpecList &operator=(const SBModuleSpecList &rhs);
+
+ static SBModuleSpecList GetModuleSpecifications(const char *path);
+
+ void Append(const SBModuleSpec &spec);
+
+ void Append(const SBModuleSpecList &spec_list);
+
+ SBModuleSpec FindFirstMatchingSpec(const SBModuleSpec &match_spec);
+
+ SBModuleSpecList FindMatchingSpecs(const SBModuleSpec &match_spec);
+
+ size_t GetSize();
+
+ SBModuleSpec GetSpecAtIndex(size_t i);
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBModuleSpec_h_
diff --git a/linux-x64/clang/include/lldb/API/SBPlatform.h b/linux-x64/clang/include/lldb/API/SBPlatform.h
new file mode 100644
index 0000000..7207b2e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBPlatform.h
@@ -0,0 +1,166 @@
+//===-- SBPlatform.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBPlatform_h_
+#define LLDB_SBPlatform_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <functional>
+
+struct PlatformConnectOptions;
+struct PlatformShellCommand;
+
+namespace lldb {
+
+class SBLaunchInfo;
+
+class LLDB_API SBPlatformConnectOptions {
+public:
+ SBPlatformConnectOptions(const char *url);
+
+ SBPlatformConnectOptions(const SBPlatformConnectOptions &rhs);
+
+ ~SBPlatformConnectOptions();
+
+ void operator=(const SBPlatformConnectOptions &rhs);
+
+ const char *GetURL();
+
+ void SetURL(const char *url);
+
+ bool GetRsyncEnabled();
+
+ void EnableRsync(const char *options, const char *remote_path_prefix,
+ bool omit_remote_hostname);
+
+ void DisableRsync();
+
+ const char *GetLocalCacheDirectory();
+
+ void SetLocalCacheDirectory(const char *path);
+
+protected:
+ PlatformConnectOptions *m_opaque_ptr;
+};
+
+class LLDB_API SBPlatformShellCommand {
+public:
+ SBPlatformShellCommand(const char *shell_command);
+
+ SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
+
+ ~SBPlatformShellCommand();
+
+ void Clear();
+
+ const char *GetCommand();
+
+ void SetCommand(const char *shell_command);
+
+ const char *GetWorkingDirectory();
+
+ void SetWorkingDirectory(const char *path);
+
+ uint32_t GetTimeoutSeconds();
+
+ void SetTimeoutSeconds(uint32_t sec);
+
+ int GetSignal();
+
+ int GetStatus();
+
+ const char *GetOutput();
+
+protected:
+ friend class SBPlatform;
+
+ PlatformShellCommand *m_opaque_ptr;
+};
+
+class LLDB_API SBPlatform {
+public:
+ SBPlatform();
+
+ SBPlatform(const char *platform_name);
+
+ ~SBPlatform();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ const char *GetWorkingDirectory();
+
+ bool SetWorkingDirectory(const char *path);
+
+ const char *GetName();
+
+ SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
+
+ void DisconnectRemote();
+
+ bool IsConnected();
+
+ // The following functions will work if the platform is connected
+ const char *GetTriple();
+
+ const char *GetHostname();
+
+ const char *GetOSBuild();
+
+ const char *GetOSDescription();
+
+ uint32_t GetOSMajorVersion();
+
+ uint32_t GetOSMinorVersion();
+
+ uint32_t GetOSUpdateVersion();
+
+ SBError Put(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Get(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Install(SBFileSpec &src, SBFileSpec &dst);
+
+ SBError Run(SBPlatformShellCommand &shell_command);
+
+ SBError Launch(SBLaunchInfo &launch_info);
+
+ SBError Kill(const lldb::pid_t pid);
+
+ SBError
+ MakeDirectory(const char *path,
+ uint32_t file_permissions = eFilePermissionsDirectoryDefault);
+
+ uint32_t GetFilePermissions(const char *path);
+
+ SBError SetFilePermissions(const char *path, uint32_t file_permissions);
+
+ SBUnixSignals GetUnixSignals() const;
+
+protected:
+ friend class SBDebugger;
+ friend class SBTarget;
+
+ lldb::PlatformSP GetSP() const;
+
+ void SetSP(const lldb::PlatformSP &platform_sp);
+
+ SBError ExecuteConnected(
+ const std::function<lldb_private::Status(const lldb::PlatformSP &)>
+ &func);
+
+ lldb::PlatformSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBPlatform_h_
diff --git a/linux-x64/clang/include/lldb/API/SBProcess.h b/linux-x64/clang/include/lldb/API/SBProcess.h
new file mode 100644
index 0000000..863cb3c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBProcess.h
@@ -0,0 +1,415 @@
+//===-- SBProcess.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBProcess_h_
+#define LLDB_SBProcess_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBError.h"
+#include "lldb/API/SBProcessInfo.h"
+#include "lldb/API/SBQueue.h"
+#include "lldb/API/SBTarget.h"
+#include <stdio.h>
+
+namespace lldb {
+
+class SBEvent;
+
+class LLDB_API SBProcess {
+public:
+ /// Broadcaster event bits definitions.
+ FLAGS_ANONYMOUS_ENUM(){eBroadcastBitStateChanged = (1 << 0),
+ eBroadcastBitInterrupt = (1 << 1),
+ eBroadcastBitSTDOUT = (1 << 2),
+ eBroadcastBitSTDERR = (1 << 3),
+ eBroadcastBitProfileData = (1 << 4),
+ eBroadcastBitStructuredData = (1 << 5)};
+
+ SBProcess();
+
+ SBProcess(const lldb::SBProcess &rhs);
+
+ const lldb::SBProcess &operator=(const lldb::SBProcess &rhs);
+
+ SBProcess(const lldb::ProcessSP &process_sp);
+
+ ~SBProcess();
+
+ static const char *GetBroadcasterClassName();
+
+ const char *GetPluginName();
+
+ // DEPRECATED: use GetPluginName()
+ const char *GetShortPluginName();
+
+ void Clear();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::SBTarget GetTarget() const;
+
+ lldb::ByteOrder GetByteOrder() const;
+
+ size_t PutSTDIN(const char *src, size_t src_len);
+
+ size_t GetSTDOUT(char *dst, size_t dst_len) const;
+
+ size_t GetSTDERR(char *dst, size_t dst_len) const;
+
+ size_t GetAsyncProfileData(char *dst, size_t dst_len) const;
+
+ void ReportEventState(const lldb::SBEvent &event, FILE *out) const;
+
+ void AppendEventStateReport(const lldb::SBEvent &event,
+ lldb::SBCommandReturnObject &result);
+
+ /// Remote connection related functions. These will fail if the
+ /// process is not in eStateConnected. They are intended for use
+ /// when connecting to an externally managed debugserver instance.
+ bool RemoteAttachToProcessWithID(lldb::pid_t pid, lldb::SBError &error);
+
+ bool RemoteLaunch(char const **argv, char const **envp,
+ const char *stdin_path, const char *stdout_path,
+ const char *stderr_path, const char *working_directory,
+ uint32_t launch_flags, bool stop_at_entry,
+ lldb::SBError &error);
+
+ // Thread related functions
+ uint32_t GetNumThreads();
+
+ lldb::SBThread GetThreadAtIndex(size_t index);
+
+ lldb::SBThread GetThreadByID(lldb::tid_t sb_thread_id);
+
+ lldb::SBThread GetThreadByIndexID(uint32_t index_id);
+
+ lldb::SBThread GetSelectedThread() const;
+
+ // Function for lazily creating a thread using the current OS plug-in. This
+ // function will be removed in the future when there are APIs to create
+ // SBThread objects through the interface and add them to the process through
+ // the SBProcess API.
+ lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
+
+ bool SetSelectedThread(const lldb::SBThread &thread);
+
+ bool SetSelectedThreadByID(lldb::tid_t tid);
+
+ bool SetSelectedThreadByIndexID(uint32_t index_id);
+
+ // Queue related functions
+ uint32_t GetNumQueues();
+
+ lldb::SBQueue GetQueueAtIndex(size_t index);
+
+ // Stepping related functions
+
+ lldb::StateType GetState();
+
+ int GetExitStatus();
+
+ const char *GetExitDescription();
+
+ /// Gets the process ID
+ ///
+ /// Returns the process identifier for the process as it is known
+ /// on the system on which the process is running. For unix systems
+ /// this is typically the same as if you called "getpid()" in the
+ /// process.
+ ///
+ /// \return
+ /// Returns LLDB_INVALID_PROCESS_ID if this object does not
+ /// contain a valid process object, or if the process has not
+ /// been launched. Returns a valid process ID if the process is
+ /// valid.
+ lldb::pid_t GetProcessID();
+
+ /// Gets the unique ID associated with this process object
+ ///
+ /// Unique IDs start at 1 and increment up with each new process
+ /// instance. Since starting a process on a system might always
+ /// create a process with the same process ID, there needs to be a
+ /// way to tell two process instances apart.
+ ///
+ /// \return
+ /// Returns a non-zero integer ID if this object contains a
+ /// valid process object, zero if this object does not contain
+ /// a valid process object.
+ uint32_t GetUniqueID();
+
+ uint32_t GetAddressByteSize() const;
+
+ lldb::SBError Destroy();
+
+ lldb::SBError Continue();
+
+ lldb::SBError Stop();
+
+ lldb::SBError Kill();
+
+ lldb::SBError Detach();
+
+ lldb::SBError Detach(bool keep_stopped);
+
+ lldb::SBError Signal(int signal);
+
+ lldb::SBUnixSignals GetUnixSignals();
+
+ void SendAsyncInterrupt();
+
+ uint32_t GetStopID(bool include_expression_stops = false);
+
+ /// Gets the stop event corresponding to stop ID.
+ //
+ /// Note that it wasn't fully implemented and tracks only the stop
+ /// event for the last natural stop ID.
+ ///
+ /// \param [in] stop_id
+ /// The ID of the stop event to return.
+ ///
+ /// \return
+ /// The stop event corresponding to stop ID.
+ lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
+
+ size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
+
+ size_t WriteMemory(addr_t addr, const void *buf, size_t size,
+ lldb::SBError &error);
+
+ size_t ReadCStringFromMemory(addr_t addr, void *buf, size_t size,
+ lldb::SBError &error);
+
+ uint64_t ReadUnsignedFromMemory(addr_t addr, uint32_t byte_size,
+ lldb::SBError &error);
+
+ lldb::addr_t ReadPointerFromMemory(addr_t addr, lldb::SBError &error);
+
+ // Events
+ static lldb::StateType GetStateFromEvent(const lldb::SBEvent &event);
+
+ static bool GetRestartedFromEvent(const lldb::SBEvent &event);
+
+ static size_t GetNumRestartedReasonsFromEvent(const lldb::SBEvent &event);
+
+ static const char *
+ GetRestartedReasonAtIndexFromEvent(const lldb::SBEvent &event, size_t idx);
+
+ static lldb::SBProcess GetProcessFromEvent(const lldb::SBEvent &event);
+
+ static bool GetInterruptedFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBStructuredData
+ GetStructuredDataFromEvent(const lldb::SBEvent &event);
+
+ static bool EventIsProcessEvent(const lldb::SBEvent &event);
+
+ static bool EventIsStructuredDataEvent(const lldb::SBEvent &event);
+
+ lldb::SBBroadcaster GetBroadcaster() const;
+
+ static const char *GetBroadcasterClass();
+
+ 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;
+
+ /// Load a shared library into this process.
+ ///
+ /// \param[in] remote_image_spec
+ /// The path for the shared library on the target what you want
+ /// to load.
+ ///
+ /// \param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// \return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ uint32_t LoadImage(lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
+
+ /// Load a shared library into this process.
+ ///
+ /// \param[in] local_image_spec
+ /// The file spec that points to the shared library that you
+ /// want to load if the library is located on the host. The
+ /// library will be copied over to the location specified by
+ /// remote_image_spec or into the current working directory with
+ /// the same filename if the remote_image_spec isn't specified.
+ ///
+ /// \param[in] remote_image_spec
+ /// If local_image_spec is specified then the location where the
+ /// library should be copied over from the host. If
+ /// local_image_spec isn't specified, then the path for the
+ /// shared library on the target what you want to load.
+ ///
+ /// \param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// \return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ uint32_t LoadImage(const lldb::SBFileSpec &local_image_spec,
+ const lldb::SBFileSpec &remote_image_spec,
+ lldb::SBError &error);
+
+ /// Load a shared library into this process, starting with a
+ /// library name and a list of paths, searching along the list of
+ /// paths till you find a matching library.
+ ///
+ /// \param[in] image_spec
+ /// The name of the shared library that you want to load.
+ /// If image_spec is a relative path, the relative path will be
+ /// appended to the search paths.
+ /// If the image_spec is an absolute path, just the basename is used.
+ ///
+ /// \param[in] paths
+ /// A list of paths to search for the library whose basename is
+ /// local_spec.
+ ///
+ /// \param[out] loaded_path
+ /// If the library was found along the paths, this will store the
+ /// full path to the found library.
+ ///
+ /// \param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to search for the shared library.
+ ///
+ /// \return
+ /// A token that represents the shared library that can be
+ /// later passed to UnloadImage. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ uint32_t LoadImageUsingPaths(const lldb::SBFileSpec &image_spec,
+ SBStringList &paths,
+ lldb::SBFileSpec &loaded_path,
+ lldb::SBError &error);
+
+ lldb::SBError UnloadImage(uint32_t image_token);
+
+ lldb::SBError SendEventData(const char *data);
+
+ /// Return the number of different thread-origin extended backtraces
+ /// this process can support.
+ ///
+ /// When the process is stopped and you have an SBThread, lldb may be
+ /// able to show a backtrace of when that thread was originally created,
+ /// or the work item was enqueued to it (in the case of a libdispatch
+ /// queue).
+ ///
+ /// \return
+ /// The number of thread-origin extended backtrace types that may be
+ /// available.
+ uint32_t GetNumExtendedBacktraceTypes();
+
+ /// Return the name of one of the thread-origin extended backtrace
+ /// methods.
+ ///
+ /// \param [in] idx
+ /// The index of the name to return. They will be returned in
+ /// the order that the user will most likely want to see them.
+ /// e.g. if the type at index 0 is not available for a thread,
+ /// see if the type at index 1 provides an extended backtrace.
+ ///
+ /// \return
+ /// The name at that index.
+ const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx);
+
+ lldb::SBThreadCollection GetHistoryThreads(addr_t addr);
+
+ bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
+
+ /// Save the state of the process in a core file (or mini dump on Windows).
+ lldb::SBError SaveCore(const char *file_name);
+
+ /// Query the address load_addr and store the details of the memory
+ /// region that contains it in the supplied SBMemoryRegionInfo object.
+ /// To iterate over all memory regions use GetMemoryRegionList.
+ ///
+ /// \param[in] load_addr
+ /// The address to be queried.
+ ///
+ /// \param[out] region_info
+ /// A reference to an SBMemoryRegionInfo object that will contain
+ /// the details of the memory region containing load_addr.
+ ///
+ /// \return
+ /// An error object describes any errors that occurred while
+ /// querying load_addr.
+ lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr,
+ lldb::SBMemoryRegionInfo ®ion_info);
+
+ /// Return the list of memory regions within the process.
+ ///
+ /// \return
+ /// A list of all witin the process memory regions.
+ lldb::SBMemoryRegionInfoList GetMemoryRegions();
+
+ /// Return information about the process.
+ ///
+ /// Valid process info will only be returned when the process is
+ /// alive, use SBProcessInfo::IsValid() to check returned info is
+ /// valid.
+ lldb::SBProcessInfo GetProcessInfo();
+
+protected:
+ friend class SBAddress;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+ friend class SBExecutionContext;
+ friend class SBFunction;
+ friend class SBModule;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+
+ lldb::ProcessSP GetSP() const;
+
+ void SetSP(const lldb::ProcessSP &process_sp);
+
+ lldb::ProcessWP m_opaque_wp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBProcess_h_
diff --git a/linux-x64/clang/include/lldb/API/SBProcessInfo.h b/linux-x64/clang/include/lldb/API/SBProcessInfo.h
new file mode 100644
index 0000000..86dba9a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBProcessInfo.h
@@ -0,0 +1,65 @@
+//===-- SBProcessInfo.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBProcessInfo_h_
+#define LLDB_SBProcessInfo_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBProcessInfo {
+public:
+ SBProcessInfo();
+ SBProcessInfo(const SBProcessInfo &rhs);
+
+ ~SBProcessInfo();
+
+ SBProcessInfo &operator=(const SBProcessInfo &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ SBFileSpec GetExecutableFile();
+
+ lldb::pid_t GetProcessID();
+
+ uint32_t GetUserID();
+
+ uint32_t GetGroupID();
+
+ bool UserIDIsValid();
+
+ bool GroupIDIsValid();
+
+ uint32_t GetEffectiveUserID();
+
+ uint32_t GetEffectiveGroupID();
+
+ bool EffectiveUserIDIsValid();
+
+ bool EffectiveGroupIDIsValid();
+
+ lldb::pid_t GetParentProcessID();
+
+private:
+ friend class SBProcess;
+
+ lldb_private::ProcessInstanceInfo &ref();
+
+ void SetProcessInfo(const lldb_private::ProcessInstanceInfo &proc_info_ref);
+
+ std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBProcessInfo_h_
diff --git a/linux-x64/clang/include/lldb/API/SBQueue.h b/linux-x64/clang/include/lldb/API/SBQueue.h
new file mode 100644
index 0000000..0124c1c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBQueue.h
@@ -0,0 +1,69 @@
+//===-- SBQueue.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBQueue_h_
+#define LLDB_SBQueue_h_
+
+#include <vector>
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/lldb-forward.h"
+
+namespace lldb {
+
+class LLDB_API SBQueue {
+public:
+ SBQueue();
+
+ SBQueue(const QueueSP &queue_sp);
+
+ SBQueue(const SBQueue &rhs);
+
+ const SBQueue &operator=(const lldb::SBQueue &rhs);
+
+ ~SBQueue();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::SBProcess GetProcess();
+
+ lldb::queue_id_t GetQueueID() const;
+
+ const char *GetName() const;
+
+ uint32_t GetIndexID() const;
+
+ uint32_t GetNumThreads();
+
+ lldb::SBThread GetThreadAtIndex(uint32_t);
+
+ uint32_t GetNumPendingItems();
+
+ lldb::SBQueueItem GetPendingItemAtIndex(uint32_t);
+
+ uint32_t GetNumRunningItems();
+
+ lldb::QueueKind GetKind();
+
+protected:
+ friend class SBProcess;
+ friend class SBThread;
+
+ void SetQueue(const lldb::QueueSP &queue_sp);
+
+private:
+ std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBQueue_h_
diff --git a/linux-x64/clang/include/lldb/API/SBQueueItem.h b/linux-x64/clang/include/lldb/API/SBQueueItem.h
new file mode 100644
index 0000000..455a1f9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBQueueItem.h
@@ -0,0 +1,49 @@
+//===-- SBQueueItem.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBQueueItem_h_
+#define LLDB_SBQueueItem_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBQueueItem {
+public:
+ SBQueueItem();
+
+ SBQueueItem(const lldb::QueueItemSP &queue_item_sp);
+
+ ~SBQueueItem();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::QueueItemKind GetKind() const;
+
+ void SetKind(lldb::QueueItemKind kind);
+
+ lldb::SBAddress GetAddress() const;
+
+ void SetAddress(lldb::SBAddress addr);
+
+ void SetQueueItem(const lldb::QueueItemSP &queue_item_sp);
+
+ SBThread GetExtendedBacktraceThread(const char *type);
+
+private:
+ lldb::QueueItemSP m_queue_item_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBQueueItem_h_
diff --git a/linux-x64/clang/include/lldb/API/SBReproducer.h b/linux-x64/clang/include/lldb/API/SBReproducer.h
new file mode 100644
index 0000000..0f1739d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBReproducer.h
@@ -0,0 +1,28 @@
+//===-- SBReproducer.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBREPRODUCER_H
+#define LLDB_API_SBREPRODUCER_H
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+/// The SBReproducer class is special because it bootstraps the capture and
+/// replay of SB API calls. As a result we cannot rely on any other SB objects
+/// in the interface or implementation of this class.
+class LLDB_API SBReproducer {
+public:
+ static const char *Capture();
+ static const char *Capture(const char *path);
+ static const char *Replay(const char *path);
+};
+
+} // namespace lldb
+
+#endif
diff --git a/linux-x64/clang/include/lldb/API/SBSection.h b/linux-x64/clang/include/lldb/API/SBSection.h
new file mode 100644
index 0000000..06a195e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBSection.h
@@ -0,0 +1,101 @@
+//===-- SBSection.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSection_h_
+#define LLDB_SBSection_h_
+
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBSection {
+public:
+ SBSection();
+
+ SBSection(const lldb::SBSection &rhs);
+
+ ~SBSection();
+
+ const lldb::SBSection &operator=(const lldb::SBSection &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ lldb::SBSection GetParent();
+
+ lldb::SBSection FindSubSection(const char *sect_name);
+
+ size_t GetNumSubSections();
+
+ lldb::SBSection GetSubSectionAtIndex(size_t idx);
+
+ lldb::addr_t GetFileAddress();
+
+ lldb::addr_t GetLoadAddress(lldb::SBTarget &target);
+
+ lldb::addr_t GetByteSize();
+
+ uint64_t GetFileOffset();
+
+ uint64_t GetFileByteSize();
+
+ lldb::SBData GetSectionData();
+
+ lldb::SBData GetSectionData(uint64_t offset, uint64_t size);
+
+ SectionType GetSectionType();
+
+ /// Gets the permissions (RWX) of the section of the object file
+ ///
+ /// Returns a mask of bits of enum lldb::Permissions for this section.
+ /// Sections for which permissions are not defined, 0 is returned for
+ /// them. The binary representation of this value corresponds to [XRW]
+ /// i.e. for a section having read and execute permissions, the value
+ /// returned is 6
+ ///
+ /// \return
+ /// Returns an unsigned value for Permissions for the section.
+ uint32_t
+ GetPermissions() const;
+
+ /// Return the size of a target's byte represented by this section
+ /// in numbers of host bytes. Note that certain architectures have
+ /// varying minimum addressable unit (i.e. byte) size for their
+ /// CODE or DATA buses.
+ ///
+ /// \return
+ /// The number of host (8-bit) bytes needed to hold a target byte
+ uint32_t GetTargetByteSize();
+
+ bool operator==(const lldb::SBSection &rhs);
+
+ bool operator!=(const lldb::SBSection &rhs);
+
+ bool GetDescription(lldb::SBStream &description);
+
+private:
+ friend class SBAddress;
+ friend class SBModule;
+ friend class SBTarget;
+
+ SBSection(const lldb::SectionSP §ion_sp);
+
+ lldb::SectionSP GetSP() const;
+
+ void SetSP(const lldb::SectionSP §ion_sp);
+
+ lldb::SectionWP m_opaque_wp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBSection_h_
diff --git a/linux-x64/clang/include/lldb/API/SBSourceManager.h b/linux-x64/clang/include/lldb/API/SBSourceManager.h
new file mode 100644
index 0000000..3d69aa2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBSourceManager.h
@@ -0,0 +1,47 @@
+//===-- SBSourceManager.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSourceManager_h_
+#define LLDB_SBSourceManager_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+
+namespace lldb {
+
+class LLDB_API SBSourceManager {
+public:
+ SBSourceManager(const SBDebugger &debugger);
+ SBSourceManager(const SBTarget &target);
+ SBSourceManager(const SBSourceManager &rhs);
+
+ ~SBSourceManager();
+
+ const lldb::SBSourceManager &operator=(const lldb::SBSourceManager &rhs);
+
+ size_t DisplaySourceLinesWithLineNumbers(
+ const lldb::SBFileSpec &file, uint32_t line, uint32_t context_before,
+ uint32_t context_after, const char *current_line_cstr, lldb::SBStream &s);
+
+ size_t DisplaySourceLinesWithLineNumbersAndColumn(
+ const lldb::SBFileSpec &file, uint32_t line, uint32_t column,
+ uint32_t context_before, uint32_t context_after,
+ const char *current_line_cstr, lldb::SBStream &s);
+
+protected:
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+
+private:
+ std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBSourceManager_h_
diff --git a/linux-x64/clang/include/lldb/API/SBStream.h b/linux-x64/clang/include/lldb/API/SBStream.h
new file mode 100644
index 0000000..8afbf45
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBStream.h
@@ -0,0 +1,105 @@
+//===-- SBStream.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBStream_h_
+#define LLDB_SBStream_h_
+
+#include <stdio.h>
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBStream {
+public:
+ SBStream();
+
+ SBStream(SBStream &&rhs);
+
+ ~SBStream();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ // If this stream is not redirected to a file, it will maintain a local cache
+ // for the stream data which can be accessed using this accessor.
+ const char *GetData();
+
+ // If this stream is not redirected to a file, it will maintain a local cache
+ // for the stream output whose length can be accessed using this accessor.
+ size_t GetSize();
+
+ void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+ void RedirectToFile(const char *path, bool append);
+
+ void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
+
+ void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
+
+ // If the stream is redirected to a file, forget about the file and if
+ // ownership of the file was transferred to this object, close the file. If
+ // the stream is backed by a local cache, clear this cache.
+ void Clear();
+
+protected:
+ friend class SBAddress;
+ friend class SBBlock;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
+ friend class SBCommandReturnObject;
+ friend class SBCompileUnit;
+ friend class SBData;
+ friend class SBDebugger;
+ friend class SBDeclaration;
+ friend class SBEvent;
+ friend class SBFileSpec;
+ friend class SBFileSpecList;
+ friend class SBFrame;
+ friend class SBFunction;
+ friend class SBInstruction;
+ friend class SBInstructionList;
+ friend class SBLineEntry;
+ friend class SBMemoryRegionInfo;
+ friend class SBModule;
+ friend class SBModuleSpec;
+ friend class SBModuleSpecList;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBSourceManager;
+ friend class SBStructuredData;
+ friend class SBSymbol;
+ friend class SBSymbolContext;
+ friend class SBSymbolContextList;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBThreadPlan;
+ friend class SBType;
+ friend class SBTypeEnumMember;
+ friend class SBTypeMemberFunction;
+ friend class SBTypeMember;
+ friend class SBValue;
+ friend class SBWatchpoint;
+
+ lldb_private::Stream *operator->();
+
+ lldb_private::Stream *get();
+
+ lldb_private::Stream &ref();
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SBStream);
+ std::unique_ptr<lldb_private::Stream> m_opaque_up;
+ bool m_is_file;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBStream_h_
diff --git a/linux-x64/clang/include/lldb/API/SBStringList.h b/linux-x64/clang/include/lldb/API/SBStringList.h
new file mode 100644
index 0000000..1df1e45
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBStringList.h
@@ -0,0 +1,65 @@
+//===-- SBStringList.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBStringList_h_
+#define LLDB_SBStringList_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBStringList {
+public:
+ SBStringList();
+
+ SBStringList(const lldb::SBStringList &rhs);
+
+ const SBStringList &operator=(const SBStringList &rhs);
+
+ ~SBStringList();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void AppendString(const char *str);
+
+ void AppendList(const char **strv, int strc);
+
+ void AppendList(const lldb::SBStringList &strings);
+
+ uint32_t GetSize() const;
+
+ const char *GetStringAtIndex(size_t idx);
+
+ const char *GetStringAtIndex(size_t idx) const;
+
+ void Clear();
+
+protected:
+ friend class SBCommandInterpreter;
+ friend class SBDebugger;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
+
+ SBStringList(const lldb_private::StringList *lldb_strings);
+
+ void AppendList(const lldb_private::StringList &strings);
+
+ const lldb_private::StringList *operator->() const;
+
+ const lldb_private::StringList &operator*() const;
+
+private:
+ std::unique_ptr<lldb_private::StringList> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBStringList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBStructuredData.h b/linux-x64/clang/include/lldb/API/SBStructuredData.h
new file mode 100644
index 0000000..5b10133
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBStructuredData.h
@@ -0,0 +1,99 @@
+//===-- SBStructuredData.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SBStructuredData_h
+#define SBStructuredData_h
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBModule.h"
+
+namespace lldb {
+
+class SBStructuredData {
+public:
+ SBStructuredData();
+
+ SBStructuredData(const lldb::SBStructuredData &rhs);
+
+ SBStructuredData(const lldb::EventSP &event_sp);
+
+ SBStructuredData(lldb_private::StructuredDataImpl *impl);
+
+ ~SBStructuredData();
+
+ lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
+
+ explicit operator bool() const;
+
+ 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;
+
+ /// 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;
+
+ /// Fill keys with the keys in this object and return true if this data
+ /// structure is a dictionary. Returns false otherwise.
+ bool GetKeys(lldb::SBStringList &keys) 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 \a dst.
+ ///
+ /// \param[in] dst_len
+ /// max number of characters that can be written at \a dst. In case it is
+ /// zero, nothing will be written at \a dst. If this length is not enough
+ /// to write the complete string value, (\a dst_len - 1) bytes of the
+ /// string value will be written at \a dst followed by a null character.
+ ///
+ /// \return
+ /// Returns the byte size needed to completely write the string value at
+ /// \a dst in all cases.
+ size_t GetStringValue(char *dst, size_t dst_len) const;
+
+protected:
+ friend class SBTraceOptions;
+ friend class SBDebugger;
+ friend class SBTarget;
+
+ StructuredDataImplUP m_impl_up;
+};
+} // namespace lldb
+
+#endif /* SBStructuredData_h */
diff --git a/linux-x64/clang/include/lldb/API/SBSymbol.h b/linux-x64/clang/include/lldb/API/SBSymbol.h
new file mode 100644
index 0000000..52486b8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBSymbol.h
@@ -0,0 +1,86 @@
+//===-- SBSymbol.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSymbol_h_
+#define LLDB_SBSymbol_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBInstructionList.h"
+#include "lldb/API/SBTarget.h"
+
+namespace lldb {
+
+class LLDB_API SBSymbol {
+public:
+ SBSymbol();
+
+ ~SBSymbol();
+
+ SBSymbol(const lldb::SBSymbol &rhs);
+
+ const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName() const;
+
+ const char *GetDisplayName() const;
+
+ const char *GetMangledName() const;
+
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target);
+
+ lldb::SBInstructionList GetInstructions(lldb::SBTarget target,
+ const char *flavor_string);
+
+ SBAddress GetStartAddress();
+
+ SBAddress GetEndAddress();
+
+ uint32_t GetPrologueByteSize();
+
+ SymbolType GetType();
+
+ bool operator==(const lldb::SBSymbol &rhs) const;
+
+ bool operator!=(const lldb::SBSymbol &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+ // Returns true if the symbol is externally visible in the module that it is
+ // defined in
+ bool IsExternal();
+
+ // Returns true if the symbol was synthetically generated from something
+ // other than the actual symbol table itself in the object file.
+ bool IsSynthetic();
+
+protected:
+ lldb_private::Symbol *get();
+
+ void reset(lldb_private::Symbol *);
+
+private:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBModule;
+ friend class SBSymbolContext;
+
+ SBSymbol(lldb_private::Symbol *lldb_object_ptr);
+
+ void SetSymbol(lldb_private::Symbol *lldb_object_ptr);
+
+ lldb_private::Symbol *m_opaque_ptr;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBSymbol_h_
diff --git a/linux-x64/clang/include/lldb/API/SBSymbolContext.h b/linux-x64/clang/include/lldb/API/SBSymbolContext.h
new file mode 100644
index 0000000..3d16d09
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBSymbolContext.h
@@ -0,0 +1,83 @@
+//===-- SBSymbolContext.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSymbolContext_h_
+#define LLDB_SBSymbolContext_h_
+
+#include "lldb/API/SBBlock.h"
+#include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFunction.h"
+#include "lldb/API/SBLineEntry.h"
+#include "lldb/API/SBModule.h"
+#include "lldb/API/SBSymbol.h"
+
+namespace lldb {
+
+class LLDB_API SBSymbolContext {
+public:
+ SBSymbolContext();
+
+ SBSymbolContext(const lldb::SBSymbolContext &rhs);
+
+ SBSymbolContext(const lldb_private::SymbolContext *sc_ptr);
+
+ ~SBSymbolContext();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs);
+
+ lldb::SBModule GetModule();
+ lldb::SBCompileUnit GetCompileUnit();
+ lldb::SBFunction GetFunction();
+ lldb::SBBlock GetBlock();
+ lldb::SBLineEntry GetLineEntry();
+ lldb::SBSymbol GetSymbol();
+
+ void SetModule(lldb::SBModule module);
+ void SetCompileUnit(lldb::SBCompileUnit compile_unit);
+ void SetFunction(lldb::SBFunction function);
+ void SetBlock(lldb::SBBlock block);
+ void SetLineEntry(lldb::SBLineEntry line_entry);
+ void SetSymbol(lldb::SBSymbol symbol);
+
+ SBSymbolContext GetParentOfInlinedScope(const SBAddress &curr_frame_pc,
+ SBAddress &parent_frame_addr) const;
+
+ bool GetDescription(lldb::SBStream &description);
+
+protected:
+ friend class SBAddress;
+ friend class SBFrame;
+ friend class SBModule;
+ friend class SBThread;
+ friend class SBTarget;
+ friend class SBSymbolContextList;
+
+ lldb_private::SymbolContext *operator->() const;
+
+ lldb_private::SymbolContext &operator*();
+
+ lldb_private::SymbolContext &ref();
+
+ const lldb_private::SymbolContext &operator*() const;
+
+ lldb_private::SymbolContext *get() const;
+
+ void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr);
+
+private:
+ std::unique_ptr<lldb_private::SymbolContext> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBSymbolContext_h_
diff --git a/linux-x64/clang/include/lldb/API/SBSymbolContextList.h b/linux-x64/clang/include/lldb/API/SBSymbolContextList.h
new file mode 100644
index 0000000..577993c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBSymbolContextList.h
@@ -0,0 +1,58 @@
+//===-- SBSymbolContextList.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBSymbolContextList_h_
+#define LLDB_SBSymbolContextList_h_
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBSymbolContext.h"
+
+namespace lldb {
+
+class LLDB_API SBSymbolContextList {
+public:
+ SBSymbolContextList();
+
+ SBSymbolContextList(const lldb::SBSymbolContextList &rhs);
+
+ ~SBSymbolContextList();
+
+ const lldb::SBSymbolContextList &
+ operator=(const lldb::SBSymbolContextList &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint32_t GetSize() const;
+
+ lldb::SBSymbolContext GetContextAtIndex(uint32_t idx);
+
+ bool GetDescription(lldb::SBStream &description);
+
+ void Append(lldb::SBSymbolContext &sc);
+
+ void Append(lldb::SBSymbolContextList &sc_list);
+
+ void Clear();
+
+protected:
+ friend class SBModule;
+ friend class SBTarget;
+
+ lldb_private::SymbolContextList *operator->() const;
+
+ lldb_private::SymbolContextList &operator*() const;
+
+private:
+ std::unique_ptr<lldb_private::SymbolContextList> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBSymbolContextList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTarget.h b/linux-x64/clang/include/lldb/API/SBTarget.h
new file mode 100644
index 0000000..80a7fa0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTarget.h
@@ -0,0 +1,852 @@
+//===-- SBTarget.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTarget_h_
+#define LLDB_SBTarget_h_
+
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBAttachInfo.h"
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFileSpecList.h"
+#include "lldb/API/SBLaunchInfo.h"
+#include "lldb/API/SBSymbolContextList.h"
+#include "lldb/API/SBType.h"
+#include "lldb/API/SBValue.h"
+#include "lldb/API/SBWatchpoint.h"
+
+namespace lldb {
+
+class SBPlatform;
+
+class LLDB_API SBTarget {
+public:
+ // Broadcaster bits.
+ enum {
+ eBroadcastBitBreakpointChanged = (1 << 0),
+ eBroadcastBitModulesLoaded = (1 << 1),
+ eBroadcastBitModulesUnloaded = (1 << 2),
+ eBroadcastBitWatchpointChanged = (1 << 3),
+ eBroadcastBitSymbolsLoaded = (1 << 4)
+ };
+
+ // Constructors
+ SBTarget();
+
+ SBTarget(const lldb::SBTarget &rhs);
+
+ SBTarget(const lldb::TargetSP &target_sp);
+
+ // Destructor
+ ~SBTarget();
+
+ const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ static bool EventIsTargetEvent(const lldb::SBEvent &event);
+
+ static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event);
+
+ static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx,
+ const lldb::SBEvent &event);
+
+ static const char *GetBroadcasterClassName();
+
+ lldb::SBProcess GetProcess();
+
+ /// Sets whether we should collect statistics on lldb or not.
+ ///
+ /// \param[in] v
+ /// A boolean to control the collection.
+ void SetCollectingStats(bool v);
+
+ /// Returns whether statistics collection are enabled.
+ ///
+ /// \return
+ /// true if statistics are currently being collected, false
+ /// otherwise.
+ bool GetCollectingStats();
+
+ /// Returns a dump of the collected statistics.
+ ///
+ /// \return
+ /// A SBStructuredData with the statistics collected.
+ lldb::SBStructuredData GetStatistics();
+
+ /// Return the platform object associated with the target.
+ ///
+ /// After return, the platform object should be checked for
+ /// validity.
+ ///
+ /// \return
+ /// A platform object.
+ lldb::SBPlatform GetPlatform();
+
+ /// Install any binaries that need to be installed.
+ ///
+ /// This function does nothing when debugging on the host system.
+ /// When connected to remote platforms, the target's main executable
+ /// and any modules that have their remote install path set will be
+ /// installed on the remote platform. If the main executable doesn't
+ /// have an install location set, it will be installed in the remote
+ /// platform's working directory.
+ ///
+ /// \return
+ /// An error describing anything that went wrong during
+ /// installation.
+ SBError Install();
+
+ /// Launch a new process.
+ ///
+ /// Launch a new process by spawning a new process using the
+ /// target object's executable module's file as the file to launch.
+ /// Arguments are given in \a argv, and the environment variables
+ /// are in \a envp. Standard input and output files can be
+ /// optionally re-directed to \a stdin_path, \a stdout_path, and
+ /// \a stderr_path.
+ ///
+ /// \param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// \param[in] argv
+ /// The argument array.
+ ///
+ /// \param[in] envp
+ /// The environment array.
+ ///
+ /// \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
+ /// terminal will be used.
+ ///
+ /// \param[in] stdout_path
+ /// The path to use when re-directing the STDOUT of the new
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
+ /// terminal will be used.
+ ///
+ /// \param[in] stderr_path
+ /// The path to use when re-directing the STDERR of the new
+ /// process. If all stdXX_path arguments are nullptr, a pseudo
+ /// terminal will be used.
+ ///
+ /// \param[in] working_directory
+ /// The working directory to have the child process run in
+ ///
+ /// \param[in] launch_flags
+ /// Some launch options specified by logical OR'ing
+ /// lldb::LaunchFlags enumeration values together.
+ ///
+ /// \param[in] stop_at_entry
+ /// If false do not stop the inferior at the entry point.
+ ///
+ /// \param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// \return
+ /// A process object for the newly created process.
+ lldb::SBProcess Launch(SBListener &listener, char const **argv,
+ char const **envp, const char *stdin_path,
+ const char *stdout_path, const char *stderr_path,
+ const char *working_directory,
+ uint32_t launch_flags, // See LaunchFlags
+ bool stop_at_entry, lldb::SBError &error);
+
+ SBProcess LoadCore(const char *core_file);
+ SBProcess LoadCore(const char *core_file, lldb::SBError &error);
+
+ /// Launch a new process with sensible defaults.
+ ///
+ /// \param[in] argv
+ /// The argument array.
+ ///
+ /// \param[in] envp
+ /// The environment array.
+ ///
+ /// \param[in] working_directory
+ /// The working directory to have the child process run in
+ ///
+ /// Default: listener
+ /// Set to the target's debugger (SBTarget::GetDebugger())
+ ///
+ /// Default: launch_flags
+ /// Empty launch flags
+ ///
+ /// Default: stdin_path
+ /// Default: stdout_path
+ /// Default: stderr_path
+ /// A pseudo terminal will be used.
+ ///
+ /// \return
+ /// A process object for the newly created process.
+ SBProcess LaunchSimple(const char **argv, const char **envp,
+ const char *working_directory);
+
+ SBProcess Launch(SBLaunchInfo &launch_info, SBError &error);
+
+ SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
+
+ /// Attach to process with pid.
+ ///
+ /// \param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// \param[in] pid
+ /// The process ID to attach to.
+ ///
+ /// \param[out] error
+ /// An error explaining what went wrong if attach fails.
+ ///
+ /// \return
+ /// A process object for the attached process.
+ lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
+ lldb::SBError &error);
+
+ /// Attach to process with name.
+ ///
+ /// \param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// \param[in] name
+ /// Basename of process to attach to.
+ ///
+ /// \param[in] wait_for
+ /// If true wait for a new instance of 'name' to be launched.
+ ///
+ /// \param[out] error
+ /// An error explaining what went wrong if attach fails.
+ ///
+ /// \return
+ /// A process object for the attached process.
+ lldb::SBProcess AttachToProcessWithName(SBListener &listener,
+ const char *name, bool wait_for,
+ lldb::SBError &error);
+
+ /// Connect to a remote debug server with url.
+ ///
+ /// \param[in] listener
+ /// An optional listener that will receive all process events.
+ /// If \a listener is valid then \a listener will listen to all
+ /// process events. If not valid, then this target's debugger
+ /// (SBTarget::GetDebugger()) will listen to all process events.
+ ///
+ /// \param[in] url
+ /// The url to connect to, e.g., 'connect://localhost:12345'.
+ ///
+ /// \param[in] plugin_name
+ /// The plugin name to be used; can be nullptr.
+ ///
+ /// \param[out] error
+ /// An error explaining what went wrong if the connect fails.
+ ///
+ /// \return
+ /// A process object for the connected process.
+ lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
+ const char *plugin_name, SBError &error);
+
+ lldb::SBFileSpec GetExecutable();
+
+ // Append the path mapping (from -> to) to the target's paths mapping list.
+ void AppendImageSearchPath(const char *from, const char *to,
+ lldb::SBError &error);
+
+ bool AddModule(lldb::SBModule &module);
+
+ lldb::SBModule AddModule(const char *path, const char *triple,
+ const char *uuid);
+
+ lldb::SBModule AddModule(const char *path, const char *triple,
+ const char *uuid_cstr, const char *symfile);
+
+ lldb::SBModule AddModule(const SBModuleSpec &module_spec);
+
+ uint32_t GetNumModules() const;
+
+ lldb::SBModule GetModuleAtIndex(uint32_t idx);
+
+ bool RemoveModule(lldb::SBModule module);
+
+ lldb::SBDebugger GetDebugger() const;
+
+ lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
+
+ /// Find compile units related to *this target and passed source
+ /// file.
+ ///
+ /// \param[in] sb_file_spec
+ /// A lldb::SBFileSpec object that contains source file
+ /// specification.
+ ///
+ /// \return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ lldb::SBSymbolContextList
+ FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
+
+ lldb::ByteOrder GetByteOrder();
+
+ uint32_t GetAddressByteSize();
+
+ const char *GetTriple();
+
+ /// Architecture data byte width accessor
+ ///
+ /// \return
+ /// The size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's data bus
+ uint32_t GetDataByteSize();
+
+ /// Architecture code byte width accessor
+ ///
+ /// \return
+ /// The size in 8-bit (host) bytes of a minimum addressable
+ /// unit from the Architecture's code bus
+ uint32_t GetCodeByteSize();
+
+ /// Set the base load address for a module section.
+ ///
+ /// \param[in] section
+ /// The section whose base load address will be set within this
+ /// target.
+ ///
+ /// \param[in] section_base_addr
+ /// The base address for the section.
+ ///
+ /// \return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
+ lldb::addr_t section_base_addr);
+
+ /// Clear the base load address for a module section.
+ ///
+ /// \param[in] section
+ /// The section whose base load address will be cleared within
+ /// this target.
+ ///
+ /// \return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
+
+ /// Slide all file addresses for all module sections so that \a module
+ /// appears to loaded at these slide addresses.
+ ///
+ /// When you need all sections within a module to be loaded at a
+ /// rigid slide from the addresses found in the module object file,
+ /// this function will allow you to easily and quickly slide all
+ /// module sections.
+ ///
+ /// \param[in] module
+ /// The module to load.
+ ///
+ /// \param[in] sections_offset
+ /// An offset that will be applied to all section file addresses
+ /// (the virtual addresses found in the object file itself).
+ ///
+ /// \return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
+ int64_t sections_offset);
+
+ /// Clear the section base load addresses for all sections in a module.
+ ///
+ /// \param[in] module
+ /// The module to unload.
+ ///
+ /// \return
+ /// An error to indicate success, fail, and any reason for
+ /// failure.
+ lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
+
+ /// Find functions by name.
+ ///
+ /// \param[in] name
+ /// The name of the function we are looking for.
+ ///
+ /// \param[in] name_type_mask
+ /// A logical OR of one or more FunctionNameType enum bits that
+ /// indicate what kind of names should be used when doing the
+ /// lookup. Bits include fully qualified names, base names,
+ /// C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
+ /// \return
+ /// A lldb::SBSymbolContextList that gets filled in with all of
+ /// the symbol contexts for all the matches.
+ lldb::SBSymbolContextList
+ FindFunctions(const char *name,
+ uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
+
+ /// Find global and static variables by name.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// \return
+ /// A list of matched variables in an SBValueList.
+ lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
+
+ /// Find the first global (or static) variable by name.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \return
+ /// An SBValue that gets filled in with the found variable (if any).
+ lldb::SBValue FindFirstGlobalVariable(const char *name);
+
+ /// Find global and static variables by pattern.
+ ///
+ /// \param[in] name
+ /// The pattern to search for global or static variables
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// \param[in] matchtype
+ /// The match type to use.
+ ///
+ /// \return
+ /// A list of matched variables in an SBValueList.
+ lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
+ MatchType matchtype);
+
+ /// Find global functions by their name with pattern matching.
+ ///
+ /// \param[in] name
+ /// The pattern to search for global or static variables
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a max_matches.
+ ///
+ /// \param[in] matchtype
+ /// The match type to use.
+ ///
+ /// \return
+ /// A list of matched variables in an SBValueList.
+ lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
+ uint32_t max_matches,
+ MatchType matchtype);
+
+ void Clear();
+
+ /// 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...
+ lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
+
+ /// Resolve a current load address into a section offset address.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual address from the current process state that is to
+ /// be translated into a section offset address.
+ ///
+ /// \return
+ /// An SBAddress which will be valid if \a vm_addr was
+ /// successfully resolved into a section offset address, or an
+ /// invalid SBAddress if \a vm_addr doesn't resolve to a section
+ /// in a module.
+ lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);
+
+ /// Resolve a current load address into a section offset address
+ /// using the process stop ID to identify a time in the past.
+ ///
+ /// \param[in] stop_id
+ /// Each time a process stops, the process stop ID integer gets
+ /// incremented. These stop IDs are used to identify past times
+ /// and can be used in history objects as a cheap way to store
+ /// the time at which the sample was taken. Specifying
+ /// UINT32_MAX will always resolve the address using the
+ /// currently loaded sections.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual address from the current process state that is to
+ /// be translated into a section offset address.
+ ///
+ /// \return
+ /// An SBAddress which will be valid if \a vm_addr was
+ /// successfully resolved into a section offset address, or an
+ /// invalid SBAddress if \a vm_addr doesn't resolve to a section
+ /// in a module.
+ lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
+ lldb::addr_t vm_addr);
+
+ SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
+ uint32_t resolve_scope);
+
+ /// Read target memory. If a target process is running then memory
+ /// is read from here. Otherwise the memory is read from the object
+ /// files. For a target whose bytes are sized as a multiple of host
+ /// bytes, the data read back will preserve the target's byte order.
+ ///
+ /// \param[in] addr
+ /// A target address to read from.
+ ///
+ /// \param[out] buf
+ /// The buffer to read memory into.
+ ///
+ /// \param[in] size
+ /// The maximum number of host bytes to read in the buffer passed
+ /// into this call
+ ///
+ /// \param[out] error
+ /// Status information is written here if the memory read fails.
+ ///
+ /// \return
+ /// The amount of data read in host bytes.
+ size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
+ lldb::SBError &error);
+
+ lldb::SBBreakpoint BreakpointCreateByLocation(const char *file,
+ uint32_t line);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
+ lldb::addr_t offset);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
+ lldb::addr_t offset, SBFileSpecList &module_list);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
+ uint32_t column, lldb::addr_t offset,
+ SBFileSpecList &module_list);
+
+ lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
+ const char *module_name = nullptr);
+
+ // This version uses name_type_mask = eFunctionNameTypeAuto
+ lldb::SBBreakpoint
+ BreakpointCreateByName(const char *symbol_name,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByName(
+ const char *symbol_name,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByName(
+ const char *symbol_name,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByNames(
+ const char *symbol_name[], uint32_t num_names,
+ uint32_t
+ name_type_mask, // Logical OR one or more FunctionNameType enum bits
+ lldb::LanguageType symbol_language,
+ lldb::addr_t offset, const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex,
+ const char *module_name = nullptr);
+
+ lldb::SBBreakpoint
+ BreakpointCreateByRegex(const char *symbol_name_regex,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint BreakpointCreateByRegex(
+ const char *symbol_name_regex, lldb::LanguageType symbol_language,
+ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list);
+
+ lldb::SBBreakpoint
+ BreakpointCreateBySourceRegex(const char *source_regex,
+ const SBFileSpec &source_file,
+ const char *module_name = nullptr);
+
+ lldb::SBBreakpoint
+ BreakpointCreateBySourceRegex(const char *source_regex,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &source_file);
+
+ lldb::SBBreakpoint BreakpointCreateBySourceRegex(
+ const char *source_regex, const SBFileSpecList &module_list,
+ const SBFileSpecList &source_file, const SBStringList &func_names);
+
+ lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language,
+ bool catch_bp, bool throw_bp);
+
+ lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
+
+ lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
+
+ /// Create a breakpoint using a scripted resolver.
+ ///
+ /// \param[in] class_name
+ /// This is the name of the class that implements a scripted resolver.
+ ///
+ /// \param[in] extra_args
+ /// This is an SBStructuredData object that will get passed to the
+ /// constructor of the class in class_name. You can use this to
+ /// reuse the same class, parametrizing with entries from this
+ /// dictionary.
+ ///
+ /// \param module_list
+ /// If this is non-empty, this will be used as the module filter in the
+ /// SearchFilter created for this breakpoint.
+ ///
+ /// \param file_list
+ /// If this is non-empty, this will be used as the comp unit filter in the
+ /// SearchFilter created for this breakpoint.
+ ///
+ /// \return
+ /// An SBBreakpoint that will set locations based on the logic in the
+ /// resolver's search callback.
+ lldb::SBBreakpoint BreakpointCreateFromScript(
+ const char *class_name,
+ SBStructuredData &extra_args,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &file_list,
+ bool request_hardware = false);
+
+ /// Read breakpoints from source_file and return the newly created
+ /// breakpoints in bkpt_list.
+ ///
+ /// \param[in] source_file
+ /// The file from which to read the breakpoints.
+ ///
+ /// \param[out] new_bps
+ /// A list of the newly created breakpoints.
+ ///
+ /// \return
+ /// An SBError detailing any errors in reading in the breakpoints.
+ lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
+ SBBreakpointList &new_bps);
+
+ /// Read breakpoints from source_file and return the newly created
+ /// breakpoints in bkpt_list.
+ ///
+ /// \param[in] source_file
+ /// The file from which to read the breakpoints.
+ ///
+ /// \param[in] matching_names
+ /// Only read in breakpoints whose names match one of the names in this
+ /// list.
+ ///
+ /// \param[out] new_bps
+ /// A list of the newly created breakpoints.
+ ///
+ /// \return
+ /// An SBError detailing any errors in reading in the breakpoints.
+ lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
+ SBStringList &matching_names,
+ SBBreakpointList &new_bps);
+
+ /// Write breakpoints to dest_file.
+ ///
+ /// \param[in] dest_file
+ /// The file to which to write the breakpoints.
+ ///
+ /// \return
+ /// An SBError detailing any errors in writing in the breakpoints.
+ lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
+
+ /// Write breakpoints listed in bkpt_list to dest_file.
+ ///
+ /// \param[in] dest_file
+ /// The file to which to write the breakpoints.
+ ///
+ /// \param[in] bkpt_list
+ /// Only write breakpoints from this list.
+ ///
+ /// \param[in] append
+ /// If \b true, append the breakpoints in bkpt_list to the others
+ /// serialized in dest_file. If dest_file doesn't exist, then a new
+ /// file will be created and the breakpoints in bkpt_list written to it.
+ ///
+ /// \return
+ /// An SBError detailing any errors in writing in the breakpoints.
+ lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
+ SBBreakpointList &bkpt_list,
+ bool append = false);
+
+ uint32_t GetNumBreakpoints() const;
+
+ lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const;
+
+ bool BreakpointDelete(break_id_t break_id);
+
+ lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id);
+
+ // Finds all breakpoints by name, returning the list in bkpt_list. Returns
+ // false if the name is not a valid breakpoint name, true otherwise.
+ bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
+
+ void GetBreakpointNames(SBStringList &names);
+
+ void DeleteBreakpointName(const char *name);
+
+ bool EnableAllBreakpoints();
+
+ bool DisableAllBreakpoints();
+
+ bool DeleteAllBreakpoints();
+
+ uint32_t GetNumWatchpoints() const;
+
+ lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const;
+
+ bool DeleteWatchpoint(lldb::watch_id_t watch_id);
+
+ lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id);
+
+ lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read,
+ bool write, SBError &error);
+
+ bool EnableAllWatchpoints();
+
+ bool DisableAllWatchpoints();
+
+ bool DeleteAllWatchpoints();
+
+ lldb::SBBroadcaster GetBroadcaster() const;
+
+ lldb::SBType FindFirstType(const char *type);
+
+ lldb::SBTypeList FindTypes(const char *type);
+
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr,
+ lldb::SBType type);
+
+ lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
+ lldb::SBType type);
+
+ lldb::SBValue CreateValueFromExpression(const char *name, const char *expr);
+
+ SBSourceManager GetSourceManager();
+
+ lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
+ uint32_t count);
+
+ lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr,
+ uint32_t count,
+ const char *flavor_string);
+
+ lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr,
+ const void *buf, size_t size);
+
+ // The "WithFlavor" is necessary to keep SWIG from getting confused about
+ // overloaded arguments when using the buf + size -> Python Object magic.
+
+ lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
+ const char *flavor_string,
+ const void *buf,
+ size_t size);
+
+ lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr,
+ const void *buf, size_t size);
+
+ lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr,
+ const char *flavor_string,
+ const void *buf,
+ size_t size);
+
+ lldb::SBSymbolContextList FindSymbols(const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ bool operator==(const lldb::SBTarget &rhs) const;
+
+ bool operator!=(const lldb::SBTarget &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBValue EvaluateExpression(const char *expr);
+
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options);
+
+ lldb::addr_t GetStackRedZoneSize();
+
+ lldb::SBLaunchInfo GetLaunchInfo() const;
+
+ void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info);
+
+protected:
+ friend class SBAddress;
+ friend class SBBlock;
+ friend class SBBreakpointList;
+ friend class SBBreakpointNameImpl;
+ friend class SBDebugger;
+ friend class SBExecutionContext;
+ friend class SBFunction;
+ friend class SBInstruction;
+ friend class SBModule;
+ friend class SBProcess;
+ friend class SBSection;
+ friend class SBSourceManager;
+ friend class SBSymbol;
+ friend class SBValue;
+ friend class SBVariablesOptions;
+
+ // Constructors are private, use static Target::Create function to create an
+ // instance of this class.
+
+ lldb::TargetSP GetSP() const;
+
+ void SetSP(const lldb::TargetSP &target_sp);
+
+private:
+ lldb::TargetSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTarget_h_
diff --git a/linux-x64/clang/include/lldb/API/SBThread.h b/linux-x64/clang/include/lldb/API/SBThread.h
new file mode 100644
index 0000000..da8726a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBThread.h
@@ -0,0 +1,231 @@
+//===-- SBThread.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBThread_h_
+#define LLDB_SBThread_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+
+namespace lldb {
+
+class SBFrame;
+
+class LLDB_API SBThread {
+public:
+ enum {
+ eBroadcastBitStackChanged = (1 << 0),
+ eBroadcastBitThreadSuspended = (1 << 1),
+ eBroadcastBitThreadResumed = (1 << 2),
+ eBroadcastBitSelectedFrameChanged = (1 << 3),
+ eBroadcastBitThreadSelected = (1 << 4)
+ };
+
+ static const char *GetBroadcasterClassName();
+
+ SBThread();
+
+ SBThread(const lldb::SBThread &thread);
+
+ SBThread(const lldb::ThreadSP &lldb_object_sp);
+
+ ~SBThread();
+
+ lldb::SBQueue GetQueue() const;
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::StopReason GetStopReason();
+
+ /// Get the number of words associated with the stop reason.
+ /// See also GetStopReasonDataAtIndex().
+ size_t GetStopReasonDataCount();
+
+ /// Get information associated with a stop reason.
+ ///
+ /// Breakpoint stop reasons will have data that consists of pairs of
+ /// breakpoint IDs followed by the breakpoint location IDs (they always come
+ /// in pairs).
+ ///
+ /// Stop Reason Count Data Type
+ /// ======================== ===== =========================================
+ /// eStopReasonNone 0
+ /// eStopReasonTrace 0
+ /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
+ /// eStopReasonWatchpoint 1 watchpoint id
+ /// eStopReasonSignal 1 unix signal number
+ /// eStopReasonException N exception data
+ /// eStopReasonExec 0
+ /// eStopReasonPlanComplete 0
+ uint64_t GetStopReasonDataAtIndex(uint32_t idx);
+
+ bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
+
+ SBThreadCollection
+ GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type);
+
+ size_t GetStopDescription(char *dst, size_t dst_len);
+
+ SBValue GetStopReturnValue();
+
+ lldb::tid_t GetThreadID() const;
+
+ uint32_t GetIndexID() const;
+
+ const char *GetName() const;
+
+ const char *GetQueueName() const;
+
+ lldb::queue_id_t GetQueueID() const;
+
+ bool GetInfoItemByPathAsString(const char *path, SBStream &strm);
+
+ void StepOver(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepOver(lldb::RunMode stop_other_threads, SBError &error);
+
+ void StepInto(lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepInto(const char *target_name,
+ lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepInto(const char *target_name, uint32_t end_line, SBError &error,
+ lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
+
+ void StepOut();
+
+ void StepOut(SBError &error);
+
+ void StepOutOfFrame(SBFrame &frame);
+
+ void StepOutOfFrame(SBFrame &frame, SBError &error);
+
+ void StepInstruction(bool step_over);
+
+ void StepInstruction(bool step_over, SBError &error);
+
+ SBError StepOverUntil(lldb::SBFrame &frame, lldb::SBFileSpec &file_spec,
+ uint32_t line);
+
+ SBError StepUsingScriptedThreadPlan(const char *script_class_name);
+
+ SBError StepUsingScriptedThreadPlan(const char *script_class_name,
+ bool resume_immediately);
+
+ SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
+
+ void RunToAddress(lldb::addr_t addr);
+
+ void RunToAddress(lldb::addr_t addr, SBError &error);
+
+ SBError ReturnFromFrame(SBFrame &frame, SBValue &return_value);
+
+ SBError UnwindInnermostExpression();
+
+ /// LLDB currently supports process centric debugging which means when any
+ /// thread in a process stops, all other threads are stopped. The Suspend()
+ /// call here tells our process to suspend a thread and not let it run when
+ /// the other threads in a process are allowed to run. So when
+ /// SBProcess::Continue() is called, any threads that aren't suspended will
+ /// be allowed to run. If any of the SBThread functions for stepping are
+ /// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddress), the
+ /// thread will not be allowed to run and these functions will simply return.
+ ///
+ /// Eventually we plan to add support for thread centric debugging where
+ /// each thread is controlled individually and each thread would broadcast
+ /// its state, but we haven't implemented this yet.
+ ///
+ /// Likewise the SBThread::Resume() call will again allow the thread to run
+ /// when the process is continued.
+ ///
+ /// Suspend() and Resume() functions are not currently reference counted, if
+ /// anyone has the need for them to be reference counted, please let us
+ /// know.
+ bool Suspend();
+
+ bool Suspend(SBError &error);
+
+ bool Resume();
+
+ bool Resume(SBError &error);
+
+ bool IsSuspended();
+
+ bool IsStopped();
+
+ uint32_t GetNumFrames();
+
+ lldb::SBFrame GetFrameAtIndex(uint32_t idx);
+
+ lldb::SBFrame GetSelectedFrame();
+
+ lldb::SBFrame SetSelectedFrame(uint32_t frame_idx);
+
+ static bool EventIsThreadEvent(const SBEvent &event);
+
+ static SBFrame GetStackFrameFromEvent(const SBEvent &event);
+
+ static SBThread GetThreadFromEvent(const SBEvent &event);
+
+ lldb::SBProcess GetProcess();
+
+ const lldb::SBThread &operator=(const lldb::SBThread &rhs);
+
+ bool operator==(const lldb::SBThread &rhs) const;
+
+ bool operator!=(const lldb::SBThread &rhs) const;
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+ bool GetDescription(lldb::SBStream &description, bool stop_format) const;
+
+ bool GetStatus(lldb::SBStream &status) const;
+
+ SBThread GetExtendedBacktraceThread(const char *type);
+
+ uint32_t GetExtendedBacktraceOriginatingIndexID();
+
+ SBValue GetCurrentException();
+
+ SBThread GetCurrentExceptionBacktrace();
+
+ bool SafeToCallFunctions();
+
+private:
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointCallbackBaton;
+ friend class SBExecutionContext;
+ friend class SBFrame;
+ friend class SBProcess;
+ friend class SBDebugger;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+ friend class SBQueueItem;
+ friend class SBThreadPlan;
+
+ void SetThread(const lldb::ThreadSP &lldb_object_sp);
+
+ SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx,
+ lldb_private::ThreadPlan *new_plan);
+
+ lldb::ExecutionContextRefSP m_opaque_sp;
+
+ lldb_private::Thread *operator->();
+
+ lldb_private::Thread *get();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBThread_h_
diff --git a/linux-x64/clang/include/lldb/API/SBThreadCollection.h b/linux-x64/clang/include/lldb/API/SBThreadCollection.h
new file mode 100644
index 0000000..1c6b463
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBThreadCollection.h
@@ -0,0 +1,57 @@
+//===-- SBThreadCollection.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBThreadCollection_h_
+#define LLDB_SBThreadCollection_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBThreadCollection {
+public:
+ SBThreadCollection();
+
+ SBThreadCollection(const SBThreadCollection &rhs);
+
+ const SBThreadCollection &operator=(const SBThreadCollection &rhs);
+
+ ~SBThreadCollection();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ size_t GetSize();
+
+ lldb::SBThread GetThreadAtIndex(size_t idx);
+
+protected:
+ // Mimic shared pointer...
+ lldb_private::ThreadCollection *get() const;
+
+ lldb_private::ThreadCollection *operator->() const;
+
+ lldb::ThreadCollectionSP &operator*();
+
+ const lldb::ThreadCollectionSP &operator*() const;
+
+ SBThreadCollection(const lldb::ThreadCollectionSP &threads);
+
+ void SetOpaque(const lldb::ThreadCollectionSP &threads);
+
+private:
+ friend class SBProcess;
+ friend class SBThread;
+
+ lldb::ThreadCollectionSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBThreadCollection_h_
diff --git a/linux-x64/clang/include/lldb/API/SBThreadPlan.h b/linux-x64/clang/include/lldb/API/SBThreadPlan.h
new file mode 100644
index 0000000..007e9e2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBThreadPlan.h
@@ -0,0 +1,122 @@
+//===-- SBThreadPlan.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBThreadPlan_h_
+#define LLDB_SBThreadPlan_h_
+
+#include "lldb/API/SBDefines.h"
+
+#include <stdio.h>
+
+namespace lldb {
+
+class LLDB_API SBThreadPlan {
+
+ friend class lldb_private::ThreadPlan;
+
+public:
+ SBThreadPlan();
+
+ SBThreadPlan(const lldb::SBThreadPlan &threadPlan);
+
+ SBThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
+
+ SBThreadPlan(lldb::SBThread &thread, const char *class_name);
+
+ ~SBThreadPlan();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ lldb::StopReason GetStopReason();
+
+ /// Get the number of words associated with the stop reason.
+ /// See also GetStopReasonDataAtIndex().
+ size_t GetStopReasonDataCount();
+
+ /// Get information associated with a stop reason.
+ ///
+ /// Breakpoint stop reasons will have data that consists of pairs of
+ /// breakpoint IDs followed by the breakpoint location IDs (they always come
+ /// in pairs).
+ ///
+ /// Stop Reason Count Data Type
+ /// ======================== ===== =========================================
+ /// eStopReasonNone 0
+ /// eStopReasonTrace 0
+ /// eStopReasonBreakpoint N duple: {breakpoint id, location id}
+ /// eStopReasonWatchpoint 1 watchpoint id
+ /// eStopReasonSignal 1 unix signal number
+ /// eStopReasonException N exception data
+ /// eStopReasonExec 0
+ /// eStopReasonPlanComplete 0
+ uint64_t GetStopReasonDataAtIndex(uint32_t idx);
+
+ SBThread GetThread() const;
+
+ const lldb::SBThreadPlan &operator=(const lldb::SBThreadPlan &rhs);
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+ void SetPlanComplete(bool success);
+
+ bool IsPlanComplete();
+
+ bool IsPlanStale();
+
+ bool IsValid();
+
+ // This section allows an SBThreadPlan to push another of the common types of
+ // plans...
+ SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
+ lldb::addr_t range_size);
+ SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
+ lldb::addr_t range_size,
+ SBError &error);
+
+ SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
+ lldb::addr_t range_size);
+ SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
+ lldb::addr_t range_size,
+ SBError &error);
+
+ SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
+ bool first_insn = false);
+ SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
+ bool first_insn, SBError &error);
+
+ SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
+ SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address,
+ SBError &error);
+
+ SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
+ SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
+ SBError &error);
+
+private:
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBFrame;
+ friend class SBProcess;
+ friend class SBDebugger;
+ friend class SBValue;
+ friend class lldb_private::QueueImpl;
+ friend class SBQueueItem;
+
+ lldb_private::ThreadPlan *get();
+ void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
+
+ lldb::ThreadPlanSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBThreadPlan_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTrace.h b/linux-x64/clang/include/lldb/API/SBTrace.h
new file mode 100644
index 0000000..87c67ad
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTrace.h
@@ -0,0 +1,116 @@
+//===-- SBTrace.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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();
+
+ explicit operator bool() const;
+
+ 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/linux-x64/clang/include/lldb/API/SBTraceOptions.h b/linux-x64/clang/include/lldb/API/SBTraceOptions.h
new file mode 100644
index 0000000..4c586bf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTraceOptions.h
@@ -0,0 +1,59 @@
+//===-- SBTraceOptions ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+protected:
+ friend class SBProcess;
+ friend class SBTrace;
+
+ lldb::TraceOptionsSP m_traceoptions_sp;
+};
+}
+
+#endif /* SBTRACEOPTIONS_H_ */
diff --git a/linux-x64/clang/include/lldb/API/SBType.h b/linux-x64/clang/include/lldb/API/SBType.h
new file mode 100644
index 0000000..b3f92b7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBType.h
@@ -0,0 +1,262 @@
+//===-- SBType.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBType_h_
+#define LLDB_SBType_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class SBTypeList;
+
+class LLDB_API SBTypeMember {
+public:
+ SBTypeMember();
+
+ SBTypeMember(const lldb::SBTypeMember &rhs);
+
+ ~SBTypeMember();
+
+ lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ lldb::SBType GetType();
+
+ uint64_t GetOffsetInBytes();
+
+ uint64_t GetOffsetInBits();
+
+ bool IsBitfield();
+
+ uint32_t GetBitfieldSizeInBits();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+protected:
+ friend class SBType;
+
+ void reset(lldb_private::TypeMemberImpl *);
+
+ lldb_private::TypeMemberImpl &ref();
+
+ const lldb_private::TypeMemberImpl &ref() const;
+
+ std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up;
+};
+
+class SBTypeMemberFunction {
+public:
+ SBTypeMemberFunction();
+
+ SBTypeMemberFunction(const lldb::SBTypeMemberFunction &rhs);
+
+ ~SBTypeMemberFunction();
+
+ lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ const char *GetDemangledName();
+
+ const char *GetMangledName();
+
+ lldb::SBType GetType();
+
+ lldb::SBType GetReturnType();
+
+ uint32_t GetNumberOfArguments();
+
+ lldb::SBType GetArgumentTypeAtIndex(uint32_t);
+
+ lldb::MemberFunctionKind GetKind();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+protected:
+ friend class SBType;
+
+ void reset(lldb_private::TypeMemberFunctionImpl *);
+
+ lldb_private::TypeMemberFunctionImpl &ref();
+
+ const lldb_private::TypeMemberFunctionImpl &ref() const;
+
+ lldb::TypeMemberFunctionImplSP m_opaque_sp;
+};
+
+class SBType {
+public:
+ SBType();
+
+ SBType(const lldb::SBType &rhs);
+
+ ~SBType();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint64_t GetByteSize();
+
+ bool IsPointerType();
+
+ bool IsReferenceType();
+
+ bool IsFunctionType();
+
+ bool IsPolymorphicClass();
+
+ bool IsArrayType();
+
+ bool IsVectorType();
+
+ bool IsTypedefType();
+
+ bool IsAnonymousType();
+
+ lldb::SBType GetPointerType();
+
+ lldb::SBType GetPointeeType();
+
+ lldb::SBType GetReferenceType();
+
+ lldb::SBType GetTypedefedType();
+
+ lldb::SBType GetDereferencedType();
+
+ lldb::SBType GetUnqualifiedType();
+
+ lldb::SBType GetArrayElementType();
+
+ lldb::SBType GetArrayType(uint64_t size);
+
+ lldb::SBType GetVectorElementType();
+
+ lldb::SBType GetCanonicalType();
+ // Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
+ // type eBasicTypeInvalid will be returned
+ lldb::BasicType GetBasicType();
+
+ // The call below confusing and should really be renamed to "CreateBasicType"
+ lldb::SBType GetBasicType(lldb::BasicType type);
+
+ uint32_t GetNumberOfFields();
+
+ uint32_t GetNumberOfDirectBaseClasses();
+
+ uint32_t GetNumberOfVirtualBaseClasses();
+
+ lldb::SBTypeMember GetFieldAtIndex(uint32_t idx);
+
+ lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx);
+
+ lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx);
+
+ lldb::SBTypeEnumMemberList GetEnumMembers();
+
+ uint32_t GetNumberOfTemplateArguments();
+
+ lldb::SBType GetTemplateArgumentType(uint32_t idx);
+
+ lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx);
+
+ lldb::SBType GetFunctionReturnType();
+
+ lldb::SBTypeList GetFunctionArgumentTypes();
+
+ uint32_t GetNumberOfMemberFunctions();
+
+ lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
+
+ const char *GetName();
+
+ const char *GetDisplayTypeName();
+
+ lldb::TypeClass GetTypeClass();
+
+ bool IsTypeComplete();
+
+ uint32_t GetTypeFlags();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBType &operator=(const lldb::SBType &rhs);
+
+ bool operator==(lldb::SBType &rhs);
+
+ bool operator!=(lldb::SBType &rhs);
+
+protected:
+ lldb_private::TypeImpl &ref();
+
+ const lldb_private::TypeImpl &ref() const;
+
+ lldb::TypeImplSP GetSP();
+
+ void SetSP(const lldb::TypeImplSP &type_impl_sp);
+
+ lldb::TypeImplSP m_opaque_sp;
+
+ friend class SBFunction;
+ friend class SBModule;
+ friend class SBTarget;
+ friend class SBTypeEnumMember;
+ friend class SBTypeEnumMemberList;
+ friend class SBTypeNameSpecifier;
+ friend class SBTypeMember;
+ friend class SBTypeMemberFunction;
+ friend class SBTypeList;
+ friend class SBValue;
+
+ SBType(const lldb_private::CompilerType &);
+ SBType(const lldb::TypeSP &);
+ SBType(const lldb::TypeImplSP &);
+};
+
+class SBTypeList {
+public:
+ SBTypeList();
+
+ SBTypeList(const lldb::SBTypeList &rhs);
+
+ ~SBTypeList();
+
+ lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ void Append(lldb::SBType type);
+
+ lldb::SBType GetTypeAtIndex(uint32_t index);
+
+ uint32_t GetSize();
+
+private:
+ std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up;
+ friend class SBModule;
+ friend class SBCompileUnit;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBType_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeCategory.h b/linux-x64/clang/include/lldb/API/SBTypeCategory.h
new file mode 100644
index 0000000..c0f4cee
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeCategory.h
@@ -0,0 +1,116 @@
+//===-- SBTypeCategory.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeCategory_h_
+#define LLDB_SBTypeCategory_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeCategory {
+public:
+ SBTypeCategory();
+
+ SBTypeCategory(const lldb::SBTypeCategory &rhs);
+
+ ~SBTypeCategory();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool GetEnabled();
+
+ void SetEnabled(bool);
+
+ const char *GetName();
+
+ lldb::LanguageType GetLanguageAtIndex(uint32_t idx);
+
+ uint32_t GetNumLanguages();
+
+ void AddLanguage(lldb::LanguageType language);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ uint32_t GetNumFormats();
+
+ uint32_t GetNumSummaries();
+
+ uint32_t GetNumFilters();
+
+ uint32_t GetNumSynthetics();
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForFilterAtIndex(uint32_t);
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForFormatAtIndex(uint32_t);
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForSummaryAtIndex(uint32_t);
+
+ SBTypeNameSpecifier GetTypeNameSpecifierForSyntheticAtIndex(uint32_t);
+
+ SBTypeFilter GetFilterForType(SBTypeNameSpecifier);
+
+ SBTypeFormat GetFormatForType(SBTypeNameSpecifier);
+
+ SBTypeSummary GetSummaryForType(SBTypeNameSpecifier);
+
+ SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
+
+ SBTypeFilter GetFilterAtIndex(uint32_t);
+
+ SBTypeFormat GetFormatAtIndex(uint32_t);
+
+ SBTypeSummary GetSummaryAtIndex(uint32_t);
+
+ SBTypeSynthetic GetSyntheticAtIndex(uint32_t);
+
+ bool AddTypeFormat(SBTypeNameSpecifier, SBTypeFormat);
+
+ bool DeleteTypeFormat(SBTypeNameSpecifier);
+
+ bool AddTypeSummary(SBTypeNameSpecifier, SBTypeSummary);
+
+ bool DeleteTypeSummary(SBTypeNameSpecifier);
+
+ bool AddTypeFilter(SBTypeNameSpecifier, SBTypeFilter);
+
+ bool DeleteTypeFilter(SBTypeNameSpecifier);
+
+ bool AddTypeSynthetic(SBTypeNameSpecifier, SBTypeSynthetic);
+
+ bool DeleteTypeSynthetic(SBTypeNameSpecifier);
+
+ lldb::SBTypeCategory &operator=(const lldb::SBTypeCategory &rhs);
+
+ bool operator==(lldb::SBTypeCategory &rhs);
+
+ bool operator!=(lldb::SBTypeCategory &rhs);
+
+protected:
+ friend class SBDebugger;
+
+ lldb::TypeCategoryImplSP GetSP();
+
+ void SetSP(const lldb::TypeCategoryImplSP &typecategory_impl_sp);
+
+ TypeCategoryImplSP m_opaque_sp;
+
+ SBTypeCategory(const lldb::TypeCategoryImplSP &);
+
+ SBTypeCategory(const char *);
+
+ bool IsDefaultCategory();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeCategory_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h b/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h
new file mode 100644
index 0000000..2410dbc
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h
@@ -0,0 +1,83 @@
+
+//===-- SBTypeEnumMember.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeEnumMember_h_
+#define LLDB_SBTypeEnumMember_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeEnumMember {
+public:
+ SBTypeEnumMember();
+
+ SBTypeEnumMember(const SBTypeEnumMember &rhs);
+
+ ~SBTypeEnumMember();
+
+ SBTypeEnumMember &operator=(const SBTypeEnumMember &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ int64_t GetValueAsSigned();
+
+ uint64_t GetValueAsUnsigned();
+
+ const char *GetName();
+
+ lldb::SBType GetType();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+protected:
+ friend class SBType;
+ friend class SBTypeEnumMemberList;
+
+ void reset(lldb_private::TypeEnumMemberImpl *);
+
+ lldb_private::TypeEnumMemberImpl &ref();
+
+ const lldb_private::TypeEnumMemberImpl &ref() const;
+
+ lldb::TypeEnumMemberImplSP m_opaque_sp;
+
+ SBTypeEnumMember(const lldb::TypeEnumMemberImplSP &);
+};
+
+class SBTypeEnumMemberList {
+public:
+ SBTypeEnumMemberList();
+
+ SBTypeEnumMemberList(const SBTypeEnumMemberList &rhs);
+
+ ~SBTypeEnumMemberList();
+
+ SBTypeEnumMemberList &operator=(const SBTypeEnumMemberList &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ void Append(SBTypeEnumMember entry);
+
+ SBTypeEnumMember GetTypeEnumMemberAtIndex(uint32_t index);
+
+ uint32_t GetSize();
+
+private:
+ std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeEnumMember_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeFilter.h b/linux-x64/clang/include/lldb/API/SBTypeFilter.h
new file mode 100644
index 0000000..4a0de11
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeFilter.h
@@ -0,0 +1,74 @@
+//===-- SBTypeFilter.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeFilter_h_
+#define LLDB_SBTypeFilter_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeFilter {
+public:
+ SBTypeFilter();
+
+ SBTypeFilter(uint32_t options); // see lldb::eTypeOption values
+
+ SBTypeFilter(const lldb::SBTypeFilter &rhs);
+
+ ~SBTypeFilter();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint32_t GetNumberOfExpressionPaths();
+
+ const char *GetExpressionPathAtIndex(uint32_t i);
+
+ bool ReplaceExpressionPathAtIndex(uint32_t i, const char *item);
+
+ void AppendExpressionPath(const char *item);
+
+ void Clear();
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeFilter &operator=(const lldb::SBTypeFilter &rhs);
+
+ bool IsEqualTo(lldb::SBTypeFilter &rhs);
+
+ bool operator==(lldb::SBTypeFilter &rhs);
+
+ bool operator!=(lldb::SBTypeFilter &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeFilterImplSP GetSP();
+
+ void SetSP(const lldb::TypeFilterImplSP &typefilter_impl_sp);
+
+ lldb::TypeFilterImplSP m_opaque_sp;
+
+ SBTypeFilter(const lldb::TypeFilterImplSP &);
+
+ bool CopyOnWrite_Impl();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeFilter_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeFormat.h b/linux-x64/clang/include/lldb/API/SBTypeFormat.h
new file mode 100644
index 0000000..8a0ac77
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeFormat.h
@@ -0,0 +1,78 @@
+//===-- SBTypeFormat.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeFormat_h_
+#define LLDB_SBTypeFormat_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeFormat {
+public:
+ SBTypeFormat();
+
+ SBTypeFormat(lldb::Format format,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeFormat(const char *type,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeFormat(const lldb::SBTypeFormat &rhs);
+
+ ~SBTypeFormat();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ lldb::Format GetFormat();
+
+ const char *GetTypeName();
+
+ uint32_t GetOptions();
+
+ void SetFormat(lldb::Format);
+
+ void SetTypeName(const char *);
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeFormat &operator=(const lldb::SBTypeFormat &rhs);
+
+ bool IsEqualTo(lldb::SBTypeFormat &rhs);
+
+ bool operator==(lldb::SBTypeFormat &rhs);
+
+ bool operator!=(lldb::SBTypeFormat &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeFormatImplSP GetSP();
+
+ void SetSP(const lldb::TypeFormatImplSP &typeformat_impl_sp);
+
+ lldb::TypeFormatImplSP m_opaque_sp;
+
+ SBTypeFormat(const lldb::TypeFormatImplSP &);
+
+ enum class Type { eTypeKeepSame, eTypeFormat, eTypeEnum };
+
+ bool CopyOnWrite_Impl(Type);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeFormat_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h b/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h
new file mode 100644
index 0000000..9fe449d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h
@@ -0,0 +1,65 @@
+//===-- SBTypeNameSpecifier.h --------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeNameSpecifier_h_
+#define LLDB_SBTypeNameSpecifier_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeNameSpecifier {
+public:
+ SBTypeNameSpecifier();
+
+ SBTypeNameSpecifier(const char *name, bool is_regex = false);
+
+ SBTypeNameSpecifier(SBType type);
+
+ SBTypeNameSpecifier(const lldb::SBTypeNameSpecifier &rhs);
+
+ ~SBTypeNameSpecifier();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetName();
+
+ SBType GetType();
+
+ bool IsRegex();
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeNameSpecifier &operator=(const lldb::SBTypeNameSpecifier &rhs);
+
+ bool IsEqualTo(lldb::SBTypeNameSpecifier &rhs);
+
+ bool operator==(lldb::SBTypeNameSpecifier &rhs);
+
+ bool operator!=(lldb::SBTypeNameSpecifier &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+
+ lldb::TypeNameSpecifierImplSP GetSP();
+
+ void SetSP(const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
+
+ lldb::TypeNameSpecifierImplSP m_opaque_sp;
+
+ SBTypeNameSpecifier(const lldb::TypeNameSpecifierImplSP &);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeNameSpecifier_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeSummary.h b/linux-x64/clang/include/lldb/API/SBTypeSummary.h
new file mode 100644
index 0000000..bb7121f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeSummary.h
@@ -0,0 +1,139 @@
+//===-- SBTypeSummary.h -------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeSummary_h_
+#define LLDB_SBTypeSummary_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+class LLDB_API SBTypeSummaryOptions {
+public:
+ SBTypeSummaryOptions();
+
+ SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs);
+
+ SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
+
+ ~SBTypeSummaryOptions();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ lldb::LanguageType GetLanguage();
+
+ lldb::TypeSummaryCapping GetCapping();
+
+ void SetLanguage(lldb::LanguageType);
+
+ void SetCapping(lldb::TypeSummaryCapping);
+
+protected:
+ friend class SBValue;
+
+ lldb_private::TypeSummaryOptions *operator->();
+
+ const lldb_private::TypeSummaryOptions *operator->() const;
+
+ lldb_private::TypeSummaryOptions *get();
+
+ lldb_private::TypeSummaryOptions &ref();
+
+ const lldb_private::TypeSummaryOptions &ref() const;
+
+ void SetOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr);
+
+private:
+ std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_up;
+};
+
+class SBTypeSummary {
+public:
+ SBTypeSummary();
+
+ // Native function summary formatter callback
+ typedef bool (*FormatCallback)(SBValue, SBTypeSummaryOptions, SBStream &);
+
+ static SBTypeSummary
+ CreateWithSummaryString(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary
+ CreateWithFunctionName(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary
+ CreateWithScriptCode(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSummary CreateWithCallback(FormatCallback cb,
+ uint32_t options = 0,
+ const char *description = nullptr);
+
+ SBTypeSummary(const lldb::SBTypeSummary &rhs);
+
+ ~SBTypeSummary();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool IsFunctionCode();
+
+ bool IsFunctionName();
+
+ bool IsSummaryString();
+
+ const char *GetData();
+
+ void SetSummaryString(const char *data);
+
+ void SetFunctionName(const char *data);
+
+ void SetFunctionCode(const char *data);
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeSummary &operator=(const lldb::SBTypeSummary &rhs);
+
+ bool DoesPrintValue(lldb::SBValue value);
+
+ bool IsEqualTo(lldb::SBTypeSummary &rhs);
+
+ bool operator==(lldb::SBTypeSummary &rhs);
+
+ bool operator!=(lldb::SBTypeSummary &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::TypeSummaryImplSP GetSP();
+
+ void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp);
+
+ lldb::TypeSummaryImplSP m_opaque_sp;
+
+ SBTypeSummary(const lldb::TypeSummaryImplSP &);
+
+ bool CopyOnWrite_Impl();
+
+ bool ChangeSummaryType(bool want_script);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeSummary_h_
diff --git a/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h b/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h
new file mode 100644
index 0000000..c190643
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h
@@ -0,0 +1,80 @@
+//===-- SBTypeSynthetic.h -----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBTypeSynthetic_h_
+#define LLDB_SBTypeSynthetic_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBTypeSynthetic {
+public:
+ SBTypeSynthetic();
+
+ static SBTypeSynthetic
+ CreateWithClassName(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ static SBTypeSynthetic
+ CreateWithScriptCode(const char *data,
+ uint32_t options = 0); // see lldb::eTypeOption values
+
+ SBTypeSynthetic(const lldb::SBTypeSynthetic &rhs);
+
+ ~SBTypeSynthetic();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool IsClassCode();
+
+ bool IsClassName();
+
+ const char *GetData();
+
+ void SetClassName(const char *data);
+
+ void SetClassCode(const char *data);
+
+ uint32_t GetOptions();
+
+ void SetOptions(uint32_t);
+
+ bool GetDescription(lldb::SBStream &description,
+ lldb::DescriptionLevel description_level);
+
+ lldb::SBTypeSynthetic &operator=(const lldb::SBTypeSynthetic &rhs);
+
+ bool IsEqualTo(lldb::SBTypeSynthetic &rhs);
+
+ bool operator==(lldb::SBTypeSynthetic &rhs);
+
+ bool operator!=(lldb::SBTypeSynthetic &rhs);
+
+protected:
+ friend class SBDebugger;
+ friend class SBTypeCategory;
+ friend class SBValue;
+
+ lldb::ScriptedSyntheticChildrenSP GetSP();
+
+ void SetSP(const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
+
+ lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
+
+ SBTypeSynthetic(const lldb::ScriptedSyntheticChildrenSP &);
+
+ bool CopyOnWrite_Impl();
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBTypeSynthetic_h_
diff --git a/linux-x64/clang/include/lldb/API/SBUnixSignals.h b/linux-x64/clang/include/lldb/API/SBUnixSignals.h
new file mode 100644
index 0000000..c7e99d1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBUnixSignals.h
@@ -0,0 +1,71 @@
+//===-- SBUnixSignals.h -----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBUnixSignals_h_
+#define LLDB_SBUnixSignals_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBUnixSignals {
+public:
+ SBUnixSignals();
+
+ SBUnixSignals(const lldb::SBUnixSignals &rhs);
+
+ ~SBUnixSignals();
+
+ const SBUnixSignals &operator=(const lldb::SBUnixSignals &rhs);
+
+ void Clear();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ const char *GetSignalAsCString(int32_t signo) const;
+
+ int32_t GetSignalNumberFromName(const char *name) const;
+
+ bool GetShouldSuppress(int32_t signo) const;
+
+ bool SetShouldSuppress(int32_t signo, bool value);
+
+ bool GetShouldStop(int32_t signo) const;
+
+ bool SetShouldStop(int32_t signo, bool value);
+
+ bool GetShouldNotify(int32_t signo) const;
+
+ bool SetShouldNotify(int32_t signo, bool value);
+
+ int32_t GetNumSignals() const;
+
+ int32_t GetSignalAtIndex(int32_t index) const;
+
+protected:
+ friend class SBProcess;
+ friend class SBPlatform;
+
+ SBUnixSignals(lldb::ProcessSP &process_sp);
+
+ SBUnixSignals(lldb::PlatformSP &platform_sp);
+
+ lldb::UnixSignalsSP GetSP() const;
+
+ void SetSP(const lldb::UnixSignalsSP &signals_sp);
+
+private:
+ lldb::UnixSignalsWP m_opaque_wp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBUnixSignals_h_
diff --git a/linux-x64/clang/include/lldb/API/SBValue.h b/linux-x64/clang/include/lldb/API/SBValue.h
new file mode 100644
index 0000000..c36ba20
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBValue.h
@@ -0,0 +1,435 @@
+//===-- SBValue.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBValue_h_
+#define LLDB_SBValue_h_
+
+#include "lldb/API/SBData.h"
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBType.h"
+
+class ValueImpl;
+class ValueLocker;
+
+namespace lldb {
+
+class LLDB_API SBValue {
+public:
+ SBValue();
+
+ SBValue(const lldb::SBValue &rhs);
+
+ lldb::SBValue &operator=(const lldb::SBValue &rhs);
+
+ ~SBValue();
+
+ explicit operator bool() const;
+
+ bool IsValid();
+
+ void Clear();
+
+ SBError GetError();
+
+ lldb::user_id_t GetID();
+
+ const char *GetName();
+
+ const char *GetTypeName();
+
+ const char *GetDisplayTypeName();
+
+ size_t GetByteSize();
+
+ bool IsInScope();
+
+ lldb::Format GetFormat();
+
+ void SetFormat(lldb::Format format);
+
+ const char *GetValue();
+
+ int64_t GetValueAsSigned(lldb::SBError &error, int64_t fail_value = 0);
+
+ uint64_t GetValueAsUnsigned(lldb::SBError &error, uint64_t fail_value = 0);
+
+ int64_t GetValueAsSigned(int64_t fail_value = 0);
+
+ uint64_t GetValueAsUnsigned(uint64_t fail_value = 0);
+
+ ValueType GetValueType();
+
+ // If you call this on a newly created ValueObject, it will always return
+ // false.
+ bool GetValueDidChange();
+
+ const char *GetSummary();
+
+ const char *GetSummary(lldb::SBStream &stream,
+ lldb::SBTypeSummaryOptions &options);
+
+ const char *GetObjectDescription();
+
+ const char *GetTypeValidatorResult();
+
+ lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue GetStaticValue();
+
+ lldb::SBValue GetNonSyntheticValue();
+
+ lldb::DynamicValueType GetPreferDynamicValue();
+
+ void SetPreferDynamicValue(lldb::DynamicValueType use_dynamic);
+
+ bool GetPreferSyntheticValue();
+
+ void SetPreferSyntheticValue(bool use_synthetic);
+
+ bool IsDynamic();
+
+ bool IsSynthetic();
+
+ bool IsSyntheticChildrenGenerated();
+
+ void SetSyntheticChildrenGenerated(bool);
+
+ const char *GetLocation();
+
+ // Deprecated - use the one that takes SBError&
+ bool SetValueFromCString(const char *value_str);
+
+ bool SetValueFromCString(const char *value_str, lldb::SBError &error);
+
+ lldb::SBTypeFormat GetTypeFormat();
+
+ lldb::SBTypeSummary GetTypeSummary();
+
+ lldb::SBTypeFilter GetTypeFilter();
+
+ lldb::SBTypeSynthetic GetTypeSynthetic();
+
+ lldb::SBValue GetChildAtIndex(uint32_t idx);
+
+ lldb::SBValue CreateChildAtOffset(const char *name, uint32_t offset,
+ lldb::SBType type);
+
+ // Deprecated - use the expression evaluator to perform type casting
+ lldb::SBValue Cast(lldb::SBType type);
+
+ lldb::SBValue CreateValueFromExpression(const char *name,
+ const char *expression);
+
+ lldb::SBValue CreateValueFromExpression(const char *name,
+ const char *expression,
+ SBExpressionOptions &options);
+
+ lldb::SBValue CreateValueFromAddress(const char *name, lldb::addr_t address,
+ lldb::SBType type);
+
+ // this has no address! GetAddress() and GetLoadAddress() as well as
+ // AddressOf() on the return of this call all return invalid
+ lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
+ lldb::SBType type);
+
+ /// Get a child value by index from a value.
+ ///
+ /// Structs, unions, classes, arrays and pointers have child
+ /// values that can be access by index.
+ ///
+ /// Structs and unions access child members using a zero based index
+ /// for each child member. For
+ ///
+ /// Classes reserve the first indexes for base classes that have
+ /// members (empty base classes are omitted), and all members of the
+ /// current class will then follow the base classes.
+ ///
+ /// Pointers differ depending on what they point to. If the pointer
+ /// points to a simple type, the child at index zero
+ /// is the only child value available, unless \a synthetic_allowed
+ /// is \b true, in which case the pointer will be used as an array
+ /// and can create 'synthetic' child values using positive or
+ /// negative indexes. If the pointer points to an aggregate type
+ /// (an array, class, union, struct), then the pointee is
+ /// transparently skipped and any children are going to be the indexes
+ /// of the child values within the aggregate type. For example if
+ /// we have a 'Point' type and we have a SBValue that contains a
+ /// pointer to a 'Point' type, then the child at index zero will be
+ /// the 'x' member, and the child at index 1 will be the 'y' member
+ /// (the child at index zero won't be a 'Point' instance).
+ ///
+ /// If you actually need an SBValue that represents the type pointed
+ /// to by a SBValue for which GetType().IsPointeeType() returns true,
+ /// regardless of the pointee type, you can do that with SBValue::Dereference.
+ ///
+ /// Arrays have a preset number of children that can be accessed by
+ /// index and will returns invalid child values for indexes that are
+ /// out of bounds unless the \a synthetic_allowed is \b true. In this
+ /// case the array can create 'synthetic' child values for indexes
+ /// that aren't in the array bounds using positive or negative
+ /// indexes.
+ ///
+ /// \param[in] idx
+ /// The index of the child value to get
+ ///
+ /// \param[in] use_dynamic
+ /// An enumeration that specifies whether to get dynamic values,
+ /// and also if the target can be run to figure out the dynamic
+ /// type of the child value.
+ ///
+ /// \param[in] can_create_synthetic
+ /// If \b true, then allow child values to be created by index
+ /// for pointers and arrays for indexes that normally wouldn't
+ /// be allowed.
+ ///
+ /// \return
+ /// A new SBValue object that represents the child member value.
+ lldb::SBValue GetChildAtIndex(uint32_t idx,
+ lldb::DynamicValueType use_dynamic,
+ bool can_create_synthetic);
+
+ // Matches children of this object only and will match base classes and
+ // member names if this is a clang typed object.
+ uint32_t GetIndexOfChildWithName(const char *name);
+
+ // Matches child members of this object and child members of any base
+ // classes.
+ lldb::SBValue GetChildMemberWithName(const char *name);
+
+ // Matches child members of this object and child members of any base
+ // classes.
+ lldb::SBValue GetChildMemberWithName(const char *name,
+ lldb::DynamicValueType use_dynamic);
+
+ // Expands nested expressions like .a->b[0].c[1]->d
+ lldb::SBValue GetValueForExpressionPath(const char *expr_path);
+
+ lldb::SBValue AddressOf();
+
+ lldb::addr_t GetLoadAddress();
+
+ lldb::SBAddress GetAddress();
+
+ /// Get an SBData wrapping what this SBValue points to.
+ ///
+ /// This method will dereference the current SBValue, if its
+ /// data type is a T* or T[], and extract item_count elements
+ /// of type T from it, copying their contents in an SBData.
+ ///
+ /// \param[in] item_idx
+ /// The index of the first item to retrieve. For an array
+ /// this is equivalent to array[item_idx], for a pointer
+ /// to *(pointer + item_idx). In either case, the measurement
+ /// unit for item_idx is the sizeof(T) rather than the byte
+ ///
+ /// \param[in] item_count
+ /// How many items should be copied into the output. By default
+ /// only one item is copied, but more can be asked for.
+ ///
+ /// \return
+ /// An SBData with the contents of the copied items, on success.
+ /// An empty SBData otherwise.
+ lldb::SBData GetPointeeData(uint32_t item_idx = 0, uint32_t item_count = 1);
+
+ /// Get an SBData wrapping the contents of this SBValue.
+ ///
+ /// This method will read the contents of this object in memory
+ /// and copy them into an SBData for future use.
+ ///
+ /// \return
+ /// An SBData with the contents of this SBValue, on success.
+ /// An empty SBData otherwise.
+ lldb::SBData GetData();
+
+ bool SetData(lldb::SBData &data, lldb::SBError &error);
+
+ lldb::SBDeclaration GetDeclaration();
+
+ /// Find out if a SBValue might have children.
+ ///
+ /// This call is much more efficient than GetNumChildren() as it
+ /// doesn't need to complete the underlying type. This is designed
+ /// to be used in a UI environment in order to detect if the
+ /// disclosure triangle should be displayed or not.
+ ///
+ /// This function returns true for class, union, structure,
+ /// pointers, references, arrays and more. Again, it does so without
+ /// doing any expensive type completion.
+ ///
+ /// \return
+ /// Returns \b true if the SBValue might have children, or \b
+ /// false otherwise.
+ bool MightHaveChildren();
+
+ bool IsRuntimeSupportValue();
+
+ uint32_t GetNumChildren();
+
+ uint32_t GetNumChildren(uint32_t max);
+
+ void *GetOpaqueType();
+
+ lldb::SBTarget GetTarget();
+
+ lldb::SBProcess GetProcess();
+
+ lldb::SBThread GetThread();
+
+ lldb::SBFrame GetFrame();
+
+ lldb::SBValue Dereference();
+
+ // Deprecated - please use GetType().IsPointerType() instead.
+ bool TypeIsPointerType();
+
+ lldb::SBType GetType();
+
+ lldb::SBValue Persist();
+
+ bool GetDescription(lldb::SBStream &description);
+
+ bool GetExpressionPath(lldb::SBStream &description);
+
+ bool GetExpressionPath(lldb::SBStream &description,
+ bool qualify_cxx_base_classes);
+
+ lldb::SBValue EvaluateExpression(const char *expr) const;
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options) const;
+ lldb::SBValue EvaluateExpression(const char *expr,
+ const SBExpressionOptions &options,
+ const char *name) const;
+
+ SBValue(const lldb::ValueObjectSP &value_sp);
+
+ /// Watch this value if it resides in memory.
+ ///
+ /// Sets a watchpoint on the value.
+ ///
+ /// \param[in] resolve_location
+ /// Resolve the location of this value once and watch its address.
+ /// This value must currently be set to \b true as watching all
+ /// locations of a variable or a variable path is not yet supported,
+ /// though we plan to support it in the future.
+ ///
+ /// \param[in] read
+ /// Stop when this value is accessed.
+ ///
+ /// \param[in] write
+ /// Stop when this value is modified
+ ///
+ /// \param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// \return
+ /// An SBWatchpoint object. This object might not be valid upon
+ /// return due to a value not being contained in memory, too
+ /// large, or watchpoint resources are not available or all in
+ /// use.
+ lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write,
+ SBError &error);
+
+ // Backward compatibility fix in the interim.
+ lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write);
+
+ /// Watch this value that this value points to in memory
+ ///
+ /// Sets a watchpoint on the value.
+ ///
+ /// \param[in] resolve_location
+ /// Resolve the location of this value once and watch its address.
+ /// This value must currently be set to \b true as watching all
+ /// locations of a variable or a variable path is not yet supported,
+ /// though we plan to support it in the future.
+ ///
+ /// \param[in] read
+ /// Stop when this value is accessed.
+ ///
+ /// \param[in] write
+ /// Stop when this value is modified
+ ///
+ /// \param[out] error
+ /// An error object. Contains the reason if there is some failure.
+ ///
+ /// \return
+ /// An SBWatchpoint object. This object might not be valid upon
+ /// return due to a value not being contained in memory, too
+ /// large, or watchpoint resources are not available or all in
+ /// use.
+ lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
+ SBError &error);
+
+ /// Same as the protected version of GetSP that takes a locker, except that we
+ /// make the
+ /// locker locally in the function. Since the Target API mutex is recursive,
+ /// and the
+ /// StopLocker is a read lock, you can call this function even if you are
+ /// already
+ /// holding the two above-mentioned locks.
+ ///
+ /// \return
+ /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
+ /// can cons up, in accordance with the SBValue's settings.
+ lldb::ValueObjectSP GetSP() const;
+
+protected:
+ friend class SBBlock;
+ friend class SBFrame;
+ friend class SBTarget;
+ friend class SBThread;
+ friend class SBValueList;
+
+ /// Get the appropriate ValueObjectSP from this SBValue, consulting the
+ /// use_dynamic and use_synthetic options passed in to SetSP when the
+ /// SBValue's contents were set. Since this often requires examining memory,
+ /// and maybe even running code, it needs to acquire the Target API and
+ /// Process StopLock.
+ /// Those are held in an opaque class ValueLocker which is currently local to
+ /// SBValue.cpp.
+ /// So you don't have to get these yourself just default construct a
+ /// ValueLocker, and pass it into this.
+ /// If we need to make a ValueLocker and use it in some other .cpp file, we'll
+ /// have to move it to
+ /// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so
+ /// far.
+ ///
+ /// \param[in] value_locker
+ /// An object that will hold the Target API, and Process RunLocks, and
+ /// auto-destroy them when it goes out of scope. Currently this is only
+ /// useful in
+ /// SBValue.cpp.
+ ///
+ /// \return
+ /// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
+ /// can cons up, in accordance with the SBValue's settings.
+ lldb::ValueObjectSP GetSP(ValueLocker &value_locker) const;
+
+ // these calls do the right thing WRT adjusting their settings according to
+ // the target's preferences
+ void SetSP(const lldb::ValueObjectSP &sp);
+
+ void SetSP(const lldb::ValueObjectSP &sp, bool use_synthetic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
+ bool use_synthetic);
+
+ void SetSP(const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic,
+ bool use_synthetic, const char *name);
+
+private:
+ typedef std::shared_ptr<ValueImpl> ValueImplSP;
+ ValueImplSP m_opaque_sp;
+
+ void SetSP(ValueImplSP impl_sp);
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBValue_h_
diff --git a/linux-x64/clang/include/lldb/API/SBValueList.h b/linux-x64/clang/include/lldb/API/SBValueList.h
new file mode 100644
index 0000000..d305b35
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBValueList.h
@@ -0,0 +1,75 @@
+//===-- SBValueList.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBValueList_h_
+#define LLDB_SBValueList_h_
+
+#include "lldb/API/SBDefines.h"
+
+class ValueListImpl;
+
+namespace lldb {
+
+class LLDB_API SBValueList {
+public:
+ SBValueList();
+
+ SBValueList(const lldb::SBValueList &rhs);
+
+ ~SBValueList();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ void Clear();
+
+ void Append(const lldb::SBValue &val_obj);
+
+ void Append(const lldb::SBValueList &value_list);
+
+ uint32_t GetSize() const;
+
+ lldb::SBValue GetValueAtIndex(uint32_t idx) const;
+
+ lldb::SBValue GetFirstValueByName(const char *name) const;
+
+ lldb::SBValue FindValueObjectByUID(lldb::user_id_t uid);
+
+ const lldb::SBValueList &operator=(const lldb::SBValueList &rhs);
+
+protected:
+ // only useful for visualizing the pointer or comparing two SBValueLists to
+ // see if they are backed by the same underlying Impl.
+ void *opaque_ptr();
+
+private:
+ friend class SBFrame;
+
+ SBValueList(const ValueListImpl *lldb_object_ptr);
+
+ void Append(lldb::ValueObjectSP &val_obj_sp);
+
+ void CreateIfNeeded();
+
+ ValueListImpl *operator->();
+
+ ValueListImpl &operator*();
+
+ const ValueListImpl *operator->() const;
+
+ const ValueListImpl &operator*() const;
+
+ ValueListImpl &ref();
+
+ std::unique_ptr<ValueListImpl> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBValueList_h_
diff --git a/linux-x64/clang/include/lldb/API/SBVariablesOptions.h b/linux-x64/clang/include/lldb/API/SBVariablesOptions.h
new file mode 100644
index 0000000..e226ce4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBVariablesOptions.h
@@ -0,0 +1,82 @@
+//===-- SBVariablesOptions.h ------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBVariablesOptions_h_
+#define LLDB_SBVariablesOptions_h_
+
+#include "lldb/API/SBDefines.h"
+
+class VariablesOptionsImpl;
+
+namespace lldb {
+
+class LLDB_API SBVariablesOptions {
+public:
+ SBVariablesOptions();
+
+ SBVariablesOptions(const SBVariablesOptions &options);
+
+ SBVariablesOptions &operator=(const SBVariablesOptions &options);
+
+ ~SBVariablesOptions();
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ bool GetIncludeArguments() const;
+
+ void SetIncludeArguments(bool);
+
+ bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const;
+
+ void SetIncludeRecognizedArguments(bool);
+
+ bool GetIncludeLocals() const;
+
+ void SetIncludeLocals(bool);
+
+ bool GetIncludeStatics() const;
+
+ void SetIncludeStatics(bool);
+
+ bool GetInScopeOnly() const;
+
+ void SetInScopeOnly(bool);
+
+ bool GetIncludeRuntimeSupportValues() const;
+
+ void SetIncludeRuntimeSupportValues(bool);
+
+ lldb::DynamicValueType GetUseDynamic() const;
+
+ void SetUseDynamic(lldb::DynamicValueType);
+
+protected:
+ VariablesOptionsImpl *operator->();
+
+ const VariablesOptionsImpl *operator->() const;
+
+ VariablesOptionsImpl *get();
+
+ VariablesOptionsImpl &ref();
+
+ const VariablesOptionsImpl &ref() const;
+
+ SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr);
+
+ void SetOptions(VariablesOptionsImpl *lldb_object_ptr);
+
+private:
+ std::unique_ptr<VariablesOptionsImpl> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBValue_h_
diff --git a/linux-x64/clang/include/lldb/API/SBWatchpoint.h b/linux-x64/clang/include/lldb/API/SBWatchpoint.h
new file mode 100644
index 0000000..05ff0ca
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBWatchpoint.h
@@ -0,0 +1,85 @@
+//===-- SBWatchpoint.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SBWatchpoint_h_
+#define LLDB_SBWatchpoint_h_
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBWatchpoint {
+public:
+ SBWatchpoint();
+
+ SBWatchpoint(const lldb::SBWatchpoint &rhs);
+
+ SBWatchpoint(const lldb::WatchpointSP &wp_sp);
+
+ ~SBWatchpoint();
+
+ const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs);
+
+ explicit operator bool() const;
+
+ bool operator==(const SBWatchpoint &rhs) const;
+
+ bool operator!=(const SBWatchpoint &rhs) const;
+
+ bool IsValid() const;
+
+ SBError GetError();
+
+ watch_id_t GetID();
+
+ /// With -1 representing an invalid hardware index.
+ int32_t GetHardwareIndex();
+
+ lldb::addr_t GetWatchAddress();
+
+ size_t GetWatchSize();
+
+ void SetEnabled(bool enabled);
+
+ bool IsEnabled();
+
+ uint32_t GetHitCount();
+
+ uint32_t GetIgnoreCount();
+
+ void SetIgnoreCount(uint32_t n);
+
+ const char *GetCondition();
+
+ void SetCondition(const char *condition);
+
+ bool GetDescription(lldb::SBStream &description, DescriptionLevel level);
+
+ void Clear();
+
+ lldb::WatchpointSP GetSP() const;
+
+ void SetSP(const lldb::WatchpointSP &sp);
+
+ static bool EventIsWatchpointEvent(const lldb::SBEvent &event);
+
+ static lldb::WatchpointEventType
+ GetWatchpointEventTypeFromEvent(const lldb::SBEvent &event);
+
+ static lldb::SBWatchpoint GetWatchpointFromEvent(const lldb::SBEvent &event);
+
+private:
+ friend class SBTarget;
+ friend class SBValue;
+
+ std::weak_ptr<lldb_private::Watchpoint> m_opaque_wp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_SBWatchpoint_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h b/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h
new file mode 100644
index 0000000..f561b6d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h
@@ -0,0 +1,676 @@
+//===-- Breakpoint.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Breakpoint_h_
+#define liblldb_Breakpoint_h_
+
+#include <memory>
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/BreakpointLocationList.h"
+#include "lldb/Breakpoint/BreakpointName.h"
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+/// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that
+/// manages logical breakpoint setting.
+
+/// General Outline:
+/// A breakpoint has four main parts, a filter, a resolver, the list of
+/// breakpoint
+/// locations that have been determined for the filter/resolver pair, and
+/// finally a set of options for the breakpoint.
+///
+/// \b Filter:
+/// This is an object derived from SearchFilter. It manages the search for
+/// breakpoint location matches through the symbols in the module list of the
+/// target that owns it. It also filters out locations based on whatever
+/// logic it wants.
+///
+/// \b Resolver:
+/// This is an object derived from BreakpointResolver. It provides a callback
+/// to the filter that will find breakpoint locations. How it does this is
+/// determined by what kind of resolver it is.
+///
+/// The Breakpoint class also provides constructors for the common breakpoint
+/// cases which make the appropriate filter and resolver for you.
+///
+/// \b Location List:
+/// This stores the breakpoint locations that have been determined to date.
+/// For a given breakpoint, there will be only one location with a given
+/// address. Adding a location at an already taken address will just return
+/// the location already at that address. Locations can be looked up by ID,
+/// or by address.
+///
+/// \b Options:
+/// This includes:
+/// \b Enabled/Disabled
+/// \b Ignore Count
+/// \b Callback
+/// \b Condition
+/// Note, these options can be set on the breakpoint, and they can also be set
+/// on the individual locations. The options set on the breakpoint take
+/// precedence over the options set on the individual location. So for
+/// instance disabling the breakpoint will cause NONE of the locations to get
+/// hit. But if the breakpoint is enabled, then the location's enabled state
+/// will be checked to determine whether to insert that breakpoint location.
+/// Similarly, if the breakpoint condition says "stop", we won't check the
+/// location's condition. But if the breakpoint condition says "continue",
+/// then we will check the location for whether to actually stop or not. One
+/// subtle point worth observing here is that you don't actually stop at a
+/// Breakpoint, you always stop at one of its locations. So the "should stop"
+/// tests are done by the location, not by the breakpoint.
+class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
+ public Stoppoint {
+public:
+ static ConstString GetEventIdentifier();
+
+ /// An enum specifying the match style for breakpoint settings. At present
+ /// only used for function name style breakpoints.
+ enum MatchType { Exact, Regexp, Glob };
+
+private:
+ enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName };
+
+ static const char
+ *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
+
+ static const char *GetKey(OptionNames enum_value) {
+ return g_option_names[static_cast<uint32_t>(enum_value)];
+ }
+
+public:
+ class BreakpointEventData : public EventData {
+ public:
+ BreakpointEventData(lldb::BreakpointEventType sub_type,
+ const lldb::BreakpointSP &new_breakpoint_sp);
+
+ ~BreakpointEventData() override;
+
+ static ConstString GetFlavorString();
+
+ ConstString GetFlavor() const override;
+
+ lldb::BreakpointEventType GetBreakpointEventType() const;
+
+ lldb::BreakpointSP &GetBreakpoint();
+
+ BreakpointLocationCollection &GetBreakpointLocationCollection() {
+ return m_locations;
+ }
+
+ void Dump(Stream *s) const override;
+
+ static lldb::BreakpointEventType
+ GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp);
+
+ static lldb::BreakpointSP
+ GetBreakpointFromEvent(const lldb::EventSP &event_sp);
+
+ static lldb::BreakpointLocationSP
+ GetBreakpointLocationAtIndexFromEvent(const lldb::EventSP &event_sp,
+ uint32_t loc_idx);
+
+ static size_t
+ GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp);
+
+ static const BreakpointEventData *
+ GetEventDataFromEvent(const Event *event_sp);
+
+ private:
+ lldb::BreakpointEventType m_breakpoint_event;
+ lldb::BreakpointSP m_new_breakpoint_sp;
+ BreakpointLocationCollection m_locations;
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointEventData);
+ };
+
+ // Saving & restoring breakpoints:
+ static lldb::BreakpointSP CreateFromStructuredData(
+ Target &target, StructuredData::ObjectSP &data_object_sp, Status &error);
+
+ static bool
+ SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp,
+ std::vector<std::string> &names);
+
+ virtual StructuredData::ObjectSP SerializeToStructuredData();
+
+ static const char *GetSerializationKey() { return "Breakpoint"; }
+ /// Destructor.
+ ///
+ /// The destructor is not virtual since there should be no reason to
+ /// subclass breakpoints. The varieties of breakpoints are specified
+ /// instead by providing different resolvers & filters.
+ ~Breakpoint() override;
+
+ // Methods
+
+ /// Tell whether this breakpoint is an "internal" breakpoint. \return
+ /// Returns \b true if this is an internal breakpoint, \b false otherwise.
+ bool IsInternal() const;
+
+ /// Standard "Dump" method. At present it does nothing.
+ void Dump(Stream *s) override;
+
+ // The next set of methods provide ways to tell the breakpoint to update it's
+ // location list - usually done when modules appear or disappear.
+
+ /// Tell this breakpoint to clear all its breakpoint sites. Done when the
+ /// process holding the breakpoint sites is destroyed.
+ void ClearAllBreakpointSites();
+
+ /// Tell this breakpoint to scan it's target's module list and resolve any
+ /// new locations that match the breakpoint's specifications.
+ void ResolveBreakpoint();
+
+ /// Tell this breakpoint to scan a given module list and resolve any new
+ /// locations that match the breakpoint's specifications.
+ ///
+ /// \param[in] module_list
+ /// The list of modules to look in for new locations.
+ ///
+ /// \param[in] send_event
+ /// If \b true, send a breakpoint location added event for non-internal
+ /// breakpoints.
+ void ResolveBreakpointInModules(ModuleList &module_list,
+ bool send_event = true);
+
+ /// Tell this breakpoint to scan a given module list and resolve any new
+ /// locations that match the breakpoint's specifications.
+ ///
+ /// \param[in] changed_modules
+ /// The list of modules to look in for new locations.
+ ///
+ /// \param[in] new_locations
+ /// Fills new_locations with the new locations that were made.
+ void ResolveBreakpointInModules(ModuleList &module_list,
+ BreakpointLocationCollection &new_locations);
+
+ /// Like ResolveBreakpointInModules, but allows for "unload" events, in
+ /// which case we will remove any locations that are in modules that got
+ /// unloaded.
+ ///
+ /// \param[in] changedModules
+ /// The list of modules to look in for new locations.
+ /// \param[in] load_event
+ /// If \b true then the modules were loaded, if \b false, unloaded.
+ /// \param[in] delete_locations
+ /// If \b true then the modules were unloaded delete any locations in the
+ /// changed modules.
+ void ModulesChanged(ModuleList &changed_modules, bool load_event,
+ bool delete_locations = false);
+
+ /// Tells the breakpoint the old module \a old_module_sp has been replaced
+ /// by new_module_sp (usually because the underlying file has been rebuilt,
+ /// and the old version is gone.)
+ ///
+ /// \param[in] old_module_sp
+ /// The old module that is going away.
+ /// \param[in] new_module_sp
+ /// The new module that is replacing it.
+ void ModuleReplaced(lldb::ModuleSP old_module_sp,
+ lldb::ModuleSP new_module_sp);
+
+ // The next set of methods provide access to the breakpoint locations for
+ // this breakpoint.
+
+ /// Add a location to the breakpoint's location list. This is only meant to
+ /// be called by the breakpoint's resolver. FIXME: how do I ensure that?
+ ///
+ /// \param[in] addr
+ /// The Address specifying the new location.
+ /// \param[out] new_location
+ /// Set to \b true if a new location was created, to \b false if there
+ /// already was a location at this Address.
+ /// \return
+ /// Returns a pointer to the new location.
+ lldb::BreakpointLocationSP AddLocation(const Address &addr,
+ bool *new_location = nullptr);
+
+ /// Find a breakpoint location by Address.
+ ///
+ /// \param[in] addr
+ /// The Address specifying the location.
+ /// \return
+ /// Returns a shared pointer to the location at \a addr. The pointer
+ /// in the shared pointer will be nullptr if there is no location at that
+ /// address.
+ lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr);
+
+ /// Find a breakpoint location ID by Address.
+ ///
+ /// \param[in] addr
+ /// The Address specifying the location.
+ /// \return
+ /// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
+ /// there is no breakpoint location at that address.
+ lldb::break_id_t FindLocationIDByAddress(const Address &addr);
+
+ /// Find a breakpoint location for a given breakpoint location ID.
+ ///
+ /// \param[in] bp_loc_id
+ /// The ID specifying the location.
+ /// \return
+ /// Returns a shared pointer to the location with ID \a bp_loc_id. The
+ /// pointer
+ /// in the shared pointer will be nullptr if there is no location with that
+ /// ID.
+ lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id);
+
+ /// Get breakpoint locations by index.
+ ///
+ /// \param[in] index
+ /// The location index.
+ ///
+ /// \return
+ /// Returns a shared pointer to the location with index \a
+ /// index. The shared pointer might contain nullptr if \a index is
+ /// greater than then number of actual locations.
+ lldb::BreakpointLocationSP GetLocationAtIndex(size_t index);
+
+ /// Removes all invalid breakpoint locations.
+ ///
+ /// Removes all breakpoint locations with architectures that aren't
+ /// compatible with \a arch. Also remove any breakpoint locations with whose
+ /// locations have address where the section has been deleted (module and
+ /// object files no longer exist).
+ ///
+ /// This is typically used after the process calls exec, or anytime the
+ /// architecture of the target changes.
+ ///
+ /// \param[in] arch
+ /// If valid, check the module in each breakpoint to make sure
+ /// they are compatible, otherwise, ignore architecture.
+ void RemoveInvalidLocations(const ArchSpec &arch);
+
+ // The next section deals with various breakpoint options.
+
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ void SetEnabled(bool enable) override;
+
+ /// Check the Enable/Disable state.
+ /// \return
+ /// \b true if the breakpoint is enabled, \b false if disabled.
+ bool IsEnabled() override;
+
+ /// Set the breakpoint to ignore the next \a count breakpoint hits.
+ /// \param[in] count
+ /// The number of breakpoint hits to ignore.
+ void SetIgnoreCount(uint32_t count);
+
+ /// Return the current ignore count/
+ /// \return
+ /// The number of breakpoint hits to be ignored.
+ uint32_t GetIgnoreCount() const;
+
+ /// Return the current hit count for all locations. \return
+ /// The current hit count for all locations.
+ uint32_t GetHitCount() const;
+
+ /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
+ void SetOneShot(bool one_shot);
+
+ /// Check the OneShot state.
+ /// \return
+ /// \b true if the breakpoint is one shot, \b false otherwise.
+ bool IsOneShot() const;
+
+ /// If \a auto_continue is \b true, breakpoint will auto-continue when on
+ /// hit.
+ void SetAutoContinue(bool auto_continue);
+
+ /// Check the AutoContinue state.
+ /// \return
+ /// \b true if the breakpoint is set to auto-continue, \b false otherwise.
+ bool IsAutoContinue() const;
+
+ /// Set the valid thread to be checked when the breakpoint is hit.
+ /// \param[in] thread_id
+ /// If this thread hits the breakpoint, we stop, otherwise not.
+ void SetThreadID(lldb::tid_t thread_id);
+
+ /// Return the current stop thread value.
+ /// \return
+ /// The thread id for which the breakpoint hit will stop,
+ /// LLDB_INVALID_THREAD_ID for all threads.
+ lldb::tid_t GetThreadID() const;
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ /// Set the callback action invoked when the breakpoint is hit.
+ ///
+ /// \param[in] callback
+ /// The method that will get called when the breakpoint is hit.
+ /// \param[in] baton
+ /// A void * pointer that will get passed back to the callback function.
+ /// \param[in] is_synchronous
+ /// If \b true the callback will be run on the private event thread
+ /// before the stop event gets reported. If false, the callback will get
+ /// handled on the public event thread after the stop has been posted.
+ ///
+ /// \return
+ /// \b true if the process should stop when you hit the breakpoint.
+ /// \b false if it should continue.
+ void SetCallback(BreakpointHitCallback callback, void *baton,
+ bool is_synchronous = false);
+
+ void SetCallback(BreakpointHitCallback callback,
+ const lldb::BatonSP &callback_baton_sp,
+ bool is_synchronous = false);
+
+ void ClearCallback();
+
+ /// Set the breakpoint's condition.
+ ///
+ /// \param[in] condition
+ /// The condition expression to evaluate when the breakpoint is hit.
+ /// Pass in nullptr to clear the condition.
+ void SetCondition(const char *condition);
+
+ /// Return a pointer to the text of the condition expression.
+ ///
+ /// \return
+ /// A pointer to the condition expression text, or nullptr if no
+ // condition has been set.
+ const char *GetConditionText() const;
+
+ // The next section are various utility functions.
+
+ /// Return the number of breakpoint locations that have resolved to actual
+ /// breakpoint sites.
+ ///
+ /// \return
+ /// The number locations resolved breakpoint sites.
+ size_t GetNumResolvedLocations() const;
+
+ /// Return whether this breakpoint has any resolved locations.
+ ///
+ /// \return
+ /// True if GetNumResolvedLocations > 0
+ bool HasResolvedLocations() const;
+
+ /// Return the number of breakpoint locations.
+ ///
+ /// \return
+ /// The number breakpoint locations.
+ size_t GetNumLocations() const;
+
+ /// Put a description of this breakpoint into the stream \a s.
+ ///
+ /// \param[in] s
+ /// Stream into which to dump the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ bool show_locations = false);
+
+ /// Set the "kind" description for a breakpoint. If the breakpoint is hit
+ /// the stop info will show this "kind" description instead of the
+ /// breakpoint number. Mostly useful for internal breakpoints, where the
+ /// breakpoint number doesn't have meaning to the user.
+ ///
+ /// \param[in] kind
+ /// New "kind" description.
+ void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); }
+
+ /// Return the "kind" description for a breakpoint.
+ ///
+ /// \return
+ /// The breakpoint kind, or nullptr if none is set.
+ const char *GetBreakpointKind() const { return m_kind_description.c_str(); }
+
+ /// Accessor for the breakpoint Target.
+ /// \return
+ /// This breakpoint's Target.
+ Target &GetTarget() { return m_target; }
+
+ const Target &GetTarget() const { return m_target; }
+
+ const lldb::TargetSP GetTargetSP();
+
+ void GetResolverDescription(Stream *s);
+
+ /// Find breakpoint locations which match the (filename, line_number)
+ /// description. The breakpoint location collection is to be filled with the
+ /// matching locations. It should be initialized with 0 size by the API
+ /// client.
+ ///
+ /// \return
+ /// True if there is a match
+ ///
+ /// The locations which match the filename and line_number in loc_coll.
+ /// If its
+ /// size is 0 and true is returned, it means the breakpoint fully matches
+ /// the
+ /// description.
+ bool GetMatchingFileLine(ConstString filename, uint32_t line_number,
+ BreakpointLocationCollection &loc_coll);
+
+ void GetFilterDescription(Stream *s);
+
+ /// Returns the BreakpointOptions structure set at the breakpoint level.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// \return
+ /// A pointer to this breakpoint's BreakpointOptions.
+ BreakpointOptions *GetOptions();
+
+ /// Returns the BreakpointOptions structure set at the breakpoint level.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// \return
+ /// A pointer to this breakpoint's BreakpointOptions.
+ const BreakpointOptions *GetOptions() const;
+
+ /// Invoke the callback action when the breakpoint is hit.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// \param[in] context
+ /// Described the breakpoint event.
+ ///
+ /// \param[in] bp_loc_id
+ /// Which breakpoint location hit this breakpoint.
+ ///
+ /// \return
+ /// \b true if the target should stop at this breakpoint and \b false not.
+ bool InvokeCallback(StoppointCallbackContext *context,
+ lldb::break_id_t bp_loc_id);
+
+ bool IsHardware() const { return m_hardware; }
+
+ lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; }
+
+ lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
+
+private: // The target needs to manage adding & removing names. It will do the
+ // checking for name validity as well.
+ bool AddName(llvm::StringRef new_name);
+
+ void RemoveName(const char *name_to_remove) {
+ if (name_to_remove)
+ m_name_list.erase(name_to_remove);
+ }
+
+public:
+ bool MatchesName(const char *name) {
+ return m_name_list.find(name) != m_name_list.end();
+ }
+
+ void GetNames(std::vector<std::string> &names) {
+ names.clear();
+ for (auto name : m_name_list) {
+ names.push_back(name);
+ }
+ }
+
+ /// Set a pre-condition filter that overrides all user provided
+ /// filters/callbacks etc.
+ ///
+ /// Used to define fancy breakpoints that can do dynamic hit detection
+ /// without taking up the condition slot - which really belongs to the user
+ /// anyway...
+ ///
+ /// The Precondition should not continue the target, it should return true
+ /// if the condition says to stop and false otherwise.
+ ///
+ void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
+ m_precondition_sp = precondition_sp;
+ }
+
+ bool EvaluatePrecondition(StoppointCallbackContext &context);
+
+ lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
+
+ // Produces the OR'ed values for all the names assigned to this breakpoint.
+ const BreakpointName::Permissions &GetPermissions() const {
+ return m_permissions;
+ }
+
+ BreakpointName::Permissions &GetPermissions() {
+ return m_permissions;
+ }
+
+ bool AllowList() const {
+ return GetPermissions().GetAllowList();
+ }
+ bool AllowDisable() const {
+ return GetPermissions().GetAllowDisable();
+ }
+ bool AllowDelete() const {
+ return GetPermissions().GetAllowDelete();
+ }
+
+protected:
+ friend class Target;
+ // Protected Methods
+
+ /// Constructors and Destructors
+ /// Only the Target can make a breakpoint, and it owns the breakpoint
+ /// lifespans. The constructor takes a filter and a resolver. Up in Target
+ /// there are convenience variants that make breakpoints for some common
+ /// cases.
+ ///
+ /// \param[in] target
+ /// The target in which the breakpoint will be set.
+ ///
+ /// \param[in] filter_sp
+ /// Shared pointer to the search filter that restricts the search domain of
+ /// the breakpoint.
+ ///
+ /// \param[in] resolver_sp
+ /// Shared pointer to the resolver object that will determine breakpoint
+ /// matches.
+ ///
+ /// \param hardware
+ /// If true, request a hardware breakpoint to be used to implement the
+ /// breakpoint locations.
+ ///
+ /// \param resolve_indirect_symbols
+ /// If true, and the address of a given breakpoint location in this
+ /// breakpoint is set on an
+ /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual
+ /// breakpoint site will
+ /// be set on the target of the indirect symbol.
+ // This is the generic constructor
+ Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp,
+ lldb::BreakpointResolverSP &resolver_sp, bool hardware,
+ bool resolve_indirect_symbols = true);
+
+ friend class BreakpointLocation; // To call the following two when determining
+ // whether to stop.
+
+ void DecrementIgnoreCount();
+
+ // BreakpointLocation::IgnoreCountShouldStop &
+ // Breakpoint::IgnoreCountShouldStop can only be called once per stop, and
+ // BreakpointLocation::IgnoreCountShouldStop should be tested first, and if
+ // it returns false we should continue, otherwise we should test
+ // Breakpoint::IgnoreCountShouldStop.
+
+ bool IgnoreCountShouldStop();
+
+ void IncrementHitCount() { m_hit_count++; }
+
+ void DecrementHitCount() {
+ assert(m_hit_count > 0);
+ m_hit_count--;
+ }
+
+private:
+ // This one should only be used by Target to copy breakpoints from target to
+ // target - primarily from the dummy target to prime new targets.
+ Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);
+
+ // For Breakpoint only
+ bool m_being_created;
+ bool
+ m_hardware; // If this breakpoint is required to use a hardware breakpoint
+ Target &m_target; // The target that holds this breakpoint.
+ std::unordered_set<std::string> m_name_list; // If not empty, this is the name
+ // of this breakpoint (many
+ // breakpoints can share the same
+ // name.)
+ lldb::SearchFilterSP
+ m_filter_sp; // The filter that constrains the breakpoint's domain.
+ lldb::BreakpointResolverSP
+ m_resolver_sp; // The resolver that defines this breakpoint.
+ lldb::BreakpointPreconditionSP m_precondition_sp; // The precondition is a
+ // breakpoint-level hit
+ // filter that can be used
+ // to skip certain breakpoint hits. For instance, exception breakpoints use
+ // this to limit the stop to certain exception classes, while leaving the
+ // condition & callback free for user specification.
+ std::unique_ptr<BreakpointOptions>
+ m_options_up; // Settable breakpoint options
+ BreakpointLocationList
+ m_locations; // The list of locations currently found for this breakpoint.
+ std::string m_kind_description;
+ bool m_resolve_indirect_symbols;
+ uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been
+ // hit. This is kept
+ // separately from the locations hit counts, since locations can go away when
+ // their backing library gets unloaded, and we would lose hit counts.
+ BreakpointName::Permissions m_permissions;
+
+ void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
+
+ void SendBreakpointChangedEvent(BreakpointEventData *data);
+
+ DISALLOW_COPY_AND_ASSIGN(Breakpoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Breakpoint_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h
new file mode 100644
index 0000000..0951329
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h
@@ -0,0 +1,98 @@
+//===-- BreakpointID.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointID_h_
+#define liblldb_BreakpointID_h_
+
+
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+// class BreakpointID
+
+class BreakpointID {
+public:
+ BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
+ lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
+
+ virtual ~BreakpointID();
+
+ lldb::break_id_t GetBreakpointID() const { return m_break_id; }
+
+ lldb::break_id_t GetLocationID() const { return m_location_id; }
+
+ void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) {
+ m_break_id = bp_id;
+ m_location_id = loc_id;
+ }
+
+ void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; }
+
+ void SetBreakpointLocationID(lldb::break_id_t loc_id) {
+ m_location_id = loc_id;
+ }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ static bool IsRangeIdentifier(llvm::StringRef str);
+ static bool IsValidIDExpression(llvm::StringRef str);
+ static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
+
+ /// Takes an input string containing the description of a breakpoint or
+ /// breakpoint and location and returns a BreakpointID filled out with
+ /// the proper id and location.
+ ///
+ /// \param[in] input
+ /// A string containing JUST the breakpoint description.
+ /// \return
+ /// If \p input was not a valid breakpoint ID string, returns
+ /// \b llvm::None. Otherwise returns a BreakpointID with members filled
+ /// out accordingly.
+ static llvm::Optional<BreakpointID>
+ ParseCanonicalReference(llvm::StringRef input);
+
+ /// Takes an input string and checks to see whether it is a breakpoint name.
+ /// If it is a mal-formed breakpoint name, error will be set to an appropriate
+ /// error string.
+ ///
+ /// \param[in] input
+ /// A string containing JUST the breakpoint description.
+ /// \param[out] error
+ /// If the name is a well-formed breakpoint name, set to success,
+ /// otherwise set to an error.
+ /// \return
+ /// \b true if the name is a breakpoint name (as opposed to an ID or
+ /// range) false otherwise.
+ static bool StringIsBreakpointName(llvm::StringRef str, Status &error);
+
+ /// Takes a breakpoint ID and the breakpoint location id and returns
+ /// a string containing the canonical description for the breakpoint
+ /// or breakpoint location.
+ ///
+ /// \param[out] break_id
+ /// This is the break id.
+ ///
+ /// \param[out] break_loc_id
+ /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
+ /// location is to be specified.
+ static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id);
+
+protected:
+ lldb::break_id_t m_break_id;
+ lldb::break_id_t m_location_id;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointID_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h
new file mode 100644
index 0000000..c642922
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h
@@ -0,0 +1,76 @@
+//===-- BreakpointIDList.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointIDList_h_
+#define liblldb_BreakpointIDList_h_
+
+#include <utility>
+#include <vector>
+
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointName.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// class BreakpointIDList
+
+class BreakpointIDList {
+public:
+ // TODO: Convert this class to StringRef.
+ typedef std::vector<BreakpointID> BreakpointIDArray;
+
+ BreakpointIDList();
+
+ virtual ~BreakpointIDList();
+
+ size_t GetSize() const;
+
+ const BreakpointID &GetBreakpointIDAtIndex(size_t index) const;
+
+ bool RemoveBreakpointIDAtIndex(size_t index);
+
+ void Clear();
+
+ bool AddBreakpointID(BreakpointID bp_id);
+
+ bool AddBreakpointID(const char *bp_id);
+
+ // TODO: This should take a const BreakpointID.
+ bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const;
+
+ bool FindBreakpointID(const char *bp_id, size_t *position) const;
+
+ void InsertStringArray(llvm::ArrayRef<const char *> string_array,
+ CommandReturnObject &result);
+
+ // Returns a pair consisting of the beginning and end of a breakpoint
+ // ID range expression. If the input string is not a valid specification,
+ // returns an empty pair.
+ static std::pair<llvm::StringRef, llvm::StringRef>
+ SplitIDRangeExpression(llvm::StringRef in_string);
+
+ static void FindAndReplaceIDRanges(Args &old_args, Target *target,
+ bool allow_locations,
+ BreakpointName::Permissions
+ ::PermissionKinds purpose,
+ CommandReturnObject &result,
+ Args &new_args);
+
+private:
+ BreakpointIDArray m_breakpoint_ids;
+ BreakpointID m_invalid_id;
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointIDList_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h
new file mode 100644
index 0000000..fe10adb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h
@@ -0,0 +1,174 @@
+//===-- BreakpointList.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointList_h_
+#define liblldb_BreakpointList_h_
+
+#include <list>
+#include <mutex>
+
+#include "lldb/Breakpoint/Breakpoint.h"
+
+namespace lldb_private {
+
+/// \class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h"
+/// This class manages a list of breakpoints.
+
+/// General Outline:
+/// Allows adding and removing breakpoints and find by ID and index.
+
+class BreakpointList {
+public:
+ BreakpointList(bool is_internal);
+
+ ~BreakpointList();
+
+ /// Add the breakpoint \a bp_sp to the list.
+ ///
+ /// \param[in] bp_sp
+ /// Shared pointer to the breakpoint that will get added to the list.
+ ///
+ /// \result
+ /// Returns breakpoint id.
+ lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify);
+
+ /// Standard "Dump" method. At present it does nothing.
+ void Dump(Stream *s) const;
+
+ /// Returns a shared pointer to the breakpoint with id \a breakID. Const
+ /// version.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint ID to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL pointer if the
+ /// breakpoint doesn't exist.
+ lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const;
+
+ /// Returns a shared pointer to the breakpoint with index \a i.
+ ///
+ /// \param[in] i
+ /// The breakpoint index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL pointer if the
+ /// breakpoint doesn't exist.
+ lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const;
+
+ /// Find all the breakpoints with a given name
+ ///
+ /// \param[in] name
+ /// The breakpoint name for which to search.
+ ///
+ /// \result
+ /// \bfalse if the input name was not a legal breakpoint name.
+ bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps);
+
+ /// Returns the number of elements in this breakpoint list.
+ ///
+ /// \result
+ /// The number of elements.
+ size_t GetSize() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_breakpoints.size();
+ }
+
+ /// Removes the breakpoint given by \b breakID from this list.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint index to remove.
+ ///
+ /// \result
+ /// \b true if the breakpoint \a breakID was in the list.
+ bool Remove(lldb::break_id_t breakID, bool notify);
+
+ /// Removes all invalid breakpoint locations.
+ ///
+ /// Removes all breakpoint locations in the list with architectures that
+ /// aren't compatible with \a arch. Also remove any breakpoint locations
+ /// with whose locations have address where the section has been deleted
+ /// (module and object files no longer exist).
+ ///
+ /// This is typically used after the process calls exec, or anytime the
+ /// architecture of the target changes.
+ ///
+ /// \param[in] arch
+ /// If valid, check the module in each breakpoint to make sure
+ /// they are compatible, otherwise, ignore architecture.
+ void RemoveInvalidLocations(const ArchSpec &arch);
+
+ void SetEnabledAll(bool enabled);
+
+ void SetEnabledAllowed(bool enabled);
+
+ /// Removes all the breakpoints from this list.
+ void RemoveAll(bool notify);
+
+ /// Removes all the breakpoints from this list - first checking the
+ /// ePermDelete on the breakpoints. This call should be used unless you are
+ /// shutting down and need to actually clear them all.
+ void RemoveAllowed(bool notify);
+
+ /// Tell all the breakpoints to update themselves due to a change in the
+ /// modules in \a module_list. \a added says whether the module was loaded
+ /// or unloaded.
+ ///
+ /// \param[in] module_list
+ /// The module list that has changed.
+ ///
+ /// \param[in] load
+ /// \b true if the modules are loaded, \b false if unloaded.
+ ///
+ /// \param[in] delete_locations
+ /// If \a load is \b false, then delete breakpoint locations when
+ /// when updating breakpoints.
+ void UpdateBreakpoints(ModuleList &module_list, bool load,
+ bool delete_locations);
+
+ void UpdateBreakpointsWhenModuleIsReplaced(lldb::ModuleSP old_module_sp,
+ lldb::ModuleSP new_module_sp);
+
+ void ClearAllBreakpointSites();
+
+ /// Sets the passed in Locker to hold the Breakpoint List mutex.
+ ///
+ /// \param[in] locker
+ /// The locker object that is set.
+ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
+
+protected:
+ typedef std::vector<lldb::BreakpointSP> bp_collection;
+
+ bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID);
+
+ bp_collection::const_iterator
+ GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
+
+ std::recursive_mutex &GetMutex() const { return m_mutex; }
+
+ mutable std::recursive_mutex m_mutex;
+ bp_collection m_breakpoints;
+ lldb::break_id_t m_next_break_id;
+ bool m_is_internal;
+
+public:
+ typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP,
+ list_adapter, std::recursive_mutex>
+ BreakpointIterable;
+ BreakpointIterable Breakpoints() {
+ return BreakpointIterable(m_breakpoints, GetMutex());
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(BreakpointList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointList_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h
new file mode 100644
index 0000000..7b27160
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h
@@ -0,0 +1,356 @@
+//===-- BreakpointLocation.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointLocation_h_
+#define liblldb_BreakpointLocation_h_
+
+#include <memory>
+#include <mutex>
+
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Core/Address.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class BreakpointLocation BreakpointLocation.h
+/// "lldb/Breakpoint/BreakpointLocation.h" Class that manages one unique (by
+/// address) instance of a logical breakpoint.
+
+/// General Outline:
+/// A breakpoint location is defined by the breakpoint that produces it,
+/// and the address that resulted in this particular instantiation. Each
+/// breakpoint location also may have a breakpoint site if its address has
+/// been loaded into the program. Finally it has a settable options object.
+///
+/// FIXME: Should we also store some fingerprint for the location, so
+/// we can map one location to the "equivalent location" on rerun? This would
+/// be useful if you've set options on the locations.
+
+class BreakpointLocation
+ : public std::enable_shared_from_this<BreakpointLocation>,
+ public StoppointLocation {
+public:
+ ~BreakpointLocation() override;
+
+ /// Gets the load address for this breakpoint location \return
+ /// Returns breakpoint location load address, \b
+ /// LLDB_INVALID_ADDRESS if not yet set.
+ lldb::addr_t GetLoadAddress() const override;
+
+ /// Gets the Address for this breakpoint location \return
+ /// Returns breakpoint location Address.
+ Address &GetAddress();
+ /// Gets the Breakpoint that created this breakpoint location \return
+ /// Returns the owning breakpoint.
+ Breakpoint &GetBreakpoint();
+
+ Target &GetTarget();
+
+ /// Determines whether we should stop due to a hit at this breakpoint
+ /// location.
+ ///
+ /// Side Effects: This may evaluate the breakpoint condition, and run the
+ /// callback. So this command may do a considerable amount of work.
+ ///
+ /// \return
+ /// \b true if this breakpoint location thinks we should stop,
+ /// \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context) override;
+
+ // The next section deals with various breakpoint options.
+
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ void SetEnabled(bool enabled);
+
+ /// Check the Enable/Disable state.
+ ///
+ /// \return
+ /// \b true if the breakpoint is enabled, \b false if disabled.
+ bool IsEnabled() const;
+
+ /// If \a auto_continue is \b true, set the breakpoint to continue when hit.
+ void SetAutoContinue(bool auto_continue);
+
+ /// Check the AutoContinue state.
+ ///
+ /// \return
+ /// \b true if the breakpoint is set to auto-continue, \b false if not.
+ bool IsAutoContinue() const;
+
+ /// Return the current Ignore Count.
+ ///
+ /// \return
+ /// The number of breakpoint hits to be ignored.
+ uint32_t GetIgnoreCount();
+
+ /// Set the breakpoint to ignore the next \a count breakpoint hits.
+ ///
+ /// \param[in] count
+ /// The number of breakpoint hits to ignore.
+ void SetIgnoreCount(uint32_t n);
+
+ /// Set the callback action invoked when the breakpoint is hit.
+ ///
+ /// The callback will return a bool indicating whether the target should
+ /// stop at this breakpoint or not.
+ ///
+ /// \param[in] callback
+ /// The method that will get called when the breakpoint is hit.
+ ///
+ /// \param[in] callback_baton_sp
+ /// A shared pointer to a Baton that provides the void * needed
+ /// for the callback.
+ ///
+ /// \see lldb_private::Baton
+ void SetCallback(BreakpointHitCallback callback,
+ const lldb::BatonSP &callback_baton_sp, bool is_synchronous);
+
+ void SetCallback(BreakpointHitCallback callback, void *baton,
+ bool is_synchronous);
+
+ void ClearCallback();
+
+ /// Set the breakpoint location's condition.
+ ///
+ /// \param[in] condition
+ /// The condition expression to evaluate when the breakpoint is hit.
+ void SetCondition(const char *condition);
+
+ /// Return a pointer to the text of the condition expression.
+ ///
+ /// \return
+ /// A pointer to the condition expression text, or nullptr if no
+ // condition has been set.
+ const char *GetConditionText(size_t *hash = nullptr) const;
+
+ bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error);
+
+ /// Set the valid thread to be checked when the breakpoint is hit.
+ ///
+ /// \param[in] thread_id
+ /// If this thread hits the breakpoint, we stop, otherwise not.
+ void SetThreadID(lldb::tid_t thread_id);
+
+ lldb::tid_t GetThreadID();
+
+ void SetThreadIndex(uint32_t index);
+
+ uint32_t GetThreadIndex() const;
+
+ void SetThreadName(const char *thread_name);
+
+ const char *GetThreadName() const;
+
+ void SetQueueName(const char *queue_name);
+
+ const char *GetQueueName() const;
+
+ // The next section deals with this location's breakpoint sites.
+
+ /// Try to resolve the breakpoint site for this location.
+ ///
+ /// \return
+ /// \b true if we were successful at setting a breakpoint site,
+ /// \b false otherwise.
+ bool ResolveBreakpointSite();
+
+ /// Clear this breakpoint location's breakpoint site - for instance when
+ /// disabling the breakpoint.
+ ///
+ /// \return
+ /// \b true if there was a breakpoint site to be cleared, \b false
+ /// otherwise.
+ bool ClearBreakpointSite();
+
+ /// Return whether this breakpoint location has a breakpoint site. \return
+ /// \b true if there was a breakpoint site for this breakpoint
+ /// location, \b false otherwise.
+ bool IsResolved() const;
+
+ lldb::BreakpointSiteSP GetBreakpointSite() const;
+
+ // The next section are generic report functions.
+
+ /// Print a description of this breakpoint location to the stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ /// Standard "Dump" method. At present it does nothing.
+ void Dump(Stream *s) const override;
+
+ /// Use this to set location specific breakpoint options.
+ ///
+ /// It will create a copy of the containing breakpoint's options if that
+ /// hasn't been done already
+ ///
+ /// \return
+ /// A pointer to the breakpoint options.
+ BreakpointOptions *GetLocationOptions();
+
+ /// Use this to access breakpoint options from this breakpoint location.
+ /// This will return the options that have a setting for the specified
+ /// BreakpointOptions kind.
+ ///
+ /// \param[in] kind
+ /// The particular option you are looking up.
+ /// \return
+ /// A pointer to the containing breakpoint's options if this
+ /// location doesn't have its own copy.
+ const BreakpointOptions *GetOptionsSpecifyingKind(
+ BreakpointOptions::OptionKind kind) const;
+
+ bool ValidForThisThread(Thread *thread);
+
+ /// Invoke the callback action when the breakpoint is hit.
+ ///
+ /// Meant to be used by the BreakpointLocation class.
+ ///
+ /// \param[in] context
+ /// Described the breakpoint event.
+ ///
+ /// \param[in] bp_loc_id
+ /// Which breakpoint location hit this breakpoint.
+ ///
+ /// \return
+ /// \b true if the target should stop at this breakpoint and \b
+ /// false not.
+ bool InvokeCallback(StoppointCallbackContext *context);
+
+ /// Returns whether we should resolve Indirect functions in setting the
+ /// breakpoint site for this location.
+ ///
+ /// \return
+ /// \b true if the breakpoint SITE for this location should be set on the
+ /// resolved location for Indirect functions.
+ bool ShouldResolveIndirectFunctions() {
+ return m_should_resolve_indirect_functions;
+ }
+
+ /// Returns whether the address set in the breakpoint site for this location
+ /// was found by resolving an indirect symbol.
+ ///
+ /// \return
+ /// \b true or \b false as given in the description above.
+ bool IsIndirect() { return m_is_indirect; }
+
+ void SetIsIndirect(bool is_indirect) { m_is_indirect = is_indirect; }
+
+ /// Returns whether the address set in the breakpoint location was re-routed
+ /// to the target of a re-exported symbol.
+ ///
+ /// \return
+ /// \b true or \b false as given in the description above.
+ bool IsReExported() { return m_is_reexported; }
+
+ void SetIsReExported(bool is_reexported) { m_is_reexported = is_reexported; }
+
+ /// Returns whether the two breakpoint locations might represent "equivalent
+ /// locations". This is used when modules changed to determine if a Location
+ /// in the old module might be the "same as" the input location.
+ ///
+ /// \param[in] location
+ /// The location to compare against.
+ ///
+ /// \return
+ /// \b true or \b false as given in the description above.
+ bool EquivalentToLocation(BreakpointLocation &location);
+
+protected:
+ friend class BreakpointSite;
+ friend class BreakpointLocationList;
+ friend class Process;
+ friend class StopInfoBreakpoint;
+
+ /// Set the breakpoint site for this location to \a bp_site_sp.
+ ///
+ /// \param[in] bp_site_sp
+ /// The breakpoint site we are setting for this location.
+ ///
+ /// \return
+ /// \b true if we were successful at setting the breakpoint site,
+ /// \b false otherwise.
+ bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp);
+
+ void DecrementIgnoreCount();
+
+ bool IgnoreCountShouldStop();
+
+private:
+ void SwapLocation(lldb::BreakpointLocationSP swap_from);
+
+ void BumpHitCount();
+
+ void UndoBumpHitCount();
+
+ // Constructors and Destructors
+ //
+ // Only the Breakpoint can make breakpoint locations, and it owns them.
+
+ /// Constructor.
+ ///
+ /// \param[in] owner
+ /// A back pointer to the breakpoint that owns this location.
+ ///
+ /// \param[in] addr
+ /// The Address defining this location.
+ ///
+ /// \param[in] tid
+ /// The thread for which this breakpoint location is valid, or
+ /// LLDB_INVALID_THREAD_ID if it is valid for all threads.
+ ///
+ /// \param[in] hardware
+ /// \b true if a hardware breakpoint is requested.
+
+ BreakpointLocation(lldb::break_id_t bid, Breakpoint &owner,
+ const Address &addr, lldb::tid_t tid, bool hardware,
+ bool check_for_resolver = true);
+
+ // Data members:
+ bool m_being_created;
+ bool m_should_resolve_indirect_functions;
+ bool m_is_reexported;
+ bool m_is_indirect;
+ Address m_address; ///< The address defining this location.
+ Breakpoint &m_owner; ///< The breakpoint that produced this object.
+ std::unique_ptr<BreakpointOptions> m_options_up; ///< Breakpoint options
+ /// pointer, nullptr if we're
+ /// using our breakpoint's
+ /// options.
+ lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be
+ ///shared by more than one location.)
+ lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to
+ ///use in testing our condition.
+ std::mutex m_condition_mutex; ///< Guards parsing and evaluation of the
+ ///condition, which could be evaluated by
+ /// multiple processes.
+ size_t m_condition_hash; ///< For testing whether the condition source code
+ ///changed.
+
+ void SetShouldResolveIndirectFunctions(bool do_resolve) {
+ m_should_resolve_indirect_functions = do_resolve;
+ }
+
+ void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind);
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointLocation_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h
new file mode 100644
index 0000000..3da52eb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h
@@ -0,0 +1,184 @@
+//===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointLocationCollection_h_
+#define liblldb_BreakpointLocationCollection_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class BreakpointLocationCollection {
+public:
+ BreakpointLocationCollection();
+
+ ~BreakpointLocationCollection();
+
+ BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs);
+
+ /// Add the breakpoint \a bp_loc_sp to the list.
+ ///
+ /// \param[in] bp_sp
+ /// Shared pointer to the breakpoint location that will get added
+ /// to the list.
+ ///
+ /// \result
+ /// Returns breakpoint location id.
+ void Add(const lldb::BreakpointLocationSP &bp_loc_sp);
+
+ /// Removes the breakpoint location given by \b breakID from this
+ /// list.
+ ///
+ /// \param[in] break_id
+ /// The breakpoint index to remove.
+ ///
+ /// \param[in] break_loc_id
+ /// The breakpoint location index in break_id to remove.
+ ///
+ /// \result
+ /// \b true if the breakpoint was in the list.
+ bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
+
+ /// Returns a shared pointer to the breakpoint location with id \a
+ /// breakID.
+ ///
+ /// \param[in] break_id
+ /// The breakpoint ID to seek for.
+ ///
+ /// \param[in] break_loc_id
+ /// The breakpoint location ID in \a break_id to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL
+ /// pointer if the breakpoint doesn't exist.
+ lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id);
+
+ /// Returns a shared pointer to the breakpoint location with id \a
+ /// breakID, const version.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint location ID to seek for.
+ ///
+ /// \param[in] break_loc_id
+ /// The breakpoint location ID in \a break_id to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL
+ /// pointer if the breakpoint doesn't exist.
+ const lldb::BreakpointLocationSP
+ FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
+
+ /// Returns a shared pointer to the breakpoint location with index
+ /// \a i.
+ ///
+ /// \param[in] i
+ /// The breakpoint location index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL
+ /// pointer if the breakpoint doesn't exist.
+ lldb::BreakpointLocationSP GetByIndex(size_t i);
+
+ /// Returns a shared pointer to the breakpoint location with index
+ /// \a i, const version.
+ ///
+ /// \param[in] i
+ /// The breakpoint location index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a NULL
+ /// pointer if the breakpoint doesn't exist.
+ const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
+
+ /// Returns the number of elements in this breakpoint location list.
+ ///
+ /// \result
+ /// The number of elements.
+ size_t GetSize() const { return m_break_loc_collection.size(); }
+
+ /// Enquires of all the breakpoint locations in this list whether
+ /// we should stop at a hit at \a breakID.
+ ///
+ /// \param[in] context
+ /// This contains the information about this stop.
+ ///
+ /// \param[in] breakID
+ /// This break ID that we hit.
+ ///
+ /// \return
+ /// \b true if we should stop, \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context);
+
+ /// Print a description of the breakpoint locations in this list
+ /// to the stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ /// Check whether this collection of breakpoint locations have any
+ /// thread specifiers, and if yes, is \a thread_id contained in any
+ /// of these specifiers.
+ ///
+ /// \param[in] thread
+ /// The thread against which to test.
+ ///
+ /// return
+ /// \b true if the collection contains at least one location that
+ /// would be valid for this thread, false otherwise.
+ bool ValidForThisThread(Thread *thread);
+
+ /// Tell whether ALL the breakpoints in the location collection are internal.
+ ///
+ /// \result
+ /// \b true if all breakpoint locations are owned by internal breakpoints,
+ /// \b false otherwise.
+ bool IsInternal() const;
+
+protected:
+ // Classes that inherit from BreakpointLocationCollection can see and modify
+ // these
+
+private:
+ // For BreakpointLocationCollection only
+
+ typedef std::vector<lldb::BreakpointLocationSP> collection;
+
+ collection::iterator GetIDPairIterator(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id);
+
+ collection::const_iterator
+ GetIDPairConstIterator(lldb::break_id_t break_id,
+ lldb::break_id_t break_loc_id) const;
+
+ collection m_break_loc_collection;
+ mutable std::mutex m_collection_mutex;
+
+public:
+ typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
+ vector_adapter>
+ BreakpointLocationCollectionIterable;
+ BreakpointLocationCollectionIterable BreakpointLocations() {
+ return BreakpointLocationCollectionIterable(m_break_loc_collection);
+ }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointLocationCollection_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h
new file mode 100644
index 0000000..b7e0e49
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -0,0 +1,223 @@
+//===-- BreakpointLocationList.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointLocationList_h_
+#define liblldb_BreakpointLocationList_h_
+
+#include <map>
+#include <mutex>
+#include <vector>
+
+#include "lldb/Core/Address.h"
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class BreakpointLocationList BreakpointLocationList.h
+/// "lldb/Breakpoint/BreakpointLocationList.h" This class is used by
+/// Breakpoint to manage a list of breakpoint locations, each breakpoint
+/// location in the list has a unique ID, and is unique by Address as well.
+class BreakpointLocationList {
+ // Only Breakpoints can make the location list, or add elements to it. This
+ // is not just some random collection of locations. Rather, the act of
+ // adding the location to this list sets its ID, and implicitly all the
+ // locations have the same breakpoint ID as well. If you need a generic
+ // container for breakpoint locations, use BreakpointLocationCollection.
+ friend class Breakpoint;
+
+public:
+ virtual ~BreakpointLocationList();
+
+ /// Standard "Dump" method. At present it does nothing.
+ void Dump(Stream *s) const;
+
+ /// Returns a shared pointer to the breakpoint location at address \a addr -
+ /// const version.
+ ///
+ /// \param[in] addr
+ /// The address to look for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a nullptr
+ /// pointer if the breakpoint doesn't exist.
+ const lldb::BreakpointLocationSP FindByAddress(const Address &addr) const;
+
+ /// Returns a shared pointer to the breakpoint location with id \a breakID,
+ /// const version.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint location ID to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a nullptr
+ /// pointer if the breakpoint doesn't exist.
+ lldb::BreakpointLocationSP FindByID(lldb::break_id_t breakID) const;
+
+ /// Returns the breakpoint location id to the breakpoint location at address
+ /// \a addr.
+ ///
+ /// \param[in] addr
+ /// The address to match.
+ ///
+ /// \result
+ /// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
+ lldb::break_id_t FindIDByAddress(const Address &addr);
+
+ /// Returns a breakpoint location list of the breakpoint locations in the
+ /// module \a module. This list is allocated, and owned by the caller.
+ ///
+ /// \param[in] module
+ /// The module to seek in.
+ ///
+ /// \param[in]
+ /// A breakpoint collection that gets any breakpoint locations
+ /// that match \a module appended to.
+ ///
+ /// \result
+ /// The number of matches
+ size_t FindInModule(Module *module,
+ BreakpointLocationCollection &bp_loc_list);
+
+ /// Returns a shared pointer to the breakpoint location with index \a i.
+ ///
+ /// \param[in] i
+ /// The breakpoint location index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a nullptr
+ /// pointer if the breakpoint doesn't exist.
+ lldb::BreakpointLocationSP GetByIndex(size_t i);
+
+ /// Returns a shared pointer to the breakpoint location with index \a i,
+ /// const version.
+ ///
+ /// \param[in] i
+ /// The breakpoint location index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint. May contain a nullptr
+ /// pointer if the breakpoint doesn't exist.
+ const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
+
+ /// Removes all the locations in this list from their breakpoint site owners
+ /// list.
+ void ClearAllBreakpointSites();
+
+ /// Tells all the breakpoint locations in this list to attempt to resolve
+ /// any possible breakpoint sites.
+ void ResolveAllBreakpointSites();
+
+ /// Returns the number of breakpoint locations in this list with resolved
+ /// breakpoints.
+ ///
+ /// \result
+ /// Number of qualifying breakpoint locations.
+ size_t GetNumResolvedLocations() const;
+
+ /// Returns the number hit count of all locations in this list.
+ ///
+ /// \result
+ /// Hit count of all locations in this list.
+ uint32_t GetHitCount() const;
+
+ /// Enquires of the breakpoint location in this list with ID \a breakID
+ /// whether we should stop.
+ ///
+ /// \param[in] context
+ /// This contains the information about this stop.
+ ///
+ /// \param[in] breakID
+ /// This break ID that we hit.
+ ///
+ /// \return
+ /// \b true if we should stop, \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
+
+ /// Returns the number of elements in this breakpoint location list.
+ ///
+ /// \result
+ /// The number of elements.
+ size_t GetSize() const { return m_locations.size(); }
+
+ /// Print a description of the breakpoint locations in this list to the
+ /// stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+protected:
+ /// This is the standard constructor.
+ ///
+ /// It creates an empty breakpoint location list. It is protected here
+ /// because only Breakpoints are allowed to create the breakpoint location
+ /// list.
+ BreakpointLocationList(Breakpoint &owner);
+
+ /// Add the breakpoint \a bp_loc_sp to the list.
+ ///
+ /// \param[in] bp_sp
+ /// Shared pointer to the breakpoint location that will get
+ /// added to the list.
+ ///
+ /// \result
+ /// Returns breakpoint location id.
+ lldb::BreakpointLocationSP Create(const Address &addr,
+ bool resolve_indirect_symbols);
+
+ void StartRecordingNewLocations(BreakpointLocationCollection &new_locations);
+
+ void StopRecordingNewLocations();
+
+ lldb::BreakpointLocationSP AddLocation(const Address &addr,
+ bool resolve_indirect_symbols,
+ bool *new_location = nullptr);
+
+ void SwapLocation(lldb::BreakpointLocationSP to_location_sp,
+ lldb::BreakpointLocationSP from_location_sp);
+
+ bool RemoveLocation(const lldb::BreakpointLocationSP &bp_loc_sp);
+
+ void RemoveLocationByIndex(size_t idx);
+
+ void RemoveInvalidLocations(const ArchSpec &arch);
+
+ void Compact();
+
+ typedef std::vector<lldb::BreakpointLocationSP> collection;
+ typedef std::map<lldb_private::Address, lldb::BreakpointLocationSP,
+ Address::ModulePointerAndOffsetLessThanFunctionObject>
+ addr_map;
+
+ Breakpoint &m_owner;
+ collection m_locations; // Vector of locations, sorted by ID
+ addr_map m_address_to_location;
+ mutable std::recursive_mutex m_mutex;
+ lldb::break_id_t m_next_id;
+ BreakpointLocationCollection *m_new_location_recorder;
+
+public:
+ typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
+ vector_adapter>
+ BreakpointLocationIterable;
+
+ BreakpointLocationIterable BreakpointLocations() {
+ return BreakpointLocationIterable(m_locations);
+ }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointLocationList_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h
new file mode 100644
index 0000000..61020a6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h
@@ -0,0 +1,208 @@
+//===-- BreakpointName.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Breakpoint_Name_h_
+#define liblldb_Breakpoint_Name_h_
+
+#include <memory>
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+#include "lldb/Breakpoint/BreakpointID.h"
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/BreakpointLocationList.h"
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+class BreakpointName {
+public:
+ class Permissions
+ {
+ public:
+
+ enum PermissionKinds { listPerm = 0, disablePerm = 1,
+ deletePerm = 2, allPerms = 3 };
+
+ Permissions(bool in_list, bool in_disable, bool in_delete)
+ {
+ m_permissions[listPerm] = in_list;
+ m_permissions[disablePerm] = in_disable;
+ m_permissions[deletePerm] = in_delete;
+ m_set_mask.Set(permissions_mask[allPerms]);
+ }
+
+ Permissions(const Permissions &rhs)
+ {
+ m_permissions[listPerm] = rhs.m_permissions[listPerm];
+ m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
+ m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
+ m_set_mask = rhs.m_set_mask;
+ }
+
+ Permissions()
+ {
+ m_permissions[listPerm] = true;
+ m_permissions[disablePerm] = true;
+ m_permissions[deletePerm] = true;
+ m_set_mask.Clear();
+ }
+
+ const Permissions &operator= (const Permissions &rhs)
+ {
+ if (this != &rhs) {
+ m_permissions[listPerm] = rhs.m_permissions[listPerm];
+ m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
+ m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
+ m_set_mask = rhs.m_set_mask;
+ }
+ return *this;
+ }
+
+ void Clear() {
+ *this = Permissions();
+ }
+
+ // Merge the permissions from incoming into this set of permissions. Only
+ // merge set permissions, and most restrictive permission wins.
+ void MergeInto(const Permissions &incoming)
+ {
+ MergePermission(incoming, listPerm);
+ MergePermission(incoming, disablePerm);
+ MergePermission(incoming, deletePerm);
+ }
+
+ bool GetAllowList() const { return GetPermission(listPerm); }
+ bool SetAllowList(bool value) { return SetPermission(listPerm, value); }
+
+ bool GetAllowDelete() const { return GetPermission(deletePerm); }
+ bool SetAllowDelete(bool value) { return SetPermission(deletePerm, value); }
+
+ bool GetAllowDisable() const { return GetPermission(disablePerm); }
+ bool SetAllowDisable(bool value) { return SetPermission(disablePerm,
+ value); }
+
+ bool GetPermission(enum PermissionKinds permission) const
+ {
+ return m_permissions[permission];
+ }
+
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ bool IsSet(enum PermissionKinds permission) const
+ {
+ return m_set_mask.Test(permissions_mask[permission]);
+ }
+
+ bool AnySet() {
+ return m_set_mask.AnySet(permissions_mask[allPerms]);
+ }
+
+ private:
+ static const Flags::ValueType permissions_mask[allPerms + 1];
+
+ bool m_permissions[allPerms];
+ Flags m_set_mask;
+
+ bool SetPermission(enum PermissionKinds permission, bool value)
+ {
+ bool old_value = m_permissions[permission];
+ m_permissions[permission] = value;
+ m_set_mask.Set(permissions_mask[permission]);
+ return old_value;
+ }
+
+ // If either side disallows the permission, the resultant disallows it.
+ void MergePermission(const Permissions &incoming,
+ enum PermissionKinds permission)
+ {
+ if (incoming.IsSet(permission))
+ {
+ SetPermission(permission, !(m_permissions[permission] |
+ incoming.m_permissions[permission]));
+ }
+ }
+ };
+
+ BreakpointName(ConstString name, const char *help = nullptr) :
+ m_name(name), m_options(false)
+ {
+ SetHelp(help);
+ }
+
+ BreakpointName(ConstString name,
+ BreakpointOptions &options,
+ const Permissions &permissions = Permissions(),
+ const char *help = nullptr) :
+ m_name(name), m_options(options),
+ m_permissions(permissions) {
+ SetHelp(help);
+ };
+
+ BreakpointName(const BreakpointName &rhs) :
+ m_name(rhs.m_name), m_options(rhs.m_options),
+ m_permissions(rhs.m_permissions), m_help(rhs.m_help)
+ {}
+
+ BreakpointName(ConstString name, const Breakpoint &bkpt,
+ const char *help);
+
+ ConstString GetName() const { return m_name; }
+ BreakpointOptions &GetOptions() { return m_options; }
+ const BreakpointOptions &GetOptions() const { return m_options; }
+
+ void SetOptions(const BreakpointOptions &options) {
+ m_options = options;
+ }
+
+ Permissions &GetPermissions() { return m_permissions; }
+ const Permissions &GetPermissions() const { return m_permissions; }
+ void SetPermissions(const Permissions &permissions) {
+ m_permissions = permissions;
+ }
+
+ bool GetPermission(Permissions::PermissionKinds permission) const
+ {
+ return m_permissions.GetPermission(permission);
+ }
+
+ void SetHelp(const char *description)
+ {
+ if (description)
+ m_help.assign(description);
+ else
+ m_help.clear();
+ }
+
+ const char *GetHelp()
+ {
+ return m_help.c_str();
+ }
+
+ // Returns true if any options were set in the name
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ void ConfigureBreakpoint(lldb::BreakpointSP bp_sp);
+
+private:
+ ConstString m_name;
+ BreakpointOptions m_options;
+ Permissions m_permissions;
+ std::string m_help;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Breakpoint_Name_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h
new file mode 100644
index 0000000..cdac5d3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h
@@ -0,0 +1,390 @@
+//===-- BreakpointOptions.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointOptions_h_
+#define liblldb_BreakpointOptions_h_
+
+#include <memory>
+#include <string>
+
+#include "lldb/Utility/Baton.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class BreakpointOptions BreakpointOptions.h
+/// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a
+/// breakpoint or breakpoint location.
+
+class BreakpointOptions {
+friend class BreakpointLocation;
+friend class BreakpointName;
+friend class lldb_private::BreakpointOptionGroup;
+friend class Breakpoint;
+
+public:
+ enum OptionKind {
+ eCallback = 1 << 0,
+ eEnabled = 1 << 1,
+ eOneShot = 1 << 2,
+ eIgnoreCount = 1 << 3,
+ eThreadSpec = 1 << 4,
+ eCondition = 1 << 5,
+ eAutoContinue = 1 << 6,
+ eAllOptions = (eCallback | eEnabled | eOneShot | eIgnoreCount | eThreadSpec
+ | eCondition | eAutoContinue)
+ };
+ struct CommandData {
+ CommandData()
+ : user_source(), script_source(),
+ interpreter(lldb::eScriptLanguageNone), stop_on_error(true) {}
+
+ CommandData(const StringList &user_source, lldb::ScriptLanguage interp)
+ : user_source(user_source), script_source(), interpreter(interp),
+ stop_on_error(true) {}
+
+ ~CommandData() = default;
+
+ static const char *GetSerializationKey() { return "BKPTCMDData"; }
+
+ StructuredData::ObjectSP SerializeToStructuredData();
+
+ static std::unique_ptr<CommandData>
+ CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
+ Status &error);
+
+ StringList user_source;
+ std::string script_source;
+ enum lldb::ScriptLanguage
+ interpreter; // eScriptLanguageNone means command interpreter.
+ bool stop_on_error;
+
+ private:
+ enum class OptionNames : uint32_t {
+ UserSource = 0,
+ Interpreter,
+ StopOnError,
+ LastOptionName
+ };
+
+ static const char
+ *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
+
+ static const char *GetKey(OptionNames enum_value) {
+ return g_option_names[static_cast<uint32_t>(enum_value)];
+ }
+ };
+
+ class CommandBaton : public TypedBaton<CommandData> {
+ public:
+ explicit CommandBaton(std::unique_ptr<CommandData> Data)
+ : TypedBaton(std::move(Data)) {}
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+ };
+
+ typedef std::shared_ptr<CommandBaton> CommandBatonSP;
+
+ // Constructors and Destructors
+
+ /// This constructor allows you to specify all the breakpoint options except
+ /// the callback. That one is more complicated, and better to do by hand.
+ ///
+ /// \param[in] condition
+ /// The expression which if it evaluates to \b true if we are to stop
+ ///
+ /// \param[in] enabled
+ /// Is this breakpoint enabled.
+ ///
+ /// \param[in] ignore
+ /// How many breakpoint hits we should ignore before stopping.
+ ///
+ BreakpointOptions(const char *condition, bool enabled = true,
+ int32_t ignore = 0, bool one_shot = false,
+ bool auto_continue = false);
+
+ /// Breakpoints make options with all flags set. Locations and Names make
+ /// options with no flags set.
+ BreakpointOptions(bool all_flags_set);
+ BreakpointOptions(const BreakpointOptions &rhs);
+
+ virtual ~BreakpointOptions();
+
+ static std::unique_ptr<BreakpointOptions>
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ virtual StructuredData::ObjectSP SerializeToStructuredData();
+
+ static const char *GetSerializationKey() { return "BKPTOptions"; }
+
+ // Operators
+ const BreakpointOptions &operator=(const BreakpointOptions &rhs);
+
+ /// Copy over only the options set in the incoming BreakpointOptions.
+ void CopyOverSetOptions(const BreakpointOptions &rhs);
+
+ // Callbacks
+ //
+ // Breakpoint callbacks come in two forms, synchronous and asynchronous.
+ // Synchronous callbacks will get run before any of the thread plans are
+ // consulted, and if they return false the target will continue "under the
+ // radar" of the thread plans. There are a couple of restrictions to
+ // synchronous callbacks:
+ // 1) They should NOT resume the target themselves.
+ // Just return false if you want the target to restart.
+ // 2) Breakpoints with synchronous callbacks can't have conditions
+ // (or rather, they can have them, but they won't do anything.
+ // Ditto with ignore counts, etc... You are supposed to control that all
+ // through the callback.
+ // Asynchronous callbacks get run as part of the "ShouldStop" logic in the
+ // thread plan. The logic there is:
+ // a) If the breakpoint is thread specific and not for this thread, continue
+ // w/o running the callback.
+ // NB. This is actually enforced underneath the breakpoint system, the
+ // Process plugin is expected to
+ // call BreakpointSite::IsValidForThread, and set the thread's StopInfo
+ // to "no reason". That way,
+ // thread displays won't show stops for breakpoints not for that
+ // thread...
+ // b) If the ignore count says we shouldn't stop, then ditto.
+ // c) If the condition says we shouldn't stop, then ditto.
+ // d) Otherwise, the callback will get run, and if it returns true we will
+ // stop, and if false we won't.
+ // The asynchronous callback can run the target itself, but at present that
+ // should be the last action the callback does. We will relax this condition
+ // at some point, but it will take a bit of plumbing to get that to work.
+ //
+
+ /// Adds a callback to the breakpoint option set.
+ ///
+ /// \param[in] callback
+ /// The function to be called when the breakpoint gets hit.
+ ///
+ /// \param[in] baton_sp
+ /// A baton which will get passed back to the callback when it is invoked.
+ ///
+ /// \param[in] synchronous
+ /// Whether this is a synchronous or asynchronous callback. See discussion
+ /// above.
+ void SetCallback(BreakpointHitCallback callback,
+ const lldb::BatonSP &baton_sp, bool synchronous = false);
+
+ void SetCallback(BreakpointHitCallback callback,
+ const BreakpointOptions::CommandBatonSP &command_baton_sp,
+ bool synchronous = false);
+
+ /// Returns the command line commands for the callback on this breakpoint.
+ ///
+ /// \param[out] command_list
+ /// The commands will be appended to this list.
+ ///
+ /// \return
+ /// \btrue if the command callback is a command-line callback,
+ /// \bfalse otherwise.
+ bool GetCommandLineCallbacks(StringList &command_list);
+
+ /// Remove the callback from this option set.
+ void ClearCallback();
+
+ // The rest of these functions are meant to be used only within the
+ // breakpoint handling mechanism.
+
+ /// Use this function to invoke the callback for a specific stop.
+ ///
+ /// \param[in] context
+ /// The context in which the callback is to be invoked. This includes the
+ /// stop event, the
+ /// execution context of the stop (since you might hit the same breakpoint
+ /// on multiple threads) and
+ /// whether we are currently executing synchronous or asynchronous
+ /// callbacks.
+ ///
+ /// \param[in] break_id
+ /// The breakpoint ID that owns this option set.
+ ///
+ /// \param[in] break_loc_id
+ /// The breakpoint location ID that owns this option set.
+ ///
+ /// \return
+ /// The callback return value.
+ bool InvokeCallback(StoppointCallbackContext *context,
+ lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+
+ /// Used in InvokeCallback to tell whether it is the right time to run this
+ /// kind of callback.
+ ///
+ /// \return
+ /// The synchronicity of our callback.
+ bool IsCallbackSynchronous() const { return m_callback_is_synchronous; }
+
+ /// Fetch the baton from the callback.
+ ///
+ /// \return
+ /// The baton.
+ Baton *GetBaton();
+
+ /// Fetch a const version of the baton from the callback.
+ ///
+ /// \return
+ /// The baton.
+ const Baton *GetBaton() const;
+
+ // Condition
+ /// Set the breakpoint option's condition.
+ ///
+ /// \param[in] condition
+ /// The condition expression to evaluate when the breakpoint is hit.
+ void SetCondition(const char *condition);
+
+ /// Return a pointer to the text of the condition expression.
+ ///
+ /// \return
+ /// A pointer to the condition expression text, or nullptr if no
+ // condition has been set.
+ const char *GetConditionText(size_t *hash = nullptr) const;
+
+ // Enabled/Ignore Count
+
+ /// Check the Enable/Disable state.
+ /// \return
+ /// \b true if the breakpoint is enabled, \b false if disabled.
+ bool IsEnabled() const { return m_enabled; }
+
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ void SetEnabled(bool enabled) {
+ m_enabled = enabled;
+ m_set_flags.Set(eEnabled);
+ }
+
+ /// Check the auto-continue state.
+ /// \return
+ /// \b true if the breakpoint is set to auto-continue, \b false otherwise.
+ bool IsAutoContinue() const { return m_auto_continue; }
+
+ /// Set the auto-continue state.
+ void SetAutoContinue(bool auto_continue) {
+ m_auto_continue = auto_continue;
+ m_set_flags.Set(eAutoContinue);
+ }
+
+ /// Check the One-shot state.
+ /// \return
+ /// \b true if the breakpoint is one-shot, \b false otherwise.
+ bool IsOneShot() const { return m_one_shot; }
+
+ /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ void SetOneShot(bool one_shot) {
+ m_one_shot = one_shot;
+ m_set_flags.Set(eOneShot);
+ }
+
+ /// Set the breakpoint to ignore the next \a count breakpoint hits.
+ /// \param[in] count
+ /// The number of breakpoint hits to ignore.
+
+ void SetIgnoreCount(uint32_t n) {
+ m_ignore_count = n;
+ m_set_flags.Set(eIgnoreCount);
+ }
+
+ /// Return the current Ignore Count.
+ /// \return
+ /// The number of breakpoint hits to be ignored.
+ uint32_t GetIgnoreCount() const { return m_ignore_count; }
+
+ /// Return the current thread spec for this option. This will return nullptr
+ /// if the no thread specifications have been set for this Option yet.
+ /// \return
+ /// The thread specification pointer for this option, or nullptr if none
+ /// has
+ /// been set yet.
+ const ThreadSpec *GetThreadSpecNoCreate() const;
+
+ /// Returns a pointer to the ThreadSpec for this option, creating it. if it
+ /// hasn't been created already. This API is used for setting the
+ /// ThreadSpec items for this option.
+ ThreadSpec *GetThreadSpec();
+
+ void SetThreadID(lldb::tid_t thread_id);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ /// Returns true if the breakpoint option has a callback set.
+ bool HasCallback() const;
+
+ /// This is the default empty callback.
+ static bool NullCallback(void *baton, StoppointCallbackContext *context,
+ lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id);
+
+ /// Set a callback based on BreakpointOptions::CommandData. \param[in]
+ /// cmd_data
+ /// A UP holding the new'ed CommandData object.
+ /// The breakpoint will take ownership of pointer held by this object.
+ void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
+
+ void Clear();
+
+ bool AnySet() const {
+ return m_set_flags.AnySet(eAllOptions);
+ }
+
+protected:
+ // Classes that inherit from BreakpointOptions can see and modify these
+ bool IsOptionSet(OptionKind kind)
+ {
+ return m_set_flags.Test(kind);
+ }
+
+ enum class OptionNames {
+ ConditionText = 0,
+ IgnoreCount,
+ EnabledState,
+ OneShotState,
+ AutoContinue,
+ LastOptionName
+ };
+ static const char *g_option_names[(size_t)OptionNames::LastOptionName];
+
+ static const char *GetKey(OptionNames enum_value) {
+ return g_option_names[(size_t)enum_value];
+ }
+
+ static bool BreakpointOptionsCallbackFunction(
+ void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id);
+
+ void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
+
+private:
+ // For BreakpointOptions only
+ BreakpointHitCallback m_callback; // This is the callback function pointer
+ lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+ bool m_baton_is_command_baton;
+ bool m_callback_is_synchronous;
+ bool m_enabled;
+ bool m_one_shot;
+ uint32_t m_ignore_count; // Number of times to ignore this breakpoint
+ std::unique_ptr<ThreadSpec>
+ m_thread_spec_up; // Thread for which this breakpoint will take
+ std::string m_condition_text; // The condition to test.
+ size_t m_condition_text_hash; // Its hash, so that locations know when the
+ // condition is updated.
+ bool m_auto_continue; // If set, auto-continue from breakpoint.
+ Flags m_set_flags; // Which options are set at this level. Drawn
+ // from BreakpointOptions::SetOptionsFlags.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointOptions_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h
new file mode 100644
index 0000000..2a9461b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h
@@ -0,0 +1,30 @@
+//===-- BreakpointPrecondition.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointPrecondition_h_
+#define liblldb_BreakpointPrecondition_h_
+
+#include "lldb/lldb-enumerations.h"
+
+namespace lldb_private {
+
+class Args;
+class Status;
+class StoppointCallbackContext;
+class Stream;
+
+class BreakpointPrecondition {
+public:
+ virtual ~BreakpointPrecondition() = default;
+ virtual bool EvaluatePrecondition(StoppointCallbackContext &context);
+ virtual Status ConfigurePrecondition(Args &args);
+ virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level);
+};
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h
new file mode 100644
index 0000000..11e183b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h
@@ -0,0 +1,230 @@
+//===-- BreakpointResolver.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolver_h_
+#define liblldb_BreakpointResolver_h_
+
+#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/Address.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class BreakpointResolver BreakpointResolver.h
+/// "lldb/Breakpoint/BreakpointResolver.h" This class works with SearchFilter
+/// to resolve logical breakpoints to their of concrete breakpoint locations.
+
+/// General Outline:
+/// The BreakpointResolver is a Searcher. In that protocol, the SearchFilter
+/// asks the question "At what depth of the symbol context descent do you want
+/// your callback to get called?" of the filter. The resolver answers this
+/// question (in the GetDepth method) and provides the resolution callback.
+/// Each Breakpoint has a BreakpointResolver, and it calls either
+/// ResolveBreakpoint or ResolveBreakpointInModules to tell it to look for new
+/// breakpoint locations.
+
+class BreakpointResolver : public Searcher {
+ friend class Breakpoint;
+
+public:
+ /// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint
+ /// to make sense. It can be constructed without a breakpoint, but you have
+ /// to call SetBreakpoint before ResolveBreakpoint.
+ ///
+ /// \param[in] bkpt
+ /// The breakpoint that owns this resolver.
+ /// \param[in] resolverType
+ /// The concrete breakpoint resolver type for this breakpoint.
+ ///
+ /// \result
+ /// Returns breakpoint location id.
+ BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType,
+ lldb::addr_t offset = 0);
+
+ /// The Destructor is virtual, all significant breakpoint resolvers derive
+ /// from this class.
+ ~BreakpointResolver() override;
+
+ /// This sets the breakpoint for this resolver.
+ ///
+ /// \param[in] bkpt
+ /// The breakpoint that owns this resolver.
+ void SetBreakpoint(Breakpoint *bkpt);
+
+ /// This updates the offset for this breakpoint. All the locations
+ /// currently set for this breakpoint will have their offset adjusted when
+ /// this is called.
+ ///
+ /// \param[in] offset
+ /// The offset to add to all locations.
+ void SetOffset(lldb::addr_t offset);
+
+ /// This updates the offset for this breakpoint. All the locations
+ /// currently set for this breakpoint will have their offset adjusted when
+ /// this is called.
+ ///
+ /// \param[in] offset
+ /// The offset to add to all locations.
+ lldb::addr_t GetOffset() const { return m_offset; }
+
+ /// In response to this method the resolver scans all the modules in the
+ /// breakpoint's target, and adds any new locations it finds.
+ ///
+ /// \param[in] filter
+ /// The filter that will manage the search for this resolver.
+ virtual void ResolveBreakpoint(SearchFilter &filter);
+
+ /// In response to this method the resolver scans the modules in the module
+ /// list \a modules, and adds any new locations it finds.
+ ///
+ /// \param[in] filter
+ /// The filter that will manage the search for this resolver.
+ virtual void ResolveBreakpointInModules(SearchFilter &filter,
+ ModuleList &modules);
+
+ /// Prints a canonical description for the breakpoint to the stream \a s.
+ ///
+ /// \param[in] s
+ /// Stream to which the output is copied.
+ void GetDescription(Stream *s) override = 0;
+
+ /// Standard "Dump" method. At present it does nothing.
+ virtual void Dump(Stream *s) const = 0;
+
+ /// This section handles serializing and deserializing from StructuredData
+ /// objects.
+
+ static lldb::BreakpointResolverSP
+ CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict,
+ Status &error);
+
+ virtual StructuredData::ObjectSP SerializeToStructuredData() {
+ return StructuredData::ObjectSP();
+ }
+
+ static const char *GetSerializationKey() { return "BKPTResolver"; }
+
+ static const char *GetSerializationSubclassKey() { return "Type"; }
+
+ static const char *GetSerializationSubclassOptionsKey() { return "Options"; }
+
+ StructuredData::DictionarySP
+ WrapOptionsDict(StructuredData::DictionarySP options_dict_sp);
+
+ /// An enumeration for keeping track of the concrete subclass that is
+ /// actually instantiated. Values of this enumeration are kept in the
+ /// BreakpointResolver's SubclassID field. They are used for concrete type
+ /// identification.
+ enum ResolverTy {
+ FileLineResolver = 0, // This is an instance of BreakpointResolverFileLine
+ AddressResolver, // This is an instance of BreakpointResolverAddress
+ NameResolver, // This is an instance of BreakpointResolverName
+ FileRegexResolver,
+ PythonResolver,
+ ExceptionResolver,
+ LastKnownResolverType = ExceptionResolver,
+ UnknownResolver
+ };
+
+ // Translate the Ty to name for serialization, the "+2" is one for size vrs.
+ // index, and one for UnknownResolver.
+ static const char *g_ty_to_name[LastKnownResolverType + 2];
+
+ /// getResolverID - Return an ID for the concrete type of this object. This
+ /// is used to implement the LLVM classof checks. This should not be used
+ /// for any other purpose, as the values may change as LLDB evolves.
+ unsigned getResolverID() const { return SubclassID; }
+
+ enum ResolverTy GetResolverTy() {
+ if (SubclassID > ResolverTy::LastKnownResolverType)
+ return ResolverTy::UnknownResolver;
+ else
+ return (enum ResolverTy)SubclassID;
+ }
+
+ const char *GetResolverName() { return ResolverTyToName(GetResolverTy()); }
+
+ static const char *ResolverTyToName(enum ResolverTy);
+
+ static ResolverTy NameToResolverTy(llvm::StringRef name);
+
+ virtual lldb::BreakpointResolverSP
+ CopyForBreakpoint(Breakpoint &breakpoint) = 0;
+
+protected:
+ // Used for serializing resolver options:
+ // The options in this enum and the strings in the g_option_names must be
+ // kept in sync.
+ enum class OptionNames : uint32_t {
+ AddressOffset = 0,
+ ExactMatch,
+ FileName,
+ Inlines,
+ LanguageName,
+ LineNumber,
+ Column,
+ ModuleName,
+ NameMaskArray,
+ Offset,
+ PythonClassName,
+ RegexString,
+ ScriptArgs,
+ SectionName,
+ SearchDepth,
+ SkipPrologue,
+ SymbolNameArray,
+ LastOptionName
+ };
+ static const char
+ *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
+
+ virtual void NotifyBreakpointSet() {};
+
+public:
+ static const char *GetKey(OptionNames enum_value) {
+ return g_option_names[static_cast<uint32_t>(enum_value)];
+ }
+
+protected:
+ /// Takes a symbol context list of matches which supposedly represent the
+ /// same file and line number in a CU, and find the nearest actual line
+ /// number that matches, and then filter down the matching addresses to
+ /// unique entries, and skip the prologue if asked to do so, and then set
+ /// breakpoint locations in this breakpoint for all the resultant addresses.
+ /// When \p column is nonzero the \p line and \p column args are used to
+ /// filter the results to find the first breakpoint >= (line, column).
+ void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
+ bool skip_prologue, llvm::StringRef log_ident,
+ uint32_t line = 0, uint32_t column = 0);
+ void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
+ const char *) = delete;
+
+ lldb::BreakpointLocationSP AddLocation(Address loc_addr,
+ bool *new_location = nullptr);
+
+ Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
+ lldb::addr_t m_offset; // A random offset the user asked us to add to any
+ // breakpoints we set.
+
+private:
+ /// Helper for \p SetSCMatchesByLine.
+ void AddLocation(SearchFilter &filter, const SymbolContext &sc,
+ bool skip_prologue, llvm::StringRef log_ident);
+
+ // Subclass identifier (for llvm isa/dyn_cast)
+ const unsigned char SubclassID;
+ DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolver_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h
new file mode 100644
index 0000000..949a788
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h
@@ -0,0 +1,76 @@
+//===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolverAddress_h_
+#define liblldb_BreakpointResolverAddress_h_
+
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/ModuleSpec.h"
+
+namespace lldb_private {
+
+/// \class BreakpointResolverAddress BreakpointResolverAddress.h
+/// "lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints
+/// on a given Address. This breakpoint only takes once, and then it won't
+/// attempt to reset itself.
+
+class BreakpointResolverAddress : public BreakpointResolver {
+public:
+ BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr);
+
+ BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr,
+ const FileSpec &module_spec);
+
+ ~BreakpointResolverAddress() override;
+
+ static BreakpointResolver *
+ CreateFromStructuredData(Breakpoint *bkpt,
+ const StructuredData::Dictionary &options_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ void ResolveBreakpoint(SearchFilter &filter) override;
+
+ void ResolveBreakpointInModules(SearchFilter &filter,
+ ModuleList &modules) override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ void Dump(Stream *s) const override;
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const BreakpointResolverAddress *) { return true; }
+ static inline bool classof(const BreakpointResolver *V) {
+ return V->getResolverID() == BreakpointResolver::AddressResolver;
+ }
+
+ lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ Address
+ m_addr; // The address - may be Section Offset or may be just an offset
+ lldb::addr_t m_resolved_addr; // The current value of the resolved load
+ // address for this breakpoint,
+ FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an
+ // offset, then it will be converted
+ // to a Section+Offset address in this module, whenever that module gets
+ // around to being loaded.
+private:
+ DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverAddress_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h
new file mode 100644
index 0000000..f146a70
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -0,0 +1,75 @@
+//===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolverFileLine_h_
+#define liblldb_BreakpointResolverFileLine_h_
+
+#include "lldb/Breakpoint/BreakpointResolver.h"
+
+namespace lldb_private {
+
+/// \class BreakpointResolverFileLine BreakpointResolverFileLine.h
+/// "lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints
+/// by file and line. Optionally, it will look for inlined instances of the
+/// file and line specification.
+
+class BreakpointResolverFileLine : public BreakpointResolver {
+public:
+ BreakpointResolverFileLine(Breakpoint *bkpt, const FileSpec &resolver,
+ uint32_t line_no, uint32_t column,
+ lldb::addr_t m_offset, bool check_inlines,
+ bool skip_prologue, bool exact_match);
+
+ static BreakpointResolver *
+ CreateFromStructuredData(Breakpoint *bkpt,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ ~BreakpointResolverFileLine() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ void Dump(Stream *s) const override;
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const BreakpointResolverFileLine *) {
+ return true;
+ }
+ static inline bool classof(const BreakpointResolver *V) {
+ return V->getResolverID() == BreakpointResolver::FileLineResolver;
+ }
+
+ lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ void FilterContexts(SymbolContextList &sc_list, bool is_relative);
+
+ 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.
+ uint32_t m_column; ///< This is the column that we are looking for.
+ bool m_inlines; ///< This determines whether the resolver looks for inlined
+ ///< functions or not.
+ bool m_skip_prologue;
+ bool m_exact_match;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverFileLine_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
new file mode 100644
index 0000000..9631457
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
@@ -0,0 +1,77 @@
+//===-- BreakpointResolverFileRegex.h ----------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolverFileRegex_h_
+#define liblldb_BreakpointResolverFileRegex_h_
+
+#include <set>
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+
+/// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
+/// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets
+/// breakpoints by file and line. Optionally, it will look for inlined
+/// instances of the file and line specification.
+
+class BreakpointResolverFileRegex : public BreakpointResolver {
+public:
+ BreakpointResolverFileRegex(
+ Breakpoint *bkpt, RegularExpression ®ex,
+ const std::unordered_set<std::string> &func_name_set, bool exact_match);
+
+ static BreakpointResolver *
+ CreateFromStructuredData(Breakpoint *bkpt,
+ const StructuredData::Dictionary &options_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ ~BreakpointResolverFileRegex() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ void Dump(Stream *s) const override;
+
+ void AddFunctionName(const char *func_name);
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const BreakpointResolverFileRegex *) {
+ return true;
+ }
+ static inline bool classof(const BreakpointResolver *V) {
+ return V->getResolverID() == BreakpointResolver::FileRegexResolver;
+ }
+
+ lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ friend class Breakpoint;
+ RegularExpression
+ m_regex; // This is the line expression that we are looking for.
+ bool m_exact_match; // If true, then if the source we match is in a comment,
+ // we won't set a location there.
+ std::unordered_set<std::string> m_function_names; // Limit the search to
+ // functions in the
+ // comp_unit passed in.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverFileRegex_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h
new file mode 100644
index 0000000..85a41b6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -0,0 +1,94 @@
+//===-- BreakpointResolverName.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolverName_h_
+#define liblldb_BreakpointResolverName_h_
+
+#include <string>
+#include <vector>
+
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/Module.h"
+
+namespace lldb_private {
+
+/// \class BreakpointResolverName BreakpointResolverName.h
+/// "lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on
+/// a given function name, either by exact match or by regular expression.
+
+class BreakpointResolverName : public BreakpointResolver {
+public:
+ BreakpointResolverName(Breakpoint *bkpt, const char *name,
+ lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language,
+ Breakpoint::MatchType type, lldb::addr_t offset,
+ bool skip_prologue);
+
+ // This one takes an array of names. It is always MatchType = Exact.
+ BreakpointResolverName(Breakpoint *bkpt, const char *names[],
+ size_t num_names,
+ lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language, lldb::addr_t offset,
+ bool skip_prologue);
+
+ // This one takes a C++ array of names. It is always MatchType = Exact.
+ BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names,
+ lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language, lldb::addr_t offset,
+ bool skip_prologue);
+
+ // Creates a function breakpoint by regular expression. Takes over control
+ // of the lifespan of func_regex.
+ BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex,
+ lldb::LanguageType language, lldb::addr_t offset,
+ bool skip_prologue);
+
+ static BreakpointResolver *
+ CreateFromStructuredData(Breakpoint *bkpt,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ ~BreakpointResolverName() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ void Dump(Stream *s) const override;
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const BreakpointResolverName *) { return true; }
+ static inline bool classof(const BreakpointResolver *V) {
+ return V->getResolverID() == BreakpointResolver::NameResolver;
+ }
+
+ lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ BreakpointResolverName(const BreakpointResolverName &rhs);
+
+ std::vector<Module::LookupInfo> m_lookups;
+ ConstString m_class_name;
+ RegularExpression m_regex;
+ Breakpoint::MatchType m_match_type;
+ lldb::LanguageType m_language;
+ bool m_skip_prologue;
+
+ void AddNameLookup(ConstString name,
+ lldb::FunctionNameType name_type_mask);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverName_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h
new file mode 100644
index 0000000..980bb46
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h
@@ -0,0 +1,78 @@
+//===-- BreakpointResolverScripted.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointResolverScripted_h_
+#define liblldb_BreakpointResolverScripted_h_
+
+#include "lldb/lldb-forward.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/ModuleSpec.h"
+
+
+namespace lldb_private {
+
+/// \class BreakpointResolverScripted BreakpointResolverScripted.h
+/// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints
+/// on a given Address. This breakpoint only takes once, and then it won't
+/// attempt to reset itself.
+
+class BreakpointResolverScripted : public BreakpointResolver {
+public:
+ BreakpointResolverScripted(Breakpoint *bkpt,
+ const llvm::StringRef class_name,
+ lldb::SearchDepth depth,
+ StructuredDataImpl *args_data,
+ ScriptInterpreter &script_interp);
+
+ ~BreakpointResolverScripted() override;
+
+ static BreakpointResolver *
+ CreateFromStructuredData(Breakpoint *bkpt,
+ const StructuredData::Dictionary &options_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ void Dump(Stream *s) const override;
+
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const BreakpointResolverScripted *) { return true; }
+ static inline bool classof(const BreakpointResolver *V) {
+ return V->getResolverID() == BreakpointResolver::PythonResolver;
+ }
+
+ lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ void NotifyBreakpointSet() override;
+private:
+ void CreateImplementationIfNeeded();
+ ScriptInterpreter *GetScriptInterpreter();
+
+ std::string m_class_name;
+ lldb::SearchDepth m_depth;
+ StructuredDataImpl *m_args_ptr; // We own this, but the implementation
+ // has to manage the UP (since that is
+ // how it gets stored in the
+ // SBStructuredData).
+ StructuredData::GenericSP m_implementation_sp;
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverScripted_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h
new file mode 100644
index 0000000..51ed84f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h
@@ -0,0 +1,237 @@
+//===-- BreakpointSite.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointSite_h_
+#define liblldb_BreakpointSite_h_
+
+
+#include <list>
+#include <mutex>
+
+
+#include "lldb/Breakpoint/BreakpointLocationCollection.h"
+#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+
+/// \class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h"
+/// Class that manages the actual breakpoint that will be inserted into the
+/// running program.
+///
+/// The BreakpointSite class handles the physical breakpoint that is actually
+/// inserted in the target program. As such, it is also the one that gets
+/// hit, when the program stops. It keeps a list of all BreakpointLocations
+/// that share this physical site. When the breakpoint is hit, all the
+/// locations are informed by the breakpoint site. Breakpoint sites are owned
+/// by the process.
+
+class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
+ public StoppointLocation {
+public:
+ enum Type {
+ eSoftware, // Breakpoint opcode has been written to memory and
+ // m_saved_opcode
+ // and m_trap_opcode contain the saved and written opcode.
+ eHardware, // Breakpoint site is set as a hardware breakpoint
+ eExternal // Breakpoint site is managed by an external debug nub or
+ // debug interface where memory reads transparently will not
+ // display any breakpoint opcodes.
+ };
+
+ ~BreakpointSite() override;
+
+ // This section manages the breakpoint traps
+
+ /// Returns the Opcode Bytes for this breakpoint
+ uint8_t *GetTrapOpcodeBytes();
+
+ /// Returns the Opcode Bytes for this breakpoint - const version
+ const uint8_t *GetTrapOpcodeBytes() const;
+
+ /// Get the size of the trap opcode for this address
+ size_t GetTrapOpcodeMaxByteSize() const;
+
+ /// Sets the trap opcode
+ bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size);
+
+ /// Gets the original instruction bytes that were overwritten by the trap
+ uint8_t *GetSavedOpcodeBytes();
+
+ /// Gets the original instruction bytes that were overwritten by the trap
+ /// const version
+ const uint8_t *GetSavedOpcodeBytes() const;
+
+ /// Says whether \a addr and size \a size intersects with the address \a
+ /// intersect_addr
+ bool IntersectsRange(lldb::addr_t addr, size_t size,
+ lldb::addr_t *intersect_addr, size_t *intersect_size,
+ size_t *opcode_offset) const;
+
+ /// Tells whether the current breakpoint site is enabled or not
+ ///
+ /// This is a low-level enable bit for the breakpoint sites. If a
+ /// breakpoint site has no enabled owners, it should just get removed. This
+ /// enable/disable is for the low-level target code to enable and disable
+ /// breakpoint sites when single stepping, etc.
+ bool IsEnabled() const;
+
+ /// Sets whether the current breakpoint site is enabled or not
+ ///
+ /// \param[in] enabled
+ /// \b true if the breakpoint is enabled, \b false otherwise.
+ void SetEnabled(bool enabled);
+
+ /// Enquires of the breakpoint locations that produced this breakpoint site
+ /// whether we should stop at this location.
+ ///
+ /// \param[in] context
+ /// This contains the information about this stop.
+ ///
+ /// \return
+ /// \b true if we should stop, \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context) override;
+
+ /// Standard Dump method
+ ///
+ /// \param[in] context
+ /// The stream to dump this output.
+ void Dump(Stream *s) const override;
+
+ /// The "Owners" are the breakpoint locations that share this breakpoint
+ /// site. The method adds the \a owner to this breakpoint site's owner list.
+ ///
+ /// \param[in] context
+ /// \a owner is the Breakpoint Location to add.
+ void AddOwner(const lldb::BreakpointLocationSP &owner);
+
+ /// This method returns the number of breakpoint locations currently located
+ /// at this breakpoint site.
+ ///
+ /// \return
+ /// The number of owners.
+ size_t GetNumberOfOwners();
+
+ /// This method returns the breakpoint location at index \a index located at
+ /// this breakpoint site. The owners are listed ordinally from 0 to
+ /// GetNumberOfOwners() - 1 so you can use this method to iterate over the
+ /// owners
+ ///
+ /// \param[in] index
+ /// The index in the list of owners for which you wish the owner location.
+ /// \return
+ /// A shared pointer to the breakpoint location at that index.
+ lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx);
+
+ /// This method copies the breakpoint site's owners into a new collection.
+ /// It does this while the owners mutex is locked.
+ ///
+ /// \param[out] out_collection
+ /// The BreakpointLocationCollection into which to put the owners
+ /// of this breakpoint site.
+ ///
+ /// \return
+ /// The number of elements copied into out_collection.
+ size_t CopyOwnersList(BreakpointLocationCollection &out_collection);
+
+ /// Check whether the owners of this breakpoint site have any thread
+ /// specifiers, and if yes, is \a thread contained in any of these
+ /// specifiers.
+ ///
+ /// \param[in] thread
+ /// The thread against which to test.
+ ///
+ /// return
+ /// \b true if the collection contains at least one location that
+ /// would be valid for this thread, false otherwise.
+ bool ValidForThisThread(Thread *thread);
+
+ /// Print a description of this breakpoint site to the stream \a s.
+ /// GetDescription tells you about the breakpoint site's owners. Use
+ /// BreakpointSite::Dump(Stream *) to get information about the breakpoint
+ /// site itself.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ /// Tell whether a breakpoint has a location at this site.
+ ///
+ /// \param[in] bp_id
+ /// The breakpoint id to query.
+ ///
+ /// \result
+ /// \b true if bp_id has a location that is at this site,
+ /// \b false otherwise.
+ bool IsBreakpointAtThisSite(lldb::break_id_t bp_id);
+
+ /// Tell whether ALL the breakpoints in the location collection are
+ /// internal.
+ ///
+ /// \result
+ /// \b true if all breakpoint locations are owned by internal breakpoints,
+ /// \b false otherwise.
+ bool IsInternal() const;
+
+ BreakpointSite::Type GetType() const { return m_type; }
+
+ void SetType(BreakpointSite::Type type) { m_type = type; }
+
+private:
+ friend class Process;
+ friend class BreakpointLocation;
+ // The StopInfoBreakpoint knows when it is processing a hit for a thread for
+ // a site, so let it be the one to manage setting the location hit count once
+ // and only once.
+ friend class StopInfoBreakpoint;
+
+ void BumpHitCounts();
+
+ /// The method removes the owner at \a break_loc_id from this breakpoint
+ /// list.
+ ///
+ /// \param[in] context
+ /// \a break_loc_id is the Breakpoint Location to remove.
+ size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
+
+ BreakpointSite::Type m_type; ///< The type of this breakpoint site.
+ uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site
+ ///uses trap opcodes.
+ uint8_t m_trap_opcode[8]; ///< The opcode that was used to create the
+ ///breakpoint if it is a software breakpoint site.
+ bool
+ m_enabled; ///< Boolean indicating if this breakpoint site enabled or not.
+
+ // Consider adding an optimization where if there is only one owner, we don't
+ // store a list. The usual case will be only one owner...
+ BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations
+ ///that share this breakpoint site.
+ std::recursive_mutex
+ m_owners_mutex; ///< This mutex protects the owners collection.
+
+ static lldb::break_id_t GetNextID();
+
+ // Only the Process can create breakpoint sites in
+ // Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
+ BreakpointSite(BreakpointSiteList *list,
+ const lldb::BreakpointLocationSP &owner, lldb::addr_t m_addr,
+ bool use_hardware);
+
+ DISALLOW_COPY_AND_ASSIGN(BreakpointSite);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointSite_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h
new file mode 100644
index 0000000..b10d119
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h
@@ -0,0 +1,173 @@
+//===-- BreakpointSiteList.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_BreakpointSiteList_h_
+#define liblldb_BreakpointSiteList_h_
+
+#include <functional>
+#include <map>
+#include <mutex>
+
+#include "lldb/Breakpoint/BreakpointSite.h"
+
+namespace lldb_private {
+
+/// \class BreakpointSiteList BreakpointSiteList.h
+/// "lldb/Breakpoint/BreakpointSiteList.h" Class that manages lists of
+/// BreakpointSite shared pointers.
+class BreakpointSiteList {
+ // At present Process directly accesses the map of BreakpointSites so it can
+ // do quick lookups into the map (using GetMap).
+ // FIXME: Find a better interface for this.
+ friend class Process;
+
+public:
+ /// Default constructor makes an empty list.
+ BreakpointSiteList();
+
+ /// Destructor, currently does nothing.
+ ~BreakpointSiteList();
+
+ /// Add a BreakpointSite to the list.
+ ///
+ /// \param[in] bp_site_sp
+ /// A shared pointer to a breakpoint site being added to the list.
+ ///
+ /// \return
+ /// The ID of the BreakpointSite in the list.
+ lldb::break_id_t Add(const lldb::BreakpointSiteSP &bp_site_sp);
+
+ /// Standard Dump routine, doesn't do anything at present. \param[in] s
+ /// Stream into which to dump the description.
+ void Dump(Stream *s) const;
+
+ /// Returns a shared pointer to the breakpoint site at address \a addr.
+ ///
+ /// \param[in] addr
+ /// The address to look for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint site. May contain a NULL
+ /// pointer if no breakpoint site exists with a matching address.
+ lldb::BreakpointSiteSP FindByAddress(lldb::addr_t addr);
+
+ /// Returns a shared pointer to the breakpoint site with id \a breakID.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint site ID to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint site. May contain a NULL pointer if
+ /// the
+ /// breakpoint doesn't exist.
+ lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID);
+
+ /// Returns a shared pointer to the breakpoint site with id \a breakID -
+ /// const version.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint site ID to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the breakpoint site. May contain a NULL pointer if
+ /// the
+ /// breakpoint doesn't exist.
+ const lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID) const;
+
+ /// Returns the breakpoint site id to the breakpoint site at address \a
+ /// addr.
+ ///
+ /// \param[in] addr
+ /// The address to match.
+ ///
+ /// \result
+ /// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
+ lldb::break_id_t FindIDByAddress(lldb::addr_t addr);
+
+ /// Returns whether the breakpoint site \a bp_site_id has \a bp_id
+ // as one of its owners.
+ ///
+ /// \param[in] bp_site_id
+ /// The breakpoint site id to query.
+ ///
+ /// \param[in] bp_id
+ /// The breakpoint id to look for in \a bp_site_id.
+ ///
+ /// \result
+ /// True if \a bp_site_id exists in the site list AND \a bp_id is one of the
+ /// owners of that site.
+ bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id,
+ lldb::break_id_t bp_id);
+
+ void ForEach(std::function<void(BreakpointSite *)> const &callback);
+
+ /// Removes the breakpoint site given by \b breakID from this list.
+ ///
+ /// \param[in] breakID
+ /// The breakpoint site index to remove.
+ ///
+ /// \result
+ /// \b true if the breakpoint site \a breakID was in the list.
+ bool Remove(lldb::break_id_t breakID);
+
+ /// Removes the breakpoint site at address \a addr from this list.
+ ///
+ /// \param[in] addr
+ /// The address from which to remove a breakpoint site.
+ ///
+ /// \result
+ /// \b true if \a addr had a breakpoint site to remove from the list.
+ bool RemoveByAddress(lldb::addr_t addr);
+
+ bool FindInRange(lldb::addr_t lower_bound, lldb::addr_t upper_bound,
+ BreakpointSiteList &bp_site_list) const;
+
+ typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp,
+ void *baton);
+
+ /// Enquires of the breakpoint site on in this list with ID \a breakID
+ /// whether we should stop for the breakpoint or not.
+ ///
+ /// \param[in] context
+ /// This contains the information about this stop.
+ ///
+ /// \param[in] breakID
+ /// This break ID that we hit.
+ ///
+ /// \return
+ /// \b true if we should stop, \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
+
+ /// Returns the number of elements in the list.
+ ///
+ /// \result
+ /// The number of elements.
+ size_t GetSize() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_bp_site_list.size();
+ }
+
+ bool IsEmpty() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_bp_site_list.empty();
+ }
+
+protected:
+ typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
+
+ collection::iterator GetIDIterator(lldb::break_id_t breakID);
+
+ collection::const_iterator GetIDConstIterator(lldb::break_id_t breakID) const;
+
+ mutable std::recursive_mutex m_mutex;
+ collection m_bp_site_list; // The breakpoint site list.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointSiteList_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h b/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h
new file mode 100644
index 0000000..f20b100
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h
@@ -0,0 +1,45 @@
+//===-- Stoppoint.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Stoppoint_h_
+#define liblldb_Stoppoint_h_
+
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class Stoppoint {
+public:
+ // Constructors and Destructors
+ Stoppoint();
+
+ virtual ~Stoppoint();
+
+ // Methods
+ virtual void Dump(Stream *) = 0;
+
+ virtual bool IsEnabled() = 0;
+
+ virtual void SetEnabled(bool enable) = 0;
+
+ lldb::break_id_t GetID() const;
+
+ void SetID(lldb::break_id_t bid);
+
+protected:
+ lldb::break_id_t m_bid;
+
+private:
+ // For Stoppoint only
+ DISALLOW_COPY_AND_ASSIGN(Stoppoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Stoppoint_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h
new file mode 100644
index 0000000..c1724a6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h
@@ -0,0 +1,51 @@
+//===-- StoppointCallbackContext.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StoppointCallbackContext_h_
+#define liblldb_StoppointCallbackContext_h_
+
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class StoppointCallbackContext StoppointCallbackContext.h
+/// "lldb/Breakpoint/StoppointCallbackContext.h" Class holds the information
+/// that a breakpoint callback needs to evaluate this stop.
+
+/// General Outline:
+/// When we hit a breakpoint we need to package up whatever information is
+/// needed to evaluate breakpoint commands and conditions. This class is the
+/// container of that information.
+
+class StoppointCallbackContext {
+public:
+ StoppointCallbackContext();
+
+ StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx,
+ bool synchronously = false);
+
+ /// Clear the object's state.
+ ///
+ /// Sets the event, process and thread to NULL, and the frame index to an
+ /// invalid value.
+ void Clear();
+
+ // Member variables
+ Event *event; // This is the event, the callback can modify this to indicate
+ // the meaning of the breakpoint hit
+ ExecutionContextRef
+ exe_ctx_ref; // This tells us where we have stopped, what thread.
+ bool is_synchronous; // Is the callback being executed synchronously with the
+ // breakpoint,
+ // or asynchronously as the event is retrieved?
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StoppointCallbackContext_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h
new file mode 100644
index 0000000..3926f45
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h
@@ -0,0 +1,86 @@
+//===-- StoppointLocation.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StoppointLocation_h_
+#define liblldb_StoppointLocation_h_
+
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+// #include "lldb/Breakpoint/BreakpointOptions.h"
+
+namespace lldb_private {
+
+class StoppointLocation {
+public:
+ // Constructors and Destructors
+ StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
+
+ StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
+ uint32_t byte_size, bool hardware);
+
+ virtual ~StoppointLocation();
+
+ // Operators
+
+ // Methods
+ virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
+
+ virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
+
+ uint32_t GetByteSize() const { return m_byte_size; }
+
+ uint32_t GetHitCount() const { return m_hit_count; }
+
+ uint32_t GetHardwareIndex() const { return m_hardware_index; }
+
+ bool HardwareRequired() const { return m_hardware; }
+
+ virtual bool IsHardware() const {
+ return m_hardware_index != LLDB_INVALID_INDEX32;
+ }
+
+ virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
+
+ virtual void Dump(Stream *stream) const {}
+
+ void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
+
+ lldb::break_id_t GetID() const { return m_loc_id; }
+
+protected:
+ // Classes that inherit from StoppointLocation can see and modify these
+ lldb::break_id_t m_loc_id; // Stoppoint location ID
+ lldb::addr_t
+ m_addr; // The load address of this stop point. The base Stoppoint doesn't
+ // store a full Address since that's not needed for the breakpoint sites.
+ bool m_hardware; // True if this point has been is required to use hardware
+ // (which may fail due to lack of resources)
+ uint32_t m_hardware_index; // The hardware resource index for this
+ // breakpoint/watchpoint
+ uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
+ // of the trap opcode for
+ // software breakpoints, or the optional length in bytes for hardware
+ // breakpoints, or the length of the watchpoint.
+ uint32_t
+ m_hit_count; // Number of times this breakpoint/watchpoint has been hit
+
+ // If you override this, be sure to call the base class to increment the
+ // internal counter.
+ void IncrementHitCount() { ++m_hit_count; }
+
+ void DecrementHitCount();
+
+private:
+ // For StoppointLocation only
+ DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
+ StoppointLocation() = delete;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StoppointLocation_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h b/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h
new file mode 100644
index 0000000..e71f89b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h
@@ -0,0 +1,217 @@
+//===-- Watchpoint.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Watchpoint_h_
+#define liblldb_Watchpoint_h_
+
+#include <memory>
+#include <string>
+
+#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Breakpoint/WatchpointOptions.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
+ public StoppointLocation {
+public:
+ class WatchpointEventData : public EventData {
+ public:
+ WatchpointEventData(lldb::WatchpointEventType sub_type,
+ const lldb::WatchpointSP &new_watchpoint_sp);
+
+ ~WatchpointEventData() override;
+
+ static ConstString GetFlavorString();
+
+ ConstString GetFlavor() const override;
+
+ lldb::WatchpointEventType GetWatchpointEventType() const;
+
+ lldb::WatchpointSP &GetWatchpoint();
+
+ void Dump(Stream *s) const override;
+
+ static lldb::WatchpointEventType
+ GetWatchpointEventTypeFromEvent(const lldb::EventSP &event_sp);
+
+ static lldb::WatchpointSP
+ GetWatchpointFromEvent(const lldb::EventSP &event_sp);
+
+ static const WatchpointEventData *
+ GetEventDataFromEvent(const Event *event_sp);
+
+ private:
+ lldb::WatchpointEventType m_watchpoint_event;
+ lldb::WatchpointSP m_new_watchpoint_sp;
+
+ DISALLOW_COPY_AND_ASSIGN(WatchpointEventData);
+ };
+
+ Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
+ const CompilerType *type, bool hardware = true);
+
+ ~Watchpoint() override;
+
+ void IncrementFalseAlarmsAndReviseHitCount();
+
+ bool IsEnabled() const;
+
+ // This doesn't really enable/disable the watchpoint. It is currently just
+ // for use in the Process plugin's {Enable,Disable}Watchpoint, which should
+ // be used instead.
+
+ void SetEnabled(bool enabled, bool notify = true);
+
+ bool IsHardware() const override;
+
+ bool ShouldStop(StoppointCallbackContext *context) override;
+
+ bool WatchpointRead() const;
+ bool WatchpointWrite() const;
+ uint32_t GetIgnoreCount() const;
+ void SetIgnoreCount(uint32_t n);
+ void SetWatchpointType(uint32_t type, bool notify = true);
+ void SetDeclInfo(const std::string &str);
+ std::string GetWatchSpec();
+ void SetWatchSpec(const std::string &str);
+
+ // Snapshot management interface.
+ bool IsWatchVariable() const;
+ void SetWatchVariable(bool val);
+ bool CaptureWatchedValue(const ExecutionContext &exe_ctx);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+ void Dump(Stream *s) const override;
+ void DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
+ void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
+ Target &GetTarget() { return m_target; }
+ const Status &GetError() { return m_error; }
+
+ /// Returns the WatchpointOptions structure set for this watchpoint.
+ ///
+ /// \return
+ /// A pointer to this watchpoint's WatchpointOptions.
+ WatchpointOptions *GetOptions() { return &m_options; }
+
+ /// Set the callback action invoked when the watchpoint is hit.
+ ///
+ /// \param[in] callback
+ /// The method that will get called when the watchpoint is hit.
+ /// \param[in] callback_baton
+ /// A void * pointer that will get passed back to the callback function.
+ /// \param[in] is_synchronous
+ /// If \b true the callback will be run on the private event thread
+ /// before the stop event gets reported. If false, the callback will get
+ /// handled on the public event thread after the stop has been posted.
+ ///
+ /// \return
+ /// \b true if the process should stop when you hit the watchpoint.
+ /// \b false if it should continue.
+ void SetCallback(WatchpointHitCallback callback, void *callback_baton,
+ bool is_synchronous = false);
+
+ void SetCallback(WatchpointHitCallback callback,
+ const lldb::BatonSP &callback_baton_sp,
+ bool is_synchronous = false);
+
+ void ClearCallback();
+
+ /// Invoke the callback action when the watchpoint is hit.
+ ///
+ /// \param[in] context
+ /// Described the watchpoint event.
+ ///
+ /// \return
+ /// \b true if the target should stop at this watchpoint and \b false not.
+ bool InvokeCallback(StoppointCallbackContext *context);
+
+ // Condition
+ /// Set the watchpoint's condition.
+ ///
+ /// \param[in] condition
+ /// The condition expression to evaluate when the watchpoint is hit.
+ /// Pass in nullptr to clear the condition.
+ void SetCondition(const char *condition);
+
+ /// Return a pointer to the text of the condition expression.
+ ///
+ /// \return
+ /// A pointer to the condition expression text, or nullptr if no
+ // condition has been set.
+ const char *GetConditionText() const;
+
+ void TurnOnEphemeralMode();
+
+ void TurnOffEphemeralMode();
+
+ bool IsDisabledDuringEphemeralMode();
+
+ const CompilerType &GetCompilerType() { return m_type; }
+
+private:
+ friend class Target;
+ friend class WatchpointList;
+
+ void ResetHitCount() { m_hit_count = 0; }
+
+ void ResetHistoricValues() {
+ m_old_value_sp.reset(nullptr);
+ m_new_value_sp.reset(nullptr);
+ }
+
+ Target &m_target;
+ bool m_enabled; // Is this watchpoint enabled
+ bool m_is_hardware; // Is this a hardware watchpoint
+ bool m_is_watch_variable; // True if set via 'watchpoint set variable'.
+ bool m_is_ephemeral; // True if the watchpoint is in the ephemeral mode,
+ // meaning that it is
+ // undergoing a pair of temporary disable/enable actions to avoid recursively
+ // triggering further watchpoint events.
+ uint32_t m_disabled_count; // Keep track of the count that the watchpoint is
+ // disabled while in ephemeral mode.
+ // At the end of the ephemeral mode when the watchpoint is to be enabled
+ // again, we check the count, if it is more than 1, it means the user-
+ // supplied actions actually want the watchpoint to be disabled!
+ uint32_t m_watch_read : 1, // 1 if we stop when the watched data is read from
+ m_watch_write : 1, // 1 if we stop when the watched data is written to
+ m_watch_was_read : 1, // Set to 1 when watchpoint is hit for a read access
+ m_watch_was_written : 1; // Set to 1 when watchpoint is hit for a write
+ // access
+ uint32_t m_ignore_count; // Number of times to ignore this watchpoint
+ uint32_t m_false_alarms; // Number of false alarms.
+ std::string m_decl_str; // Declaration information, if any.
+ std::string m_watch_spec_str; // Spec for the watchpoint.
+ lldb::ValueObjectSP m_old_value_sp;
+ lldb::ValueObjectSP m_new_value_sp;
+ CompilerType m_type;
+ 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.
+ bool m_being_created;
+
+ std::unique_ptr<UserExpression> m_condition_up; // The condition to test.
+
+ void SetID(lldb::watch_id_t id) { m_loc_id = id; }
+
+ void SendWatchpointChangedEvent(lldb::WatchpointEventType eventKind);
+
+ void SendWatchpointChangedEvent(WatchpointEventData *data);
+
+ DISALLOW_COPY_AND_ASSIGN(Watchpoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Watchpoint_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h b/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h
new file mode 100644
index 0000000..98c6483
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h
@@ -0,0 +1,206 @@
+//===-- WatchpointList.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_WatchpointList_h_
+#define liblldb_WatchpointList_h_
+
+#include <list>
+#include <mutex>
+#include <vector>
+
+#include "lldb/Core/Address.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h"
+/// This class is used by Watchpoint to manage a list of watchpoints,
+// each watchpoint in the list has a unique ID, and is unique by Address as
+// well.
+
+class WatchpointList {
+ // Only Target can make the watchpoint list, or add elements to it. This is
+ // not just some random collection of watchpoints. Rather, the act of adding
+ // the watchpoint to this list sets its ID.
+ friend class Watchpoint;
+ friend class Target;
+
+public:
+ /// Default constructor makes an empty list.
+ WatchpointList();
+
+ /// Destructor, currently does nothing.
+ ~WatchpointList();
+
+ /// Add a Watchpoint to the list.
+ ///
+ /// \param[in] wp_sp
+ /// A shared pointer to a watchpoint being added to the list.
+ ///
+ /// \return
+ /// The ID of the Watchpoint in the list.
+ lldb::watch_id_t Add(const lldb::WatchpointSP &wp_sp, bool notify);
+
+ /// Standard "Dump" method.
+ void Dump(Stream *s) const;
+
+ /// Dump with lldb::DescriptionLevel.
+ void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
+
+ /// Returns a shared pointer to the watchpoint at address \a addr - const
+ /// version.
+ ///
+ /// \param[in] addr
+ /// The address to look for.
+ ///
+ /// \result
+ /// A shared pointer to the watchpoint. May contain a NULL
+ /// pointer if the watchpoint doesn't exist.
+ const lldb::WatchpointSP FindByAddress(lldb::addr_t addr) const;
+
+ /// Returns a shared pointer to the watchpoint with watchpoint spec \a spec
+ /// - const version.
+ ///
+ /// \param[in] spec
+ /// The watchpoint spec to look for.
+ ///
+ /// \result
+ /// A shared pointer to the watchpoint. May contain a NULL
+ /// pointer if the watchpoint doesn't exist.
+ const lldb::WatchpointSP FindBySpec(std::string spec) const;
+
+ /// Returns a shared pointer to the watchpoint with id \a watchID, const
+ /// version.
+ ///
+ /// \param[in] watchID
+ /// The watchpoint location ID to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the watchpoint. May contain a NULL
+ /// pointer if the watchpoint doesn't exist.
+ lldb::WatchpointSP FindByID(lldb::watch_id_t watchID) const;
+
+ /// Returns the watchpoint id to the watchpoint at address \a addr.
+ ///
+ /// \param[in] addr
+ /// The address to match.
+ ///
+ /// \result
+ /// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
+ lldb::watch_id_t FindIDByAddress(lldb::addr_t addr);
+
+ /// Returns the watchpoint id to the watchpoint with watchpoint spec \a
+ /// spec.
+ ///
+ /// \param[in] spec
+ /// The watchpoint spec to match.
+ ///
+ /// \result
+ /// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
+ lldb::watch_id_t FindIDBySpec(std::string spec);
+
+ /// Returns a shared pointer to the watchpoint with index \a i.
+ ///
+ /// \param[in] i
+ /// The watchpoint index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the watchpoint. May contain a NULL pointer if
+ /// the watchpoint doesn't exist.
+ lldb::WatchpointSP GetByIndex(uint32_t i);
+
+ /// Returns a shared pointer to the watchpoint with index \a i, const
+ /// version.
+ ///
+ /// \param[in] i
+ /// The watchpoint index to seek for.
+ ///
+ /// \result
+ /// A shared pointer to the watchpoint. May contain a NULL pointer if
+ /// the watchpoint location doesn't exist.
+ const lldb::WatchpointSP GetByIndex(uint32_t i) const;
+
+ /// Removes the watchpoint given by \b watchID from this list.
+ ///
+ /// \param[in] watchID
+ /// The watchpoint ID to remove.
+ ///
+ /// \result
+ /// \b true if the watchpoint \a watchID was in the list.
+ bool Remove(lldb::watch_id_t watchID, bool notify);
+
+ /// Returns the number hit count of all watchpoints in this list.
+ ///
+ /// \result
+ /// Hit count of all watchpoints in this list.
+ uint32_t GetHitCount() const;
+
+ /// Enquires of the watchpoint in this list with ID \a watchID whether we
+ /// should stop.
+ ///
+ /// \param[in] context
+ /// This contains the information about this stop.
+ ///
+ /// \param[in] watchID
+ /// This watch ID that we hit.
+ ///
+ /// \return
+ /// \b true if we should stop, \b false otherwise.
+ bool ShouldStop(StoppointCallbackContext *context, lldb::watch_id_t watchID);
+
+ /// Returns the number of elements in this watchpoint list.
+ ///
+ /// \result
+ /// The number of elements.
+ size_t GetSize() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_watchpoints.size();
+ }
+
+ /// Print a description of the watchpoints in this list to the stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The description level that indicates the detail level to
+ /// provide.
+ ///
+ /// \see lldb::DescriptionLevel
+ void GetDescription(Stream *s, lldb::DescriptionLevel level);
+
+ void SetEnabledAll(bool enabled);
+
+ void RemoveAll(bool notify);
+
+ /// Sets the passed in Locker to hold the Watchpoint List mutex.
+ ///
+ /// \param[in] locker
+ /// The locker object that is set.
+ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
+
+protected:
+ typedef std::list<lldb::WatchpointSP> wp_collection;
+ typedef std::vector<lldb::watch_id_t> id_vector;
+
+ id_vector GetWatchpointIDs() const;
+
+ wp_collection::iterator GetIDIterator(lldb::watch_id_t watchID);
+
+ wp_collection::const_iterator
+ GetIDConstIterator(lldb::watch_id_t watchID) const;
+
+ wp_collection m_watchpoints;
+ mutable std::recursive_mutex m_mutex;
+
+ lldb::watch_id_t m_next_wp_id;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_WatchpointList_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h b/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h
new file mode 100644
index 0000000..b395dde
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h
@@ -0,0 +1,200 @@
+//===-- WatchpointOptions.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_WatchpointOptions_h_
+#define liblldb_WatchpointOptions_h_
+
+#include <memory>
+#include <string>
+
+#include "lldb/Utility/Baton.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class WatchpointOptions WatchpointOptions.h
+/// "lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a
+/// watchpoint.
+
+class WatchpointOptions {
+public:
+ // Constructors and Destructors
+ /// Default constructor. The watchpoint is enabled, and has no condition,
+ /// callback, ignore count, etc...
+ WatchpointOptions();
+ WatchpointOptions(const WatchpointOptions &rhs);
+
+ static WatchpointOptions *CopyOptionsNoCallback(WatchpointOptions &rhs);
+ /// This constructor allows you to specify all the watchpoint options.
+ ///
+ /// \param[in] callback
+ /// This is the plugin for some code that gets run, returns \b true if we
+ /// are to stop.
+ ///
+ /// \param[in] baton
+ /// Client data that will get passed to the callback.
+ ///
+ /// \param[in] thread_id
+ /// Only stop if \a thread_id hits the watchpoint.
+ WatchpointOptions(WatchpointHitCallback callback, void *baton,
+ lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
+
+ virtual ~WatchpointOptions();
+
+ // Operators
+ const WatchpointOptions &operator=(const WatchpointOptions &rhs);
+
+ // Callbacks
+ //
+ // Watchpoint callbacks come in two forms, synchronous and asynchronous.
+ // Synchronous callbacks will get run before any of the thread plans are
+ // consulted, and if they return false the target will continue "under the
+ // radar" of the thread plans. There are a couple of restrictions to
+ // synchronous callbacks: 1) They should NOT resume the target themselves.
+ // Just return false if you want the target to restart. 2) Watchpoints with
+ // synchronous callbacks can't have conditions (or rather, they can have
+ // them, but they
+ // won't do anything. Ditto with ignore counts, etc... You are supposed
+ // to control that all through the
+ // callback.
+ // Asynchronous callbacks get run as part of the "ShouldStop" logic in the
+ // thread plan. The logic there is:
+ // a) If the watchpoint is thread specific and not for this thread, continue
+ // w/o running the callback.
+ // b) If the ignore count says we shouldn't stop, then ditto.
+ // c) If the condition says we shouldn't stop, then ditto.
+ // d) Otherwise, the callback will get run, and if it returns true we will
+ // stop, and if false we won't.
+ // The asynchronous callback can run the target itself, but at present that
+ // should be the last action the
+ // callback does. We will relax this condition at some point, but it will
+ // take a bit of plumbing to get
+ // that to work.
+ //
+
+ /// Adds a callback to the watchpoint option set.
+ ///
+ /// \param[in] callback
+ /// The function to be called when the watchpoint gets hit.
+ ///
+ /// \param[in] baton_sp
+ /// A baton which will get passed back to the callback when it is invoked.
+ ///
+ /// \param[in] synchronous
+ /// Whether this is a synchronous or asynchronous callback. See discussion
+ /// above.
+ void SetCallback(WatchpointHitCallback callback,
+ const lldb::BatonSP &baton_sp, bool synchronous = false);
+
+ /// Remove the callback from this option set.
+ void ClearCallback();
+
+ // The rest of these functions are meant to be used only within the
+ // watchpoint handling mechanism.
+
+ /// Use this function to invoke the callback for a specific stop.
+ ///
+ /// \param[in] context
+ /// The context in which the callback is to be invoked. This includes the
+ /// stop event, the
+ /// execution context of the stop (since you might hit the same watchpoint
+ /// on multiple threads) and
+ /// whether we are currently executing synchronous or asynchronous
+ /// callbacks.
+ ///
+ /// \param[in] watch_id
+ /// The watchpoint ID that owns this option set.
+ ///
+ /// \return
+ /// The callback return value.
+ bool InvokeCallback(StoppointCallbackContext *context,
+ lldb::user_id_t watch_id);
+
+ /// Used in InvokeCallback to tell whether it is the right time to run this
+ /// kind of callback.
+ ///
+ /// \return
+ /// The synchronicity of our callback.
+ bool IsCallbackSynchronous() { return m_callback_is_synchronous; }
+
+ /// Fetch the baton from the callback.
+ ///
+ /// \return
+ /// The baton.
+ Baton *GetBaton();
+
+ /// Fetch a const version of the baton from the callback.
+ ///
+ /// \return
+ /// The baton.
+ const Baton *GetBaton() const;
+
+ /// Return the current thread spec for this option. This will return nullptr
+ /// if the no thread specifications have been set for this Option yet.
+ /// \return
+ /// The thread specification pointer for this option, or nullptr if none
+ /// has
+ /// been set yet.
+ const ThreadSpec *GetThreadSpecNoCreate() const;
+
+ /// Returns a pointer to the ThreadSpec for this option, creating it. if it
+ /// hasn't been created already. This API is used for setting the
+ /// ThreadSpec items for this option.
+ ThreadSpec *GetThreadSpec();
+
+ void SetThreadID(lldb::tid_t thread_id);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ /// Get description for callback only.
+ void GetCallbackDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ /// Returns true if the watchpoint option has a callback set.
+ bool HasCallback();
+
+ /// This is the default empty callback.
+ /// \return
+ /// The thread id for which the watchpoint hit will stop,
+ /// LLDB_INVALID_THREAD_ID for all threads.
+ static bool NullCallback(void *baton, StoppointCallbackContext *context,
+ lldb::user_id_t watch_id);
+
+ struct CommandData {
+ CommandData() : user_source(), script_source(), stop_on_error(true) {}
+
+ ~CommandData() = default;
+
+ StringList user_source;
+ std::string script_source;
+ bool stop_on_error;
+ };
+
+ class CommandBaton : public TypedBaton<CommandData> {
+ public:
+ CommandBaton(std::unique_ptr<CommandData> Data)
+ : TypedBaton(std::move(Data)) {}
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+ };
+
+protected:
+ // Classes that inherit from WatchpointOptions can see and modify these
+
+private:
+ // For WatchpointOptions only
+ WatchpointHitCallback m_callback; // This is the callback function pointer
+ lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+ bool m_callback_is_synchronous;
+ std::unique_ptr<ThreadSpec>
+ m_thread_spec_up; // Thread for which this watchpoint will take
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_WatchpointOptions_h_
diff --git a/linux-x64/clang/include/lldb/Core/Address.h b/linux-x64/clang/include/lldb/Core/Address.h
new file mode 100644
index 0000000..080c00e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Address.h
@@ -0,0 +1,491 @@
+//===-- Address.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Address_h_
+#define liblldb_Address_h_
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Block;
+class CompileUnit;
+class ExecutionContextScope;
+class Function;
+class SectionList;
+class Stream;
+class Symbol;
+class SymbolContext;
+class Target;
+struct LineEntry;
+
+/// \class Address Address.h "lldb/Core/Address.h"
+/// A section + offset based address class.
+///
+/// The Address class allows addresses to be relative to a section that can
+/// move during runtime due to images (executables, shared libraries, bundles,
+/// frameworks) being loaded at different addresses than the addresses found
+/// in the object file that represents them on disk. There are currently two
+/// types of addresses for a section:
+/// \li file addresses
+/// \li load addresses
+///
+/// File addresses represent the virtual addresses that are in the "on disk"
+/// object files. These virtual addresses are converted to be relative to
+/// unique sections scoped to the object file so that when/if the addresses
+/// slide when the images are loaded/unloaded in memory, we can easily track
+/// these changes without having to update every object (compile unit ranges,
+/// line tables, function address ranges, lexical block and inlined subroutine
+/// address ranges, global and static variables) each time an image is loaded
+/// or unloaded.
+///
+/// Load addresses represent the virtual addresses where each section ends up
+/// getting loaded at runtime. Before executing a program, it is common for
+/// all of the load addresses to be unresolved. When a DynamicLoader plug-in
+/// receives notification that shared libraries have been loaded/unloaded, the
+/// load addresses of the main executable and any images (shared libraries)
+/// will be resolved/unresolved. When this happens, breakpoints that are in
+/// one of these sections can be set/cleared.
+class Address {
+public:
+ /// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function
+ /// to display Address contents in a variety of ways.
+ enum DumpStyle {
+ DumpStyleInvalid, ///< Invalid dump style
+ DumpStyleSectionNameOffset, ///< Display as the section name + offset.
+ ///< \code
+ /// // address for printf in libSystem.B.dylib as a section name + offset
+ /// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf \endcode
+ DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset
+ ///(debug output).
+ ///< \code
+ /// // address for printf in libSystem.B.dylib as a section pointer +
+ /// offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode
+ DumpStyleFileAddress, ///< Display as the file address (if any).
+ ///< \code
+ /// // address for printf in libSystem.B.dylib as a file address
+ /// 0x000000000005dcff \endcode
+ DumpStyleModuleWithFileAddress, ///< Display as the file address with the
+ /// module name prepended (if any).
+ ///< \code
+ /// // address for printf in libSystem.B.dylib as a file address
+ /// libSystem.B.dylib[0x000000000005dcff] \endcode
+ DumpStyleLoadAddress, ///< Display as the load address (if resolved).
+ ///< \code
+ /// // address for printf in libSystem.B.dylib as a load address
+ /// 0x00007fff8306bcff \endcode
+ DumpStyleResolvedDescription, ///< Display the details about what an address
+ /// resolves to. This can
+ ///< be anything from a symbol context summary (module, function/symbol,
+ ///< and file and line), to information about what the pointer points to
+ ///< if the address is in a section (section of pointers, c strings, etc).
+ DumpStyleResolvedDescriptionNoModule,
+ DumpStyleResolvedDescriptionNoFunctionArguments,
+ DumpStyleNoFunctionName, ///< Elide the function name; display an offset
+ /// into the current function.
+ ///< Used primarily in disassembly symbolication
+ DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for
+ /// an address for all symbol
+ ///< context members.
+ DumpStyleResolvedPointerDescription ///< Dereference a pointer at the
+ /// current address and then lookup the
+ ///< dereferenced address using DumpStyleResolvedDescription
+ };
+
+ /// Default constructor.
+ ///
+ /// Initialize with a invalid section (NULL) and an invalid offset
+ /// (LLDB_INVALID_ADDRESS).
+ Address() : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {}
+
+ /// Copy constructor
+ ///
+ /// Makes a copy of the another Address object \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const Address object reference to copy.
+ Address(const Address &rhs)
+ : m_section_wp(rhs.m_section_wp), m_offset(rhs.m_offset) {}
+
+ /// Construct with a section pointer and offset.
+ ///
+ /// Initialize the address with the supplied \a section and \a offset.
+ ///
+ /// \param[in] section
+ /// A section pointer to a valid lldb::Section, or NULL if the
+ /// address doesn't have a section or will get resolved later.
+ ///
+ /// \param[in] offset
+ /// The offset in bytes into \a section.
+ Address(const lldb::SectionSP §ion_sp, lldb::addr_t offset)
+ : m_section_wp(), // Don't init with section_sp in case section_sp is
+ // invalid (the weak_ptr will throw)
+ m_offset(offset) {
+ if (section_sp)
+ m_section_wp = section_sp;
+ }
+
+ /// Construct with a virtual address and section list.
+ ///
+ /// Initialize and resolve the address with the supplied virtual address \a
+ /// file_addr.
+ ///
+ /// \param[in] file_addr
+ /// A virtual file address.
+ ///
+ /// \param[in] section_list
+ /// A list of sections, one of which may contain the \a file_addr.
+ Address(lldb::addr_t file_addr, const SectionList *section_list);
+
+ Address(lldb::addr_t abs_addr);
+
+/// Assignment operator.
+///
+/// Copies the address value from another Address object \a rhs into \a this
+/// object.
+///
+/// \param[in] rhs
+/// A const Address object reference to copy.
+///
+/// \return
+/// A const Address object reference to \a this.
+ const Address &operator=(const Address &rhs);
+
+ /// Clear the object's state.
+ ///
+ /// Sets the section to an invalid value (NULL) and an invalid offset
+ /// (LLDB_INVALID_ADDRESS).
+ void Clear() {
+ m_section_wp.reset();
+ m_offset = LLDB_INVALID_ADDRESS;
+ }
+
+ /// Compare two Address objects.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const Address object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const Address object reference.
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ static int CompareFileAddress(const Address &lhs, const Address &rhs);
+
+ static int CompareLoadAddress(const Address &lhs, const Address &rhs,
+ Target *target);
+
+ static int CompareModulePointerAndOffset(const Address &lhs,
+ const Address &rhs);
+
+ // For use with std::map, std::multi_map
+ class ModulePointerAndOffsetLessThanFunctionObject {
+ public:
+ ModulePointerAndOffsetLessThanFunctionObject() = default;
+
+ bool operator()(const Address &a, const Address &b) const {
+ return Address::CompareModulePointerAndOffset(a, b) < 0;
+ }
+ };
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s. There are many ways to display a section offset based address, and
+ /// \a style lets the user choose.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] style
+ /// The display style for the address.
+ ///
+ /// \param[in] fallback_style
+ /// The display style for the address.
+ ///
+ /// \return
+ /// Returns \b true if the address was able to be displayed.
+ /// File and load addresses may be unresolved and it may not be
+ /// possible to display a valid value, \b false will be returned
+ /// in such cases.
+ ///
+ /// \see Address::DumpStyle
+ bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
+ DumpStyle fallback_style = DumpStyleInvalid,
+ uint32_t addr_byte_size = UINT32_MAX) const;
+
+ AddressClass GetAddressClass() const;
+
+ /// Get the file address.
+ ///
+ /// If an address comes from a file on disk that has section relative
+ /// addresses, then it has a virtual address that is relative to unique
+ /// section in the object file.
+ ///
+ /// \return
+ /// The valid file virtual address, or LLDB_INVALID_ADDRESS if
+ /// the address doesn't have a file virtual address (image is
+ /// from memory only with no representation on disk).
+ lldb::addr_t GetFileAddress() const;
+
+ /// Get the load address.
+ ///
+ /// If an address comes from a file on disk that has section relative
+ /// addresses, then it has a virtual address that is relative to unique
+ /// section in the object file. Sections get resolved at runtime by
+ /// DynamicLoader plug-ins as images (executables and shared libraries) get
+ /// loaded/unloaded. If a section is loaded, then the load address can be
+ /// resolved.
+ ///
+ /// \return
+ /// The valid load virtual address, or LLDB_INVALID_ADDRESS if
+ /// the address is currently not loaded.
+ lldb::addr_t GetLoadAddress(Target *target) const;
+
+ /// Get the load address as a callable code load address.
+ ///
+ /// This function will first resolve its address to a load address. Then, if
+ /// the address turns out to be in code address, return the load address
+ /// that would be required to call or return to. The address might have
+ /// extra bits set (bit zero will be set to Thumb functions for an ARM
+ /// target) that are required when changing the program counter to setting a
+ /// return address.
+ ///
+ /// \return
+ /// The valid load virtual address, or LLDB_INVALID_ADDRESS if
+ /// the address is currently not loaded.
+ lldb::addr_t GetCallableLoadAddress(Target *target,
+ bool is_indirect = false) const;
+
+ /// Get the load address as an opcode load address.
+ ///
+ /// This function will first resolve its address to a load address. Then, if
+ /// the address turns out to be in code address, return the load address for
+ /// an opcode. This address object might have extra bits set (bit zero will
+ /// be set to Thumb functions for an
+ /// ARM target) that are required for changing the program counter
+ /// and this function will remove any bits that are intended for these
+ /// special purposes. The result of this function can be used to safely
+ /// write a software breakpoint trap to memory.
+ ///
+ /// \return
+ /// The valid load virtual address with extra callable bits
+ /// removed, or LLDB_INVALID_ADDRESS if the address is currently
+ /// not loaded.
+ lldb::addr_t GetOpcodeLoadAddress(
+ Target *target,
+ AddressClass addr_class = AddressClass::eInvalid) const;
+
+ /// Get the section relative offset value.
+ ///
+ /// \return
+ /// The current offset, or LLDB_INVALID_ADDRESS if this address
+ /// doesn't contain a valid offset.
+ lldb::addr_t GetOffset() const { return m_offset; }
+
+ /// Check if an address is section offset.
+ ///
+ /// When converting a virtual file or load address into a section offset
+ /// based address, we often need to know if, given a section list, if the
+ /// address was able to be converted to section offset. This function
+ /// returns true if the current value contained in this object is section
+ /// offset based.
+ ///
+ /// \return
+ /// Returns \b true if the address has a valid section and
+ /// offset, \b false otherwise.
+ bool IsSectionOffset() const {
+ return IsValid() && (GetSection().get() != nullptr);
+ }
+
+ /// Check if the object state is valid.
+ ///
+ /// A valid Address object contains either a section pointer and
+ /// offset (for section offset based addresses), or just a valid offset
+ /// (for absolute addresses that have no section).
+ ///
+ /// \return
+ /// Returns \b true if the offset is valid, \b false
+ /// otherwise.
+ bool IsValid() const { return m_offset != LLDB_INVALID_ADDRESS; }
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ size_t MemorySize() const;
+
+ /// Resolve a file virtual address using a section list.
+ ///
+ /// Given a list of sections, attempt to resolve \a addr as an offset into
+ /// one of the file sections.
+ ///
+ /// \return
+ /// Returns \b true if \a addr was able to be resolved, \b false
+ /// otherwise.
+ bool ResolveAddressUsingFileSections(lldb::addr_t addr,
+ const SectionList *sections);
+
+ /// Set the address to represent \a load_addr.
+ ///
+ /// The address will attempt to find a loaded section within \a target that
+ /// contains \a load_addr. If successful, this address object will have a
+ /// valid section and offset. Else this address object will have no section
+ /// (NULL) and the offset will be \a load_addr.
+ ///
+ /// \param[in] load_addr
+ /// A load address from a current process.
+ ///
+ /// \param[in] target
+ /// The target to use when trying resolve the address into
+ /// 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
+ /// address to not resolve to a section in a module, this often
+ /// happens for JIT'ed code, or any load addresses on the stack
+ /// or heap.
+ bool SetLoadAddress(lldb::addr_t load_addr, Target *target,
+ bool allow_section_end = false);
+
+ bool SetOpcodeLoadAddress(
+ lldb::addr_t load_addr, Target *target,
+ AddressClass addr_class = AddressClass::eInvalid,
+ bool allow_section_end = false);
+
+ bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);
+
+ /// Get accessor for the module for this address.
+ ///
+ /// \return
+ /// Returns the Module pointer that this address is an offset
+ /// in, or NULL if this address doesn't belong in a module, or
+ /// isn't resolved yet.
+ lldb::ModuleSP GetModule() const;
+
+ /// Get const accessor for the section.
+ ///
+ /// \return
+ /// Returns the const lldb::Section pointer that this address is an
+ /// offset in, or NULL if this address is absolute.
+ lldb::SectionSP GetSection() const { return m_section_wp.lock(); }
+
+ /// Set accessor for the offset.
+ ///
+ /// \param[in] offset
+ /// A new offset value for this object.
+ ///
+ /// \return
+ /// Returns \b true if the offset changed, \b false otherwise.
+ bool SetOffset(lldb::addr_t offset) {
+ bool changed = m_offset != offset;
+ m_offset = offset;
+ return changed;
+ }
+
+ void SetRawAddress(lldb::addr_t addr) {
+ m_section_wp.reset();
+ m_offset = addr;
+ }
+
+ bool Slide(int64_t offset) {
+ if (m_offset != LLDB_INVALID_ADDRESS) {
+ m_offset += offset;
+ return true;
+ }
+ return false;
+ }
+
+ /// Set accessor for the section.
+ ///
+ /// \param[in] section
+ /// A new lldb::Section pointer to use as the section base. Can
+ /// be NULL for absolute addresses that are not relative to
+ /// any section.
+ void SetSection(const lldb::SectionSP §ion_sp) {
+ m_section_wp = section_sp;
+ }
+
+ void ClearSection() { m_section_wp.reset(); }
+
+ /// Reconstruct a symbol context from an address.
+ ///
+ /// This class doesn't inherit from SymbolContextScope because many address
+ /// objects have short lifespans. Address objects that are section offset
+ /// can reconstruct their symbol context by looking up the address in the
+ /// module found in the section.
+ ///
+ /// \see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ uint32_t CalculateSymbolContext(SymbolContext *sc,
+ lldb::SymbolContextItem resolve_scope =
+ lldb::eSymbolContextEverything) const;
+
+ lldb::ModuleSP CalculateSymbolContextModule() const;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() const;
+
+ Function *CalculateSymbolContextFunction() const;
+
+ Block *CalculateSymbolContextBlock() const;
+
+ Symbol *CalculateSymbolContextSymbol() const;
+
+ bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
+
+ // Returns true if the section should be valid, but isn't because the shared
+ // pointer to the section can't be reconstructed from a weak pointer that
+ // contains a valid weak reference to a section. Returns false if the section
+ // weak pointer has no reference to a section, or if the section is still
+ // valid
+ bool SectionWasDeleted() const;
+
+protected:
+ // Member variables.
+ lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
+ lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid...
+
+ // Returns true if the m_section_wp once had a reference to a valid section
+ // shared pointer, but no longer does. This can happen if we have an address
+ // from a module that gets unloaded and deleted. This function should only be
+ // called if GetSection() returns an empty shared pointer and you want to
+ // know if this address used to have a valid section.
+ bool SectionWasDeletedPrivate() const;
+};
+
+// NOTE: Be careful using this operator. It can correctly compare two
+// addresses from the same Module correctly. It can't compare two addresses
+// from different modules in any meaningful way, but it will compare the module
+// pointers.
+//
+// To sum things up:
+// - works great for addresses within the same module - it works for addresses
+// across multiple modules, but don't expect the
+// address results to make much sense
+//
+// This basically lets Address objects be used in ordered collection classes.
+bool operator<(const Address &lhs, const Address &rhs);
+bool operator>(const Address &lhs, const Address &rhs);
+bool operator==(const Address &lhs, const Address &rhs);
+bool operator!=(const Address &lhs, const Address &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_Address_h_
diff --git a/linux-x64/clang/include/lldb/Core/AddressRange.h b/linux-x64/clang/include/lldb/Core/AddressRange.h
new file mode 100644
index 0000000..4a019bf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/AddressRange.h
@@ -0,0 +1,253 @@
+//===-- AddressRange.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AddressRange_h_
+#define liblldb_AddressRange_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+
+namespace lldb_private {
+class SectionList;
+class Stream;
+class Target;
+
+/// \class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
+/// A section + offset based address range class.
+class AddressRange {
+public:
+ /// Default constructor.
+ ///
+ /// Initialize with a invalid section (NULL), an invalid offset
+ /// (LLDB_INVALID_ADDRESS), and zero byte size.
+ AddressRange();
+
+ /// Construct with a section pointer, offset, and byte_size.
+ ///
+ /// Initialize the address with the supplied \a section, \a offset and \a
+ /// byte_size.
+ ///
+ /// \param[in] section
+ /// A section pointer to a valid lldb::Section, or NULL if the
+ /// address doesn't have a section or will get resolved later.
+ ///
+ /// \param[in] offset
+ /// The offset in bytes into \a section.
+ ///
+ /// \param[in] byte_size
+ /// The size in bytes of the address range.
+ AddressRange(const lldb::SectionSP §ion, lldb::addr_t offset,
+ lldb::addr_t byte_size);
+
+ /// Construct with a virtual address, section list and byte size.
+ ///
+ /// Initialize and resolve the address with the supplied virtual address \a
+ /// file_addr, and byte size \a byte_size.
+ ///
+ /// \param[in] file_addr
+ /// A virtual address.
+ ///
+ /// \param[in] byte_size
+ /// The size in bytes of the address range.
+ ///
+ /// \param[in] section_list
+ /// A list of sections, one of which may contain the \a vaddr.
+ AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size,
+ const SectionList *section_list = nullptr);
+
+ /// Construct with a Address object address and byte size.
+ ///
+ /// Initialize by copying the section offset address in \a so_addr, and
+ /// setting the byte size to \a byte_size.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object.
+ ///
+ /// \param[in] byte_size
+ /// The size in bytes of the address range.
+ AddressRange(const Address &so_addr, lldb::addr_t byte_size);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual in case this class is subclassed.
+ ~AddressRange();
+
+ /// Clear the object's state.
+ ///
+ /// Sets the section to an invalid value (NULL), an invalid offset
+ /// (LLDB_INVALID_ADDRESS) and a zero byte size.
+ void Clear();
+
+ /// Check if a section offset address is contained in this range.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object reference.
+ ///
+ /// \return
+ /// Returns \b true if \a so_addr is contained in this range,
+ /// \b false otherwise.
+ // bool
+ // Contains (const Address &so_addr) const;
+
+ /// Check if a section offset address is contained in this range.
+ ///
+ /// \param[in] so_addr_ptr
+ /// A section offset address object pointer.
+ ///
+ /// \return
+ /// Returns \b true if \a so_addr is contained in this range,
+ /// \b false otherwise.
+ // bool
+ // Contains (const Address *so_addr_ptr) const;
+
+ /// Check if a section offset \a so_addr when represented as a file address
+ /// is contained within this object's file address range.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object reference.
+ ///
+ /// \return
+ /// Returns \b true if both \a this and \a so_addr have
+ /// resolvable file address values and \a so_addr is contained
+ /// in the address range, \b false otherwise.
+ bool ContainsFileAddress(const Address &so_addr) const;
+
+ /// Check if the resolved file address \a file_addr is contained within this
+ /// object's file address range.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object reference.
+ ///
+ /// \return
+ /// Returns \b true if both \a this has a resolvable file
+ /// address value and \a so_addr is contained in the address
+ /// range, \b false otherwise.
+ bool ContainsFileAddress(lldb::addr_t file_addr) const;
+
+ /// Check if a section offset \a so_addr when represented as a load address
+ /// is contained within this object's load address range.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object reference.
+ ///
+ /// \return
+ /// Returns \b true if both \a this and \a so_addr have
+ /// resolvable load address values and \a so_addr is contained
+ /// in the address range, \b false otherwise.
+ bool ContainsLoadAddress(const Address &so_addr, Target *target) const;
+
+ /// Check if the resolved load address \a load_addr is contained within this
+ /// object's load address range.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object reference.
+ ///
+ /// \return
+ /// Returns \b true if both \a this has a resolvable load
+ /// address value and \a so_addr is contained in the address
+ /// range, \b false otherwise.
+ bool ContainsLoadAddress(lldb::addr_t load_addr, Target *target) const;
+
+ //------------------------------------------------------------------
+ /// Extends this range with \b rhs_range if it overlaps this range on the
+ /// right side. The range overlaps on the right side if the base address
+ /// of \b rhs_range lies within this range or if it's contiguous on its
+ /// right side.
+ ///
+ /// @param[in] rhs_range
+ /// The range to extend at the right side.
+ ///
+ /// @return
+ /// Returns \b true if this range was extended, \b false otherwise.
+ //------------------------------------------------------------------
+ bool Extend(const AddressRange &rhs_range);
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s. There are many ways to display a section offset based address
+ /// range, and \a style lets the user choose how the base address gets
+ /// displayed.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] style
+ /// The display style for the address.
+ ///
+ /// \return
+ /// Returns \b true if the address was able to be displayed.
+ /// File and load addresses may be unresolved and it may not be
+ /// possible to display a valid value, \b false will be returned
+ /// in such cases.
+ ///
+ /// \see Address::DumpStyle
+ bool
+ Dump(Stream *s, Target *target, Address::DumpStyle style,
+ Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
+
+ /// Dump a debug description of this object to a Stream.
+ ///
+ /// Dump a debug description of the contents of this object to the supplied
+ /// stream \a s.
+ ///
+ /// The debug description contains verbose internal state such and pointer
+ /// values, reference counts, etc.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void DumpDebug(Stream *s) const;
+
+ /// Get accessor for the base address of the range.
+ ///
+ /// \return
+ /// A reference to the base address object.
+ Address &GetBaseAddress() { return m_base_addr; }
+
+ /// Get const accessor for the base address of the range.
+ ///
+ /// \return
+ /// A const reference to the base address object.
+ const Address &GetBaseAddress() const { return m_base_addr; }
+
+ /// Get accessor for the byte size of this range.
+ ///
+ /// \return
+ /// The size in bytes of this address range.
+ lldb::addr_t GetByteSize() const { return m_byte_size; }
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ size_t MemorySize() const {
+ // Noting special for the memory size of a single AddressRange object, it
+ // is just the size of itself.
+ return sizeof(AddressRange);
+ }
+
+ /// Set accessor for the byte size of this range.
+ ///
+ /// \param[in] byte_size
+ /// The new size in bytes of this address range.
+ void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
+
+protected:
+ // Member variables
+ Address m_base_addr; ///< The section offset base address of this range.
+ lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
+};
+
+// bool operator== (const AddressRange& lhs, const AddressRange& rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_AddressRange_h_
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolver.h b/linux-x64/clang/include/lldb/Core/AddressResolver.h
new file mode 100644
index 0000000..cd95c7c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/AddressResolver.h
@@ -0,0 +1,63 @@
+//===-- AddressResolver.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AddressResolver_h_
+#define liblldb_AddressResolver_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/lldb-defines.h"
+
+#include <stddef.h>
+#include <vector>
+
+namespace lldb_private {
+class ModuleList;
+class Stream;
+
+/// \class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
+/// This class works with SearchFilter to resolve function names and source
+/// file locations to their concrete addresses.
+
+/// General Outline:
+/// The AddressResolver is a Searcher. In that protocol, the SearchFilter
+/// asks the question "At what depth of the symbol context descent do you want
+/// your callback to get called?" of the filter. The resolver answers this
+/// question (in the GetDepth method) and provides the resolution callback.
+
+class AddressResolver : public Searcher {
+public:
+ enum MatchType { Exact, Regexp, Glob };
+
+ AddressResolver();
+
+ ~AddressResolver() override;
+
+ virtual void ResolveAddress(SearchFilter &filter);
+
+ virtual void ResolveAddressInModules(SearchFilter &filter,
+ ModuleList &modules);
+
+ void GetDescription(Stream *s) override = 0;
+
+ std::vector<AddressRange> &GetAddressRanges();
+
+ size_t GetNumberOfAddresses();
+
+ AddressRange &GetAddressRangeAtIndex(size_t idx);
+
+protected:
+ std::vector<AddressRange> m_address_ranges;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(AddressResolver);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_AddressResolver_h_
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h b/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h
new file mode 100644
index 0000000..b98e7d4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h
@@ -0,0 +1,56 @@
+//===-- AddressResolverFileLine.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AddressResolverFileLine_h_
+#define liblldb_AddressResolverFileLine_h_
+
+#include "lldb/Core/AddressResolver.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-defines.h"
+
+#include <stdint.h>
+
+namespace lldb_private {
+class Address;
+class Stream;
+class SymbolContext;
+
+/// \class AddressResolverFileLine AddressResolverFileLine.h
+/// "lldb/Core/AddressResolverFileLine.h" This class finds address for source
+/// file and line. Optionally, it will look for inlined instances of the file
+/// and line specification.
+
+class AddressResolverFileLine : public AddressResolver {
+public:
+ AddressResolverFileLine(const FileSpec &resolver, uint32_t line_no,
+ bool check_inlines);
+
+ ~AddressResolverFileLine() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+protected:
+ 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.
+ bool m_inlines; // This determines whether the resolver looks for inlined
+ // functions or not.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_AddressResolverFileLine_h_
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolverName.h b/linux-x64/clang/include/lldb/Core/AddressResolverName.h
new file mode 100644
index 0000000..ad14ef6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/AddressResolverName.h
@@ -0,0 +1,62 @@
+//===-- AddressResolverName.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AddressResolverName_h_
+#define liblldb_AddressResolverName_h_
+
+#include "lldb/Core/AddressResolver.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/lldb-defines.h"
+
+namespace lldb_private {
+class Address;
+class Stream;
+class SymbolContext;
+
+/// \class AddressResolverName AddressResolverName.h
+/// "lldb/Core/AddressResolverName.h" This class finds addresses for a given
+/// function name, either by exact match or by regular expression.
+
+class AddressResolverName : public AddressResolver {
+public:
+ AddressResolverName(const char *func_name,
+ AddressResolver::MatchType type = Exact);
+
+ // Creates a function breakpoint by regular expression. Takes over control
+ // of the lifespan of func_regex.
+ AddressResolverName(RegularExpression &func_regex);
+
+ AddressResolverName(const char *class_name, const char *method,
+ AddressResolver::MatchType type);
+
+ ~AddressResolverName() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+protected:
+ ConstString m_func_name;
+ ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop
+ // on methods of this class.
+ RegularExpression m_regex;
+ AddressResolver::MatchType m_match_type;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(AddressResolverName);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_AddressResolverName_h_
diff --git a/linux-x64/clang/include/lldb/Core/Architecture.h b/linux-x64/clang/include/lldb/Core/Architecture.h
new file mode 100644
index 0000000..d8dbbb4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Architecture.h
@@ -0,0 +1,111 @@
+//===-- Architecture.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_ARCHITECTURE_H
+#define LLDB_CORE_ARCHITECTURE_H
+
+#include "lldb/Core/PluginInterface.h"
+
+namespace lldb_private {
+
+class Architecture : public PluginInterface {
+public:
+ Architecture() = default;
+ ~Architecture() override = default;
+
+ /// This is currently intended to handle cases where a
+ /// program stops at an instruction that won't get executed and it
+ /// allows the stop reason, like "breakpoint hit", to be replaced
+ /// with a different stop reason like "no stop reason".
+ ///
+ /// This is specifically used for ARM in Thumb code when we stop in
+ /// an IT instruction (if/then/else) where the instruction won't get
+ /// executed and therefore it wouldn't be correct to show the program
+ /// stopped at the current PC. The code is generic and applies to all
+ /// ARM CPUs.
+ virtual void OverrideStopInfo(Thread &thread) const = 0;
+
+ /// This method is used to get the number of bytes that should be
+ /// skipped, from function start address, to reach the first
+ /// instruction after the prologue. If overrode, it must return
+ /// non-zero only if the current address matches one of the known
+ /// function entry points.
+ ///
+ /// This method is called only if the standard platform-independent
+ /// code fails to get the number of bytes to skip, giving the plugin
+ /// a chance to try to find the missing info.
+ ///
+ /// This is specifically used for PPC64, where functions may have
+ /// more than one entry point, global and local, so both should
+ /// be compared with current address, in order to find out the
+ /// number of bytes that should be skipped, in case we are stopped
+ /// at either function entry point.
+ virtual size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const {
+ return 0;
+ }
+
+ /// Adjust function breakpoint address, if needed. In some cases,
+ /// the function start address is not the right place to set the
+ /// breakpoint, specially in functions with multiple entry points.
+ ///
+ /// This is specifically used for PPC64, for functions that have
+ /// both a global and a local entry point. In this case, the
+ /// breakpoint is adjusted to the first function address reached
+ /// by both entry points.
+ virtual void AdjustBreakpointAddress(const Symbol &func,
+ Address &addr) const {}
+
+
+ /// Get \a load_addr as a callable code load address for this target
+ ///
+ /// Take \a load_addr and potentially add any address bits that are
+ /// needed to make the address callable. For ARM this can set bit
+ /// zero (if it already isn't) if \a load_addr is a thumb function.
+ /// If \a addr_class is set to AddressClass::eInvalid, then the address
+ /// adjustment will always happen. If it is set to an address class
+ /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+ /// returned.
+ virtual lldb::addr_t GetCallableLoadAddress(
+ lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
+ return addr;
+ }
+
+ /// Get \a load_addr as an opcode for this target.
+ ///
+ /// Take \a load_addr and potentially strip any address bits that are
+ /// needed to make the address point to an opcode. For ARM this can
+ /// clear bit zero (if it already isn't) if \a load_addr is a
+ /// thumb function and load_addr is in code.
+ /// If \a addr_class is set to AddressClass::eInvalid, then the address
+ /// adjustment will always happen. If it is set to an address class
+ /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+ /// returned.
+
+ virtual lldb::addr_t GetOpcodeLoadAddress(
+ lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
+ return addr;
+ }
+
+ // Get load_addr as breakable load address for this target. Take a addr and
+ // check if for any reason there is a better address than this to put a
+ // breakpoint on. If there is then return that address. For MIPS, if
+ // instruction at addr is a delay slot instruction then this method will find
+ // the address of its previous instruction and return that address.
+ virtual lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr,
+ Target &target) const {
+ return addr;
+ }
+
+private:
+ Architecture(const Architecture &) = delete;
+ void operator=(const Architecture &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_CORE_ARCHITECTURE_H
diff --git a/linux-x64/clang/include/lldb/Core/ClangForward.h b/linux-x64/clang/include/lldb/Core/ClangForward.h
new file mode 100644
index 0000000..6b24b47
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ClangForward.h
@@ -0,0 +1,134 @@
+//===-- ClangForward.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangForward_h_
+#define liblldb_ClangForward_h_
+
+
+#if defined(__cplusplus)
+
+namespace clang {
+namespace Builtin {
+class Context;
+}
+
+class Action;
+class ASTConsumer;
+class ASTContext;
+class ASTRecordLayout;
+class AddrLabelExpr;
+class AnalyzerOptions;
+class BinaryOperator;
+class ClassTemplateDecl;
+class ClassTemplateSpecializationDecl;
+class CodeGenOptions;
+class CodeGenerator;
+class CompilerInstance;
+class CompoundStmt;
+class CXXBaseSpecifier;
+class CXXBoolLiteralExpr;
+class CXXFunctionalCastExpr;
+class CXXMethodDecl;
+class CXXNamedCastExpr;
+class CXXRecordDecl;
+class CXXThisExpr;
+class CharacterLiteral;
+class CompoundAssignOperator;
+class Decl;
+class DeclarationName;
+class DeclaratorDecl;
+class DeclContext;
+class DeclRefExpr;
+class DeclStmt;
+class DependencyOutputOptions;
+class Diagnostic;
+class DiagnosticConsumer;
+class DiagnosticsEngine;
+class DiagnosticOptions;
+class EnumDecl;
+class EnumConstantDecl;
+class Expr;
+class ExternalASTSource;
+class ExtVectorElementExpr;
+class FieldDecl;
+class FileManager;
+class FileSystemOptions;
+class FloatingLiteral;
+class FrontendOptions;
+class FunctionDecl;
+class FunctionTemplateDecl;
+class FunctionTemplateSpecializationInfo;
+class GotoStmt;
+class HeaderSearchOptions;
+class IdentifierInfo;
+class IdentifierTable;
+class IntegerLiteral;
+class LabelStmt;
+class LangOptions;
+class MacroDirective;
+class MemberExpr;
+class Module;
+class NamedDecl;
+class NamespaceDecl;
+class NonTypeTemplateParmDecl;
+class ObjCEncodeExpr;
+class ObjCImplicitSetterGetterRefExpr;
+class ObjCInterfaceDecl;
+class ObjCIvarDecl;
+class ObjCIvarRefExpr;
+class ObjCMessageExpr;
+class ObjCMethodDecl;
+class ObjCPropertyRefExpr;
+class ObjCProtocolDecl;
+class ObjCProtocolExpr;
+class ObjCSelectorExpr;
+class ObjCSuperExpr;
+class ParenExpr;
+class ParmVarDecl;
+class PredefinedExpr;
+class PreprocessorOptions;
+class PreprocessorOutputOptions;
+class QualType;
+class QualifiedNameType;
+class RecordDecl;
+class SelectorTable;
+class SizeOfAlignOfExpr;
+class SourceLocation;
+class SourceManager;
+class Stmt;
+class StmtIteratorBase;
+class StringLiteral;
+class TagDecl;
+class TargetInfo;
+class TargetOptions;
+class TemplateArgument;
+class TemplateDecl;
+class TemplateParameterList;
+class TemplateTemplateParmDecl;
+class TemplateTypeParmDecl;
+class TextDiagnosticBuffer;
+class TranslationUnitDecl;
+class Type;
+class TypeDecl;
+class TypedefDecl;
+class TypesCompatibleExpr;
+class UnaryOperator;
+class ValueDecl;
+class VarDecl;
+struct PrintingPolicy;
+}
+
+namespace llvm {
+class APInt;
+class APSInt;
+class LLVMContext;
+class ExecutionEngine;
+}
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_ClangForward_h_
diff --git a/linux-x64/clang/include/lldb/Core/Communication.h b/linux-x64/clang/include/lldb/Core/Communication.h
new file mode 100644
index 0000000..901b8fd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Communication.h
@@ -0,0 +1,367 @@
+//===-- Communication.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Communication_h_
+#define liblldb_Communication_h_
+
+#include "lldb/Host/HostThread.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Timeout.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <atomic>
+#include <mutex>
+#include <ratio>
+#include <string>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Connection;
+class ConstString;
+class Status;
+
+/// \class Communication Communication.h "lldb/Core/Communication.h" An
+/// abstract communications class.
+///
+/// Communication is an class that handles data communication between two data
+/// sources. It uses a Connection class to do the real communication. This
+/// approach has a couple of advantages: it allows a single instance of this
+/// class to be used even though its connection can change. Connections could
+/// negotiate for different connections based on abilities like starting with
+/// Bluetooth and negotiating up to WiFi if available. It also allows this
+/// class to be subclassed by any interfaces that don't want to give bytes but
+/// want to validate and give out packets. This can be done by overriding:
+///
+/// AppendBytesToCache (const uint8_t *src, size_t src_len, bool broadcast);
+///
+/// Communication inherits from Broadcaster which means it can be used in
+/// conjunction with Listener to wait for multiple broadcaster objects and
+/// multiple events from each of those objects. Communication defines a set of
+/// pre-defined event bits (see enumerations definitions that start with
+/// "eBroadcastBit" below).
+///
+/// There are two modes in which communications can occur:
+/// \li single-threaded
+/// \li multi-threaded
+///
+/// In single-threaded mode, all reads and writes happen synchronously on the
+/// calling thread.
+///
+/// In multi-threaded mode, a read thread is spawned that continually reads
+/// data and caches any received bytes. To start the read thread clients call:
+///
+/// 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:
+///
+/// size_t Communication::ReadFromConnection (void *, size_t, uint32_t);
+///
+/// When bytes are received the data gets cached in \a m_bytes and this class
+/// will broadcast a \b eBroadcastBitReadThreadGotBytes event. Clients that
+/// want packet based communication should override AppendBytesToCache. The
+/// subclasses can choose to call the built in AppendBytesToCache with the \a
+/// broadcast parameter set to false. This will cause the \b
+/// eBroadcastBitReadThreadGotBytes event not get broadcast, and then the
+/// subclass can post a \b eBroadcastBitPacketAvailable event when a full
+/// packet of data has been received.
+///
+/// If the connection is disconnected a \b eBroadcastBitDisconnected event
+/// gets broadcast. If the read thread exits a \b
+/// eBroadcastBitReadThreadDidExit event will be broadcast. Clients can also
+/// post a \b eBroadcastBitReadThreadShouldExit event to this object which
+/// will cause the read thread to exit.
+class Communication : public Broadcaster {
+public:
+ FLAGS_ANONYMOUS_ENUM(){
+ eBroadcastBitDisconnected =
+ (1u << 0), ///< Sent when the communications connection is lost.
+ eBroadcastBitReadThreadGotBytes =
+ (1u << 1), ///< Sent by the read thread when bytes become available.
+ eBroadcastBitReadThreadDidExit =
+ (1u
+ << 2), ///< Sent by the read thread when it exits to inform clients.
+ eBroadcastBitReadThreadShouldExit =
+ (1u << 3), ///< Sent by clients that need to cancel the read thread.
+ eBroadcastBitPacketAvailable =
+ (1u << 4), ///< Sent when data received makes a complete packet.
+ eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread
+ ///to indicate all pending
+ ///input has been processed.
+ kLoUserBroadcastBit =
+ (1u << 16), ///< Subclasses can used bits 31:16 for any needed events.
+ kHiUserBroadcastBit = (1u << 31),
+ eAllEventBits = 0xffffffff};
+
+ typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
+ size_t src_len);
+
+ /// Construct the Communication object with the specified name for the
+ /// Broadcaster that this object inherits from.
+ ///
+ /// \param[in] broadcaster_name
+ /// The name of the broadcaster object. This name should be as
+ /// complete as possible to uniquely identify this object. The
+ /// broadcaster name can be updated after the connect function
+ /// is called.
+ Communication(const char *broadcaster_name);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class gets subclassed.
+ ~Communication() override;
+
+ void Clear();
+
+ /// Connect using the current connection by passing \a url to its connect
+ /// function. string.
+ ///
+ /// \param[in] url
+ /// A string that contains all information needed by the
+ /// subclass to connect to another client.
+ ///
+ /// \return
+ /// \b True if the connect succeeded, \b false otherwise. The
+ /// internal error object should be filled in with an
+ /// appropriate value based on the result of this function.
+ ///
+ /// \see Status& Communication::GetError ();
+ /// \see bool Connection::Connect (const char *url);
+ lldb::ConnectionStatus Connect(const char *url, Status *error_ptr);
+
+ /// Disconnect the communications connection if one is currently connected.
+ ///
+ /// \return
+ /// \b True if the disconnect succeeded, \b false otherwise. The
+ /// internal error object should be filled in with an
+ /// appropriate value based on the result of this function.
+ ///
+ /// \see Status& Communication::GetError ();
+ /// \see bool Connection::Disconnect ();
+ lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr);
+
+ /// Check if the connection is valid.
+ ///
+ /// \return
+ /// \b True if this object is currently connected, \b false
+ /// otherwise.
+ bool IsConnected() const;
+
+ bool HasConnection() const;
+
+ lldb_private::Connection *GetConnection() { return m_connection_sp.get(); }
+
+ /// Read bytes from the current connection.
+ ///
+ /// If no read thread is running, this function call the connection's
+ /// Connection::Read(...) function to get any available.
+ ///
+ /// If a read thread has been started, this function will check for any
+ /// cached bytes that have already been read and return any currently
+ /// available bytes. If no bytes are cached, it will wait for the bytes to
+ /// become available by listening for the \a eBroadcastBitReadThreadGotBytes
+ /// event. If this function consumes all of the bytes in the cache, it will
+ /// reset the \a eBroadcastBitReadThreadGotBytes event bit.
+ ///
+ /// \param[in] dst
+ /// A destination buffer that must be at least \a dst_len bytes
+ /// long.
+ ///
+ /// \param[in] dst_len
+ /// The number of bytes to attempt to read, and also the max
+ /// number of bytes that can be placed into \a dst.
+ ///
+ /// \param[in] timeout
+ /// A timeout value or llvm::None for no timeout.
+ ///
+ /// \return
+ /// The number of bytes actually read.
+ ///
+ /// \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, Status *error_ptr);
+
+ /// The actual write function that attempts to write to the communications
+ /// protocol.
+ ///
+ /// Subclasses must override this function.
+ ///
+ /// \param[in] src
+ /// A source buffer that must be at least \a src_len bytes
+ /// long.
+ ///
+ /// \param[in] src_len
+ /// The number of bytes to attempt to write, and also the
+ /// number of bytes are currently available in \a src.
+ ///
+ /// \return
+ /// The number of bytes actually Written.
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
+ Status *error_ptr);
+
+ /// Sets the connection that it to be used by this class.
+ ///
+ /// By making a communication class that uses different connections it
+ /// allows a single communication interface to negotiate and change its
+ /// connection without any interruption to the client. It also allows the
+ /// Communication class to be subclassed for packet based communication.
+ ///
+ /// \param[in] connection
+ /// A connection that this class will own and destroy.
+ ///
+ /// \see
+ /// class Connection
+ void SetConnection(Connection *connection);
+
+ /// Starts a read thread whose sole purpose it to read bytes from the
+ /// current connection. This function will call connection's read function:
+ ///
+ /// size_t Connection::Read (void *, size_t);
+ ///
+ /// When bytes are read and cached, this function will call:
+ ///
+ /// Communication::AppendBytesToCache (const uint8_t * bytes, size_t len,
+ /// bool
+ /// broadcast);
+ ///
+ /// Subclasses should override this function if they wish to override the
+ /// default action of caching the bytes and broadcasting a \b
+ /// eBroadcastBitReadThreadGotBytes event.
+ ///
+ /// \return
+ /// \b True if the read thread was successfully started, \b
+ /// false otherwise.
+ ///
+ /// \see size_t Connection::Read (void *, size_t);
+ /// \see void Communication::AppendBytesToCache (const uint8_t * bytes,
+ /// size_t len, bool broadcast);
+ virtual bool StartReadThread(Status *error_ptr = nullptr);
+
+ /// Stops the read thread by cancelling it.
+ ///
+ /// \return
+ /// \b True if the read thread was successfully canceled, \b
+ /// false otherwise.
+ virtual bool StopReadThread(Status *error_ptr = nullptr);
+
+ virtual bool JoinReadThread(Status *error_ptr = nullptr);
+ /// Checks if there is a currently running read thread.
+ ///
+ /// \return
+ /// \b True if the read thread is running, \b false otherwise.
+ bool ReadThreadIsRunning();
+
+ /// The static read thread function. This function will call the "DoRead"
+ /// function continuously and wait for data to become available. When data
+ /// is received it will append the available data to the internal cache and
+ /// broadcast a \b eBroadcastBitReadThreadGotBytes event.
+ ///
+ /// \param[in] comm_ptr
+ /// A pointer to an instance of this class.
+ ///
+ /// \return
+ /// \b NULL.
+ ///
+ /// \see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
+ static lldb::thread_result_t ReadThread(lldb::thread_arg_t comm_ptr);
+
+ void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
+ void *callback_baton);
+
+ /// Wait for the read thread to process all outstanding data.
+ ///
+ /// After this function returns, the read thread has processed all data that
+ /// has been waiting in the Connection queue.
+ ///
+ void SynchronizeWithReadThread();
+
+ static const char *ConnectionStatusAsCString(lldb::ConnectionStatus status);
+
+ bool GetCloseOnEOF() const { return m_close_on_eof; }
+
+ void SetCloseOnEOF(bool b) { m_close_on_eof = b; }
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+protected:
+ lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use
+ ///by this communications class.
+ HostThread m_read_thread; ///< The read thread handle in case we need to
+ ///cancel the thread.
+ std::atomic<bool> m_read_thread_enabled;
+ std::atomic<bool> m_read_thread_did_exit;
+ std::string
+ m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
+ std::recursive_mutex m_bytes_mutex; ///< A mutex to protect multi-threaded
+ ///access to the cached bytes.
+ std::mutex
+ m_write_mutex; ///< Don't let multiple threads write at the same time...
+ std::mutex m_synchronize_mutex;
+ ReadThreadBytesReceived m_callback;
+ void *m_callback_baton;
+ bool m_close_on_eof;
+
+ size_t ReadFromConnection(void *dst, size_t dst_len,
+ const Timeout<std::micro> &timeout,
+ lldb::ConnectionStatus &status, Status *error_ptr);
+
+ /// Append new bytes that get read from the read thread into the internal
+ /// object byte cache. This will cause a \b eBroadcastBitReadThreadGotBytes
+ /// event to be broadcast if \a broadcast is true.
+ ///
+ /// Subclasses can override this function in order to inspect the received
+ /// data and check if a packet is available.
+ ///
+ /// Subclasses can also still call this function from the overridden method
+ /// to allow the caching to correctly happen and suppress the broadcasting
+ /// of the \a eBroadcastBitReadThreadGotBytes event by setting \a broadcast
+ /// to false.
+ ///
+ /// \param[in] src
+ /// A source buffer that must be at least \a src_len bytes
+ /// long.
+ ///
+ /// \param[in] src_len
+ /// The number of bytes to append to the cache.
+ virtual void AppendBytesToCache(const uint8_t *src, size_t src_len,
+ bool broadcast,
+ lldb::ConnectionStatus status);
+
+ /// Get any available bytes from our data cache. If this call empties the
+ /// data cache, the \b eBroadcastBitReadThreadGotBytes event will be reset
+ /// to signify no more bytes are available.
+ ///
+ /// \param[in] dst
+ /// A destination buffer that must be at least \a dst_len bytes
+ /// long.
+ ///
+ /// \param[in] dst_len
+ /// The number of bytes to attempt to read from the cache,
+ /// and also the max number of bytes that can be placed into
+ /// \a dst.
+ ///
+ /// \return
+ /// The number of bytes extracted from the data cache.
+ size_t GetCachedBytes(void *dst, size_t dst_len);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Communication);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Communication_h_
diff --git a/linux-x64/clang/include/lldb/Core/Debugger.h b/linux-x64/clang/include/lldb/Core/Debugger.h
new file mode 100644
index 0000000..8e60871
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Debugger.h
@@ -0,0 +1,418 @@
+//===-- Debugger.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Debugger_h_
+#define liblldb_Debugger_h_
+
+#include <stdint.h>
+
+#include <memory>
+#include <vector>
+
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Core/IOHandler.h"
+#include "lldb/Core/SourceManager.h"
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Host/HostThread.h"
+#include "lldb/Host/Terminal.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Platform.h"
+#include "lldb/Target/TargetList.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/Threading.h"
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdio.h>
+
+namespace llvm {
+class raw_ostream;
+}
+
+namespace lldb_private {
+class Address;
+class CommandInterpreter;
+class Process;
+class Stream;
+class SymbolContext;
+class Target;
+
+namespace repro {
+class DataRecorder;
+}
+
+/// \class Debugger Debugger.h "lldb/Core/Debugger.h"
+/// A class to manage flag bits.
+///
+/// Provides a global root objects for the debugger core.
+
+class Debugger : public std::enable_shared_from_this<Debugger>,
+ public UserID,
+ public Properties {
+ friend class SourceManager; // For GetSourceFileCache.
+
+public:
+ ~Debugger() override;
+
+ static lldb::DebuggerSP
+ CreateInstance(lldb::LogOutputCallback log_callback = nullptr,
+ void *baton = nullptr);
+
+ static lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid);
+
+ static lldb::TargetSP FindTargetWithProcess(Process *process);
+
+ static void Initialize(LoadPluginCallbackType load_plugin_callback);
+
+ static void Terminate();
+
+ static void SettingsInitialize();
+
+ static void SettingsTerminate();
+
+ static void Destroy(lldb::DebuggerSP &debugger_sp);
+
+ static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id);
+
+ static lldb::DebuggerSP
+ FindDebuggerWithInstanceName(ConstString instance_name);
+
+ static size_t GetNumDebuggers();
+
+ static lldb::DebuggerSP GetDebuggerAtIndex(size_t index);
+
+ static bool FormatDisassemblerAddress(const FormatEntity::Entry *format,
+ const SymbolContext *sc,
+ const SymbolContext *prev_sc,
+ const ExecutionContext *exe_ctx,
+ const Address *addr, Stream &s);
+
+ void Clear();
+
+ bool GetAsyncExecution();
+
+ void SetAsyncExecution(bool async);
+
+ lldb::StreamFileSP GetInputFile() { return m_input_file_sp; }
+
+ lldb::StreamFileSP GetOutputFile() { return m_output_file_sp; }
+
+ lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; }
+
+ repro::DataRecorder *GetInputRecorder();
+
+ void SetInputFileHandle(FILE *fh, bool tranfer_ownership,
+ repro::DataRecorder *recorder = nullptr);
+
+ void SetOutputFileHandle(FILE *fh, bool tranfer_ownership);
+
+ void SetErrorFileHandle(FILE *fh, bool tranfer_ownership);
+
+ void SaveInputTerminalState();
+
+ void RestoreInputTerminalState();
+
+ lldb::StreamSP GetAsyncOutputStream();
+
+ lldb::StreamSP GetAsyncErrorStream();
+
+ CommandInterpreter &GetCommandInterpreter() {
+ assert(m_command_interpreter_up.get());
+ return *m_command_interpreter_up;
+ }
+
+ ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
+
+ lldb::ListenerSP GetListener() { return m_listener_sp; }
+
+ // This returns the Debugger's scratch source manager. It won't be able to
+ // look up files in debug information, but it can look up files by absolute
+ // path and display them to you. To get the target's source manager, call
+ // GetSourceManager on the target instead.
+ SourceManager &GetSourceManager();
+
+ lldb::TargetSP GetSelectedTarget() {
+ return m_target_list.GetSelectedTarget();
+ }
+
+ ExecutionContext GetSelectedExecutionContext();
+ /// Get accessor for the target list.
+ ///
+ /// The target list is part of the global debugger object. This the single
+ /// debugger shared instance to control where targets get created and to
+ /// allow for tracking and searching for targets based on certain criteria.
+ ///
+ /// \return
+ /// A global shared target list.
+ TargetList &GetTargetList() { return m_target_list; }
+
+ PlatformList &GetPlatformList() { return m_platform_list; }
+
+ void DispatchInputInterrupt();
+
+ void DispatchInputEndOfFile();
+
+ // If any of the streams are not set, set them to the in/out/err stream of
+ // the top most input reader to ensure they at least have something
+ void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in,
+ lldb::StreamFileSP &out,
+ lldb::StreamFileSP &err);
+
+ void PushIOHandler(const lldb::IOHandlerSP &reader_sp,
+ bool cancel_top_handler = true);
+
+ bool PopIOHandler(const lldb::IOHandlerSP &reader_sp);
+
+ // Synchronously run an input reader until it is done
+ void RunIOHandler(const lldb::IOHandlerSP &reader_sp);
+
+ bool IsTopIOHandler(const lldb::IOHandlerSP &reader_sp);
+
+ bool CheckTopIOHandlerTypes(IOHandler::Type top_type,
+ IOHandler::Type second_top_type);
+
+ void PrintAsync(const char *s, size_t len, bool is_stdout);
+
+ ConstString GetTopIOHandlerControlSequence(char ch);
+
+ const char *GetIOHandlerCommandPrefix();
+
+ const char *GetIOHandlerHelpPrologue();
+
+ void ClearIOHandlers();
+
+ bool GetCloseInputOnEOF() const;
+
+ void SetCloseInputOnEOF(bool b);
+
+ 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);
+
+ // Properties Functions
+ enum StopDisassemblyType {
+ eStopDisassemblyTypeNever = 0,
+ eStopDisassemblyTypeNoDebugInfo,
+ eStopDisassemblyTypeNoSource,
+ eStopDisassemblyTypeAlways
+ };
+
+ Status SetPropertyValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op, llvm::StringRef property_path,
+ llvm::StringRef value) override;
+
+ bool GetAutoConfirm() const;
+
+ const FormatEntity::Entry *GetDisassemblyFormat() const;
+
+ const FormatEntity::Entry *GetFrameFormat() const;
+
+ const FormatEntity::Entry *GetFrameFormatUnique() const;
+
+ const FormatEntity::Entry *GetThreadFormat() const;
+
+ const FormatEntity::Entry *GetThreadStopFormat() const;
+
+ lldb::ScriptLanguage GetScriptLanguage() const;
+
+ bool SetScriptLanguage(lldb::ScriptLanguage script_lang);
+
+ uint32_t GetTerminalWidth() const;
+
+ bool SetTerminalWidth(uint32_t term_width);
+
+ llvm::StringRef GetPrompt() const;
+
+ void SetPrompt(llvm::StringRef p);
+ void SetPrompt(const char *) = delete;
+
+ llvm::StringRef GetReproducerPath() const;
+
+ bool GetUseExternalEditor() const;
+
+ bool SetUseExternalEditor(bool use_external_editor_p);
+
+ bool GetUseColor() const;
+
+ bool SetUseColor(bool use_color);
+
+ bool GetHighlightSource() const;
+
+ lldb::StopShowColumn GetStopShowColumn() const;
+
+ llvm::StringRef GetStopShowColumnAnsiPrefix() const;
+
+ llvm::StringRef GetStopShowColumnAnsiSuffix() const;
+
+ uint32_t GetStopSourceLineCount(bool before) const;
+
+ StopDisassemblyType GetStopDisassemblyDisplay() const;
+
+ uint32_t GetDisassemblyLineCount() const;
+
+ bool GetAutoOneLineSummaries() const;
+
+ bool GetAutoIndent() const;
+
+ bool SetAutoIndent(bool b);
+
+ bool GetPrintDecls() const;
+
+ bool SetPrintDecls(bool b);
+
+ uint32_t GetTabSize() const;
+
+ bool SetTabSize(uint32_t tab_size);
+
+ bool GetEscapeNonPrintables() const;
+
+ bool GetNotifyVoid() const;
+
+ ConstString GetInstanceName() { return m_instance_name; }
+
+ bool LoadPlugin(const FileSpec &spec, Status &error);
+
+ void ExecuteIOHandlers();
+
+ bool IsForwardingEvents();
+
+ void EnableForwardEvents(const lldb::ListenerSP &listener_sp);
+
+ void CancelForwardEvents(const lldb::ListenerSP &listener_sp);
+
+ bool IsHandlingEvents() const { return m_event_handler_thread.IsJoinable(); }
+
+ 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 is present you want to prime the dummy
+ // target with entities that will be copied over to new targets.
+ Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
+ Target *GetDummyTarget();
+
+ lldb::BroadcasterManagerSP GetBroadcasterManager() {
+ return m_broadcaster_manager_sp;
+ }
+
+protected:
+ friend class CommandInterpreter;
+ friend class REPL;
+
+ bool StartEventHandlerThread();
+
+ void StopEventHandlerThread();
+
+ static lldb::thread_result_t EventHandlerThread(lldb::thread_arg_t arg);
+
+ bool HasIOHandlerThread();
+
+ bool StartIOHandlerThread();
+
+ void StopIOHandlerThread();
+
+ void JoinIOHandlerThread();
+
+ static lldb::thread_result_t IOHandlerThread(lldb::thread_arg_t arg);
+
+ void DefaultEventHandler();
+
+ void HandleBreakpointEvent(const lldb::EventSP &event_sp);
+
+ void HandleProcessEvent(const lldb::EventSP &event_sp);
+
+ void HandleThreadEvent(const lldb::EventSP &event_sp);
+
+ size_t GetProcessSTDOUT(Process *process, Stream *stream);
+
+ size_t GetProcessSTDERR(Process *process, Stream *stream);
+
+ SourceManager::SourceFileCache &GetSourceFileCache() {
+ return m_source_file_cache;
+ }
+
+ void InstanceInitialize();
+
+ lldb::StreamFileSP m_input_file_sp;
+ lldb::StreamFileSP m_output_file_sp;
+ lldb::StreamFileSP m_error_file_sp;
+
+ /// Used for shadowing the input file when capturing a reproducer.
+ repro::DataRecorder *m_input_recorder;
+
+ lldb::BroadcasterManagerSP m_broadcaster_manager_sp; // The debugger acts as a
+ // broadcaster manager of
+ // last resort.
+ // It needs to get constructed before the target_list or any other member
+ // that might want to broadcast through the debugger.
+
+ TerminalState m_terminal_state;
+ TargetList m_target_list;
+
+ PlatformList m_platform_list;
+ lldb::ListenerSP m_listener_sp;
+ std::unique_ptr<SourceManager> m_source_manager_up; // This is a scratch
+ // source manager that we
+ // return if we have no
+ // targets.
+ SourceManager::SourceFileCache m_source_file_cache; // All the source managers
+ // for targets created in
+ // this debugger used this
+ // shared
+ // source file cache.
+ std::unique_ptr<CommandInterpreter> m_command_interpreter_up;
+
+ lldb::ScriptInterpreterSP m_script_interpreter_sp;
+ std::recursive_mutex m_script_interpreter_mutex;
+
+ IOHandlerStack m_input_reader_stack;
+ 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;
+ LoadedPluginsList m_loaded_plugins;
+ HostThread m_event_handler_thread;
+ HostThread m_io_handler_thread;
+ Broadcaster m_sync_broadcaster;
+ lldb::ListenerSP m_forward_listener_sp;
+ llvm::once_flag m_clear_once;
+
+ // Events for m_sync_broadcaster
+ enum {
+ eBroadcastBitEventThreadIsListening = (1 << 0),
+ };
+
+private:
+ // Use Debugger::CreateInstance() to get a shared pointer to a new debugger
+ // object
+ Debugger(lldb::LogOutputCallback m_log_callback, void *baton);
+
+ DISALLOW_COPY_AND_ASSIGN(Debugger);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Debugger_h_
diff --git a/linux-x64/clang/include/lldb/Core/Disassembler.h b/linux-x64/clang/include/lldb/Core/Disassembler.h
new file mode 100644
index 0000000..ba9ca87
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Disassembler.h
@@ -0,0 +1,551 @@
+//===-- Disassembler.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Disassembler_h_
+#define liblldb_Disassembler_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/EmulateInstruction.h"
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Core/Opcode.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+
+namespace llvm {
+template <typename T> class SmallVectorImpl;
+}
+
+namespace lldb_private {
+class AddressRange;
+class DataExtractor;
+class Debugger;
+class Disassembler;
+class Module;
+class Stream;
+class SymbolContext;
+class SymbolContextList;
+class Target;
+struct RegisterInfo;
+
+class Instruction {
+public:
+ Instruction(const Address &address,
+ AddressClass addr_class = AddressClass::eInvalid);
+
+ virtual ~Instruction();
+
+ const Address &GetAddress() const { return m_address; }
+
+ const char *GetMnemonic(const ExecutionContext *exe_ctx) {
+ CalculateMnemonicOperandsAndCommentIfNeeded(exe_ctx);
+ return m_opcode_name.c_str();
+ }
+
+ const char *GetOperands(const ExecutionContext *exe_ctx) {
+ CalculateMnemonicOperandsAndCommentIfNeeded(exe_ctx);
+ return m_mnemonics.c_str();
+ }
+
+ const char *GetComment(const ExecutionContext *exe_ctx) {
+ CalculateMnemonicOperandsAndCommentIfNeeded(exe_ctx);
+ return m_comment.c_str();
+ }
+
+ virtual void
+ CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx) = 0;
+
+ AddressClass GetAddressClass();
+
+ void SetAddress(const Address &addr) {
+ // Invalidate the address class to lazily discover it if we need to.
+ m_address_class = AddressClass::eInvalid;
+ m_address = addr;
+ }
+
+ /// Dump the text representation of this Instruction to a Stream
+ ///
+ /// Print the (optional) address, (optional) bytes, opcode,
+ /// operands, and instruction comments to a stream.
+ ///
+ /// \param[in] s
+ /// The Stream to add the text to.
+ ///
+ /// \param[in] show_address
+ /// Whether the address (using disassembly_addr_format_spec formatting)
+ /// should be printed.
+ ///
+ /// \param[in] show_bytes
+ /// Whether the bytes of the assembly instruction should be printed.
+ ///
+ /// \param[in] max_opcode_byte_size
+ /// The size (in bytes) of the largest instruction in the list that
+ /// we are printing (for text justification/alignment purposes)
+ /// Only needed if show_bytes is true.
+ ///
+ /// \param[in] exe_ctx
+ /// The current execution context, if available. May be used in
+ /// the assembling of the operands+comments for this instruction.
+ /// Pass NULL if not applicable.
+ ///
+ /// \param[in] sym_ctx
+ /// The SymbolContext for this instruction.
+ /// Pass NULL if not available/computed.
+ /// Only needed if show_address is true.
+ ///
+ /// \param[in] prev_sym_ctx
+ /// The SymbolContext for the previous instruction. Depending on
+ /// the disassembly address format specification, a change in
+ /// Symbol / Function may mean that a line is printed with the new
+ /// symbol/function name.
+ /// Pass NULL if unavailable, or if this is the first instruction of
+ /// the InstructionList.
+ /// Only needed if show_address is true.
+ ///
+ /// \param[in] disassembly_addr_format
+ /// The format specification for how addresses are printed.
+ /// Only needed if show_address is true.
+ ///
+ /// \param[in] max_address_text_size
+ /// The length of the longest address string at the start of the
+ /// disassembly line that will be printed (the
+ /// Debugger::FormatDisassemblerAddress() string)
+ /// so this method can properly align the instruction opcodes.
+ /// May be 0 to indicate no indentation/alignment of the opcodes.
+ virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address,
+ bool show_bytes, const ExecutionContext *exe_ctx,
+ const SymbolContext *sym_ctx,
+ const SymbolContext *prev_sym_ctx,
+ const FormatEntity::Entry *disassembly_addr_format,
+ size_t max_address_text_size);
+
+ virtual bool DoesBranch() = 0;
+
+ virtual bool HasDelaySlot();
+
+ bool CanSetBreakpoint ();
+
+ virtual size_t Decode(const Disassembler &disassembler,
+ const DataExtractor &data,
+ lldb::offset_t data_offset) = 0;
+
+ virtual void SetDescription(llvm::StringRef) {
+ } // May be overridden in sub-classes that have descriptions.
+
+ lldb::OptionValueSP ReadArray(FILE *in_file, Stream *out_stream,
+ OptionValue::Type data_type);
+
+ lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream *out_stream);
+
+ bool DumpEmulation(const ArchSpec &arch);
+
+ virtual bool TestEmulation(Stream *stream, const char *test_file_name);
+
+ bool Emulate(const ArchSpec &arch, uint32_t evaluate_options, void *baton,
+ EmulateInstruction::ReadMemoryCallback read_mem_callback,
+ EmulateInstruction::WriteMemoryCallback write_mem_calback,
+ EmulateInstruction::ReadRegisterCallback read_reg_callback,
+ EmulateInstruction::WriteRegisterCallback write_reg_callback);
+
+ const Opcode &GetOpcode() const { return m_opcode; }
+
+ uint32_t GetData(DataExtractor &data);
+
+ struct Operand {
+ enum class Type {
+ Invalid = 0,
+ Register,
+ Immediate,
+ Dereference,
+ Sum,
+ Product
+ } m_type = Type::Invalid;
+ std::vector<Operand> m_children;
+ lldb::addr_t m_immediate = 0;
+ ConstString m_register;
+ bool m_negative = false;
+ bool m_clobbered = false;
+
+ bool IsValid() { return m_type != Type::Invalid; }
+
+ static Operand BuildRegister(ConstString &r);
+ static Operand BuildImmediate(lldb::addr_t imm, bool neg);
+ static Operand BuildImmediate(int64_t imm);
+ static Operand BuildDereference(const Operand &ref);
+ static Operand BuildSum(const Operand &lhs, const Operand &rhs);
+ static Operand BuildProduct(const Operand &lhs, const Operand &rhs);
+ };
+
+ virtual bool ParseOperands(llvm::SmallVectorImpl<Operand> &operands) {
+ return false;
+ }
+
+ virtual bool IsCall() { return false; }
+
+protected:
+ Address m_address; // The section offset address of this instruction
+ // We include an address class in the Instruction class to
+ // allow the instruction specify the
+ // AddressClass::eCodeAlternateISA (currently used for
+ // thumb), and also to specify data (AddressClass::eData).
+ // The usual value will be AddressClass::eCode, but often
+ // when disassembling memory, you might run into data.
+ // This can help us to disassemble appropriately.
+private:
+ AddressClass m_address_class; // Use GetAddressClass () accessor function!
+
+protected:
+ Opcode m_opcode; // The opcode for this instruction
+ std::string m_opcode_name;
+ std::string m_mnemonics;
+ std::string m_comment;
+ bool m_calculated_strings;
+
+ void
+ CalculateMnemonicOperandsAndCommentIfNeeded(const ExecutionContext *exe_ctx) {
+ if (!m_calculated_strings) {
+ m_calculated_strings = true;
+ CalculateMnemonicOperandsAndComment(exe_ctx);
+ }
+ }
+};
+
+namespace OperandMatchers {
+std::function<bool(const Instruction::Operand &)>
+MatchBinaryOp(std::function<bool(const Instruction::Operand &)> base,
+ std::function<bool(const Instruction::Operand &)> left,
+ std::function<bool(const Instruction::Operand &)> right);
+
+std::function<bool(const Instruction::Operand &)>
+MatchUnaryOp(std::function<bool(const Instruction::Operand &)> base,
+ std::function<bool(const Instruction::Operand &)> child);
+
+std::function<bool(const Instruction::Operand &)>
+MatchRegOp(const RegisterInfo &info);
+
+std::function<bool(const Instruction::Operand &)> FetchRegOp(ConstString ®);
+
+std::function<bool(const Instruction::Operand &)> MatchImmOp(int64_t imm);
+
+std::function<bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm);
+
+std::function<bool(const Instruction::Operand &)>
+MatchOpType(Instruction::Operand::Type type);
+}
+
+class InstructionList {
+public:
+ InstructionList();
+ ~InstructionList();
+
+ size_t GetSize() const;
+
+ uint32_t GetMaxOpcocdeByteSize() const;
+
+ lldb::InstructionSP GetInstructionAtIndex(size_t idx) const;
+
+ //------------------------------------------------------------------
+ /// Get the index of the next branch instruction.
+ ///
+ /// Given a list of instructions, find the next branch instruction
+ /// in the list by returning an index.
+ ///
+ /// @param[in] start
+ /// The instruction index of the first instruction to check.
+ ///
+ /// @param[in] target
+ /// A LLDB target object that is used to resolve addresses.
+ ///
+ /// @param[in] ignore_calls
+ /// It true, then fine the first branch instruction that isn't
+ /// a function call (a branch that calls and returns to the next
+ /// instruction). If false, find the instruction index of any
+ /// branch in the list.
+ ///
+ /// @return
+ /// The instruction index of the first branch that is at or past
+ /// \a start. Returns UINT32_MAX if no matching branches are
+ /// found.
+ //------------------------------------------------------------------
+ uint32_t GetIndexOfNextBranchInstruction(uint32_t start,
+ Target &target,
+ bool ignore_calls) const;
+
+ uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr,
+ Target &target);
+
+ uint32_t GetIndexOfInstructionAtAddress(const Address &addr);
+
+ void Clear();
+
+ void Append(lldb::InstructionSP &inst_sp);
+
+ void Dump(Stream *s, bool show_address, bool show_bytes,
+ const ExecutionContext *exe_ctx);
+
+private:
+ typedef std::vector<lldb::InstructionSP> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ collection m_instructions;
+};
+
+class PseudoInstruction : public Instruction {
+public:
+ PseudoInstruction();
+
+ ~PseudoInstruction() override;
+
+ bool DoesBranch() override;
+
+ bool HasDelaySlot() override;
+
+ void CalculateMnemonicOperandsAndComment(
+ const ExecutionContext *exe_ctx) override {
+ // TODO: fill this in and put opcode name into Instruction::m_opcode_name,
+ // mnemonic into Instruction::m_mnemonics, and any comment into
+ // Instruction::m_comment
+ }
+
+ size_t Decode(const Disassembler &disassembler, const DataExtractor &data,
+ lldb::offset_t data_offset) override;
+
+ void SetOpcode(size_t opcode_size, void *opcode_data);
+
+ void SetDescription(llvm::StringRef description) override;
+
+protected:
+ std::string m_description;
+
+ DISALLOW_COPY_AND_ASSIGN(PseudoInstruction);
+};
+
+class Disassembler : public std::enable_shared_from_this<Disassembler>,
+ public PluginInterface {
+public:
+ enum {
+ eOptionNone = 0u,
+ eOptionShowBytes = (1u << 0),
+ eOptionRawOuput = (1u << 1),
+ eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains
+ // the current PC (mixed mode only)
+ eOptionMarkPCAddress =
+ (1u << 3) // Mark the disassembly line the contains the PC
+ };
+
+ enum HexImmediateStyle {
+ eHexStyleC,
+ eHexStyleAsm,
+ };
+
+ // FindPlugin should be lax about the flavor string (it is too annoying to
+ // have various internal uses of the disassembler fail because the global
+ // flavor string gets set wrong. Instead, if you get a flavor string you
+ // don't understand, use the default. Folks who care to check can use the
+ // FlavorValidForArchSpec method on the disassembler they got back.
+ static lldb::DisassemblerSP
+ FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name);
+
+ // This version will use the value in the Target settings if flavor is NULL;
+ static lldb::DisassemblerSP
+ FindPluginForTarget(const lldb::TargetSP target_sp, const ArchSpec &arch,
+ const char *flavor, const char *plugin_name);
+
+ static lldb::DisassemblerSP
+ DisassembleRange(const ArchSpec &arch, const char *plugin_name,
+ const char *flavor, const ExecutionContext &exe_ctx,
+ const AddressRange &disasm_range, bool prefer_file_cache);
+
+ static lldb::DisassemblerSP
+ DisassembleBytes(const ArchSpec &arch, const char *plugin_name,
+ const char *flavor, const Address &start, const void *bytes,
+ size_t length, uint32_t max_num_instructions,
+ bool data_from_file);
+
+ static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
+ const char *plugin_name, const char *flavor,
+ const ExecutionContext &exe_ctx,
+ const AddressRange &range, uint32_t num_instructions,
+ bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines, uint32_t options,
+ Stream &strm);
+
+ static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
+ const char *plugin_name, const char *flavor,
+ const ExecutionContext &exe_ctx, const Address &start,
+ uint32_t num_instructions,
+ bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines, uint32_t options,
+ Stream &strm);
+
+ static size_t
+ Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
+ const char *flavor, const ExecutionContext &exe_ctx,
+ SymbolContextList &sc_list, uint32_t num_instructions,
+ bool mixed_source_and_assembly, uint32_t num_mixed_context_lines,
+ uint32_t options, Stream &strm);
+
+ static bool
+ Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
+ const char *flavor, const ExecutionContext &exe_ctx,
+ ConstString name, Module *module,
+ uint32_t num_instructions, bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
+
+ static bool
+ Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
+ const char *flavor, const ExecutionContext &exe_ctx,
+ uint32_t num_instructions, bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
+
+ // Constructors and Destructors
+ Disassembler(const ArchSpec &arch, const char *flavor);
+ ~Disassembler() override;
+
+ typedef const char *(*SummaryCallback)(const Instruction &inst,
+ ExecutionContext *exe_context,
+ void *user_data);
+
+ static bool PrintInstructions(Disassembler *disasm_ptr, Debugger &debugger,
+ const ArchSpec &arch,
+ const ExecutionContext &exe_ctx,
+ uint32_t num_instructions,
+ bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines,
+ uint32_t options, Stream &strm);
+
+ size_t ParseInstructions(const ExecutionContext *exe_ctx,
+ const AddressRange &range, Stream *error_strm_ptr,
+ bool prefer_file_cache);
+
+ size_t ParseInstructions(const ExecutionContext *exe_ctx,
+ const Address &range, uint32_t num_instructions,
+ bool prefer_file_cache);
+
+ virtual size_t DecodeInstructions(const Address &base_addr,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t num_instructions, bool append,
+ bool data_from_file) = 0;
+
+ InstructionList &GetInstructionList();
+
+ const InstructionList &GetInstructionList() const;
+
+ const ArchSpec &GetArchitecture() const { return m_arch; }
+
+ const char *GetFlavor() const { return m_flavor.c_str(); }
+
+ virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch,
+ const char *flavor) = 0;
+
+protected:
+ // SourceLine and SourceLinesToDisplay structures are only used in the mixed
+ // source and assembly display methods internal to this class.
+
+ struct SourceLine {
+ FileSpec file;
+ uint32_t line;
+ uint32_t column;
+
+ SourceLine() : file(), line(LLDB_INVALID_LINE_NUMBER), column(0) {}
+
+ bool operator==(const SourceLine &rhs) const {
+ return file == rhs.file && line == rhs.line && rhs.column == column;
+ }
+
+ bool operator!=(const SourceLine &rhs) const {
+ return file != rhs.file || line != rhs.line || column != rhs.column;
+ }
+
+ bool IsValid() const { return line != LLDB_INVALID_LINE_NUMBER; }
+ };
+
+ struct SourceLinesToDisplay {
+ std::vector<SourceLine> lines;
+
+ // index of the "current" source line, if we want to highlight that when
+ // displaying the source lines. (as opposed to the surrounding source
+ // lines provided to give context)
+ size_t current_source_line;
+
+ // Whether to print a blank line at the end of the source lines.
+ bool print_source_context_end_eol;
+
+ SourceLinesToDisplay()
+ : lines(), current_source_line(-1), print_source_context_end_eol(true) {
+ }
+ };
+
+ // Get the function's declaration line number, hopefully a line number
+ // earlier than the opening curly brace at the start of the function body.
+ static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc);
+
+ // Add the provided SourceLine to the map of filenames-to-source-lines-seen.
+ static void AddLineToSourceLineTables(
+ SourceLine &line,
+ std::map<FileSpec, std::set<uint32_t>> &source_lines_seen);
+
+ // Given a source line, determine if we should print it when we're doing
+ // mixed source & assembly output. We're currently using the
+ // target.process.thread.step-avoid-regexp setting (which is used for
+ // stepping over inlined STL functions by default) to determine what source
+ // lines to avoid showing.
+ //
+ // Returns true if this source line should be elided (if the source line
+ // should not be displayed).
+ static bool
+ ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx,
+ const SymbolContext &sc, SourceLine &line);
+
+ static bool
+ ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx,
+ const SymbolContext &sc, LineEntry &line) {
+ SourceLine sl;
+ sl.file = line.file;
+ sl.line = line.line;
+ sl.column = line.column;
+ return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
+ };
+
+ // Classes that inherit from Disassembler can see and modify these
+ ArchSpec m_arch;
+ InstructionList m_instruction_list;
+ lldb::addr_t m_base_addr;
+ std::string m_flavor;
+
+private:
+ // For Disassembler only
+ DISALLOW_COPY_AND_ASSIGN(Disassembler);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Disassembler_h_
diff --git a/linux-x64/clang/include/lldb/Core/DumpDataExtractor.h b/linux-x64/clang/include/lldb/Core/DumpDataExtractor.h
new file mode 100644
index 0000000..2a9d778
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/DumpDataExtractor.h
@@ -0,0 +1,92 @@
+//===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H
+#define LLDB_CORE_DUMPDATAEXTRACTOR_H
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+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/linux-x64/clang/include/lldb/Core/DumpRegisterValue.h b/linux-x64/clang/include/lldb/Core/DumpRegisterValue.h
new file mode 100644
index 0000000..443fdb3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/DumpRegisterValue.h
@@ -0,0 +1,30 @@
+//===-- DumpRegisterValue.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_DUMPREGISTERVALUE_H
+#define LLDB_CORE_DUMPREGISTERVALUE_H
+
+#include "lldb/lldb-enumerations.h"
+#include <cstdint>
+
+namespace lldb_private {
+
+class RegisterValue;
+struct RegisterInfo;
+class Stream;
+
+// The default value of 0 for reg_name_right_align_at means no alignment at
+// all.
+bool DumpRegisterValue(const RegisterValue ®_val, Stream *s,
+ const RegisterInfo *reg_info, bool prefix_with_name,
+ bool prefix_with_alt_name, lldb::Format format,
+ uint32_t reg_name_right_align_at = 0);
+
+} // namespace lldb_private
+
+#endif // LLDB_CORE_DUMPREGISTERVALUE_H
diff --git a/linux-x64/clang/include/lldb/Core/EmulateInstruction.h b/linux-x64/clang/include/lldb/Core/EmulateInstruction.h
new file mode 100644
index 0000000..6b19c17
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/EmulateInstruction.h
@@ -0,0 +1,507 @@
+//===-- EmulateInstruction.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_EmulateInstruction_h_
+#define lldb_EmulateInstruction_h_
+
+#include <string>
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/Opcode.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class OptionValueDictionary;
+class RegisterContext;
+class RegisterValue;
+class Stream;
+class Target;
+class UnwindPlan;
+
+/// \class EmulateInstruction EmulateInstruction.h
+/// "lldb/Core/EmulateInstruction.h"
+/// A class that allows emulation of CPU opcodes.
+///
+/// This class is a plug-in interface that is accessed through the standard
+/// static FindPlugin function call in the EmulateInstruction class. The
+/// FindPlugin takes a target triple and returns a new object if there is a
+/// plug-in that supports the architecture and OS. Four callbacks and a baton
+/// are provided. The four callbacks are read register, write register, read
+/// memory and write memory.
+///
+/// This class is currently designed for these main use cases: - Auto
+/// generation of Call Frame Information (CFI) from assembly code - Predicting
+/// single step breakpoint locations - Emulating instructions for breakpoint
+/// traps
+///
+/// Objects can be asked to read an instruction which will cause a call to the
+/// read register callback to get the PC, followed by a read memory call to
+/// read the opcode. If ReadInstruction () returns true, then a call to
+/// EmulateInstruction::EvaluateInstruction () can be made. At this point the
+/// EmulateInstruction subclass will use all of the callbacks to emulate an
+/// instruction.
+///
+/// Clients that provide the callbacks can either do the read/write
+/// registers/memory to actually emulate the instruction on a real or virtual
+/// CPU, or watch for the EmulateInstruction::Context which is context for the
+/// read/write register/memory which explains why the callback is being
+/// called. Examples of a context are: "pushing register 3 onto the stack at
+/// offset -12", or "adjusting stack pointer by -16". This extra context
+/// allows the generation of
+/// CFI information from assembly code without having to actually do
+/// the read/write register/memory.
+///
+/// Clients must be prepared that not all instructions for an Instruction Set
+/// Architecture (ISA) will be emulated.
+///
+/// Subclasses at the very least should implement the instructions that save
+/// and restore registers onto the stack and adjustment to the stack pointer.
+/// By just implementing a few instructions for an ISA that are the typical
+/// prologue opcodes, you can then generate CFI using a class that will soon
+/// be available.
+///
+/// Implementing all of the instructions that affect the PC can then allow
+/// single step prediction support.
+///
+/// Implementing all of the instructions allows for emulation of opcodes for
+/// breakpoint traps and will pave the way for "thread centric" debugging. The
+/// current debugging model is "process centric" where all threads must be
+/// stopped when any thread is stopped; when hitting software breakpoints we
+/// must disable the breakpoint by restoring the original breakpoint opcode,
+/// single stepping and restoring the breakpoint trap. If all threads were
+/// allowed to run then other threads could miss the breakpoint.
+///
+/// This class centralizes the code that usually is done in separate code
+/// paths in a debugger (single step prediction, finding save restore
+/// locations of registers for unwinding stack frame variables) and emulating
+/// the instruction is just a bonus.
+
+class EmulateInstruction : public PluginInterface {
+public:
+ static EmulateInstruction *FindPlugin(const ArchSpec &arch,
+ InstructionType supported_inst_type,
+ const char *plugin_name);
+
+ enum ContextType {
+ eContextInvalid = 0,
+ // Read an instruction opcode from memory
+ eContextReadOpcode,
+
+ // Usually used for writing a register value whose source value is an
+ // immediate
+ eContextImmediate,
+
+ // Exclusively used when saving a register to the stack as part of the
+ // prologue
+ eContextPushRegisterOnStack,
+
+ // Exclusively used when restoring a register off the stack as part of the
+ // epilogue
+ eContextPopRegisterOffStack,
+
+ // Add or subtract a value from the stack
+ eContextAdjustStackPointer,
+
+ // Adjust the frame pointer for the current frame
+ eContextSetFramePointer,
+
+ // Typically in an epilogue sequence. Copy the frame pointer back into the
+ // stack pointer, use SP for CFA calculations again.
+ eContextRestoreStackPointer,
+
+ // Add or subtract a value from a base address register (other than SP)
+ eContextAdjustBaseRegister,
+
+ // Add or subtract a value from the PC or store a value to the PC.
+ eContextAdjustPC,
+
+ // Used in WriteRegister callbacks to indicate where the
+ eContextRegisterPlusOffset,
+
+ // Used in WriteMemory callback to indicate where the data came from
+ eContextRegisterStore,
+
+ eContextRegisterLoad,
+
+ // Used when performing a PC-relative branch where the
+ eContextRelativeBranchImmediate,
+
+ // Used when performing an absolute branch where the
+ eContextAbsoluteBranchRegister,
+
+ // Used when performing a supervisor call to an operating system to provide
+ // a service:
+ eContextSupervisorCall,
+
+ // Used when performing a MemU operation to read the PC-relative offset
+ // from an address.
+ eContextTableBranchReadMemory,
+
+ // Used when random bits are written into a register
+ eContextWriteRegisterRandomBits,
+
+ // Used when random bits are written to memory
+ eContextWriteMemoryRandomBits,
+
+ eContextArithmetic,
+
+ eContextAdvancePC,
+
+ eContextReturnFromException
+ };
+
+ enum InfoType {
+ eInfoTypeRegisterPlusOffset,
+ eInfoTypeRegisterPlusIndirectOffset,
+ eInfoTypeRegisterToRegisterPlusOffset,
+ eInfoTypeRegisterToRegisterPlusIndirectOffset,
+ eInfoTypeRegisterRegisterOperands,
+ eInfoTypeOffset,
+ eInfoTypeRegister,
+ eInfoTypeImmediate,
+ eInfoTypeImmediateSigned,
+ eInfoTypeAddress,
+ eInfoTypeISAAndImmediate,
+ eInfoTypeISAAndImmediateSigned,
+ eInfoTypeISA,
+ eInfoTypeNoArgs
+ } InfoType;
+
+ struct Context {
+ ContextType type;
+ enum InfoType info_type;
+ union {
+ struct RegisterPlusOffset {
+ RegisterInfo reg; // base register
+ int64_t signed_offset; // signed offset added to base register
+ } RegisterPlusOffset;
+
+ struct RegisterPlusIndirectOffset {
+ RegisterInfo base_reg; // base register number
+ RegisterInfo offset_reg; // offset register kind
+ } RegisterPlusIndirectOffset;
+
+ struct RegisterToRegisterPlusOffset {
+ RegisterInfo data_reg; // source/target register for data
+ RegisterInfo base_reg; // base register for address calculation
+ int64_t offset; // offset for address calculation
+ } RegisterToRegisterPlusOffset;
+
+ struct RegisterToRegisterPlusIndirectOffset {
+ RegisterInfo base_reg; // base register for address calculation
+ RegisterInfo offset_reg; // offset register for address calculation
+ RegisterInfo data_reg; // source/target register for data
+ } RegisterToRegisterPlusIndirectOffset;
+
+ struct RegisterRegisterOperands {
+ RegisterInfo
+ operand1; // register containing first operand for binary op
+ RegisterInfo
+ operand2; // register containing second operand for binary op
+ } RegisterRegisterOperands;
+
+ int64_t signed_offset; // signed offset by which to adjust self (for
+ // registers only)
+
+ RegisterInfo reg; // plain register
+
+ uint64_t unsigned_immediate; // unsigned immediate value
+ int64_t signed_immediate; // signed immediate value
+
+ lldb::addr_t address; // direct address
+
+ struct ISAAndImmediate {
+ uint32_t isa;
+ uint32_t unsigned_data32; // immediate data
+ } ISAAndImmediate;
+
+ struct ISAAndImmediateSigned {
+ uint32_t isa;
+ int32_t signed_data32; // signed immediate data
+ } ISAAndImmediateSigned;
+
+ uint32_t isa;
+ } info;
+
+ Context() : type(eContextInvalid), info_type(eInfoTypeNoArgs) {}
+
+ void SetRegisterPlusOffset(RegisterInfo base_reg, int64_t signed_offset) {
+ info_type = eInfoTypeRegisterPlusOffset;
+ info.RegisterPlusOffset.reg = base_reg;
+ info.RegisterPlusOffset.signed_offset = signed_offset;
+ }
+
+ void SetRegisterPlusIndirectOffset(RegisterInfo base_reg,
+ RegisterInfo offset_reg) {
+ info_type = eInfoTypeRegisterPlusIndirectOffset;
+ info.RegisterPlusIndirectOffset.base_reg = base_reg;
+ info.RegisterPlusIndirectOffset.offset_reg = offset_reg;
+ }
+
+ void SetRegisterToRegisterPlusOffset(RegisterInfo data_reg,
+ RegisterInfo base_reg,
+ int64_t offset) {
+ info_type = eInfoTypeRegisterToRegisterPlusOffset;
+ info.RegisterToRegisterPlusOffset.data_reg = data_reg;
+ info.RegisterToRegisterPlusOffset.base_reg = base_reg;
+ info.RegisterToRegisterPlusOffset.offset = offset;
+ }
+
+ void SetRegisterToRegisterPlusIndirectOffset(RegisterInfo base_reg,
+ RegisterInfo offset_reg,
+ RegisterInfo data_reg) {
+ info_type = eInfoTypeRegisterToRegisterPlusIndirectOffset;
+ info.RegisterToRegisterPlusIndirectOffset.base_reg = base_reg;
+ info.RegisterToRegisterPlusIndirectOffset.offset_reg = offset_reg;
+ info.RegisterToRegisterPlusIndirectOffset.data_reg = data_reg;
+ }
+
+ void SetRegisterRegisterOperands(RegisterInfo op1_reg,
+ RegisterInfo op2_reg) {
+ info_type = eInfoTypeRegisterRegisterOperands;
+ info.RegisterRegisterOperands.operand1 = op1_reg;
+ info.RegisterRegisterOperands.operand2 = op2_reg;
+ }
+
+ void SetOffset(int64_t signed_offset) {
+ info_type = eInfoTypeOffset;
+ info.signed_offset = signed_offset;
+ }
+
+ void SetRegister(RegisterInfo reg) {
+ info_type = eInfoTypeRegister;
+ info.reg = reg;
+ }
+
+ void SetImmediate(uint64_t immediate) {
+ info_type = eInfoTypeImmediate;
+ info.unsigned_immediate = immediate;
+ }
+
+ void SetImmediateSigned(int64_t signed_immediate) {
+ info_type = eInfoTypeImmediateSigned;
+ info.signed_immediate = signed_immediate;
+ }
+
+ void SetAddress(lldb::addr_t address) {
+ info_type = eInfoTypeAddress;
+ info.address = address;
+ }
+ void SetISAAndImmediate(uint32_t isa, uint32_t data) {
+ info_type = eInfoTypeISAAndImmediate;
+ info.ISAAndImmediate.isa = isa;
+ info.ISAAndImmediate.unsigned_data32 = data;
+ }
+
+ void SetISAAndImmediateSigned(uint32_t isa, int32_t data) {
+ info_type = eInfoTypeISAAndImmediateSigned;
+ info.ISAAndImmediateSigned.isa = isa;
+ info.ISAAndImmediateSigned.signed_data32 = data;
+ }
+
+ void SetISA(uint32_t isa) {
+ info_type = eInfoTypeISA;
+ info.isa = isa;
+ }
+
+ void SetNoArgs() { info_type = eInfoTypeNoArgs; }
+
+ void Dump(Stream &s, EmulateInstruction *instruction) const;
+ };
+
+ typedef size_t (*ReadMemoryCallback)(EmulateInstruction *instruction,
+ void *baton, const Context &context,
+ lldb::addr_t addr, void *dst,
+ size_t length);
+
+ typedef size_t (*WriteMemoryCallback)(EmulateInstruction *instruction,
+ void *baton, const Context &context,
+ lldb::addr_t addr, const void *dst,
+ size_t length);
+
+ typedef bool (*ReadRegisterCallback)(EmulateInstruction *instruction,
+ void *baton,
+ const RegisterInfo *reg_info,
+ RegisterValue ®_value);
+
+ typedef bool (*WriteRegisterCallback)(EmulateInstruction *instruction,
+ void *baton, const Context &context,
+ const RegisterInfo *reg_info,
+ const RegisterValue ®_value);
+
+ // Type to represent the condition of an instruction. The UINT32 value is
+ // reserved for the unconditional case and all other value can be used in an
+ // architecture dependent way.
+ typedef uint32_t InstructionCondition;
+ static const InstructionCondition UnconditionalCondition = UINT32_MAX;
+
+ EmulateInstruction(const ArchSpec &arch);
+
+ ~EmulateInstruction() override = default;
+
+ // Mandatory overrides
+ virtual bool
+ SupportsEmulatingInstructionsOfType(InstructionType inst_type) = 0;
+
+ virtual bool SetTargetTriple(const ArchSpec &arch) = 0;
+
+ virtual bool ReadInstruction() = 0;
+
+ virtual bool EvaluateInstruction(uint32_t evaluate_options) = 0;
+
+ virtual InstructionCondition GetInstructionCondition() {
+ return UnconditionalCondition;
+ }
+
+ virtual bool TestEmulation(Stream *out_stream, ArchSpec &arch,
+ OptionValueDictionary *test_data) = 0;
+
+ virtual bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
+ RegisterInfo ®_info) = 0;
+
+ // Optional overrides
+ virtual bool SetInstruction(const Opcode &insn_opcode,
+ const Address &inst_addr, Target *target);
+
+ virtual bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan);
+
+ static const char *TranslateRegister(lldb::RegisterKind reg_kind,
+ uint32_t reg_num, std::string ®_name);
+
+ // RegisterInfo variants
+ bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value);
+
+ uint64_t ReadRegisterUnsigned(const RegisterInfo *reg_info,
+ uint64_t fail_value, bool *success_ptr);
+
+ bool WriteRegister(const Context &context, const RegisterInfo *ref_info,
+ const RegisterValue ®_value);
+
+ bool WriteRegisterUnsigned(const Context &context,
+ const RegisterInfo *reg_info, uint64_t reg_value);
+
+ // Register kind and number variants
+ bool ReadRegister(lldb::RegisterKind reg_kind, uint32_t reg_num,
+ RegisterValue ®_value);
+
+ bool WriteRegister(const Context &context, lldb::RegisterKind reg_kind,
+ uint32_t reg_num, const RegisterValue ®_value);
+
+ uint64_t ReadRegisterUnsigned(lldb::RegisterKind reg_kind, uint32_t reg_num,
+ uint64_t fail_value, bool *success_ptr);
+
+ bool WriteRegisterUnsigned(const Context &context,
+ lldb::RegisterKind reg_kind, uint32_t reg_num,
+ uint64_t reg_value);
+
+ size_t ReadMemory(const Context &context, lldb::addr_t addr, void *dst,
+ size_t dst_len);
+
+ uint64_t ReadMemoryUnsigned(const Context &context, lldb::addr_t addr,
+ size_t byte_size, uint64_t fail_value,
+ bool *success_ptr);
+
+ bool WriteMemory(const Context &context, lldb::addr_t addr, const void *src,
+ size_t src_len);
+
+ bool WriteMemoryUnsigned(const Context &context, lldb::addr_t addr,
+ uint64_t uval, size_t uval_byte_size);
+
+ uint32_t GetAddressByteSize() const { return m_arch.GetAddressByteSize(); }
+
+ lldb::ByteOrder GetByteOrder() const { return m_arch.GetByteOrder(); }
+
+ const Opcode &GetOpcode() const { return m_opcode; }
+
+ lldb::addr_t GetAddress() const { return m_addr; }
+
+ const ArchSpec &GetArchitecture() const { return m_arch; }
+
+ static size_t ReadMemoryFrame(EmulateInstruction *instruction, void *baton,
+ const Context &context, lldb::addr_t addr,
+ void *dst, size_t length);
+
+ static size_t WriteMemoryFrame(EmulateInstruction *instruction, void *baton,
+ const Context &context, lldb::addr_t addr,
+ const void *dst, size_t length);
+
+ static bool ReadRegisterFrame(EmulateInstruction *instruction, void *baton,
+ const RegisterInfo *reg_info,
+ RegisterValue ®_value);
+
+ static bool WriteRegisterFrame(EmulateInstruction *instruction, void *baton,
+ const Context &context,
+ const RegisterInfo *reg_info,
+ const RegisterValue ®_value);
+
+ static size_t ReadMemoryDefault(EmulateInstruction *instruction, void *baton,
+ const Context &context, lldb::addr_t addr,
+ void *dst, size_t length);
+
+ static size_t WriteMemoryDefault(EmulateInstruction *instruction, void *baton,
+ const Context &context, lldb::addr_t addr,
+ const void *dst, size_t length);
+
+ static bool ReadRegisterDefault(EmulateInstruction *instruction, void *baton,
+ const RegisterInfo *reg_info,
+ RegisterValue ®_value);
+
+ static bool WriteRegisterDefault(EmulateInstruction *instruction, void *baton,
+ const Context &context,
+ const RegisterInfo *reg_info,
+ const RegisterValue ®_value);
+
+ void SetBaton(void *baton);
+
+ void SetCallbacks(ReadMemoryCallback read_mem_callback,
+ WriteMemoryCallback write_mem_callback,
+ ReadRegisterCallback read_reg_callback,
+ WriteRegisterCallback write_reg_callback);
+
+ void SetReadMemCallback(ReadMemoryCallback read_mem_callback);
+
+ void SetWriteMemCallback(WriteMemoryCallback write_mem_callback);
+
+ void SetReadRegCallback(ReadRegisterCallback read_reg_callback);
+
+ void SetWriteRegCallback(WriteRegisterCallback write_reg_callback);
+
+ static bool GetBestRegisterKindAndNumber(const RegisterInfo *reg_info,
+ lldb::RegisterKind ®_kind,
+ uint32_t ®_num);
+
+ static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx,
+ const RegisterInfo ®_info);
+
+protected:
+ ArchSpec m_arch;
+ void *m_baton = nullptr;
+ ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault;
+ WriteMemoryCallback m_write_mem_callback = &WriteMemoryDefault;
+ ReadRegisterCallback m_read_reg_callback = &ReadRegisterDefault;
+ WriteRegisterCallback m_write_reg_callback = &WriteRegisterDefault;
+ lldb::addr_t m_addr = LLDB_INVALID_ADDRESS;
+ Opcode m_opcode;
+
+private:
+ // For EmulateInstruction only
+ DISALLOW_COPY_AND_ASSIGN(EmulateInstruction);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_EmulateInstruction_h_
diff --git a/linux-x64/clang/include/lldb/Core/FileLineResolver.h b/linux-x64/clang/include/lldb/Core/FileLineResolver.h
new file mode 100644
index 0000000..1967ed5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/FileLineResolver.h
@@ -0,0 +1,66 @@
+//===-- FileLineResolver.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FileLineResolver_h_
+#define liblldb_FileLineResolver_h_
+
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-defines.h"
+
+#include <stdint.h>
+
+namespace lldb_private {
+class Address;
+class Stream;
+
+/// \class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
+/// This class finds address for source file and line. Optionally, it will
+/// look for inlined instances of the file and line specification.
+
+class FileLineResolver : public Searcher {
+public:
+ FileLineResolver()
+ : m_file_spec(),
+ m_line_number(UINT32_MAX), // Set this to zero for all lines in a file
+ m_sc_list(), m_inlines(true) {}
+
+ FileLineResolver(const FileSpec &resolver, uint32_t line_no,
+ bool check_inlines);
+
+ ~FileLineResolver() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool containing) override;
+
+ lldb::SearchDepth GetDepth() override;
+
+ void GetDescription(Stream *s) override;
+
+ const SymbolContextList &GetFileLineMatches() { return m_sc_list; }
+
+ void Clear();
+
+ void Reset(const FileSpec &file_spec, uint32_t line, bool check_inlines);
+
+protected:
+ 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.
+ SymbolContextList m_sc_list;
+ bool m_inlines; // This determines whether the resolver looks for inlined
+ // functions or not.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(FileLineResolver);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_FileLineResolver_h_
diff --git a/linux-x64/clang/include/lldb/Core/FileSpecList.h b/linux-x64/clang/include/lldb/Core/FileSpecList.h
new file mode 100644
index 0000000..79623ef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/FileSpecList.h
@@ -0,0 +1,194 @@
+//===-- FileSpecList.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FileSpecList_h_
+#define liblldb_FileSpecList_h_
+#if defined(__cplusplus)
+
+#include "lldb/Utility/FileSpec.h"
+
+#include <vector>
+
+#include <stddef.h>
+
+namespace lldb_private {
+class Stream;
+
+/// \class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h"
+/// A file collection class.
+///
+/// A class that contains a mutable list of FileSpec objects.
+class FileSpecList {
+public:
+ /// Default constructor.
+ ///
+ /// Initialize this object with an empty file list.
+ FileSpecList();
+
+ /// Copy constructor.
+ FileSpecList(const FileSpecList &rhs) = default;
+
+ /// Move constructor
+ FileSpecList(FileSpecList &&rhs) = default;
+
+ /// Initialize this object from a vector of FileSpecs
+ FileSpecList(std::vector<FileSpec> &&rhs) : m_files(std::move(rhs)) {}
+
+ /// Destructor.
+ ~FileSpecList();
+
+ /// Assignment operator.
+ ///
+ /// Replace the file list in this object with the file list from \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A file list object to copy.
+ ///
+ /// \return
+ /// A const reference to this object.
+ FileSpecList &operator=(const FileSpecList &rhs) = default;
+
+ /// Move-assignment operator.
+ FileSpecList &operator=(FileSpecList &&rhs) = default;
+
+ /// Append a FileSpec object to the list.
+ ///
+ /// Appends \a file to the end of the file list.
+ ///
+ /// \param[in] file
+ /// A new file to append to this file list.
+ void Append(const FileSpec &file);
+
+ /// Append a FileSpec object if unique.
+ ///
+ /// Appends \a file to the end of the file list if it doesn't already exist
+ /// in the file list.
+ ///
+ /// \param[in] file
+ /// A new file to append to this file list.
+ ///
+ /// \return
+ /// \b true if the file was appended, \b false otherwise.
+ bool AppendIfUnique(const FileSpec &file);
+
+ /// Clears the file list.
+ void Clear();
+
+ /// Dumps the file list to the supplied stream pointer "s".
+ ///
+ /// \param[in] s
+ /// The stream that will be used to dump the object description.
+ void Dump(Stream *s, const char *separator_cstr = "\n") const;
+
+ /// Find a file index.
+ ///
+ /// Find the index of the file in the file spec list that matches \a file
+ /// starting \a idx entries into the file spec list.
+ ///
+ /// \param[in] idx
+ /// An index into the file list.
+ ///
+ /// \param[in] file
+ /// The file specification to search for.
+ ///
+ /// \param[in] full
+ /// Should FileSpec::Equal be called with "full" true or false.
+ ///
+ /// \return
+ /// The index of the file that matches \a file if it is found,
+ /// else UINT32_MAX is returned.
+ size_t FindFileIndex(size_t idx, const FileSpec &file, bool full) const;
+
+ /// Get file at index.
+ ///
+ /// Gets a file from the file list. If \a idx is not a valid index, an empty
+ /// FileSpec object will be returned. The file objects that are returned can
+ /// be tested using FileSpec::operator void*().
+ ///
+ /// \param[in] idx
+ /// An index into the file list.
+ ///
+ /// \return
+ /// A copy of the FileSpec object at index \a idx. If \a idx
+ /// is out of range, then an empty FileSpec object will be
+ /// returned.
+ const FileSpec &GetFileSpecAtIndex(size_t idx) const;
+
+ /// Get file specification pointer at index.
+ ///
+ /// Gets a file from the file list. The file objects that are returned can
+ /// be tested using FileSpec::operator void*().
+ ///
+ /// \param[in] idx
+ /// An index into the file list.
+ ///
+ /// \return
+ /// A pointer to a contained FileSpec object at index \a idx.
+ /// If \a idx is out of range, then an NULL is returned.
+ const FileSpec *GetFileSpecPointerAtIndex(size_t idx) const;
+
+ /// Get the memory cost of this object.
+ ///
+ /// Return the size in bytes that this object takes in memory. This returns
+ /// the size in bytes of this object, not any shared string values it may
+ /// refer to.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const;
+
+ bool IsEmpty() const { return m_files.empty(); }
+
+ /// Get the number of files in the file list.
+ ///
+ /// \return
+ /// The number of files in the file spec list.
+ size_t GetSize() const;
+
+ bool Insert(size_t idx, const FileSpec &file) {
+ if (idx < m_files.size()) {
+ m_files.insert(m_files.begin() + idx, file);
+ return true;
+ } else if (idx == m_files.size()) {
+ m_files.push_back(file);
+ return true;
+ }
+ return false;
+ }
+
+ bool Replace(size_t idx, const FileSpec &file) {
+ if (idx < m_files.size()) {
+ m_files[idx] = file;
+ return true;
+ }
+ return false;
+ }
+
+ bool Remove(size_t idx) {
+ if (idx < m_files.size()) {
+ m_files.erase(m_files.begin() + idx);
+ return true;
+ }
+ return false;
+ }
+
+ static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay,
+ FileSpecList &matches);
+
+protected:
+ typedef std::vector<FileSpec>
+ collection; ///< The collection type for the file list.
+ collection m_files; ///< A collection of FileSpec objects.
+};
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_FileSpecList_h_
diff --git a/linux-x64/clang/include/lldb/Core/FormatEntity.h b/linux-x64/clang/include/lldb/Core/FormatEntity.h
new file mode 100644
index 0000000..634d9df
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/FormatEntity.h
@@ -0,0 +1,220 @@
+//===-- FormatEntity.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FormatEntity_h_
+#define liblldb_FormatEntity_h_
+
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+#include <algorithm>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+class Address;
+class ExecutionContext;
+class Stream;
+class StringList;
+class SymbolContext;
+class ValueObject;
+}
+namespace llvm {
+class StringRef;
+}
+
+namespace lldb_private {
+class FormatEntity {
+public:
+ struct Entry {
+ enum class Type {
+ Invalid,
+ ParentNumber,
+ ParentString,
+ EscapeCode,
+ Root,
+ String,
+ Scope,
+ Variable,
+ VariableSynthetic,
+ ScriptVariable,
+ ScriptVariableSynthetic,
+ AddressLoad,
+ AddressFile,
+ AddressLoadOrFile,
+ ProcessID,
+ ProcessFile,
+ ScriptProcess,
+ ThreadID,
+ ThreadProtocolID,
+ ThreadIndexID,
+ ThreadName,
+ ThreadQueue,
+ ThreadStopReason,
+ ThreadReturnValue,
+ ThreadCompletedExpression,
+ ScriptThread,
+ ThreadInfo,
+ TargetArch,
+ ScriptTarget,
+ ModuleFile,
+ File,
+ Lang,
+ FrameIndex,
+ FrameNoDebug,
+ FrameRegisterPC,
+ FrameRegisterSP,
+ FrameRegisterFP,
+ FrameRegisterFlags,
+ FrameRegisterByName,
+ FrameIsArtificial,
+ ScriptFrame,
+ FunctionID,
+ FunctionDidChange,
+ FunctionInitialFunction,
+ FunctionName,
+ FunctionNameWithArgs,
+ FunctionNameNoArgs,
+ FunctionAddrOffset,
+ FunctionAddrOffsetConcrete,
+ FunctionLineOffset,
+ FunctionPCOffset,
+ FunctionInitial,
+ FunctionChanged,
+ FunctionIsOptimized,
+ LineEntryFile,
+ LineEntryLineNumber,
+ LineEntryColumn,
+ LineEntryStartAddress,
+ LineEntryEndAddress,
+ CurrentPCArrow
+ };
+
+ struct Definition {
+ const char *name;
+ const char *string; // Insert this exact string into the output
+ Entry::Type type;
+ uint64_t data;
+ uint32_t num_children;
+ Definition *children; // An array of "num_children" Definition entries,
+ bool keep_separator;
+ };
+
+ Entry(Type t = Type::Invalid, const char *s = nullptr,
+ const char *f = nullptr)
+ : string(s ? s : ""), printf_format(f ? f : ""), children(),
+ definition(nullptr), type(t), fmt(lldb::eFormatDefault), number(0),
+ deref(false) {}
+
+ Entry(llvm::StringRef s);
+ Entry(char ch);
+
+ void AppendChar(char ch);
+
+ void AppendText(const llvm::StringRef &s);
+
+ void AppendText(const char *cstr);
+
+ void AppendEntry(const Entry &&entry) { children.push_back(entry); }
+
+ void Clear() {
+ string.clear();
+ printf_format.clear();
+ children.clear();
+ definition = nullptr;
+ type = Type::Invalid;
+ fmt = lldb::eFormatDefault;
+ number = 0;
+ deref = false;
+ }
+
+ static const char *TypeToCString(Type t);
+
+ void Dump(Stream &s, int depth = 0) const;
+
+ bool operator==(const Entry &rhs) const {
+ if (string != rhs.string)
+ return false;
+ if (printf_format != rhs.printf_format)
+ return false;
+ const size_t n = children.size();
+ const size_t m = rhs.children.size();
+ for (size_t i = 0; i < std::min<size_t>(n, m); ++i) {
+ if (!(children[i] == rhs.children[i]))
+ return false;
+ }
+ if (children != rhs.children)
+ return false;
+ if (definition != rhs.definition)
+ return false;
+ if (type != rhs.type)
+ return false;
+ if (fmt != rhs.fmt)
+ return false;
+ if (deref != rhs.deref)
+ return false;
+ return true;
+ }
+
+ std::string string;
+ std::string printf_format;
+ std::vector<Entry> children;
+ Definition *definition;
+ Type type;
+ lldb::Format fmt;
+ lldb::addr_t number;
+ bool deref;
+ };
+
+ static bool Format(const Entry &entry, Stream &s, const SymbolContext *sc,
+ const ExecutionContext *exe_ctx, const Address *addr,
+ ValueObject *valobj, bool function_changed,
+ bool initial_function);
+
+ static bool FormatStringRef(const llvm::StringRef &format, Stream &s,
+ const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ const Address *addr, ValueObject *valobj,
+ bool function_changed, bool initial_function);
+
+ static bool FormatCString(const char *format, Stream &s,
+ const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ const Address *addr, ValueObject *valobj,
+ bool function_changed, bool initial_function);
+
+ static Status Parse(const llvm::StringRef &format, Entry &entry);
+
+ static Status ExtractVariableInfo(llvm::StringRef &format_str,
+ llvm::StringRef &variable_name,
+ llvm::StringRef &variable_format);
+
+ static size_t AutoComplete(lldb_private::CompletionRequest &request);
+
+ // Format the current elements into the stream \a s.
+ //
+ // The root element will be stripped off and the format str passed in will be
+ // either an empty string (print a description of this object), or contain a
+ // `.`-separated series like a domain name that identifies further
+ // sub-elements to display.
+ static bool FormatFileSpec(const FileSpec &file, Stream &s,
+ llvm::StringRef elements,
+ llvm::StringRef element_format);
+
+protected:
+ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry,
+ uint32_t depth);
+};
+} // namespace lldb_private
+
+#endif // liblldb_FormatEntity_h_
diff --git a/linux-x64/clang/include/lldb/Core/Highlighter.h b/linux-x64/clang/include/lldb/Core/Highlighter.h
new file mode 100644
index 0000000..88d3bb3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Highlighter.h
@@ -0,0 +1,156 @@
+//===-- Highlighter.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Highlighter_h_
+#define liblldb_Highlighter_h_
+
+#include <utility>
+#include <vector>
+
+#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+/// Represents style that the highlighter should apply to the given source code.
+/// Stores information about how every kind of token should be annotated.
+struct HighlightStyle {
+
+ /// A pair of strings that should be placed around a certain token. Usually
+ /// stores color codes in these strings (the suffix string is often used for
+ /// resetting the terminal attributes back to normal).
+ class ColorStyle {
+ std::string m_prefix;
+ std::string m_suffix;
+
+ public:
+ ColorStyle() = default;
+ ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix) {
+ Set(prefix, suffix);
+ }
+
+ /// Applies this style to the given value.
+ /// \param s
+ /// The stream to which the result should be appended.
+ /// \param value
+ /// The value that we should place our strings around.
+ void Apply(Stream &s, llvm::StringRef value) const;
+
+ /// Sets the prefix and suffix strings.
+ /// \param prefix
+ /// \param suffix
+ void Set(llvm::StringRef prefix, llvm::StringRef suffix);
+ };
+
+ /// The style for the token which is below the cursor of the user. Note that
+ /// this style is overwritten by the SourceManager with the values of
+ /// stop-show-column-ansi-prefix/stop-show-column-ansi-suffix.
+ ColorStyle selected;
+
+ /// Matches identifiers to variable or functions.
+ ColorStyle identifier;
+ /// Matches any string or character literals in the language: "foo" or 'f'
+ ColorStyle string_literal;
+ /// Matches scalar value literals like '42' or '0.1'.
+ ColorStyle scalar_literal;
+ /// Matches all reserved keywords in the language.
+ ColorStyle keyword;
+ /// Matches any comments in the language.
+ ColorStyle comment;
+ /// Matches commas: ','
+ ColorStyle comma;
+ /// Matches one colon: ':'
+ ColorStyle colon;
+ /// Matches any semicolon: ';'
+ ColorStyle semicolons;
+ /// Matches operators like '+', '-', '%', '&', '='
+ ColorStyle operators;
+
+ /// Matches '{' or '}'
+ ColorStyle braces;
+ /// Matches '[' or ']'
+ ColorStyle square_brackets;
+ /// Matches '(' or ')'
+ ColorStyle parentheses;
+
+ // C language specific options
+
+ /// Matches directives to a preprocessor (if the language has any).
+ ColorStyle pp_directive;
+
+ /// Returns a HighlightStyle that is based on vim's default highlight style.
+ static HighlightStyle MakeVimStyle();
+};
+
+/// Annotates source code with color attributes.
+class Highlighter {
+public:
+ Highlighter() = default;
+ virtual ~Highlighter() = default;
+ DISALLOW_COPY_AND_ASSIGN(Highlighter);
+
+ /// Returns a human readable name for the selected highlighter.
+ virtual llvm::StringRef GetName() const = 0;
+
+ /// Highlights the given line
+ /// \param options
+ /// \param line
+ /// The user supplied line that needs to be highlighted.
+ /// \param cursor_pos
+ /// The cursor position of the user in this line, starting at 0 (which
+ /// means the cursor is on the first character in 'line').
+ /// \param previous_lines
+ /// Any previous lines the user has written which we should only use
+ /// for getting the context of the Highlighting right.
+ /// \param s
+ /// The stream to which the highlighted version of the user string should
+ /// be written.
+ virtual void Highlight(const HighlightStyle &options, llvm::StringRef line,
+ llvm::Optional<size_t> cursor_pos,
+ llvm::StringRef previous_lines, Stream &s) const = 0;
+
+ /// Utility method for calling Highlight without a stream.
+ std::string Highlight(const HighlightStyle &options, llvm::StringRef line,
+ llvm::Optional<size_t> cursor_pos,
+ llvm::StringRef previous_lines = "") const;
+};
+
+/// A default highlighter that only highlights the user cursor, but doesn't
+/// do any other highlighting.
+class DefaultHighlighter : public Highlighter {
+public:
+ llvm::StringRef GetName() const override { return "none"; }
+
+ void Highlight(const HighlightStyle &options, llvm::StringRef line,
+ llvm::Optional<size_t> cursor_pos,
+ llvm::StringRef previous_lines, Stream &s) const override;
+};
+
+/// Manages the available highlighters.
+class HighlighterManager {
+ DefaultHighlighter m_default;
+
+public:
+ /// Queries all known highlighter for one that can highlight some source code.
+ /// \param language_type
+ /// The language type that the caller thinks the source code was given in.
+ /// \param path
+ /// The path to the file the source code is from. Used as a fallback when
+ /// the user can't provide a language.
+ /// \return
+ /// The highlighter that wants to highlight the source code. Could be an
+ /// empty highlighter that does nothing.
+ const Highlighter &getHighlighterFor(lldb::LanguageType language_type,
+ llvm::StringRef path) const;
+ const Highlighter &getDefaultHighlighter() const { return m_default; }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Highlighter_h_
diff --git a/linux-x64/clang/include/lldb/Core/IOHandler.h b/linux-x64/clang/include/lldb/Core/IOHandler.h
new file mode 100644
index 0000000..b718067
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/IOHandler.h
@@ -0,0 +1,592 @@
+//===-- IOHandler.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_IOHandler_h_
+#define liblldb_IOHandler_h_
+
+#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/Predicate.h"
+#include "lldb/Utility/Reproducer.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include <stdint.h>
+#include <stdio.h>
+
+namespace lldb_private {
+class Debugger;
+}
+
+namespace curses {
+class Application;
+typedef std::unique_ptr<Application> ApplicationAP;
+} // namespace curses
+
+namespace lldb_private {
+
+class IOHandler {
+public:
+ enum class Type {
+ CommandInterpreter,
+ CommandList,
+ Confirm,
+ Curses,
+ Expression,
+ REPL,
+ ProcessIO,
+ PythonInterpreter,
+ PythonCode,
+ Other
+ };
+
+ IOHandler(Debugger &debugger, IOHandler::Type type);
+
+ IOHandler(Debugger &debugger, IOHandler::Type type,
+ const lldb::StreamFileSP &input_sp,
+ const lldb::StreamFileSP &output_sp,
+ const lldb::StreamFileSP &error_sp, uint32_t flags,
+ repro::DataRecorder *data_recorder);
+
+ virtual ~IOHandler();
+
+ // Each IOHandler gets to run until it is done. It should read data from the
+ // "in" and place output into "out" and "err and return when done.
+ virtual void Run() = 0;
+
+ // Called when an input reader should relinquish its control so another can
+ // be pushed onto the IO handler stack, or so the current IO handler can pop
+ // itself off the stack
+
+ virtual void Cancel() = 0;
+
+ // Called when CTRL+C is pressed which usually causes
+ // Debugger::DispatchInputInterrupt to be called.
+
+ virtual bool Interrupt() = 0;
+
+ virtual void GotEOF() = 0;
+
+ virtual bool IsActive() { return m_active && !m_done; }
+
+ virtual void SetIsDone(bool b) { m_done = b; }
+
+ virtual bool GetIsDone() { return m_done; }
+
+ Type GetType() const { return m_type; }
+
+ virtual void Activate() { m_active = true; }
+
+ virtual void Deactivate() { m_active = false; }
+
+ virtual const char *GetPrompt() {
+ // Prompt support isn't mandatory
+ return nullptr;
+ }
+
+ virtual bool SetPrompt(llvm::StringRef prompt) {
+ // Prompt support isn't mandatory
+ return false;
+ }
+ bool SetPrompt(const char *) = delete;
+
+ virtual ConstString GetControlSequence(char ch) { return ConstString(); }
+
+ virtual const char *GetCommandPrefix() { return nullptr; }
+
+ virtual const char *GetHelpPrologue() { return nullptr; }
+
+ int GetInputFD();
+
+ int GetOutputFD();
+
+ int GetErrorFD();
+
+ FILE *GetInputFILE();
+
+ FILE *GetOutputFILE();
+
+ FILE *GetErrorFILE();
+
+ lldb::StreamFileSP &GetInputStreamFile();
+
+ lldb::StreamFileSP &GetOutputStreamFile();
+
+ lldb::StreamFileSP &GetErrorStreamFile();
+
+ Debugger &GetDebugger() { return m_debugger; }
+
+ void *GetUserData() { return m_user_data; }
+
+ void SetUserData(void *user_data) { m_user_data = user_data; }
+
+ Flags &GetFlags() { return m_flags; }
+
+ const Flags &GetFlags() const { return m_flags; }
+
+ /// Check if the input is being supplied interactively by a user
+ ///
+ /// This will return true if the input stream is a terminal (tty or
+ /// pty) and can cause IO handlers to do different things (like
+ /// for a confirmation when deleting all breakpoints).
+ bool GetIsInteractive();
+
+ /// Check if the input is coming from a real terminal.
+ ///
+ /// A real terminal has a valid size with a certain number of rows
+ /// and columns. If this function returns true, then terminal escape
+ /// sequences are expected to work (cursor movement escape sequences,
+ /// clearing lines, etc).
+ bool GetIsRealTerminal();
+
+ void SetPopped(bool b);
+
+ void WaitForPop();
+
+ virtual void PrintAsync(Stream *stream, const char *s, size_t len) {
+ stream->Write(s, len);
+ stream->Flush();
+ }
+
+protected:
+ Debugger &m_debugger;
+ lldb::StreamFileSP m_input_sp;
+ lldb::StreamFileSP m_output_sp;
+ lldb::StreamFileSP m_error_sp;
+ repro::DataRecorder *m_data_recorder;
+ Predicate<bool> m_popped;
+ Flags m_flags;
+ Type m_type;
+ void *m_user_data;
+ bool m_done;
+ bool m_active;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(IOHandler);
+};
+
+/// A delegate class for use with IOHandler subclasses.
+///
+/// The IOHandler delegate is designed to be mixed into classes so
+/// they can use an IOHandler subclass to fetch input and notify the
+/// object that inherits from this delegate class when a token is
+/// received.
+class IOHandlerDelegate {
+public:
+ enum class Completion { None, LLDBCommand, Expression };
+
+ IOHandlerDelegate(Completion completion = Completion::None)
+ : m_completion(completion) {}
+
+ virtual ~IOHandlerDelegate() = default;
+
+ virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {}
+
+ virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
+
+ virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
+ const char *cursor, const char *last_char,
+ int skip_first_n_matches, int max_matches,
+ StringList &matches, StringList &descriptions);
+
+ virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
+
+ /// Called when a new line is created or one of an identified set of
+ /// indentation characters is typed.
+ ///
+ /// This function determines how much indentation should be added
+ /// or removed to match the recommended amount for the final line.
+ ///
+ /// \param[in] io_handler
+ /// The IOHandler that responsible for input.
+ ///
+ /// \param[in] lines
+ /// The current input up to the line to be corrected. Lines
+ /// following the line containing the cursor are not included.
+ ///
+ /// \param[in] cursor_position
+ /// The number of characters preceding the cursor on the final
+ /// line at the time.
+ ///
+ /// \return
+ /// Returns an integer describing the number of spaces needed
+ /// to correct the indentation level. Positive values indicate
+ /// that spaces should be added, while negative values represent
+ /// spaces that should be removed.
+ virtual int IOHandlerFixIndentation(IOHandler &io_handler,
+ const StringList &lines,
+ int cursor_position) {
+ return 0;
+ }
+
+ /// Called when a line or lines have been retrieved.
+ ///
+ /// This function can handle the current line and possibly call
+ /// IOHandler::SetIsDone(true) when the IO handler is done like when
+ /// "quit" is entered as a command, of when an empty line is
+ /// received. It is up to the delegate to determine when a line
+ /// should cause a IOHandler to exit.
+ virtual void IOHandlerInputComplete(IOHandler &io_handler,
+ std::string &data) = 0;
+
+ virtual void IOHandlerInputInterrupted(IOHandler &io_handler,
+ std::string &data) {}
+
+ /// Called to determine whether typing enter after the last line in
+ /// \a lines should end input. This function will not be called on
+ /// IOHandler objects that are getting single lines.
+ /// \param[in] io_handler
+ /// The IOHandler that responsible for updating the lines.
+ ///
+ /// \param[in] lines
+ /// The current multi-line content. May be altered to provide
+ /// alternative input when complete.
+ ///
+ /// \return
+ /// Return an boolean to indicate whether input is complete,
+ /// true indicates that no additional input is necessary, while
+ /// false indicates that more input is required.
+ virtual bool IOHandlerIsInputComplete(IOHandler &io_handler,
+ StringList &lines) {
+ // Impose no requirements for input to be considered complete. subclasses
+ // should do something more intelligent.
+ return true;
+ }
+
+ virtual ConstString IOHandlerGetControlSequence(char ch) {
+ return ConstString();
+ }
+
+ virtual const char *IOHandlerGetCommandPrefix() { return nullptr; }
+
+ virtual const char *IOHandlerGetHelpPrologue() { return nullptr; }
+
+ // Intercept the IOHandler::Interrupt() calls and do something.
+ //
+ // Return true if the interrupt was handled, false if the IOHandler should
+ // continue to try handle the interrupt itself.
+ virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; }
+
+protected:
+ Completion m_completion; // Support for common builtin completions
+};
+
+// IOHandlerDelegateMultiline
+//
+// A IOHandlerDelegate that handles terminating multi-line input when
+// the last line is equal to "end_line" which is specified in the constructor.
+class IOHandlerDelegateMultiline : public IOHandlerDelegate {
+public:
+ IOHandlerDelegateMultiline(const char *end_line,
+ Completion completion = Completion::None)
+ : IOHandlerDelegate(completion),
+ m_end_line((end_line && end_line[0]) ? end_line : "") {}
+
+ ~IOHandlerDelegateMultiline() override = default;
+
+ ConstString IOHandlerGetControlSequence(char ch) override {
+ if (ch == 'd')
+ return ConstString(m_end_line + "\n");
+ return ConstString();
+ }
+
+ bool IOHandlerIsInputComplete(IOHandler &io_handler,
+ StringList &lines) override {
+ // Determine whether the end of input signal has been entered
+ const size_t num_lines = lines.GetSize();
+ if (num_lines > 0 && lines[num_lines - 1] == m_end_line) {
+ // Remove the terminal line from "lines" so it doesn't appear in the
+ // resulting input and return true to indicate we are done getting lines
+ lines.PopBack();
+ return true;
+ }
+ return false;
+ }
+
+protected:
+ const std::string m_end_line;
+};
+
+class IOHandlerEditline : public IOHandler {
+public:
+ IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
+ const char *editline_name, // Used for saving history files
+ llvm::StringRef prompt, llvm::StringRef continuation_prompt,
+ bool multi_line, bool color_prompts,
+ uint32_t line_number_start, // If non-zero show line numbers
+ // starting at
+ // 'line_number_start'
+ IOHandlerDelegate &delegate,
+ repro::DataRecorder *data_recorder);
+
+ IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
+ const lldb::StreamFileSP &input_sp,
+ const lldb::StreamFileSP &output_sp,
+ const lldb::StreamFileSP &error_sp, uint32_t flags,
+ const char *editline_name, // Used for saving history files
+ llvm::StringRef prompt, llvm::StringRef continuation_prompt,
+ bool multi_line, bool color_prompts,
+ uint32_t line_number_start, // If non-zero show line numbers
+ // starting at
+ // 'line_number_start'
+ IOHandlerDelegate &delegate,
+ repro::DataRecorder *data_recorder);
+
+ IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *,
+ const char *, bool, bool, uint32_t,
+ IOHandlerDelegate &) = delete;
+
+ IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &,
+ const lldb::StreamFileSP &, const lldb::StreamFileSP &,
+ uint32_t, const char *, const char *, const char *, bool,
+ bool, uint32_t, IOHandlerDelegate &) = delete;
+
+ ~IOHandlerEditline() override;
+
+ void Run() override;
+
+ void Cancel() override;
+
+ bool Interrupt() override;
+
+ void GotEOF() override;
+
+ void Activate() override;
+
+ void Deactivate() override;
+
+ ConstString GetControlSequence(char ch) override {
+ return m_delegate.IOHandlerGetControlSequence(ch);
+ }
+
+ const char *GetCommandPrefix() override {
+ return m_delegate.IOHandlerGetCommandPrefix();
+ }
+
+ const char *GetHelpPrologue() override {
+ return m_delegate.IOHandlerGetHelpPrologue();
+ }
+
+ const char *GetPrompt() override;
+
+ bool SetPrompt(llvm::StringRef prompt) override;
+ bool SetPrompt(const char *prompt) = delete;
+
+ const char *GetContinuationPrompt();
+
+ void SetContinuationPrompt(llvm::StringRef prompt);
+ void SetContinuationPrompt(const char *) = delete;
+
+ bool GetLine(std::string &line, bool &interrupted);
+
+ bool GetLines(StringList &lines, bool &interrupted);
+
+ void SetBaseLineNumber(uint32_t line);
+
+ bool GetInterruptExits() { return m_interrupt_exits; }
+
+ void SetInterruptExits(bool b) { m_interrupt_exits = b; }
+
+ const StringList *GetCurrentLines() const { return m_current_lines_ptr; }
+
+ uint32_t GetCurrentLineIndex() const;
+
+ void PrintAsync(Stream *stream, const char *s, size_t len) override;
+
+private:
+#ifndef LLDB_DISABLE_LIBEDIT
+ static bool IsInputCompleteCallback(Editline *editline, StringList &lines,
+ void *baton);
+
+ static int FixIndentationCallback(Editline *editline, const StringList &lines,
+ int cursor_position, void *baton);
+
+ static int AutoCompleteCallback(const char *current_line, const char *cursor,
+ const char *last_char,
+ int skip_first_n_matches, int max_matches,
+ StringList &matches, StringList &descriptions,
+ void *baton);
+#endif
+
+protected:
+#ifndef LLDB_DISABLE_LIBEDIT
+ std::unique_ptr<Editline> m_editline_up;
+#endif
+ IOHandlerDelegate &m_delegate;
+ std::string m_prompt;
+ std::string m_continuation_prompt;
+ StringList *m_current_lines_ptr;
+ uint32_t m_base_line_number; // If non-zero, then show line numbers in prompt
+ uint32_t m_curr_line_idx;
+ bool m_multi_line;
+ bool m_color_prompts;
+ bool m_interrupt_exits;
+ bool m_editing; // Set to true when fetching a line manually (not using
+ // libedit)
+};
+
+// The order of base classes is important. Look at the constructor of
+// IOHandlerConfirm to see how.
+class IOHandlerConfirm : public IOHandlerDelegate, public IOHandlerEditline {
+public:
+ IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt,
+ bool default_response);
+
+ ~IOHandlerConfirm() override;
+
+ bool GetResponse() const { return m_user_response; }
+
+ int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
+ const char *cursor, const char *last_char,
+ int skip_first_n_matches, int max_matches,
+ StringList &matches, StringList &descriptions) override;
+
+ void IOHandlerInputComplete(IOHandler &io_handler,
+ std::string &data) override;
+
+protected:
+ const bool m_default_response;
+ bool m_user_response;
+};
+
+class IOHandlerCursesGUI : public IOHandler {
+public:
+ IOHandlerCursesGUI(Debugger &debugger);
+
+ ~IOHandlerCursesGUI() override;
+
+ void Run() override;
+
+ void Cancel() override;
+
+ bool Interrupt() override;
+
+ void GotEOF() override;
+
+ void Activate() override;
+
+ void Deactivate() override;
+
+protected:
+ curses::ApplicationAP m_app_ap;
+};
+
+class IOHandlerCursesValueObjectList : public IOHandler {
+public:
+ IOHandlerCursesValueObjectList(Debugger &debugger,
+ ValueObjectList &valobj_list);
+
+ ~IOHandlerCursesValueObjectList() override;
+
+ void Run() override;
+
+ void GotEOF() override;
+
+protected:
+ ValueObjectList m_valobj_list;
+};
+
+class IOHandlerStack {
+public:
+ IOHandlerStack() : m_stack(), m_mutex(), m_top(nullptr) {}
+
+ ~IOHandlerStack() = default;
+
+ size_t GetSize() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_stack.size();
+ }
+
+ void Push(const lldb::IOHandlerSP &sp) {
+ if (sp) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ sp->SetPopped(false);
+ m_stack.push_back(sp);
+ // Set m_top the non-locking IsTop() call
+ m_top = sp.get();
+ }
+ }
+
+ bool IsEmpty() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_stack.empty();
+ }
+
+ lldb::IOHandlerSP Top() {
+ lldb::IOHandlerSP sp;
+ {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (!m_stack.empty())
+ sp = m_stack.back();
+ }
+ return sp;
+ }
+
+ void Pop() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (!m_stack.empty()) {
+ lldb::IOHandlerSP sp(m_stack.back());
+ m_stack.pop_back();
+ sp->SetPopped(true);
+ }
+ // Set m_top the non-locking IsTop() call
+
+ m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
+ }
+
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+
+ bool IsTop(const lldb::IOHandlerSP &io_handler_sp) const {
+ return m_top == io_handler_sp.get();
+ }
+
+ bool CheckTopIOHandlerTypes(IOHandler::Type top_type,
+ IOHandler::Type second_top_type) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ const size_t num_io_handlers = m_stack.size();
+ return (num_io_handlers >= 2 &&
+ m_stack[num_io_handlers - 1]->GetType() == top_type &&
+ m_stack[num_io_handlers - 2]->GetType() == second_top_type);
+ }
+
+ ConstString GetTopIOHandlerControlSequence(char ch) {
+ return ((m_top != nullptr) ? m_top->GetControlSequence(ch) : ConstString());
+ }
+
+ const char *GetTopIOHandlerCommandPrefix() {
+ return ((m_top != nullptr) ? m_top->GetCommandPrefix() : nullptr);
+ }
+
+ const char *GetTopIOHandlerHelpPrologue() {
+ return ((m_top != nullptr) ? m_top->GetHelpPrologue() : nullptr);
+ }
+
+ void PrintAsync(Stream *stream, const char *s, size_t len);
+
+protected:
+ typedef std::vector<lldb::IOHandlerSP> collection;
+ collection m_stack;
+ mutable std::recursive_mutex m_mutex;
+ IOHandler *m_top;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(IOHandlerStack);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_IOHandler_h_
diff --git a/linux-x64/clang/include/lldb/Core/IOStreamMacros.h b/linux-x64/clang/include/lldb/Core/IOStreamMacros.h
new file mode 100644
index 0000000..45bde88
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/IOStreamMacros.h
@@ -0,0 +1,41 @@
+//===-- IOStreamMacros.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_IOStreamMacros_h_
+#define liblldb_IOStreamMacros_h_
+#if defined(__cplusplus)
+
+#include <iomanip>
+
+#define RAW_HEXBASE std::setfill('0') << std::hex << std::right
+#define HEXBASE '0' << 'x' << RAW_HEXBASE
+#define RAWHEX8(x) RAW_HEXBASE << std::setw(2) << ((uint32_t)(x))
+#define RAWHEX16 RAW_HEXBASE << std::setw(4)
+#define RAWHEX32 RAW_HEXBASE << std::setw(8)
+#define RAWHEX64 RAW_HEXBASE << std::setw(16)
+#define HEX8(x) HEXBASE << std::setw(2) << ((uint32_t)(x))
+#define HEX16 HEXBASE << std::setw(4)
+#define HEX32 HEXBASE << std::setw(8)
+#define HEX64 HEXBASE << std::setw(16)
+#define RAW_HEX(x) RAW_HEXBASE << std::setw(sizeof(x) * 2) << (x)
+#define HEX(x) HEXBASE << std::setw(sizeof(x) * 2) << (x)
+#define HEX_SIZE(x, sz) HEXBASE << std::setw((sz)) << (x)
+#define STRING_WIDTH(w) std::setfill(' ') << std::setw(w)
+#define LEFT_STRING_WIDTH(s, w) \
+ std::left << std::setfill(' ') << std::setw(w) << (s) << std::right
+#define DECIMAL std::dec << std::setfill(' ')
+#define DECIMAL_WIDTH(w) DECIMAL << std::setw(w)
+//#define FLOAT(n, d) std::setfill(' ') << std::setw((n)+(d)+1) <<
+//std::setprecision(d) << std::showpoint << std::fixed
+#define INDENT_WITH_SPACES(iword_idx) \
+ std::setfill(' ') << std::setw((iword_idx)) << ""
+#define INDENT_WITH_TABS(iword_idx) \
+ std::setfill('\t') << std::setw((iword_idx)) << ""
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_IOStreamMacros_h_
diff --git a/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h b/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h
new file mode 100644
index 0000000..f7f8360
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h
@@ -0,0 +1,119 @@
+//===-- LoadedModuleInfoList.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LoadedModuleInfoList_h_
+#define liblldb_LoadedModuleInfoList_h_
+
+
+#include <cassert>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+class LoadedModuleInfoList {
+public:
+ class LoadedModuleInfo {
+ public:
+ enum e_data_point {
+ e_has_name = 0,
+ e_has_base,
+ e_has_dynamic,
+ e_has_link_map,
+ e_num
+ };
+
+ LoadedModuleInfo() {
+ for (uint32_t i = 0; i < e_num; ++i)
+ m_has[i] = false;
+ };
+
+ void set_name(const std::string &name) {
+ m_name = name;
+ m_has[e_has_name] = true;
+ }
+ bool get_name(std::string &out) const {
+ out = m_name;
+ return m_has[e_has_name];
+ }
+
+ void set_base(const lldb::addr_t base) {
+ m_base = base;
+ m_has[e_has_base] = true;
+ }
+ bool get_base(lldb::addr_t &out) const {
+ out = m_base;
+ return m_has[e_has_base];
+ }
+
+ void set_base_is_offset(bool is_offset) { m_base_is_offset = is_offset; }
+ bool get_base_is_offset(bool &out) const {
+ out = m_base_is_offset;
+ return m_has[e_has_base];
+ }
+
+ void set_link_map(const lldb::addr_t addr) {
+ m_link_map = addr;
+ m_has[e_has_link_map] = true;
+ }
+ bool get_link_map(lldb::addr_t &out) const {
+ out = m_link_map;
+ return m_has[e_has_link_map];
+ }
+
+ void set_dynamic(const lldb::addr_t addr) {
+ m_dynamic = addr;
+ m_has[e_has_dynamic] = true;
+ }
+ bool get_dynamic(lldb::addr_t &out) const {
+ out = m_dynamic;
+ return m_has[e_has_dynamic];
+ }
+
+ bool has_info(e_data_point datum) const {
+ assert(datum < e_num);
+ return m_has[datum];
+ }
+
+ bool operator==(LoadedModuleInfo const &rhs) const {
+ if (e_num != rhs.e_num)
+ return false;
+
+ for (size_t i = 0; i < e_num; ++i) {
+ if (m_has[i] != rhs.m_has[i])
+ return false;
+ }
+
+ return (m_base == rhs.m_base) && (m_link_map == rhs.m_link_map) &&
+ (m_dynamic == rhs.m_dynamic) && (m_name == rhs.m_name);
+ }
+
+ protected:
+ bool m_has[e_num];
+ std::string m_name;
+ lldb::addr_t m_link_map;
+ lldb::addr_t m_base;
+ bool m_base_is_offset;
+ lldb::addr_t m_dynamic;
+ };
+
+ LoadedModuleInfoList() : m_list(), m_link_map(LLDB_INVALID_ADDRESS) {}
+
+ void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); }
+
+ void clear() { m_list.clear(); }
+
+ std::vector<LoadedModuleInfo> m_list;
+ lldb::addr_t m_link_map;
+};
+} // namespace lldb_private
+
+#endif // liblldb_LoadedModuleInfoList_h_
diff --git a/linux-x64/clang/include/lldb/Core/Mangled.h b/linux-x64/clang/include/lldb/Core/Mangled.h
new file mode 100644
index 0000000..fb52afd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Mangled.h
@@ -0,0 +1,296 @@
+//===-- Mangled.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Mangled_h_
+#define liblldb_Mangled_h_
+#if defined(__cplusplus)
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include "lldb/Utility/ConstString.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <memory>
+#include <stddef.h>
+
+namespace lldb_private {
+
+/// \class Mangled Mangled.h "lldb/Core/Mangled.h"
+/// A class that handles mangled names.
+///
+/// Designed to handle mangled names. The demangled version of any names will
+/// be computed when the demangled name is accessed through the Demangled()
+/// acccessor. This class can also tokenize the demangled version of the name
+/// for powerful searches. Functions and symbols could make instances of this
+/// class for their mangled names. Uniqued string pools are used for the
+/// mangled, demangled, and token string values to allow for faster
+/// comparisons and for efficient memory use.
+class Mangled {
+public:
+ enum NamePreference {
+ ePreferMangled,
+ ePreferDemangled,
+ ePreferDemangledWithoutArguments
+ };
+
+ enum ManglingScheme {
+ eManglingSchemeNone = 0,
+ eManglingSchemeMSVC,
+ eManglingSchemeItanium
+ };
+
+ /// Default constructor.
+ ///
+ /// Initialize with both mangled and demangled names empty.
+ Mangled();
+
+ /// Construct with name.
+ ///
+ /// Constructor with an optional string and a boolean indicating if it is
+ /// the mangled version.
+ ///
+ /// \param[in] name
+ /// The already const name to copy into this object.
+ ///
+ /// \param[in] is_mangled
+ /// If \b true then \a name is a mangled name, if \b false then
+ /// \a name is demangled.
+ Mangled(ConstString name, bool is_mangled);
+ Mangled(llvm::StringRef name, bool is_mangled);
+
+ /// Construct with name.
+ ///
+ /// Constructor with an optional string and auto-detect if \a name is
+ /// mangled or not.
+ ///
+ /// \param[in] name
+ /// The already const name to copy into this object.
+ explicit Mangled(ConstString name);
+
+ explicit Mangled(llvm::StringRef name);
+
+ /// Destructor
+ ///
+ /// Releases its ref counts on the mangled and demangled strings that live
+ /// in the global string pool.
+ ~Mangled();
+
+ /// Convert to pointer operator.
+ ///
+ /// This allows code to check a Mangled object to see if it contains a valid
+ /// mangled name using code such as:
+ ///
+ /// \code
+ /// Mangled mangled(...);
+ /// if (mangled)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// A pointer to this object if either the mangled or unmangled
+ /// name is set, NULL otherwise.
+ operator void *() const;
+
+ /// Logical NOT operator.
+ ///
+ /// This allows code to check a Mangled object to see if it contains an
+ /// empty mangled name using code such as:
+ ///
+ /// \code
+ /// Mangled mangled(...);
+ /// if (!mangled)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// Returns \b true if the object has an empty mangled and
+ /// unmangled name, \b false otherwise.
+ bool operator!() const;
+
+ /// Clear the mangled and demangled values.
+ void Clear();
+
+ /// Compare the mangled string values
+ ///
+ /// Compares the Mangled::GetName() string in \a lhs and \a rhs.
+ ///
+ /// \param[in] lhs
+ /// A const reference to the Left Hand Side object to compare.
+ ///
+ /// \param[in] rhs
+ /// A const reference to the Right Hand Side object to compare.
+ ///
+ /// \return
+ /// \li -1 if \a lhs is less than \a rhs
+ /// \li 0 if \a lhs is equal to \a rhs
+ /// \li 1 if \a lhs is greater than \a rhs
+ static int Compare(const Mangled &lhs, const Mangled &rhs);
+
+ /// Dump a description of this object to a Stream \a s.
+ ///
+ /// Dump a Mangled object to stream \a s. We don't force our demangled name
+ /// to be computed currently (we don't use the accessor).
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s) const;
+
+ /// Dump a debug description of this object to a Stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void DumpDebug(Stream *s) const;
+
+ /// Demangled name get accessor.
+ ///
+ /// \return
+ /// A const reference to the demangled name string object.
+ ConstString GetDemangledName(lldb::LanguageType language) const;
+
+ /// Display demangled name get accessor.
+ ///
+ /// \return
+ /// A const reference to the display demangled name string object.
+ ConstString GetDisplayDemangledName(lldb::LanguageType language) const;
+
+ void SetDemangledName(ConstString name) { m_demangled = name; }
+
+ void SetMangledName(ConstString name) { m_mangled = name; }
+
+ /// Mangled name get accessor.
+ ///
+ /// \return
+ /// A reference to the mangled name string object.
+ ConstString &GetMangledName() { return m_mangled; }
+
+ /// Mangled name get accessor.
+ ///
+ /// \return
+ /// A const reference to the mangled name string object.
+ ConstString GetMangledName() const { return m_mangled; }
+
+ /// Best name get accessor.
+ ///
+ /// \param[in] preference
+ /// Which name would you prefer to get?
+ ///
+ /// \return
+ /// A const reference to the preferred name string object if this
+ /// object has a valid name of that kind, else a const reference to the
+ /// other name is returned.
+ ConstString GetName(lldb::LanguageType language,
+ NamePreference preference = ePreferDemangled) const;
+
+ /// Check if "name" matches either the mangled or demangled name.
+ ///
+ /// \param[in] name
+ /// A name to match against both strings.
+ ///
+ /// \return
+ /// \b True if \a name matches either name, \b false otherwise.
+ bool NameMatches(ConstString name, lldb::LanguageType language) const {
+ if (m_mangled == name)
+ return true;
+ return GetDemangledName(language) == name;
+ }
+ bool NameMatches(const RegularExpression ®ex,
+ lldb::LanguageType language) const;
+
+ /// Get the memory cost of this object.
+ ///
+ /// Return the size in bytes that this object takes in memory. This returns
+ /// the size in bytes of this object, not any shared string values it may
+ /// refer to.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const;
+
+ /// Set the string value in this object.
+ ///
+ /// If \a is_mangled is \b true, then the mangled named is set to \a name,
+ /// else the demangled name is set to \a name.
+ ///
+ /// \param[in] name
+ /// The already const version of the name for this object.
+ ///
+ /// \param[in] is_mangled
+ /// If \b true then \a name is a mangled name, if \b false then
+ /// \a name is demangled.
+ void SetValue(ConstString name, bool is_mangled);
+
+ /// Set the string value in this object.
+ ///
+ /// This version auto detects if the string is mangled by inspecting the
+ /// string value and looking for common mangling prefixes.
+ ///
+ /// \param[in] name
+ /// The already const version of the name for this object.
+ void SetValue(ConstString name);
+
+ /// Try to guess the language from the mangling.
+ ///
+ /// For a mangled name to have a language it must have both a mangled and a
+ /// demangled name and it can be guessed from the mangling what the language
+ /// is. Note: this will return C++ for any language that uses Itanium ABI
+ /// mangling.
+ ///
+ /// Standard C function names will return eLanguageTypeUnknown because they
+ /// aren't mangled and it isn't clear what language the name represents
+ /// (there will be no mangled name).
+ ///
+ /// \return
+ /// The language for the mangled/demangled name, eLanguageTypeUnknown
+ /// if there is no mangled or demangled counterpart.
+ lldb::LanguageType GuessLanguage() const;
+
+ /// Function signature for filtering mangled names.
+ using SkipMangledNameFn = bool(llvm::StringRef, ManglingScheme);
+
+ /// Trigger explicit demangling to obtain rich mangling information. This is
+ /// optimized for batch processing while populating a name index. To get the
+ /// pure demangled name string for a single entity, use GetDemangledName()
+ /// instead.
+ ///
+ /// For names that match the Itanium mangling scheme, this uses LLVM's
+ /// ItaniumPartialDemangler. All other names fall back to LLDB's builtin
+ /// parser currently.
+ ///
+ /// This function is thread-safe when used with different \a context
+ /// instances in different threads.
+ ///
+ /// \param[in] context
+ /// The context for this function. A single instance can be stack-
+ /// allocated in the caller's frame and used for multiple calls.
+ ///
+ /// \param[in] skip_mangled_name
+ /// A filtering function for skipping entities based on name and mangling
+ /// scheme. This can be null if unused.
+ ///
+ /// \return
+ /// True on success, false otherwise.
+ bool DemangleWithRichManglingInfo(RichManglingContext &context,
+ SkipMangledNameFn *skip_mangled_name);
+
+private:
+ /// Mangled member variables.
+ ConstString m_mangled; ///< The mangled version of the name
+ mutable ConstString m_demangled; ///< Mutable so we can get it on demand with
+ ///a const version of this object
+};
+
+Stream &operator<<(Stream &s, const Mangled &obj);
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Mangled_h_
diff --git a/linux-x64/clang/include/lldb/Core/MappedHash.h b/linux-x64/clang/include/lldb/Core/MappedHash.h
new file mode 100644
index 0000000..7dc9b5b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/MappedHash.h
@@ -0,0 +1,310 @@
+//===-- MappedHash.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_MappedHash_h_
+#define liblldb_MappedHash_h_
+
+#include <assert.h>
+#include <stdint.h>
+
+#include <algorithm>
+#include <functional>
+#include <map>
+#include <vector>
+
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Stream.h"
+#include "llvm/Support/DJB.h"
+
+class MappedHash {
+public:
+ enum HashFunctionType {
+ eHashFunctionDJB = 0u // Daniel J Bernstein hash function that is also used
+ // by the ELF GNU_HASH sections
+ };
+
+ static uint32_t HashString(uint32_t hash_function, llvm::StringRef s) {
+ switch (hash_function) {
+ case MappedHash::eHashFunctionDJB:
+ return llvm::djbHash(s);
+
+ default:
+ break;
+ }
+ llvm_unreachable("Invalid hash function index");
+ }
+
+ static const uint32_t HASH_MAGIC = 0x48415348u;
+ static const uint32_t HASH_CIGAM = 0x48534148u;
+
+ template <typename T> struct Header {
+ typedef T HeaderData;
+
+ uint32_t
+ magic; // HASH_MAGIC or HASH_CIGAM magic value to allow endian detection
+ uint16_t version; // Version number
+ uint16_t hash_function; // The hash function enumeration that was used
+ uint32_t bucket_count; // The number of buckets in this hash table
+ uint32_t hashes_count; // The total number of unique hash values and hash
+ // data offsets in this table
+ uint32_t header_data_len; // The size in bytes of the "header_data" template
+ // member below
+ HeaderData header_data; //
+
+ Header()
+ : magic(HASH_MAGIC), version(1), hash_function(eHashFunctionDJB),
+ bucket_count(0), hashes_count(0), header_data_len(sizeof(T)),
+ header_data() {}
+
+ virtual ~Header() = default;
+
+ size_t GetByteSize() const {
+ return sizeof(magic) + sizeof(version) + sizeof(hash_function) +
+ sizeof(bucket_count) + sizeof(hashes_count) +
+ sizeof(header_data_len) + header_data_len;
+ }
+
+ virtual size_t GetByteSize(const HeaderData &header_data) = 0;
+
+ void SetHeaderDataByteSize(uint32_t header_data_byte_size) {
+ header_data_len = header_data_byte_size;
+ }
+
+ void Dump(lldb_private::Stream &s) {
+ s.Printf("header.magic = 0x%8.8x\n", magic);
+ s.Printf("header.version = 0x%4.4x\n", version);
+ s.Printf("header.hash_function = 0x%4.4x\n", hash_function);
+ s.Printf("header.bucket_count = 0x%8.8x %u\n", bucket_count,
+ bucket_count);
+ s.Printf("header.hashes_count = 0x%8.8x %u\n", hashes_count,
+ hashes_count);
+ s.Printf("header.header_data_len = 0x%8.8x %u\n", header_data_len,
+ header_data_len);
+ }
+
+ virtual lldb::offset_t Read(lldb_private::DataExtractor &data,
+ lldb::offset_t offset) {
+ if (data.ValidOffsetForDataOfSize(
+ offset, sizeof(magic) + sizeof(version) + sizeof(hash_function) +
+ sizeof(bucket_count) + sizeof(hashes_count) +
+ sizeof(header_data_len))) {
+ magic = data.GetU32(&offset);
+ if (magic != HASH_MAGIC) {
+ if (magic == HASH_CIGAM) {
+ switch (data.GetByteOrder()) {
+ case lldb::eByteOrderBig:
+ data.SetByteOrder(lldb::eByteOrderLittle);
+ break;
+ case lldb::eByteOrderLittle:
+ data.SetByteOrder(lldb::eByteOrderBig);
+ break;
+ default:
+ return LLDB_INVALID_OFFSET;
+ }
+ } else {
+ // Magic bytes didn't match
+ version = 0;
+ return LLDB_INVALID_OFFSET;
+ }
+ }
+
+ version = data.GetU16(&offset);
+ if (version != 1) {
+ // Unsupported version
+ return LLDB_INVALID_OFFSET;
+ }
+ hash_function = data.GetU16(&offset);
+ if (hash_function == 4)
+ hash_function = 0; // Deal with pre-release version of this table...
+ bucket_count = data.GetU32(&offset);
+ hashes_count = data.GetU32(&offset);
+ header_data_len = data.GetU32(&offset);
+ return offset;
+ }
+ return LLDB_INVALID_OFFSET;
+ }
+ //
+ // // Returns a buffer that contains a serialized version of this
+ // table
+ // // that must be freed with free().
+ // virtual void *
+ // Write (int fd);
+ };
+
+ // A class for reading and using a saved hash table from a block of data
+ // in memory
+ template <typename __KeyType, class __HeaderType, class __HashData>
+ class MemoryTable {
+ public:
+ typedef __HeaderType HeaderType;
+ typedef __KeyType KeyType;
+ typedef __HashData HashData;
+
+ enum Result {
+ eResultKeyMatch = 0u, // The entry was found, key matched and "pair" was
+ // filled in successfully
+ eResultKeyMismatch =
+ 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 // Status parsing the hash data, abort
+ };
+
+ struct Pair {
+ KeyType key;
+ HashData value;
+ };
+
+ MemoryTable(lldb_private::DataExtractor &data)
+ : m_header(), m_hash_indexes(nullptr), m_hash_values(nullptr),
+ m_hash_offsets(nullptr) {
+ lldb::offset_t offset = m_header.Read(data, 0);
+ if (offset != LLDB_INVALID_OFFSET && IsValid()) {
+ m_hash_indexes = (const uint32_t *)data.GetData(
+ &offset, m_header.bucket_count * sizeof(uint32_t));
+ m_hash_values = (const uint32_t *)data.GetData(
+ &offset, m_header.hashes_count * sizeof(uint32_t));
+ m_hash_offsets = (const uint32_t *)data.GetData(
+ &offset, m_header.hashes_count * sizeof(uint32_t));
+ }
+ }
+
+ virtual ~MemoryTable() = default;
+
+ bool IsValid() const {
+ return m_header.version == 1 &&
+ m_header.hash_function == eHashFunctionDJB &&
+ m_header.bucket_count > 0;
+ }
+
+ uint32_t GetHashIndex(uint32_t bucket_idx) const {
+ uint32_t result = UINT32_MAX;
+ if (m_hash_indexes && bucket_idx < m_header.bucket_count)
+ memcpy(&result, m_hash_indexes + bucket_idx, sizeof(uint32_t));
+ return result;
+ }
+
+ uint32_t GetHashValue(uint32_t hash_idx) const {
+ uint32_t result = UINT32_MAX;
+ if (m_hash_values && hash_idx < m_header.hashes_count)
+ memcpy(&result, m_hash_values + hash_idx, sizeof(uint32_t));
+ return result;
+ }
+
+ uint32_t GetHashDataOffset(uint32_t hash_idx) const {
+ uint32_t result = UINT32_MAX;
+ if (m_hash_offsets && hash_idx < m_header.hashes_count)
+ memcpy(&result, m_hash_offsets + hash_idx, sizeof(uint32_t));
+ return result;
+ }
+
+ bool Find(llvm::StringRef name, Pair &pair) const {
+ if (name.empty())
+ return false;
+
+ if (IsValid()) {
+ const uint32_t bucket_count = m_header.bucket_count;
+ const uint32_t hash_count = m_header.hashes_count;
+ const uint32_t hash_value =
+ MappedHash::HashString(m_header.hash_function, name);
+ const uint32_t bucket_idx = hash_value % bucket_count;
+ uint32_t hash_idx = GetHashIndex(bucket_idx);
+ if (hash_idx < hash_count) {
+ for (; hash_idx < hash_count; ++hash_idx) {
+ const uint32_t curr_hash_value = GetHashValue(hash_idx);
+ if (curr_hash_value == hash_value) {
+ lldb::offset_t hash_data_offset = GetHashDataOffset(hash_idx);
+ while (hash_data_offset != UINT32_MAX) {
+ const lldb::offset_t prev_hash_data_offset = hash_data_offset;
+ Result hash_result =
+ GetHashDataForName(name, &hash_data_offset, pair);
+ // Check the result of getting our hash data
+ switch (hash_result) {
+ case eResultKeyMatch:
+ return true;
+
+ case eResultKeyMismatch:
+ if (prev_hash_data_offset == hash_data_offset)
+ return false;
+ break;
+
+ case eResultEndOfHashData:
+ // The last HashData for this key has been reached, stop
+ // searching
+ return false;
+ case eResultError:
+ // Status parsing the hash data, abort
+ return false;
+ }
+ }
+ }
+ if ((curr_hash_value % bucket_count) != bucket_idx)
+ break;
+ }
+ }
+ }
+ return false;
+ }
+
+ // This method must be implemented in any subclasses. The KeyType is user
+ // specified and must somehow result in a string value. For example, the
+ // KeyType might be a string offset in a string table and subclasses can
+ // store their string table as a member of the subclass and return a valie
+ // "const char *" given a "key". The value could also be a C string
+ // pointer, in which case just returning "key" will suffice.
+ virtual const char *GetStringForKeyType(KeyType key) const = 0;
+
+ virtual bool ReadHashData(uint32_t hash_data_offset,
+ HashData &hash_data) const = 0;
+
+ // This method must be implemented in any subclasses and it must try to
+ // read one "Pair" at the offset pointed to by the "hash_data_offset_ptr"
+ // parameter. This offset should be updated as bytes are consumed and a
+ // value "Result" enum should be returned. If the "name" matches the full
+ // name for the "pair.key" (which must be filled in by this call), then the
+ // HashData in the pair ("pair.value") should be extracted and filled in
+ // and "eResultKeyMatch" should be returned. If "name" doesn't match this
+ // string for the key, then "eResultKeyMismatch" should be returned and all
+ // data for the current HashData must be consumed or skipped and the
+ // "hash_data_offset_ptr" offset needs to be updated to point to the next
+ // HashData. If the end of the HashData objects for a given hash value have
+ // been reached, then "eResultEndOfHashData" should be returned. If
+ // anything else goes wrong during parsing, return "eResultError" and the
+ // corresponding "Find()" function will be canceled and return false.
+ virtual Result GetHashDataForName(llvm::StringRef name,
+ lldb::offset_t *hash_data_offset_ptr,
+ Pair &pair) const = 0;
+
+ const HeaderType &GetHeader() { return m_header; }
+
+ void ForEach(
+ std::function<bool(const HashData &hash_data)> const &callback) const {
+ const size_t num_hash_offsets = m_header.hashes_count;
+ for (size_t i = 0; i < num_hash_offsets; ++i) {
+ uint32_t hash_data_offset = GetHashDataOffset(i);
+ if (hash_data_offset != UINT32_MAX) {
+ HashData hash_data;
+ if (ReadHashData(hash_data_offset, hash_data)) {
+ // If the callback returns false, then we are done and should stop
+ if (callback(hash_data) == false)
+ return;
+ }
+ }
+ }
+ }
+
+ protected:
+ // Implementation agnostic information
+ HeaderType m_header;
+ const uint32_t *m_hash_indexes;
+ const uint32_t *m_hash_values;
+ const uint32_t *m_hash_offsets;
+ };
+};
+
+#endif // liblldb_MappedHash_h_
diff --git a/linux-x64/clang/include/lldb/Core/Module.h b/linux-x64/clang/include/lldb/Core/Module.h
new file mode 100644
index 0000000..544895e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Module.h
@@ -0,0 +1,1086 @@
+//===-- Module.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Module_h_
+#define liblldb_Module_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Chrono.h"
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+class CompilerDeclContext;
+class Function;
+class Log;
+class ObjectFile;
+class RegularExpression;
+class SectionList;
+class Stream;
+class Symbol;
+class SymbolContext;
+class SymbolContextList;
+class SymbolFile;
+class SymbolVendor;
+class Symtab;
+class Target;
+class TypeList;
+class TypeMap;
+class VariableList;
+
+/// \class Module Module.h "lldb/Core/Module.h"
+/// A class that describes an executable image and its associated
+/// object and symbol files.
+///
+/// The module is designed to be able to select a single slice of an
+/// executable image as it would appear on disk and during program execution.
+///
+/// Modules control when and if information is parsed according to which
+/// accessors are called. For example the object file (ObjectFile)
+/// representation will only be parsed if the object file is requested using
+/// the Module::GetObjectFile() is called. The debug symbols will only be
+/// parsed if the symbol vendor (SymbolVendor) is requested using the
+/// Module::GetSymbolVendor() is called.
+///
+/// The module will parse more detailed information as more queries are made.
+class Module : public std::enable_shared_from_this<Module>,
+ public SymbolContextScope {
+public:
+ // Static functions that can track the lifetime of module objects. This is
+ // handy because we might have Module objects that are in shared pointers
+ // that aren't in the global module list (from ModuleList). If this is the
+ // case we need to know about it. The modules in the global list maintained
+ // by these functions can be viewed using the "target modules list" command
+ // using the "--global" (-g for short).
+ static size_t GetNumberAllocatedModules();
+
+ static Module *GetAllocatedModuleAtIndex(size_t idx);
+
+ static std::recursive_mutex &GetAllocationModuleCollectionMutex();
+
+ /// Construct with file specification and architecture.
+ ///
+ /// Clients that wish to share modules with other targets should use
+ /// ModuleList::GetSharedModule().
+ ///
+ /// \param[in] file_spec
+ /// The file specification for the on disk representation of
+ /// this executable image.
+ ///
+ /// \param[in] arch
+ /// The architecture to set as the current architecture in
+ /// this module.
+ ///
+ /// \param[in] object_name
+ /// The name of an object in a module used to extract a module
+ /// within a module (.a files and modules that contain multiple
+ /// architectures).
+ ///
+ /// \param[in] object_offset
+ /// The offset within an existing module used to extract a
+ /// module within a module (.a files and modules that contain
+ /// multiple architectures).
+ Module(
+ const FileSpec &file_spec, const ArchSpec &arch,
+ const ConstString *object_name = nullptr,
+ lldb::offset_t object_offset = 0,
+ const llvm::sys::TimePoint<> &object_mod_time = llvm::sys::TimePoint<>());
+
+ Module(const ModuleSpec &module_spec);
+
+ template <typename ObjFilePlugin, typename... Args>
+ static lldb::ModuleSP CreateModuleFromObjectFile(Args &&... args) {
+ // Must create a module and place it into a shared pointer before we can
+ // create an object file since it has a std::weak_ptr back to the module,
+ // so we need to control the creation carefully in this static function
+ lldb::ModuleSP module_sp(new Module());
+ module_sp->m_objfile_sp =
+ std::make_shared<ObjFilePlugin>(module_sp, std::forward<Args>(args)...);
+ module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed);
+
+ // Once we get the object file, set module ArchSpec to the one we get from
+ // the object file. If the object file does not have an architecture, we
+ // consider the creation a failure.
+ ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture();
+ if (!arch)
+ return nullptr;
+ module_sp->m_arch = arch;
+
+ // Also copy the object file's FileSpec.
+ module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec();
+ return module_sp;
+ }
+
+ /// Destructor.
+ ~Module() override;
+
+ bool MatchesModuleSpec(const ModuleSpec &module_ref);
+
+ /// Set the load address for all sections in a module to be the file address
+ /// plus \a slide.
+ ///
+ /// Many times a module will be loaded in a target with a constant offset
+ /// applied to all top level sections. This function can set the load
+ /// address for all top level sections to be the section file address +
+ /// offset.
+ ///
+ /// \param[in] target
+ /// The target in which to apply the section load addresses.
+ ///
+ /// \param[in] value
+ /// if \a value_is_offset is true, then value is the offset to
+ /// apply to all file addresses for all top level sections in
+ /// the object file as each section load address is being set.
+ /// If \a value_is_offset is false, then "value" is the new
+ /// absolute base address for the image.
+ ///
+ /// \param[in] value_is_offset
+ /// If \b true, then \a value is an offset to apply to each
+ /// file address of each top level section.
+ /// If \b false, then \a value is the image base address that
+ /// will be used to rigidly slide all loadable sections.
+ ///
+ /// \param[out] changed
+ /// If any section load addresses were changed in \a target,
+ /// then \a changed will be set to \b true. Else \a changed
+ /// will be set to false. This allows this function to be
+ /// called multiple times on the same module for the same
+ /// target. If the module hasn't moved, then \a changed will
+ /// be false and no module updated notification will need to
+ /// be sent out.
+ ///
+ /// \return
+ /// /b True if any sections were successfully loaded in \a target,
+ /// /b false otherwise.
+ bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
+ bool &changed);
+
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// \see SymbolContextScope
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
+
+ /// Get the module path and object name.
+ ///
+ /// Modules can refer to object files. In this case the specification is
+ /// simple and would return the path to the file:
+ ///
+ /// "/usr/lib/foo.dylib"
+ ///
+ /// Modules can be .o files inside of a BSD archive (.a file). In this case,
+ /// the object specification will look like:
+ ///
+ /// "/usr/lib/foo.a(bar.o)"
+ ///
+ /// There are many places where logging wants to log this fully qualified
+ /// specification, so we centralize this functionality here.
+ ///
+ /// \return
+ /// The object path + object name if there is one.
+ std::string GetSpecificationDescription() const;
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s. The dumped content will be only what has been loaded or parsed up
+ /// to this point at which this function is called, so this is a good way to
+ /// see what has been parsed in a module.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s);
+
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// \see SymbolContextScope
+ void DumpSymbolContext(Stream *s) override;
+
+ /// Find a symbol in the object file's symbol table.
+ ///
+ /// \param[in] name
+ /// The name of the symbol that we are looking for.
+ ///
+ /// \param[in] symbol_type
+ /// If set to eSymbolTypeAny, find a symbol of any type that
+ /// has a name that matches \a name. If set to any other valid
+ /// SymbolType enumeration value, then search only for
+ /// symbols that match \a symbol_type.
+ ///
+ /// \return
+ /// Returns a valid symbol pointer if a symbol was found,
+ /// nullptr otherwise.
+ const Symbol *FindFirstSymbolWithNameAndType(
+ ConstString name,
+ lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
+
+ size_t FindSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
+
+ size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
+
+ /// Find a function symbols in the object file's symbol table.
+ ///
+ /// \param[in] name
+ /// The name of the symbol that we are looking for.
+ ///
+ /// \param[in] name_type_mask
+ /// A mask that has one or more bitwise OR'ed values from the
+ /// lldb::FunctionNameType enumeration type that indicate what
+ /// kind of names we are looking for.
+ ///
+ /// \param[out] sc_list
+ /// A list to append any matching symbol contexts to.
+ ///
+ /// \return
+ /// The number of symbol contexts that were added to \a sc_list
+ size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
+
+ /// Find compile units by partial or full path.
+ ///
+ /// Finds all compile units that match \a path in all of the modules and
+ /// returns the results in \a sc_list.
+ ///
+ /// \param[in] path
+ /// The name of the function we are looking for.
+ ///
+ /// \param[in] append
+ /// If \b true, then append any compile units that were found
+ /// to \a sc_list. If \b false, then the \a sc_list is cleared
+ /// and the contents of \a sc_list are replaced.
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets filled in with all of the
+ /// matches.
+ ///
+ /// \return
+ /// The number of matches added to \a sc_list.
+ size_t FindCompileUnits(const FileSpec &path, bool append,
+ SymbolContextList &sc_list);
+
+ /// Find functions by name.
+ ///
+ /// If the function is an inlined function, it will have a block,
+ /// representing the inlined function, and the function will be the
+ /// containing function. If it is not inlined, then the block will be NULL.
+ ///
+ /// \param[in] name
+ /// The name of the compile unit we are looking for.
+ ///
+ /// \param[in] namespace_decl
+ /// If valid, a namespace to search in.
+ ///
+ /// \param[in] name_type_mask
+ /// A bit mask of bits that indicate what kind of names should
+ /// be used when doing the lookup. Bits include fully qualified
+ /// names, base names, C++ methods, or ObjC selectors.
+ /// See FunctionNameType for more details.
+ ///
+ /// \param[in] append
+ /// If \b true, any matches will be appended to \a sc_list, else
+ /// matches replace the contents of \a sc_list.
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets filled in with all of the
+ /// matches.
+ ///
+ /// \return
+ /// The number of matches added to \a sc_list.
+ size_t FindFunctions(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask, bool symbols_ok,
+ bool inlines_ok, bool append,
+ SymbolContextList &sc_list);
+
+ /// Find functions by name.
+ ///
+ /// If the function is an inlined function, it will have a block,
+ /// representing the inlined function, and the function will be the
+ /// containing function. If it is not inlined, then the block will be NULL.
+ ///
+ /// \param[in] regex
+ /// A regular expression to use when matching the name.
+ ///
+ /// \param[in] append
+ /// If \b true, any matches will be appended to \a sc_list, else
+ /// matches replace the contents of \a sc_list.
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets filled in with all of the
+ /// matches.
+ ///
+ /// \return
+ /// The number of matches added to \a sc_list.
+ size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok,
+ bool inlines_ok, bool append,
+ SymbolContextList &sc_list);
+
+ /// Find addresses by file/line
+ ///
+ /// \param[in] target_sp
+ /// The target the addresses are desired for.
+ ///
+ /// \param[in] file
+ /// Source file to locate.
+ ///
+ /// \param[in] line
+ /// Source line to locate.
+ ///
+ /// \param[in] function
+ /// Optional filter function. Addresses within this function will be
+ /// added to the 'local' list. All others will be added to the 'extern'
+ /// list.
+ ///
+ /// \param[out] output_local
+ /// All matching addresses within 'function'
+ ///
+ /// \param[out] output_extern
+ /// All matching addresses not within 'function'
+ void FindAddressesForLine(const lldb::TargetSP target_sp,
+ const FileSpec &file, uint32_t line,
+ Function *function,
+ std::vector<Address> &output_local,
+ std::vector<Address> &output_extern);
+
+ /// Find global and static variables by name.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \param[in] parent_decl_ctx
+ /// If valid, a decl context that results must exist within
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a
+ /// max_matches. Specify UINT32_MAX to get all possible matches.
+ ///
+ /// \param[in] variable_list
+ /// A list of variables that gets the matches appended to.
+ ///
+ /// \return
+ /// The number of matches added to \a variable_list.
+ size_t FindGlobalVariables(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ size_t max_matches, VariableList &variable_list);
+
+ /// Find global and static variables by regular expression.
+ ///
+ /// \param[in] regex
+ /// A regular expression to use when matching the name.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a
+ /// max_matches. Specify UINT32_MAX to get all possible matches.
+ ///
+ /// \param[in] variable_list
+ /// A list of variables that gets the matches appended to.
+ ///
+ /// \return
+ /// The number of matches added to \a variable_list.
+ size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
+ VariableList &variable_list);
+
+ /// Find types by name.
+ ///
+ /// Type lookups in modules go through the SymbolVendor (which will use one
+ /// or more SymbolFile subclasses). The SymbolFile needs to be able to
+ /// lookup types by basename and not the fully qualified typename. This
+ /// allows the type accelerator tables to stay small, even with heavily
+ /// templatized C++. The type search will then narrow down the search
+ /// results. If "exact_match" is true, then the type search will only match
+ /// exact type name matches. If "exact_match" is false, the type will match
+ /// as long as the base typename matches and as long as any immediate
+ /// containing namespaces/class scopes that are specified match. So to
+ /// search for a type "d" in "b::c", the name "b::c::d" can be specified and
+ /// it will match any class/namespace "b" which contains a class/namespace
+ /// "c" which contains type "d". We do this to allow users to not always
+ /// have to specify complete scoping on all expressions, but it also allows
+ /// for exact matching when required.
+ ///
+ /// \param[in] type_name
+ /// The name of the type we are looking for that is a fully
+ /// or partially qualified type name.
+ ///
+ /// \param[in] exact_match
+ /// If \b true, \a type_name is fully qualified and must match
+ /// exactly. If \b false, \a type_name is a partially qualified
+ /// name where the leading namespaces or classes can be
+ /// omitted to make finding types that a user may type
+ /// easier.
+ ///
+ /// \param[out] type_list
+ /// A type list gets populated with any matches.
+ ///
+ /// \return
+ /// The number of matches added to \a type_list.
+ size_t
+ FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeList &types);
+
+ lldb::TypeSP FindFirstType(const SymbolContext &sc,
+ ConstString type_name, bool exact_match);
+
+ /// Find types by name that are in a namespace. This function is used by the
+ /// expression parser when searches need to happen in an exact namespace
+ /// scope.
+ ///
+ /// \param[in] type_name
+ /// The name of a type within a namespace that should not include
+ /// any qualifying namespaces (just a type basename).
+ ///
+ /// \param[in] namespace_decl
+ /// The namespace declaration that this type must exist in.
+ ///
+ /// \param[out] type_list
+ /// A type list gets populated with any matches.
+ ///
+ /// \return
+ /// The number of matches added to \a type_list.
+ size_t FindTypesInNamespace(ConstString type_name,
+ const CompilerDeclContext *parent_decl_ctx,
+ size_t max_matches, TypeList &type_list);
+
+ /// Get const accessor for the module architecture.
+ ///
+ /// \return
+ /// A const reference to the architecture object.
+ const ArchSpec &GetArchitecture() const;
+
+ /// Get const accessor for the module file specification.
+ ///
+ /// This function returns the file for the module on the host system that is
+ /// running LLDB. This can differ from the path on the platform since we
+ /// might be doing remote debugging.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ const FileSpec &GetFileSpec() const { return m_file; }
+
+ /// Get accessor for the module platform file specification.
+ ///
+ /// Platform file refers to the path of the module as it is known on the
+ /// remote system on which it is being debugged. For local debugging this is
+ /// always the same as Module::GetFileSpec(). But remote debugging might
+ /// mention a file "/usr/lib/liba.dylib" which might be locally downloaded
+ /// and cached. In this case the platform file could be something like:
+ /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The
+ /// file could also be cached in a local developer kit directory.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ const FileSpec &GetPlatformFileSpec() const {
+ if (m_platform_file)
+ return m_platform_file;
+ return m_file;
+ }
+
+ void SetPlatformFileSpec(const FileSpec &file) { m_platform_file = file; }
+
+ const FileSpec &GetRemoteInstallFileSpec() const {
+ return m_remote_install_file;
+ }
+
+ void SetRemoteInstallFileSpec(const FileSpec &file) {
+ m_remote_install_file = file;
+ }
+
+ const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; }
+
+ void PreloadSymbols();
+
+ void SetSymbolFileFileSpec(const FileSpec &file);
+
+ const llvm::sys::TimePoint<> &GetModificationTime() const {
+ return m_mod_time;
+ }
+
+ const llvm::sys::TimePoint<> &GetObjectModificationTime() const {
+ return m_object_mod_time;
+ }
+
+ void SetObjectModificationTime(const llvm::sys::TimePoint<> &mod_time) {
+ m_mod_time = mod_time;
+ }
+
+ /// Tells whether this module is capable of being the main executable for a
+ /// process.
+ ///
+ /// \return
+ /// \b true if it is, \b false otherwise.
+ bool IsExecutable();
+
+ /// Tells whether this module has been loaded in the target passed in. This
+ /// call doesn't distinguish between whether the module is loaded by the
+ /// dynamic loader, or by a "target module add" type call.
+ ///
+ /// \param[in] target
+ /// The target to check whether this is loaded in.
+ ///
+ /// \return
+ /// \b true if it is, \b false otherwise.
+ bool IsLoadedInTarget(Target *target);
+
+ bool LoadScriptingResourceInTarget(Target *target, Status &error,
+ Stream *feedback_stream = nullptr);
+
+ /// Get the number of compile units for this module.
+ ///
+ /// \return
+ /// The number of compile units that the symbol vendor plug-in
+ /// finds.
+ size_t GetNumCompileUnits();
+
+ lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
+
+ ConstString GetObjectName() const;
+
+ uint64_t GetObjectOffset() const { return m_object_offset; }
+
+ /// Get the object file representation for the current architecture.
+ ///
+ /// If the object file has not been located or parsed yet, this function
+ /// will find the best ObjectFile plug-in that can parse Module::m_file.
+ ///
+ /// \return
+ /// If Module::m_file does not exist, or no plug-in was found
+ /// that can parse the file, or the object file doesn't contain
+ /// the current architecture in Module::m_arch, nullptr will be
+ /// returned, else a valid object file interface will be
+ /// returned. The returned pointer is owned by this object and
+ /// remains valid as long as the object is around.
+ virtual ObjectFile *GetObjectFile();
+
+ /// Get the unified section list for the module. This is the section list
+ /// created by the module's object file and any debug info and symbol files
+ /// created by the symbol vendor.
+ ///
+ /// If the symbol vendor has not been loaded yet, this function will return
+ /// the section list for the object file.
+ ///
+ /// \return
+ /// Unified module section list.
+ virtual SectionList *GetSectionList();
+
+ /// Notify the module that the file addresses for the Sections have been
+ /// updated.
+ ///
+ /// If the Section file addresses for a module are updated, this method
+ /// should be called. Any parts of the module, object file, or symbol file
+ /// that has cached those file addresses must invalidate or update its
+ /// cache.
+ virtual void SectionFileAddressesChanged();
+
+ /// Returns a reference to the UnwindTable for this Module
+ ///
+ /// The UnwindTable contains FuncUnwinders objects for any function in this
+ /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the
+ /// function has yet to be unwound in a stack walk), it will be created when
+ /// requested. Specifically, we do not create FuncUnwinders objects for
+ /// functions until they are needed.
+ ///
+ /// \return
+ /// Returns the unwind table for this module. If this object has no
+ /// associated object file, an empty UnwindTable is returned.
+ UnwindTable &GetUnwindTable();
+
+ llvm::VersionTuple GetVersion();
+
+ /// Load an object file from memory.
+ ///
+ /// If available, the size of the object file in memory may be passed to
+ /// avoid additional round trips to process memory. If the size is not
+ /// provided, a default value is used. This value should be large enough to
+ /// enable the ObjectFile plugins to read the header of the object file
+ /// without going back to the process.
+ ///
+ /// \return
+ /// The object file loaded from memory or nullptr, if the operation
+ /// failed (see the `error` for more information in that case).
+ ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
+ lldb::addr_t header_addr, Status &error,
+ size_t size_to_read = 512);
+ /// Get the symbol vendor interface for the current architecture.
+ ///
+ /// If the symbol vendor file has not been located yet, this function will
+ /// find the best SymbolVendor plug-in that can use the current object file.
+ ///
+ /// \return
+ /// If this module does not have a valid object file, or no
+ /// plug-in can be found that can use the object file, nullptr will
+ /// be returned, else a valid symbol vendor plug-in interface
+ /// will be returned. The returned pointer is owned by this
+ /// object and remains valid as long as the object is around.
+ virtual SymbolVendor *
+ GetSymbolVendor(bool can_create = true,
+ lldb_private::Stream *feedback_strm = nullptr);
+
+ /// Get accessor the type list for this module.
+ ///
+ /// \return
+ /// A valid type list pointer, or nullptr if there is no valid
+ /// symbol vendor for this module.
+ TypeList *GetTypeList();
+
+ /// Get a reference to the UUID value contained in this object.
+ ///
+ /// If the executable image file doesn't not have a UUID value built into
+ /// the file format, an MD5 checksum of the entire file, or slice of the
+ /// file for the current architecture should be used.
+ ///
+ /// \return
+ /// A const pointer to the internal copy of the UUID value in
+ /// this module if this module has a valid UUID value, NULL
+ /// otherwise.
+ const lldb_private::UUID &GetUUID();
+
+ /// A debugging function that will cause everything in a module to
+ /// be parsed.
+ ///
+ /// All compile units will be parsed, along with all globals and static
+ /// variables and all functions for those compile units. All types, scopes,
+ /// local variables, static variables, global variables, and line tables
+ /// will be parsed. This can be used prior to dumping a module to see a
+ /// complete list of the resulting debug information that gets parsed, or as
+ /// a debug function to ensure that the module can consume all of the debug
+ /// data the symbol vendor provides.
+ void ParseAllDebugSymbols();
+
+ bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr);
+
+ /// Resolve the symbol context for the given address.
+ ///
+ /// Tries to resolve the matching symbol context based on a lookup from the
+ /// current symbol vendor. If the lazy lookup fails, an attempt is made to
+ /// parse the eh_frame section to handle stripped symbols. If this fails,
+ /// an attempt is made to resolve the symbol to the previous address to
+ /// handle the case of a function with a tail call.
+ ///
+ /// Use properties of the modified SymbolContext to inspect any resolved
+ /// target, module, compilation unit, symbol, function, function block or
+ /// line entry. Use the return value to determine which of these properties
+ /// have been modified.
+ ///
+ /// \param[in] so_addr
+ /// A load address to resolve.
+ ///
+ /// \param[in] resolve_scope
+ /// The scope that should be resolved (see SymbolContext::Scope).
+ /// A combination of flags from the enumeration SymbolContextItem
+ /// requesting a resolution depth. Note that the flags that are
+ /// actually resolved may be a superset of the requested flags.
+ /// For instance, eSymbolContextSymbol requires resolution of
+ /// eSymbolContextModule, and eSymbolContextFunction requires
+ /// eSymbolContextSymbol.
+ ///
+ /// \param[out] sc
+ /// The SymbolContext that is modified based on symbol resolution.
+ ///
+ /// \param[in] resolve_tail_call_address
+ /// Determines if so_addr should resolve to a symbol in the case
+ /// of a function whose last instruction is a call. In this case,
+ /// the PC can be one past the address range of the function.
+ ///
+ /// \return
+ /// The scope that has been resolved (see SymbolContext::Scope).
+ ///
+ /// \see SymbolContext::Scope
+ uint32_t ResolveSymbolContextForAddress(
+ const Address &so_addr, lldb::SymbolContextItem resolve_scope,
+ SymbolContext &sc, bool resolve_tail_call_address = false);
+
+ /// Resolve items in the symbol context for a given file and line.
+ ///
+ /// Tries to resolve \a file_path and \a line to a list of matching symbol
+ /// contexts.
+ ///
+ /// The line table entries contains addresses that can be used to further
+ /// resolve the values in each match: the function, block, symbol. Care
+ /// should be taken to minimize the amount of information that is requested
+ /// to only what is needed -- typically the module, compile unit, line table
+ /// and line table entry are sufficient.
+ ///
+ /// \param[in] file_path
+ /// A path to a source file to match. If \a file_path does not
+ /// specify a directory, then this query will match all files
+ /// whose base filename matches. If \a file_path does specify
+ /// a directory, the fullpath to the file must match.
+ ///
+ /// \param[in] line
+ /// The source line to match, or zero if just the compile unit
+ /// should be resolved.
+ ///
+ /// \param[in] check_inlines
+ /// Check for inline file and line number matches. This option
+ /// should be used sparingly as it will cause all line tables
+ /// for every compile unit to be parsed and searched for
+ /// matching inline file entries.
+ ///
+ /// \param[in] resolve_scope
+ /// The scope that should be resolved (see
+ /// SymbolContext::Scope).
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets matching symbols contexts
+ /// appended to.
+ ///
+ /// \return
+ /// The number of matches that were added to \a sc_list.
+ ///
+ /// \see SymbolContext::Scope
+ uint32_t ResolveSymbolContextForFilePath(
+ const char *file_path, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
+
+ /// Resolve items in the symbol context for a given file and line.
+ ///
+ /// Tries to resolve \a file_spec and \a line to a list of matching symbol
+ /// contexts.
+ ///
+ /// The line table entries contains addresses that can be used to further
+ /// resolve the values in each match: the function, block, symbol. Care
+ /// should be taken to minimize the amount of information that is requested
+ /// to only what is needed -- typically the module, compile unit, line table
+ /// and line table entry are sufficient.
+ ///
+ /// \param[in] file_spec
+ /// A file spec to a source file to match. If \a file_path does
+ /// not specify a directory, then this query will match all
+ /// files whose base filename matches. If \a file_path does
+ /// specify a directory, the fullpath to the file must match.
+ ///
+ /// \param[in] line
+ /// The source line to match, or zero if just the compile unit
+ /// should be resolved.
+ ///
+ /// \param[in] check_inlines
+ /// Check for inline file and line number matches. This option
+ /// should be used sparingly as it will cause all line tables
+ /// for every compile unit to be parsed and searched for
+ /// matching inline file entries.
+ ///
+ /// \param[in] resolve_scope
+ /// The scope that should be resolved (see
+ /// SymbolContext::Scope).
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets filled in with all of the
+ /// matches.
+ ///
+ /// \return
+ /// A integer that contains SymbolContext::Scope bits set for
+ /// each item that was successfully resolved.
+ ///
+ /// \see SymbolContext::Scope
+ uint32_t ResolveSymbolContextsForFileSpec(
+ const FileSpec &file_spec, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
+
+ void SetFileSpecAndObjectName(const FileSpec &file,
+ ConstString object_name);
+
+ bool GetIsDynamicLinkEditor();
+
+ TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
+
+ // Special error functions that can do printf style formatting that will
+ // prepend the message with something appropriate for this module (like the
+ // architecture, path and object name (if any)). This centralizes code so
+ // that everyone doesn't need to format their error and log messages on their
+ // own and keeps the output a bit more consistent.
+ void LogMessage(Log *log, const char *format, ...)
+ __attribute__((format(printf, 3, 4)));
+
+ void LogMessageVerboseBacktrace(Log *log, const char *format, ...)
+ __attribute__((format(printf, 3, 4)));
+
+ void ReportWarning(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ void ReportError(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ // Only report an error once when the module is first detected to be modified
+ // so we don't spam the console with many messages.
+ void ReportErrorIfModifyDetected(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ // Return true if the file backing this module has changed since the module
+ // was originally created since we saved the initial file modification time
+ // when the module first gets created.
+ bool FileHasChanged() const;
+
+ // SymbolVendor, SymbolFile and ObjectFile member objects should lock the
+ // module mutex to avoid deadlocks.
+ std::recursive_mutex &GetMutex() const { return m_mutex; }
+
+ PathMappingList &GetSourceMappingList() { return m_source_mappings; }
+
+ const PathMappingList &GetSourceMappingList() const {
+ return m_source_mappings;
+ }
+
+ /// Finds a source file given a file spec using the module source path
+ /// remappings (if any).
+ ///
+ /// Tries to resolve \a orig_spec by checking the module source path
+ /// remappings. It makes sure the file exists, so this call can be expensive
+ /// if the remappings are on a network file system, so use this function
+ /// sparingly (not in a tight debug info parsing loop).
+ ///
+ /// \param[in] orig_spec
+ /// The original source file path to try and remap.
+ ///
+ /// \param[out] new_spec
+ /// The newly remapped filespec that is guaranteed to exist.
+ ///
+ /// \return
+ /// /b true if \a orig_spec was successfully located and
+ /// \a new_spec is filled in with an existing file spec,
+ /// \b false otherwise.
+ bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
+
+ /// Remaps a source file given \a path into \a new_path.
+ ///
+ /// Remaps \a path if any source remappings match. This function does NOT
+ /// stat the file system so it can be used in tight loops where debug info
+ /// is being parsed.
+ ///
+ /// \param[in] path
+ /// The original source file path to try and remap.
+ ///
+ /// \param[out] new_path
+ /// The newly remapped filespec that is may or may not exist.
+ ///
+ /// \return
+ /// /b true if \a path was successfully located and \a new_path
+ /// is filled in with a new source path, \b false otherwise.
+ bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
+ bool RemapSourceFile(const char *, std::string &) const = delete;
+
+ /// \class LookupInfo Module.h "lldb/Core/Module.h"
+ /// A class that encapsulates name lookup information.
+ ///
+ /// Users can type a wide variety of partial names when setting breakpoints
+ /// by name or when looking for functions by name. SymbolVendor and
+ /// SymbolFile objects are only required to implement name lookup for
+ /// function basenames and for fully mangled names. This means if the user
+ /// types in a partial name, we must reduce this to a name lookup that will
+ /// work with all SymbolFile objects. So we might reduce a name lookup to
+ /// look for a basename, and then prune out any results that don't match.
+ ///
+ /// The "m_name" member variable represents the name as it was typed by the
+ /// user. "m_lookup_name" will be the name we actually search for through
+ /// the symbol or objects files. Lanaguage is included in case we need to
+ /// filter results by language at a later date. The "m_name_type_mask"
+ /// member variable tells us what kinds of names we are looking for and can
+ /// help us prune out unwanted results.
+ ///
+ /// Function lookups are done in Module.cpp, ModuleList.cpp and in
+ /// BreakpointResolverName.cpp and they all now use this class to do lookups
+ /// correctly.
+ class LookupInfo {
+ public:
+ LookupInfo()
+ : m_name(), m_lookup_name(), m_language(lldb::eLanguageTypeUnknown),
+ m_name_type_mask(lldb::eFunctionNameTypeNone),
+ m_match_name_after_lookup(false) {}
+
+ LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask,
+ lldb::LanguageType language);
+
+ ConstString GetName() const { return m_name; }
+
+ void SetName(ConstString name) { m_name = name; }
+
+ ConstString GetLookupName() const { return m_lookup_name; }
+
+ void SetLookupName(ConstString name) { m_lookup_name = name; }
+
+ lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; }
+
+ void SetNameTypeMask(lldb::FunctionNameType mask) {
+ m_name_type_mask = mask;
+ }
+
+ void Prune(SymbolContextList &sc_list, size_t start_idx) const;
+
+ protected:
+ /// What the user originally typed
+ ConstString m_name;
+
+ /// The actual name will lookup when calling in the object or symbol file
+ ConstString m_lookup_name;
+
+ /// Limit matches to only be for this language
+ lldb::LanguageType m_language;
+
+ /// One or more bits from lldb::FunctionNameType that indicate what kind of
+ /// names we are looking for
+ lldb::FunctionNameType m_name_type_mask;
+
+ ///< If \b true, then demangled names that match will need to contain
+ ///< "m_name" in order to be considered a match
+ bool m_match_name_after_lookup;
+ };
+
+protected:
+ // Member Variables
+ mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy
+ ///in multi-threaded environments.
+
+ /// The modification time for this module when it was created.
+ llvm::sys::TimePoint<> m_mod_time;
+
+ ArchSpec m_arch; ///< The architecture for this module.
+ UUID m_uuid; ///< Each module is assumed to have a unique identifier to help
+ ///match it up to debug symbols.
+ FileSpec m_file; ///< The file representation on disk for this module (if
+ ///there is one).
+ FileSpec m_platform_file; ///< The path to the module on the platform on which
+ ///it is being debugged
+ FileSpec m_remote_install_file; ///< If set when debugging on remote
+ ///platforms, this module will be installed at
+ ///this location
+ FileSpec m_symfile_spec; ///< If this path is valid, then this is the file
+ ///that _will_ be used as the symbol file for this
+ ///module
+ ConstString m_object_name; ///< The name an object within this module that is
+ ///selected, or empty of the module is represented
+ ///by \a m_file.
+ uint64_t m_object_offset;
+ llvm::sys::TimePoint<> m_object_mod_time;
+ lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
+ ///parser for this module as it may or may
+ ///not be shared with the SymbolFile
+ llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
+ /// objects created for this
+ /// Module's functions
+ lldb::SymbolVendorUP
+ m_symfile_up; ///< A pointer to the symbol vendor for this module.
+ std::vector<lldb::SymbolVendorUP>
+ m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and
+ ///changes the symbol file,
+ ///< we need to keep all old symbol files around in case anyone has type
+ ///references to them
+ TypeSystemMap m_type_system_map; ///< A map of any type systems associated
+ ///with this module
+ PathMappingList m_source_mappings; ///< Module specific source remappings for
+ ///when you have debug info for a module
+ ///that doesn't match where the sources
+ ///currently are
+ lldb::SectionListUP m_sections_up; ///< Unified section list for module that
+ /// is used by the ObjectFile and and
+ /// ObjectFile instances for the debug info
+
+ std::atomic<bool> m_did_load_objfile{false};
+ std::atomic<bool> m_did_load_symbol_vendor{false};
+ std::atomic<bool> m_did_set_uuid{false};
+ mutable bool m_file_has_changed : 1,
+ m_first_file_changed_log : 1; /// See if the module was modified after it
+ /// was initially opened.
+
+ /// Resolve a file or load virtual address.
+ ///
+ /// Tries to resolve \a vm_addr as a file address (if \a
+ /// vm_addr_is_file_addr is true) or as a load address if \a
+ /// vm_addr_is_file_addr is false) in the symbol vendor. \a resolve_scope
+ /// indicates what clients wish to resolve and can be used to limit the
+ /// scope of what is parsed.
+ ///
+ /// \param[in] vm_addr
+ /// The load virtual address to resolve.
+ ///
+ /// \param[in] vm_addr_is_file_addr
+ /// If \b true, \a vm_addr is a file address, else \a vm_addr
+ /// if a load address.
+ ///
+ /// \param[in] resolve_scope
+ /// The scope that should be resolved (see
+ /// SymbolContext::Scope).
+ ///
+ /// \param[out] so_addr
+ /// The section offset based address that got resolved if
+ /// any bits are returned.
+ ///
+ /// \param[out] sc
+ // The symbol context that has objects filled in. Each bit
+ /// in the \a resolve_scope pertains to a member in the \a sc.
+ ///
+ /// \return
+ /// A integer that contains SymbolContext::Scope bits set for
+ /// each item that was successfully resolved.
+ ///
+ /// \see SymbolContext::Scope
+ uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr,
+ bool vm_addr_is_file_addr,
+ lldb::SymbolContextItem resolve_scope,
+ Address &so_addr, SymbolContext &sc);
+
+ void SymbolIndicesToSymbolContextList(Symtab *symtab,
+ std::vector<uint32_t> &symbol_indexes,
+ SymbolContextList &sc_list);
+
+ bool SetArchitecture(const ArchSpec &new_arch);
+
+ void SetUUID(const lldb_private::UUID &uuid);
+
+ SectionList *GetUnifiedSectionList();
+
+ friend class ModuleList;
+ friend class ObjectFile;
+ friend class SymbolFile;
+
+private:
+ Module(); // Only used internally by CreateJITModule ()
+
+ size_t FindTypes_Impl(
+ ConstString name, const CompilerDeclContext *parent_decl_ctx,
+ bool append, size_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+
+ DISALLOW_COPY_AND_ASSIGN(Module);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Module_h_
diff --git a/linux-x64/clang/include/lldb/Core/ModuleChild.h b/linux-x64/clang/include/lldb/Core/ModuleChild.h
new file mode 100644
index 0000000..8a81c1a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ModuleChild.h
@@ -0,0 +1,62 @@
+//===-- ModuleChild.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ModuleChild_h_
+#define liblldb_ModuleChild_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+
+/// \class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
+/// A mix in class that contains a pointer back to the module
+/// that owns the object which inherits from it.
+class ModuleChild {
+public:
+ /// Construct with owning module.
+ ///
+ /// \param[in] module
+ /// The module that owns the object that inherits from this
+ /// class.
+ ModuleChild(const lldb::ModuleSP &module_sp);
+
+ /// Destructor.
+ ~ModuleChild();
+
+ /// Assignment operator.
+ ///
+ /// \param[in] rhs
+ /// A const ModuleChild class reference to copy.
+ ///
+ /// \return
+ /// A const reference to this object.
+ const ModuleChild &operator=(const ModuleChild &rhs);
+
+ /// Get const accessor for the module pointer.
+ ///
+ /// \return
+ /// A const pointer to the module that owns the object that
+ /// inherits from this class.
+ lldb::ModuleSP GetModule() const;
+
+ /// Set accessor for the module pointer.
+ ///
+ /// \param[in] module
+ /// A new module that owns the object that inherits from this
+ /// class.
+ void SetModule(const lldb::ModuleSP &module_sp);
+
+protected:
+ // Member variables
+ lldb::ModuleWP m_module_wp; ///< The Module that owns the object that inherits
+ ///< from this class.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ModuleChild_h_
diff --git a/linux-x64/clang/include/lldb/Core/ModuleList.h b/linux-x64/clang/include/lldb/Core/ModuleList.h
new file mode 100644
index 0000000..1e26c35
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ModuleList.h
@@ -0,0 +1,542 @@
+//===-- ModuleList.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ModuleList_h_
+#define liblldb_ModuleList_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/DenseSet.h"
+
+#include <functional>
+#include <list>
+#include <mutex>
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class ConstString;
+class FileSpecList;
+class Function;
+class Log;
+class Module;
+class RegularExpression;
+class Stream;
+class SymbolContext;
+class SymbolContextList;
+class SymbolFile;
+class Target;
+class TypeList;
+class UUID;
+class VariableList;
+
+class ModuleListProperties : public Properties {
+public:
+ ModuleListProperties();
+
+ FileSpec GetClangModulesCachePath() const;
+ bool SetClangModulesCachePath(llvm::StringRef path);
+ bool GetEnableExternalLookup() const;
+ bool SetEnableExternalLookup(bool new_value);
+};
+
+/// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
+/// A collection class for Module objects.
+///
+/// Modules in the module collection class are stored as reference counted
+/// shared pointers to Module objects.
+class ModuleList {
+public:
+ class Notifier {
+ public:
+ virtual ~Notifier() = default;
+
+ virtual void NotifyModuleAdded(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) = 0;
+ virtual void NotifyModuleRemoved(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) = 0;
+ virtual void NotifyModuleUpdated(const ModuleList &module_list,
+ const lldb::ModuleSP &old_module_sp,
+ const lldb::ModuleSP &new_module_sp) = 0;
+ virtual void NotifyWillClearList(const ModuleList &module_list) = 0;
+
+ virtual void NotifyModulesRemoved(lldb_private::ModuleList &module_list) = 0;
+ };
+
+ /// Default constructor.
+ ///
+ /// Creates an empty list of Module objects.
+ ModuleList();
+
+ /// Copy Constructor.
+ ///
+ /// Creates a new module list object with a copy of the modules from \a rhs.
+ ///
+ /// \param[in] rhs
+ /// Another module list object.
+ ModuleList(const ModuleList &rhs);
+
+ ModuleList(ModuleList::Notifier *notifier);
+
+ /// Destructor.
+ ~ModuleList();
+
+ /// Assignment operator.
+ ///
+ /// Copies the module list from \a rhs into this list.
+ ///
+ /// \param[in] rhs
+ /// Another module list object.
+ ///
+ /// \return
+ /// A const reference to this object.
+ const ModuleList &operator=(const ModuleList &rhs);
+
+ /// Append a module to the module list.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer to a module to add to this collection.
+ ///
+ /// \param[in] notify
+ /// If true, and a notifier function is set, the notifier function
+ /// will be called. Defaults to true.
+ ///
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidLoad -- the call to
+ /// ModulesDidLoad may be deferred when adding multiple Modules
+ /// to the Target, but it must be called at the end,
+ /// before resuming execution.
+ void Append(const lldb::ModuleSP &module_sp, bool notify = true);
+
+ /// Append a module to the module list and remove any equivalent modules.
+ /// Equivalent modules are ones whose file, platform file and architecture
+ /// matches.
+ ///
+ /// Replaces the module to the collection.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer to a module to replace in this collection.
+ void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
+
+ /// Append a module to the module list, if it is not already there.
+ ///
+ /// \param[in] module_sp
+ ///
+ /// \param[in] notify
+ /// If true, and a notifier function is set, the notifier function
+ /// will be called. Defaults to true.
+ ///
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidLoad -- the call to
+ /// ModulesDidLoad may be deferred when adding multiple Modules
+ /// to the Target, but it must be called at the end,
+ /// before resuming execution.
+ bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify = true);
+
+ void Append(const ModuleList &module_list);
+
+ bool AppendIfNeeded(const ModuleList &module_list);
+
+ bool ReplaceModule(const lldb::ModuleSP &old_module_sp,
+ const lldb::ModuleSP &new_module_sp);
+
+ /// Clear the object's state.
+ ///
+ /// Clears the list of modules and releases a reference to each module
+ /// object and if the reference count goes to zero, the module will be
+ /// deleted.
+ void Clear();
+
+ /// Clear the object's state.
+ ///
+ /// Clears the list of modules and releases a reference to each module
+ /// object and if the reference count goes to zero, the module will be
+ /// deleted. Also release all memory that might be held by any collection
+ /// classes (like std::vector)
+ void Destroy();
+
+ /// Dump the description of each module contained in this list.
+ ///
+ /// Dump the description of each module contained in this list to the
+ /// supplied stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \see Module::Dump(Stream *) const
+ void Dump(Stream *s) const;
+
+ void LogUUIDAndPaths(Log *log, const char *prefix_cstr);
+
+ std::recursive_mutex &GetMutex() const { return m_modules_mutex; }
+
+ size_t GetIndexForModule(const Module *module) const;
+
+ /// Get the module shared pointer for the module at index \a idx.
+ ///
+ /// \param[in] idx
+ /// An index into this module collection.
+ ///
+ /// \return
+ /// A shared pointer to a Module which can contain NULL if
+ /// \a idx is out of range.
+ ///
+ /// \see ModuleList::GetSize()
+ lldb::ModuleSP GetModuleAtIndex(size_t idx) const;
+
+ /// Get the module shared pointer for the module at index \a idx without
+ /// acquiring the ModuleList mutex. This MUST already have been acquired
+ /// with ModuleList::GetMutex and locked for this call to be safe.
+ ///
+ /// \param[in] idx
+ /// An index into this module collection.
+ ///
+ /// \return
+ /// A shared pointer to a Module which can contain NULL if
+ /// \a idx is out of range.
+ ///
+ /// \see ModuleList::GetSize()
+ lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const;
+
+ /// Get the module pointer for the module at index \a idx.
+ ///
+ /// \param[in] idx
+ /// An index into this module collection.
+ ///
+ /// \return
+ /// A pointer to a Module which can by nullptr if \a idx is out
+ /// of range.
+ ///
+ /// \see ModuleList::GetSize()
+ Module *GetModulePointerAtIndex(size_t idx) const;
+
+ /// Get the module pointer for the module at index \a idx without acquiring
+ /// the ModuleList mutex. This MUST already have been acquired with
+ /// ModuleList::GetMutex and locked for this call to be safe.
+ ///
+ /// \param[in] idx
+ /// An index into this module collection.
+ ///
+ /// \return
+ /// A pointer to a Module which can by nullptr if \a idx is out
+ /// of range.
+ ///
+ /// \see ModuleList::GetSize()
+ Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
+
+ /// Find compile units by partial or full path.
+ ///
+ /// Finds all compile units that match \a path in all of the modules and
+ /// returns the results in \a sc_list.
+ ///
+ /// \param[in] path
+ /// The name of the compile unit we are looking for.
+ ///
+ /// \param[in] append
+ /// If \b true, then append any compile units that were found
+ /// to \a sc_list. If \b false, then the \a sc_list is cleared
+ /// and the contents of \a sc_list are replaced.
+ ///
+ /// \param[out] sc_list
+ /// A symbol context list that gets filled in with all of the
+ /// matches.
+ ///
+ /// \return
+ /// The number of matches added to \a sc_list.
+ size_t FindCompileUnits(const FileSpec &path, bool append,
+ SymbolContextList &sc_list) const;
+
+ /// \see Module::FindFunctions ()
+ size_t FindFunctions(ConstString name,
+ lldb::FunctionNameType name_type_mask,
+ bool include_symbols, bool include_inlines, bool append,
+ SymbolContextList &sc_list) const;
+
+ /// \see Module::FindFunctionSymbols ()
+ size_t FindFunctionSymbols(ConstString name,
+ lldb::FunctionNameType name_type_mask,
+ SymbolContextList &sc_list);
+
+ /// \see Module::FindFunctions ()
+ size_t FindFunctions(const RegularExpression &name, bool include_symbols,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+
+ /// Find global and static variables by name.
+ ///
+ /// \param[in] name
+ /// The name of the global or static variable we are looking
+ /// for.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a
+ /// max_matches. Specify UINT32_MAX to get all possible matches.
+ ///
+ /// \param[in] variable_list
+ /// A list of variables that gets the matches appended to.
+ ///
+ /// \return
+ /// The number of matches added to \a variable_list.
+ size_t FindGlobalVariables(ConstString name, size_t max_matches,
+ VariableList &variable_list) const;
+
+ /// Find global and static variables by regular expression.
+ ///
+ /// \param[in] regex
+ /// A regular expression to use when matching the name.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a
+ /// max_matches. Specify UINT32_MAX to get all possible matches.
+ ///
+ /// \param[in] variable_list
+ /// A list of variables that gets the matches appended to.
+ ///
+ /// \return
+ /// The number of matches added to \a variable_list.
+ size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
+ VariableList &variable_list) const;
+
+ /// Finds the first module whose file specification matches \a file_spec.
+ ///
+ /// \param[in] file_spec_ptr
+ /// A file specification object to match against the Module's
+ /// file specifications. If \a file_spec does not have
+ /// directory information, matches will occur by matching only
+ /// the basename of any modules in this list. If this value is
+ /// NULL, then file specifications won't be compared when
+ /// searching for matching modules.
+ ///
+ /// \param[in] arch_ptr
+ /// The architecture to search for if non-NULL. If this value
+ /// is NULL no architecture matching will be performed.
+ ///
+ /// \param[in] uuid_ptr
+ /// The uuid to search for if non-NULL. If this value is NULL
+ /// no uuid matching will be performed.
+ ///
+ /// \param[in] object_name
+ /// An optional object name that must match as well. This value
+ /// can be NULL.
+ ///
+ /// \param[out] matching_module_list
+ /// A module list that gets filled in with any modules that
+ /// match the search criteria.
+ ///
+ /// \return
+ /// The number of matching modules found by the search.
+ size_t FindModules(const ModuleSpec &module_spec,
+ ModuleList &matching_module_list) const;
+
+ lldb::ModuleSP FindModule(const Module *module_ptr) const;
+
+ // Find a module by UUID
+ //
+ // The UUID value for a module is extracted from the ObjectFile and is the
+ // MD5 checksum, or a smarter object file equivalent, so finding modules by
+ // UUID values is very efficient and accurate.
+ lldb::ModuleSP FindModule(const UUID &uuid) const;
+
+ lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
+
+ size_t FindSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list,
+ bool append = false) const;
+
+ size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list,
+ bool append = false) const;
+
+ /// Find types by name.
+ ///
+ /// \param[in] search_first
+ /// If non-null, this module will be searched before any other
+ /// modules.
+ ///
+ /// \param[in] name
+ /// The name of the type we are looking for.
+ ///
+ /// \param[in] append
+ /// If \b true, any matches will be appended to \a
+ /// variable_list, else matches replace the contents of
+ /// \a variable_list.
+ ///
+ /// \param[in] max_matches
+ /// Allow the number of matches to be limited to \a
+ /// max_matches. Specify UINT32_MAX to get all possible matches.
+ ///
+ /// \param[in] encoding
+ /// Limit the search to specific types, or get all types if
+ /// set to Type::invalid.
+ ///
+ /// \param[in] udt_name
+ /// If the encoding is a user defined type, specify the name
+ /// of the user defined type ("struct", "union", "class", etc).
+ ///
+ /// \param[out] type_list
+ /// A type list gets populated with any matches.
+ ///
+ /// \return
+ /// The number of matches added to \a type_list.
+ size_t FindTypes(Module *search_first, ConstString name,
+ bool name_is_fully_qualified, size_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeList &types) const;
+
+ bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
+
+ /// Find addresses by file/line
+ ///
+ /// \param[in] target_sp
+ /// The target the addresses are desired for.
+ ///
+ /// \param[in] file
+ /// Source file to locate.
+ ///
+ /// \param[in] line
+ /// Source line to locate.
+ ///
+ /// \param[in] function
+ /// Optional filter function. Addresses within this function will be
+ /// added to the 'local' list. All others will be added to the 'extern'
+ /// list.
+ ///
+ /// \param[out] output_local
+ /// All matching addresses within 'function'
+ ///
+ /// \param[out] output_extern
+ /// All matching addresses not within 'function'
+ void FindAddressesForLine(const lldb::TargetSP target_sp,
+ const FileSpec &file, uint32_t line,
+ Function *function,
+ std::vector<Address> &output_local,
+ std::vector<Address> &output_extern);
+
+ /// Remove a module from the module list.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer to a module to remove from this collection.
+ ///
+ /// \param[in] notify
+ /// If true, and a notifier function is set, the notifier function
+ /// will be called. Defaults to true.
+ ///
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidUnload -- the call to
+ /// ModulesDidUnload may be deferred when removing multiple Modules
+ /// from the Target, but it must be called at the end,
+ /// before resuming execution.
+ bool Remove(const lldb::ModuleSP &module_sp, bool notify = true);
+
+ size_t Remove(ModuleList &module_list);
+
+ bool RemoveIfOrphaned(const Module *module_ptr);
+
+ size_t RemoveOrphans(bool mandatory);
+
+ bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const;
+
+ /// \copydoc Module::ResolveSymbolContextForAddress (const Address
+ /// &,uint32_t,SymbolContext&)
+ uint32_t ResolveSymbolContextForAddress(const Address &so_addr,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContext &sc) const;
+
+ /// \copydoc Module::ResolveSymbolContextForFilePath (const char
+ /// *,uint32_t,bool,uint32_t,SymbolContextList&)
+ uint32_t ResolveSymbolContextForFilePath(
+ const char *file_path, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
+
+ /// \copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec
+ /// &,uint32_t,bool,uint32_t,SymbolContextList&)
+ uint32_t ResolveSymbolContextsForFileSpec(
+ const FileSpec &file_spec, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
+
+ /// Gets the size of the module list.
+ ///
+ /// \return
+ /// The number of modules in the module list.
+ size_t GetSize() const;
+
+ bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
+ Stream *feedback_stream = nullptr,
+ bool continue_on_error = true);
+
+ static ModuleListProperties &GetGlobalModuleListProperties();
+
+ static bool ModuleIsInCache(const Module *module_ptr);
+
+ 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);
+
+ static size_t FindSharedModules(const ModuleSpec &module_spec,
+ ModuleList &matching_module_list);
+
+ static size_t RemoveOrphanSharedModules(bool mandatory);
+
+ static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr);
+
+ void ForEach(std::function<bool(const lldb::ModuleSP &module_sp)> const
+ &callback) const;
+
+protected:
+ // Class typedefs.
+ typedef std::vector<lldb::ModuleSP>
+ collection; ///< The module collection type.
+
+ void AppendImpl(const lldb::ModuleSP &module_sp, bool use_notifier = true);
+
+ bool RemoveImpl(const lldb::ModuleSP &module_sp, bool use_notifier = true);
+
+ collection::iterator RemoveImpl(collection::iterator pos,
+ bool use_notifier = true);
+
+ void ClearImpl(bool use_notifier = true);
+
+ // Member variables.
+ collection m_modules; ///< The collection of modules.
+ mutable std::recursive_mutex m_modules_mutex;
+
+ Notifier *m_notifier;
+
+public:
+ typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter,
+ std::recursive_mutex>
+ ModuleIterable;
+ ModuleIterable Modules() { return ModuleIterable(m_modules, GetMutex()); }
+
+ typedef AdaptedIterable<collection, lldb::ModuleSP, vector_adapter>
+ ModuleIterableNoLocking;
+ ModuleIterableNoLocking ModulesNoLocking() {
+ return ModuleIterableNoLocking(m_modules);
+ }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ModuleList_h_
diff --git a/linux-x64/clang/include/lldb/Core/ModuleSpec.h b/linux-x64/clang/include/lldb/Core/ModuleSpec.h
new file mode 100644
index 0000000..ab0f4e9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ModuleSpec.h
@@ -0,0 +1,425 @@
+//===-- ModuleSpec.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ModuleSpec_h_
+#define liblldb_ModuleSpec_h_
+
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Target/PathMappingList.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/UUID.h"
+
+#include "llvm/Support/Chrono.h"
+
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+
+class ModuleSpec {
+public:
+ ModuleSpec()
+ : m_file(), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(),
+ m_object_name(), m_object_offset(0), m_object_size(0),
+ m_source_mappings() {}
+
+ ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID())
+ : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),
+ m_uuid(uuid), m_object_name(), m_object_offset(0),
+ m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+ m_source_mappings() {}
+
+ ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
+ : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch),
+ m_uuid(), m_object_name(), m_object_offset(0),
+ m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+ m_source_mappings() {}
+
+ ModuleSpec(const ModuleSpec &rhs)
+ : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file),
+ m_symbol_file(rhs.m_symbol_file), m_arch(rhs.m_arch),
+ m_uuid(rhs.m_uuid), m_object_name(rhs.m_object_name),
+ m_object_offset(rhs.m_object_offset), m_object_size(rhs.m_object_size),
+ m_object_mod_time(rhs.m_object_mod_time),
+ m_source_mappings(rhs.m_source_mappings) {}
+
+ ModuleSpec &operator=(const ModuleSpec &rhs) {
+ if (this != &rhs) {
+ m_file = rhs.m_file;
+ m_platform_file = rhs.m_platform_file;
+ m_symbol_file = rhs.m_symbol_file;
+ m_arch = rhs.m_arch;
+ m_uuid = rhs.m_uuid;
+ m_object_name = rhs.m_object_name;
+ m_object_offset = rhs.m_object_offset;
+ m_object_size = rhs.m_object_size;
+ m_object_mod_time = rhs.m_object_mod_time;
+ m_source_mappings = rhs.m_source_mappings;
+ }
+ return *this;
+ }
+
+ FileSpec *GetFileSpecPtr() { return (m_file ? &m_file : nullptr); }
+
+ const FileSpec *GetFileSpecPtr() const {
+ return (m_file ? &m_file : nullptr);
+ }
+
+ FileSpec &GetFileSpec() { return m_file; }
+
+ const FileSpec &GetFileSpec() const { return m_file; }
+
+ FileSpec *GetPlatformFileSpecPtr() {
+ return (m_platform_file ? &m_platform_file : nullptr);
+ }
+
+ const FileSpec *GetPlatformFileSpecPtr() const {
+ return (m_platform_file ? &m_platform_file : nullptr);
+ }
+
+ FileSpec &GetPlatformFileSpec() { return m_platform_file; }
+
+ const FileSpec &GetPlatformFileSpec() const { return m_platform_file; }
+
+ FileSpec *GetSymbolFileSpecPtr() {
+ return (m_symbol_file ? &m_symbol_file : nullptr);
+ }
+
+ const FileSpec *GetSymbolFileSpecPtr() const {
+ return (m_symbol_file ? &m_symbol_file : nullptr);
+ }
+
+ FileSpec &GetSymbolFileSpec() { return m_symbol_file; }
+
+ const FileSpec &GetSymbolFileSpec() const { return m_symbol_file; }
+
+ ArchSpec *GetArchitecturePtr() {
+ return (m_arch.IsValid() ? &m_arch : nullptr);
+ }
+
+ const ArchSpec *GetArchitecturePtr() const {
+ return (m_arch.IsValid() ? &m_arch : nullptr);
+ }
+
+ ArchSpec &GetArchitecture() { return m_arch; }
+
+ const ArchSpec &GetArchitecture() const { return m_arch; }
+
+ UUID *GetUUIDPtr() { return (m_uuid.IsValid() ? &m_uuid : nullptr); }
+
+ const UUID *GetUUIDPtr() const {
+ return (m_uuid.IsValid() ? &m_uuid : nullptr);
+ }
+
+ UUID &GetUUID() { return m_uuid; }
+
+ const UUID &GetUUID() const { return m_uuid; }
+
+ ConstString &GetObjectName() { return m_object_name; }
+
+ ConstString GetObjectName() const { return m_object_name; }
+
+ uint64_t GetObjectOffset() const { return m_object_offset; }
+
+ void SetObjectOffset(uint64_t object_offset) {
+ m_object_offset = object_offset;
+ }
+
+ uint64_t GetObjectSize() const { return m_object_size; }
+
+ void SetObjectSize(uint64_t object_size) { m_object_size = object_size; }
+
+ llvm::sys::TimePoint<> &GetObjectModificationTime() {
+ return m_object_mod_time;
+ }
+
+ const llvm::sys::TimePoint<> &GetObjectModificationTime() const {
+ return m_object_mod_time;
+ }
+
+ PathMappingList &GetSourceMappingList() const { return m_source_mappings; }
+
+ void Clear() {
+ m_file.Clear();
+ m_platform_file.Clear();
+ m_symbol_file.Clear();
+ m_arch.Clear();
+ m_uuid.Clear();
+ m_object_name.Clear();
+ m_object_offset = 0;
+ m_object_size = 0;
+ m_source_mappings.Clear(false);
+ m_object_mod_time = llvm::sys::TimePoint<>();
+ }
+
+ explicit operator bool() const {
+ if (m_file)
+ return true;
+ if (m_platform_file)
+ return true;
+ if (m_symbol_file)
+ return true;
+ if (m_arch.IsValid())
+ return true;
+ if (m_uuid.IsValid())
+ return true;
+ if (m_object_name)
+ return true;
+ if (m_object_size)
+ return true;
+ if (m_object_mod_time != llvm::sys::TimePoint<>())
+ return true;
+ return false;
+ }
+
+ void Dump(Stream &strm) const {
+ bool dumped_something = false;
+ if (m_file) {
+ strm.PutCString("file = '");
+ strm << m_file;
+ strm.PutCString("'");
+ dumped_something = true;
+ }
+ if (m_platform_file) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.PutCString("platform_file = '");
+ strm << m_platform_file;
+ strm.PutCString("'");
+ dumped_something = true;
+ }
+ if (m_symbol_file) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.PutCString("symbol_file = '");
+ strm << m_symbol_file;
+ strm.PutCString("'");
+ dumped_something = true;
+ }
+ if (m_arch.IsValid()) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Printf("arch = ");
+ m_arch.DumpTriple(strm);
+ dumped_something = true;
+ }
+ if (m_uuid.IsValid()) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.PutCString("uuid = ");
+ m_uuid.Dump(&strm);
+ dumped_something = true;
+ }
+ if (m_object_name) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Printf("object_name = %s", m_object_name.GetCString());
+ dumped_something = true;
+ }
+ if (m_object_offset > 0) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Printf("object_offset = %" PRIu64, m_object_offset);
+ dumped_something = true;
+ }
+ if (m_object_size > 0) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Printf("object size = %" PRIu64, m_object_size);
+ dumped_something = true;
+ }
+ if (m_object_mod_time != llvm::sys::TimePoint<>()) {
+ if (dumped_something)
+ strm.PutCString(", ");
+ strm.Format("object_mod_time = {0:x+}",
+ uint64_t(llvm::sys::toTimeT(m_object_mod_time)));
+ }
+ }
+
+ bool Matches(const ModuleSpec &match_module_spec,
+ bool exact_arch_match) const {
+ if (match_module_spec.GetUUIDPtr() &&
+ match_module_spec.GetUUID() != GetUUID())
+ return false;
+ if (match_module_spec.GetObjectName() &&
+ match_module_spec.GetObjectName() != GetObjectName())
+ return false;
+ if (match_module_spec.GetFileSpecPtr()) {
+ const FileSpec &fspec = match_module_spec.GetFileSpec();
+ if (!FileSpec::Equal(fspec, GetFileSpec(),
+ !fspec.GetDirectory().IsEmpty()))
+ return false;
+ }
+ if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) {
+ const FileSpec &fspec = match_module_spec.GetPlatformFileSpec();
+ if (!FileSpec::Equal(fspec, GetPlatformFileSpec(),
+ !fspec.GetDirectory().IsEmpty()))
+ return false;
+ }
+ // Only match the symbol file spec if there is one in this ModuleSpec
+ if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) {
+ const FileSpec &fspec = match_module_spec.GetSymbolFileSpec();
+ if (!FileSpec::Equal(fspec, GetSymbolFileSpec(),
+ !fspec.GetDirectory().IsEmpty()))
+ return false;
+ }
+ if (match_module_spec.GetArchitecturePtr()) {
+ if (exact_arch_match) {
+ if (!GetArchitecture().IsExactMatch(
+ match_module_spec.GetArchitecture()))
+ return false;
+ } else {
+ if (!GetArchitecture().IsCompatibleMatch(
+ match_module_spec.GetArchitecture()))
+ return false;
+ }
+ }
+ return true;
+ }
+
+protected:
+ FileSpec m_file;
+ FileSpec m_platform_file;
+ FileSpec m_symbol_file;
+ ArchSpec m_arch;
+ UUID m_uuid;
+ ConstString m_object_name;
+ uint64_t m_object_offset;
+ uint64_t m_object_size;
+ llvm::sys::TimePoint<> m_object_mod_time;
+ mutable PathMappingList m_source_mappings;
+};
+
+class ModuleSpecList {
+public:
+ ModuleSpecList() : m_specs(), m_mutex() {}
+
+ ModuleSpecList(const ModuleSpecList &rhs) : m_specs(), m_mutex() {
+ std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+ std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
+ m_specs = rhs.m_specs;
+ }
+
+ ~ModuleSpecList() = default;
+
+ ModuleSpecList &operator=(const ModuleSpecList &rhs) {
+ if (this != &rhs) {
+ std::lock(m_mutex, rhs.m_mutex);
+ std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex, std::adopt_lock);
+ std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
+ std::adopt_lock);
+ m_specs = rhs.m_specs;
+ }
+ return *this;
+ }
+
+ size_t GetSize() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_specs.size();
+ }
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_specs.clear();
+ }
+
+ void Append(const ModuleSpec &spec) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_specs.push_back(spec);
+ }
+
+ void Append(const ModuleSpecList &rhs) {
+ std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+ std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
+ m_specs.insert(m_specs.end(), rhs.m_specs.begin(), rhs.m_specs.end());
+ }
+
+ // The index "i" must be valid and this can't be used in multi-threaded code
+ // as no mutex lock is taken.
+ ModuleSpec &GetModuleSpecRefAtIndex(size_t i) { return m_specs[i]; }
+
+ bool GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (i < m_specs.size()) {
+ module_spec = m_specs[i];
+ return true;
+ }
+ module_spec.Clear();
+ return false;
+ }
+
+ bool FindMatchingModuleSpec(const ModuleSpec &module_spec,
+ ModuleSpec &match_module_spec) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ bool exact_arch_match = true;
+ for (auto spec : m_specs) {
+ if (spec.Matches(module_spec, exact_arch_match)) {
+ match_module_spec = spec;
+ return true;
+ }
+ }
+
+ // If there was an architecture, retry with a compatible arch
+ if (module_spec.GetArchitecturePtr()) {
+ exact_arch_match = false;
+ for (auto spec : m_specs) {
+ if (spec.Matches(module_spec, exact_arch_match)) {
+ match_module_spec = spec;
+ return true;
+ }
+ }
+ }
+ match_module_spec.Clear();
+ return false;
+ }
+
+ size_t FindMatchingModuleSpecs(const ModuleSpec &module_spec,
+ ModuleSpecList &matching_list) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ bool exact_arch_match = true;
+ const size_t initial_match_count = matching_list.GetSize();
+ for (auto spec : m_specs) {
+ if (spec.Matches(module_spec, exact_arch_match))
+ matching_list.Append(spec);
+ }
+
+ // If there was an architecture, retry with a compatible arch if no matches
+ // were found
+ if (module_spec.GetArchitecturePtr() &&
+ (initial_match_count == matching_list.GetSize())) {
+ exact_arch_match = false;
+ for (auto spec : m_specs) {
+ if (spec.Matches(module_spec, exact_arch_match))
+ matching_list.Append(spec);
+ }
+ }
+ return matching_list.GetSize() - initial_match_count;
+ }
+
+ void Dump(Stream &strm) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ uint32_t idx = 0;
+ for (auto spec : m_specs) {
+ strm.Printf("[%u] ", idx);
+ spec.Dump(strm);
+ strm.EOL();
+ ++idx;
+ }
+ }
+
+protected:
+ typedef std::vector<ModuleSpec> collection; ///< The module collection type.
+ collection m_specs; ///< The collection of modules.
+ mutable std::recursive_mutex m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ModuleSpec_h_
diff --git a/linux-x64/clang/include/lldb/Core/Opcode.h b/linux-x64/clang/include/lldb/Core/Opcode.h
new file mode 100644
index 0000000..1a30ce4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Opcode.h
@@ -0,0 +1,273 @@
+//===-- Opcode.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Opcode_h
+#define lldb_Opcode_h
+
+#include "lldb/Utility/Endian.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "llvm/Support/MathExtras.h"
+
+#include <assert.h>
+#include <stdint.h>
+#include <string.h>
+
+namespace lldb {
+class SBInstruction;
+}
+
+namespace lldb_private {
+class DataExtractor;
+class Stream;
+
+class Opcode {
+public:
+ enum Type {
+ eTypeInvalid,
+ eType8,
+ eType16,
+ eType16_2, // a 32-bit Thumb instruction, made up of two words
+ eType32,
+ eType64,
+ eTypeBytes
+ };
+
+ Opcode() : m_byte_order(lldb::eByteOrderInvalid), m_type(eTypeInvalid) {}
+
+ Opcode(uint8_t inst, lldb::ByteOrder order)
+ : m_byte_order(order), m_type(eType8) {
+ m_data.inst8 = inst;
+ }
+
+ Opcode(uint16_t inst, lldb::ByteOrder order)
+ : m_byte_order(order), m_type(eType16) {
+ m_data.inst16 = inst;
+ }
+
+ Opcode(uint32_t inst, lldb::ByteOrder order)
+ : m_byte_order(order), m_type(eType32) {
+ m_data.inst32 = inst;
+ }
+
+ Opcode(uint64_t inst, lldb::ByteOrder order)
+ : m_byte_order(order), m_type(eType64) {
+ m_data.inst64 = inst;
+ }
+
+ Opcode(uint8_t *bytes, size_t length)
+ : m_byte_order(lldb::eByteOrderInvalid) {
+ SetOpcodeBytes(bytes, length);
+ }
+
+ void Clear() {
+ m_byte_order = lldb::eByteOrderInvalid;
+ m_type = Opcode::eTypeInvalid;
+ }
+
+ Opcode::Type GetType() const { return m_type; }
+
+ uint8_t GetOpcode8(uint8_t invalid_opcode = UINT8_MAX) const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return m_data.inst8;
+ case Opcode::eType16:
+ break;
+ case Opcode::eType16_2:
+ break;
+ case Opcode::eType32:
+ break;
+ case Opcode::eType64:
+ break;
+ case Opcode::eTypeBytes:
+ break;
+ }
+ return invalid_opcode;
+ }
+
+ uint16_t GetOpcode16(uint16_t invalid_opcode = UINT16_MAX) const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return m_data.inst8;
+ case Opcode::eType16:
+ return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : m_data.inst16;
+ case Opcode::eType16_2:
+ break;
+ case Opcode::eType32:
+ break;
+ case Opcode::eType64:
+ break;
+ case Opcode::eTypeBytes:
+ break;
+ }
+ return invalid_opcode;
+ }
+
+ uint32_t GetOpcode32(uint32_t invalid_opcode = UINT32_MAX) const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return m_data.inst8;
+ case Opcode::eType16:
+ return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : m_data.inst16;
+ case Opcode::eType16_2: // passthrough
+ case Opcode::eType32:
+ return GetEndianSwap() ? llvm::ByteSwap_32(m_data.inst32) : m_data.inst32;
+ case Opcode::eType64:
+ break;
+ case Opcode::eTypeBytes:
+ break;
+ }
+ return invalid_opcode;
+ }
+
+ uint64_t GetOpcode64(uint64_t invalid_opcode = UINT64_MAX) const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return m_data.inst8;
+ case Opcode::eType16:
+ return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : m_data.inst16;
+ case Opcode::eType16_2: // passthrough
+ case Opcode::eType32:
+ return GetEndianSwap() ? llvm::ByteSwap_32(m_data.inst32) : m_data.inst32;
+ case Opcode::eType64:
+ return GetEndianSwap() ? llvm::ByteSwap_64(m_data.inst64) : m_data.inst64;
+ case Opcode::eTypeBytes:
+ break;
+ }
+ return invalid_opcode;
+ }
+
+ void SetOpcode8(uint8_t inst, lldb::ByteOrder order) {
+ m_type = eType8;
+ m_data.inst8 = inst;
+ m_byte_order = order;
+ }
+
+ void SetOpcode16(uint16_t inst, lldb::ByteOrder order) {
+ m_type = eType16;
+ m_data.inst16 = inst;
+ m_byte_order = order;
+ }
+
+ void SetOpcode16_2(uint32_t inst, lldb::ByteOrder order) {
+ m_type = eType16_2;
+ m_data.inst32 = inst;
+ m_byte_order = order;
+ }
+
+ void SetOpcode32(uint32_t inst, lldb::ByteOrder order) {
+ m_type = eType32;
+ m_data.inst32 = inst;
+ m_byte_order = order;
+ }
+
+ void SetOpcode64(uint64_t inst, lldb::ByteOrder order) {
+ m_type = eType64;
+ m_data.inst64 = inst;
+ m_byte_order = order;
+ }
+
+ void SetOpcodeBytes(const void *bytes, size_t length) {
+ if (bytes != nullptr && length > 0) {
+ m_type = eTypeBytes;
+ m_data.inst.length = length;
+ assert(length < sizeof(m_data.inst.bytes));
+ memcpy(m_data.inst.bytes, bytes, length);
+ m_byte_order = lldb::eByteOrderInvalid;
+ } else {
+ m_type = eTypeInvalid;
+ m_data.inst.length = 0;
+ }
+ }
+
+ int Dump(Stream *s, uint32_t min_byte_width);
+
+ const void *GetOpcodeBytes() const {
+ return ((m_type == Opcode::eTypeBytes) ? m_data.inst.bytes : nullptr);
+ }
+
+ uint32_t GetByteSize() const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return sizeof(m_data.inst8);
+ case Opcode::eType16:
+ return sizeof(m_data.inst16);
+ case Opcode::eType16_2: // passthrough
+ case Opcode::eType32:
+ return sizeof(m_data.inst32);
+ case Opcode::eType64:
+ return sizeof(m_data.inst64);
+ case Opcode::eTypeBytes:
+ return m_data.inst.length;
+ }
+ return 0;
+ }
+
+ // Get the opcode exactly as it would be laid out in memory.
+ uint32_t GetData(DataExtractor &data) const;
+
+protected:
+ friend class lldb::SBInstruction;
+
+ const void *GetOpcodeDataBytes() const {
+ switch (m_type) {
+ case Opcode::eTypeInvalid:
+ break;
+ case Opcode::eType8:
+ return &m_data.inst8;
+ case Opcode::eType16:
+ return &m_data.inst16;
+ case Opcode::eType16_2: // passthrough
+ case Opcode::eType32:
+ return &m_data.inst32;
+ case Opcode::eType64:
+ return &m_data.inst64;
+ case Opcode::eTypeBytes:
+ return m_data.inst.bytes;
+ }
+ return nullptr;
+ }
+
+ lldb::ByteOrder GetDataByteOrder() const;
+
+ bool GetEndianSwap() const {
+ return (m_byte_order == lldb::eByteOrderBig &&
+ endian::InlHostByteOrder() == lldb::eByteOrderLittle) ||
+ (m_byte_order == lldb::eByteOrderLittle &&
+ endian::InlHostByteOrder() == lldb::eByteOrderBig);
+ }
+
+ lldb::ByteOrder m_byte_order;
+
+ Opcode::Type m_type;
+ union {
+ uint8_t inst8;
+ uint16_t inst16;
+ uint32_t inst32;
+ uint64_t inst64;
+ struct {
+ uint8_t bytes[16]; // This must be big enough to handle any opcode for any
+ // supported target.
+ uint8_t length;
+ } inst;
+ } m_data;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Opcode_h
diff --git a/linux-x64/clang/include/lldb/Core/PluginInterface.h b/linux-x64/clang/include/lldb/Core/PluginInterface.h
new file mode 100644
index 0000000..6e625a6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/PluginInterface.h
@@ -0,0 +1,27 @@
+//===-- PluginInterface.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PluginInterface_h_
+#define liblldb_PluginInterface_h_
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class PluginInterface {
+public:
+ virtual ~PluginInterface() {}
+
+ virtual ConstString GetPluginName() = 0;
+
+ virtual uint32_t GetPluginVersion() = 0;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_PluginInterface_h_
diff --git a/linux-x64/clang/include/lldb/Core/PluginManager.h b/linux-x64/clang/include/lldb/Core/PluginManager.h
new file mode 100644
index 0000000..1bac1e5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/PluginManager.h
@@ -0,0 +1,492 @@
+//===-- PluginManager.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PluginManager_h_
+#define liblldb_PluginManager_h_
+
+#include "lldb/Core/Architecture.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-interfaces.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class CommandInterpreter;
+class ConstString;
+class Debugger;
+class StringList;
+
+class PluginManager {
+public:
+ static void Initialize();
+
+ static void Terminate();
+
+ // ABI
+ static bool RegisterPlugin(ConstString name, const char *description,
+ ABICreateInstance create_callback);
+
+ static bool UnregisterPlugin(ABICreateInstance create_callback);
+
+ static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
+
+ static ABICreateInstance
+ GetABICreateCallbackForPluginName(ConstString name);
+
+ // Architecture
+ using ArchitectureCreateInstance =
+ std::unique_ptr<Architecture> (*)(const ArchSpec &);
+
+ static void RegisterPlugin(ConstString name,
+ llvm::StringRef description,
+ ArchitectureCreateInstance create_callback);
+
+ static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
+
+ static std::unique_ptr<Architecture>
+ CreateArchitectureInstance(const ArchSpec &arch);
+
+ // Disassembler
+ static bool RegisterPlugin(ConstString name, const char *description,
+ DisassemblerCreateInstance create_callback);
+
+ static bool UnregisterPlugin(DisassemblerCreateInstance create_callback);
+
+ static DisassemblerCreateInstance
+ GetDisassemblerCreateCallbackAtIndex(uint32_t idx);
+
+ static DisassemblerCreateInstance
+ GetDisassemblerCreateCallbackForPluginName(ConstString name);
+
+ // DynamicLoader
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ DynamicLoaderCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
+
+ static bool UnregisterPlugin(DynamicLoaderCreateInstance create_callback);
+
+ static DynamicLoaderCreateInstance
+ GetDynamicLoaderCreateCallbackAtIndex(uint32_t idx);
+
+ static DynamicLoaderCreateInstance
+ GetDynamicLoaderCreateCallbackForPluginName(ConstString name);
+
+ // JITLoader
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ JITLoaderCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
+
+ static bool UnregisterPlugin(JITLoaderCreateInstance create_callback);
+
+ static JITLoaderCreateInstance
+ GetJITLoaderCreateCallbackAtIndex(uint32_t idx);
+
+ static JITLoaderCreateInstance
+ GetJITLoaderCreateCallbackForPluginName(ConstString name);
+
+ // EmulateInstruction
+ static bool RegisterPlugin(ConstString name, const char *description,
+ EmulateInstructionCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin(EmulateInstructionCreateInstance create_callback);
+
+ static EmulateInstructionCreateInstance
+ GetEmulateInstructionCreateCallbackAtIndex(uint32_t idx);
+
+ static EmulateInstructionCreateInstance
+ GetEmulateInstructionCreateCallbackForPluginName(ConstString name);
+
+ // OperatingSystem
+ static bool RegisterPlugin(ConstString name, const char *description,
+ OperatingSystemCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback);
+
+ static bool UnregisterPlugin(OperatingSystemCreateInstance create_callback);
+
+ static OperatingSystemCreateInstance
+ GetOperatingSystemCreateCallbackAtIndex(uint32_t idx);
+
+ static OperatingSystemCreateInstance
+ GetOperatingSystemCreateCallbackForPluginName(ConstString name);
+
+ // Language
+ static bool RegisterPlugin(ConstString name, const char *description,
+ LanguageCreateInstance create_callback);
+
+ static bool UnregisterPlugin(LanguageCreateInstance create_callback);
+
+ static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx);
+
+ static LanguageCreateInstance
+ GetLanguageCreateCallbackForPluginName(ConstString name);
+
+ // LanguageRuntime
+ static bool RegisterPlugin(
+ ConstString name, const char *description,
+ LanguageRuntimeCreateInstance create_callback,
+ LanguageRuntimeGetCommandObject command_callback = nullptr,
+ LanguageRuntimeGetExceptionPrecondition precondition_callback = nullptr);
+
+ static bool UnregisterPlugin(LanguageRuntimeCreateInstance create_callback);
+
+ static LanguageRuntimeCreateInstance
+ GetLanguageRuntimeCreateCallbackAtIndex(uint32_t idx);
+
+ static LanguageRuntimeGetCommandObject
+ GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx);
+
+ static LanguageRuntimeGetExceptionPrecondition
+ GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx);
+
+ static LanguageRuntimeCreateInstance
+ GetLanguageRuntimeCreateCallbackForPluginName(ConstString name);
+
+ // SystemRuntime
+ static bool RegisterPlugin(ConstString name, const char *description,
+ SystemRuntimeCreateInstance create_callback);
+
+ static bool UnregisterPlugin(SystemRuntimeCreateInstance create_callback);
+
+ static SystemRuntimeCreateInstance
+ GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
+
+ static SystemRuntimeCreateInstance
+ GetSystemRuntimeCreateCallbackForPluginName(ConstString name);
+
+ // ObjectFile
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ ObjectFileCreateInstance create_callback,
+ ObjectFileCreateMemoryInstance create_memory_callback,
+ ObjectFileGetModuleSpecifications get_module_specifications,
+ ObjectFileSaveCore save_core = nullptr);
+
+ static bool UnregisterPlugin(ObjectFileCreateInstance create_callback);
+
+ static ObjectFileCreateInstance
+ GetObjectFileCreateCallbackAtIndex(uint32_t idx);
+
+ static ObjectFileCreateMemoryInstance
+ GetObjectFileCreateMemoryCallbackAtIndex(uint32_t idx);
+
+ static ObjectFileGetModuleSpecifications
+ GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
+
+ static ObjectFileCreateInstance
+ GetObjectFileCreateCallbackForPluginName(ConstString name);
+
+ static ObjectFileCreateMemoryInstance
+ GetObjectFileCreateMemoryCallbackForPluginName(ConstString name);
+
+ static Status SaveCore(const lldb::ProcessSP &process_sp,
+ const FileSpec &outfile);
+
+ // ObjectContainer
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ ObjectContainerCreateInstance create_callback,
+ ObjectFileGetModuleSpecifications get_module_specifications);
+
+ static bool UnregisterPlugin(ObjectContainerCreateInstance create_callback);
+
+ static ObjectContainerCreateInstance
+ GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
+
+ static ObjectContainerCreateInstance
+ GetObjectContainerCreateCallbackForPluginName(ConstString name);
+
+ static ObjectFileGetModuleSpecifications
+ GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
+
+ // Platform
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ PlatformCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
+
+ static bool UnregisterPlugin(PlatformCreateInstance create_callback);
+
+ static PlatformCreateInstance GetPlatformCreateCallbackAtIndex(uint32_t idx);
+
+ static PlatformCreateInstance
+ GetPlatformCreateCallbackForPluginName(ConstString name);
+
+ static const char *GetPlatformPluginNameAtIndex(uint32_t idx);
+
+ static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
+
+ static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
+ StringList &matches);
+ // Process
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ ProcessCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
+
+ static bool UnregisterPlugin(ProcessCreateInstance create_callback);
+
+ static ProcessCreateInstance GetProcessCreateCallbackAtIndex(uint32_t idx);
+
+ static ProcessCreateInstance
+ GetProcessCreateCallbackForPluginName(ConstString name);
+
+ static const char *GetProcessPluginNameAtIndex(uint32_t idx);
+
+ static const char *GetProcessPluginDescriptionAtIndex(uint32_t idx);
+
+ // ScriptInterpreter
+ static bool RegisterPlugin(ConstString name, const char *description,
+ lldb::ScriptLanguage script_lang,
+ ScriptInterpreterCreateInstance create_callback);
+
+ static bool UnregisterPlugin(ScriptInterpreterCreateInstance create_callback);
+
+ static ScriptInterpreterCreateInstance
+ GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx);
+
+ static lldb::ScriptInterpreterSP
+ GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
+ Debugger &debugger);
+
+ // StructuredDataPlugin
+
+ /// Register a StructuredDataPlugin class along with optional
+ /// callbacks for debugger initialization and Process launch info
+ /// filtering and manipulation.
+ ///
+ /// \param[in] name
+ /// The name of the plugin.
+ ///
+ /// \param[in] description
+ /// A description string for the plugin.
+ ///
+ /// \param[in] create_callback
+ /// The callback that will be invoked to create an instance of
+ /// the callback. This may not be nullptr.
+ ///
+ /// \param[in] debugger_init_callback
+ /// An optional callback that will be made when a Debugger
+ /// instance is initialized.
+ ///
+ /// \param[in] filter_callback
+ /// An optional callback that will be invoked before LLDB
+ /// launches a process for debugging. The callback must
+ /// do the following:
+ /// 1. Only do something if the plugin's behavior is enabled.
+ /// 2. Only make changes for processes that are relevant to the
+ /// plugin. The callback gets a pointer to the Target, which
+ /// can be inspected as needed. The ProcessLaunchInfo is
+ /// provided in read-write mode, and may be modified by the
+ /// plugin if, for instance, additional environment variables
+ /// are needed to support the feature when enabled.
+ ///
+ /// \return
+ /// Returns true upon success; otherwise, false.
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ StructuredDataPluginCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr,
+ StructuredDataFilterLaunchInfo filter_callback = nullptr);
+
+ static bool
+ UnregisterPlugin(StructuredDataPluginCreateInstance create_callback);
+
+ static StructuredDataPluginCreateInstance
+ GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx);
+
+ static StructuredDataPluginCreateInstance
+ GetStructuredDataPluginCreateCallbackForPluginName(ConstString name);
+
+ static StructuredDataFilterLaunchInfo
+ GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
+ bool &iteration_complete);
+
+ // SymbolFile
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ SymbolFileCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback = nullptr);
+
+ static bool UnregisterPlugin(SymbolFileCreateInstance create_callback);
+
+ static SymbolFileCreateInstance
+ GetSymbolFileCreateCallbackAtIndex(uint32_t idx);
+
+ static SymbolFileCreateInstance
+ GetSymbolFileCreateCallbackForPluginName(ConstString name);
+
+ // SymbolVendor
+ static bool RegisterPlugin(ConstString name, const char *description,
+ SymbolVendorCreateInstance create_callback);
+
+ static bool UnregisterPlugin(SymbolVendorCreateInstance create_callback);
+
+ static SymbolVendorCreateInstance
+ GetSymbolVendorCreateCallbackAtIndex(uint32_t idx);
+
+ static SymbolVendorCreateInstance
+ GetSymbolVendorCreateCallbackForPluginName(ConstString name);
+
+ // UnwindAssembly
+ static bool RegisterPlugin(ConstString name, const char *description,
+ UnwindAssemblyCreateInstance create_callback);
+
+ static bool UnregisterPlugin(UnwindAssemblyCreateInstance create_callback);
+
+ static UnwindAssemblyCreateInstance
+ GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx);
+
+ static UnwindAssemblyCreateInstance
+ GetUnwindAssemblyCreateCallbackForPluginName(ConstString name);
+
+ // MemoryHistory
+ static bool RegisterPlugin(ConstString name, const char *description,
+ MemoryHistoryCreateInstance create_callback);
+
+ static bool UnregisterPlugin(MemoryHistoryCreateInstance create_callback);
+
+ static MemoryHistoryCreateInstance
+ GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx);
+
+ static MemoryHistoryCreateInstance
+ GetMemoryHistoryCreateCallbackForPluginName(ConstString name);
+
+ // InstrumentationRuntime
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ InstrumentationRuntimeCreateInstance create_callback,
+ InstrumentationRuntimeGetType get_type_callback);
+
+ static bool
+ UnregisterPlugin(InstrumentationRuntimeCreateInstance create_callback);
+
+ static InstrumentationRuntimeGetType
+ GetInstrumentationRuntimeGetTypeCallbackAtIndex(uint32_t idx);
+
+ static InstrumentationRuntimeCreateInstance
+ GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
+
+ static InstrumentationRuntimeCreateInstance
+ GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
+
+ // TypeSystem
+ static bool RegisterPlugin(
+ ConstString name, const char *description,
+ TypeSystemCreateInstance create_callback,
+ TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+
+ static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackAtIndex(uint32_t idx);
+
+ static TypeSystemCreateInstance
+ GetTypeSystemCreateCallbackForPluginName(ConstString name);
+
+ static TypeSystemEnumerateSupportedLanguages
+ GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
+
+ static TypeSystemEnumerateSupportedLanguages
+ GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
+ ConstString name);
+
+ // REPL
+ static bool
+ RegisterPlugin(ConstString name, const char *description,
+ REPLCreateInstance create_callback,
+ REPLEnumerateSupportedLanguages enumerate_languages_callback);
+
+ static bool UnregisterPlugin(REPLCreateInstance create_callback);
+
+ static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
+
+ static REPLCreateInstance
+ GetREPLCreateCallbackForPluginName(ConstString name);
+
+ static REPLEnumerateSupportedLanguages
+ GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
+
+ static REPLEnumerateSupportedLanguages
+ GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
+ ConstString name);
+
+ // Some plug-ins might register a DebuggerInitializeCallback callback when
+ // registering the plug-in. After a new Debugger instance is created, this
+ // DebuggerInitialize function will get called. This allows plug-ins to
+ // install Properties and do any other initialization that requires a
+ // debugger instance.
+ static void DebuggerInitialize(Debugger &debugger);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForDynamicLoaderPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForDynamicLoaderPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForPlatformPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForPlatformPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForProcessPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForProcessPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForSymbolFilePlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForSymbolFilePlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForJITLoaderPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForJITLoaderPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForOperatingSystemPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForOperatingSystemPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+
+ static lldb::OptionValuePropertiesSP
+ GetSettingForStructuredDataPlugin(Debugger &debugger,
+ ConstString setting_name);
+
+ static bool CreateSettingForStructuredDataPlugin(
+ Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
+ ConstString description, bool is_global_property);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_PluginManager_h_
diff --git a/linux-x64/clang/include/lldb/Core/RichManglingContext.h b/linux-x64/clang/include/lldb/Core/RichManglingContext.h
new file mode 100644
index 0000000..e6fa259
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/RichManglingContext.h
@@ -0,0 +1,107 @@
+//===-- RichManglingContext.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RichManglingContext_h_
+#define liblldb_RichManglingContext_h_
+
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+#include "lldb/Utility/ConstString.h"
+
+#include "llvm/ADT/Any.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Demangle/Demangle.h"
+
+namespace lldb_private {
+
+/// Uniform wrapper for access to rich mangling information from different
+/// providers. See Mangled::DemangleWithRichManglingInfo()
+class RichManglingContext {
+public:
+ RichManglingContext() : m_provider(None), m_ipd_buf_size(2048) {
+ m_ipd_buf = static_cast<char *>(std::malloc(m_ipd_buf_size));
+ m_ipd_buf[0] = '\0';
+ }
+
+ ~RichManglingContext() { std::free(m_ipd_buf); }
+
+ /// Use the ItaniumPartialDemangler to obtain rich mangling information from
+ /// the given mangled name.
+ bool FromItaniumName(ConstString mangled);
+
+ /// Use the legacy language parser implementation to obtain rich mangling
+ /// information from the given demangled name.
+ bool FromCxxMethodName(ConstString demangled);
+
+ /// If this symbol describes a constructor or destructor.
+ bool IsCtorOrDtor() const;
+
+ /// If this symbol describes a function.
+ bool IsFunction() const;
+
+ /// Get the base name of a function. This doesn't include trailing template
+ /// arguments, ie "a::b<int>" gives "b". The result will overwrite the
+ /// internal buffer. It can be obtained via GetBufferRef().
+ void ParseFunctionBaseName();
+
+ /// Get the context name for a function. For "a::b::c", this function returns
+ /// "a::b". The result will overwrite the internal buffer. It can be obtained
+ /// via GetBufferRef().
+ void ParseFunctionDeclContextName();
+
+ /// Get the entire demangled name. The result will overwrite the internal
+ /// buffer. It can be obtained via GetBufferRef().
+ void ParseFullName();
+
+ /// Obtain a StringRef to the internal buffer that holds the result of the
+ /// most recent ParseXy() operation. The next ParseXy() call invalidates it.
+ llvm::StringRef GetBufferRef() const {
+ assert(m_provider != None && "Initialize a provider first");
+ return m_buffer;
+ }
+
+private:
+ enum InfoProvider { None, ItaniumPartialDemangler, PluginCxxLanguage };
+
+ /// Selects the rich mangling info provider.
+ InfoProvider m_provider;
+
+ /// Reference to the buffer used for results of ParseXy() operations.
+ llvm::StringRef m_buffer;
+
+ /// Members for ItaniumPartialDemangler
+ llvm::ItaniumPartialDemangler m_ipd;
+ char *m_ipd_buf;
+ size_t m_ipd_buf_size;
+
+ /// Members for PluginCxxLanguage
+ /// Cannot forward declare inner class CPlusPlusLanguage::MethodName. The
+ /// respective header is in Plugins and including it from here causes cyclic
+ /// dependency. Instead keep a llvm::Any and cast it on-access in the cpp.
+ llvm::Any m_cxx_method_parser;
+
+ /// Clean up memory and set a new info provider for this instance.
+ void ResetProvider(InfoProvider new_provider);
+
+ /// Uniform handling of string buffers for ItaniumPartialDemangler.
+ void processIPDStrResult(char *ipd_res, size_t res_len);
+
+ /// Cast the given parser to the given type. Ideally we would have a type
+ /// trait to deduce \a ParserT from a given InfoProvider, but unfortunately we
+ /// can't access CPlusPlusLanguage::MethodName from within the header.
+ template <class ParserT> static ParserT *get(llvm::Any parser) {
+ assert(parser.hasValue());
+ assert(llvm::any_isa<ParserT *>(parser));
+ return llvm::any_cast<ParserT *>(parser);
+ }
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Core/STLUtils.h b/linux-x64/clang/include/lldb/Core/STLUtils.h
new file mode 100644
index 0000000..830aca3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/STLUtils.h
@@ -0,0 +1,74 @@
+//===-- STLUtils.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_STLUtils_h_
+#define liblldb_STLUtils_h_
+
+#include <string.h>
+
+#include <map>
+#include <ostream>
+#include <vector>
+
+
+// C string less than compare function object
+struct CStringCompareFunctionObject {
+ bool operator()(const char *s1, const char *s2) const {
+ return strcmp(s1, s2) < 0;
+ }
+};
+
+// C string equality function object (binary predicate).
+struct CStringEqualBinaryPredicate {
+ bool operator()(const char *s1, const char *s2) const {
+ return strcmp(s1, s2) == 0;
+ }
+};
+
+// Templated type for finding an entry in a std::map<F,S> whose value is equal
+// to something
+template <class F, class S> class ValueEquals {
+public:
+ ValueEquals(const S &val) : second_value(val) {}
+
+ // Compare the second item
+ bool operator()(std::pair<const F, S> elem) {
+ return elem.second == second_value;
+ }
+
+private:
+ S second_value;
+};
+
+template <class T>
+inline void PrintAllCollectionElements(std::ostream &s, const T &coll,
+ const char *header_cstr = nullptr,
+ const char *separator_cstr = " ") {
+ typename T::const_iterator pos;
+
+ if (header_cstr)
+ s << header_cstr;
+ for (pos = coll.begin(); pos != coll.end(); ++pos) {
+ s << *pos << separator_cstr;
+ }
+ s << std::endl;
+}
+
+// The function object below can be used to delete a STL container that
+// contains C++ object pointers.
+//
+// Usage: std::for_each(vector.begin(), vector.end(), for_each_delete());
+
+struct for_each_cplusplus_delete {
+ template <typename T> void operator()(T *ptr) { delete ptr; }
+};
+
+typedef std::vector<std::string> STLStringArray;
+typedef std::vector<const char *> CStringArray;
+
+#endif // liblldb_STLUtils_h_
diff --git a/linux-x64/clang/include/lldb/Core/SearchFilter.h b/linux-x64/clang/include/lldb/Core/SearchFilter.h
new file mode 100644
index 0000000..f38690c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/SearchFilter.h
@@ -0,0 +1,456 @@
+//===-- SearchFilter.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SearchFilter_h_
+#define liblldb_SearchFilter_h_
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Utility/StructuredData.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-forward.h"
+
+#include <stdint.h>
+
+namespace lldb_private {
+class Address;
+class Breakpoint;
+class CompileUnit;
+class Status;
+class Function;
+class ModuleList;
+class SearchFilter;
+class Stream;
+class SymbolContext;
+class Target;
+}
+
+namespace lldb_private {
+
+/// \class Searcher SearchFilter.h "lldb/Core/SearchFilter.h" Class that is
+/// driven by the SearchFilter to search the SymbolContext space of the target
+/// program.
+
+/// General Outline:
+/// Provides the callback and search depth for the SearchFilter search.
+
+class Searcher {
+public:
+ enum CallbackReturn {
+ eCallbackReturnStop = 0, // Stop the iteration
+ eCallbackReturnContinue, // Continue the iteration
+ eCallbackReturnPop // Pop one level up and continue iterating
+ };
+
+ Searcher();
+
+ virtual ~Searcher();
+
+ virtual CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context, Address *addr,
+ bool complete) = 0;
+
+ virtual lldb::SearchDepth GetDepth() = 0;
+
+ /// Prints a canonical description for the searcher to the stream \a s.
+ ///
+ /// \param[in] s
+ /// Stream to which the output is copied.
+ virtual void GetDescription(Stream *s);
+};
+
+/// \class SearchFilter SearchFilter.h "lldb/Core/SearchFilter.h" Class
+/// descends through the SymbolContext space of the target, applying a filter
+/// at each stage till it reaches the depth specified by the GetDepth method
+/// of the searcher, and calls its callback at that point.
+
+/// General Outline:
+/// Provides the callback and search depth for the SearchFilter search.
+///
+/// The search is done by cooperation between the search filter and the
+/// searcher. The search filter does the heavy work of recursing through the
+/// SymbolContext space of the target program's symbol space. The Searcher
+/// specifies the depth at which it wants its callback to be invoked. Note
+/// that since the resolution of the Searcher may be greater than that of the
+/// SearchFilter, before the Searcher qualifies an address it should pass it
+/// to "AddressPasses." The default implementation is "Everything Passes."
+
+class SearchFilter {
+public:
+ /// The basic constructor takes a Target, which gives the space to search.
+ ///
+ /// \param[in] target
+ /// The Target that provides the module list to search.
+ SearchFilter(const lldb::TargetSP &target_sp);
+
+ SearchFilter(const lldb::TargetSP &target_sp, unsigned char filterType);
+
+ virtual ~SearchFilter();
+
+ /// Call this method with a file spec to see if that spec passes the filter.
+ ///
+ /// \param[in] spec
+ /// The file spec to check against the filter.
+ /// \return
+ /// \b true if \a spec passes, and \b false otherwise.
+ virtual bool ModulePasses(const FileSpec &spec);
+
+ /// Call this method with a Module to see if that module passes the filter.
+ ///
+ /// \param[in] module
+ /// The Module to check against the filter.
+ ///
+ /// \return
+ /// \b true if \a module passes, and \b false otherwise.
+ virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
+
+ /// Call this method with a Address to see if \a address passes the filter.
+ ///
+ /// \param[in] addr
+ /// The address to check against the filter.
+ ///
+ /// \return
+ /// \b true if \a address passes, and \b false otherwise.
+ virtual bool AddressPasses(Address &addr);
+
+ /// Call this method with a FileSpec to see if \a file spec passes the
+ /// filter as the name of a compilation unit.
+ ///
+ /// \param[in] fileSpec
+ /// The file spec to check against the filter.
+ ///
+ /// \return
+ /// \b true if \a file spec passes, and \b false otherwise.
+ virtual bool CompUnitPasses(FileSpec &fileSpec);
+
+ /// Call this method with a CompileUnit to see if \a comp unit passes the
+ /// filter.
+ ///
+ /// \param[in] compUnit
+ /// The CompileUnit to check against the filter.
+ ///
+ /// \return
+ /// \b true if \a Comp Unit passes, and \b false otherwise.
+ virtual bool CompUnitPasses(CompileUnit &compUnit);
+
+ /// Call this method with a Function to see if \a function passes the
+ /// filter.
+ ///
+ /// \param[in] function
+ /// The Functions to check against the filter.
+ ///
+ /// \return
+ /// \b true if \a function passes, and \b false otherwise.
+ virtual bool FunctionPasses(Function &function);
+
+ /// Call this method to do the search using the Searcher.
+ ///
+ /// \param[in] searcher
+ /// The searcher to drive with this search.
+ ///
+ virtual void Search(Searcher &searcher);
+
+ /// Call this method to do the search using the Searcher in the module list
+ /// \a modules.
+ ///
+ /// \param[in] searcher
+ /// The searcher to drive with this search.
+ ///
+ /// \param[in] modules
+ /// The module list within which to restrict the search.
+ ///
+ virtual void SearchInModuleList(Searcher &searcher, ModuleList &modules);
+
+ /// This determines which items are REQUIRED for the filter to pass. For
+ /// instance, if you are filtering by Compilation Unit, obviously symbols
+ /// that have no compilation unit can't pass So return eSymbolContextCU and
+ /// search callbacks can then short cut the search to avoid looking at
+ /// things that obviously won't pass.
+ ///
+ /// \return
+ /// The required elements for the search, which is an or'ed together
+ /// set of lldb:SearchContextItem enum's.
+ ///
+ virtual uint32_t GetFilterRequiredItems();
+
+ /// Prints a canonical description for the search filter to the stream \a s.
+ ///
+ /// \param[in] s
+ /// Stream to which the output is copied.
+ virtual void GetDescription(Stream *s);
+
+ /// Standard "Dump" method. At present it does nothing.
+ virtual void Dump(Stream *s) const;
+
+ lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
+
+ static lldb::SearchFilterSP
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ virtual StructuredData::ObjectSP SerializeToStructuredData() {
+ return StructuredData::ObjectSP();
+ }
+
+ static const char *GetSerializationKey() { return "SearchFilter"; }
+
+ static const char *GetSerializationSubclassKey() { return "Type"; }
+
+ static const char *GetSerializationSubclassOptionsKey() { return "Options"; }
+
+ enum FilterTy {
+ Unconstrained = 0,
+ Exception,
+ ByModule,
+ ByModules,
+ ByModulesAndCU,
+ LastKnownFilterType = ByModulesAndCU,
+ UnknownFilter
+ };
+
+ static const char *g_ty_to_name[LastKnownFilterType + 2];
+
+ enum FilterTy GetFilterTy() {
+ if (SubclassID > FilterTy::LastKnownFilterType)
+ return FilterTy::UnknownFilter;
+ else
+ return (enum FilterTy)SubclassID;
+ }
+
+ const char *GetFilterName() { return FilterTyToName(GetFilterTy()); }
+
+ static const char *FilterTyToName(enum FilterTy);
+
+ static FilterTy NameToFilterTy(llvm::StringRef name);
+
+protected:
+ // Serialization of SearchFilter options:
+ enum OptionNames { ModList = 0, CUList, LanguageName, LastOptionName };
+ static const char *g_option_names[LastOptionName];
+
+ static const char *GetKey(enum OptionNames enum_value) {
+ return g_option_names[enum_value];
+ }
+
+ StructuredData::DictionarySP
+ WrapOptionsDict(StructuredData::DictionarySP options_dict_sp);
+
+ void SerializeFileSpecList(StructuredData::DictionarySP &options_dict_sp,
+ OptionNames name, FileSpecList &file_list);
+
+ // These are utility functions to assist with the search iteration. They are
+ // used by the default Search method.
+
+ Searcher::CallbackReturn DoModuleIteration(const SymbolContext &context,
+ Searcher &searcher);
+
+ Searcher::CallbackReturn DoModuleIteration(const lldb::ModuleSP &module_sp,
+ Searcher &searcher);
+
+ Searcher::CallbackReturn DoCUIteration(const lldb::ModuleSP &module_sp,
+ const SymbolContext &context,
+ Searcher &searcher);
+
+ Searcher::CallbackReturn DoFunctionIteration(Function *function,
+ const SymbolContext &context,
+ Searcher &searcher);
+
+ virtual lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) = 0;
+
+ void SetTarget(lldb::TargetSP &target_sp) { m_target_sp = target_sp; }
+
+ lldb::TargetSP
+ m_target_sp; // Every filter has to be associated with a target for
+ // now since you need a starting place for the search.
+private:
+ unsigned char SubclassID;
+};
+
+/// \class SearchFilterForUnconstrainedSearches SearchFilter.h
+/// "lldb/Core/SearchFilter.h" This is a SearchFilter that searches through
+/// all modules. It also consults the
+/// Target::ModuleIsExcludedForUnconstrainedSearches.
+class SearchFilterForUnconstrainedSearches : public SearchFilter {
+public:
+ SearchFilterForUnconstrainedSearches(const lldb::TargetSP &target_sp)
+ : SearchFilter(target_sp, FilterTy::Unconstrained) {}
+
+ ~SearchFilterForUnconstrainedSearches() override = default;
+
+ bool ModulePasses(const FileSpec &module_spec) override;
+
+ bool ModulePasses(const lldb::ModuleSP &module_sp) override;
+
+ static lldb::SearchFilterSP
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+protected:
+ lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+};
+
+/// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
+/// is a SearchFilter that restricts the search to a given module.
+
+class SearchFilterByModule : public SearchFilter {
+public:
+ /// The basic constructor takes a Target, which gives the space to search,
+ /// and the module to restrict the search to.
+ ///
+ /// \param[in] target
+ /// The Target that provides the module list to search.
+ ///
+ /// \param[in] module
+ /// The Module that limits the search.
+ SearchFilterByModule(const lldb::TargetSP &targetSP, const FileSpec &module);
+
+ ~SearchFilterByModule() override;
+
+ bool ModulePasses(const lldb::ModuleSP &module_sp) override;
+
+ bool ModulePasses(const FileSpec &spec) override;
+
+ bool AddressPasses(Address &address) override;
+
+ bool CompUnitPasses(FileSpec &fileSpec) override;
+
+ bool CompUnitPasses(CompileUnit &compUnit) override;
+
+ void GetDescription(Stream *s) override;
+
+ uint32_t GetFilterRequiredItems() override;
+
+ void Dump(Stream *s) const override;
+
+ void Search(Searcher &searcher) override;
+
+ static lldb::SearchFilterSP
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+protected:
+ lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+
+private:
+ FileSpec m_module_spec;
+};
+
+class SearchFilterByModuleList : public SearchFilter {
+public:
+ /// The basic constructor takes a Target, which gives the space to search,
+ /// and the module list to restrict the search to.
+ ///
+ /// \param[in] target
+ /// The Target that provides the module list to search.
+ ///
+ /// \param[in] module
+ /// The Module that limits the search.
+ SearchFilterByModuleList(const lldb::TargetSP &targetSP,
+ const FileSpecList &module_list);
+
+ SearchFilterByModuleList(const lldb::TargetSP &targetSP,
+ const FileSpecList &module_list,
+ enum FilterTy filter_ty);
+
+ ~SearchFilterByModuleList() override;
+
+ SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs);
+
+ bool ModulePasses(const lldb::ModuleSP &module_sp) override;
+
+ bool ModulePasses(const FileSpec &spec) override;
+
+ bool AddressPasses(Address &address) override;
+
+ bool CompUnitPasses(FileSpec &fileSpec) override;
+
+ bool CompUnitPasses(CompileUnit &compUnit) override;
+
+ void GetDescription(Stream *s) override;
+
+ uint32_t GetFilterRequiredItems() override;
+
+ void Dump(Stream *s) const override;
+
+ void Search(Searcher &searcher) override;
+
+ static lldb::SearchFilterSP
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+ void SerializeUnwrapped(StructuredData::DictionarySP &options_dict_sp);
+
+protected:
+ lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+
+protected:
+ FileSpecList m_module_spec_list;
+};
+
+class SearchFilterByModuleListAndCU : public SearchFilterByModuleList {
+public:
+ /// The basic constructor takes a Target, which gives the space to search,
+ /// and the module list to restrict the search to.
+ ///
+ /// \param[in] target
+ /// The Target that provides the module list to search.
+ ///
+ /// \param[in] module
+ /// The Module that limits the search.
+ SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP,
+ const FileSpecList &module_list,
+ const FileSpecList &cu_list);
+
+ SearchFilterByModuleListAndCU(const SearchFilterByModuleListAndCU &rhs);
+
+ ~SearchFilterByModuleListAndCU() override;
+
+ SearchFilterByModuleListAndCU &
+ operator=(const SearchFilterByModuleListAndCU &rhs);
+
+ bool AddressPasses(Address &address) override;
+
+ bool CompUnitPasses(FileSpec &fileSpec) override;
+
+ bool CompUnitPasses(CompileUnit &compUnit) override;
+
+ void GetDescription(Stream *s) override;
+
+ uint32_t GetFilterRequiredItems() override;
+
+ void Dump(Stream *s) const override;
+
+ void Search(Searcher &searcher) override;
+
+ static lldb::SearchFilterSP
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+protected:
+ lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+
+private:
+ FileSpecList m_cu_spec_list;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SearchFilter_h_
diff --git a/linux-x64/clang/include/lldb/Core/Section.h b/linux-x64/clang/include/lldb/Core/Section.h
new file mode 100644
index 0000000..542849b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Section.h
@@ -0,0 +1,271 @@
+//===-- Section.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Section_h_
+#define liblldb_Section_h_
+
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <memory>
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Address;
+class DataExtractor;
+class ObjectFile;
+class Section;
+class Stream;
+class Target;
+
+class SectionList {
+public:
+ typedef std::vector<lldb::SectionSP> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ SectionList();
+
+ ~SectionList();
+
+ SectionList &operator=(const SectionList &rhs);
+
+ size_t AddSection(const lldb::SectionSP §ion_sp);
+
+ size_t AddUniqueSection(const lldb::SectionSP §ion_sp);
+
+ size_t FindSectionIndex(const Section *sect);
+
+ bool ContainsSection(lldb::user_id_t sect_id) const;
+
+ void Dump(Stream *s, Target *target, bool show_header, uint32_t depth) const;
+
+ lldb::SectionSP FindSectionByName(ConstString section_dstr) const;
+
+ lldb::SectionSP FindSectionByID(lldb::user_id_t sect_id) const;
+
+ lldb::SectionSP FindSectionByType(lldb::SectionType sect_type,
+ bool check_children,
+ size_t start_idx = 0) const;
+
+ lldb::SectionSP
+ FindSectionContainingFileAddress(lldb::addr_t addr,
+ uint32_t depth = UINT32_MAX) const;
+
+ // Get the number of sections in this list only
+ size_t GetSize() const { return m_sections.size(); }
+
+ // Get the number of sections in this list, and any contained child sections
+ size_t GetNumSections(uint32_t depth) const;
+
+ bool ReplaceSection(lldb::user_id_t sect_id,
+ const lldb::SectionSP §ion_sp,
+ uint32_t depth = UINT32_MAX);
+
+ // Warning, this can be slow as it's removing items from a std::vector.
+ bool DeleteSection(size_t idx);
+
+ lldb::SectionSP GetSectionAtIndex(size_t idx) const;
+
+ size_t Slide(lldb::addr_t slide_amount, bool slide_children);
+
+ void Clear() { m_sections.clear(); }
+
+protected:
+ collection m_sections;
+};
+
+class Section : public std::enable_shared_from_this<Section>,
+ public ModuleChild,
+ public UserID,
+ public Flags {
+public:
+ // Create a root section (one that has no parent)
+ Section(const lldb::ModuleSP &module_sp, ObjectFile *obj_file,
+ lldb::user_id_t sect_id, ConstString name,
+ lldb::SectionType sect_type, lldb::addr_t file_vm_addr,
+ lldb::addr_t vm_size, lldb::offset_t file_offset,
+ lldb::offset_t file_size, uint32_t log2align, uint32_t flags,
+ uint32_t target_byte_size = 1);
+
+ // Create a section that is a child of parent_section_sp
+ Section(const lldb::SectionSP &parent_section_sp, // NULL for top level
+ // sections, non-NULL for
+ // child sections
+ const lldb::ModuleSP &module_sp, ObjectFile *obj_file,
+ lldb::user_id_t sect_id, ConstString name,
+ lldb::SectionType sect_type, lldb::addr_t file_vm_addr,
+ lldb::addr_t vm_size, lldb::offset_t file_offset,
+ lldb::offset_t file_size, uint32_t log2align, uint32_t flags,
+ uint32_t target_byte_size = 1);
+
+ ~Section();
+
+ static int Compare(const Section &a, const Section &b);
+
+ bool ContainsFileAddress(lldb::addr_t vm_addr) const;
+
+ SectionList &GetChildren() { return m_children; }
+
+ const SectionList &GetChildren() const { return m_children; }
+
+ void Dump(Stream *s, Target *target, uint32_t depth) const;
+
+ void DumpName(Stream *s) const;
+
+ lldb::addr_t GetLoadBaseAddress(Target *target) 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; }
+
+ void SetFileOffset(lldb::offset_t file_offset) {
+ m_file_offset = file_offset;
+ }
+
+ lldb::offset_t GetFileSize() const { return m_file_size; }
+
+ void SetFileSize(lldb::offset_t file_size) { m_file_size = file_size; }
+
+ lldb::addr_t GetFileAddress() const;
+
+ bool SetFileAddress(lldb::addr_t file_addr);
+
+ lldb::addr_t GetOffset() const;
+
+ lldb::addr_t GetByteSize() const { return m_byte_size; }
+
+ void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
+
+ bool IsFake() const { return m_fake; }
+
+ void SetIsFake(bool fake) { m_fake = fake; }
+
+ bool IsEncrypted() const { return m_encrypted; }
+
+ void SetIsEncrypted(bool b) { m_encrypted = b; }
+
+ bool IsDescendant(const Section *section);
+
+ ConstString GetName() const { return m_name; }
+
+ bool Slide(lldb::addr_t slide_amount, bool slide_children);
+
+ lldb::SectionType GetType() const { return m_type; }
+
+ const char *GetTypeAsCString() const;
+
+ lldb::SectionSP GetParent() const { return m_parent_wp.lock(); }
+
+ bool IsThreadSpecific() const { return m_thread_specific; }
+
+ void SetIsThreadSpecific(bool b) { m_thread_specific = b; }
+
+ /// Get the permissions as OR'ed bits from lldb::Permissions
+ uint32_t GetPermissions() const;
+
+ /// Set the permissions using bits OR'ed from lldb::Permissions
+ void SetPermissions(uint32_t permissions);
+
+ ObjectFile *GetObjectFile() { return m_obj_file; }
+ const ObjectFile *GetObjectFile() const { return m_obj_file; }
+
+ /// Read the section data from the object file that the section
+ /// resides in.
+ ///
+ /// \param[in] dst
+ /// Where to place the data
+ ///
+ /// \param[in] dst_len
+ /// How many bytes of section data to read
+ ///
+ /// \param[in] offset
+ /// The offset in bytes within this section's data at which to
+ /// start copying data from.
+ ///
+ /// \return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ lldb::offset_t GetSectionData(void *dst, lldb::offset_t dst_len,
+ lldb::offset_t offset = 0);
+
+ /// Get the shared reference to the section data from the object
+ /// file that the section resides in. No copies of the data will be
+ /// make unless the object file has been read from memory. If the
+ /// object file is on disk, it will shared the mmap data for the
+ /// entire object file.
+ ///
+ /// \param[in] data
+ /// Where to place the data, address byte size, and byte order
+ ///
+ /// \return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ lldb::offset_t GetSectionData(DataExtractor &data);
+
+ uint32_t GetLog2Align() { return m_log2align; }
+
+ void SetLog2Align(uint32_t align) { m_log2align = align; }
+
+ // Get the number of host bytes required to hold a target byte
+ uint32_t GetTargetByteSize() const { return m_target_byte_size; }
+
+ bool IsRelocated() const { return m_relocated; }
+
+ void SetIsRelocated(bool b) { m_relocated = b; }
+
+protected:
+ ObjectFile *m_obj_file; // The object file that data for this section should
+ // be read from
+ lldb::SectionType m_type; // The type of this section
+ lldb::SectionWP m_parent_wp; // Weak pointer to parent section
+ ConstString m_name; // Name of this section
+ lldb::addr_t m_file_addr; // The absolute file virtual address range of this
+ // section if m_parent == NULL,
+ // offset from parent file virtual address if m_parent != NULL
+ lldb::addr_t m_byte_size; // Size in bytes that this section will occupy in
+ // memory at runtime
+ lldb::offset_t m_file_offset; // Object file offset (if any)
+ lldb::offset_t m_file_size; // Object file size (can be smaller than
+ // m_byte_size for zero filled sections...)
+ uint32_t m_log2align; // log_2(align) of the section (i.e. section has to be
+ // aligned to 2^m_log2align)
+ SectionList m_children; // Child sections
+ bool m_fake : 1, // If true, then this section only can contain the address if
+ // one of its
+ // children contains an address. This allows for gaps between the
+ // children that are contained in the address range for this section, but
+ // do not produce hits unless the children contain the address.
+ m_encrypted : 1, // Set to true if the contents are encrypted
+ m_thread_specific : 1, // This section is thread specific
+ m_readable : 1, // If this section has read permissions
+ m_writable : 1, // If this section has write permissions
+ m_executable : 1, // If this section has executable permissions
+ m_relocated : 1; // If this section has had relocations applied
+ uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size.
+ // This is specified as
+ // as a multiple number of a host bytes
+private:
+ DISALLOW_COPY_AND_ASSIGN(Section);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Section_h_
diff --git a/linux-x64/clang/include/lldb/Core/SourceManager.h b/linux-x64/clang/include/lldb/Core/SourceManager.h
new file mode 100644
index 0000000..bca8177
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/SourceManager.h
@@ -0,0 +1,167 @@
+//===-- SourceManager.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SourceManager_h_
+#define liblldb_SourceManager_h_
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+
+#include "llvm/Support/Chrono.h"
+
+#include <cstdint>
+#include <map>
+#include <memory>
+#include <stddef.h>
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+class RegularExpression;
+class Stream;
+class SymbolContextList;
+class Target;
+
+class SourceManager {
+public:
+ class File {
+ friend bool operator==(const SourceManager::File &lhs,
+ const SourceManager::File &rhs);
+
+ public:
+ File(const FileSpec &file_spec, Target *target);
+ File(const FileSpec &file_spec, lldb::DebuggerSP debugger_sp);
+ ~File() = default;
+
+ void UpdateIfNeeded();
+
+ size_t DisplaySourceLines(uint32_t line, llvm::Optional<size_t> column,
+ uint32_t context_before, uint32_t context_after,
+ Stream *s);
+ void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line,
+ uint32_t end_line,
+ std::vector<uint32_t> &match_lines);
+
+ bool GetLine(uint32_t line_no, std::string &buffer);
+
+ uint32_t GetLineOffset(uint32_t line);
+
+ bool LineIsValid(uint32_t line);
+
+ bool FileSpecMatches(const FileSpec &file_spec);
+
+ const FileSpec &GetFileSpec() { return m_file_spec; }
+
+ uint32_t GetSourceMapModificationID() const { return m_source_map_mod_id; }
+
+ const char *PeekLineData(uint32_t line);
+
+ uint32_t GetLineLength(uint32_t line, bool include_newline_chars);
+
+ uint32_t GetNumLines();
+
+ protected:
+ bool CalculateLineOffsets(uint32_t line = UINT32_MAX);
+
+ FileSpec m_file_spec_orig; // The original file spec that was used (can be
+ // different from m_file_spec)
+ FileSpec m_file_spec; // The actually file spec being used (if the target
+ // has source mappings, this might be different from
+ // m_file_spec_orig)
+
+ // Keep the modification time that this file data is valid for
+ llvm::sys::TimePoint<> m_mod_time;
+
+ // If the target uses path remappings, be sure to clear our notion of a
+ // source file if the path modification ID changes
+ uint32_t m_source_map_mod_id = 0;
+ lldb::DataBufferSP m_data_sp;
+ typedef std::vector<uint32_t> LineOffsets;
+ LineOffsets m_offsets;
+ lldb::DebuggerWP m_debugger_wp;
+
+ private:
+ void CommonInitializer(const FileSpec &file_spec, Target *target);
+ };
+
+ typedef std::shared_ptr<File> FileSP;
+
+ // The SourceFileCache class separates the source manager from the cache of
+ // source files, so the cache can be stored in the Debugger, but the source
+ // managers can be per target.
+ class SourceFileCache {
+ public:
+ SourceFileCache() = default;
+ ~SourceFileCache() = default;
+
+ void AddSourceFile(const FileSP &file_sp);
+ FileSP FindSourceFile(const FileSpec &file_spec) const;
+
+ protected:
+ typedef std::map<FileSpec, FileSP> FileCache;
+ FileCache m_file_cache;
+ };
+
+ // Constructors and Destructors
+ // A source manager can be made with a non-null target, in which case it can
+ // use the path remappings to find
+ // source files that are not in their build locations. With no target it
+ // won't be able to do this.
+ SourceManager(const lldb::DebuggerSP &debugger_sp);
+ SourceManager(const lldb::TargetSP &target_sp);
+
+ ~SourceManager();
+
+ FileSP GetLastFile() { return m_last_file_sp; }
+
+ size_t
+ DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
+ uint32_t column, uint32_t context_before,
+ uint32_t context_after,
+ const char *current_line_cstr, Stream *s,
+ const SymbolContextList *bp_locs = nullptr);
+
+ // This variant uses the last file we visited.
+ size_t DisplaySourceLinesWithLineNumbersUsingLastFile(
+ uint32_t start_line, uint32_t count, uint32_t curr_line, uint32_t column,
+ const char *current_line_cstr, Stream *s,
+ const SymbolContextList *bp_locs = nullptr);
+
+ size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse,
+ const SymbolContextList *bp_locs = nullptr);
+
+ bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line);
+
+ bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
+
+ bool DefaultFileAndLineSet() { return (m_last_file_sp.get() != nullptr); }
+
+ void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
+ uint32_t start_line, uint32_t end_line,
+ std::vector<uint32_t> &match_lines);
+
+ FileSP GetFile(const FileSpec &file_spec);
+
+protected:
+ FileSP m_last_file_sp;
+ uint32_t m_last_line;
+ uint32_t m_last_count;
+ bool m_default_set;
+ lldb::TargetWP m_target_wp;
+ lldb::DebuggerWP m_debugger_wp;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SourceManager);
+};
+
+bool operator==(const SourceManager::File &lhs, const SourceManager::File &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_SourceManager_h_
diff --git a/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h b/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h
new file mode 100644
index 0000000..6237e12
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h
@@ -0,0 +1,40 @@
+//===-- StreamAsynchronousIO.h -----------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamAsynchronousIO_h_
+#define liblldb_StreamAsynchronousIO_h_
+
+#include "lldb/Utility/Stream.h"
+
+#include <string>
+
+#include <stddef.h>
+
+namespace lldb_private {
+class Debugger;
+
+class StreamAsynchronousIO : public Stream {
+public:
+ StreamAsynchronousIO(Debugger &debugger, bool for_stdout);
+
+ ~StreamAsynchronousIO() override;
+
+ void Flush() override;
+
+protected:
+ size_t WriteImpl(const void *src, size_t src_len) override;
+
+private:
+ Debugger &m_debugger;
+ std::string m_data;
+ bool m_for_stdout;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamAsynchronousIO_h
diff --git a/linux-x64/clang/include/lldb/Core/StreamBuffer.h b/linux-x64/clang/include/lldb/Core/StreamBuffer.h
new file mode 100644
index 0000000..6c51651
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/StreamBuffer.h
@@ -0,0 +1,54 @@
+//===-- StreamBuffer.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamBuffer_h_
+#define liblldb_StreamBuffer_h_
+
+#include "lldb/Utility/Stream.h"
+#include "llvm/ADT/SmallVector.h"
+#include <stdio.h>
+#include <string>
+
+namespace lldb_private {
+
+template <unsigned N> class StreamBuffer : public Stream {
+public:
+ StreamBuffer() : Stream(0, 4, lldb::eByteOrderBig), m_packet() {}
+
+ StreamBuffer(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order)
+ : Stream(flags, addr_size, byte_order), m_packet() {}
+
+ ~StreamBuffer() override {}
+
+ void Flush() override {
+ // Nothing to do when flushing a buffer based stream...
+ }
+
+ void Clear() { m_packet.clear(); }
+
+ // Beware, this might not be NULL terminated as you can expect from
+ // StringString as there may be random bits in the llvm::SmallVector. If you
+ // are using this class to create a C string, be sure the call PutChar ('\0')
+ // after you have created your string, or use StreamString.
+ const char *GetData() const { return m_packet.data(); }
+
+ size_t GetSize() const { return m_packet.size(); }
+
+protected:
+ llvm::SmallVector<char, N> m_packet;
+
+ size_t WriteImpl(const void *s, size_t length) override {
+ if (s && length)
+ m_packet.append((const char *)s, ((const char *)s) + length);
+ return length;
+ }
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_StreamBuffer_h_
diff --git a/linux-x64/clang/include/lldb/Core/StreamFile.h b/linux-x64/clang/include/lldb/Core/StreamFile.h
new file mode 100644
index 0000000..54aeab1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/StreamFile.h
@@ -0,0 +1,58 @@
+//===-- StreamFile.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamFile_h_
+#define liblldb_StreamFile_h_
+
+#include "lldb/Host/File.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+
+#include <stdint.h>
+#include <stdio.h>
+
+namespace lldb_private {
+
+class StreamFile : public Stream {
+public:
+ // Constructors and Destructors
+ StreamFile();
+
+ StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
+
+ StreamFile(int fd, bool transfer_ownership);
+
+ StreamFile(const char *path);
+
+ StreamFile(const char *path, uint32_t options,
+ uint32_t permissions = lldb::eFilePermissionsFileDefault);
+
+ StreamFile(FILE *fh, bool transfer_ownership);
+
+ ~StreamFile() override;
+
+ File &GetFile() { return m_file; }
+
+ const File &GetFile() const { return m_file; }
+
+ void Flush() override;
+
+
+protected:
+ // Classes that inherit from StreamFile can see and modify these
+ File m_file;
+ size_t WriteImpl(const void *s, size_t length) override;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(StreamFile);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamFile_h_
diff --git a/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h b/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h
new file mode 100644
index 0000000..79a709a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h
@@ -0,0 +1,155 @@
+//===-- StructuredDataImpl.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StructuredDataImpl_h_
+#define liblldb_StructuredDataImpl_h_
+
+#include "lldb/Target/StructuredDataPlugin.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StructuredData.h"
+#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/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h
new file mode 100644
index 0000000..c485b91
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h
@@ -0,0 +1,65 @@
+//===-- ThreadSafeDenseMap.h ------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeDenseMap_h_
+#define liblldb_ThreadSafeDenseMap_h_
+
+#include <mutex>
+
+#include "llvm/ADT/DenseMap.h"
+
+
+namespace lldb_private {
+
+template <typename _KeyType, typename _ValueType,
+ typename _MutexType = std::mutex>
+class ThreadSafeDenseMap {
+public:
+ typedef llvm::DenseMap<_KeyType, _ValueType> LLVMMapType;
+
+ ThreadSafeDenseMap(unsigned map_initial_capacity = 0)
+ : m_map(map_initial_capacity), m_mutex() {}
+
+ void Insert(_KeyType k, _ValueType v) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_map.insert(std::make_pair(k, v));
+ }
+
+ void Erase(_KeyType k) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_map.erase(k);
+ }
+
+ _ValueType Lookup(_KeyType k) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ return m_map.lookup(k);
+ }
+
+ bool Lookup(_KeyType k, _ValueType &v) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ auto iter = m_map.find(k), end = m_map.end();
+ if (iter == end)
+ return false;
+ v = iter->second;
+ return true;
+ }
+
+ void Clear() {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_map.clear();
+ }
+
+protected:
+ LLVMMapType m_map;
+ _MutexType m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSafeSTLMap_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeDenseSet.h b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseSet.h
new file mode 100644
index 0000000..fbc8d3f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseSet.h
@@ -0,0 +1,55 @@
+//===-- ThreadSafeDenseSet.h ------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeDenseSet_h_
+#define liblldb_ThreadSafeDenseSet_h_
+
+#include <mutex>
+
+#include "llvm/ADT/DenseSet.h"
+
+
+namespace lldb_private {
+
+template <typename _ElementType, typename _MutexType = std::mutex>
+class ThreadSafeDenseSet {
+public:
+ typedef llvm::DenseSet<_ElementType> LLVMSetType;
+
+ ThreadSafeDenseSet(unsigned set_initial_capacity = 0)
+ : m_set(set_initial_capacity), m_mutex() {}
+
+ void Insert(_ElementType e) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_set.insert(e);
+ }
+
+ void Erase(_ElementType e) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_set.erase(e);
+ }
+
+ bool Lookup(_ElementType e) {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ return (m_set.count(e) > 0);
+ }
+
+ void Clear() {
+ std::lock_guard<_MutexType> guard(m_mutex);
+ m_set.clear();
+ }
+
+protected:
+ LLVMSetType m_set;
+ _MutexType m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSafeDenseSet_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h
new file mode 100644
index 0000000..df0208c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h
@@ -0,0 +1,128 @@
+//===-- ThreadSafeSTLMap.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeSTLMap_h_
+#define liblldb_ThreadSafeSTLMap_h_
+
+#include <map>
+#include <mutex>
+
+#include "lldb/lldb-defines.h"
+
+namespace lldb_private {
+
+template <typename _Key, typename _Tp> class ThreadSafeSTLMap {
+public:
+ typedef std::map<_Key, _Tp> collection;
+ typedef typename collection::iterator iterator;
+ typedef typename collection::const_iterator const_iterator;
+ // Constructors and Destructors
+ ThreadSafeSTLMap() : m_collection(), m_mutex() {}
+
+ ~ThreadSafeSTLMap() {}
+
+ bool IsEmpty() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.empty();
+ }
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.clear();
+ }
+
+ size_t Erase(const _Key &key) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return EraseNoLock(key);
+ }
+
+ size_t EraseNoLock(const _Key &key) { return m_collection.erase(key); }
+
+ bool GetValueForKey(const _Key &key, _Tp &value) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return GetValueForKeyNoLock(key, value);
+ }
+
+ // Call this if you have already manually locked the mutex using the
+ // GetMutex() accessor
+ bool GetValueForKeyNoLock(const _Key &key, _Tp &value) const {
+ const_iterator pos = m_collection.find(key);
+ if (pos != m_collection.end()) {
+ value = pos->second;
+ return true;
+ }
+ return false;
+ }
+
+ bool GetFirstKeyForValue(const _Tp &value, _Key &key) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return GetFirstKeyForValueNoLock(value, key);
+ }
+
+ bool GetFirstKeyForValueNoLock(const _Tp &value, _Key &key) const {
+ const_iterator pos, end = m_collection.end();
+ for (pos = m_collection.begin(); pos != end; ++pos) {
+ if (pos->second == value) {
+ key = pos->first;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool LowerBound(const _Key &key, _Key &match_key, _Tp &match_value,
+ bool decrement_if_not_equal) const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return LowerBoundNoLock(key, match_key, match_value,
+ decrement_if_not_equal);
+ }
+
+ bool LowerBoundNoLock(const _Key &key, _Key &match_key, _Tp &match_value,
+ bool decrement_if_not_equal) const {
+ const_iterator pos = m_collection.lower_bound(key);
+ if (pos != m_collection.end()) {
+ match_key = pos->first;
+ if (decrement_if_not_equal && key != match_key &&
+ pos != m_collection.begin()) {
+ --pos;
+ match_key = pos->first;
+ }
+ match_value = pos->second;
+ return true;
+ }
+ return false;
+ }
+
+ iterator lower_bound_unsafe(const _Key &key) {
+ return m_collection.lower_bound(key);
+ }
+
+ void SetValueForKey(const _Key &key, const _Tp &value) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ SetValueForKeyNoLock(key, value);
+ }
+
+ // Call this if you have already manually locked the mutex using the
+ // GetMutex() accessor
+ void SetValueForKeyNoLock(const _Key &key, const _Tp &value) {
+ m_collection[key] = value;
+ }
+
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+
+private:
+ collection m_collection;
+ mutable std::recursive_mutex m_mutex;
+
+ // For ThreadSafeSTLMap only
+ DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSafeSTLMap_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h
new file mode 100644
index 0000000..e1666a6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h
@@ -0,0 +1,72 @@
+//===-- ThreadSafeSTLVector.h ------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeSTLVector_h_
+#define liblldb_ThreadSafeSTLVector_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/lldb-defines.h"
+
+namespace lldb_private {
+
+template <typename _Object> class ThreadSafeSTLVector {
+public:
+ typedef std::vector<_Object> collection;
+ typedef typename collection::iterator iterator;
+ typedef typename collection::const_iterator const_iterator;
+ // Constructors and Destructors
+ ThreadSafeSTLVector() : m_collection(), m_mutex() {}
+
+ ~ThreadSafeSTLVector() = default;
+
+ bool IsEmpty() const {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.empty();
+ }
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.clear();
+ }
+
+ size_t GetCount() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.size();
+ }
+
+ void AppendObject(_Object &object) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_collection.push_back(object);
+ }
+
+ _Object GetObject(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_collection.at(index);
+ }
+
+ void SetObject(size_t index, const _Object &object) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_collection.at(index) = object;
+ }
+
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+
+private:
+ collection m_collection;
+ mutable std::recursive_mutex m_mutex;
+
+ // For ThreadSafeSTLVector only
+ DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSafeSTLVector_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h b/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h
new file mode 100644
index 0000000..91f9681
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h
@@ -0,0 +1,61 @@
+//===-- ThreadSafeValue.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSafeValue_h_
+#define liblldb_ThreadSafeValue_h_
+
+
+#include <mutex>
+
+#include "lldb/lldb-defines.h"
+
+namespace lldb_private {
+
+template <class T> class ThreadSafeValue {
+public:
+ // Constructors and Destructors
+ ThreadSafeValue() : m_value(), m_mutex() {}
+
+ ThreadSafeValue(const T &value) : m_value(value), m_mutex() {}
+
+ ~ThreadSafeValue() {}
+
+ T GetValue() const {
+ T value;
+ {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ value = m_value;
+ }
+ return value;
+ }
+
+ // Call this if you have already manually locked the mutex using the
+ // GetMutex() accessor
+ const T &GetValueNoLock() const { return m_value; }
+
+ void SetValue(const T &value) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_value = value;
+ }
+
+ // Call this if you have already manually locked the mutex using the
+ // GetMutex() accessor
+ void SetValueNoLock(const T &value) { m_value = value; }
+
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+
+private:
+ T m_value;
+ mutable std::recursive_mutex m_mutex;
+
+ // For ThreadSafeValue only
+ DISALLOW_COPY_AND_ASSIGN(ThreadSafeValue);
+};
+
+} // namespace lldb_private
+#endif // liblldb_ThreadSafeValue_h_
diff --git a/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h b/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h
new file mode 100644
index 0000000..9949bd4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h
@@ -0,0 +1,207 @@
+//===-- UniqueCStringMap.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UniqueCStringMap_h_
+#define liblldb_UniqueCStringMap_h_
+
+#include <algorithm>
+#include <vector>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/RegularExpression.h"
+
+namespace lldb_private {
+
+// Templatized uniqued string map.
+//
+// This map is useful for mapping unique C string names to values of type T.
+// Each "const char *" name added must be unique for a given
+// C string value. ConstString::GetCString() can provide such strings.
+// Any other string table that has guaranteed unique values can also be used.
+template <typename T> class UniqueCStringMap {
+public:
+ struct Entry {
+ Entry(ConstString cstr, const T &v) : cstring(cstr), value(v) {}
+
+ ConstString cstring;
+ T value;
+ };
+
+ // Call this function multiple times to add a bunch of entries to this map,
+ // then later call UniqueCStringMap<T>::Sort() before doing any searches by
+ // name.
+ void Append(ConstString unique_cstr, const T &value) {
+ m_map.push_back(typename UniqueCStringMap<T>::Entry(unique_cstr, value));
+ }
+
+ void Append(const Entry &e) { m_map.push_back(e); }
+
+ void Clear() { m_map.clear(); }
+
+ // Get an entries by index in a variety of forms.
+ //
+ // The caller is responsible for ensuring that the collection does not change
+ // during while using the returned values.
+ bool GetValueAtIndex(uint32_t idx, T &value) const {
+ if (idx < m_map.size()) {
+ value = m_map[idx].value;
+ return true;
+ }
+ return false;
+ }
+
+ ConstString GetCStringAtIndexUnchecked(uint32_t idx) const {
+ return m_map[idx].cstring;
+ }
+
+ // Use this function if you have simple types in your map that you can easily
+ // copy when accessing values by index.
+ T GetValueAtIndexUnchecked(uint32_t idx) const { return m_map[idx].value; }
+
+ // Use this function if you have complex types in your map that you don't
+ // want to copy when accessing values by index.
+ const T &GetValueRefAtIndexUnchecked(uint32_t idx) const {
+ return m_map[idx].value;
+ }
+
+ ConstString GetCStringAtIndex(uint32_t idx) const {
+ return ((idx < m_map.size()) ? m_map[idx].cstring : ConstString());
+ }
+
+ // Find the value for the unique string in the map.
+ //
+ // Return the value for \a unique_cstr if one is found, return \a fail_value
+ // otherwise. This method works well for simple type
+ // 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(ConstString unique_cstr, T fail_value) const {
+ auto pos = llvm::lower_bound(m_map, unique_cstr, Compare());
+ if (pos != m_map.end() && pos->cstring == unique_cstr)
+ return pos->value;
+ return fail_value;
+ }
+
+ // Get a pointer to the first entry that matches "name". nullptr will be
+ // returned if there is no entry that matches "name".
+ //
+ // The caller is responsible for ensuring that the collection does not change
+ // during while using the returned pointer.
+ const Entry *FindFirstValueForName(ConstString unique_cstr) const {
+ auto pos = llvm::lower_bound(m_map, unique_cstr, Compare());
+ if (pos != m_map.end() && pos->cstring == unique_cstr)
+ return &(*pos);
+ return nullptr;
+ }
+
+ // Get a pointer to the next entry that matches "name" from a previously
+ // returned Entry pointer. nullptr will be returned if there is no subsequent
+ // entry that matches "name".
+ //
+ // The caller is responsible for ensuring that the collection does not change
+ // during while using the returned pointer.
+ const Entry *FindNextValueForName(const Entry *entry_ptr) const {
+ if (!m_map.empty()) {
+ const Entry *first_entry = &m_map[0];
+ const Entry *after_last_entry = first_entry + m_map.size();
+ const Entry *next_entry = entry_ptr + 1;
+ if (first_entry <= next_entry && next_entry < after_last_entry) {
+ if (next_entry->cstring == entry_ptr->cstring)
+ return next_entry;
+ }
+ }
+ return nullptr;
+ }
+
+ size_t GetValues(ConstString unique_cstr, std::vector<T> &values) const {
+ const size_t start_size = values.size();
+
+ for (const Entry &entry : llvm::make_range(std::equal_range(
+ m_map.begin(), m_map.end(), unique_cstr, Compare())))
+ values.push_back(entry.value);
+
+ return values.size() - start_size;
+ }
+
+ size_t GetValues(const RegularExpression ®ex,
+ std::vector<T> &values) const {
+ const size_t start_size = values.size();
+
+ const_iterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; ++pos) {
+ if (regex.Execute(pos->cstring.GetCString()))
+ values.push_back(pos->value);
+ }
+
+ return values.size() - start_size;
+ }
+
+ // Get the total number of entries in this map.
+ size_t GetSize() const { return m_map.size(); }
+
+ // Returns true if this map is empty.
+ bool IsEmpty() const { return m_map.empty(); }
+
+ // Reserve memory for at least "n" entries in the map. This is useful to call
+ // when you know you will be adding a lot of entries using
+ // UniqueCStringMap::Append() (which should be followed by a call to
+ // UniqueCStringMap::Sort()) or to UniqueCStringMap::Insert().
+ void Reserve(size_t n) { m_map.reserve(n); }
+
+ // Sort the unsorted contents in this map. A typical code flow would be:
+ // size_t approximate_num_entries = ....
+ // UniqueCStringMap<uint32_t> my_map;
+ // my_map.Reserve (approximate_num_entries);
+ // for (...)
+ // {
+ // my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
+ // }
+ // my_map.Sort();
+ void Sort() { llvm::sort(m_map.begin(), m_map.end(), Compare()); }
+
+ // Since we are using a vector to contain our items it will always double its
+ // memory consumption as things are added to the vector, so if you intend to
+ // keep a UniqueCStringMap around and have a lot of entries in the map, you
+ // will want to call this function to create a new vector and copy _only_ the
+ // exact size needed as part of the finalization of the string map.
+ void SizeToFit() {
+ if (m_map.size() < m_map.capacity()) {
+ collection temp(m_map.begin(), m_map.end());
+ m_map.swap(temp);
+ }
+ }
+
+protected:
+ struct Compare {
+ bool operator()(const Entry &lhs, const Entry &rhs) {
+ return operator()(lhs.cstring, rhs.cstring);
+ }
+
+ bool operator()(const Entry &lhs, ConstString rhs) {
+ return operator()(lhs.cstring, rhs);
+ }
+
+ bool operator()(ConstString lhs, const Entry &rhs) {
+ return operator()(lhs, rhs.cstring);
+ }
+
+ // This is only for uniqueness, not lexicographical ordering, so we can
+ // just compare pointers. *However*, comparing pointers from different
+ // allocations is UB, so we need compare their integral values instead.
+ bool operator()(ConstString lhs, ConstString rhs) {
+ return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
+ }
+ };
+ typedef std::vector<Entry> collection;
+ typedef typename collection::iterator iterator;
+ typedef typename collection::const_iterator const_iterator;
+ collection m_map;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_UniqueCStringMap_h_
diff --git a/linux-x64/clang/include/lldb/Core/UserSettingsController.h b/linux-x64/clang/include/lldb/Core/UserSettingsController.h
new file mode 100644
index 0000000..6ae3bde
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/UserSettingsController.h
@@ -0,0 +1,91 @@
+//====-- UserSettingsController.h --------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UserSettingsController_h_
+#define liblldb_UserSettingsController_h_
+
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class CommandInterpreter;
+class ConstString;
+class ExecutionContext;
+class Property;
+class Stream;
+}
+
+namespace lldb_private {
+
+class Properties {
+public:
+ Properties() : m_collection_sp() {}
+
+ Properties(const lldb::OptionValuePropertiesSP &collection_sp)
+ : m_collection_sp(collection_sp) {}
+
+ virtual ~Properties() {}
+
+ virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
+ // This function is virtual in case subclasses want to lazily implement
+ // creating the properties.
+ return m_collection_sp;
+ }
+
+ virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
+ llvm::StringRef property_path,
+ bool will_modify,
+ Status &error) const;
+
+ virtual Status SetPropertyValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op,
+ llvm::StringRef property_path,
+ llvm::StringRef value);
+
+ 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);
+
+ virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
+ Stream &strm) const;
+
+ size_t Apropos(llvm::StringRef keyword,
+ std::vector<const Property *> &matching_properties) const;
+
+ lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
+ ConstString name);
+
+ // We sometimes need to introduce a setting to enable experimental features,
+ // but then we don't want the setting for these to cause errors when the
+ // setting goes away. Add a sub-topic of the settings using this
+ // experimental name, and two things will happen. One is that settings that
+ // don't find the name will not be treated as errors. Also, if you decide to
+ // keep the settings just move them into the containing properties, and we
+ // will auto-forward the experimental settings to the real one.
+ static const char *GetExperimentalSettingsName();
+
+ static bool IsSettingExperimental(llvm::StringRef setting);
+
+protected:
+ lldb::OptionValuePropertiesSP m_collection_sp;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_UserSettingsController_h_
diff --git a/linux-x64/clang/include/lldb/Core/Value.h b/linux-x64/clang/include/lldb/Core/Value.h
new file mode 100644
index 0000000..b786e48
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/Value.h
@@ -0,0 +1,262 @@
+//===-- Value.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Value_h_
+#define liblldb_Value_h_
+
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/Scalar.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-private-types.h"
+
+#include "llvm/ADT/APInt.h"
+
+#include <vector>
+
+#include <stdint.h>
+#include <string.h>
+
+namespace lldb_private {
+class DataExtractor;
+class ExecutionContext;
+class Module;
+class Stream;
+class Type;
+class Variable;
+}
+
+namespace lldb_private {
+
+class Value {
+public:
+ // Values Less than zero are an error, greater than or equal to zero returns
+ // what the Scalar result is.
+ enum ValueType {
+ // m_value contains...
+ // ============================
+ eValueTypeScalar, // raw scalar value
+ eValueTypeVector, // byte array of m_vector.length with endianness of
+ // m_vector.byte_order
+ eValueTypeFileAddress, // file address value
+ eValueTypeLoadAddress, // load address value
+ eValueTypeHostAddress // host address value (for memory in the process that
+ // is using liblldb)
+ };
+
+ enum ContextType // Type that describes Value::m_context
+ {
+ // m_context contains...
+ // ====================
+ eContextTypeInvalid, // undefined
+ eContextTypeRegisterInfo, // RegisterInfo * (can be a scalar or a vector
+ // register)
+ eContextTypeLLDBType, // lldb_private::Type *
+ eContextTypeVariable // lldb_private::Variable *
+ };
+
+ const static size_t kMaxByteSize = 32u;
+
+ struct Vector {
+ // The byte array must be big enough to hold vector registers for any
+ // supported target.
+ uint8_t bytes[kMaxByteSize];
+ size_t length;
+ lldb::ByteOrder byte_order;
+
+ Vector() : length(0), byte_order(lldb::eByteOrderInvalid) {}
+
+ Vector(const Vector &vector) { *this = vector; }
+ const Vector &operator=(const Vector &vector) {
+ SetBytes(vector.bytes, vector.length, vector.byte_order);
+ return *this;
+ }
+
+ void Clear() { length = 0; }
+
+ bool SetBytes(const void *bytes, size_t length,
+ lldb::ByteOrder byte_order) {
+ this->length = length;
+ this->byte_order = byte_order;
+ if (length)
+ ::memcpy(this->bytes, bytes,
+ length < kMaxByteSize ? length : kMaxByteSize);
+ return IsValid();
+ }
+
+ bool IsValid() const {
+ return (length > 0 && length < kMaxByteSize &&
+ byte_order != lldb::eByteOrderInvalid);
+ }
+ // Casts a vector, if valid, to an unsigned int of matching or largest
+ // supported size. Truncates to the beginning of the vector if required.
+ // Returns a default constructed Scalar if the Vector data is internally
+ // inconsistent.
+ llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
+ ((type128 *)bytes)->x);
+ Scalar GetAsScalar() const {
+ Scalar scalar;
+ if (IsValid()) {
+ if (length == 1)
+ scalar = *(const uint8_t *)bytes;
+ else if (length == 2)
+ scalar = *(const uint16_t *)bytes;
+ else if (length == 4)
+ scalar = *(const uint32_t *)bytes;
+ else if (length == 8)
+ scalar = *(const uint64_t *)bytes;
+ else if (length >= 16)
+ scalar = rhs;
+ }
+ return scalar;
+ }
+ };
+
+ Value();
+ Value(const Scalar &scalar);
+ Value(const Vector &vector);
+ Value(const void *bytes, int len);
+ Value(const Value &rhs);
+
+ void SetBytes(const void *bytes, int len);
+
+ void AppendBytes(const void *bytes, int len);
+
+ Value &operator=(const Value &rhs);
+
+ const CompilerType &GetCompilerType();
+
+ void SetCompilerType(const CompilerType &compiler_type);
+
+ ValueType GetValueType() const;
+
+ AddressType GetValueAddressType() const;
+
+ ContextType GetContextType() const { return m_context_type; }
+
+ void SetValueType(ValueType value_type) { m_value_type = value_type; }
+
+ void ClearContext() {
+ m_context = nullptr;
+ m_context_type = eContextTypeInvalid;
+ }
+
+ void SetContext(ContextType context_type, void *p) {
+ m_context_type = context_type;
+ m_context = p;
+ if (m_context_type == eContextTypeRegisterInfo) {
+ RegisterInfo *reg_info = GetRegisterInfo();
+ if (reg_info->encoding == lldb::eEncodingVector &&
+ m_vector.byte_order != lldb::eByteOrderInvalid)
+ SetValueType(eValueTypeScalar);
+ }
+ }
+
+ RegisterInfo *GetRegisterInfo() const;
+
+ Type *GetType();
+
+ Scalar &ResolveValue(ExecutionContext *exe_ctx);
+
+ const Scalar &GetScalar() const { return m_value; }
+
+ const Vector &GetVector() const { return m_vector; }
+
+ Scalar &GetScalar() { return m_value; }
+
+ Vector &GetVector() { return m_vector; }
+
+ bool SetVectorBytes(const Vector &vector) {
+ m_vector = vector;
+ return m_vector.IsValid();
+ }
+
+ bool SetVectorBytes(uint8_t *bytes, size_t length,
+ lldb::ByteOrder byte_order) {
+ return m_vector.SetBytes(bytes, length, byte_order);
+ }
+
+ bool SetScalarFromVector() {
+ if (m_vector.IsValid()) {
+ m_value = m_vector.GetAsScalar();
+ return true;
+ }
+ return false;
+ }
+
+ size_t ResizeData(size_t len);
+
+ size_t AppendDataToHostBuffer(const Value &rhs);
+
+ DataBufferHeap &GetBuffer() { return m_data_buffer; }
+
+ const DataBufferHeap &GetBuffer() const { return m_data_buffer; }
+
+ bool ValueOf(ExecutionContext *exe_ctx);
+
+ Variable *GetVariable();
+
+ void Dump(Stream *strm);
+
+ lldb::Format GetValueDefaultFormat();
+
+ uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
+
+ Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
+ uint32_t data_offset,
+ Module *module); // Can be nullptr
+
+ static const char *GetValueTypeAsCString(ValueType context_type);
+
+ static const char *GetContextTypeAsCString(ContextType context_type);
+
+ /// Convert this value's file address to a load address, if possible.
+ void ConvertToLoadAddress(Module *module, Target *target);
+
+ bool GetData(DataExtractor &data);
+
+ void Clear();
+
+protected:
+ Scalar m_value;
+ Vector m_vector;
+ CompilerType m_compiler_type;
+ void *m_context;
+ ValueType m_value_type;
+ ContextType m_context_type;
+ DataBufferHeap m_data_buffer;
+};
+
+class ValueList {
+public:
+ ValueList() : m_values() {}
+
+ ValueList(const ValueList &rhs);
+
+ ~ValueList() = default;
+
+ const ValueList &operator=(const ValueList &rhs);
+
+ // void InsertValue (Value *value, size_t idx);
+ void PushValue(const Value &value);
+
+ size_t GetSize();
+ Value *GetValueAtIndex(size_t idx);
+ void Clear();
+
+private:
+ typedef std::vector<Value> collection;
+
+ collection m_values;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Value_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObject.h b/linux-x64/clang/include/lldb/Core/ValueObject.h
new file mode 100644
index 0000000..0808b86
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObject.h
@@ -0,0 +1,1042 @@
+//===-- ValueObject.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObject_h_
+#define liblldb_ValueObject_h_
+
+#include "lldb/Core/Value.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/SharedCluster.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <functional>
+#include <initializer_list>
+#include <map>
+#include <mutex>
+#include <string>
+#include <utility>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Declaration;
+class DumpValueObjectOptions;
+class EvaluateExpressionOptions;
+class ExecutionContextScope;
+class Log;
+class Scalar;
+class Stream;
+class SymbolContextScope;
+class TypeFormatImpl;
+class TypeSummaryImpl;
+class TypeSummaryOptions;
+
+/// ValueObject:
+///
+/// This abstract class provides an interface to a particular value, be it a
+/// register, a local or global variable,
+/// that is evaluated in some particular scope. The ValueObject also has the
+/// capability of being the "child" of
+/// some other variable object, and in turn of having children.
+/// If a ValueObject is a root variable object - having no parent - then it must
+/// be constructed with respect to some
+/// particular ExecutionContextScope. If it is a child, it inherits the
+/// ExecutionContextScope from its parent.
+/// The ValueObject will update itself if necessary before fetching its value,
+/// summary, object description, etc.
+/// But it will always update itself in the ExecutionContextScope with which it
+/// was originally created.
+
+/// A brief note on life cycle management for ValueObjects. This is a little
+/// tricky because a ValueObject can contain
+/// various other ValueObjects - the Dynamic Value, its children, the
+/// dereference value, etc. Any one of these can be
+/// handed out as a shared pointer, but for that contained value object to be
+/// valid, the root object and potentially other
+/// of the value objects need to stay around.
+/// We solve this problem by handing out shared pointers to the Value Object and
+/// any of its dependents using a shared
+/// ClusterManager. This treats each shared pointer handed out for the entire
+/// cluster as a reference to the whole
+/// cluster. The whole cluster will stay around until the last reference is
+/// released.
+///
+/// The ValueObject mostly handle this automatically, if a value object is made
+/// with a Parent ValueObject, then it adds
+/// itself to the ClusterManager of the parent.
+
+/// It does mean that external to the ValueObjects we should only ever make
+/// available ValueObjectSP's, never ValueObjects
+/// or pointers to them. So all the "Root level" ValueObject derived
+/// constructors should be private, and
+/// should implement a Create function that new's up object and returns a Shared
+/// Pointer that it gets from the GetSP() method.
+///
+/// However, if you are making an derived ValueObject that will be contained in
+/// a parent value object, you should just
+/// hold onto a pointer to it internally, and by virtue of passing the parent
+/// ValueObject into its constructor, it will
+/// be added to the ClusterManager for the parent. Then if you ever hand out a
+/// Shared Pointer to the contained ValueObject,
+/// just do so by calling GetSP() on the contained object.
+
+class ValueObject : public UserID {
+public:
+ enum GetExpressionPathFormat {
+ eGetExpressionPathFormatDereferencePointers = 1,
+ eGetExpressionPathFormatHonorPointers
+ };
+
+ enum ValueObjectRepresentationStyle {
+ eValueObjectRepresentationStyleValue = 1,
+ eValueObjectRepresentationStyleSummary,
+ eValueObjectRepresentationStyleLanguageSpecific,
+ eValueObjectRepresentationStyleLocation,
+ eValueObjectRepresentationStyleChildrenCount,
+ eValueObjectRepresentationStyleType,
+ eValueObjectRepresentationStyleName,
+ eValueObjectRepresentationStyleExpressionPath
+ };
+
+ enum ExpressionPathScanEndReason {
+ eExpressionPathScanEndReasonEndOfString = 1, // out of data to parse
+ eExpressionPathScanEndReasonNoSuchChild, // child element not found
+ eExpressionPathScanEndReasonNoSuchSyntheticChild, // (synthetic) child
+ // element not found
+ eExpressionPathScanEndReasonEmptyRangeNotAllowed, // [] only allowed for
+ // arrays
+ eExpressionPathScanEndReasonDotInsteadOfArrow, // . used when -> should be
+ // used
+ eExpressionPathScanEndReasonArrowInsteadOfDot, // -> used when . should be
+ // used
+ eExpressionPathScanEndReasonFragileIVarNotAllowed, // ObjC ivar expansion
+ // not allowed
+ eExpressionPathScanEndReasonRangeOperatorNotAllowed, // [] not allowed by
+ // options
+ eExpressionPathScanEndReasonRangeOperatorInvalid, // [] not valid on objects
+ // other than scalars,
+ // pointers or arrays
+ eExpressionPathScanEndReasonArrayRangeOperatorMet, // [] is good for arrays,
+ // but I cannot parse it
+ eExpressionPathScanEndReasonBitfieldRangeOperatorMet, // [] is good for
+ // bitfields, but I
+ // cannot parse after
+ // it
+ eExpressionPathScanEndReasonUnexpectedSymbol, // something is malformed in
+ // the expression
+ eExpressionPathScanEndReasonTakingAddressFailed, // impossible to apply &
+ // operator
+ eExpressionPathScanEndReasonDereferencingFailed, // impossible to apply *
+ // operator
+ eExpressionPathScanEndReasonRangeOperatorExpanded, // [] was expanded into a
+ // VOList
+ eExpressionPathScanEndReasonSyntheticValueMissing, // getting the synthetic
+ // children failed
+ eExpressionPathScanEndReasonUnknown = 0xFFFF
+ };
+
+ enum ExpressionPathEndResultType {
+ eExpressionPathEndResultTypePlain = 1, // anything but...
+ eExpressionPathEndResultTypeBitfield, // a bitfield
+ eExpressionPathEndResultTypeBoundedRange, // a range [low-high]
+ eExpressionPathEndResultTypeUnboundedRange, // a range []
+ eExpressionPathEndResultTypeValueObjectList, // several items in a VOList
+ eExpressionPathEndResultTypeInvalid = 0xFFFF
+ };
+
+ enum ExpressionPathAftermath {
+ eExpressionPathAftermathNothing = 1, // just return it
+ eExpressionPathAftermathDereference, // dereference the target
+ eExpressionPathAftermathTakeAddress // take target's address
+ };
+
+ enum ClearUserVisibleDataItems {
+ eClearUserVisibleDataItemsNothing = 1u << 0,
+ eClearUserVisibleDataItemsValue = 1u << 1,
+ eClearUserVisibleDataItemsSummary = 1u << 2,
+ eClearUserVisibleDataItemsLocation = 1u << 3,
+ eClearUserVisibleDataItemsDescription = 1u << 4,
+ eClearUserVisibleDataItemsSyntheticChildren = 1u << 5,
+ eClearUserVisibleDataItemsValidator = 1u << 6,
+ eClearUserVisibleDataItemsAllStrings =
+ eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary |
+ eClearUserVisibleDataItemsLocation |
+ eClearUserVisibleDataItemsDescription,
+ eClearUserVisibleDataItemsAll = 0xFFFF
+ };
+
+ struct GetValueForExpressionPathOptions {
+ enum class SyntheticChildrenTraversal {
+ None,
+ ToSynthetic,
+ FromSynthetic,
+ Both
+ };
+
+ bool m_check_dot_vs_arrow_syntax;
+ bool m_no_fragile_ivar;
+ bool m_allow_bitfields_syntax;
+ SyntheticChildrenTraversal m_synthetic_children_traversal;
+
+ GetValueForExpressionPathOptions(
+ bool dot = false, bool no_ivar = false, bool bitfield = true,
+ SyntheticChildrenTraversal synth_traverse =
+ SyntheticChildrenTraversal::ToSynthetic)
+ : m_check_dot_vs_arrow_syntax(dot), m_no_fragile_ivar(no_ivar),
+ m_allow_bitfields_syntax(bitfield),
+ m_synthetic_children_traversal(synth_traverse) {}
+
+ GetValueForExpressionPathOptions &DoCheckDotVsArrowSyntax() {
+ m_check_dot_vs_arrow_syntax = true;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &DontCheckDotVsArrowSyntax() {
+ m_check_dot_vs_arrow_syntax = false;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &DoAllowFragileIVar() {
+ m_no_fragile_ivar = false;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &DontAllowFragileIVar() {
+ m_no_fragile_ivar = true;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &DoAllowBitfieldSyntax() {
+ m_allow_bitfields_syntax = true;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &DontAllowBitfieldSyntax() {
+ m_allow_bitfields_syntax = false;
+ return *this;
+ }
+
+ GetValueForExpressionPathOptions &
+ SetSyntheticChildrenTraversal(SyntheticChildrenTraversal traverse) {
+ m_synthetic_children_traversal = traverse;
+ return *this;
+ }
+
+ static const GetValueForExpressionPathOptions DefaultOptions() {
+ static GetValueForExpressionPathOptions g_default_options;
+
+ return g_default_options;
+ }
+ };
+
+ class EvaluationPoint {
+ public:
+ EvaluationPoint();
+
+ EvaluationPoint(ExecutionContextScope *exe_scope,
+ bool use_selected = false);
+
+ EvaluationPoint(const EvaluationPoint &rhs);
+
+ ~EvaluationPoint();
+
+ const ExecutionContextRef &GetExecutionContextRef() const {
+ return m_exe_ctx_ref;
+ }
+
+ // Set the EvaluationPoint to the values in exe_scope, Return true if the
+ // Evaluation Point changed. Since the ExecutionContextScope is always
+ // going to be valid currently, the Updated Context will also always be
+ // valid.
+
+ // bool
+ // SetContext (ExecutionContextScope *exe_scope);
+
+ void SetIsConstant() {
+ SetUpdated();
+ m_mod_id.SetInvalid();
+ }
+
+ bool IsConstant() const { return !m_mod_id.IsValid(); }
+
+ ProcessModID GetModID() const { return m_mod_id; }
+
+ void SetUpdateID(ProcessModID new_id) { m_mod_id = new_id; }
+
+ void SetNeedsUpdate() { m_needs_update = true; }
+
+ void SetUpdated();
+
+ bool NeedsUpdating(bool accept_invalid_exe_ctx) {
+ SyncWithProcessState(accept_invalid_exe_ctx);
+ return m_needs_update;
+ }
+
+ bool IsValid() {
+ const bool accept_invalid_exe_ctx = false;
+ if (!m_mod_id.IsValid())
+ return false;
+ else if (SyncWithProcessState(accept_invalid_exe_ctx)) {
+ if (!m_mod_id.IsValid())
+ return false;
+ }
+ return true;
+ }
+
+ void SetInvalid() {
+ // Use the stop id to mark us as invalid, leave the thread id and the
+ // stack id around for logging and history purposes.
+ m_mod_id.SetInvalid();
+
+ // Can't update an invalid state.
+ m_needs_update = false;
+ }
+
+ private:
+ bool SyncWithProcessState(bool accept_invalid_exe_ctx);
+
+ ProcessModID m_mod_id; // This is the stop id when this ValueObject was last
+ // evaluated.
+ ExecutionContextRef m_exe_ctx_ref;
+ bool m_needs_update;
+ };
+
+ virtual ~ValueObject();
+
+ const EvaluationPoint &GetUpdatePoint() const { return m_update_point; }
+
+ EvaluationPoint &GetUpdatePoint() { return m_update_point; }
+
+ const ExecutionContextRef &GetExecutionContextRef() const {
+ return m_update_point.GetExecutionContextRef();
+ }
+
+ lldb::TargetSP GetTargetSP() const {
+ return m_update_point.GetExecutionContextRef().GetTargetSP();
+ }
+
+ lldb::ProcessSP GetProcessSP() const {
+ return m_update_point.GetExecutionContextRef().GetProcessSP();
+ }
+
+ lldb::ThreadSP GetThreadSP() const {
+ return m_update_point.GetExecutionContextRef().GetThreadSP();
+ }
+
+ lldb::StackFrameSP GetFrameSP() const {
+ return m_update_point.GetExecutionContextRef().GetFrameSP();
+ }
+
+ void SetNeedsUpdate();
+
+ CompilerType GetCompilerType();
+
+ // this vends a TypeImpl that is useful at the SB API layer
+ virtual TypeImpl GetTypeImpl();
+
+ virtual bool CanProvideValue();
+
+ // Subclasses must implement the functions below.
+ virtual uint64_t GetByteSize() = 0;
+
+ virtual lldb::ValueType GetValueType() const = 0;
+
+ // Subclasses can implement the functions below.
+ virtual ConstString GetTypeName();
+
+ virtual ConstString GetDisplayTypeName();
+
+ virtual ConstString GetQualifiedTypeName();
+
+ virtual lldb::LanguageType GetObjectRuntimeLanguage();
+
+ virtual uint32_t
+ GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr);
+
+ virtual bool IsPointerType();
+
+ virtual bool IsArrayType();
+
+ virtual bool IsScalarType();
+
+ virtual bool IsPointerOrReferenceType();
+
+ virtual bool IsPossibleDynamicType();
+
+ bool IsNilReference();
+
+ bool IsUninitializedReference();
+
+ virtual bool IsBaseClass() { return false; }
+
+ bool IsBaseClass(uint32_t &depth);
+
+ virtual bool IsDereferenceOfParent() { return false; }
+
+ bool IsIntegerType(bool &is_signed);
+
+ virtual bool GetBaseClassPath(Stream &s);
+
+ virtual void GetExpressionPath(
+ Stream &s, bool qualify_cxx_base_classes,
+ GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);
+
+ lldb::ValueObjectSP GetValueForExpressionPath(
+ llvm::StringRef expression,
+ ExpressionPathScanEndReason *reason_to_stop = nullptr,
+ ExpressionPathEndResultType *final_value_type = nullptr,
+ const GetValueForExpressionPathOptions &options =
+ GetValueForExpressionPathOptions::DefaultOptions(),
+ ExpressionPathAftermath *final_task_on_target = nullptr);
+
+ virtual bool IsInScope() { return true; }
+
+ virtual lldb::offset_t GetByteOffset() { return 0; }
+
+ virtual uint32_t GetBitfieldBitSize() { return 0; }
+
+ virtual uint32_t GetBitfieldBitOffset() { return 0; }
+
+ bool IsBitfield() {
+ return (GetBitfieldBitSize() != 0) || (GetBitfieldBitOffset() != 0);
+ }
+
+ virtual bool IsArrayItemForPointer() { return m_is_array_item_for_pointer; }
+
+ virtual const char *GetValueAsCString();
+
+ virtual bool GetValueAsCString(const lldb_private::TypeFormatImpl &format,
+ std::string &destination);
+
+ bool GetValueAsCString(lldb::Format format, std::string &destination);
+
+ virtual uint64_t GetValueAsUnsigned(uint64_t fail_value,
+ bool *success = nullptr);
+
+ virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success = nullptr);
+
+ 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 sections of the file.
+ // This can be used for variables.
+ virtual lldb::ModuleSP GetModule();
+
+ ValueObject *GetRoot();
+
+ // Given a ValueObject, loop over itself and its parent, and its parent's
+ // parent, .. until either the given callback returns false, or you end up at
+ // a null pointer
+ ValueObject *FollowParentChain(std::function<bool(ValueObject *)>);
+
+ virtual bool GetDeclaration(Declaration &decl);
+
+ // The functions below should NOT be modified by subclasses
+ const Status &GetError();
+
+ ConstString GetName() const;
+
+ virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create);
+
+ // this will always create the children if necessary
+ lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
+ size_t *index_of_error = nullptr);
+
+ lldb::ValueObjectSP
+ 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(llvm::ArrayRef<ConstString> names,
+ ConstString *name_of_error = nullptr);
+
+ lldb::ValueObjectSP
+ GetChildAtNamePath(llvm::ArrayRef<std::pair<ConstString, bool>> names,
+ ConstString *name_of_error = nullptr);
+
+ virtual lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ bool can_create);
+
+ virtual size_t GetIndexOfChildWithName(ConstString name);
+
+ size_t GetNumChildren(uint32_t max = UINT32_MAX);
+
+ const Value &GetValue() const;
+
+ Value &GetValue();
+
+ virtual bool ResolveValue(Scalar &scalar);
+
+ // 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(Status &error);
+
+ virtual const char *GetLocationAsCString();
+
+ const char *
+ GetSummaryAsCString(lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
+
+ bool
+ GetSummaryAsCString(TypeSummaryImpl *summary_ptr, std::string &destination,
+ lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
+
+ bool GetSummaryAsCString(std::string &destination,
+ const TypeSummaryOptions &options);
+
+ bool GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
+ std::string &destination,
+ const TypeSummaryOptions &options);
+
+ std::pair<TypeValidatorResult, std::string> GetValidationStatus();
+
+ const char *GetObjectDescription();
+
+ bool HasSpecialPrintableRepresentation(
+ ValueObjectRepresentationStyle val_obj_display,
+ lldb::Format custom_format);
+
+ enum class PrintableRepresentationSpecialCases : bool {
+ eDisable = false,
+ eAllow = true
+ };
+
+ bool
+ DumpPrintableRepresentation(Stream &s,
+ ValueObjectRepresentationStyle val_obj_display =
+ eValueObjectRepresentationStyleSummary,
+ lldb::Format custom_format = lldb::eFormatInvalid,
+ PrintableRepresentationSpecialCases special =
+ PrintableRepresentationSpecialCases::eAllow,
+ bool do_dump_error = true);
+ bool GetValueIsValid() const;
+
+ // If you call this on a newly created ValueObject, it will always return
+ // false.
+ bool GetValueDidChange();
+
+ bool UpdateValueIfNeeded(bool update_format = true);
+
+ bool UpdateFormatsIfNeeded();
+
+ 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(ConstString name);
+
+ virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr);
+
+ lldb::addr_t GetPointerValue(AddressType *address_type = nullptr);
+
+ lldb::ValueObjectSP GetSyntheticChild(ConstString key) const;
+
+ lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create);
+
+ lldb::ValueObjectSP GetSyntheticBitFieldChild(uint32_t from, uint32_t to,
+ bool can_create);
+
+ lldb::ValueObjectSP GetSyntheticExpressionPathChild(const char *expression,
+ bool can_create);
+
+ virtual lldb::ValueObjectSP
+ GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type,
+ bool can_create,
+ ConstString name_const_str = ConstString());
+
+ virtual lldb::ValueObjectSP
+ GetSyntheticBase(uint32_t offset, const CompilerType &type, bool can_create,
+ ConstString name_const_str = ConstString());
+
+ virtual lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType);
+
+ lldb::DynamicValueType GetDynamicValueType();
+
+ virtual lldb::ValueObjectSP GetStaticValue();
+
+ virtual lldb::ValueObjectSP GetNonSyntheticValue();
+
+ lldb::ValueObjectSP GetSyntheticValue(bool use_synthetic = true);
+
+ virtual bool HasSyntheticValue();
+
+ virtual bool IsSynthetic() { return false; }
+
+ lldb::ValueObjectSP
+ GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue,
+ bool synthValue);
+
+ virtual lldb::ValueObjectSP CreateConstantValue(ConstString name);
+
+ 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(ConstString new_name);
+
+ virtual lldb::ValueObjectSP AddressOf(Status &error);
+
+ virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; }
+
+ virtual void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
+ AddressType address_type = eAddressTypeLoad) {}
+
+ virtual lldb::ValueObjectSP Cast(const CompilerType &compiler_type);
+
+ virtual lldb::ValueObjectSP CastPointerType(const char *name,
+ CompilerType &ast_type);
+
+ virtual lldb::ValueObjectSP CastPointerType(const char *name,
+ lldb::TypeSP &type_sp);
+
+ // The backing bits of this value object were updated, clear any descriptive
+ // string, so we know we have to refetch them
+ virtual void ValueUpdated() {
+ ClearUserVisibleData(eClearUserVisibleDataItemsValue |
+ eClearUserVisibleDataItemsSummary |
+ eClearUserVisibleDataItemsDescription);
+ }
+
+ virtual bool IsDynamic() { return false; }
+
+ virtual bool DoesProvideSyntheticValue() { return false; }
+
+ virtual bool IsSyntheticChildrenGenerated();
+
+ virtual void SetSyntheticChildrenGenerated(bool b);
+
+ virtual SymbolContextScope *GetSymbolContextScope();
+
+ void Dump(Stream &s);
+
+ void Dump(Stream &s, const DumpValueObjectOptions &options);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromExpression(llvm::StringRef name,
+ llvm::StringRef expression,
+ const ExecutionContext &exe_ctx);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromExpression(llvm::StringRef name,
+ llvm::StringRef expression,
+ const ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address,
+ const ExecutionContext &exe_ctx,
+ CompilerType type);
+
+ static lldb::ValueObjectSP
+ CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data,
+ const ExecutionContext &exe_ctx, CompilerType type);
+
+ void LogValueObject(Log *log);
+
+ void LogValueObject(Log *log, const DumpValueObjectOptions &options);
+
+ lldb::ValueObjectSP Persist();
+
+ // returns true if this is a char* or a char[] if it is a char* and
+ // check_pointer is true, it also checks that the pointer is valid
+ bool IsCStringContainer(bool check_pointer = false);
+
+ std::pair<size_t, bool>
+ 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, Status &error);
+
+ virtual bool SetData(DataExtractor &data, Status &error);
+
+ virtual bool GetIsConstant() const { return m_update_point.IsConstant(); }
+
+ bool NeedsUpdating() {
+ const bool accept_invalid_exe_ctx =
+ (CanUpdateWithInvalidExecutionContext() == eLazyBoolYes);
+ return m_update_point.NeedsUpdating(accept_invalid_exe_ctx);
+ }
+
+ void SetIsConstant() { m_update_point.SetIsConstant(); }
+
+ lldb::Format GetFormat() const;
+
+ virtual void SetFormat(lldb::Format format) {
+ if (format != m_format)
+ ClearUserVisibleData(eClearUserVisibleDataItemsValue);
+ m_format = format;
+ }
+
+ virtual lldb::LanguageType GetPreferredDisplayLanguage();
+
+ void SetPreferredDisplayLanguage(lldb::LanguageType);
+
+ lldb::TypeSummaryImplSP GetSummaryFormat() {
+ UpdateFormatsIfNeeded();
+ return m_type_summary_sp;
+ }
+
+ void SetSummaryFormat(lldb::TypeSummaryImplSP format) {
+ m_type_summary_sp = format;
+ ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
+ }
+
+ lldb::TypeValidatorImplSP GetValidator() {
+ UpdateFormatsIfNeeded();
+ return m_type_validator_sp;
+ }
+
+ void SetValidator(lldb::TypeValidatorImplSP format) {
+ m_type_validator_sp = format;
+ ClearUserVisibleData(eClearUserVisibleDataItemsValidator);
+ }
+
+ void SetValueFormat(lldb::TypeFormatImplSP format) {
+ m_type_format_sp = format;
+ ClearUserVisibleData(eClearUserVisibleDataItemsValue);
+ }
+
+ lldb::TypeFormatImplSP GetValueFormat() {
+ UpdateFormatsIfNeeded();
+ return m_type_format_sp;
+ }
+
+ void SetSyntheticChildren(const lldb::SyntheticChildrenSP &synth_sp) {
+ if (synth_sp.get() == m_synthetic_children_sp.get())
+ return;
+ ClearUserVisibleData(eClearUserVisibleDataItemsSyntheticChildren);
+ m_synthetic_children_sp = synth_sp;
+ }
+
+ lldb::SyntheticChildrenSP GetSyntheticChildren() {
+ UpdateFormatsIfNeeded();
+ return m_synthetic_children_sp;
+ }
+
+ // Use GetParent for display purposes, but if you want to tell the parent to
+ // update itself then use m_parent. The ValueObjectDynamicValue's parent is
+ // not the correct parent for displaying, they are really siblings, so for
+ // display it needs to route through to its grandparent.
+ virtual ValueObject *GetParent() { return m_parent; }
+
+ virtual const ValueObject *GetParent() const { return m_parent; }
+
+ ValueObject *GetNonBaseClassParent();
+
+ void SetAddressTypeOfChildren(AddressType at) {
+ m_address_type_of_ptr_or_ref_children = at;
+ }
+
+ AddressType GetAddressTypeOfChildren();
+
+ void SetHasCompleteType() { m_did_calculate_complete_objc_class_type = true; }
+
+ /// Find out if a ValueObject might have children.
+ ///
+ /// This call is much more efficient than CalculateNumChildren() as
+ /// it doesn't need to complete the underlying type. This is designed
+ /// to be used in a UI environment in order to detect if the
+ /// disclosure triangle should be displayed or not.
+ ///
+ /// This function returns true for class, union, structure,
+ /// pointers, references, arrays and more. Again, it does so without
+ /// doing any expensive type completion.
+ ///
+ /// \return
+ /// Returns \b true if the ValueObject might have children, or \b
+ /// false otherwise.
+ virtual bool MightHaveChildren();
+
+ virtual lldb::VariableSP GetVariable() { return nullptr; }
+
+ virtual bool IsRuntimeSupportValue();
+
+ virtual uint64_t GetLanguageFlags();
+
+ virtual void SetLanguageFlags(uint64_t flags);
+
+protected:
+ typedef ClusterManager<ValueObject> ValueObjectManager;
+
+ class ChildrenManager {
+ public:
+ ChildrenManager() : m_mutex(), m_children(), m_children_count(0) {}
+
+ bool HasChildAtIndex(size_t idx) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return (m_children.find(idx) != m_children.end());
+ }
+
+ ValueObject *GetChildAtIndex(size_t idx) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ const auto iter = m_children.find(idx);
+ return ((iter == m_children.end()) ? nullptr : iter->second);
+ }
+
+ void SetChildAtIndex(size_t idx, ValueObject *valobj) {
+ // we do not need to be mutex-protected to make a pair
+ ChildrenPair pair(idx, valobj);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_children.insert(pair);
+ }
+
+ void SetChildrenCount(size_t count) { Clear(count); }
+
+ size_t GetChildrenCount() { return m_children_count; }
+
+ void Clear(size_t new_count = 0) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_children_count = new_count;
+ m_children.clear();
+ }
+
+ private:
+ typedef std::map<size_t, ValueObject *> ChildrenMap;
+ typedef ChildrenMap::iterator ChildrenIterator;
+ typedef ChildrenMap::value_type ChildrenPair;
+ std::recursive_mutex m_mutex;
+ ChildrenMap m_children;
+ size_t m_children_count;
+ };
+
+ // Classes that inherit from ValueObject can see and modify these
+ ValueObject
+ *m_parent; // The parent value object, or nullptr if this has no parent
+ ValueObject *m_root; // The root of the hierarchy for this ValueObject (or
+ // nullptr if never calculated)
+ EvaluationPoint m_update_point; // Stores both the stop id and the full
+ // context at which this value was last
+ // updated. When we are asked to update the value object, we check whether
+ // the context & stop id are the same before updating.
+ ConstString m_name; // The name of this object
+ DataExtractor
+ m_data; // A data extractor that can be used to extract the value.
+ Value m_value;
+ 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
+ // value was gotten
+ std::string m_location_str; // Cached location string that will get cleared
+ // if/when the value is updated.
+ std::string m_summary_str; // Cached summary string that will get cleared
+ // if/when the value is updated.
+ std::string m_object_desc_str; // Cached result of the "object printer". This
+ // differs from the summary
+ // in that the summary is consed up by us, the object_desc_string is builtin.
+
+ llvm::Optional<std::pair<TypeValidatorResult, std::string>>
+ m_validation_result;
+
+ CompilerType m_override_type; // If the type of the value object should be
+ // overridden, the type to impose.
+
+ ValueObjectManager *m_manager; // This object is managed by the root object
+ // (any ValueObject that gets created
+ // without a parent.) The manager gets passed through all the generations of
+ // dependent objects, and will keep the whole cluster of objects alive as
+ // long as a shared pointer to any of them has been handed out. Shared
+ // pointers to value objects must always be made with the GetSP method.
+
+ ChildrenManager m_children;
+ std::map<ConstString, ValueObject *> m_synthetic_children;
+
+ ValueObject *m_dynamic_value;
+ ValueObject *m_synthetic_value;
+ ValueObject *m_deref_valobj;
+
+ lldb::ValueObjectSP m_addr_of_valobj_sp; // We have to hold onto a shared
+ // pointer to this one because it is
+ // created
+ // as an independent ValueObjectConstResult, which isn't managed by us.
+
+ lldb::Format m_format;
+ lldb::Format m_last_format;
+ uint32_t m_last_format_mgr_revision;
+ lldb::TypeSummaryImplSP m_type_summary_sp;
+ lldb::TypeFormatImplSP m_type_format_sp;
+ lldb::SyntheticChildrenSP m_synthetic_children_sp;
+ lldb::TypeValidatorImplSP m_type_validator_sp;
+ ProcessModID m_user_id_of_forced_summary;
+ AddressType m_address_type_of_ptr_or_ref_children;
+
+ llvm::SmallVector<uint8_t, 16> m_value_checksum;
+
+ lldb::LanguageType m_preferred_display_language;
+
+ uint64_t m_language_flags;
+
+ bool m_value_is_valid : 1, m_value_did_change : 1, m_children_count_valid : 1,
+ m_old_value_valid : 1, m_is_deref_of_parent : 1,
+ m_is_array_item_for_pointer : 1, m_is_bitfield_for_scalar : 1,
+ m_is_child_at_offset : 1, m_is_getting_summary : 1,
+ m_did_calculate_complete_objc_class_type : 1,
+ m_is_synthetic_children_generated : 1;
+
+ friend class ValueObjectChild;
+ friend class ClangExpressionDeclMap; // For GetValue
+ friend class ExpressionVariable; // For SetName
+ friend class Target; // For SetName
+ friend class ValueObjectConstResultImpl;
+ friend class ValueObjectSynthetic; // For ClearUserVisibleData
+
+ // Constructors and Destructors
+
+ // Use the no-argument constructor to make a constant variable object (with
+ // no ExecutionContextScope.)
+
+ ValueObject();
+
+ // Use this constructor to create a "root variable object". The ValueObject
+ // will be locked to this context through-out its lifespan.
+
+ ValueObject(ExecutionContextScope *exe_scope,
+ AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
+
+ // Use this constructor to create a ValueObject owned by another ValueObject.
+ // It will inherit the ExecutionContext of its parent.
+
+ ValueObject(ValueObject &parent);
+
+ ValueObjectManager *GetManager() { return m_manager; }
+
+ virtual bool UpdateValue() = 0;
+
+ virtual LazyBool CanUpdateWithInvalidExecutionContext() {
+ return eLazyBoolCalculate;
+ }
+
+ virtual void CalculateDynamicValue(lldb::DynamicValueType use_dynamic);
+
+ virtual lldb::DynamicValueType GetDynamicValueTypeImpl() {
+ return lldb::eNoDynamicValues;
+ }
+
+ virtual bool HasDynamicValueTypeInfo() { return false; }
+
+ virtual void CalculateSyntheticValue(bool use_synthetic = true);
+
+ // Should only be called by ValueObject::GetChildAtIndex() Returns a
+ // ValueObject managed by this ValueObject's manager.
+ virtual ValueObject *CreateChildAtIndex(size_t idx,
+ bool synthetic_array_member,
+ int32_t synthetic_index);
+
+ // Should only be called by ValueObject::GetNumChildren()
+ virtual size_t CalculateNumChildren(uint32_t max = UINT32_MAX) = 0;
+
+ void SetNumChildren(size_t num_children);
+
+ void SetValueDidChange(bool value_changed);
+
+ void SetValueIsValid(bool valid);
+
+ void ClearUserVisibleData(
+ uint32_t items = ValueObject::eClearUserVisibleDataItemsAllStrings);
+
+ void AddSyntheticChild(ConstString key, ValueObject *valobj);
+
+ DataExtractor &GetDataExtractor();
+
+ void ClearDynamicTypeInformation();
+
+ // Subclasses must implement the functions below.
+
+ virtual CompilerType GetCompilerTypeImpl() = 0;
+
+ const char *GetLocationAsCStringImpl(const Value &value,
+ const DataExtractor &data);
+
+ bool IsChecksumEmpty();
+
+ void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType);
+
+private:
+ virtual CompilerType MaybeCalculateCompleteType();
+
+ lldb::ValueObjectSP GetValueForExpressionPath_Impl(
+ llvm::StringRef expression_cstr,
+ ExpressionPathScanEndReason *reason_to_stop,
+ ExpressionPathEndResultType *final_value_type,
+ const GetValueForExpressionPathOptions &options,
+ ExpressionPathAftermath *final_task_on_target);
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObject);
+};
+
+// A value object manager class that is seeded with the static variable value
+// and it vends the user facing value object. If the type is dynamic it can
+// vend the dynamic type. If this user type also has a synthetic type
+// associated with it, it will vend the synthetic type. The class watches the
+// process' stop
+// ID and will update the user type when needed.
+class ValueObjectManager {
+ // The root value object is the static typed variable object.
+ lldb::ValueObjectSP m_root_valobj_sp;
+ // The user value object is the value object the user wants to see.
+ lldb::ValueObjectSP m_user_valobj_sp;
+ lldb::DynamicValueType m_use_dynamic;
+ uint32_t m_stop_id; // The stop ID that m_user_valobj_sp is valid for.
+ bool m_use_synthetic;
+
+public:
+ ValueObjectManager() {}
+
+ ValueObjectManager(lldb::ValueObjectSP in_valobj_sp,
+ lldb::DynamicValueType use_dynamic, bool use_synthetic);
+
+ bool IsValid() const;
+
+ lldb::ValueObjectSP GetRootSP() const { return m_root_valobj_sp; }
+
+ // Gets the correct value object from the root object for a given process
+ // stop ID. If dynamic values are enabled, or if synthetic children are
+ // enabled, the value object that the user wants to see might change while
+ // debugging.
+ lldb::ValueObjectSP GetSP();
+
+ void SetUseDynamic(lldb::DynamicValueType use_dynamic);
+ void SetUseSynthetic(bool use_synthetic);
+ lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
+ bool GetUseSynthetic() const { return m_use_synthetic; }
+ lldb::TargetSP GetTargetSP() const;
+ lldb::ProcessSP GetProcessSP() const;
+ lldb::ThreadSP GetThreadSP() const;
+ lldb::StackFrameSP GetFrameSP() const;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObject_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectCast.h b/linux-x64/clang/include/lldb/Core/ValueObjectCast.h
new file mode 100644
index 0000000..feee493
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectCast.h
@@ -0,0 +1,65 @@
+//===-- ValueObjectCast.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectCast_h_
+#define liblldb_ValueObjectCast_h_
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class ConstString;
+
+// A ValueObject that represents a given value represented as a different type.
+class ValueObjectCast : public ValueObject {
+public:
+ ~ValueObjectCast() override;
+
+ static lldb::ValueObjectSP Create(ValueObject &parent,
+ ConstString name,
+ const CompilerType &cast_type);
+
+ uint64_t GetByteSize() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueType GetValueType() const override;
+
+ bool IsInScope() override;
+
+ ValueObject *GetParent() override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+ const ValueObject *GetParent() const override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+protected:
+ ValueObjectCast(ValueObject &parent, ConstString name,
+ const CompilerType &cast_type);
+
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ CompilerType m_cast_type;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectCast);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectCast_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectChild.h b/linux-x64/clang/include/lldb/Core/ValueObjectChild.h
new file mode 100644
index 0000000..76209a2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectChild.h
@@ -0,0 +1,96 @@
+//===-- ValueObjectChild.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectChild_h_
+#define liblldb_ValueObjectChild_h_
+
+#include "lldb/Core/ValueObject.h"
+
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/Optional.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+
+// A child of another ValueObject.
+class ValueObjectChild : public ValueObject {
+public:
+ ~ValueObjectChild() override;
+
+ uint64_t GetByteSize() override { return m_byte_size; }
+
+ lldb::offset_t GetByteOffset() override { return m_byte_offset; }
+
+ uint32_t GetBitfieldBitSize() override { return m_bitfield_bit_size; }
+
+ uint32_t GetBitfieldBitOffset() override { return m_bitfield_bit_offset; }
+
+ lldb::ValueType GetValueType() const override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ bool IsInScope() override;
+
+ bool IsBaseClass() override { return m_is_base_class; }
+
+ bool IsDereferenceOfParent() override { return m_is_deref_of_parent; }
+
+protected:
+ bool UpdateValue() override;
+
+ LazyBool CanUpdateWithInvalidExecutionContext() override;
+
+ CompilerType GetCompilerTypeImpl() override { return m_compiler_type; }
+
+ CompilerType m_compiler_type;
+ ConstString m_type_name;
+ uint64_t m_byte_size;
+ int32_t m_byte_offset;
+ uint8_t m_bitfield_bit_size;
+ uint8_t m_bitfield_bit_offset;
+ bool m_is_base_class;
+ bool m_is_deref_of_parent;
+ llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
+
+ //
+ // void
+ // ReadValueFromMemory (ValueObject* parent, lldb::addr_t address);
+
+protected:
+ friend class ValueObject;
+ friend class ValueObjectConstResult;
+ friend class ValueObjectConstResultImpl;
+
+ ValueObjectChild(ValueObject &parent, const CompilerType &compiler_type,
+ ConstString name, uint64_t byte_size,
+ int32_t byte_offset, uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, bool is_base_class,
+ bool is_deref_of_parent,
+ AddressType child_ptr_or_ref_addr_type,
+ uint64_t language_flags);
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectChild);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectChild_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h
new file mode 100644
index 0000000..3bc957e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h
@@ -0,0 +1,154 @@
+//===-- ValueObjectConstResult.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectConstResult_h_
+#define liblldb_ValueObjectConstResult_h_
+
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResultImpl.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class ExecutionContextScope;
+class Module;
+
+// A frozen ValueObject copied into host memory
+class ValueObjectConstResult : public ValueObject {
+public:
+ ~ValueObjectConstResult() override;
+
+ static lldb::ValueObjectSP
+ Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
+ uint32_t addr_byte_size, lldb::addr_t address = LLDB_INVALID_ADDRESS);
+
+ static lldb::ValueObjectSP
+ Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+ ConstString name, const DataExtractor &data,
+ lldb::addr_t address = LLDB_INVALID_ADDRESS);
+
+ static lldb::ValueObjectSP
+ Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+ ConstString name, const lldb::DataBufferSP &result_data_sp,
+ lldb::ByteOrder byte_order, uint32_t addr_size,
+ lldb::addr_t address = LLDB_INVALID_ADDRESS);
+
+ static lldb::ValueObjectSP
+ Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+ ConstString name, lldb::addr_t address,
+ AddressType address_type, uint32_t addr_byte_size);
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ Value &value, ConstString name,
+ Module *module = nullptr);
+
+ // When an expression fails to evaluate, we return an error
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ const Status &error);
+
+ uint64_t GetByteSize() override;
+
+ lldb::ValueType GetValueType() const override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ bool IsInScope() override;
+
+ void SetByteSize(size_t size);
+
+ lldb::ValueObjectSP Dereference(Status &error) override;
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+ lldb::ValueObjectSP GetSyntheticChildAtOffset(
+ uint32_t offset, const CompilerType &type, bool can_create,
+ ConstString name_const_str = ConstString()) override;
+
+ lldb::ValueObjectSP AddressOf(Status &error) override;
+
+ lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr) override;
+
+ size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
+ uint32_t item_count = 1) override;
+
+ lldb::addr_t GetLiveAddress() override { return m_impl.GetLiveAddress(); }
+
+ void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
+ AddressType address_type = eAddressTypeLoad) override {
+ m_impl.SetLiveAddress(addr, address_type);
+ }
+
+ lldb::ValueObjectSP
+ GetDynamicValue(lldb::DynamicValueType valueType) override;
+
+ lldb::LanguageType GetPreferredDisplayLanguage() override;
+
+ lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ ConstString m_type_name;
+ uint64_t m_byte_size;
+
+ ValueObjectConstResultImpl m_impl;
+
+private:
+ friend class ValueObjectConstResultImpl;
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ lldb::ByteOrder byte_order, uint32_t addr_byte_size,
+ lldb::addr_t address);
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ const CompilerType &compiler_type,
+ ConstString name, const DataExtractor &data,
+ lldb::addr_t address);
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ const CompilerType &compiler_type,
+ ConstString name,
+ const lldb::DataBufferSP &result_data_sp,
+ lldb::ByteOrder byte_order, uint32_t addr_size,
+ lldb::addr_t address);
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ const CompilerType &compiler_type,
+ ConstString name, lldb::addr_t address,
+ AddressType address_type, uint32_t addr_byte_size);
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
+ ConstString name, Module *module = nullptr);
+
+ ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error);
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectConstResult_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h
new file mode 100644
index 0000000..be9b12b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h
@@ -0,0 +1,69 @@
+//===-- ValueObjectConstResultCast.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectConstResultCast_h_
+#define liblldb_ValueObjectConstResultCast_h_
+
+#include "lldb/Core/ValueObjectCast.h"
+#include "lldb/Core/ValueObjectConstResultImpl.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class Status;
+class ValueObject;
+
+class ValueObjectConstResultCast : public ValueObjectCast {
+public:
+ ValueObjectConstResultCast(ValueObject &parent, ConstString name,
+ const CompilerType &cast_type,
+ lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
+
+ ~ValueObjectConstResultCast() override;
+
+ lldb::ValueObjectSP Dereference(Status &error) override;
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+ virtual CompilerType GetCompilerType() {
+ return ValueObjectCast::GetCompilerType();
+ }
+
+ lldb::ValueObjectSP GetSyntheticChildAtOffset(
+ uint32_t offset, const CompilerType &type, bool can_create,
+ ConstString name_const_str = ConstString()) override;
+
+ lldb::ValueObjectSP AddressOf(Status &error) override;
+
+ size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
+ uint32_t item_count = 1) override;
+
+ lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
+
+protected:
+ ValueObjectConstResultImpl m_impl;
+
+private:
+ friend class ValueObject;
+ friend class ValueObjectConstResult;
+ friend class ValueObjectConstResultImpl;
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultCast);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectConstResultCast_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h
new file mode 100644
index 0000000..16fa74f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h
@@ -0,0 +1,78 @@
+//===-- ValueObjectConstResultChild.h ----------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectConstResultChild_h_
+#define liblldb_ValueObjectConstResultChild_h_
+
+#include "lldb/Core/ValueObjectChild.h"
+#include "lldb/Core/ValueObjectConstResultImpl.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class Status;
+class ValueObject;
+
+// A child of a ValueObjectConstResult.
+class ValueObjectConstResultChild : public ValueObjectChild {
+public:
+ ValueObjectConstResultChild(ValueObject &parent,
+ const CompilerType &compiler_type,
+ ConstString name, uint32_t byte_size,
+ int32_t byte_offset, uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, bool is_base_class,
+ bool is_deref_of_parent,
+ lldb::addr_t live_address,
+ uint64_t language_flags);
+
+ ~ValueObjectConstResultChild() override;
+
+ lldb::ValueObjectSP Dereference(Status &error) override;
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+ virtual CompilerType GetCompilerType() {
+ return ValueObjectChild::GetCompilerType();
+ }
+
+ lldb::ValueObjectSP GetSyntheticChildAtOffset(
+ uint32_t offset, const CompilerType &type, bool can_create,
+ ConstString name_const_str = ConstString()) override;
+
+ lldb::ValueObjectSP AddressOf(Status &error) override;
+
+ lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr) override;
+
+ size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
+ uint32_t item_count = 1) override;
+
+ lldb::ValueObjectSP Cast(const CompilerType &compiler_type) override;
+
+protected:
+ ValueObjectConstResultImpl m_impl;
+
+private:
+ friend class ValueObject;
+ friend class ValueObjectConstResult;
+ friend class ValueObjectConstResultImpl;
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultChild);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectConstResultChild_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h
new file mode 100644
index 0000000..ffac98e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h
@@ -0,0 +1,79 @@
+//===-- ValueObjectConstResultImpl.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectConstResultImpl_h_
+#define liblldb_ValueObjectConstResultImpl_h_
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+namespace lldb_private {
+class CompilerType;
+class DataExtractor;
+class Status;
+class ValueObject;
+}
+
+namespace lldb_private {
+
+// A class wrapping common implementation details for operations in
+// ValueObjectConstResult ( & Child ) that may need to jump from the host
+// memory space into the target's memory space
+class ValueObjectConstResultImpl {
+public:
+ ValueObjectConstResultImpl(ValueObject *valobj,
+ lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
+
+ virtual ~ValueObjectConstResultImpl() = default;
+
+ lldb::ValueObjectSP Dereference(Status &error);
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index);
+
+ lldb::ValueObjectSP
+ GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type,
+ bool can_create,
+ ConstString name_const_str = ConstString());
+
+ lldb::ValueObjectSP AddressOf(Status &error);
+
+ lldb::addr_t GetLiveAddress() { return m_live_address; }
+
+ lldb::ValueObjectSP Cast(const CompilerType &compiler_type);
+
+ void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS,
+ AddressType address_type = eAddressTypeLoad) {
+ m_live_address = addr;
+ m_live_address_type = address_type;
+ }
+
+ virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
+ AddressType *address_type = nullptr);
+
+ virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
+ uint32_t item_count = 1);
+
+private:
+ ValueObject *m_impl_backend;
+ lldb::addr_t m_live_address;
+ AddressType m_live_address_type;
+ lldb::ValueObjectSP m_load_addr_backend;
+ lldb::ValueObjectSP m_address_of_backend;
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultImpl);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectConstResultImpl_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h b/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h
new file mode 100644
index 0000000..f656d42
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h
@@ -0,0 +1,136 @@
+//===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectDynamicValue_h_
+#define liblldb_ValueObjectDynamicValue_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/SharingPtr.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class Declaration;
+class Status;
+
+// A ValueObject that represents memory at a given address, viewed as some
+// set lldb type.
+class ValueObjectDynamicValue : public ValueObject {
+public:
+ ~ValueObjectDynamicValue() override;
+
+ uint64_t GetByteSize() override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueType GetValueType() const override;
+
+ bool IsInScope() override;
+
+ bool IsDynamic() override { return true; }
+
+ bool IsBaseClass() override {
+ if (m_parent)
+ return m_parent->IsBaseClass();
+ return false;
+ }
+
+ bool GetIsConstant() const override { return false; }
+
+ ValueObject *GetParent() override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+ const ValueObject *GetParent() const override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+ lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
+
+ void SetOwningSP(lldb::ValueObjectSP &owning_sp) {
+ if (m_owning_valobj_sp == owning_sp)
+ return;
+
+ assert(m_owning_valobj_sp.get() == nullptr);
+ m_owning_valobj_sp = owning_sp;
+ }
+
+ bool SetValueFromCString(const char *value_str, Status &error) override;
+
+ bool SetData(DataExtractor &data, Status &error) override;
+
+ TypeImpl GetTypeImpl() override;
+
+ lldb::VariableSP GetVariable() override {
+ return m_parent ? m_parent->GetVariable() : nullptr;
+ }
+
+ lldb::LanguageType GetPreferredDisplayLanguage() override;
+
+ void SetPreferredDisplayLanguage(lldb::LanguageType);
+
+ bool IsSyntheticChildrenGenerated() override;
+
+ void SetSyntheticChildrenGenerated(bool b) override;
+
+ bool GetDeclaration(Declaration &decl) override;
+
+ uint64_t GetLanguageFlags() override;
+
+ void SetLanguageFlags(uint64_t flags) override;
+
+protected:
+ bool UpdateValue() override;
+
+ LazyBool CanUpdateWithInvalidExecutionContext() override {
+ return eLazyBoolYes;
+ }
+
+ lldb::DynamicValueType GetDynamicValueTypeImpl() override {
+ return m_use_dynamic;
+ }
+
+ bool HasDynamicValueTypeInfo() override { return true; }
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ Address m_address; ///< The variable that this value object is based upon
+ TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
+ lldb::ValueObjectSP m_owning_valobj_sp;
+ lldb::DynamicValueType m_use_dynamic;
+ TypeImpl m_type_impl;
+
+private:
+ friend class ValueObject;
+ friend class ValueObjectConstResult;
+ ValueObjectDynamicValue(ValueObject &parent,
+ lldb::DynamicValueType use_dynamic);
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectDynamicValue);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectDynamicValue_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectList.h b/linux-x64/clang/include/lldb/Core/ValueObjectList.h
new file mode 100644
index 0000000..42d1967
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectList.h
@@ -0,0 +1,62 @@
+//===-- ValueObjectList.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectList_h_
+#define liblldb_ValueObjectList_h_
+
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <vector>
+
+#include <stddef.h>
+
+namespace lldb_private {
+class ValueObject;
+
+// A collection of ValueObject values that
+class ValueObjectList {
+public:
+ const ValueObjectList &operator=(const ValueObjectList &rhs);
+
+ void Append(const lldb::ValueObjectSP &val_obj_sp);
+
+ void Append(const ValueObjectList &valobj_list);
+
+ lldb::ValueObjectSP FindValueObjectByPointer(ValueObject *valobj);
+
+ size_t GetSize() const;
+
+ void Resize(size_t size);
+
+ lldb::ValueObjectSP GetValueObjectAtIndex(size_t idx);
+
+ lldb::ValueObjectSP RemoveValueObjectAtIndex(size_t idx);
+
+ void SetValueObjectAtIndex(size_t idx, const lldb::ValueObjectSP &valobj_sp);
+
+ lldb::ValueObjectSP FindValueObjectByValueName(const char *name);
+
+ lldb::ValueObjectSP FindValueObjectByUID(lldb::user_id_t uid);
+
+ void Swap(ValueObjectList &value_object_list);
+
+ void Clear() { m_value_objects.clear(); }
+
+ const std::vector<lldb::ValueObjectSP> &GetObjects() const {
+ return m_value_objects;
+ }
+protected:
+ typedef std::vector<lldb::ValueObjectSP> collection;
+ // Classes that inherit from ValueObjectList can see and modify these
+ collection m_value_objects;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectList_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h b/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h
new file mode 100644
index 0000000..df3557f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h
@@ -0,0 +1,78 @@
+//===-- ValueObjectMemory.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectMemory_h_
+#define liblldb_ValueObjectMemory_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class ExecutionContextScope;
+
+// A ValueObject that represents memory at a given address, viewed as some
+// set lldb type.
+class ValueObjectMemory : public ValueObject {
+public:
+ ~ValueObjectMemory() override;
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ llvm::StringRef name,
+ const Address &address,
+ lldb::TypeSP &type_sp);
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ llvm::StringRef name,
+ const Address &address,
+ const CompilerType &ast_type);
+
+ uint64_t GetByteSize() override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueType GetValueType() const override;
+
+ bool IsInScope() override;
+
+ lldb::ModuleSP GetModule() override;
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ Address m_address; ///< The variable that this value object is based upon
+ lldb::TypeSP m_type_sp;
+ CompilerType m_compiler_type;
+
+private:
+ ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
+ const Address &address, lldb::TypeSP &type_sp);
+
+ ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
+ const Address &address, const CompilerType &ast_type);
+ // For ValueObject only
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectMemory_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h b/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h
new file mode 100644
index 0000000..e584be6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h
@@ -0,0 +1,171 @@
+//===-- ValueObjectRegister.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectRegister_h_
+#define liblldb_ValueObjectRegister_h_
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class Status;
+class ExecutionContextScope;
+class Scalar;
+class Stream;
+
+// A ValueObject that contains a root variable that may or may not
+// have children.
+class ValueObjectRegisterContext : public ValueObject {
+public:
+ ~ValueObjectRegisterContext() override;
+
+ uint64_t GetByteSize() override;
+
+ lldb::ValueType GetValueType() const override {
+ return lldb::eValueTypeRegisterSet;
+ }
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ lldb::RegisterContextSP m_reg_ctx_sp;
+
+private:
+ ValueObjectRegisterContext(ValueObject &parent,
+ lldb::RegisterContextSP ®_ctx_sp);
+ // For ValueObject only
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
+};
+
+class ValueObjectRegisterSet : public ValueObject {
+public:
+ ~ValueObjectRegisterSet() override;
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ lldb::RegisterContextSP ®_ctx_sp,
+ uint32_t set_idx);
+
+ uint64_t GetByteSize() override;
+
+ lldb::ValueType GetValueType() const override {
+ return lldb::eValueTypeRegisterSet;
+ }
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
+ int32_t synthetic_index) override;
+
+ lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ bool can_create) override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ lldb::RegisterContextSP m_reg_ctx_sp;
+ const RegisterSet *m_reg_set;
+ uint32_t m_reg_set_idx;
+
+private:
+ friend class ValueObjectRegisterContext;
+
+ ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
+ lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx);
+
+ // For ValueObject only
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
+};
+
+class ValueObjectRegister : public ValueObject {
+public:
+ ~ValueObjectRegister() override;
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ lldb::RegisterContextSP ®_ctx_sp,
+ uint32_t reg_num);
+
+ uint64_t GetByteSize() override;
+
+ lldb::ValueType GetValueType() const override {
+ return lldb::eValueTypeRegister;
+ }
+
+ ConstString GetTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ bool SetValueFromCString(const char *value_str, Status &error) override;
+
+ bool SetData(DataExtractor &data, Status &error) override;
+
+ bool ResolveValue(Scalar &scalar) override;
+
+ void
+ GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
+ GetExpressionPathFormat epformat =
+ eGetExpressionPathFormatDereferencePointers) override;
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ lldb::RegisterContextSP m_reg_ctx_sp;
+ RegisterInfo m_reg_info;
+ RegisterValue m_reg_value;
+ ConstString m_type_name;
+ CompilerType m_compiler_type;
+
+private:
+ void ConstructObject(uint32_t reg_num);
+
+ friend class ValueObjectRegisterSet;
+
+ ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp,
+ uint32_t reg_num);
+ ValueObjectRegister(ExecutionContextScope *exe_scope,
+ lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num);
+
+ // For ValueObject only
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectRegister_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h b/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h
new file mode 100644
index 0000000..3b14a3e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -0,0 +1,169 @@
+//===-- ValueObjectSyntheticFilter.h ----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectSyntheticFilter_h_
+#define liblldb_ValueObjectSyntheticFilter_h_
+
+#include "lldb/Core/ThreadSafeSTLMap.h"
+#include "lldb/Core/ThreadSafeSTLVector.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+
+#include <cstdint>
+#include <memory>
+
+#include <stddef.h>
+
+namespace lldb_private {
+class Declaration;
+class Status;
+class SyntheticChildrenFrontEnd;
+
+// A ValueObject that obtains its children from some source other than
+// real information
+// This is currently used to implement Python-based children and filters but
+// you can bind it to any source of synthetic information and have it behave
+// accordingly
+class ValueObjectSynthetic : public ValueObject {
+public:
+ ~ValueObjectSynthetic() override;
+
+ uint64_t GetByteSize() override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ bool MightHaveChildren() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueType GetValueType() const override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create) override;
+
+ lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
+ bool can_create) override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+ lldb::ValueObjectSP
+ GetDynamicValue(lldb::DynamicValueType valueType) override;
+
+ bool IsInScope() override;
+
+ bool HasSyntheticValue() override { return false; }
+
+ bool IsSynthetic() override { return true; }
+
+ void CalculateSyntheticValue(bool use_synthetic) override {}
+
+ bool IsDynamic() override {
+ return ((m_parent != nullptr) ? m_parent->IsDynamic() : false);
+ }
+
+ lldb::ValueObjectSP GetStaticValue() override {
+ return ((m_parent != nullptr) ? m_parent->GetStaticValue() : GetSP());
+ }
+
+ virtual lldb::DynamicValueType GetDynamicValueType() {
+ return ((m_parent != nullptr) ? m_parent->GetDynamicValueType()
+ : lldb::eNoDynamicValues);
+ }
+
+ ValueObject *GetParent() override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+ const ValueObject *GetParent() const override {
+ return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
+ }
+
+ lldb::ValueObjectSP GetNonSyntheticValue() override;
+
+ bool CanProvideValue() override;
+
+ bool DoesProvideSyntheticValue() override {
+ return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes);
+ }
+
+ bool GetIsConstant() const override { return false; }
+
+ bool SetValueFromCString(const char *value_str, Status &error) override;
+
+ void SetFormat(lldb::Format format) override;
+
+ lldb::LanguageType GetPreferredDisplayLanguage() override;
+
+ void SetPreferredDisplayLanguage(lldb::LanguageType);
+
+ bool IsSyntheticChildrenGenerated() override;
+
+ void SetSyntheticChildrenGenerated(bool b) override;
+
+ bool GetDeclaration(Declaration &decl) override;
+
+ uint64_t GetLanguageFlags() override;
+
+ void SetLanguageFlags(uint64_t flags) override;
+
+protected:
+ bool UpdateValue() override;
+
+ LazyBool CanUpdateWithInvalidExecutionContext() override {
+ return eLazyBoolYes;
+ }
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ virtual void CreateSynthFilter();
+
+ // we need to hold on to the SyntheticChildren because someone might delete
+ // the type binding while we are alive
+ lldb::SyntheticChildrenSP m_synth_sp;
+ std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_up;
+
+ typedef ThreadSafeSTLMap<uint32_t, ValueObject *> ByIndexMap;
+ typedef ThreadSafeSTLMap<const char *, uint32_t> NameToIndexMap;
+ typedef ThreadSafeSTLVector<lldb::ValueObjectSP> SyntheticChildrenCache;
+
+ typedef ByIndexMap::iterator ByIndexIterator;
+ typedef NameToIndexMap::iterator NameToIndexIterator;
+
+ ByIndexMap m_children_byindex;
+ NameToIndexMap m_name_toindex;
+ uint32_t m_synthetic_children_count; // FIXME use the ValueObject's
+ // ChildrenManager instead of a special
+ // purpose solution
+ SyntheticChildrenCache m_synthetic_children_cache;
+
+ ConstString m_parent_type_name;
+
+ LazyBool m_might_have_children;
+
+ LazyBool m_provides_value;
+
+private:
+ friend class ValueObject;
+ ValueObjectSynthetic(ValueObject &parent, lldb::SyntheticChildrenSP filter);
+
+ void CopyValueData(ValueObject *source);
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectSynthetic);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectSyntheticFilter_h_
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h b/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h
new file mode 100644
index 0000000..86bb8ef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h
@@ -0,0 +1,87 @@
+//===-- ValueObjectVariable.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ValueObjectVariable_h_
+#define liblldb_ValueObjectVariable_h_
+
+#include "lldb/Core/ValueObject.h"
+
+#include "lldb/Core/Value.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class DataExtractor;
+class Declaration;
+class Status;
+class ExecutionContextScope;
+class SymbolContextScope;
+
+// A ValueObject that contains a root variable that may or may not
+// have children.
+class ValueObjectVariable : public ValueObject {
+public:
+ ~ValueObjectVariable() override;
+
+ static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
+ const lldb::VariableSP &var_sp);
+
+ uint64_t GetByteSize() override;
+
+ ConstString GetTypeName() override;
+
+ ConstString GetQualifiedTypeName() override;
+
+ ConstString GetDisplayTypeName() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueType GetValueType() const override;
+
+ bool IsInScope() override;
+
+ lldb::ModuleSP GetModule() override;
+
+ SymbolContextScope *GetSymbolContextScope() override;
+
+ bool GetDeclaration(Declaration &decl) override;
+
+ const char *GetLocationAsCString() override;
+
+ bool SetValueFromCString(const char *value_str, Status &error) override;
+
+ bool SetData(DataExtractor &data, Status &error) override;
+
+ lldb::VariableSP GetVariable() override { return m_variable_sp; }
+
+protected:
+ bool UpdateValue() override;
+
+ CompilerType GetCompilerTypeImpl() override;
+
+ lldb::VariableSP
+ m_variable_sp; ///< The variable that this value object is based upon
+ Value m_resolved_value; ///< The value that DWARFExpression resolves this
+ ///variable to before we patch it up
+
+private:
+ ValueObjectVariable(ExecutionContextScope *exe_scope,
+ const lldb::VariableSP &var_sp);
+ // For ValueObject only
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ValueObjectVariable_h_
diff --git a/linux-x64/clang/include/lldb/Core/dwarf.h b/linux-x64/clang/include/lldb/Core/dwarf.h
new file mode 100644
index 0000000..afe62e0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/dwarf.h
@@ -0,0 +1,76 @@
+//===-- dwarf.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DebugBase_dwarf_h_
+#define DebugBase_dwarf_h_
+
+#include "lldb/Utility/RangeMap.h"
+#include <stdint.h>
+
+// Get the DWARF constant definitions from llvm
+#include "llvm/BinaryFormat/Dwarf.h"
+
+// and stuff them in our default namespace
+using namespace llvm::dwarf;
+
+typedef uint32_t dw_uleb128_t;
+typedef int32_t dw_sleb128_t;
+typedef uint16_t dw_attr_t;
+typedef uint16_t dw_form_t;
+typedef uint16_t dw_tag_t;
+typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
+ // any addresses in the compile units that get
+ // parsed
+
+typedef uint32_t dw_offset_t; // Dwarf Debug Information Entry offset for any
+ // offset into the file
+
+/* Constants */
+#define DW_INVALID_OFFSET (~(dw_offset_t)0)
+#define DW_INVALID_INDEX 0xFFFFFFFFul
+
+// #define DW_ADDR_none 0x0
+
+#define DW_EH_PE_MASK_ENCODING 0x0F
+
+//// The following are used only internally within lldb - don't
+//// document them in the llvm Dwarf.h header file, we won't see
+//// them in executable files anywhere.
+//// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
+//
+//#define DW_OP_APPLE_array_ref 0xEE // first pops index, then pops array;
+//pushes array[index]
+//#define DW_OP_APPLE_extern 0xEF // ULEB128 index of external object
+//(i.e., an entity from the program that was used in the expression)
+#define DW_OP_APPLE_uninit \
+ 0xF0 // This is actually generated by some apple compilers in locations lists
+//#define DW_OP_APPLE_assign 0xF1 // pops value off and assigns it to
+//second item on stack (2nd item must have assignable context)
+//#define DW_OP_APPLE_address_of 0xF2 // gets the address of the top stack
+//item (top item must be a variable, or have value_type that is an address
+//already)
+//#define DW_OP_APPLE_value_of 0xF3 // pops the value off the stack and
+//pushes the value of that object (top item must be a variable, or expression
+//local)
+//#define DW_OP_APPLE_deref_type 0xF4 // gets the address of the top stack
+//item (top item must be a variable, or a clang type)
+//#define DW_OP_APPLE_expr_local 0xF5 // ULEB128 expression local index
+//#define DW_OP_APPLE_constf 0xF6 // 1 byte float size, followed by
+//constant float data
+//#define DW_OP_APPLE_scalar_cast 0xF7 // Cast top of stack to 2nd in stack's
+//type leaving all items in place
+//#define DW_OP_APPLE_clang_cast 0xF8 // pointer size clang::Type * off the
+//stack and cast top stack item to this type
+//#define DW_OP_APPLE_clear 0xFE // clears the entire expression stack,
+//ok if the stack is empty
+//#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and
+//returns an error (no args)
+
+typedef lldb_private::RangeArray<dw_addr_t, dw_addr_t, 2> DWARFRangeList;
+
+#endif // DebugBase_dwarf_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
new file mode 100644
index 0000000..b541789
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
@@ -0,0 +1,21 @@
+//===-- CXXFunctionPointer.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CXXFunctionPointer_h_
+#define liblldb_CXXFunctionPointer_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+namespace formatters {
+bool CXXFunctionPointerSummaryProvider(ValueObject &valobj, Stream &stream,
+ const TypeSummaryOptions &options);
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CXXFunctionPointer_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
new file mode 100644
index 0000000..cdb2eab
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
@@ -0,0 +1,131 @@
+//===-- DataVisualization.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DataVisualization_h_
+#define lldb_DataVisualization_h_
+
+
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormatManager.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+
+// this class is the high-level front-end of LLDB Data Visualization code in
+// FormatManager.h/cpp is the low-level implementation of this feature clients
+// should refer to this class as the entry-point into the data formatters
+// unless they have a good reason to bypass this and go to the backend
+class DataVisualization {
+public:
+ // use this call to force the FM to consider itself updated even when there
+ // is no apparent reason for that
+ static void ForceUpdate();
+
+ static uint32_t GetCurrentRevision();
+
+ static bool ShouldPrintAsOneLiner(ValueObject &valobj);
+
+ static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeFormatImplSP
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::TypeSummaryImplSP
+ GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeSummaryImplSP
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::TypeFilterImplSP
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::ScriptedSyntheticChildrenSP
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::SyntheticChildrenSP
+ GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeValidatorImplSP
+ GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeValidatorImplSP
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
+
+ class NamedSummaryFormats {
+ public:
+ static bool GetSummaryFormat(ConstString type,
+ lldb::TypeSummaryImplSP &entry);
+
+ static void Add(ConstString type,
+ const lldb::TypeSummaryImplSP &entry);
+
+ static bool Delete(ConstString type);
+
+ static void Clear();
+
+ static void
+ ForEach(std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
+ callback);
+
+ static uint32_t GetCount();
+ };
+
+ class Categories {
+ public:
+ static bool GetCategory(ConstString category,
+ lldb::TypeCategoryImplSP &entry,
+ bool allow_create = true);
+
+ static bool GetCategory(lldb::LanguageType language,
+ lldb::TypeCategoryImplSP &entry);
+
+ static void Add(ConstString category);
+
+ static bool Delete(ConstString category);
+
+ static void Clear();
+
+ static void Clear(ConstString category);
+
+ static void Enable(ConstString category,
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
+
+ static void Enable(lldb::LanguageType lang_type);
+
+ static void Disable(ConstString category);
+
+ static void Disable(lldb::LanguageType lang_type);
+
+ static void Enable(const lldb::TypeCategoryImplSP &category,
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
+
+ static void Disable(const lldb::TypeCategoryImplSP &category);
+
+ static void EnableStar();
+
+ static void DisableStar();
+
+ static void ForEach(TypeCategoryMap::ForEachCallback callback);
+
+ static uint32_t GetCount();
+
+ static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t);
+ };
+};
+
+} // namespace lldb_private
+
+#endif // lldb_DataVisualization_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
new file mode 100644
index 0000000..c374115
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -0,0 +1,160 @@
+//===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DumpValueObjectOptions_h_
+#define lldb_DumpValueObjectOptions_h_
+
+#include <string>
+
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include <functional>
+#include <string>
+
+namespace lldb_private {
+
+class DumpValueObjectOptions {
+public:
+ struct PointerDepth {
+ enum class Mode { Always, Default, Never } m_mode;
+ uint32_t m_count;
+
+ PointerDepth operator--() const {
+ if (m_count > 0)
+ return PointerDepth{m_mode, m_count - 1};
+ return PointerDepth{m_mode, m_count};
+ }
+
+ bool CanAllowExpansion() const;
+ };
+
+ struct PointerAsArraySettings {
+ size_t m_element_count;
+ size_t m_base_element;
+ size_t m_stride;
+
+ PointerAsArraySettings()
+ : m_element_count(0), m_base_element(0), m_stride() {}
+
+ PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
+ size_t stride = 1)
+ : m_element_count(elem_count), m_base_element(base_elem),
+ m_stride(stride) {}
+
+ operator bool() { return m_element_count > 0; }
+ };
+
+ typedef std::function<bool(ConstString, ConstString,
+ const DumpValueObjectOptions &, Stream &)>
+ DeclPrintingHelper;
+
+ static const DumpValueObjectOptions DefaultOptions() {
+ static DumpValueObjectOptions g_default_options;
+
+ return g_default_options;
+ }
+
+ DumpValueObjectOptions();
+
+ DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
+
+ DumpValueObjectOptions(ValueObject &valobj);
+
+ DumpValueObjectOptions &
+ SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
+
+ DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
+
+ DumpValueObjectOptions &SetShowTypes(bool show = false);
+
+ DumpValueObjectOptions &SetShowLocation(bool show = false);
+
+ DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
+
+ DumpValueObjectOptions &SetShowSummary(bool show = true);
+
+ DumpValueObjectOptions &
+ SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
+
+ DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
+
+ DumpValueObjectOptions &SetScopeChecked(bool check = true);
+
+ DumpValueObjectOptions &SetFlatOutput(bool flat = false);
+
+ DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
+
+ DumpValueObjectOptions &SetRawDisplay();
+
+ DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
+
+ DumpValueObjectOptions &
+ SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
+
+ DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
+
+ DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
+
+ DumpValueObjectOptions &SetHideName(bool hide_name = false);
+
+ DumpValueObjectOptions &SetHideValue(bool hide_value = false);
+
+ DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
+
+ DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
+ lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
+
+ DumpValueObjectOptions &SetRunValidator(bool run = true);
+
+ DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
+
+ DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
+
+ DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
+
+ DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
+
+ DumpValueObjectOptions &
+ SetPointerAsArray(const PointerAsArraySettings &ptr_array);
+
+public:
+ uint32_t m_max_depth = UINT32_MAX;
+ lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
+ uint32_t m_omit_summary_depth = 0;
+ lldb::Format m_format = lldb::eFormatDefault;
+ lldb::TypeSummaryImplSP m_summary_sp;
+ std::string m_root_valobj_name;
+ lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
+ PointerDepth m_max_ptr_depth;
+ DeclPrintingHelper m_decl_printing_helper;
+ PointerAsArraySettings m_pointer_as_array;
+ bool m_use_synthetic : 1;
+ bool m_scope_already_checked : 1;
+ bool m_flat_output : 1;
+ bool m_ignore_cap : 1;
+ bool m_show_types : 1;
+ bool m_show_location : 1;
+ bool m_use_objc : 1;
+ bool m_hide_root_type : 1;
+ bool m_hide_name : 1;
+ bool m_hide_value : 1;
+ bool m_run_validator : 1;
+ bool m_use_type_display_name : 1;
+ bool m_allow_oneliner_mode : 1;
+ bool m_hide_pointer_value : 1;
+ bool m_reveal_empty_aggregates : 1;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_DumpValueObjectOptions_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
new file mode 100644
index 0000000..7a6774b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
@@ -0,0 +1,107 @@
+//===-- FormatCache.h ---------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatCache_h_
+#define lldb_FormatCache_h_
+
+#include <map>
+#include <mutex>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+class FormatCache {
+private:
+ struct Entry {
+ private:
+ bool m_format_cached : 1;
+ bool m_summary_cached : 1;
+ bool m_synthetic_cached : 1;
+ bool m_validator_cached : 1;
+
+ lldb::TypeFormatImplSP m_format_sp;
+ lldb::TypeSummaryImplSP m_summary_sp;
+ lldb::SyntheticChildrenSP m_synthetic_sp;
+ lldb::TypeValidatorImplSP m_validator_sp;
+
+ public:
+ Entry();
+ Entry(lldb::TypeFormatImplSP);
+ Entry(lldb::TypeSummaryImplSP);
+ Entry(lldb::SyntheticChildrenSP);
+ Entry(lldb::TypeValidatorImplSP);
+ Entry(lldb::TypeFormatImplSP, lldb::TypeSummaryImplSP,
+ lldb::SyntheticChildrenSP, lldb::TypeValidatorImplSP);
+
+ bool IsFormatCached();
+
+ bool IsSummaryCached();
+
+ bool IsSyntheticCached();
+
+ bool IsValidatorCached();
+
+ lldb::TypeFormatImplSP GetFormat();
+
+ lldb::TypeSummaryImplSP GetSummary();
+
+ lldb::SyntheticChildrenSP GetSynthetic();
+
+ lldb::TypeValidatorImplSP GetValidator();
+
+ void SetFormat(lldb::TypeFormatImplSP);
+
+ void SetSummary(lldb::TypeSummaryImplSP);
+
+ void SetSynthetic(lldb::SyntheticChildrenSP);
+
+ void SetValidator(lldb::TypeValidatorImplSP);
+ };
+ typedef std::map<ConstString, Entry> CacheMap;
+ CacheMap m_map;
+ std::recursive_mutex m_mutex;
+
+ uint64_t m_cache_hits;
+ uint64_t m_cache_misses;
+
+ Entry &GetEntry(ConstString type);
+
+public:
+ FormatCache();
+
+ bool GetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
+
+ bool GetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
+
+ bool GetSynthetic(ConstString type,
+ lldb::SyntheticChildrenSP &synthetic_sp);
+
+ bool GetValidator(ConstString type,
+ lldb::TypeValidatorImplSP &summary_sp);
+
+ void SetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
+
+ void SetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
+
+ void SetSynthetic(ConstString type,
+ lldb::SyntheticChildrenSP &synthetic_sp);
+
+ void SetValidator(ConstString type,
+ lldb::TypeValidatorImplSP &synthetic_sp);
+
+ void Clear();
+
+ uint64_t GetCacheHits() { return m_cache_hits; }
+
+ uint64_t GetCacheMisses() { return m_cache_misses; }
+};
+} // namespace lldb_private
+
+#endif // lldb_FormatCache_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
new file mode 100644
index 0000000..5144bc6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
@@ -0,0 +1,165 @@
+//===-- FormatClasses.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatClasses_h_
+#define lldb_FormatClasses_h_
+
+#include <functional>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/DataFormatters/TypeValidator.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class HardcodedFormatters {
+public:
+ template <typename FormatterType>
+ using HardcodedFormatterFinder =
+ std::function<typename FormatterType::SharedPointer(
+ lldb_private::ValueObject &, lldb::DynamicValueType,
+ FormatManager &)>;
+
+ template <typename FormatterType>
+ using HardcodedFormatterFinders =
+ std::vector<HardcodedFormatterFinder<FormatterType>>;
+
+ typedef HardcodedFormatterFinders<TypeFormatImpl> HardcodedFormatFinder;
+ typedef HardcodedFormatterFinders<TypeSummaryImpl> HardcodedSummaryFinder;
+ typedef HardcodedFormatterFinders<SyntheticChildren> HardcodedSyntheticFinder;
+ typedef HardcodedFormatterFinders<TypeValidatorImpl> HardcodedValidatorFinder;
+};
+
+class FormattersMatchCandidate {
+public:
+ FormattersMatchCandidate(ConstString name, uint32_t reason, bool strip_ptr,
+ bool strip_ref, bool strip_tydef)
+ : m_type_name(name), m_reason(reason), m_stripped_pointer(strip_ptr),
+ m_stripped_reference(strip_ref), m_stripped_typedef(strip_tydef) {}
+
+ ~FormattersMatchCandidate() = default;
+
+ ConstString GetTypeName() const { return m_type_name; }
+
+ uint32_t GetReason() const { return m_reason; }
+
+ bool DidStripPointer() const { return m_stripped_pointer; }
+
+ bool DidStripReference() const { return m_stripped_reference; }
+
+ bool DidStripTypedef() const { return m_stripped_typedef; }
+
+ template <class Formatter>
+ bool IsMatch(const std::shared_ptr<Formatter> &formatter_sp) const {
+ if (!formatter_sp)
+ return false;
+ if (formatter_sp->Cascades() == false && DidStripTypedef())
+ return false;
+ if (formatter_sp->SkipsPointers() && DidStripPointer())
+ return false;
+ if (formatter_sp->SkipsReferences() && DidStripReference())
+ return false;
+ return true;
+ }
+
+private:
+ ConstString m_type_name;
+ uint32_t m_reason;
+ bool m_stripped_pointer;
+ bool m_stripped_reference;
+ bool m_stripped_typedef;
+};
+
+typedef std::vector<FormattersMatchCandidate> FormattersMatchVector;
+typedef std::vector<lldb::LanguageType> CandidateLanguagesVector;
+
+class FormattersMatchData {
+public:
+ FormattersMatchData(ValueObject &, lldb::DynamicValueType);
+
+ FormattersMatchVector GetMatchesVector();
+
+ ConstString GetTypeForCache();
+
+ CandidateLanguagesVector GetCandidateLanguages();
+
+ ValueObject &GetValueObject();
+
+ lldb::DynamicValueType GetDynamicValueType();
+
+private:
+ ValueObject &m_valobj;
+ lldb::DynamicValueType m_dynamic_value_type;
+ std::pair<FormattersMatchVector, bool> m_formatters_match_vector;
+ ConstString m_type_for_cache;
+ CandidateLanguagesVector m_candidate_languages;
+};
+
+class TypeNameSpecifierImpl {
+public:
+ TypeNameSpecifierImpl() : m_is_regex(false), m_type() {}
+
+ TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex)
+ : m_is_regex(is_regex), m_type() {
+ m_type.m_type_name = name;
+ }
+
+ // if constructing with a given type, is_regex cannot be true since we are
+ // giving an exact type to match
+ TypeNameSpecifierImpl(lldb::TypeSP type) : m_is_regex(false), m_type() {
+ if (type) {
+ m_type.m_type_name = type->GetName().GetStringRef();
+ m_type.m_compiler_type = type->GetForwardCompilerType();
+ }
+ }
+
+ TypeNameSpecifierImpl(CompilerType type) : m_is_regex(false), m_type() {
+ if (type.IsValid()) {
+ m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
+ m_type.m_compiler_type = type;
+ }
+ }
+
+ const char *GetName() {
+ if (m_type.m_type_name.size())
+ return m_type.m_type_name.c_str();
+ return nullptr;
+ }
+
+ CompilerType GetCompilerType() {
+ if (m_type.m_compiler_type.IsValid())
+ return m_type.m_compiler_type;
+ return CompilerType();
+ }
+
+ bool IsRegex() { return m_is_regex; }
+
+private:
+ bool m_is_regex;
+ // TODO: Replace this with TypeAndOrName.
+ struct TypeOrName {
+ std::string m_type_name;
+ CompilerType m_compiler_type;
+ };
+ TypeOrName m_type;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatClasses_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
new file mode 100644
index 0000000..afaafda
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
@@ -0,0 +1,249 @@
+//===-- FormatManager.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatManager_h_
+#define lldb_FormatManager_h_
+
+#include <atomic>
+#include <initializer_list>
+#include <map>
+#include <mutex>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormattersContainer.h"
+#include "lldb/DataFormatters/LanguageCategory.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeCategoryMap.h"
+
+namespace lldb_private {
+
+// this file (and its. cpp) contain the low-level implementation of LLDB Data
+// Visualization class DataVisualization is the high-level front-end of this
+// feature clients should refer to that class as the entry-point into the data
+// formatters unless they have a good reason to bypass it and prefer to use
+// this file's objects directly
+
+class FormatManager : public IFormatChangeListener {
+ typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
+ typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
+
+public:
+ typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer>
+ LanguageCategories;
+
+ FormatManager();
+
+ ~FormatManager() override = default;
+
+ NamedSummariesMap &GetNamedSummaryContainer() {
+ return m_named_summaries_map;
+ }
+
+ void
+ EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
+ EnableCategory(category_name, pos,
+ std::initializer_list<lldb::LanguageType>());
+ }
+
+ void EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos, lldb::LanguageType lang) {
+ std::initializer_list<lldb::LanguageType> langs = {lang};
+ EnableCategory(category_name, pos, langs);
+ }
+
+ void EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default,
+ std::initializer_list<lldb::LanguageType> langs = {}) {
+ TypeCategoryMap::ValueSP category_sp;
+ if (m_categories_map.Get(category_name, category_sp) && category_sp) {
+ m_categories_map.Enable(category_sp, pos);
+ for (const lldb::LanguageType lang : langs)
+ category_sp->AddLanguage(lang);
+ }
+ }
+
+ void DisableCategory(ConstString category_name) {
+ m_categories_map.Disable(category_name);
+ }
+
+ void
+ EnableCategory(const lldb::TypeCategoryImplSP &category,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
+ m_categories_map.Enable(category, pos);
+ }
+
+ void DisableCategory(const lldb::TypeCategoryImplSP &category) {
+ m_categories_map.Disable(category);
+ }
+
+ void EnableAllCategories();
+
+ void DisableAllCategories();
+
+ bool DeleteCategory(ConstString category_name) {
+ return m_categories_map.Delete(category_name);
+ }
+
+ void ClearCategories() { return m_categories_map.Clear(); }
+
+ uint32_t GetCategoriesCount() { return m_categories_map.GetCount(); }
+
+ lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t index) {
+ return m_categories_map.GetAtIndex(index);
+ }
+
+ void ForEachCategory(TypeCategoryMap::ForEachCallback callback);
+
+ lldb::TypeCategoryImplSP GetCategory(const char *category_name = nullptr,
+ bool can_create = true) {
+ if (!category_name)
+ return GetCategory(m_default_category_name);
+ return GetCategory(ConstString(category_name));
+ }
+
+ lldb::TypeCategoryImplSP GetCategory(ConstString category_name,
+ bool can_create = true);
+
+ lldb::TypeFormatImplSP
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeSummaryImplSP
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeFilterImplSP
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::ScriptedSyntheticChildrenSP
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeValidatorImplSP
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ lldb::TypeValidatorImplSP GetValidator(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr) {
+ return m_categories_map.AnyMatches(type_name, items, only_enabled,
+ matching_category, matching_type);
+ }
+
+ static bool GetFormatFromCString(const char *format_cstr,
+ bool partial_match_ok, lldb::Format &format);
+
+ static char GetFormatAsFormatChar(lldb::Format format);
+
+ static const char *GetFormatAsCString(lldb::Format format);
+
+ // if the user tries to add formatters for, say, "struct Foo" those will not
+ // match any type because of the way we strip qualifiers from typenames this
+ // method looks for the case where the user is adding a
+ // "class","struct","enum" or "union" Foo and strips the unnecessary
+ // qualifier
+ static ConstString GetValidTypeName(ConstString type);
+
+ // when DataExtractor dumps a vectorOfT, it uses a predefined format for each
+ // item this method returns it, or eFormatInvalid if vector_format is not a
+ // vectorOf
+ static lldb::Format GetSingleItemFormat(lldb::Format vector_format);
+
+ // this returns true if the ValueObjectPrinter is *highly encouraged* to
+ // actually represent this ValueObject in one-liner format If this object has
+ // a summary formatter, however, we should not try and do one-lining, just
+ // let the summary do the right thing
+ bool ShouldPrintAsOneLiner(ValueObject &valobj);
+
+ void Changed() override;
+
+ uint32_t GetCurrentRevision() override { return m_last_revision; }
+
+ static FormattersMatchVector
+ GetPossibleMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic) {
+ FormattersMatchVector matches;
+ GetPossibleMatches(valobj, valobj.GetCompilerType(),
+ lldb_private::eFormatterChoiceCriterionDirectChoice,
+ use_dynamic, matches, false, false, false, true);
+ return matches;
+ }
+
+ static ConstString GetTypeForCache(ValueObject &, lldb::DynamicValueType);
+
+ LanguageCategory *GetCategoryForLanguage(lldb::LanguageType lang_type);
+
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages(lldb::LanguageType lang_type);
+
+private:
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages(ValueObject &valobj);
+
+ static void GetPossibleMatches(ValueObject &valobj,
+ CompilerType compiler_type, uint32_t reason,
+ lldb::DynamicValueType use_dynamic,
+ FormattersMatchVector &entries,
+ bool did_strip_ptr, bool did_strip_ref,
+ bool did_strip_typedef,
+ bool root_level = false);
+
+ std::atomic<uint32_t> m_last_revision;
+ FormatCache m_format_cache;
+ std::recursive_mutex m_language_categories_mutex;
+ LanguageCategories m_language_categories_map;
+ NamedSummariesMap m_named_summaries_map;
+ TypeCategoryMap m_categories_map;
+
+ ConstString m_default_category_name;
+ ConstString m_system_category_name;
+ ConstString m_vectortypes_category_name;
+
+ lldb::TypeFormatImplSP GetHardcodedFormat(FormattersMatchData &);
+
+ lldb::TypeSummaryImplSP GetHardcodedSummaryFormat(FormattersMatchData &);
+
+ lldb::SyntheticChildrenSP
+ GetHardcodedSyntheticChildren(FormattersMatchData &);
+
+ lldb::TypeValidatorImplSP GetHardcodedValidator(FormattersMatchData &);
+
+ TypeCategoryMap &GetCategories() { return m_categories_map; }
+
+ // These functions are meant to initialize formatters that are very low-
+ // level/global in nature and do not naturally belong in any language. The
+ // intent is that most formatters go in language-specific categories.
+ // Eventually, the runtimes should also be allowed to vend their own
+ // formatters, and then one could put formatters that depend on specific
+ // library load events in the language runtimes, on an as-needed basis
+ void LoadSystemFormatters();
+
+ void LoadVectorFormatters();
+
+ friend class FormattersMatchData;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatManager_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
new file mode 100644
index 0000000..9d7d373
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
@@ -0,0 +1,343 @@
+//===-- FormattersContainer.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormattersContainer_h_
+#define lldb_FormattersContainer_h_
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <string>
+
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#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 {
+
+class IFormatChangeListener {
+public:
+ virtual ~IFormatChangeListener() = default;
+
+ virtual void Changed() = 0;
+
+ virtual uint32_t GetCurrentRevision() = 0;
+};
+
+// if the user tries to add formatters for, say, "struct Foo" those will not
+// match any type because of the way we strip qualifiers from typenames this
+// method looks for the case where the user is adding a "class","struct","enum"
+// or "union" Foo and strips the unnecessary qualifier
+static inline ConstString GetValidTypeName_Impl(ConstString type) {
+ if (type.IsEmpty())
+ return type;
+
+ std::string type_cstr(type.AsCString());
+ lldb_utility::StringLexer type_lexer(type_cstr);
+
+ type_lexer.AdvanceIf("class ");
+ type_lexer.AdvanceIf("enum ");
+ type_lexer.AdvanceIf("struct ");
+ type_lexer.AdvanceIf("union ");
+
+ while (type_lexer.NextIf({' ', '\t', '\v', '\f'}).first)
+ ;
+
+ return ConstString(type_lexer.GetUnlexed());
+}
+
+template <typename KeyType, typename ValueType> class FormattersContainer;
+
+template <typename KeyType, typename ValueType> class FormatMap {
+public:
+ typedef typename ValueType::SharedPointer ValueSP;
+ typedef std::map<KeyType, ValueSP> MapType;
+ typedef typename MapType::iterator MapIterator;
+ typedef std::function<bool(KeyType, const ValueSP &)> ForEachCallback;
+
+ FormatMap(IFormatChangeListener *lst)
+ : m_map(), m_map_mutex(), listener(lst) {}
+
+ void Add(KeyType name, const ValueSP &entry) {
+ if (listener)
+ entry->GetRevision() = listener->GetCurrentRevision();
+ else
+ entry->GetRevision() = 0;
+
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ m_map[name] = entry;
+ if (listener)
+ listener->Changed();
+ }
+
+ bool Delete(KeyType name) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ m_map.erase(name);
+ if (listener)
+ listener->Changed();
+ return true;
+ }
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ m_map.clear();
+ if (listener)
+ listener->Changed();
+ }
+
+ bool Get(KeyType name, ValueSP &entry) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ entry = iter->second;
+ return true;
+ }
+
+ void ForEach(ForEachCallback callback) {
+ if (callback) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++) {
+ KeyType type = pos->first;
+ if (!callback(type, pos->second))
+ break;
+ }
+ }
+ }
+
+ uint32_t GetCount() { return m_map.size(); }
+
+ ValueSP GetValueAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (index > 0) {
+ iter++;
+ index--;
+ if (end == iter)
+ return ValueSP();
+ }
+ return iter->second;
+ }
+
+ KeyType GetKeyAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (index > 0) {
+ iter++;
+ index--;
+ if (end == iter)
+ return KeyType();
+ }
+ return iter->first;
+ }
+
+protected:
+ MapType m_map;
+ std::recursive_mutex m_map_mutex;
+ IFormatChangeListener *listener;
+
+ MapType &map() { return m_map; }
+
+ std::recursive_mutex &mutex() { return m_map_mutex; }
+
+ friend class FormattersContainer<KeyType, ValueType>;
+ friend class FormatManager;
+};
+
+template <typename KeyType, typename ValueType> class FormattersContainer {
+protected:
+ typedef FormatMap<KeyType, ValueType> BackEndType;
+
+public:
+ typedef typename BackEndType::MapType MapType;
+ typedef typename MapType::iterator MapIterator;
+ typedef typename MapType::key_type MapKeyType;
+ typedef typename MapType::mapped_type MapValueType;
+ typedef typename BackEndType::ForEachCallback ForEachCallback;
+ typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
+ SharedPointer;
+
+ friend class TypeCategoryImpl;
+
+ FormattersContainer(std::string name, IFormatChangeListener *lst)
+ : m_format_map(lst), m_name(name) {}
+
+ void Add(const MapKeyType &type, const MapValueType &entry) {
+ Add_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ bool Delete(ConstString type) {
+ return Delete_Impl(type, static_cast<KeyType *>(nullptr));
+ }
+
+ bool Get(ValueObject &valobj, MapValueType &entry,
+ lldb::DynamicValueType use_dynamic, uint32_t *why = nullptr) {
+ uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
+ CompilerType ast_type(valobj.GetCompilerType());
+ bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
+ if (ret)
+ entry = MapValueType(entry);
+ else
+ entry = MapValueType();
+ if (why)
+ *why = value;
+ return ret;
+ }
+
+ bool Get(ConstString type, MapValueType &entry) {
+ return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ bool GetExact(ConstString type, MapValueType &entry) {
+ return GetExact_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ MapValueType GetAtIndex(size_t index) {
+ return m_format_map.GetValueAtIndex(index);
+ }
+
+ lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index) {
+ return GetTypeNameSpecifierAtIndex_Impl(index,
+ static_cast<KeyType *>(nullptr));
+ }
+
+ void Clear() { m_format_map.Clear(); }
+
+ void ForEach(ForEachCallback callback) { m_format_map.ForEach(callback); }
+
+ uint32_t GetCount() { return m_format_map.GetCount(); }
+
+protected:
+ BackEndType m_format_map;
+ std::string m_name;
+
+ DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
+
+ void Add_Impl(const MapKeyType &type, const MapValueType &entry,
+ lldb::RegularExpressionSP *dummy) {
+ m_format_map.Add(type, entry);
+ }
+
+ void Add_Impl(ConstString type, const MapValueType &entry,
+ ConstString *dummy) {
+ m_format_map.Add(GetValidTypeName_Impl(type), entry);
+ }
+
+ bool Delete_Impl(ConstString type, ConstString *dummy) {
+ return m_format_map.Delete(type);
+ }
+
+ bool Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy) {
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (type.GetStringRef() == regex->GetText()) {
+ m_format_map.map().erase(pos);
+ if (m_format_map.listener)
+ m_format_map.listener->Changed();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool Get_Impl(ConstString type, MapValueType &entry, ConstString *dummy) {
+ return m_format_map.Get(type, entry);
+ }
+
+ bool GetExact_Impl(ConstString type, MapValueType &entry,
+ ConstString *dummy) {
+ return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierAtIndex_Impl(size_t index, ConstString *dummy) {
+ ConstString key = m_format_map.GetKeyAtIndex(index);
+ if (key)
+ return lldb::TypeNameSpecifierImplSP(
+ new TypeNameSpecifierImpl(key.AsCString(), false));
+ else
+ return lldb::TypeNameSpecifierImplSP();
+ }
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierAtIndex_Impl(size_t index,
+ lldb::RegularExpressionSP *dummy) {
+ lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
+ if (regex.get() == nullptr)
+ return lldb::TypeNameSpecifierImplSP();
+ return lldb::TypeNameSpecifierImplSP(
+ new TypeNameSpecifierImpl(regex->GetText().str().c_str(), true));
+ }
+
+ bool Get_Impl(ConstString key, MapValueType &value,
+ lldb::RegularExpressionSP *dummy) {
+ llvm::StringRef key_str = key.GetStringRef();
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->Execute(key_str)) {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetExact_Impl(ConstString key, MapValueType &value,
+ lldb::RegularExpressionSP *dummy) {
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->GetText() == key.GetStringRef()) {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool Get(const FormattersMatchVector &candidates, MapValueType &entry,
+ uint32_t *reason) {
+ for (const FormattersMatchCandidate &candidate : candidates) {
+ if (Get(candidate.GetTypeName(), entry)) {
+ if (candidate.IsMatch(entry) == false) {
+ entry.reset();
+ continue;
+ } else {
+ if (reason)
+ *reason = candidate.GetReason();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormattersContainer_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
new file mode 100644
index 0000000..79bd376
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
@@ -0,0 +1,187 @@
+//===-- FormattersHelpers.h --------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormattersHelpers_h_
+#define lldb_FormattersHelpers_h_
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+namespace lldb_private {
+namespace formatters {
+void AddFormat(TypeCategoryImpl::SharedPointer category_sp, lldb::Format format,
+ ConstString type_name, TypeFormatImpl::Flags flags,
+ bool regex = false);
+
+void AddSummary(TypeCategoryImpl::SharedPointer category_sp,
+ lldb::TypeSummaryImplSP summary_sp, ConstString type_name,
+ bool regex = false);
+
+void AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
+ const char *string, ConstString type_name,
+ TypeSummaryImpl::Flags flags, bool regex = false);
+
+void AddOneLineSummary(TypeCategoryImpl::SharedPointer category_sp,
+ ConstString type_name, TypeSummaryImpl::Flags flags,
+ bool regex = false);
+
+void AddCXXSummary(TypeCategoryImpl::SharedPointer category_sp,
+ CXXFunctionSummaryFormat::Callback funct,
+ const char *description, ConstString type_name,
+ TypeSummaryImpl::Flags flags, bool regex = false);
+
+void AddCXXSynthetic(TypeCategoryImpl::SharedPointer category_sp,
+ CXXSyntheticChildren::CreateFrontEndCallback generator,
+ const char *description, ConstString type_name,
+ ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+
+void AddFilter(TypeCategoryImpl::SharedPointer category_sp,
+ std::vector<std::string> children, const char *description,
+ ConstString type_name, ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+
+size_t ExtractIndexFromString(const char *item_name);
+
+lldb::addr_t GetArrayAddressOrPointerValue(ValueObject &valobj);
+
+time_t GetOSXEpoch();
+
+struct InferiorSizedWord {
+
+ InferiorSizedWord(const InferiorSizedWord &word) : ptr_size(word.ptr_size) {
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ }
+
+ InferiorSizedWord operator=(const InferiorSizedWord &word) {
+ ptr_size = word.ptr_size;
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ return *this;
+ }
+
+ InferiorSizedWord(uint64_t val, Process &process)
+ : ptr_size(process.GetAddressByteSize()) {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else if (ptr_size == 8)
+ sixty_four = val;
+ else
+ assert(false && "new pointer size is unknown");
+ }
+
+ bool IsNegative() const {
+ if (ptr_size == 4)
+ return ((int32_t)thirty_two) < 0;
+ else
+ return ((int64_t)sixty_four) < 0;
+ }
+
+ bool IsZero() const {
+ if (ptr_size == 4)
+ return thirty_two == 0;
+ else
+ return sixty_four == 0;
+ }
+
+ static InferiorSizedWord GetMaximum(Process &process) {
+ if (process.GetAddressByteSize() == 4)
+ return InferiorSizedWord(UINT32_MAX, 4);
+ else
+ return InferiorSizedWord(UINT64_MAX, 8);
+ }
+
+ InferiorSizedWord operator>>(int rhs) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two >> rhs, 4);
+ return InferiorSizedWord(sixty_four >> rhs, 8);
+ }
+
+ InferiorSizedWord operator<<(int rhs) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two << rhs, 4);
+ return InferiorSizedWord(sixty_four << rhs, 8);
+ }
+
+ InferiorSizedWord operator&(const InferiorSizedWord &word) const {
+ if (ptr_size != word.ptr_size)
+ return InferiorSizedWord(0, ptr_size);
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & word.thirty_two, 4);
+ return InferiorSizedWord(sixty_four & word.sixty_four, 8);
+ }
+
+ InferiorSizedWord operator&(int x) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & x, 4);
+ return InferiorSizedWord(sixty_four & x, 8);
+ }
+
+ size_t GetBitSize() const { return ptr_size << 3; }
+
+ size_t GetByteSize() const { return ptr_size; }
+
+ uint64_t GetValue() const {
+ if (ptr_size == 4)
+ return (uint64_t)thirty_two;
+ return sixty_four;
+ }
+
+ InferiorSizedWord SignExtend() const {
+ if (ptr_size == 4)
+ return InferiorSizedWord((int32_t)thirty_two, 4);
+ return InferiorSizedWord((int64_t)sixty_four, 8);
+ }
+
+ uint8_t *CopyToBuffer(uint8_t *buffer) const {
+ if (ptr_size == 4) {
+ memcpy(buffer, &thirty_two, 4);
+ return buffer + 4;
+ } else {
+ memcpy(buffer, &sixty_four, 8);
+ return buffer + 8;
+ }
+ }
+
+ DataExtractor
+ GetAsData(lldb::ByteOrder byte_order = lldb::eByteOrderInvalid) const {
+ if (ptr_size == 4)
+ return DataExtractor(&thirty_two, 4, byte_order, 4);
+ else
+ return DataExtractor(&sixty_four, 8, byte_order, 8);
+ }
+
+private:
+ InferiorSizedWord(uint64_t val, size_t psz) : ptr_size(psz) {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else
+ sixty_four = val;
+ }
+
+ size_t ptr_size;
+ union {
+ uint32_t thirty_two;
+ uint64_t sixty_four;
+ };
+};
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // lldb_FormattersHelpers_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
new file mode 100644
index 0000000..f109d46
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
@@ -0,0 +1,75 @@
+//===-- LanguageCategory.h----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_LanguageCategory_h_
+#define lldb_LanguageCategory_h_
+
+
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/lldb-public.h"
+
+#include <memory>
+
+namespace lldb_private {
+
+class LanguageCategory {
+public:
+ typedef std::unique_ptr<LanguageCategory> UniquePointer;
+
+ LanguageCategory(lldb::LanguageType lang_type);
+
+ bool Get(FormattersMatchData &match_data, lldb::TypeFormatImplSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data, lldb::TypeSummaryImplSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data,
+ lldb::SyntheticChildrenSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data,
+ lldb::TypeValidatorImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeFormatImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeSummaryImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::SyntheticChildrenSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeValidatorImplSP &format_sp);
+
+ lldb::TypeCategoryImplSP GetCategory() const;
+
+ FormatCache &GetFormatCache();
+
+ void Enable();
+
+ void Disable();
+
+ bool IsEnabled();
+
+private:
+ lldb::TypeCategoryImplSP m_category_sp;
+
+ HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
+ HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
+ HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
+ HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators;
+
+ lldb_private::FormatCache m_format_cache;
+
+ bool m_enabled;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_LanguageCategory_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
new file mode 100644
index 0000000..41d5edd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
@@ -0,0 +1,342 @@
+//===-- StringPrinter.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StringPrinter_h_
+#define liblldb_StringPrinter_h_
+
+#include <functional>
+#include <string>
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/Utility/DataExtractor.h"
+
+namespace lldb_private {
+namespace formatters {
+class StringPrinter {
+public:
+ enum class StringElementType { ASCII, UTF8, UTF16, UTF32 };
+
+ enum class GetPrintableElementType { ASCII, UTF8 };
+
+ class ReadStringAndDumpToStreamOptions {
+ public:
+ ReadStringAndDumpToStreamOptions()
+ : m_location(0), m_process_sp(), m_stream(nullptr), m_prefix_token(),
+ m_suffix_token(), m_quote('"'), m_source_size(0),
+ m_needs_zero_termination(true), m_escape_non_printables(true),
+ m_ignore_max_length(false), m_zero_is_terminator(true),
+ m_language_type(lldb::eLanguageTypeUnknown) {}
+
+ ReadStringAndDumpToStreamOptions(ValueObject &valobj);
+
+ ReadStringAndDumpToStreamOptions &SetLocation(uint64_t l) {
+ m_location = l;
+ return *this;
+ }
+
+ uint64_t GetLocation() const { return m_location; }
+
+ ReadStringAndDumpToStreamOptions &SetProcessSP(lldb::ProcessSP p) {
+ m_process_sp = p;
+ return *this;
+ }
+
+ lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
+
+ ReadStringAndDumpToStreamOptions &SetStream(Stream *s) {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream *GetStream() const { return m_stream; }
+
+ ReadStringAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
+
+ ReadStringAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
+
+ ReadStringAndDumpToStreamOptions &SetQuote(char q) {
+ m_quote = q;
+ return *this;
+ }
+
+ char GetQuote() const { return m_quote; }
+
+ ReadStringAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t GetSourceSize() const { return m_source_size; }
+
+ ReadStringAndDumpToStreamOptions &SetNeedsZeroTermination(bool z) {
+ m_needs_zero_termination = z;
+ return *this;
+ }
+
+ bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
+
+ ReadStringAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
+
+ ReadStringAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
+
+ ReadStringAndDumpToStreamOptions &SetIgnoreMaxLength(bool e) {
+ m_ignore_max_length = e;
+ return *this;
+ }
+
+ bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
+
+ ReadStringAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType GetLanguage() const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ uint64_t m_location;
+ lldb::ProcessSP m_process_sp;
+ Stream *m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_needs_zero_termination;
+ bool m_escape_non_printables;
+ bool m_ignore_max_length;
+ bool m_zero_is_terminator;
+ lldb::LanguageType m_language_type;
+ };
+
+ class ReadBufferAndDumpToStreamOptions {
+ public:
+ ReadBufferAndDumpToStreamOptions()
+ : m_data(), m_stream(nullptr), m_prefix_token(), m_suffix_token(),
+ m_quote('"'), m_source_size(0), m_escape_non_printables(true),
+ m_zero_is_terminator(true), m_is_truncated(false),
+ m_language_type(lldb::eLanguageTypeUnknown) {}
+
+ ReadBufferAndDumpToStreamOptions(ValueObject &valobj);
+
+ ReadBufferAndDumpToStreamOptions(
+ const ReadStringAndDumpToStreamOptions &options);
+
+ ReadBufferAndDumpToStreamOptions &SetData(DataExtractor d) {
+ m_data = d;
+ return *this;
+ }
+
+ lldb_private::DataExtractor GetData() const { return m_data; }
+
+ ReadBufferAndDumpToStreamOptions &SetStream(Stream *s) {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream *GetStream() const { return m_stream; }
+
+ ReadBufferAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
+
+ ReadBufferAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
+
+ ReadBufferAndDumpToStreamOptions &SetQuote(char q) {
+ m_quote = q;
+ return *this;
+ }
+
+ char GetQuote() const { return m_quote; }
+
+ ReadBufferAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t GetSourceSize() const { return m_source_size; }
+
+ ReadBufferAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
+
+ ReadBufferAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
+
+ ReadBufferAndDumpToStreamOptions &SetIsTruncated(bool t) {
+ m_is_truncated = t;
+ return *this;
+ }
+
+ bool GetIsTruncated() const { return m_is_truncated; }
+
+ ReadBufferAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType GetLanguage() const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ DataExtractor m_data;
+ Stream *m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_escape_non_printables;
+ bool m_zero_is_terminator;
+ bool m_is_truncated;
+ lldb::LanguageType m_language_type;
+ };
+
+ // I can't use a std::unique_ptr for this because the Deleter is a template
+ // argument there
+ // and I want the same type to represent both pointers I want to free and
+ // pointers I don't need to free - which is what this class essentially is
+ // It's very specialized to the needs of this file, and not suggested for
+ // general use
+ template <typename T = uint8_t, typename U = char, typename S = size_t>
+ struct StringPrinterBufferPointer {
+ public:
+ typedef std::function<void(const T *)> Deleter;
+
+ StringPrinterBufferPointer(std::nullptr_t ptr)
+ : m_data(nullptr), m_size(0), m_deleter() {}
+
+ StringPrinterBufferPointer(const T *bytes, S size,
+ Deleter deleter = nullptr)
+ : m_data(bytes), m_size(size), m_deleter(deleter) {}
+
+ StringPrinterBufferPointer(const U *bytes, S size,
+ Deleter deleter = nullptr)
+ : m_data(reinterpret_cast<const T *>(bytes)), m_size(size),
+ m_deleter(deleter) {}
+
+ StringPrinterBufferPointer(StringPrinterBufferPointer &&rhs)
+ : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
+ rhs.m_data = nullptr;
+ }
+
+ StringPrinterBufferPointer(const StringPrinterBufferPointer &rhs)
+ : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
+ rhs.m_data = nullptr; // this is why m_data has to be mutable
+ }
+
+ ~StringPrinterBufferPointer() {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = nullptr;
+ }
+
+ const T *GetBytes() const { return m_data; }
+
+ const S GetSize() const { return m_size; }
+
+ StringPrinterBufferPointer &
+ operator=(const StringPrinterBufferPointer &rhs) {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = rhs.m_data;
+ m_size = rhs.m_size;
+ m_deleter = rhs.m_deleter;
+ rhs.m_data = nullptr;
+ return *this;
+ }
+
+ private:
+ mutable const T *m_data;
+ size_t m_size;
+ Deleter m_deleter;
+ };
+
+ typedef std::function<StringPrinter::StringPrinterBufferPointer<
+ uint8_t, char, size_t>(uint8_t *, uint8_t *, uint8_t *&)>
+ EscapingHelper;
+ typedef std::function<EscapingHelper(GetPrintableElementType)>
+ EscapingHelperGenerator;
+
+ static EscapingHelper
+ GetDefaultEscapingHelper(GetPrintableElementType elem_type);
+
+ template <StringElementType element_type>
+ static bool
+ ReadStringAndDumpToStream(const ReadStringAndDumpToStreamOptions &options);
+
+ template <StringElementType element_type>
+ static bool
+ ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options);
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_StringPrinter_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
new file mode 100644
index 0000000..bdb393a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
@@ -0,0 +1,427 @@
+//===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategory_h_
+#define lldb_TypeCategory_h_
+
+#include <initializer_list>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormattersContainer.h"
+
+namespace lldb_private {
+
+template <typename FormatterImpl> class FormatterContainerPair {
+public:
+ typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
+ typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl>
+ RegexMatchContainer;
+
+ typedef typename ExactMatchContainer::MapType ExactMatchMap;
+ typedef typename RegexMatchContainer::MapType RegexMatchMap;
+
+ typedef typename ExactMatchContainer::MapValueType MapValueType;
+
+ typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
+ typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
+
+ typedef
+ typename ExactMatchContainer::ForEachCallback ExactMatchForEachCallback;
+ typedef
+ typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
+
+ FormatterContainerPair(const char *exact_name, const char *regex_name,
+ IFormatChangeListener *clist)
+ : m_exact_sp(new ExactMatchContainer(std::string(exact_name), clist)),
+ m_regex_sp(new RegexMatchContainer(std::string(regex_name), clist)) {}
+
+ ~FormatterContainerPair() = default;
+
+ ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
+
+ RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
+
+ uint32_t GetCount() {
+ return GetExactMatch()->GetCount() + GetRegexMatch()->GetCount();
+ }
+
+private:
+ ExactMatchContainerSP m_exact_sp;
+ RegexMatchContainerSP m_regex_sp;
+};
+
+class TypeCategoryImpl {
+private:
+ typedef FormatterContainerPair<TypeFormatImpl> FormatContainer;
+ typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer;
+ typedef FormatterContainerPair<TypeFilterImpl> FilterContainer;
+ typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
+ typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
+
+public:
+ typedef uint16_t FormatCategoryItems;
+ static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
+
+ typedef FormatContainer::ExactMatchContainerSP FormatContainerSP;
+ typedef FormatContainer::RegexMatchContainerSP RegexFormatContainerSP;
+
+ typedef SummaryContainer::ExactMatchContainerSP SummaryContainerSP;
+ typedef SummaryContainer::RegexMatchContainerSP RegexSummaryContainerSP;
+
+ typedef FilterContainer::ExactMatchContainerSP FilterContainerSP;
+ typedef FilterContainer::RegexMatchContainerSP RegexFilterContainerSP;
+
+ typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
+ typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
+
+ typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
+ typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
+
+ template <typename T> class ForEachCallbacks {
+ public:
+ ForEachCallbacks() = default;
+ ~ForEachCallbacks() = default;
+
+ template <typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(FormatContainer::ExactMatchForEachCallback callback) {
+ m_format_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
+ m_format_regex = callback;
+ return *this;
+ }
+
+ template <typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
+ m_summary_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
+ m_summary_regex = callback;
+ return *this;
+ }
+
+ template <typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(FilterContainer::ExactMatchForEachCallback callback) {
+ m_filter_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
+ m_filter_regex = callback;
+ return *this;
+ }
+
+ template <typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(SynthContainer::ExactMatchForEachCallback callback) {
+ m_synth_exact = callback;
+ return *this;
+ }
+ template <typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
+ m_synth_regex = callback;
+ return *this;
+ }
+ template <typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(ValidatorContainer::ExactMatchForEachCallback callback) {
+ m_validator_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(ValidatorContainer::RegexMatchForEachCallback callback) {
+ m_validator_regex = callback;
+ return *this;
+ }
+
+ FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
+ return m_format_exact;
+ }
+ FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
+ return m_format_regex;
+ }
+
+ SummaryContainer::ExactMatchForEachCallback
+ GetSummaryExactCallback() const {
+ return m_summary_exact;
+ }
+ SummaryContainer::RegexMatchForEachCallback
+ GetSummaryRegexCallback() const {
+ return m_summary_regex;
+ }
+
+ FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
+ return m_filter_exact;
+ }
+ FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
+ return m_filter_regex;
+ }
+
+ SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
+ return m_synth_exact;
+ }
+ SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
+ return m_synth_regex;
+ }
+
+ ValidatorContainer::ExactMatchForEachCallback
+ GetValidatorExactCallback() const {
+ return m_validator_exact;
+ }
+ ValidatorContainer::RegexMatchForEachCallback
+ GetValidatorRegexCallback() const {
+ return m_validator_regex;
+ }
+
+ private:
+ FormatContainer::ExactMatchForEachCallback m_format_exact;
+ FormatContainer::RegexMatchForEachCallback m_format_regex;
+
+ SummaryContainer::ExactMatchForEachCallback m_summary_exact;
+ SummaryContainer::RegexMatchForEachCallback m_summary_regex;
+
+ FilterContainer::ExactMatchForEachCallback m_filter_exact;
+ FilterContainer::RegexMatchForEachCallback m_filter_regex;
+
+ SynthContainer::ExactMatchForEachCallback m_synth_exact;
+ SynthContainer::RegexMatchForEachCallback m_synth_regex;
+
+ ValidatorContainer::ExactMatchForEachCallback m_validator_exact;
+ ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
+ };
+
+ TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
+ std::initializer_list<lldb::LanguageType> langs = {});
+
+ template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
+ GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
+ GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
+
+ GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
+ GetRegexTypeSummariesContainer()->ForEach(
+ foreach.GetSummaryRegexCallback());
+
+ GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
+ GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
+
+ GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
+ GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
+
+ GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback());
+ GetRegexTypeValidatorsContainer()->ForEach(
+ foreach.GetValidatorRegexCallback());
+ }
+
+ FormatContainerSP GetTypeFormatsContainer() {
+ return m_format_cont.GetExactMatch();
+ }
+
+ RegexFormatContainerSP GetRegexTypeFormatsContainer() {
+ return m_format_cont.GetRegexMatch();
+ }
+
+ FormatContainer &GetFormatContainer() { return m_format_cont; }
+
+ SummaryContainerSP GetTypeSummariesContainer() {
+ return m_summary_cont.GetExactMatch();
+ }
+
+ RegexSummaryContainerSP GetRegexTypeSummariesContainer() {
+ return m_summary_cont.GetRegexMatch();
+ }
+
+ SummaryContainer &GetSummaryContainer() { return m_summary_cont; }
+
+ FilterContainerSP GetTypeFiltersContainer() {
+ return m_filter_cont.GetExactMatch();
+ }
+
+ RegexFilterContainerSP GetRegexTypeFiltersContainer() {
+ return m_filter_cont.GetRegexMatch();
+ }
+
+ FilterContainer &GetFilterContainer() { return m_filter_cont; }
+
+ FormatContainer::MapValueType
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ SummaryContainer::MapValueType
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ FilterContainer::MapValueType
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ SynthContainer::MapValueType
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ ValidatorContainer::MapValueType
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForFormatAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSummaryAtIndex(size_t index);
+
+ FormatContainer::MapValueType GetFormatAtIndex(size_t index);
+
+ SummaryContainer::MapValueType GetSummaryAtIndex(size_t index);
+
+ FilterContainer::MapValueType GetFilterAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForFilterAtIndex(size_t index);
+
+ SynthContainerSP GetTypeSyntheticsContainer() {
+ return m_synth_cont.GetExactMatch();
+ }
+
+ RegexSynthContainerSP GetRegexTypeSyntheticsContainer() {
+ return m_synth_cont.GetRegexMatch();
+ }
+
+ SynthContainer &GetSyntheticsContainer() { return m_synth_cont; }
+
+ SynthContainer::MapValueType GetSyntheticAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSyntheticAtIndex(size_t index);
+
+ ValidatorContainerSP GetTypeValidatorsContainer() {
+ return m_validator_cont.GetExactMatch();
+ }
+
+ RegexValidatorContainerSP GetRegexTypeValidatorsContainer() {
+ return m_validator_cont.GetRegexMatch();
+ }
+
+ ValidatorContainer::MapValueType GetValidatorAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForValidatorAtIndex(size_t index);
+
+ bool IsEnabled() const { return m_enabled; }
+
+ uint32_t GetEnabledPosition() {
+ if (!m_enabled)
+ return UINT32_MAX;
+ else
+ return m_enabled_position;
+ }
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeValidatorImplSP &entry, uint32_t *reason = nullptr);
+
+ void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ bool Delete(ConstString name, FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ uint32_t GetCount(FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ const char *GetName() { return m_name.GetCString(); }
+
+ size_t GetNumLanguages();
+
+ lldb::LanguageType GetLanguageAtIndex(size_t idx);
+
+ void AddLanguage(lldb::LanguageType lang);
+
+ bool HasLanguage(lldb::LanguageType lang);
+
+ std::string GetDescription();
+
+ bool AnyMatches(ConstString type_name,
+ FormatCategoryItems items = ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char **matching_category = nullptr,
+ FormatCategoryItems *matching_type = nullptr);
+
+ typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
+
+private:
+ FormatContainer m_format_cont;
+ SummaryContainer m_summary_cont;
+ FilterContainer m_filter_cont;
+ SynthContainer m_synth_cont;
+ ValidatorContainer m_validator_cont;
+
+ bool m_enabled;
+
+ IFormatChangeListener *m_change_listener;
+
+ std::recursive_mutex m_mutex;
+
+ ConstString m_name;
+
+ std::vector<lldb::LanguageType> m_languages;
+
+ uint32_t m_enabled_position;
+
+ void Enable(bool value, uint32_t position);
+
+ void Disable() { Enable(false, UINT32_MAX); }
+
+ bool IsApplicable(ValueObject &valobj);
+
+ uint32_t GetLastEnabledPosition() { return m_enabled_position; }
+
+ void SetEnabledPosition(uint32_t p) { m_enabled_position = p; }
+
+ friend class FormatManager;
+ friend class LanguageCategory;
+ friend class TypeCategoryMap;
+
+ friend class FormattersContainer<ConstString, TypeFormatImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeFormatImpl>;
+
+ friend class FormattersContainer<ConstString, TypeSummaryImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeSummaryImpl>;
+
+ friend class FormattersContainer<ConstString, TypeFilterImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeFilterImpl>;
+
+ friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
+ friend class FormattersContainer<lldb::RegularExpressionSP,
+ ScriptedSyntheticChildren>;
+
+ friend class FormattersContainer<ConstString, TypeValidatorImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP,
+ TypeValidatorImpl>;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_TypeCategory_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
new file mode 100644
index 0000000..753b58c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -0,0 +1,118 @@
+//===-- TypeCategoryMap.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategoryMap_h_
+#define lldb_TypeCategoryMap_h_
+
+#include <functional>
+#include <list>
+#include <map>
+#include <mutex>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormattersContainer.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+
+namespace lldb_private {
+class TypeCategoryMap {
+private:
+ typedef ConstString KeyType;
+ typedef TypeCategoryImpl ValueType;
+ typedef ValueType::SharedPointer ValueSP;
+ typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
+ typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
+
+public:
+ typedef std::map<KeyType, ValueSP> MapType;
+ typedef MapType::iterator MapIterator;
+ typedef std::function<bool(const ValueSP &)> ForEachCallback;
+
+ typedef uint32_t Position;
+
+ static const Position First = 0;
+ static const Position Default = 1;
+ static const Position Last = UINT32_MAX;
+
+ TypeCategoryMap(IFormatChangeListener *lst);
+
+ void Add(KeyType name, const ValueSP &entry);
+
+ bool Delete(KeyType name);
+
+ bool Enable(KeyType category_name, Position pos = Default);
+
+ bool Disable(KeyType category_name);
+
+ bool Enable(ValueSP category, Position pos = Default);
+
+ bool Disable(ValueSP category);
+
+ void EnableAllCategories();
+
+ void DisableAllCategories();
+
+ void Clear();
+
+ bool Get(KeyType name, ValueSP &entry);
+
+ bool Get(uint32_t pos, ValueSP &entry);
+
+ void ForEach(ForEachCallback callback);
+
+ lldb::TypeCategoryImplSP GetAtIndex(uint32_t);
+
+ bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
+
+ uint32_t GetCount() { return m_map.size(); }
+
+ lldb::TypeFormatImplSP GetFormat(FormattersMatchData &match_data);
+
+ lldb::TypeSummaryImplSP GetSummaryFormat(FormattersMatchData &match_data);
+
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren(FormattersMatchData &match_data);
+
+ lldb::TypeValidatorImplSP GetValidator(FormattersMatchData &match_data);
+
+private:
+ class delete_matching_categories {
+ lldb::TypeCategoryImplSP ptr;
+
+ public:
+ delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p) {}
+
+ bool operator()(const lldb::TypeCategoryImplSP &other) {
+ return ptr.get() == other.get();
+ }
+ };
+
+ std::recursive_mutex m_map_mutex;
+ IFormatChangeListener *listener;
+
+ MapType m_map;
+ ActiveCategoriesList m_active_categories;
+
+ MapType &map() { return m_map; }
+
+ ActiveCategoriesList &active_list() { return m_active_categories; }
+
+ std::recursive_mutex &mutex() { return m_map_mutex; }
+
+ friend class FormattersContainer<KeyType, ValueType>;
+ friend class FormatManager;
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeCategoryMap_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
new file mode 100644
index 0000000..77e8c0e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
@@ -0,0 +1,217 @@
+//===-- TypeFormat.h ----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeFormat_h_
+#define lldb_TypeFormat_h_
+
+
+#include <functional>
+#include <string>
+#include <unordered_map>
+
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+
+namespace lldb_private {
+class TypeFormatImpl {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ TypeFormatImpl(const Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
+
+ virtual ~TypeFormatImpl();
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ enum class Type { eTypeUnknown, eTypeFormat, eTypeEnum };
+
+ virtual Type GetType() { return Type::eTypeUnknown; }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its value
+ virtual bool FormatObject(ValueObject *valobj, std::string &dest) const = 0;
+
+ virtual std::string GetDescription() = 0;
+
+protected:
+ Flags m_flags;
+ uint32_t m_my_revision;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
+};
+
+class TypeFormatImpl_Format : public TypeFormatImpl {
+public:
+ TypeFormatImpl_Format(lldb::Format f = lldb::eFormatInvalid,
+ const TypeFormatImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
+
+ ~TypeFormatImpl_Format() override;
+
+ lldb::Format GetFormat() const { return m_format; }
+
+ void SetFormat(lldb::Format fmt) { m_format = fmt; }
+
+ TypeFormatImpl::Type GetType() override {
+ return TypeFormatImpl::Type::eTypeFormat;
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ lldb::Format m_format;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_Format);
+};
+
+class TypeFormatImpl_EnumType : public TypeFormatImpl {
+public:
+ TypeFormatImpl_EnumType(ConstString type_name = ConstString(""),
+ const TypeFormatImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
+
+ ~TypeFormatImpl_EnumType() override;
+
+ ConstString GetTypeName() { return m_enum_type; }
+
+ void SetTypeName(ConstString enum_type) { m_enum_type = enum_type; }
+
+ TypeFormatImpl::Type GetType() override {
+ return TypeFormatImpl::Type::eTypeEnum;
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ ConstString m_enum_type;
+ mutable std::unordered_map<void *, CompilerType> m_types;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeFormat_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
new file mode 100644
index 0000000..9c97b36
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
@@ -0,0 +1,394 @@
+//===-- TypeSummary.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSummary_h_
+#define lldb_TypeSummary_h_
+
+#include <stdint.h>
+
+#include <functional>
+#include <memory>
+#include <string>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+class TypeSummaryOptions {
+public:
+ TypeSummaryOptions();
+
+ ~TypeSummaryOptions() = default;
+
+ lldb::LanguageType GetLanguage() const;
+
+ lldb::TypeSummaryCapping GetCapping() const;
+
+ TypeSummaryOptions &SetLanguage(lldb::LanguageType);
+
+ TypeSummaryOptions &SetCapping(lldb::TypeSummaryCapping);
+
+private:
+ lldb::LanguageType m_lang;
+ lldb::TypeSummaryCapping m_capping;
+};
+
+class TypeSummaryImpl {
+public:
+ enum class Kind { eSummaryString, eScript, eCallback, eInternal };
+
+ virtual ~TypeSummaryImpl() = default;
+
+ Kind GetKind() const { return m_kind; }
+
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetDontShowChildren() const {
+ return (m_flags & lldb::eTypeOptionHideChildren) ==
+ lldb::eTypeOptionHideChildren;
+ }
+
+ Flags &SetDontShowChildren(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideChildren;
+ else
+ m_flags &= ~lldb::eTypeOptionHideChildren;
+ return *this;
+ }
+
+ bool GetHideEmptyAggregates() const {
+ return (m_flags & lldb::eTypeOptionHideEmptyAggregates) ==
+ lldb::eTypeOptionHideEmptyAggregates;
+ }
+
+ Flags &SetHideEmptyAggregates(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideEmptyAggregates;
+ else
+ m_flags &= ~lldb::eTypeOptionHideEmptyAggregates;
+ return *this;
+ }
+
+ bool GetDontShowValue() const {
+ return (m_flags & lldb::eTypeOptionHideValue) ==
+ lldb::eTypeOptionHideValue;
+ }
+
+ Flags &SetDontShowValue(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideValue;
+ else
+ m_flags &= ~lldb::eTypeOptionHideValue;
+ return *this;
+ }
+
+ bool GetShowMembersOneLiner() const {
+ return (m_flags & lldb::eTypeOptionShowOneLiner) ==
+ lldb::eTypeOptionShowOneLiner;
+ }
+
+ Flags &SetShowMembersOneLiner(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionShowOneLiner;
+ else
+ m_flags &= ~lldb::eTypeOptionShowOneLiner;
+ return *this;
+ }
+
+ bool GetHideItemNames() const {
+ return (m_flags & lldb::eTypeOptionHideNames) ==
+ lldb::eTypeOptionHideNames;
+ }
+
+ Flags &SetHideItemNames(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideNames;
+ else
+ m_flags &= ~lldb::eTypeOptionHideNames;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ virtual bool DoesPrintChildren(ValueObject *valobj) const {
+ return !m_flags.GetDontShowChildren();
+ }
+
+ virtual bool DoesPrintEmptyAggregates() const {
+ return !m_flags.GetHideEmptyAggregates();
+ }
+
+ virtual bool DoesPrintValue(ValueObject *valobj) const {
+ return !m_flags.GetDontShowValue();
+ }
+
+ bool IsOneLiner() const { return m_flags.GetShowMembersOneLiner(); }
+
+ virtual bool HideNames(ValueObject *valobj) const {
+ return m_flags.GetHideItemNames();
+ }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ virtual void SetDoesPrintChildren(bool value) {
+ m_flags.SetDontShowChildren(!value);
+ }
+
+ virtual void SetDoesPrintValue(bool value) {
+ m_flags.SetDontShowValue(!value);
+ }
+
+ void SetIsOneLiner(bool value) { m_flags.SetShowMembersOneLiner(value); }
+
+ virtual void SetHideNames(bool value) { m_flags.SetHideItemNames(value); }
+
+ virtual void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its summary
+ virtual bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
+
+protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+ TypeSummaryImpl(Kind kind, const TypeSummaryImpl::Flags &flags);
+
+private:
+ Kind m_kind;
+ DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
+};
+
+// simple string-based summaries, using ${var to show data
+struct StringSummaryFormat : public TypeSummaryImpl {
+ std::string m_format_str;
+ FormatEntity::Entry m_format;
+ Status m_error;
+
+ StringSummaryFormat(const TypeSummaryImpl::Flags &flags, const char *f);
+
+ ~StringSummaryFormat() override = default;
+
+ const char *GetSummaryString() const { return m_format_str.c_str(); }
+
+ void SetSummaryString(const char *f);
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eSummaryString;
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
+};
+
+// summaries implemented via a C++ function
+struct CXXFunctionSummaryFormat : public TypeSummaryImpl {
+ // we should convert these to SBValue and SBStream if we ever cross the
+ // boundary towards the external world
+ typedef std::function<bool(ValueObject &, Stream &,
+ const TypeSummaryOptions &)>
+ Callback;
+
+ Callback m_impl;
+ std::string m_description;
+
+ CXXFunctionSummaryFormat(const TypeSummaryImpl::Flags &flags, Callback impl,
+ const char *description);
+
+ ~CXXFunctionSummaryFormat() override = default;
+
+ Callback GetBackendFunction() const { return m_impl; }
+
+ const char *GetTextualInfo() const { return m_description.c_str(); }
+
+ void SetBackendFunction(Callback cb_func) { m_impl = cb_func; }
+
+ void SetTextualInfo(const char *descr) {
+ if (descr)
+ m_description.assign(descr);
+ else
+ m_description.clear();
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eCallback;
+ }
+
+ typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
+};
+
+// Python-based summaries, running script code to show data
+struct ScriptSummaryFormat : public TypeSummaryImpl {
+ std::string m_function_name;
+ std::string m_python_script;
+ StructuredData::ObjectSP m_script_function_sp;
+
+ ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
+ const char *function_name,
+ const char *python_script = nullptr);
+
+ ~ScriptSummaryFormat() override = default;
+
+ const char *GetFunctionName() const { return m_function_name.c_str(); }
+
+ const char *GetPythonScript() const { return m_python_script.c_str(); }
+
+ void SetFunctionName(const char *function_name) {
+ if (function_name)
+ m_function_name.assign(function_name);
+ else
+ m_function_name.clear();
+ m_python_script.clear();
+ }
+
+ void SetPythonScript(const char *script) {
+ if (script)
+ m_python_script.assign(script);
+ else
+ m_python_script.clear();
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eScript;
+ }
+
+ typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeSummary_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
new file mode 100644
index 0000000..93443cf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
@@ -0,0 +1,455 @@
+//===-- TypeSynthetic.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSynthetic_h_
+#define lldb_TypeSynthetic_h_
+
+#include <stdint.h>
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+class SyntheticChildrenFrontEnd {
+protected:
+ ValueObject &m_backend;
+
+ void SetValid(bool valid) { m_valid = valid; }
+
+ bool IsValid() { return m_valid; }
+
+public:
+ SyntheticChildrenFrontEnd(ValueObject &backend)
+ : m_backend(backend), m_valid(true) {}
+
+ virtual ~SyntheticChildrenFrontEnd() = default;
+
+ virtual size_t CalculateNumChildren() = 0;
+
+ virtual size_t CalculateNumChildren(uint32_t max) {
+ auto count = CalculateNumChildren();
+ return count <= max ? count : max;
+ }
+
+ virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx) = 0;
+
+ virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
+
+ // this function is assumed to always succeed and it if fails, the front-end
+ // should know to deal with it in the correct way (most probably, by refusing
+ // to return any children) the return value of Update() should actually be
+ // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
+ // ValueObjectSyntheticFilter is allowed to use the children it fetched
+ // previously and cached if =false, ValueObjectSyntheticFilter must throw
+ // away its cache, and query again for children
+ virtual bool Update() = 0;
+
+ // if this function returns false, then CalculateNumChildren() MUST return 0
+ // since UI frontends might validly decide not to inquire for children given
+ // a false return value from this call if it returns true, then
+ // CalculateNumChildren() can return any number >= 0 (0 being valid) it
+ // should if at all possible be more efficient than CalculateNumChildren()
+ virtual bool MightHaveChildren() = 0;
+
+ // if this function returns a non-null ValueObject, then the returned
+ // ValueObject will stand for this ValueObject whenever a "value" request is
+ // made to this ValueObject
+ virtual lldb::ValueObjectSP GetSyntheticValue() { return nullptr; }
+
+ // if this function returns a non-empty ConstString, then clients are
+ // expected to use the return as the name of the type of this ValueObject for
+ // display purposes
+ virtual ConstString GetSyntheticTypeName() { return ConstString(); }
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+ typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer;
+
+protected:
+ lldb::ValueObjectSP
+ CreateValueObjectFromExpression(llvm::StringRef name,
+ llvm::StringRef expression,
+ const ExecutionContext &exe_ctx);
+
+ lldb::ValueObjectSP
+ CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address,
+ const ExecutionContext &exe_ctx,
+ CompilerType type);
+
+ lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name,
+ const DataExtractor &data,
+ const ExecutionContext &exe_ctx,
+ CompilerType type);
+
+private:
+ bool m_valid;
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
+};
+
+class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ SyntheticValueProviderFrontEnd(ValueObject &backend)
+ : SyntheticChildrenFrontEnd(backend) {}
+
+ ~SyntheticValueProviderFrontEnd() override = default;
+
+ size_t CalculateNumChildren() override { return 0; }
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { return nullptr; }
+
+ size_t GetIndexOfChildWithName(ConstString name) override {
+ return UINT32_MAX;
+ }
+
+ bool Update() override { return false; }
+
+ bool MightHaveChildren() override { return false; }
+
+ lldb::ValueObjectSP GetSyntheticValue() override = 0;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
+};
+
+class SyntheticChildren {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ bool GetFrontEndWantsDereference() const {
+ return (m_flags & lldb::eTypeOptionFrontEndWantsDereference) ==
+ lldb::eTypeOptionFrontEndWantsDereference;
+ }
+
+ Flags &SetFrontEndWantsDereference(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionFrontEndWantsDereference;
+ else
+ m_flags &= ~lldb::eTypeOptionFrontEndWantsDereference;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ SyntheticChildren(const Flags &flags) : m_flags(flags) {}
+
+ virtual ~SyntheticChildren() = default;
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ bool WantsDereference() const { return m_flags.GetFrontEndWantsDereference();}
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ virtual bool IsScripted() = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) = 0;
+
+ typedef std::shared_ptr<SyntheticChildren> SharedPointer;
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
+};
+
+class TypeFilterImpl : public SyntheticChildren {
+ std::vector<std::string> m_expression_paths;
+
+public:
+ TypeFilterImpl(const SyntheticChildren::Flags &flags)
+ : SyntheticChildren(flags), m_expression_paths() {}
+
+ TypeFilterImpl(const SyntheticChildren::Flags &flags,
+ const std::initializer_list<const char *> items)
+ : SyntheticChildren(flags), m_expression_paths() {
+ for (auto path : items)
+ AddExpressionPath(path);
+ }
+
+ void AddExpressionPath(const char *path) {
+ AddExpressionPath(std::string(path));
+ }
+
+ void Clear() { m_expression_paths.clear(); }
+
+ size_t GetCount() const { return m_expression_paths.size(); }
+
+ const char *GetExpressionPathAtIndex(size_t i) const {
+ return m_expression_paths[i].c_str();
+ }
+
+ bool SetExpressionPathAtIndex(size_t i, const char *path) {
+ return SetExpressionPathAtIndex(i, std::string(path));
+ }
+
+ void AddExpressionPath(const std::string &path);
+
+ bool SetExpressionPathAtIndex(size_t i, const std::string &path);
+
+ bool IsScripted() override { return false; }
+
+ std::string GetDescription() override;
+
+ class FrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+ FrontEnd(TypeFilterImpl *flt, ValueObject &backend)
+ : SyntheticChildrenFrontEnd(backend), filter(flt) {}
+
+ ~FrontEnd() override = default;
+
+ size_t CalculateNumChildren() override { return filter->GetCount(); }
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+ if (idx >= filter->GetCount())
+ return lldb::ValueObjectSP();
+ return m_backend.GetSyntheticExpressionPathChild(
+ filter->GetExpressionPathAtIndex(idx), true);
+ }
+
+ bool Update() override { return false; }
+
+ bool MightHaveChildren() override { return filter->GetCount() > 0; }
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+ private:
+ TypeFilterImpl *filter;
+
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
+ }
+
+ typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
+};
+
+class CXXSyntheticChildren : public SyntheticChildren {
+public:
+ typedef std::function<SyntheticChildrenFrontEnd *(CXXSyntheticChildren *,
+ lldb::ValueObjectSP)>
+ CreateFrontEndCallback;
+ CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
+ const char *description, CreateFrontEndCallback callback)
+ : SyntheticChildren(flags), m_create_callback(callback),
+ m_description(description ? description : "") {}
+
+ bool IsScripted() override { return false; }
+
+ std::string GetDescription() override;
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ return SyntheticChildrenFrontEnd::AutoPointer(
+ m_create_callback(this, backend.GetSP()));
+ }
+
+protected:
+ CreateFrontEndCallback m_create_callback;
+ std::string m_description;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+};
+
+class ScriptedSyntheticChildren : public SyntheticChildren {
+ std::string m_python_class;
+ std::string m_python_code;
+
+public:
+ ScriptedSyntheticChildren(const SyntheticChildren::Flags &flags,
+ const char *pclass, const char *pcode = nullptr)
+ : SyntheticChildren(flags), m_python_class(), m_python_code() {
+ if (pclass)
+ m_python_class = pclass;
+ if (pcode)
+ m_python_code = pcode;
+ }
+
+ const char *GetPythonClassName() { return m_python_class.c_str(); }
+
+ const char *GetPythonCode() { return m_python_code.c_str(); }
+
+ void SetPythonClassName(const char *fname) {
+ m_python_class.assign(fname);
+ m_python_code.clear();
+ }
+
+ void SetPythonCode(const char *script) { m_python_code.assign(script); }
+
+ std::string GetDescription() override;
+
+ bool IsScripted() override { return true; }
+
+ class FrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+ FrontEnd(std::string pclass, ValueObject &backend);
+
+ ~FrontEnd() override;
+
+ bool IsValid();
+
+ size_t CalculateNumChildren() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+ bool Update() override;
+
+ bool MightHaveChildren() override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+ lldb::ValueObjectSP GetSyntheticValue() override;
+
+ ConstString GetSyntheticTypeName() override;
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+ private:
+ std::string m_python_class;
+ StructuredData::ObjectSP m_wrapper_sp;
+ ScriptInterpreter *m_interpreter;
+
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(
+ new FrontEnd(m_python_class, backend));
+ if (synth_ptr && ((FrontEnd *)synth_ptr.get())->IsValid())
+ return synth_ptr;
+ return nullptr;
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeSynthetic_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h b/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
new file mode 100644
index 0000000..531812e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
@@ -0,0 +1,201 @@
+//===-- TypeValidator.h ------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeValidator_h_
+#define lldb_TypeValidator_h_
+
+
+#include <functional>
+#include <string>
+
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class TypeValidatorImpl {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ TypeValidatorImpl(const Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
+
+ virtual ~TypeValidatorImpl();
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ enum class Type { eTypeUnknown, eTypeCXX };
+
+ struct ValidationResult {
+ TypeValidatorResult m_result;
+ std::string m_message;
+ };
+
+ virtual Type GetType() { return Type::eTypeUnknown; }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its value
+ virtual ValidationResult FormatObject(ValueObject *valobj) const = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ static ValidationResult Success();
+
+ static ValidationResult Failure(std::string message);
+
+protected:
+ Flags m_flags;
+ uint32_t m_my_revision;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl);
+};
+
+class TypeValidatorImpl_CXX : public TypeValidatorImpl {
+public:
+ typedef std::function<TypeValidatorImpl::ValidationResult(
+ ValueObject *valobj)>
+ ValidatorFunction;
+
+ TypeValidatorImpl_CXX(ValidatorFunction f, std::string d,
+ const TypeValidatorImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
+
+ ~TypeValidatorImpl_CXX() override;
+
+ ValidatorFunction GetValidatorFunction() const {
+ return m_validator_function;
+ }
+
+ void SetValidatorFunction(ValidatorFunction f) { m_validator_function = f; }
+
+ TypeValidatorImpl::Type GetType() override {
+ return TypeValidatorImpl::Type::eTypeCXX;
+ }
+
+ ValidationResult FormatObject(ValueObject *valobj) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ std::string m_description;
+ ValidatorFunction m_validator_function;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_TypeValidator_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
new file mode 100644
index 0000000..41adc2d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -0,0 +1,157 @@
+//===-- ValueObjectPrinter.h ---------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_ValueObjectPrinter_h_
+#define lldb_ValueObjectPrinter_h_
+
+
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private {
+
+class ValueObjectPrinter {
+public:
+ ValueObjectPrinter(ValueObject *valobj, Stream *s);
+
+ ValueObjectPrinter(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options);
+
+ ~ValueObjectPrinter() {}
+
+ bool PrintValueObject();
+
+protected:
+ typedef std::set<uint64_t> InstancePointersSet;
+ typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
+
+ InstancePointersSetSP m_printed_instance_pointers;
+
+ // only this class (and subclasses, if any) should ever be concerned with the
+ // depth mechanism
+ ValueObjectPrinter(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options,
+ const DumpValueObjectOptions::PointerDepth &ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
+
+ // we should actually be using delegating constructors here but some versions
+ // of GCC still have trouble with those
+ void Init(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options,
+ const DumpValueObjectOptions::PointerDepth &ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
+
+ bool GetMostSpecializedValue();
+
+ const char *GetDescriptionForDisplay();
+
+ const char *GetRootNameForDisplay(const char *if_fail = nullptr);
+
+ bool ShouldPrintValueObject();
+
+ bool ShouldPrintValidation();
+
+ bool IsNil();
+
+ bool IsUninitialized();
+
+ bool IsPtr();
+
+ bool IsRef();
+
+ bool IsInstancePointer();
+
+ bool IsAggregate();
+
+ bool PrintValidationMarkerIfNeeded();
+
+ bool PrintValidationErrorIfNeeded();
+
+ bool PrintLocationIfNeeded();
+
+ void PrintDecl();
+
+ bool CheckScopeIfNeeded();
+
+ bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed);
+
+ TypeSummaryImpl *GetSummaryFormatter(bool null_if_omitted = true);
+
+ void GetValueSummaryError(std::string &value, std::string &summary,
+ std::string &error);
+
+ bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed);
+
+ bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed);
+
+ bool
+ ShouldPrintChildren(bool is_failed_description,
+ DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ bool ShouldExpandEmptyAggregates();
+
+ ValueObject *GetValueObjectForChildrenGeneration();
+
+ void PrintChildrenPreamble();
+
+ void PrintChildrenPostamble(bool print_dotdotdot);
+
+ lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx);
+
+ void PrintChild(lldb::ValueObjectSP child_sp,
+ const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot);
+
+ void
+ PrintChildren(bool value_printed, bool summary_printed,
+ const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ void PrintChildrenIfNeeded(bool value_printed, bool summary_printed);
+
+ bool PrintChildrenOneLiner(bool hide_names);
+
+private:
+ ValueObject *m_orig_valobj;
+ ValueObject *m_valobj;
+ Stream *m_stream;
+ DumpValueObjectOptions m_options;
+ Flags m_type_flags;
+ CompilerType m_compiler_type;
+ DumpValueObjectOptions::PointerDepth m_ptr_depth;
+ uint32_t m_curr_depth;
+ LazyBool m_should_print;
+ LazyBool m_is_nil;
+ LazyBool m_is_uninit;
+ LazyBool m_is_ptr;
+ LazyBool m_is_ref;
+ LazyBool m_is_aggregate;
+ LazyBool m_is_instance_ptr;
+ std::pair<TypeSummaryImpl *, bool> m_summary_formatter;
+ std::string m_value;
+ std::string m_summary;
+ std::string m_error;
+ bool m_val_summary_ok;
+ std::pair<TypeValidatorResult, std::string> m_validation;
+
+ friend struct StringSummaryFormat;
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_ValueObjectPrinter_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
new file mode 100644
index 0000000..cde4be4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
@@ -0,0 +1,45 @@
+//===-- VectorIterator.h ----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorIterator_h_
+#define liblldb_VectorIterator_h_
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+namespace formatters {
+class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
+ ConstString item_name);
+
+ size_t CalculateNumChildren() override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+ bool Update() override;
+
+ bool MightHaveChildren() override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+private:
+ ExecutionContextRef m_exe_ctx_ref;
+ ConstString m_item_name;
+ lldb::ValueObjectSP m_item_sp;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CF_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorType.h b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
new file mode 100644
index 0000000..b757f75
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
@@ -0,0 +1,24 @@
+//===-- VectorType.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorType_h_
+#define liblldb_VectorType_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+namespace formatters {
+bool VectorTypeSummaryProvider(ValueObject &, Stream &,
+ const TypeSummaryOptions &);
+
+SyntheticChildrenFrontEnd *
+VectorTypeSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP);
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_VectorType_h_
diff --git a/linux-x64/clang/include/lldb/Expression/DWARFExpression.h b/linux-x64/clang/include/lldb/Expression/DWARFExpression.h
new file mode 100644
index 0000000..21830a5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/DWARFExpression.h
@@ -0,0 +1,322 @@
+//===-- DWARFExpression.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DWARFExpression_h_
+#define liblldb_DWARFExpression_h_
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/Disassembler.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Scalar.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private.h"
+#include <functional>
+
+class DWARFUnit;
+
+namespace lldb_private {
+
+/// \class DWARFExpression DWARFExpression.h
+/// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
+/// expression and interprets it.
+///
+/// DWARF location expressions are used in two ways by LLDB. The first
+/// use is to find entities specified in the debug information, since their
+/// locations are specified in precisely this language. The second is to
+/// interpret expressions without having to run the target in cases where the
+/// overhead from copying JIT-compiled code into the target is too high or
+/// where the target cannot be run. This class encapsulates a single DWARF
+/// location expression or a location list and interprets it.
+class DWARFExpression {
+public:
+ enum LocationListFormat : uint8_t {
+ NonLocationList, // Not a location list
+ RegularLocationList, // Location list format used in non-split dwarf files
+ SplitDwarfLocationList, // Location list format used in pre-DWARF v5 split
+ // dwarf files (.debug_loc.dwo)
+ LocLists, // Location list format used in DWARF v5
+ // (.debug_loclists/.debug_loclists.dwo).
+ };
+
+ DWARFExpression();
+
+ /// Constructor
+ ///
+ /// \param[in] data
+ /// A data extractor configured to read the DWARF location expression's
+ /// bytecode.
+ ///
+ /// \param[in] data_offset
+ /// The offset of the location expression in the extractor.
+ ///
+ /// \param[in] data_length
+ /// The byte length of the location expression.
+ DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
+ const DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
+ lldb::offset_t data_length);
+
+ /// Destructor
+ virtual ~DWARFExpression();
+
+ /// Print the description of the expression to a stream
+ ///
+ /// \param[in] s
+ /// The stream to print to.
+ ///
+ /// \param[in] level
+ /// The level of verbosity to use.
+ ///
+ /// \param[in] location_list_base_addr
+ /// If this is a location list based expression, this is the
+ /// address of the object that owns it. NOTE: this value is
+ /// different from the DWARF version of the location list base
+ /// address which is compile unit relative. This base address
+ /// is the address of the object that owns the location list.
+ ///
+ /// \param[in] abi
+ /// An optional ABI plug-in that can be used to resolve register
+ /// names.
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ lldb::addr_t location_list_base_addr, ABI *abi) const;
+
+ /// Return true if the location expression contains data
+ bool IsValid() const;
+
+ /// Return true if a location list was provided
+ bool IsLocationList() const;
+
+ /// Search for a load address in the location list
+ ///
+ /// \param[in] process
+ /// The process to use when resolving the load address
+ ///
+ /// \param[in] addr
+ /// The address to resolve
+ ///
+ /// \return
+ /// True if IsLocationList() is true and the address was found;
+ /// false otherwise.
+ // bool
+ // LocationListContainsLoadAddress (Process* process, const Address &addr)
+ // const;
+ //
+ bool LocationListContainsAddress(lldb::addr_t loclist_base_addr,
+ lldb::addr_t addr) const;
+
+ /// If a location is not a location list, return true if the location
+ /// contains a DW_OP_addr () opcode in the stream that matches \a file_addr.
+ /// If file_addr is LLDB_INVALID_ADDRESS, the this function will return true
+ /// if the variable there is any DW_OP_addr in a location that (yet still is
+ /// NOT a location list). This helps us detect if a variable is a global or
+ /// static variable since there is no other indication from DWARF debug
+ /// info.
+ ///
+ /// \param[in] op_addr_idx
+ /// The DW_OP_addr index to retrieve in case there is more than
+ /// one DW_OP_addr opcode in the location byte stream.
+ ///
+ /// \param[out] error
+ /// If the location stream contains unknown DW_OP opcodes or the
+ /// data is missing, \a error will be set to \b true.
+ ///
+ /// \return
+ /// LLDB_INVALID_ADDRESS if the location doesn't contain a
+ /// DW_OP_addr for \a op_addr_idx, otherwise a valid file address
+ lldb::addr_t GetLocation_DW_OP_addr(uint32_t op_addr_idx, bool &error) const;
+
+ bool Update_DW_OP_addr(lldb::addr_t file_addr);
+
+ void UpdateValue(uint64_t const_value, lldb::offset_t const_value_byte_size,
+ uint8_t addr_byte_size);
+
+ void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; }
+
+ bool ContainsThreadLocalStorage() const;
+
+ bool LinkThreadLocalStorage(
+ lldb::ModuleSP new_module_sp,
+ std::function<lldb::addr_t(lldb::addr_t file_addr)> const
+ &link_address_callback);
+
+ /// Tells the expression that it refers to a location list.
+ ///
+ /// \param[in] slide
+ /// This value should be a slide that is applied to any values
+ /// in the location list data so the values become zero based
+ /// offsets into the object that owns the location list. We need
+ /// to make location lists relative to the objects that own them
+ /// so we can relink addresses on the fly.
+ void SetLocationListSlide(lldb::addr_t slide);
+
+ /// Return the call-frame-info style register kind
+ int GetRegisterKind();
+
+ /// Set the call-frame-info style register kind
+ ///
+ /// \param[in] reg_kind
+ /// The register kind.
+ void SetRegisterKind(lldb::RegisterKind reg_kind);
+
+ /// Wrapper for the static evaluate function that accepts an
+ /// ExecutionContextScope instead of an ExecutionContext and uses member
+ /// variables to populate many operands
+ bool Evaluate(ExecutionContextScope *exe_scope,
+ lldb::addr_t loclist_base_load_addr,
+ const Value *initial_value_ptr, const Value *object_address_ptr,
+ Value &result, Status *error_ptr) const;
+
+ /// Wrapper for the static evaluate function that uses member variables to
+ /// populate many operands
+ bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
+ lldb::addr_t loclist_base_load_addr,
+ const Value *initial_value_ptr, const Value *object_address_ptr,
+ Value &result, Status *error_ptr) const;
+
+ /// Evaluate a DWARF location expression in a particular context
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context in which to evaluate the location
+ /// expression. The location expression may access the target's
+ /// memory, especially if it comes from the expression parser.
+ ///
+ /// \param[in] opcode_ctx
+ /// The module which defined the expression.
+ ///
+ /// \param[in] opcodes
+ /// This is a static method so the opcodes need to be provided
+ /// explicitly.
+ ///
+ /// \param[in] expr_locals
+ /// If the location expression was produced by the expression parser,
+ /// the list of local variables referenced by the DWARF expression.
+ /// This list should already have been populated during parsing;
+ /// the DWARF expression refers to variables by index. Can be NULL if
+ /// the location expression uses no locals.
+ ///
+ /// \param[in] decl_map
+ /// If the location expression was produced by the expression parser,
+ /// the list of external variables referenced by the location
+ /// expression. Can be NULL if the location expression uses no
+ /// external variables.
+ ///
+ /// \param[in] reg_ctx
+ /// An optional parameter which provides a RegisterContext for use
+ /// when evaluating the expression (i.e. for fetching register values).
+ /// Normally this will come from the ExecutionContext's StackFrame but
+ /// in the case where an expression needs to be evaluated while building
+ /// the stack frame list, this short-cut is available.
+ ///
+ /// \param[in] offset
+ /// The offset of the location expression in the data extractor.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the location expression.
+ ///
+ /// \param[in] reg_set
+ /// The call-frame-info style register kind.
+ ///
+ /// \param[in] initial_value_ptr
+ /// A value to put on top of the interpreter stack before evaluating
+ /// the expression, if the expression is parametrized. Can be NULL.
+ ///
+ /// \param[in] result
+ /// A value into which the result of evaluating the expression is
+ /// to be placed.
+ ///
+ /// \param[in] error_ptr
+ /// If non-NULL, used to report errors in expression evaluation.
+ ///
+ /// \return
+ /// True on success; false otherwise. If error_ptr is non-NULL,
+ /// details of the failure are provided through it.
+ static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
+ lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
+ const DWARFUnit *dwarf_cu, const lldb::offset_t offset,
+ const lldb::offset_t length,
+ const lldb::RegisterKind reg_set,
+ const Value *initial_value_ptr,
+ const Value *object_address_ptr, Value &result,
+ Status *error_ptr);
+
+ bool GetExpressionData(DataExtractor &data) const {
+ data = m_data;
+ return data.GetByteSize() > 0;
+ }
+
+ bool DumpLocationForAddress(Stream *s, lldb::DescriptionLevel level,
+ lldb::addr_t loclist_base_load_addr,
+ lldb::addr_t address, ABI *abi);
+
+ static size_t LocationListSize(const DWARFUnit *dwarf_cu,
+ const DataExtractor &debug_loc_data,
+ lldb::offset_t offset);
+
+ static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
+ int address_size, int dwarf_ref_size,
+ bool location_expression);
+
+ static void PrintDWARFLocationList(Stream &s, const DWARFUnit *cu,
+ const DataExtractor &debug_loc_data,
+ lldb::offset_t offset);
+
+ bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op);
+
+private:
+ /// Pretty-prints the location expression to a stream
+ ///
+ /// \param[in] stream
+ /// The stream to use for pretty-printing.
+ ///
+ /// \param[in] offset
+ /// The offset into the data buffer of the opcodes to be printed.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the opcodes to be printed.
+ ///
+ /// \param[in] level
+ /// The level of detail to use in pretty-printing.
+ ///
+ /// \param[in] abi
+ /// An optional ABI plug-in that can be used to resolve register
+ /// names.
+ void DumpLocation(Stream *s, lldb::offset_t offset, lldb::offset_t length,
+ lldb::DescriptionLevel level, ABI *abi) const;
+
+ bool GetLocation(lldb::addr_t base_addr, lldb::addr_t pc,
+ lldb::offset_t &offset, lldb::offset_t &len);
+
+ static bool AddressRangeForLocationListEntry(
+ const DWARFUnit *dwarf_cu, const DataExtractor &debug_loc_data,
+ lldb::offset_t *offset_ptr, lldb::addr_t &low_pc, lldb::addr_t &high_pc);
+
+ bool GetOpAndEndOffsets(StackFrame &frame, lldb::offset_t &op_offset,
+ lldb::offset_t &end_offset);
+
+ /// Module which defined this expression.
+ lldb::ModuleWP m_module_wp;
+
+ /// A data extractor capable of reading opcode bytes
+ DataExtractor m_data;
+
+ /// The DWARF compile unit this expression belongs to. It is used to evaluate
+ /// values indexing into the .debug_addr section (e.g. DW_OP_GNU_addr_index,
+ /// DW_OP_GNU_const_index)
+ const DWARFUnit *m_dwarf_cu;
+
+ /// One of the defines that starts with LLDB_REGKIND_
+ lldb::RegisterKind m_reg_kind;
+
+ /// A value used to slide the location list offsets so that m_c they are
+ /// relative to the object that owns the location list (the function for
+ /// frame base and variable location lists)
+ lldb::addr_t m_loclist_slide;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DWARFExpression_h_
diff --git a/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h b/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h
new file mode 100644
index 0000000..7e3e2bb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h
@@ -0,0 +1,165 @@
+//===-- DiagnosticManager.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DiagnosticManager_h
+#define lldb_DiagnosticManager_h
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+
+enum DiagnosticOrigin {
+ eDiagnosticOriginUnknown = 0,
+ eDiagnosticOriginLLDB,
+ eDiagnosticOriginClang,
+ eDiagnosticOriginGo,
+ eDiagnosticOriginSwift,
+ eDiagnosticOriginLLVM
+};
+
+enum DiagnosticSeverity {
+ eDiagnosticSeverityError,
+ eDiagnosticSeverityWarning,
+ eDiagnosticSeverityRemark
+};
+
+const uint32_t LLDB_INVALID_COMPILER_ID = UINT32_MAX;
+
+class Diagnostic {
+ friend class DiagnosticManager;
+
+public:
+ DiagnosticOrigin getKind() const { return m_origin; }
+
+ static bool classof(const Diagnostic *diag) {
+ DiagnosticOrigin kind = diag->getKind();
+ switch (kind) {
+ case eDiagnosticOriginUnknown:
+ case eDiagnosticOriginLLDB:
+ case eDiagnosticOriginGo:
+ case eDiagnosticOriginLLVM:
+ return true;
+ case eDiagnosticOriginClang:
+ case eDiagnosticOriginSwift:
+ return false;
+ }
+ }
+
+ Diagnostic(llvm::StringRef message, DiagnosticSeverity severity,
+ DiagnosticOrigin origin, uint32_t compiler_id)
+ : m_message(message), m_severity(severity), m_origin(origin),
+ m_compiler_id(compiler_id) {}
+
+ Diagnostic(const Diagnostic &rhs)
+ : m_message(rhs.m_message), m_severity(rhs.m_severity),
+ m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {}
+
+ virtual ~Diagnostic() = default;
+
+ virtual bool HasFixIts() const { return false; }
+
+ DiagnosticSeverity GetSeverity() const { return m_severity; }
+
+ uint32_t GetCompilerID() const { return m_compiler_id; }
+
+ llvm::StringRef GetMessage() const { return m_message; }
+
+ void AppendMessage(llvm::StringRef message,
+ bool precede_with_newline = true) {
+ if (precede_with_newline)
+ m_message.push_back('\n');
+ m_message.append(message);
+ }
+
+protected:
+ std::string m_message;
+ DiagnosticSeverity m_severity;
+ DiagnosticOrigin m_origin;
+ uint32_t m_compiler_id; // Compiler-specific diagnostic ID
+};
+
+typedef std::vector<Diagnostic *> DiagnosticList;
+
+class DiagnosticManager {
+public:
+ void Clear() {
+ m_diagnostics.clear();
+ m_fixed_expression.clear();
+ }
+
+ // The diagnostic manager holds a list of diagnostics, which are owned by the
+ // manager.
+ const DiagnosticList &Diagnostics() { return m_diagnostics; }
+
+ ~DiagnosticManager() {
+ for (Diagnostic *diag : m_diagnostics) {
+ delete diag;
+ }
+ }
+
+ bool HasFixIts() {
+ for (Diagnostic *diag : m_diagnostics) {
+ if (diag->HasFixIts())
+ return true;
+ }
+ return false;
+ }
+
+ void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
+ DiagnosticOrigin origin,
+ uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
+ m_diagnostics.push_back(
+ new Diagnostic(message, severity, origin, compiler_id));
+ }
+
+ void AddDiagnostic(Diagnostic *diagnostic) {
+ 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);
+
+ void AppendMessageToDiagnostic(llvm::StringRef str) {
+ if (!m_diagnostics.empty()) {
+ m_diagnostics.back()->AppendMessage(str);
+ }
+ }
+
+ // Returns a string containing errors in this format:
+ //
+ // "error: error text\n
+ // warning: warning text\n
+ // remark text\n"
+ std::string GetString(char separator = '\n');
+
+ void Dump(Log *log);
+
+ const std::string &GetFixedExpression() { return m_fixed_expression; }
+
+ // Moves fixed_expression to the internal storage.
+ void SetFixedExpression(std::string fixed_expression) {
+ m_fixed_expression = std::move(fixed_expression);
+ fixed_expression.clear();
+ }
+
+protected:
+ DiagnosticList m_diagnostics;
+ std::string m_fixed_expression;
+};
+}
+
+#endif /* lldb_DiagnosticManager_h */
diff --git a/linux-x64/clang/include/lldb/Expression/Expression.h b/linux-x64/clang/include/lldb/Expression/Expression.h
new file mode 100644
index 0000000..2f0183c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/Expression.h
@@ -0,0 +1,114 @@
+//===-- Expression.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Expression_h_
+#define liblldb_Expression_h_
+
+#include <map>
+#include <string>
+#include <vector>
+
+
+#include "lldb/Expression/ExpressionTypeSystemHelper.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class RecordingMemoryManager;
+
+/// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates
+/// a single expression for use in lldb
+///
+/// LLDB uses expressions for various purposes, notably to call functions
+/// and as a backend for the expr command. Expression encapsulates the
+/// objects needed to parse and interpret or JIT an expression. It uses the
+/// expression parser appropriate to the language of the expression to produce
+/// LLVM IR from the expression.
+class Expression {
+public:
+ /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ enum ExpressionKind {
+ eKindFunctionCaller,
+ eKindClangFunctionCaller,
+ eKindUserExpression,
+ eKindLLVMUserExpression,
+ eKindClangUserExpression,
+ eKindUtilityFunction,
+ eKindClangUtilityFunction,
+ };
+
+ enum ResultType { eResultTypeAny, eResultTypeId };
+
+ Expression(Target &target, ExpressionKind kind);
+
+ Expression(ExecutionContextScope &exe_scope, ExpressionKind kind);
+
+ /// Destructor
+ virtual ~Expression() {}
+
+ /// Return the string that the parser should parse. Must be a full
+ /// translation unit.
+ virtual const char *Text() = 0;
+
+ /// Return the function name that should be used for executing the
+ /// expression. Text() should contain the definition of this function.
+ virtual const char *FunctionName() = 0;
+
+ /// Return the language that should be used when parsing. To use the
+ /// default, return eLanguageTypeUnknown.
+ virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; }
+
+ /// Return the desired result type of the function, or eResultTypeAny if
+ /// indifferent.
+ virtual ResultType DesiredResultType() { return eResultTypeAny; }
+
+ /// Flags
+
+ /// Return true if validation code should be inserted into the expression.
+ virtual bool NeedsValidation() = 0;
+
+ /// Return true if external variables in the expression should be resolved.
+ virtual bool NeedsVariableResolution() = 0;
+
+ virtual EvaluateExpressionOptions *GetOptions() { return nullptr; };
+
+ /// Return the address of the function's JIT-compiled code, or
+ /// LLDB_INVALID_ADDRESS if the function is not JIT compiled
+ 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; }
+
+ /// LLVM-style RTTI support.
+ ExpressionKind getKind() const { return m_kind; }
+
+private:
+ /// LLVM-style RTTI support.
+ const ExpressionKind m_kind;
+protected:
+ lldb::TargetWP m_target_wp; /// Expression's always have to have a target...
+ lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but
+ /// it doesn't need to (e.g. calculator
+ /// mode.)
+ lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within
+ ///the JIT allocation. LLDB_INVALID_ADDRESS if
+ ///invalid.
+ lldb::addr_t m_jit_end_addr; ///< The address of the JITted function within
+ ///the JIT allocation. LLDB_INVALID_ADDRESS if
+ ///invalid.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Expression_h_
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionParser.h b/linux-x64/clang/include/lldb/Expression/ExpressionParser.h
new file mode 100644
index 0000000..59f7c15
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionParser.h
@@ -0,0 +1,147 @@
+//===-- ExpressionParser.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExpressionParser_h_
+#define liblldb_ExpressionParser_h_
+
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class IRExecutionUnit;
+
+/// \class ExpressionParser ExpressionParser.h
+/// "lldb/Expression/ExpressionParser.h" Encapsulates an instance of a
+/// compiler that can parse expressions.
+///
+/// ExpressionParser is the base class for llvm based Expression parsers.
+class ExpressionParser {
+public:
+ /// Constructor
+ ///
+ /// Initializes class variables.
+ ///
+ /// \param[in] exe_scope,
+ /// If non-NULL, an execution context scope that can help to
+ /// correctly create an expression with a valid process for
+ /// optional tuning Objective-C runtime support. Can be NULL.
+ ///
+ /// \param[in] expr
+ /// The expression to be parsed.
+ ExpressionParser(ExecutionContextScope *exe_scope, Expression &expr,
+ bool generate_debug_info)
+ : m_expr(expr), m_generate_debug_info(generate_debug_info) {}
+
+ /// Destructor
+ virtual ~ExpressionParser(){};
+
+ /// Attempts to find possible command line completions for the given
+ /// expression.
+ ///
+ /// \param[out] request
+ /// The completion request to fill out. The completion should be a string
+ /// that would complete the current token at the cursor position.
+ /// Note that the string in the list replaces the current token
+ /// in the command line.
+ ///
+ /// \param[in] line
+ /// The line with the completion cursor inside the expression as a string.
+ /// The first line in the expression has the number 0.
+ ///
+ /// \param[in] pos
+ /// The character position in the line with the completion cursor.
+ /// If the value is 0, then the cursor is on top of the first character
+ /// in the line (i.e. the user has requested completion from the start of
+ /// the expression).
+ ///
+ /// \param[in] typed_pos
+ /// The cursor position in the line as typed by the user. If the user
+ /// expression has not been transformed in some form (e.g. wrapping it
+ /// in a function body for C languages), then this is equal to the
+ /// 'pos' parameter. The semantics of this value are otherwise equal to
+ /// 'pos' (e.g. a value of 0 means the cursor is at start of the
+ /// expression).
+ ///
+ /// \return
+ /// True if we added any completion results to the output;
+ /// false otherwise.
+ virtual bool Complete(CompletionRequest &request, unsigned line, unsigned pos,
+ unsigned typed_pos) = 0;
+
+ /// Parse a single expression and convert it to IR using Clang. Don't wrap
+ /// the expression in anything at all.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager in which to store the errors and warnings.
+ ///
+ /// \return
+ /// The number of errors encountered during parsing. 0 means
+ /// success.
+ virtual unsigned Parse(DiagnosticManager &diagnostic_manager) = 0;
+
+ /// Try to use the FixIts in the diagnostic_manager to rewrite the
+ /// expression. If successful, the rewritten expression is stored in the
+ /// diagnostic_manager, get it out with GetFixedExpression.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager containing fixit's to apply.
+ ///
+ /// \return
+ /// \b true if the rewrite was successful, \b false otherwise.
+ virtual bool RewriteExpression(DiagnosticManager &diagnostic_manager) {
+ return false;
+ }
+
+ /// Ready an already-parsed expression for execution, possibly evaluating it
+ /// statically.
+ ///
+ /// \param[out] func_addr
+ /// The address to which the function has been written.
+ ///
+ /// \param[out] func_end
+ /// The end of the function's allocated memory region. (func_addr
+ /// and func_end do not delimit an allocated region; the allocated
+ /// region may begin before func_addr.)
+ ///
+ /// \param[in] execution_unit_sp
+ /// After parsing, ownership of the execution unit for
+ /// for the expression is handed to this shared pointer.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to write the function into.
+ ///
+ /// \param[out] can_interpret
+ /// Set to true if the expression could be interpreted statically;
+ /// untouched otherwise.
+ ///
+ /// \param[in] execution_policy
+ /// Determines whether the expression must be JIT-compiled, must be
+ /// evaluated statically, or whether this decision may be made
+ /// opportunistically.
+ ///
+ /// \return
+ /// An error code indicating the success or failure of the operation.
+ /// Test with Success().
+ 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,
+ lldb_private::ExecutionPolicy execution_policy) = 0;
+
+ bool GetGenerateDebugInfo() const { return m_generate_debug_info; }
+
+protected:
+ Expression &m_expr; ///< The expression to be parsed
+ bool m_generate_debug_info;
+};
+}
+
+#endif // liblldb_ExpressionParser_h_
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h b/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h
new file mode 100644
index 0000000..d0d01b5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h
@@ -0,0 +1,38 @@
+//===-- ExpressionSourceCode.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExpressionSourceCode_h
+#define liblldb_ExpressionSourceCode_h
+
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/ArrayRef.h"
+
+#include <string>
+
+namespace lldb_private {
+
+class ExpressionSourceCode {
+public:
+ bool NeedsWrapping() const { return m_wrap; }
+
+ const char *GetName() const { return m_name.c_str(); }
+
+protected:
+ ExpressionSourceCode(const char *name, const char *prefix, const char *body,
+ bool wrap)
+ : m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
+
+ std::string m_name;
+ std::string m_prefix;
+ std::string m_body;
+ bool m_wrap;
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h b/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h
new file mode 100644
index 0000000..9c64553
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h
@@ -0,0 +1,47 @@
+//===-- ExpressionTypeSystemHelper.h ---------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ExpressionTypeSystemHelper_h
+#define ExpressionTypeSystemHelper_h
+
+#include "llvm/Support/Casting.h"
+
+namespace lldb_private {
+
+/// \class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h
+/// "lldb/Expression/ExpressionTypeSystemHelper.h"
+/// A helper object that the Expression can pass to its ExpressionParser
+/// to provide generic information that
+/// any type of expression will need to supply. It's only job is to support
+/// dyn_cast so that the expression parser can cast it back to the requisite
+/// specific type.
+///
+
+class ExpressionTypeSystemHelper {
+public:
+ enum LLVMCastKind {
+ eKindClangHelper,
+ eKindSwiftHelper,
+ eKindGoHelper,
+ kNumKinds
+ };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ ExpressionTypeSystemHelper(LLVMCastKind kind) : m_kind(kind) {}
+
+ ~ExpressionTypeSystemHelper() {}
+
+protected:
+ LLVMCastKind m_kind;
+};
+
+} // namespace lldb_private
+
+#endif /* ExpressionTypeSystemHelper_h */
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h b/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h
new file mode 100644
index 0000000..08c9872
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h
@@ -0,0 +1,256 @@
+//===-- ExpressionVariable.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExpressionVariable_h_
+#define liblldb_ExpressionVariable_h_
+
+#include <memory>
+#include <vector>
+
+#include "llvm/ADT/DenseMap.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class ExpressionVariable
+ : public std::enable_shared_from_this<ExpressionVariable> {
+public:
+ // See TypeSystem.h for how to add subclasses to this.
+ enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ ExpressionVariable(LLVMCastKind kind) : m_flags(0), m_kind(kind) {}
+
+ virtual ~ExpressionVariable();
+
+ size_t GetByteSize() { return m_frozen_sp->GetByteSize(); }
+
+ ConstString GetName() { return m_frozen_sp->GetName(); }
+
+ lldb::ValueObjectSP GetValueObject() { return m_frozen_sp; }
+
+ uint8_t *GetValueBytes();
+
+ void ValueUpdated() { m_frozen_sp->ValueUpdated(); }
+
+ RegisterInfo *GetRegisterInfo() {
+ return m_frozen_sp->GetValue().GetRegisterInfo();
+ }
+
+ void SetRegisterInfo(const RegisterInfo *reg_info) {
+ return m_frozen_sp->GetValue().SetContext(
+ Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
+ }
+
+ CompilerType GetCompilerType() { return m_frozen_sp->GetCompilerType(); }
+
+ void SetCompilerType(const CompilerType &compiler_type) {
+ m_frozen_sp->GetValue().SetCompilerType(compiler_type);
+ }
+
+ void SetName(ConstString name) { m_frozen_sp->SetName(name); }
+
+ // this function is used to copy the address-of m_live_sp into m_frozen_sp
+ // this is necessary because the results of certain cast and pointer-
+ // arithmetic operations (such as those described in bugzilla issues 11588
+ // and 11618) generate frozen objects that do not have a valid address-of,
+ // which can be troublesome when using synthetic children providers.
+ // Transferring the address-of the live object solves these issues and
+ // provides the expected user-level behavior
+ void TransferAddress(bool force = false) {
+ if (m_live_sp.get() == nullptr)
+ return;
+
+ if (m_frozen_sp.get() == nullptr)
+ return;
+
+ if (force || (m_frozen_sp->GetLiveAddress() == LLDB_INVALID_ADDRESS))
+ m_frozen_sp->SetLiveAddress(m_live_sp->GetLiveAddress());
+ }
+
+ enum Flags {
+ EVNone = 0,
+ EVIsLLDBAllocated = 1 << 0, ///< This variable is resident in a location
+ ///specifically allocated for it by LLDB in the
+ ///target process
+ EVIsProgramReference = 1 << 1, ///< This variable is a reference to a
+ ///(possibly invalid) area managed by the
+ ///target program
+ EVNeedsAllocation = 1 << 2, ///< Space for this variable has yet to be
+ ///allocated in the target process
+ EVIsFreezeDried = 1 << 3, ///< This variable's authoritative version is in
+ ///m_frozen_sp (for example, for
+ ///statically-computed results)
+ EVNeedsFreezeDry =
+ 1 << 4, ///< Copy from m_live_sp to m_frozen_sp during dematerialization
+ EVKeepInTarget = 1 << 5, ///< Keep the allocation after the expression is
+ ///complete rather than freeze drying its contents
+ ///and freeing it
+ EVTypeIsReference = 1 << 6, ///< The original type of this variable is a
+ ///reference, so materialize the value rather
+ ///than the location
+ EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type
+ ///must be resolved after parsing is complete
+ EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or
+ ///some other entity.
+ };
+
+ typedef uint16_t FlagType;
+
+ FlagType m_flags; // takes elements of Flags
+
+ // these should be private
+ lldb::ValueObjectSP m_frozen_sp;
+ lldb::ValueObjectSP m_live_sp;
+ LLVMCastKind m_kind;
+};
+
+/// \class ExpressionVariableList ExpressionVariable.h
+/// "lldb/Expression/ExpressionVariable.h"
+/// A list of variable references.
+///
+/// This class stores variables internally, acting as the permanent store.
+class ExpressionVariableList {
+public:
+ /// Implementation of methods in ExpressionVariableListBase
+ size_t GetSize() { return m_variables.size(); }
+
+ lldb::ExpressionVariableSP GetVariableAtIndex(size_t index) {
+ lldb::ExpressionVariableSP var_sp;
+ if (index < m_variables.size())
+ var_sp = m_variables[index];
+ return var_sp;
+ }
+
+ size_t AddVariable(const lldb::ExpressionVariableSP &var_sp) {
+ m_variables.push_back(var_sp);
+ return m_variables.size() - 1;
+ }
+
+ lldb::ExpressionVariableSP
+ AddNewlyConstructedVariable(ExpressionVariable *var) {
+ lldb::ExpressionVariableSP var_sp(var);
+ m_variables.push_back(var_sp);
+ return m_variables.back();
+ }
+
+ bool ContainsVariable(const lldb::ExpressionVariableSP &var_sp) {
+ const size_t size = m_variables.size();
+ for (size_t index = 0; index < size; ++index) {
+ if (m_variables[index].get() == var_sp.get())
+ return true;
+ }
+ return false;
+ }
+
+ /// Finds a variable by name in the list.
+ ///
+ /// \param[in] name
+ /// The name of the requested variable.
+ ///
+ /// \return
+ /// The variable requested, or nullptr if that variable is not in the
+ /// list.
+ lldb::ExpressionVariableSP GetVariable(ConstString name) {
+ lldb::ExpressionVariableSP var_sp;
+ for (size_t index = 0, size = GetSize(); index < size; ++index) {
+ var_sp = GetVariableAtIndex(index);
+ if (var_sp->GetName() == name)
+ return var_sp;
+ }
+ var_sp.reset();
+ return var_sp;
+ }
+
+ lldb::ExpressionVariableSP GetVariable(llvm::StringRef name) {
+ if (name.empty())
+ return nullptr;
+
+ for (size_t index = 0, size = GetSize(); index < size; ++index) {
+ auto var_sp = GetVariableAtIndex(index);
+ llvm::StringRef var_name_str = var_sp->GetName().GetStringRef();
+ if (var_name_str == name)
+ return var_sp;
+ }
+ return nullptr;
+ }
+
+ void RemoveVariable(lldb::ExpressionVariableSP var_sp) {
+ for (std::vector<lldb::ExpressionVariableSP>::iterator
+ vi = m_variables.begin(),
+ ve = m_variables.end();
+ vi != ve; ++vi) {
+ if (vi->get() == var_sp.get()) {
+ m_variables.erase(vi);
+ return;
+ }
+ }
+ }
+
+ void Clear() { m_variables.clear(); }
+
+private:
+ std::vector<lldb::ExpressionVariableSP> m_variables;
+};
+
+class PersistentExpressionState : public ExpressionVariableList {
+public:
+ // See TypeSystem.h for how to add subclasses to this.
+ enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ PersistentExpressionState(LLVMCastKind kind) : m_kind(kind) {}
+
+ virtual ~PersistentExpressionState();
+
+ virtual lldb::ExpressionVariableSP
+ CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp) = 0;
+
+ virtual lldb::ExpressionVariableSP
+ CreatePersistentVariable(ExecutionContextScope *exe_scope,
+ ConstString name, const CompilerType &type,
+ lldb::ByteOrder byte_order,
+ uint32_t addr_byte_size) = 0;
+
+ /// Return a new persistent variable name with the specified prefix.
+ ConstString GetNextPersistentVariableName(Target &target,
+ llvm::StringRef prefix);
+
+ virtual llvm::StringRef
+ GetPersistentVariablePrefix(bool is_error = false) const = 0;
+
+ virtual void
+ RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
+
+ virtual llvm::Optional<CompilerType>
+ GetCompilerTypeFromPersistentDecl(ConstString type_name) = 0;
+
+ virtual lldb::addr_t LookupSymbol(ConstString name);
+
+ void RegisterExecutionUnit(lldb::IRExecutionUnitSP &execution_unit_sp);
+
+private:
+ LLVMCastKind m_kind;
+
+ typedef std::set<lldb::IRExecutionUnitSP> ExecutionUnitSet;
+ ExecutionUnitSet
+ m_execution_units; ///< The execution units that contain valuable symbols.
+
+ typedef llvm::DenseMap<const char *, lldb::addr_t> SymbolMap;
+ SymbolMap
+ m_symbol_map; ///< The addresses of the symbols in m_execution_units.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ExpressionVariable_h_
diff --git a/linux-x64/clang/include/lldb/Expression/FunctionCaller.h b/linux-x64/clang/include/lldb/Expression/FunctionCaller.h
new file mode 100644
index 0000000..ea9d020
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/FunctionCaller.h
@@ -0,0 +1,350 @@
+//===-- FunctionCaller.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FunctionCaller_h_
+#define liblldb_FunctionCaller_h_
+
+#include <list>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Expression/ExpressionParser.h"
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private {
+
+/// \class FunctionCaller FunctionCaller.h "lldb/Expression/FunctionCaller.h"
+/// Encapsulates a function that can be called.
+///
+/// A given FunctionCaller object can handle a single function signature.
+/// Once constructed, it can set up any number of concurrent calls to
+/// functions with that signature.
+///
+/// It performs the call by synthesizing a structure that contains the pointer
+/// to the function and the arguments that should be passed to that function,
+/// and producing a special-purpose JIT-compiled function that accepts a void*
+/// pointing to this struct as its only argument and calls the function in the
+/// struct with the written arguments. This method lets Clang handle the
+/// vagaries of function calling conventions.
+///
+/// The simplest use of the FunctionCaller is to construct it with a function
+/// representative of the signature you want to use, then call
+/// ExecuteFunction(ExecutionContext &, Stream &, Value &).
+///
+/// If you need to reuse the arguments for several calls, you can call
+/// InsertFunction() followed by WriteFunctionArguments(), which will return
+/// the location of the args struct for the wrapper function in args_addr_ref.
+///
+/// If you need to call the function on the thread plan stack, you can also
+/// call InsertFunction() followed by GetThreadPlanToCallFunction().
+///
+/// Any of the methods that take arg_addr_ptr or arg_addr_ref can be passed a
+/// pointer set to LLDB_INVALID_ADDRESS and new structure will be allocated
+/// and its address returned in that variable.
+///
+/// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
+/// argument space will be managed for you.
+class FunctionCaller : public Expression {
+public:
+ /// LLVM-style RTTI support.
+ static bool classof(const Expression *E) {
+ return E->getKind() == eKindFunctionCaller;
+ }
+
+ /// Constructor
+ ///
+ /// \param[in] exe_scope
+ /// An execution context scope that gets us at least a target and
+ /// process.
+ ///
+ /// \param[in] ast_context
+ /// The AST context to evaluate argument types in.
+ ///
+ /// \param[in] return_qualtype
+ /// An opaque Clang QualType for the function result. Should be
+ /// defined in ast_context.
+ ///
+ /// \param[in] function_address
+ /// The address of the function to call.
+ ///
+ /// \param[in] arg_value_list
+ /// The default values to use when calling this function. Can
+ /// be overridden using WriteFunctionArguments().
+ FunctionCaller(ExecutionContextScope &exe_scope,
+ const CompilerType &return_type,
+ const Address &function_address,
+ const ValueList &arg_value_list, const char *name);
+
+ /// Destructor
+ ~FunctionCaller() override;
+
+ /// Compile the wrapper function
+ ///
+ /// \param[in] thread_to_use_sp
+ /// Compilation might end up calling functions. Pass in the thread you
+ /// want the compilation to use. If you pass in an empty ThreadSP it will
+ /// use the currently selected thread.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report parser errors to.
+ ///
+ /// \return
+ /// The number of errors.
+ virtual unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp,
+ DiagnosticManager &diagnostic_manager) = 0;
+
+ /// Insert the default function wrapper and its default argument struct
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in,out] args_addr_ref
+ /// The address of the structure to write the arguments into. May
+ /// be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+ /// and args_addr_ref is pointed to it.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \return
+ /// True on success; false otherwise.
+ bool InsertFunction(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
+ DiagnosticManager &diagnostic_manager);
+
+ /// Insert the default function wrapper (using the JIT)
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \return
+ /// True on success; false otherwise.
+ bool WriteFunctionWrapper(ExecutionContext &exe_ctx,
+ DiagnosticManager &diagnostic_manager);
+
+ /// Insert the default function argument struct
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in,out] args_addr_ref
+ /// The address of the structure to write the arguments into. May
+ /// be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+ /// and args_addr_ref is pointed to it.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \return
+ /// True on success; false otherwise.
+ bool WriteFunctionArguments(ExecutionContext &exe_ctx,
+ lldb::addr_t &args_addr_ref,
+ DiagnosticManager &diagnostic_manager);
+
+ /// Insert an argument struct with a non-default function address and non-
+ /// default argument values
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in,out] args_addr_ref
+ /// The address of the structure to write the arguments into. May
+ /// be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+ /// and args_addr_ref is pointed at it.
+ ///
+ /// \param[in] arg_values
+ /// The values of the function's arguments.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \return
+ /// True on success; false otherwise.
+ bool WriteFunctionArguments(ExecutionContext &exe_ctx,
+ lldb::addr_t &args_addr_ref,
+ ValueList &arg_values,
+ DiagnosticManager &diagnostic_manager);
+
+ /// Run the function this FunctionCaller was created with.
+ ///
+ /// This is the full version.
+ ///
+ /// \param[in] exe_ctx
+ /// The thread & process in which this function will run.
+ ///
+ /// \param[in] args_addr_ptr
+ /// If nullptr, the function will take care of allocating & deallocating
+ /// the wrapper
+ /// args structure. Otherwise, if set to LLDB_INVALID_ADDRESS, a new
+ /// structure
+ /// will be allocated, filled and the address returned to you. You are
+ /// responsible
+ /// for deallocating it. And if passed in with a value other than
+ /// LLDB_INVALID_ADDRESS,
+ /// this should point to an already allocated structure with the values
+ /// already written.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \param[in] options
+ /// The options for this expression execution.
+ ///
+ /// \param[out] results
+ /// The result value will be put here after running the function.
+ ///
+ /// \return
+ /// Returns one of the ExpressionResults enum indicating function call
+ /// status.
+ lldb::ExpressionResults
+ ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr,
+ const EvaluateExpressionOptions &options,
+ DiagnosticManager &diagnostic_manager, Value &results);
+
+ /// Get a thread plan to run the function this FunctionCaller was created
+ /// with.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in] func_addr
+ /// The address of the function in the target process.
+ ///
+ /// \param[in] args_addr
+ /// The address of the argument struct.
+ ///
+ /// \param[in] diagnostic_manager
+ /// The diagnostic manager to report errors to.
+ ///
+ /// \param[in] stop_others
+ /// True if other threads should pause during execution.
+ ///
+ /// \param[in] unwind_on_error
+ /// True if the thread plan may simply be discarded if an error occurs.
+ ///
+ /// \return
+ /// A ThreadPlan shared pointer for executing the function.
+ lldb::ThreadPlanSP
+ GetThreadPlanToCallFunction(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
+ const EvaluateExpressionOptions &options,
+ DiagnosticManager &diagnostic_manager);
+
+ /// Get the result of the function from its struct
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to retrieve the result from.
+ ///
+ /// \param[in] args_addr
+ /// The address of the argument struct.
+ ///
+ /// \param[out] ret_value
+ /// The value returned by the function.
+ ///
+ /// \return
+ /// True on success; false otherwise.
+ bool FetchFunctionResults(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
+ Value &ret_value);
+
+ /// Deallocate the arguments structure
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to insert the function and its arguments
+ /// into.
+ ///
+ /// \param[in] args_addr
+ /// The address of the argument struct.
+ void DeallocateFunctionResults(ExecutionContext &exe_ctx,
+ lldb::addr_t args_addr);
+
+ /// Interface for ClangExpression
+
+ /// Return the string that the parser should parse. Must be a full
+ /// translation unit.
+ const char *Text() override { return m_wrapper_function_text.c_str(); }
+
+ /// Return the function name that should be used for executing the
+ /// expression. Text() should contain the definition of this function.
+ const char *FunctionName() override {
+ return m_wrapper_function_name.c_str();
+ }
+
+ /// Return the object that the parser should use when registering local
+ /// variables. May be nullptr if the Expression doesn't care.
+ ExpressionVariableList *LocalVariables() { return nullptr; }
+
+ /// Return true if validation code should be inserted into the expression.
+ bool NeedsValidation() override { return false; }
+
+ /// Return true if external variables in the expression should be resolved.
+ bool NeedsVariableResolution() override { return false; }
+
+ ValueList GetArgumentValues() const { return m_arg_values; }
+
+protected:
+ // Note: the parser needs to be destructed before the execution unit, so
+ // declare the execution unit first.
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+ std::unique_ptr<ExpressionParser>
+ m_parser; ///< The parser responsible for compiling the function.
+ ///< This will get made in CompileFunction, so it is
+ ///< safe to access it after that.
+
+ lldb::ModuleWP m_jit_module_wp;
+ std::string
+ m_name; ///< The name of this clang function - for debugging purposes.
+
+ Function *m_function_ptr; ///< The function we're going to call. May be
+ ///nullptr if we don't have debug info for the
+ ///function.
+ Address m_function_addr; ///< If we don't have the FunctionSP, we at least
+ ///need the address & return type.
+ CompilerType m_function_return_type; ///< The opaque clang qual type for the
+ ///function return type.
+
+ std::string m_wrapper_function_name; ///< The name of the wrapper function.
+ std::string
+ m_wrapper_function_text; ///< The contents of the wrapper function.
+ std::string m_wrapper_struct_name; ///< The name of the struct that contains
+ ///the target function address, arguments,
+ ///and result.
+ std::list<lldb::addr_t> m_wrapper_args_addrs; ///< The addresses of the
+ ///arguments to the wrapper
+ ///function.
+
+ bool m_struct_valid; ///< True if the ASTStructExtractor has populated the
+ ///variables below.
+
+ /// These values are populated by the ASTStructExtractor
+ size_t m_struct_size; ///< The size of the argument struct, in bytes.
+ std::vector<uint64_t>
+ m_member_offsets; ///< The offset of each member in the struct, in bytes.
+ uint64_t m_return_size; ///< The size of the result variable, in bytes.
+ uint64_t m_return_offset; ///< The offset of the result variable in the
+ ///struct, in bytes.
+
+ ValueList m_arg_values; ///< The default values of the arguments.
+
+ bool m_compiled; ///< True if the wrapper function has already been parsed.
+ bool
+ m_JITted; ///< True if the wrapper function has already been JIT-compiled.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_FunctionCaller_h_
diff --git a/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h b/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h
new file mode 100644
index 0000000..26f1cdb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h
@@ -0,0 +1,146 @@
+//===-- IRDynamicChecks.h ---------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_IRDynamicChecks_h_
+#define liblldb_IRDynamicChecks_h_
+
+#include "lldb/lldb-types.h"
+#include "llvm/Pass.h"
+
+namespace llvm {
+class BasicBlock;
+class CallInst;
+class Constant;
+class Function;
+class Instruction;
+class Module;
+class DataLayout;
+class Value;
+}
+
+namespace lldb_private {
+
+class ClangExpressionDeclMap;
+class ExecutionContext;
+class Stream;
+
+/// \class DynamicCheckerFunctions IRDynamicChecks.h
+/// "lldb/Expression/IRDynamicChecks.h" Encapsulates dynamic check functions
+/// used by expressions.
+///
+/// Each of the utility functions encapsulated in this class is responsible
+/// for validating some data that an expression is about to use. Examples
+/// are:
+///
+/// a = *b; // check that b is a valid pointer [b init]; // check that b
+/// is a valid object to send "init" to
+///
+/// The class installs each checker function into the target process and makes
+/// it available to IRDynamicChecks to use.
+class DynamicCheckerFunctions {
+public:
+ /// Constructor
+ DynamicCheckerFunctions();
+
+ /// Destructor
+ ~DynamicCheckerFunctions();
+
+ /// Install the utility functions into a process. This binds the instance
+ /// of DynamicCheckerFunctions to that process.
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to report errors to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to install the functions into.
+ ///
+ /// \return
+ /// True on success; false on failure, or if the functions have
+ /// already been installed.
+ bool Install(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx);
+
+ bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message);
+
+ std::unique_ptr<UtilityFunction> m_valid_pointer_check;
+ std::unique_ptr<UtilityFunction> m_objc_object_check;
+};
+
+/// \class IRDynamicChecks IRDynamicChecks.h
+/// "lldb/Expression/IRDynamicChecks.h" Adds dynamic checks to a user-entered
+/// expression to reduce its likelihood of crashing
+///
+/// When an IR function is executed in the target process, it may cause
+/// crashes or hangs by dereferencing NULL pointers, trying to call
+/// Objective-C methods on objects that do not respond to them, and so forth.
+///
+/// IRDynamicChecks adds calls to the functions in DynamicCheckerFunctions to
+/// appropriate locations in an expression's IR.
+class IRDynamicChecks : public llvm::ModulePass {
+public:
+ /// Constructor
+ ///
+ /// \param[in] checker_functions
+ /// The checker functions for the target process.
+ ///
+ /// \param[in] func_name
+ /// The name of the function to prepare for execution in the target.
+ ///
+ /// \param[in] decl_map
+ /// The mapping used to look up entities in the target process. In
+ /// this case, used to find objc_msgSend
+ IRDynamicChecks(DynamicCheckerFunctions &checker_functions,
+ const char *func_name = "$__lldb_expr");
+
+ /// Destructor
+ ~IRDynamicChecks() override;
+
+ /// Run this IR transformer on a single module
+ ///
+ /// \param[in] M
+ /// The module to run on. This module is searched for the function
+ /// $__lldb_expr, and that function is passed to the passes one by
+ /// one.
+ ///
+ /// \return
+ /// True on success; false otherwise
+ bool runOnModule(llvm::Module &M) override;
+
+ /// Interface stub
+ void assignPassManager(
+ llvm::PMStack &PMS,
+ llvm::PassManagerType T = llvm::PMT_ModulePassManager) override;
+
+ /// Returns PMT_ModulePassManager
+ llvm::PassManagerType getPotentialPassManagerType() const override;
+
+private:
+ /// A basic block-level pass to find all pointer dereferences and
+ /// validate them before use.
+
+ /// The top-level pass implementation
+ ///
+ /// \param[in] M
+ /// The module currently being processed.
+ ///
+ /// \param[in] BB
+ /// The basic block currently being processed.
+ ///
+ /// \return
+ /// True on success; false otherwise
+ bool FindDataLoads(llvm::Module &M, llvm::BasicBlock &BB);
+
+ std::string m_func_name; ///< The name of the function to add checks to
+ DynamicCheckerFunctions
+ &m_checker_functions; ///< The checker functions for the process
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_IRDynamicChecks_h_
diff --git a/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h b/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h
new file mode 100644
index 0000000..beff44d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h
@@ -0,0 +1,408 @@
+//===-- IRExecutionUnit.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_IRExecutionUnit_h_
+#define liblldb_IRExecutionUnit_h_
+
+#include <atomic>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
+#include "llvm/IR/Module.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"
+
+namespace llvm {
+
+class Module;
+class ExecutionEngine;
+class ObjectCache;
+
+} // namespace llvm
+
+namespace lldb_private {
+
+class Status;
+
+/// \class IRExecutionUnit IRExecutionUnit.h
+/// "lldb/Expression/IRExecutionUnit.h" Contains the IR and, optionally, JIT-
+/// compiled code for a module.
+///
+/// This class encapsulates the compiled version of an expression, in IR form
+/// (for interpretation purposes) and in raw machine code form (for execution
+/// in the target).
+///
+/// This object wraps an IR module that comes from the expression parser, and
+/// knows how to use the JIT to make it into executable code. It can then be
+/// used as input to the IR interpreter, or the address of the executable code
+/// can be passed to a thread plan to run in the target.
+///
+/// This class creates a subclass of LLVM's SectionMemoryManager, because that
+/// is how the JIT emits code. Because LLDB needs to move JIT-compiled code
+/// into the target process, the IRExecutionUnit knows how to copy the emitted
+/// code into the target process.
+class IRExecutionUnit : public std::enable_shared_from_this<IRExecutionUnit>,
+ public IRMemoryMap,
+ public ObjectFileJITDelegate {
+public:
+ /// Constructor
+ IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,
+ std::unique_ptr<llvm::Module> &module_up, ConstString &name,
+ const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx,
+ std::vector<std::string> &cpu_features);
+
+ /// Destructor
+ ~IRExecutionUnit() override;
+
+ ConstString GetFunctionName() { return m_name; }
+
+ llvm::Module *GetModule() { return m_module; }
+
+ llvm::Function *GetFunction() {
+ return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString())
+ : nullptr);
+ }
+
+ void GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
+ lldb::addr_t &func_end);
+
+ /// Accessors for IRForTarget and other clients that may want binary data
+ /// placed on their behalf. The binary data is owned by the IRExecutionUnit
+ /// unless the client explicitly chooses to free it.
+
+ lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error);
+
+ void FreeNow(lldb::addr_t allocation);
+
+ /// ObjectFileJITDelegate overrides
+ lldb::ByteOrder GetByteOrder() const override;
+
+ uint32_t GetAddressByteSize() const override;
+
+ void PopulateSymtab(lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab) override;
+
+ void PopulateSectionList(lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList §ion_list) override;
+
+ ArchSpec GetArchitecture() override;
+
+ lldb::ModuleSP GetJITModule();
+
+ lldb::addr_t FindSymbol(ConstString name, bool &missing_weak);
+
+ void GetStaticInitializers(std::vector<lldb::addr_t> &static_initializers);
+
+ /// \class JittedFunction IRExecutionUnit.h
+ /// "lldb/Expression/IRExecutionUnit.h"
+ /// Encapsulates a single function that has been generated by the JIT.
+ ///
+ /// Functions that have been generated by the JIT are first resident in the
+ /// local process, and then placed in the target process. JittedFunction
+ /// represents a function possibly resident in both.
+ struct JittedEntity {
+ ConstString m_name; ///< The function's name
+ lldb::addr_t m_local_addr; ///< The address of the function in LLDB's memory
+ lldb::addr_t
+ m_remote_addr; ///< The address of the function in the target's memory
+
+ /// Constructor
+ ///
+ /// Initializes class variabes.
+ ///
+ /// \param[in] name
+ /// The name of the function.
+ ///
+ /// \param[in] local_addr
+ /// The address of the function in LLDB, or LLDB_INVALID_ADDRESS if
+ /// it is not present in LLDB's memory.
+ ///
+ /// \param[in] remote_addr
+ /// The address of the function in the target, or LLDB_INVALID_ADDRESS
+ /// if it is not present in the target's memory.
+ JittedEntity(const char *name,
+ lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+ lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+ : m_name(name), m_local_addr(local_addr), m_remote_addr(remote_addr) {}
+ };
+
+ struct JittedFunction : JittedEntity {
+ bool m_external;
+ JittedFunction(const char *name, bool external,
+ lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+ lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+ : JittedEntity(name, local_addr, remote_addr), m_external(external) {}
+ };
+
+ struct JittedGlobalVariable : JittedEntity {
+ JittedGlobalVariable(const char *name,
+ lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+ lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+ : JittedEntity(name, local_addr, remote_addr) {}
+ };
+
+ const std::vector<JittedFunction> &GetJittedFunctions() {
+ return m_jitted_functions;
+ }
+
+ const std::vector<JittedGlobalVariable> &GetJittedGlobalVariables() {
+ return m_jitted_global_variables;
+ }
+
+private:
+ /// Look up the object in m_address_map that contains a given address, find
+ /// where it was copied to, and return the remote address at the same offset
+ /// into the copied entity
+ ///
+ /// \param[in] local_address
+ /// The address in the debugger.
+ ///
+ /// \return
+ /// The address in the target process.
+ lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address);
+
+ /// Look up the object in m_address_map that contains a given address, find
+ /// where it was copied to, and return its address range in the target
+ /// process
+ ///
+ /// \param[in] local_address
+ /// The address in the debugger.
+ ///
+ /// \return
+ /// The range of the containing object in the target process.
+ typedef std::pair<lldb::addr_t, uintptr_t> AddrRange;
+ AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address);
+
+ /// Commit all allocations to the process and record where they were stored.
+ ///
+ /// \param[in] process
+ /// The process to allocate memory in.
+ ///
+ /// \return
+ /// True <=> all allocations were performed successfully.
+ /// This method will attempt to free allocated memory if the
+ /// operation fails.
+ bool CommitAllocations(lldb::ProcessSP &process_sp);
+
+ /// Report all committed allocations to the execution engine.
+ ///
+ /// \param[in] engine
+ /// The execution engine to notify.
+ void ReportAllocations(llvm::ExecutionEngine &engine);
+
+ /// Write the contents of all allocations to the process.
+ ///
+ /// \param[in] local_address
+ /// The process containing the allocations.
+ ///
+ /// \return
+ /// True <=> all allocations were performed successfully.
+ bool WriteData(lldb::ProcessSP &process_sp);
+
+ Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp);
+
+ struct SearchSpec;
+
+ void CollectCandidateCNames(std::vector<SearchSpec> &C_specs,
+ ConstString name);
+
+ void CollectCandidateCPlusPlusNames(std::vector<SearchSpec> &CPP_specs,
+ const std::vector<SearchSpec> &C_specs,
+ const SymbolContext &sc);
+
+ void CollectFallbackNames(std::vector<SearchSpec> &fallback_specs,
+ const std::vector<SearchSpec> &C_specs);
+
+ lldb::addr_t FindInSymbols(const std::vector<SearchSpec> &specs,
+ const lldb_private::SymbolContext &sc,
+ bool &symbol_was_missing_weak);
+
+ lldb::addr_t FindInRuntimes(const std::vector<SearchSpec> &specs,
+ const lldb_private::SymbolContext &sc);
+
+ lldb::addr_t FindInUserDefinedSymbols(const std::vector<SearchSpec> &specs,
+ const lldb_private::SymbolContext &sc);
+
+ void ReportSymbolLookupError(ConstString name);
+
+ class MemoryManager : public llvm::SectionMemoryManager {
+ public:
+ MemoryManager(IRExecutionUnit &parent);
+
+ ~MemoryManager() override;
+
+ /// Allocate space for executable code, and add it to the m_spaceBlocks
+ /// map
+ ///
+ /// \param[in] Size
+ /// The size of the area.
+ ///
+ /// \param[in] Alignment
+ /// The required alignment of the area.
+ ///
+ /// \param[in] SectionID
+ /// A unique identifier for the section.
+ ///
+ /// \return
+ /// Allocated space.
+ uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID,
+ llvm::StringRef SectionName) override;
+
+ /// Allocate space for data, and add it to the m_spaceBlocks map
+ ///
+ /// \param[in] Size
+ /// The size of the area.
+ ///
+ /// \param[in] Alignment
+ /// The required alignment of the area.
+ ///
+ /// \param[in] SectionID
+ /// A unique identifier for the section.
+ ///
+ /// \param[in] IsReadOnly
+ /// Flag indicating the section is read-only.
+ ///
+ /// \return
+ /// Allocated space.
+ uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+ unsigned SectionID,
+ llvm::StringRef SectionName,
+ bool IsReadOnly) override;
+
+ /// Called when object loading is complete and section page permissions
+ /// can be applied. Currently unimplemented for LLDB.
+ ///
+ /// \param[out] ErrMsg
+ /// The error that prevented the page protection from succeeding.
+ ///
+ /// \return
+ /// True in case of failure, false in case of success.
+ bool finalizeMemory(std::string *ErrMsg) override {
+ // TODO: Ensure that the instruction cache is flushed because
+ // relocations are updated by dy-load. See:
+ // sys::Memory::InvalidateInstructionCache
+ // llvm::SectionMemoryManager
+ return false;
+ }
+
+ void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
+ size_t Size) override {}
+
+ uint64_t getSymbolAddress(const std::string &Name) override;
+
+ // Find the address of the symbol Name. If Name is a missing weak symbol
+ // then missing_weak will be true.
+ uint64_t GetSymbolAddressAndPresence(const std::string &Name,
+ bool &missing_weak);
+
+ llvm::JITSymbol findSymbol(const std::string &Name) override;
+
+ void *getPointerToNamedFunction(const std::string &Name,
+ bool AbortOnFailure = true) override;
+
+ private:
+ std::unique_ptr<SectionMemoryManager> m_default_mm_up; ///< The memory
+ /// allocator to use
+ /// in actually
+ /// creating space.
+ /// All calls are
+ /// passed through to
+ /// it.
+ IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for.
+ };
+
+ static const unsigned eSectionIDInvalid = (unsigned)-1;
+
+ /// \class AllocationRecord IRExecutionUnit.h
+ /// "lldb/Expression/IRExecutionUnit.h" Encapsulates a single allocation
+ /// request made by the JIT.
+ ///
+ /// Allocations made by the JIT are first queued up and then applied in bulk
+ /// to the underlying process.
+ enum class AllocationKind { Stub, Code, Data, Global, Bytes };
+
+ static lldb::SectionType
+ GetSectionTypeFromSectionName(const llvm::StringRef &name,
+ AllocationKind alloc_kind);
+
+ struct AllocationRecord {
+ std::string m_name;
+ lldb::addr_t m_process_address;
+ uintptr_t m_host_address;
+ uint32_t m_permissions;
+ lldb::SectionType m_sect_type;
+ size_t m_size;
+ unsigned m_alignment;
+ unsigned m_section_id;
+
+ AllocationRecord(uintptr_t host_address, uint32_t permissions,
+ lldb::SectionType sect_type, size_t size,
+ unsigned alignment, unsigned section_id, const char *name)
+ : m_name(), m_process_address(LLDB_INVALID_ADDRESS),
+ m_host_address(host_address), m_permissions(permissions),
+ m_sect_type(sect_type), m_size(size), m_alignment(alignment),
+ m_section_id(section_id) {
+ if (name && name[0])
+ m_name = name;
+ }
+
+ void dump(Log *log);
+ };
+
+ bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error,
+ AllocationRecord &record);
+
+ typedef std::vector<AllocationRecord> RecordVector;
+ RecordVector m_records;
+
+ std::unique_ptr<llvm::LLVMContext> m_context_up;
+ std::unique_ptr<llvm::ExecutionEngine> m_execution_engine_up;
+ std::unique_ptr<llvm::ObjectCache> m_object_cache_up;
+ std::unique_ptr<llvm::Module>
+ m_module_up; ///< Holder for the module until it's been handed off
+ llvm::Module *m_module; ///< Owned by the execution engine
+ std::vector<std::string> m_cpu_features;
+ std::vector<JittedFunction> m_jitted_functions; ///< A vector of all functions
+ ///that have been JITted into
+ ///machine code
+ std::vector<JittedGlobalVariable> m_jitted_global_variables; ///< A vector of
+ ///all functions
+ ///that have been
+ ///JITted into
+ ///machine code
+ const ConstString m_name;
+ SymbolContext m_sym_ctx; ///< Used for symbol lookups
+ std::vector<ConstString> m_failed_lookups;
+
+ std::atomic<bool> m_did_jit;
+
+ lldb::addr_t m_function_load_addr;
+ lldb::addr_t m_function_end_load_addr;
+
+ bool m_strip_underscore = true; ///< True for platforms where global symbols
+ /// have a _ prefix
+ bool m_reported_allocations; ///< True after allocations have been reported.
+ ///It is possible that
+ ///< sections will be allocated when this is true, in which case they weren't
+ ///< depended on by any function. (Top-level code defining a variable, but
+ ///< defining no functions using that variable, would do this.) If this
+ ///< is true, any allocations need to be committed immediately -- no
+ ///< opportunity for relocation.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_IRExecutionUnit_h_
diff --git a/linux-x64/clang/include/lldb/Expression/IRInterpreter.h b/linux-x64/clang/include/lldb/Expression/IRInterpreter.h
new file mode 100644
index 0000000..6148093
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/IRInterpreter.h
@@ -0,0 +1,55 @@
+//===-- IRInterpreter.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_IRInterpreter_h_
+#define liblldb_IRInterpreter_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"
+
+namespace llvm {
+class Function;
+class Module;
+}
+
+namespace lldb_private {
+
+class ClangExpressionDeclMap;
+class IRMemoryMap;
+}
+
+/// \class IRInterpreter IRInterpreter.h "lldb/Expression/IRInterpreter.h"
+/// Attempt to interpret the function's code if it does not require
+/// running the target.
+///
+/// In some cases, the IR for an expression can be evaluated entirely in the
+/// debugger, manipulating variables but not executing any code in the target.
+/// The IRInterpreter attempts to do this.
+class IRInterpreter {
+public:
+ static bool CanInterpret(llvm::Module &module, llvm::Function &function,
+ 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::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::Status &err);
+};
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h b/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h
new file mode 100644
index 0000000..d6a17a9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h
@@ -0,0 +1,136 @@
+//===-- IRMemoryMap.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_IRMemoryMap_h_
+#define lldb_IRMemoryMap_h_
+
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-public.h"
+
+#include <map>
+
+namespace lldb_private {
+
+/// \class IRMemoryMap IRMemoryMap.h "lldb/Expression/IRMemoryMap.h"
+/// Encapsulates memory that may exist in the process but must
+/// also be available in the host process.
+///
+/// This class encapsulates a group of memory objects that must be readable or
+/// writable from the host process regardless of whether the process exists.
+/// This allows the IR interpreter as well as JITted code to access the same
+/// memory. All allocations made by this class are represented as disjoint
+/// intervals.
+///
+/// Point queries against this group of memory objects can be made by the
+/// address in the tar at which they reside. If the inferior does not exist,
+/// allocations still get made-up addresses. If an inferior appears at some
+/// point, then those addresses need to be re-mapped.
+class IRMemoryMap {
+public:
+ IRMemoryMap(lldb::TargetSP target_sp);
+ ~IRMemoryMap();
+
+ enum AllocationPolicy : uint8_t {
+ eAllocationPolicyInvalid =
+ 0, ///< It is an error for an allocation to have this policy.
+ eAllocationPolicyHostOnly, ///< This allocation was created in the host and
+ ///will never make it into the process.
+ ///< It is an error to create other types of allocations while such
+ ///allocations exist.
+ eAllocationPolicyMirror, ///< The intent is that this allocation exist both
+ ///in the host and the process and have
+ ///< the same content in both.
+ eAllocationPolicyProcessOnly ///< The intent is that this allocation exist
+ ///only in the process.
+ };
+
+ lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions,
+ 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, Status &error);
+ void WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar,
+ size_t size, Status &error);
+ void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address,
+ Status &error);
+ void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size,
+ Status &error);
+ void ReadScalarFromMemory(Scalar &scalar, lldb::addr_t process_address,
+ size_t size, Status &error);
+ void ReadPointerFromMemory(lldb::addr_t *address,
+ 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, Status &error);
+
+ lldb::ByteOrder GetByteOrder();
+ uint32_t GetAddressByteSize();
+
+ // This function can return NULL.
+ ExecutionContextScope *GetBestExecutionContextScope() const;
+
+ lldb::TargetSP GetTarget() { return m_target_wp.lock(); }
+
+protected:
+ // This function should only be used if you know you are using the JIT. Any
+ // other cases should use GetBestExecutionContextScope().
+
+ lldb::ProcessWP &GetProcessWP() { return m_process_wp; }
+
+private:
+ struct Allocation {
+ lldb::addr_t
+ m_process_alloc; ///< The (unaligned) base for the remote allocation.
+ lldb::addr_t
+ m_process_start; ///< The base address of the allocation in the process.
+ size_t m_size; ///< The size of the requested allocation.
+ DataBufferHeap m_data;
+
+ /// Flags. Keep these grouped together to avoid structure padding.
+ AllocationPolicy m_policy;
+ bool m_leak;
+ uint8_t m_permissions; ///< The access permissions on the memory in the
+ /// process. In the host, the memory is always
+ /// read/write.
+ uint8_t m_alignment; ///< The alignment of the requested allocation.
+
+ public:
+ Allocation(lldb::addr_t process_alloc, lldb::addr_t process_start,
+ size_t size, uint32_t permissions, uint8_t alignment,
+ AllocationPolicy m_policy);
+
+ DISALLOW_COPY_AND_ASSIGN(Allocation);
+ };
+
+ static_assert(sizeof(Allocation) <=
+ (4 * sizeof(lldb::addr_t)) + sizeof(DataBufferHeap),
+ "IRMemoryMap::Allocation is larger than expected");
+
+ lldb::ProcessWP m_process_wp;
+ lldb::TargetWP m_target_wp;
+ typedef std::map<lldb::addr_t, Allocation> AllocationMap;
+ AllocationMap m_allocations;
+
+ lldb::addr_t FindSpace(size_t size);
+ bool ContainsHostOnlyAllocations();
+ AllocationMap::iterator FindAllocation(lldb::addr_t addr, size_t size);
+
+ // Returns true if the given allocation intersects any allocation in the
+ // memory map.
+ bool IntersectsAllocation(lldb::addr_t addr, size_t size) const;
+
+ // Returns true if the two given allocations intersect each other.
+ static bool AllocationsIntersect(lldb::addr_t addr1, size_t size1,
+ lldb::addr_t addr2, size_t size2);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h b/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h
new file mode 100644
index 0000000..c2af723
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h
@@ -0,0 +1,134 @@
+//===-- LLVMUserExpression.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LLVMUserExpression_h
+#define liblldb_LLVMUserExpression_h
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "llvm/IR/LegacyPassManager.h"
+
+#include "lldb/Expression/UserExpression.h"
+
+namespace lldb_private {
+
+/// \class LLVMUserExpression LLVMUserExpression.h
+/// "lldb/Expression/LLVMUserExpression.h" Encapsulates a one-time expression
+/// for use in lldb.
+///
+/// LLDB uses expressions for various purposes, notably to call functions
+/// and as a backend for the expr command. LLVMUserExpression is a virtual
+/// base class that encapsulates the objects needed to parse and JIT an
+/// expression. The actual parsing part will be provided by the specific
+/// implementations of LLVMUserExpression - which will be vended through the
+/// appropriate TypeSystem.
+class LLVMUserExpression : public UserExpression {
+public:
+ /// LLVM-style RTTI support.
+ static bool classof(const Expression *E) {
+ return E->getKind() == eKindLLVMUserExpression;
+ }
+
+ // The IRPasses struct is filled in by a runtime after an expression is
+ // compiled and can be used to to run fixups/analysis passes as required.
+ // EarlyPasses are run on the generated module before lldb runs its own IR
+ // fixups and inserts instrumentation code/pointer checks. LatePasses are run
+ // after the module has been processed by llvm, before the module is
+ // assembled and run in the ThreadPlan.
+ struct IRPasses {
+ IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){};
+ std::shared_ptr<llvm::legacy::PassManager> EarlyPasses;
+ std::shared_ptr<llvm::legacy::PassManager> LatePasses;
+ };
+
+ LLVMUserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
+ llvm::StringRef prefix, lldb::LanguageType language,
+ ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ExpressionKind kind);
+ ~LLVMUserExpression() override;
+
+ bool FinalizeJITExecution(
+ DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ lldb::ExpressionVariableSP &result,
+ lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+ lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override;
+
+ bool CanInterpret() override { return m_can_interpret; }
+
+ /// Return the string that the parser should parse. Must be a full
+ /// translation unit.
+ const char *Text() override { return m_transformed_text.c_str(); }
+
+ lldb::ModuleSP GetJITModule() override;
+
+protected:
+ lldb::ExpressionResults
+ DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) override;
+
+ virtual void ScanContext(ExecutionContext &exe_ctx,
+ lldb_private::Status &err) = 0;
+
+ bool PrepareToExecuteJITExpression(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx,
+ lldb::addr_t &struct_address);
+
+ virtual bool AddArguments(ExecutionContext &exe_ctx,
+ std::vector<lldb::addr_t> &args,
+ lldb::addr_t struct_address,
+ DiagnosticManager &diagnostic_manager) = 0;
+
+ lldb::addr_t
+ m_stack_frame_bottom; ///< The bottom of the allocated stack frame.
+ lldb::addr_t m_stack_frame_top; ///< The top of the allocated stack frame.
+
+ bool m_allow_cxx; ///< True if the language allows C++.
+ bool m_allow_objc; ///< True if the language allows Objective-C.
+ std::string
+ m_transformed_text; ///< The text of the expression, as send to the parser
+
+ std::shared_ptr<IRExecutionUnit>
+ m_execution_unit_sp; ///< The execution unit the expression is stored in.
+ std::unique_ptr<Materializer> m_materializer_up; ///< The materializer to use
+ /// when running the
+ /// expression.
+ lldb::ModuleWP m_jit_module_wp;
+ bool m_enforce_valid_object; ///< True if the expression parser should enforce
+ ///the presence of a valid class pointer
+ /// in order to generate the expression as a method.
+ bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++
+ ///member function (true if it was parsed
+ /// when exe_ctx was in a C++ method).
+ bool m_in_objectivec_method; ///< True if the expression is compiled as an
+ ///Objective-C method (true if it was parsed
+ /// when exe_ctx was in an Objective-C method).
+ bool m_in_static_method; ///< True if the expression is compiled as a static
+ ///(or class) method (currently true if it
+ /// was parsed when exe_ctx was in an Objective-C class method).
+ bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
+ ///passed in. False if the expression
+ /// doesn't really use them and they can be NULL.
+ bool m_const_object; ///< True if "this" is const.
+ Target *m_target; ///< The target for storing persistent data like types and
+ ///variables.
+
+ bool m_can_interpret; ///< True if the expression could be evaluated
+ ///statically; false otherwise.
+ lldb::addr_t m_materialized_address; ///< The address at which the arguments
+ ///to the expression have been
+ ///materialized.
+ Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
+};
+
+} // namespace lldb_private
+#endif
diff --git a/linux-x64/clang/include/lldb/Expression/Materializer.h b/linux-x64/clang/include/lldb/Expression/Materializer.h
new file mode 100644
index 0000000..603b4e0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/Materializer.h
@@ -0,0 +1,139 @@
+//===-- Materializer.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Materializer_h
+#define liblldb_Materializer_h
+
+#include <memory>
+#include <vector>
+
+#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 {
+
+class Materializer {
+public:
+ Materializer();
+ ~Materializer();
+
+ class Dematerializer {
+ public:
+ Dematerializer()
+ : m_materializer(nullptr), m_map(nullptr),
+ m_process_address(LLDB_INVALID_ADDRESS) {}
+
+ ~Dematerializer() { Wipe(); }
+
+ void Dematerialize(Status &err, lldb::addr_t frame_top,
+ lldb::addr_t frame_bottom);
+
+ void Wipe();
+
+ bool IsValid() {
+ return m_materializer && m_map &&
+ (m_process_address != LLDB_INVALID_ADDRESS);
+ }
+
+ private:
+ friend class Materializer;
+
+ Dematerializer(Materializer &materializer, lldb::StackFrameSP &frame_sp,
+ IRMemoryMap &map, lldb::addr_t process_address)
+ : m_materializer(&materializer), m_map(&map),
+ m_process_address(process_address) {
+ if (frame_sp) {
+ m_thread_wp = frame_sp->GetThread();
+ m_stack_id = frame_sp->GetStackID();
+ }
+ }
+
+ Materializer *m_materializer;
+ lldb::ThreadWP m_thread_wp;
+ StackID m_stack_id;
+ IRMemoryMap *m_map;
+ lldb::addr_t m_process_address;
+ };
+
+ typedef std::shared_ptr<Dematerializer> DematerializerSP;
+ typedef std::weak_ptr<Dematerializer> DematerializerWP;
+
+ DematerializerSP Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
+ lldb::addr_t process_address, Status &err);
+
+ class PersistentVariableDelegate {
+ public:
+ virtual ~PersistentVariableDelegate();
+ virtual ConstString GetName() = 0;
+ virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;
+ };
+
+ uint32_t
+ AddPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp,
+ 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, 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; }
+
+ uint32_t GetStructByteSize() { return m_current_offset; }
+
+ class Entity {
+ public:
+ Entity() : m_alignment(1), m_size(0), m_offset(0) {}
+
+ virtual ~Entity() = default;
+
+ virtual void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
+ 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, 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;
+
+ uint32_t GetAlignment() { return m_alignment; }
+
+ uint32_t GetSize() { return m_size; }
+
+ uint32_t GetOffset() { return m_offset; }
+
+ void SetOffset(uint32_t offset) { m_offset = offset; }
+
+ protected:
+ void SetSizeAndAlignmentFromType(CompilerType &type);
+
+ uint32_t m_alignment;
+ uint32_t m_size;
+ uint32_t m_offset;
+ };
+
+private:
+ uint32_t AddStructMember(Entity &entity);
+
+ typedef std::unique_ptr<Entity> EntityUP;
+ typedef std::vector<EntityUP> EntityVector;
+
+ DematerializerWP m_dematerializer_wp;
+ EntityVector m_entities;
+ uint32_t m_current_offset;
+ uint32_t m_struct_alignment;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Materializer_h
diff --git a/linux-x64/clang/include/lldb/Expression/REPL.h b/linux-x64/clang/include/lldb/Expression/REPL.h
new file mode 100644
index 0000000..850d2f6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/REPL.h
@@ -0,0 +1,163 @@
+//===-- REPL.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_REPL_h
+#define lldb_REPL_h
+
+#include <string>
+
+#include "lldb/Core/IOHandler.h"
+#include "lldb/Interpreter/OptionGroupFormat.h"
+#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
+#include "lldb/Target/Target.h"
+
+namespace lldb_private {
+
+class REPL : public IOHandlerDelegate {
+public:
+ // See TypeSystem.h for how to add subclasses to this.
+ enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ REPL(LLVMCastKind kind, Target &target);
+
+ ~REPL() override;
+
+ /// Get a REPL with an existing target (or, failing that, a debugger to use),
+ /// and (optional) extra arguments for the compiler.
+ ///
+ /// \param[out] error
+ /// If this language is supported but the REPL couldn't be created, this
+ /// error is populated with the reason.
+ ///
+ /// \param[in] language
+ /// The language to create a REPL for.
+ ///
+ /// \param[in] debugger
+ /// If provided, and target is nullptr, the debugger to use when setting
+ /// up a top-level REPL.
+ ///
+ /// \param[in] target
+ /// If provided, the target to put the REPL inside.
+ ///
+ /// \param[in] repl_options
+ /// If provided, additional options for the compiler when parsing REPL
+ /// expressions.
+ ///
+ /// \return
+ /// The range of the containing object in the target process.
+ static lldb::REPLSP Create(Status &Status, lldb::LanguageType language,
+ Debugger *debugger, Target *target,
+ const char *repl_options);
+
+ void SetFormatOptions(const OptionGroupFormat &options) {
+ m_format_options = options;
+ }
+
+ void
+ SetValueObjectDisplayOptions(const OptionGroupValueObjectDisplay &options) {
+ m_varobj_options = options;
+ }
+
+ void SetEvaluateOptions(const EvaluateExpressionOptions &options) {
+ m_expr_options = options;
+ }
+
+ void SetCompilerOptions(const char *options) {
+ if (options)
+ m_compiler_options = options;
+ }
+
+ lldb::IOHandlerSP GetIOHandler();
+
+ Status RunLoop();
+
+ // IOHandler::Delegate functions
+ void IOHandlerActivated(IOHandler &io_handler, bool interactive) override;
+
+ bool IOHandlerInterrupt(IOHandler &io_handler) override;
+
+ void IOHandlerInputInterrupted(IOHandler &io_handler,
+ std::string &line) override;
+
+ const char *IOHandlerGetFixIndentationCharacters() override;
+
+ ConstString IOHandlerGetControlSequence(char ch) override;
+
+ const char *IOHandlerGetCommandPrefix() override;
+
+ const char *IOHandlerGetHelpPrologue() override;
+
+ bool IOHandlerIsInputComplete(IOHandler &io_handler,
+ StringList &lines) override;
+
+ int IOHandlerFixIndentation(IOHandler &io_handler, const StringList &lines,
+ int cursor_position) override;
+
+ void IOHandlerInputComplete(IOHandler &io_handler,
+ std::string &line) override;
+
+ int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
+ const char *cursor, const char *last_char,
+ int skip_first_n_matches, int max_matches,
+ StringList &matches, StringList &descriptions) override;
+
+protected:
+ static int CalculateActualIndentation(const StringList &lines);
+
+ // Subclasses should override these functions to implement a functional REPL.
+
+ virtual Status DoInitialization() = 0;
+
+ virtual ConstString GetSourceFileBasename() = 0;
+
+ virtual const char *GetAutoIndentCharacters() = 0;
+
+ virtual bool SourceIsComplete(const std::string &source) = 0;
+
+ virtual lldb::offset_t GetDesiredIndentation(
+ const StringList &lines, int cursor_position,
+ int tab_size) = 0; // LLDB_INVALID_OFFSET means no change
+
+ virtual lldb::LanguageType GetLanguage() = 0;
+
+ virtual bool PrintOneVariable(Debugger &debugger,
+ lldb::StreamFileSP &output_sp,
+ lldb::ValueObjectSP &valobj_sp,
+ ExpressionVariable *var = nullptr) = 0;
+
+ virtual int CompleteCode(const std::string ¤t_code,
+ StringList &matches) = 0;
+
+ OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
+ OptionGroupValueObjectDisplay m_varobj_options;
+ EvaluateExpressionOptions m_expr_options;
+ std::string m_compiler_options;
+
+ bool m_enable_auto_indent = true;
+ std::string m_indent_str; // Use this string for each level of indentation
+ std::string m_current_indent_str;
+ uint32_t m_current_indent_level = 0;
+
+ std::string m_repl_source_path;
+ bool m_dedicated_repl_mode = false;
+
+ StringList m_code; // All accumulated REPL statements are saved here
+
+ Target &m_target;
+ lldb::IOHandlerSP m_io_handler_sp;
+ LLVMCastKind m_kind;
+
+private:
+ std::string GetSourcePath();
+};
+
+} // namespace lldb_private
+
+#endif // lldb_REPL_h
diff --git a/linux-x64/clang/include/lldb/Expression/UserExpression.h b/linux-x64/clang/include/lldb/Expression/UserExpression.h
new file mode 100644
index 0000000..b1d52f8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/UserExpression.h
@@ -0,0 +1,315 @@
+//===-- UserExpression.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UserExpression_h_
+#define liblldb_UserExpression_h_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/Address.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Expression/Materializer.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class UserExpression UserExpression.h "lldb/Expression/UserExpression.h"
+/// Encapsulates a one-time expression for use in lldb.
+///
+/// LLDB uses expressions for various purposes, notably to call functions
+/// and as a backend for the expr command. UserExpression is a virtual base
+/// class that encapsulates the objects needed to parse and interpret or
+/// JIT an expression. The actual parsing part will be provided by the specific
+/// implementations of UserExpression - which will be vended through the
+/// appropriate TypeSystem.
+class UserExpression : public Expression {
+public:
+ /// LLVM-style RTTI support.
+ static bool classof(const Expression *E) {
+ return E->getKind() == eKindUserExpression;
+ }
+
+ enum { kDefaultTimeout = 500000u };
+
+ /// Constructor
+ ///
+ /// \param[in] expr
+ /// The expression to parse.
+ ///
+ /// \param[in] expr_prefix
+ /// If non-nullptr, a C string containing translation-unit level
+ /// definitions to be included when the expression is parsed.
+ ///
+ /// \param[in] language
+ /// If not eLanguageTypeUnknown, a language to use when parsing
+ /// the expression. Currently restricted to those languages
+ /// supported by Clang.
+ ///
+ /// \param[in] desired_type
+ /// If not eResultTypeAny, the type to use for the expression
+ /// result.
+ UserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
+ llvm::StringRef prefix, lldb::LanguageType language,
+ ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ExpressionKind kind);
+
+ /// Destructor
+ ~UserExpression() override;
+
+ /// Parse the expression
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to report parse errors and warnings to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to use when looking up entities that
+ /// are needed for parsing (locations of functions, types of
+ /// variables, persistent variables, etc.)
+ ///
+ /// \param[in] execution_policy
+ /// Determines whether interpretation is possible or mandatory.
+ ///
+ /// \param[in] keep_result_in_memory
+ /// True if the resulting persistent variable should reside in
+ /// target memory, if applicable.
+ ///
+ /// \return
+ /// True on success (no errors); false otherwise.
+ virtual bool Parse(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx,
+ lldb_private::ExecutionPolicy execution_policy,
+ bool keep_result_in_memory, bool generate_debug_info) = 0;
+
+ /// Attempts to find possible command line completions for the given
+ /// (possible incomplete) user expression.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to use when looking up entities that
+ /// are needed for parsing and completing (locations of functions, types
+ /// of variables, persistent variables, etc.)
+ ///
+ /// \param[out] request
+ /// The completion request to fill out. The completion should be a string
+ /// that would complete the current token at the cursor position.
+ /// Note that the string in the list replaces the current token
+ /// in the command line.
+ ///
+ /// \param[in] complete_pos
+ /// The position of the cursor inside the user expression string.
+ /// The completion process starts on the token that the cursor is in.
+ ///
+ /// \return
+ /// True if we added any completion results to the output;
+ /// false otherwise.
+ virtual bool Complete(ExecutionContext &exe_ctx, CompletionRequest &request,
+ unsigned complete_pos) {
+ return false;
+ }
+
+ virtual bool CanInterpret() = 0;
+
+ bool MatchesContext(ExecutionContext &exe_ctx);
+
+ /// Execute the parsed expression by callinng the derived class's DoExecute
+ /// method.
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to report errors to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to use when looking up entities that
+ /// are needed for parsing (locations of variables, etc.)
+ ///
+ /// \param[in] options
+ /// Expression evaluation options.
+ ///
+ /// \param[in] shared_ptr_to_me
+ /// This is a shared pointer to this UserExpression. This is
+ /// needed because Execute can push a thread plan that will hold onto
+ /// the UserExpression for an unbounded period of time. So you
+ /// need to give the thread plan a reference to this object that can
+ /// keep it alive.
+ ///
+ /// \param[in] result
+ /// A pointer to direct at the persistent variable in which the
+ /// expression's result is stored.
+ ///
+ /// \return
+ /// A Process::Execution results value.
+ lldb::ExpressionResults Execute(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result);
+
+ /// Apply the side effects of the function to program state.
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to report errors to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to use when looking up entities that
+ /// are needed for parsing (locations of variables, etc.)
+ ///
+ /// \param[in] result
+ /// A pointer to direct at the persistent variable in which the
+ /// expression's result is stored.
+ ///
+ /// \param[in] function_stack_pointer
+ /// A pointer to the base of the function's stack frame. This
+ /// is used to determine whether the expression result resides in
+ /// memory that will still be valid, or whether it needs to be
+ /// treated as homeless for the purpose of future expressions.
+ ///
+ /// \return
+ /// A Process::Execution results value.
+ virtual bool FinalizeJITExecution(
+ DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ lldb::ExpressionVariableSP &result,
+ lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+ lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) = 0;
+
+ /// Return the string that the parser should parse.
+ const char *Text() override { return m_expr_text.c_str(); }
+
+ /// Return the string that the user typed.
+ const char *GetUserText() { return m_expr_text.c_str(); }
+
+ /// Return the function name that should be used for executing the
+ /// expression. Text() should contain the definition of this function.
+ const char *FunctionName() override { return "$__lldb_expr"; }
+
+ /// Return the language that should be used when parsing. To use the
+ /// default, return eLanguageTypeUnknown.
+ lldb::LanguageType Language() override { return m_language; }
+
+ /// Return the desired result type of the function, or eResultTypeAny if
+ /// indifferent.
+ ResultType DesiredResultType() override { return m_desired_type; }
+
+ /// Return true if validation code should be inserted into the expression.
+ bool NeedsValidation() override { return true; }
+
+ /// Return true if external variables in the expression should be resolved.
+ bool NeedsVariableResolution() override { return true; }
+
+ EvaluateExpressionOptions *GetOptions() override { return &m_options; }
+
+ virtual lldb::ExpressionVariableSP
+ GetResultAfterDematerialization(ExecutionContextScope *exe_scope) {
+ return lldb::ExpressionVariableSP();
+ }
+
+ virtual lldb::ModuleSP GetJITModule() { return lldb::ModuleSP(); }
+
+ /// Evaluate one expression in the scratch context of the target passed in
+ /// the exe_ctx and return its result.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to use when evaluating the expression.
+ ///
+ /// \param[in] options
+ /// Expression evaluation options. N.B. The language in the
+ /// evaluation options will be used to determine the language used for
+ /// expression evaluation.
+ ///
+ /// \param[in] expr_cstr
+ /// A C string containing the expression to be evaluated.
+ ///
+ /// \param[in] expr_prefix
+ /// If non-nullptr, a C string containing translation-unit level
+ /// definitions to be included when the expression is parsed.
+ ///
+ /// \param[in,out] result_valobj_sp
+ /// If execution is successful, the result valobj is placed here.
+ ///
+ /// \param[out] error
+ /// Filled in with an error in case the expression evaluation
+ /// fails to parse, run, or evaluated.
+ ///
+ /// \param[out] fixed_expression
+ /// If non-nullptr, the fixed expression is copied into the provided
+ /// string.
+ ///
+ /// \param[out] jit_module_sp_ptr
+ /// If non-nullptr, used to persist the generated IR module.
+ ///
+ /// \param[in] ctx_obj
+ /// If specified, then the expression will be evaluated in the context of
+ /// this object. It means that the context object's address will be
+ /// treated as `this` for the expression (the expression will be
+ /// evaluated as if it was inside of a method of the context object's
+ /// class, and its `this` parameter were pointing to the context object).
+ /// The parameter makes sense for class and union types only.
+ /// Currently there is a limitation: the context object must be located
+ /// in the debuggee process' memory (and have the load address).
+ ///
+ /// \result
+ /// A Process::ExpressionResults value. eExpressionCompleted for
+ /// success.
+ static lldb::ExpressionResults
+ Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
+ llvm::StringRef expr_cstr, llvm::StringRef expr_prefix,
+ lldb::ValueObjectSP &result_valobj_sp, Status &error,
+ std::string *fixed_expression = nullptr,
+ lldb::ModuleSP *jit_module_sp_ptr = nullptr,
+ ValueObject *ctx_obj = nullptr);
+
+ static const Status::ValueType kNoResult =
+ 0x1001; ///< ValueObject::GetError() returns this if there is no result
+ /// from the expression.
+
+ const char *GetFixedText() {
+ if (m_fixed_text.empty())
+ return nullptr;
+ return m_fixed_text.c_str();
+ }
+
+protected:
+ virtual lldb::ExpressionResults
+ DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &shared_ptr_to_me,
+ lldb::ExpressionVariableSP &result) = 0;
+
+ static lldb::addr_t GetObjectPointer(lldb::StackFrameSP frame_sp,
+ ConstString &object_name, Status &err);
+
+ /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the
+ /// environment.
+
+ void InstallContext(ExecutionContext &exe_ctx);
+
+ bool LockAndCheckContext(ExecutionContext &exe_ctx, lldb::TargetSP &target_sp,
+ lldb::ProcessSP &process_sp,
+ lldb::StackFrameSP &frame_sp);
+
+ Address m_address; ///< The address the process is stopped in.
+ std::string m_expr_text; ///< The text of the expression, as typed by the user
+ std::string m_expr_prefix; ///< The text of the translation-level definitions,
+ ///as provided by the user
+ std::string m_fixed_text; ///< The text of the expression with fix-its applied
+ ///- this won't be set if the fixed text doesn't
+ ///parse.
+ lldb::LanguageType m_language; ///< The language to use when parsing
+ ///(eLanguageTypeUnknown means use defaults)
+ ResultType m_desired_type; ///< The type to coerce the expression's result to.
+ ///If eResultTypeAny, inferred from the expression.
+ EvaluateExpressionOptions
+ m_options; ///< Additional options provided by the user.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_UserExpression_h_
diff --git a/linux-x64/clang/include/lldb/Expression/UtilityFunction.h b/linux-x64/clang/include/lldb/Expression/UtilityFunction.h
new file mode 100644
index 0000000..26da081
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/UtilityFunction.h
@@ -0,0 +1,120 @@
+//===-- UtilityFunction.h ----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UtilityFunction_h_
+#define liblldb_UtilityFunction_h_
+
+#include <memory>
+#include <string>
+
+#include "lldb/Expression/Expression.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class UtilityFunction UtilityFunction.h
+/// "lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that
+/// provides a function that is callable
+///
+/// LLDB uses expressions for various purposes, notably to call functions
+/// and as a backend for the expr command. UtilityFunction encapsulates a
+/// self-contained function meant to be used from other code. Utility
+/// functions can perform error-checking for ClangUserExpressions,
+class UtilityFunction : public Expression {
+public:
+ /// LLVM-style RTTI support.
+ static bool classof(const Expression *E) {
+ return E->getKind() == eKindUtilityFunction;
+ }
+
+ /// Constructor
+ ///
+ /// \param[in] text
+ /// The text of the function. Must be a full translation unit.
+ ///
+ /// \param[in] name
+ /// The name of the function, as used in the text.
+ UtilityFunction(ExecutionContextScope &exe_scope, const char *text,
+ const char *name, ExpressionKind kind);
+
+ ~UtilityFunction() override;
+
+ /// Install the utility function into a process
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to print parse errors and warnings to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to install the utility function to.
+ ///
+ /// \return
+ /// True on success (no errors); false otherwise.
+ virtual bool Install(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx) = 0;
+
+ /// Check whether the given PC is inside the function
+ ///
+ /// Especially useful if the function dereferences nullptr to indicate a
+ /// failed assert.
+ ///
+ /// \param[in] pc
+ /// The program counter to check.
+ ///
+ /// \return
+ /// True if the program counter falls within the function's bounds;
+ /// false if not (or the function is not JIT compiled)
+ bool ContainsAddress(lldb::addr_t address) {
+ // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, so
+ // this always returns false if the function is not JIT compiled yet
+ return (address >= m_jit_start_addr && address < m_jit_end_addr);
+ }
+
+ /// Return the string that the parser should parse. Must be a full
+ /// translation unit.
+ const char *Text() override { return m_function_text.c_str(); }
+
+ /// Return the function name that should be used for executing the
+ /// expression. Text() should contain the definition of this function.
+ const char *FunctionName() override { return m_function_name.c_str(); }
+
+ /// Return the object that the parser should use when registering local
+ /// variables. May be nullptr if the Expression doesn't care.
+ ExpressionVariableList *LocalVariables() { return nullptr; }
+
+ /// Return true if validation code should be inserted into the expression.
+ bool NeedsValidation() override { return false; }
+
+ /// Return true if external variables in the expression should be resolved.
+ bool NeedsVariableResolution() override { return false; }
+
+ // This makes the function caller function. Pass in the ThreadSP if you have
+ // one available, compilation can end up calling code (e.g. to look up
+ // indirect functions) and we don't want this to wander onto another thread.
+ FunctionCaller *MakeFunctionCaller(const CompilerType &return_type,
+ const ValueList &arg_value_list,
+ lldb::ThreadSP compilation_thread,
+ Status &error);
+
+ // This one retrieves the function caller that is already made. If you
+ // haven't made it yet, this returns nullptr
+ FunctionCaller *GetFunctionCaller() { return m_caller_up.get(); }
+
+protected:
+ std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+ lldb::ModuleWP m_jit_module_wp;
+ std::string m_function_text; ///< The text of the function. Must be a
+ ///well-formed translation unit.
+ std::string m_function_name; ///< The name of the function.
+ std::unique_ptr<FunctionCaller> m_caller_up;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_UtilityFunction_h_
diff --git a/linux-x64/clang/include/lldb/Host/Config.h b/linux-x64/clang/include/lldb/Host/Config.h
new file mode 100644
index 0000000..12f73c4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Config.h
@@ -0,0 +1,38 @@
+//===-- Config.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_HOST_CONFIG_H
+#define LLDB_HOST_CONFIG_H
+
+#define LLDB_CONFIG_TERMIOS_SUPPORTED
+
+#define LLDB_EDITLINE_USE_WCHAR 0
+
+#define LLDB_HAVE_EL_RFUNC_T 0
+
+/* #undef LLDB_DISABLE_POSIX */
+
+#define LLDB_LIBDIR_SUFFIX "64"
+
+#define HAVE_SYS_TYPES_H 1
+
+#define HAVE_SYS_EVENT_H 0
+
+#define HAVE_PPOLL 1
+
+#define HAVE_SIGACTION 1
+
+#define HAVE_PROCESS_VM_READV 1
+
+#define HAVE_NR_PROCESS_VM_READV 1
+
+#ifndef HAVE_LIBCOMPRESSION
+/* #undef HAVE_LIBCOMPRESSION */
+#endif
+
+#endif // #ifndef LLDB_HOST_CONFIG_H
diff --git a/linux-x64/clang/include/lldb/Host/ConnectionFileDescriptor.h b/linux-x64/clang/include/lldb/Host/ConnectionFileDescriptor.h
new file mode 100644
index 0000000..00444d0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/ConnectionFileDescriptor.h
@@ -0,0 +1,14 @@
+//===-- ConnectionFileDescriptor.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_ConnectionFileDescriptor_h_
+#define liblldb_Host_ConnectionFileDescriptor_h_
+
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/Debug.h b/linux-x64/clang/include/lldb/Host/Debug.h
new file mode 100644
index 0000000..036ce1e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Debug.h
@@ -0,0 +1,151 @@
+//===-- Debug.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Debug_h_
+#define liblldb_Debug_h_
+
+#include <vector>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// Tells a thread what it needs to do when the process is resumed.
+struct ResumeAction {
+ lldb::tid_t tid; // The thread ID that this action applies to,
+ // LLDB_INVALID_THREAD_ID for the default thread
+ // action
+ lldb::StateType state; // Valid values are eStateStopped/eStateSuspended,
+ // eStateRunning, and eStateStepping.
+ int signal; // When resuming this thread, resume it with this signal if this
+ // value is > 0
+};
+
+// A class that contains instructions for all threads for
+// NativeProcessProtocol::Resume(). Each thread can either run, stay suspended,
+// or step when the process is resumed. We optionally have the ability to also
+// send a signal to the thread when the action is run or step.
+class ResumeActionList {
+public:
+ ResumeActionList() : m_actions(), m_signal_handled() {}
+
+ ResumeActionList(lldb::StateType default_action, int signal)
+ : m_actions(), m_signal_handled() {
+ SetDefaultThreadActionIfNeeded(default_action, signal);
+ }
+
+ ResumeActionList(const ResumeAction *actions, size_t num_actions)
+ : m_actions(), m_signal_handled() {
+ if (actions && num_actions) {
+ m_actions.assign(actions, actions + num_actions);
+ m_signal_handled.assign(num_actions, false);
+ }
+ }
+
+ ~ResumeActionList() = default;
+
+ bool IsEmpty() const { return m_actions.empty(); }
+
+ void Append(const ResumeAction &action) {
+ m_actions.push_back(action);
+ m_signal_handled.push_back(false);
+ }
+
+ void AppendAction(lldb::tid_t tid, lldb::StateType state, int signal = 0) {
+ ResumeAction action = {tid, state, signal};
+ Append(action);
+ }
+
+ void AppendResumeAll() {
+ AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateRunning);
+ }
+
+ void AppendSuspendAll() {
+ AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateStopped);
+ }
+
+ void AppendStepAll() {
+ AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateStepping);
+ }
+
+ const ResumeAction *GetActionForThread(lldb::tid_t tid,
+ bool default_ok) const {
+ const size_t num_actions = m_actions.size();
+ for (size_t i = 0; i < num_actions; ++i) {
+ if (m_actions[i].tid == tid)
+ return &m_actions[i];
+ }
+ if (default_ok && tid != LLDB_INVALID_THREAD_ID)
+ return GetActionForThread(LLDB_INVALID_THREAD_ID, false);
+ return nullptr;
+ }
+
+ size_t NumActionsWithState(lldb::StateType state) const {
+ size_t count = 0;
+ const size_t num_actions = m_actions.size();
+ for (size_t i = 0; i < num_actions; ++i) {
+ if (m_actions[i].state == state)
+ ++count;
+ }
+ return count;
+ }
+
+ bool SetDefaultThreadActionIfNeeded(lldb::StateType action, int signal) {
+ if (GetActionForThread(LLDB_INVALID_THREAD_ID, true) == nullptr) {
+ // There isn't a default action so we do need to set it.
+ ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal};
+ m_actions.push_back(default_action);
+ m_signal_handled.push_back(false);
+ return true; // Return true as we did add the default action
+ }
+ return false;
+ }
+
+ void SetSignalHandledForThread(lldb::tid_t tid) const {
+ if (tid != LLDB_INVALID_THREAD_ID) {
+ const size_t num_actions = m_actions.size();
+ for (size_t i = 0; i < num_actions; ++i) {
+ if (m_actions[i].tid == tid)
+ m_signal_handled[i] = true;
+ }
+ }
+ }
+
+ const ResumeAction *GetFirst() const { return m_actions.data(); }
+
+ size_t GetSize() const { return m_actions.size(); }
+
+ void Clear() {
+ m_actions.clear();
+ m_signal_handled.clear();
+ }
+
+protected:
+ std::vector<ResumeAction> m_actions;
+ mutable std::vector<bool> m_signal_handled;
+};
+
+struct ThreadStopInfo {
+ lldb::StopReason reason;
+ union {
+ // eStopReasonSignal
+ struct {
+ uint32_t signo;
+ } signal;
+
+ // eStopReasonException
+ struct {
+ uint64_t type;
+ uint32_t data_count;
+ lldb::addr_t data[8];
+ } exception;
+ } details;
+};
+}
+
+#endif // liblldb_Debug_h_
diff --git a/linux-x64/clang/include/lldb/Host/Editline.h b/linux-x64/clang/include/lldb/Host/Editline.h
new file mode 100644
index 0000000..a942ede
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Editline.h
@@ -0,0 +1,367 @@
+//===-- Editline.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// TODO: wire up window size changes
+
+// If we ever get a private copy of libedit, there are a number of defects that
+// would be nice to fix;
+// a) Sometimes text just disappears while editing. In an 80-column editor
+// paste the following text, without
+// the quotes:
+// "This is a test of the input system missing Hello, World! Do you
+// disappear when it gets to a particular length?"
+// Now press ^A to move to the start and type 3 characters, and you'll see a
+// good amount of the text will
+// disappear. It's still in the buffer, just invisible.
+// b) The prompt printing logic for dealing with ANSI formatting characters is
+// broken, which is why we're
+// working around it here.
+// c) When resizing the terminal window, if the cursor moves between rows
+// libedit will get confused. d) The incremental search uses escape to cancel
+// input, so it's confused by
+// ANSI sequences starting with escape.
+// e) Emoji support is fairly terrible, presumably it doesn't understand
+// composed characters?
+
+#ifndef liblldb_Editline_h_
+#define liblldb_Editline_h_
+#if defined(__cplusplus)
+
+#if LLDB_EDITLINE_USE_WCHAR
+#include <codecvt>
+#endif
+#include <locale>
+#include <sstream>
+#include <vector>
+
+#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/lldb-private.h"
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/editlinewin.h"
+#elif !defined(__ANDROID__)
+#include <histedit.h>
+#endif
+
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Predicate.h"
+
+namespace lldb_private {
+namespace line_editor {
+
+// type alias's to help manage 8 bit and wide character versions of libedit
+#if LLDB_EDITLINE_USE_WCHAR
+using EditLineStringType = std::wstring;
+using EditLineStringStreamType = std::wstringstream;
+using EditLineCharType = wchar_t;
+#else
+using EditLineStringType = std::string;
+using EditLineStringStreamType = std::stringstream;
+using EditLineCharType = char;
+#endif
+
+// At one point the callback type of el_set getchar callback changed from char
+// to wchar_t. It is not possible to detect differentiate between the two
+// versions exactly, but this is a pretty good approximation and allows us to
+// build against almost any editline version out there.
+#if LLDB_EDITLINE_USE_WCHAR || defined(EL_CLIENTDATA) || LLDB_HAVE_EL_RFUNC_T
+using EditLineGetCharType = wchar_t;
+#else
+using EditLineGetCharType = char;
+#endif
+
+typedef int (*EditlineGetCharCallbackType)(::EditLine *editline,
+ EditLineGetCharType *c);
+typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline,
+ int ch);
+typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline);
+
+class EditlineHistory;
+
+typedef std::shared_ptr<EditlineHistory> EditlineHistorySP;
+
+typedef bool (*IsInputCompleteCallbackType)(Editline *editline,
+ StringList &lines, void *baton);
+
+typedef int (*FixIndentationCallbackType)(Editline *editline,
+ const StringList &lines,
+ int cursor_position, void *baton);
+
+typedef int (*CompleteCallbackType)(const char *current_line,
+ const char *cursor, const char *last_char,
+ int skip_first_n_matches, int max_matches,
+ StringList &matches,
+ StringList &descriptions, void *baton);
+
+/// Status used to decide when and how to start editing another line in
+/// multi-line sessions
+enum class EditorStatus {
+
+ /// The default state proceeds to edit the current line
+ Editing,
+
+ /// Editing complete, returns the complete set of edited lines
+ Complete,
+
+ /// End of input reported
+ EndOfInput,
+
+ /// Editing interrupted
+ Interrupted
+};
+
+/// Established locations that can be easily moved among with MoveCursor
+enum class CursorLocation {
+ /// The start of the first line in a multi-line edit session
+ BlockStart,
+
+ /// The start of the current line in a multi-line edit session
+ EditingPrompt,
+
+ /// The location of the cursor on the current line in a multi-line edit
+ /// session
+ EditingCursor,
+
+ /// The location immediately after the last character in a multi-line edit
+ /// session
+ BlockEnd
+};
+}
+
+using namespace line_editor;
+
+/// Instances of Editline provide an abstraction over libedit's EditLine
+/// facility. Both
+/// single- and multi-line editing are supported.
+class Editline {
+public:
+ Editline(const char *editor_name, FILE *input_file, FILE *output_file,
+ FILE *error_file, bool color_prompts);
+
+ ~Editline();
+
+ /// Uses the user data storage of EditLine to retrieve an associated instance
+ /// of Editline.
+ static Editline *InstanceFor(::EditLine *editline);
+
+ /// Sets a string to be used as a prompt, or combined with a line number to
+ /// form a prompt.
+ void SetPrompt(const char *prompt);
+
+ /// Sets an alternate string to be used as a prompt for the second line and
+ /// beyond in multi-line
+ /// editing scenarios.
+ void SetContinuationPrompt(const char *continuation_prompt);
+
+ /// Required to update the width of the terminal registered for I/O. It is
+ /// critical that this
+ /// be correct at all times.
+ void TerminalSizeChanged();
+
+ /// Returns the prompt established by SetPrompt()
+ const char *GetPrompt();
+
+ /// Returns the index of the line currently being edited
+ uint32_t GetCurrentLine();
+
+ /// Interrupt the current edit as if ^C was pressed
+ bool Interrupt();
+
+ /// Cancel this edit and oblitarate all trace of it
+ bool Cancel();
+
+ /// Register a callback for the tab key
+ void SetAutoCompleteCallback(CompleteCallbackType callback, void *baton);
+
+ /// Register a callback for testing whether multi-line input is complete
+ void SetIsInputCompleteCallback(IsInputCompleteCallbackType callback,
+ void *baton);
+
+ /// Register a callback for determining the appropriate indentation for a line
+ /// when creating a newline. An optional set of insertable characters can
+ /// also
+ /// trigger the callback.
+ bool SetFixIndentationCallback(FixIndentationCallbackType callback,
+ void *baton, const char *indent_chars);
+
+ /// Prompts for and reads a single line of user input.
+ bool GetLine(std::string &line, bool &interrupted);
+
+ /// Prompts for and reads a multi-line batch of user input.
+ bool GetLines(int first_line_number, StringList &lines, bool &interrupted);
+
+ void PrintAsync(Stream *stream, const char *s, size_t len);
+
+private:
+ /// Sets the lowest line number for multi-line editing sessions. A value of
+ /// zero suppresses
+ /// line number printing in the prompt.
+ void SetBaseLineNumber(int line_number);
+
+ /// Returns the complete prompt by combining the prompt or continuation prompt
+ /// with line numbers
+ /// as appropriate. The line index is a zero-based index into the current
+ /// multi-line session.
+ std::string PromptForIndex(int line_index);
+
+ /// Sets the current line index between line edits to allow free movement
+ /// between lines. Updates
+ /// the prompt to match.
+ void SetCurrentLine(int line_index);
+
+ /// Determines the width of the prompt in characters. The width is guaranteed
+ /// to be the same for
+ /// all lines of the current multi-line session.
+ int GetPromptWidth();
+
+ /// Returns true if the underlying EditLine session's keybindings are
+ /// Emacs-based, or false if
+ /// they are VI-based.
+ bool IsEmacs();
+
+ /// Returns true if the current EditLine buffer contains nothing but spaces,
+ /// or is empty.
+ bool IsOnlySpaces();
+
+ /// Helper method used by MoveCursor to determine relative line position.
+ int GetLineIndexForLocation(CursorLocation location, int cursor_row);
+
+ /// Move the cursor from one well-established location to another using
+ /// relative line positioning
+ /// and absolute column positioning.
+ void MoveCursor(CursorLocation from, CursorLocation to);
+
+ /// Clear from cursor position to bottom of screen and print input lines
+ /// including prompts, optionally
+ /// starting from a specific line. Lines are drawn with an extra space at the
+ /// end to reserve room for
+ /// the rightmost cursor position.
+ void DisplayInput(int firstIndex = 0);
+
+ /// Counts the number of rows a given line of content will end up occupying,
+ /// taking into account both
+ /// the preceding prompt and a single trailing space occupied by a cursor when
+ /// at the end of the line.
+ int CountRowsForLine(const EditLineStringType &content);
+
+ /// Save the line currently being edited
+ void SaveEditedLine();
+
+ /// Convert the current input lines into a UTF8 StringList
+ StringList GetInputAsStringList(int line_count = UINT32_MAX);
+
+ /// Replaces the current multi-line session with the next entry from history.
+ /// When the parameter is
+ /// true it will take the next earlier entry from history, when it is false it
+ /// takes the next most
+ /// recent.
+ unsigned char RecallHistory(bool earlier);
+
+ /// Character reading implementation for EditLine that supports our multi-line
+ /// editing trickery.
+ int GetCharacter(EditLineGetCharType *c);
+
+ /// Prompt implementation for EditLine.
+ const char *Prompt();
+
+ /// Line break command used when meta+return is pressed in multi-line mode.
+ unsigned char BreakLineCommand(int ch);
+
+ /// Command used when return is pressed in multi-line mode.
+ unsigned char EndOrAddLineCommand(int ch);
+
+ /// Delete command used when delete is pressed in multi-line mode.
+ unsigned char DeleteNextCharCommand(int ch);
+
+ /// Delete command used when backspace is pressed in multi-line mode.
+ unsigned char DeletePreviousCharCommand(int ch);
+
+ /// Line navigation command used when ^P or up arrow are pressed in multi-line
+ /// mode.
+ unsigned char PreviousLineCommand(int ch);
+
+ /// Line navigation command used when ^N or down arrow are pressed in
+ /// multi-line mode.
+ unsigned char NextLineCommand(int ch);
+
+ /// History navigation command used when Alt + up arrow is pressed in
+ /// multi-line mode.
+ unsigned char PreviousHistoryCommand(int ch);
+
+ /// History navigation command used when Alt + down arrow is pressed in
+ /// multi-line mode.
+ unsigned char NextHistoryCommand(int ch);
+
+ /// Buffer start command used when Esc < is typed in multi-line emacs mode.
+ unsigned char BufferStartCommand(int ch);
+
+ /// Buffer end command used when Esc > is typed in multi-line emacs mode.
+ unsigned char BufferEndCommand(int ch);
+
+ /// Context-sensitive tab insertion or code completion command used when the
+ /// tab key is typed.
+ unsigned char TabCommand(int ch);
+
+ /// Respond to normal character insertion by fixing line indentation
+ unsigned char FixIndentationCommand(int ch);
+
+ /// Revert line command used when moving between lines.
+ unsigned char RevertLineCommand(int ch);
+
+ /// Ensures that the current EditLine instance is properly configured for
+ /// single or multi-line editing.
+ void ConfigureEditor(bool multiline);
+
+ bool CompleteCharacter(char ch, EditLineGetCharType &out);
+
+private:
+#if LLDB_EDITLINE_USE_WCHAR
+ std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
+#endif
+ ::EditLine *m_editline = nullptr;
+ EditlineHistorySP m_history_sp;
+ bool m_in_history = false;
+ std::vector<EditLineStringType> m_live_history_lines;
+ bool m_multiline_enabled = false;
+ std::vector<EditLineStringType> m_input_lines;
+ EditorStatus m_editor_status;
+ bool m_color_prompts = true;
+ int m_terminal_width = 0;
+ int m_base_line_number = 0;
+ unsigned m_current_line_index = 0;
+ int m_current_line_rows = -1;
+ int m_revert_cursor_index = 0;
+ int m_line_number_digits = 3;
+ std::string m_set_prompt;
+ std::string m_set_continuation_prompt;
+ std::string m_current_prompt;
+ bool m_needs_prompt_repaint = false;
+ std::string m_editor_name;
+ FILE *m_input_file;
+ FILE *m_output_file;
+ FILE *m_error_file;
+ ConnectionFileDescriptor m_input_connection;
+ IsInputCompleteCallbackType m_is_input_complete_callback = nullptr;
+ void *m_is_input_complete_callback_baton = nullptr;
+ FixIndentationCallbackType m_fix_indentation_callback = nullptr;
+ void *m_fix_indentation_callback_baton = nullptr;
+ const char *m_fix_indentation_callback_chars = nullptr;
+ CompleteCallbackType m_completion_callback = nullptr;
+ void *m_completion_callback_baton = nullptr;
+
+ std::mutex m_output_mutex;
+};
+}
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Editline_h_
diff --git a/linux-x64/clang/include/lldb/Host/File.h b/linux-x64/clang/include/lldb/Host/File.h
new file mode 100644
index 0000000..eb28c4a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/File.h
@@ -0,0 +1,392 @@
+//===-- File.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_File_h_
+#define liblldb_File_h_
+
+#include "lldb/Host/PosixApi.h"
+#include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private.h"
+
+#include <mutex>
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+namespace lldb_private {
+
+/// \class File File.h "lldb/Host/File.h"
+/// A file class.
+///
+/// A file class that divides abstracts the LLDB core from host file
+/// functionality.
+class File : public IOObject {
+public:
+ static int kInvalidDescriptor;
+ static FILE *kInvalidStream;
+
+ // NB this enum is used in the lldb platform gdb-remote packet
+ // vFile:open: and existing values cannot be modified.
+ enum OpenOptions {
+ eOpenOptionRead = (1u << 0), // Open file for reading
+ eOpenOptionWrite = (1u << 1), // Open file for writing
+ eOpenOptionAppend =
+ (1u << 2), // Don't truncate file when opening, append to end of file
+ eOpenOptionTruncate = (1u << 3), // Truncate file when opening
+ eOpenOptionNonBlocking = (1u << 4), // File reads
+ eOpenOptionCanCreate = (1u << 5), // Create file if doesn't already exist
+ eOpenOptionCanCreateNewOnly =
+ (1u << 6), // Can create file only if it doesn't already exist
+ eOpenOptionDontFollowSymlinks = (1u << 7),
+ eOpenOptionCloseOnExec =
+ (1u << 8) // Close the file when executing a new process
+ };
+
+ static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
+
+ File()
+ : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
+ m_stream(kInvalidStream), m_options(0), m_own_stream(false),
+ m_is_interactive(eLazyBoolCalculate),
+ m_is_real_terminal(eLazyBoolCalculate),
+ m_supports_colors(eLazyBoolCalculate) {}
+
+ File(FILE *fh, bool transfer_ownership)
+ : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
+ m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
+ m_is_interactive(eLazyBoolCalculate),
+ m_is_real_terminal(eLazyBoolCalculate),
+ m_supports_colors(eLazyBoolCalculate) {}
+
+ File(int fd, bool transfer_ownership)
+ : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd),
+ m_stream(kInvalidStream), m_options(0), m_own_stream(false),
+ m_is_interactive(eLazyBoolCalculate),
+ m_is_real_terminal(eLazyBoolCalculate) {}
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual in case this class is subclassed.
+ ~File() override;
+
+ bool IsValid() const override {
+ return DescriptorIsValid() || StreamIsValid();
+ }
+
+ /// Convert to pointer operator.
+ ///
+ /// This allows code to check a File object to see if it contains anything
+ /// valid using code such as:
+ ///
+ /// \code
+ /// File file(...);
+ /// if (file)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// A pointer to this object if either the directory or filename
+ /// is valid, nullptr otherwise.
+ operator bool() const { return DescriptorIsValid() || StreamIsValid(); }
+
+ /// Logical NOT operator.
+ ///
+ /// This allows code to check a File object to see if it is invalid using
+ /// code such as:
+ ///
+ /// \code
+ /// File file(...);
+ /// if (!file)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// Returns \b true if the object has an empty directory and
+ /// filename, \b false otherwise.
+ bool operator!() const { return !DescriptorIsValid() && !StreamIsValid(); }
+
+ /// Get the file spec for this file.
+ ///
+ /// \return
+ /// A reference to the file specification object.
+ Status GetFileSpec(FileSpec &file_spec) const;
+
+ Status Close() override;
+
+ void Clear();
+
+ int GetDescriptor() const;
+
+ WaitableHandle GetWaitableHandle() override;
+
+ void SetDescriptor(int fd, bool transfer_ownership);
+
+ FILE *GetStream();
+
+ void SetStream(FILE *fh, bool transfer_ownership);
+
+ /// Read bytes from a file from the current file position.
+ ///
+ /// NOTE: This function is NOT thread safe. Use the read function
+ /// that takes an "off_t &offset" to ensure correct operation in multi-
+ /// threaded environments.
+ ///
+ /// \param[in] buf
+ /// A buffer where to put the bytes that are read.
+ ///
+ /// \param[in,out] num_bytes
+ /// The number of bytes to read form the current file position
+ /// which gets modified with the number of bytes that were read.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Read(void *buf, size_t &num_bytes) override;
+
+ /// Write bytes to a file at the current file position.
+ ///
+ /// NOTE: This function is NOT thread safe. Use the write function
+ /// that takes an "off_t &offset" to ensure correct operation in multi-
+ /// threaded environments.
+ ///
+ /// \param[in] buf
+ /// A buffer where to put the bytes that are read.
+ ///
+ /// \param[in,out] num_bytes
+ /// The number of bytes to write to the current file position
+ /// which gets modified with the number of bytes that were
+ /// written.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Write(const void *buf, size_t &num_bytes) override;
+
+ /// Seek to an offset relative to the beginning of the file.
+ ///
+ /// NOTE: This function is NOT thread safe, other threads that
+ /// access this object might also change the current file position. For
+ /// thread safe reads and writes see the following functions: @see
+ /// File::Read (void *, size_t, off_t &) \see File::Write (const void *,
+ /// size_t, off_t &)
+ ///
+ /// \param[in] offset
+ /// The offset to seek to within the file relative to the
+ /// beginning of the file.
+ ///
+ /// \param[in] error_ptr
+ /// 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, Status *error_ptr = nullptr);
+
+ /// Seek to an offset relative to the current file position.
+ ///
+ /// NOTE: This function is NOT thread safe, other threads that
+ /// access this object might also change the current file position. For
+ /// thread safe reads and writes see the following functions: @see
+ /// File::Read (void *, size_t, off_t &) \see File::Write (const void *,
+ /// size_t, off_t &)
+ ///
+ /// \param[in] offset
+ /// The offset to seek to within the file relative to the
+ /// current file position.
+ ///
+ /// \param[in] error_ptr
+ /// 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, Status *error_ptr = nullptr);
+
+ /// Seek to an offset relative to the end of the file.
+ ///
+ /// NOTE: This function is NOT thread safe, other threads that
+ /// access this object might also change the current file position. For
+ /// thread safe reads and writes see the following functions: @see
+ /// File::Read (void *, size_t, off_t &) \see File::Write (const void *,
+ /// size_t, off_t &)
+ ///
+ /// \param[in,out] offset
+ /// The offset to seek to within the file relative to the
+ /// end of the file which gets filled in with the resulting
+ /// absolute file offset.
+ ///
+ /// \param[in] error_ptr
+ /// 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, Status *error_ptr = nullptr);
+
+ /// Read bytes from a file from the specified file offset.
+ ///
+ /// NOTE: This function is thread safe in that clients manager their
+ /// own file position markers and reads on other threads won't mess up the
+ /// current read.
+ ///
+ /// \param[in] dst
+ /// A buffer where to put the bytes that are read.
+ ///
+ /// \param[in,out] num_bytes
+ /// The number of bytes to read form the current file position
+ /// which gets modified with the number of bytes that were read.
+ ///
+ /// \param[in,out] offset
+ /// The offset within the file from which to read \a num_bytes
+ /// bytes. This offset gets incremented by the number of bytes
+ /// that were read.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Read(void *dst, size_t &num_bytes, off_t &offset);
+
+ /// Read bytes from a file from the specified file offset.
+ ///
+ /// NOTE: This function is thread safe in that clients manager their
+ /// own file position markers and reads on other threads won't mess up the
+ /// current read.
+ ///
+ /// \param[in,out] num_bytes
+ /// The number of bytes to read form the current file position
+ /// which gets modified with the number of bytes that were read.
+ ///
+ /// \param[in,out] offset
+ /// The offset within the file from which to read \a num_bytes
+ /// bytes. This offset gets incremented by the number of bytes
+ /// that were read.
+ ///
+ /// \param[in] null_terminate
+ /// Ensure that the data that is read is terminated with a NULL
+ /// character so that the data can be used as a C string.
+ ///
+ /// \param[out] data_buffer_sp
+ /// A data buffer to create and fill in that will contain any
+ /// data that is read from the file. This buffer will be reset
+ /// if an error occurs.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ 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.
+ ///
+ /// NOTE: This function is thread safe in that clients manager their
+ /// own file position markers, though clients will need to implement their
+ /// own locking externally to avoid multiple people writing to the file at
+ /// the same time.
+ ///
+ /// \param[in] src
+ /// A buffer containing the bytes to write.
+ ///
+ /// \param[in,out] num_bytes
+ /// The number of bytes to write to the file at offset \a offset.
+ /// \a num_bytes gets modified with the number of bytes that
+ /// were read.
+ ///
+ /// \param[in,out] offset
+ /// The offset within the file at which to write \a num_bytes
+ /// bytes. This offset gets incremented by the number of bytes
+ /// that were written.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Write(const void *src, size_t &num_bytes, off_t &offset);
+
+ /// Flush the current stream
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Flush();
+
+ /// Sync to disk.
+ ///
+ /// \return
+ /// An error object that indicates success or the reason for
+ /// failure.
+ Status Sync();
+
+ /// Get the permissions for a this file.
+ ///
+ /// \return
+ /// Bits logical OR'ed together from the permission bits defined
+ /// in lldb_private::File::Permissions.
+ uint32_t GetPermissions(Status &error) const;
+
+ /// Return true if this file is interactive.
+ ///
+ /// \return
+ /// True if this file is a terminal (tty or pty), false
+ /// otherwise.
+ bool GetIsInteractive();
+
+ /// Return true if this file from a real terminal.
+ ///
+ /// Just knowing a file is a interactive isn't enough, we also need to know
+ /// if the terminal has a width and height so we can do cursor movement and
+ /// other terminal manipulations by sending escape sequences.
+ ///
+ /// \return
+ /// True if this file is a terminal (tty, not a pty) that has
+ /// a non-zero width and height, false otherwise.
+ bool GetIsRealTerminal();
+
+ bool GetIsTerminalWithColors();
+
+ /// Output printf formatted output to the stream.
+ ///
+ /// Print some formatted output to the stream.
+ ///
+ /// \param[in] format
+ /// A printf style format string.
+ ///
+ /// \param[in] ...
+ /// Variable arguments that are needed for the printf style
+ /// format string \a format.
+ size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+ size_t PrintfVarArg(const char *format, va_list args);
+
+ void SetOptions(uint32_t options) { m_options = options; }
+
+ static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
+
+protected:
+ bool DescriptorIsValid() const { return DescriptorIsValid(m_descriptor); }
+
+ bool StreamIsValid() const { return m_stream != kInvalidStream; }
+
+ void CalculateInteractiveAndTerminal();
+
+ // Member variables
+ int m_descriptor;
+ FILE *m_stream;
+ uint32_t m_options;
+ bool m_own_stream;
+ LazyBool m_is_interactive;
+ LazyBool m_is_real_terminal;
+ LazyBool m_supports_colors;
+ std::mutex offset_access_mutex;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(File);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_File_h_
diff --git a/linux-x64/clang/include/lldb/Host/FileAction.h b/linux-x64/clang/include/lldb/Host/FileAction.h
new file mode 100644
index 0000000..4d333bb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/FileAction.h
@@ -0,0 +1,58 @@
+//===-- FileAction.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_HOST_FILEACTION_H
+#define LLDB_HOST_FILEACTION_H
+
+#include "lldb/Utility/FileSpec.h"
+#include <string>
+
+namespace lldb_private {
+
+class FileAction {
+public:
+ enum Action {
+ eFileActionNone,
+ eFileActionClose,
+ eFileActionDuplicate,
+ eFileActionOpen
+ };
+
+ FileAction();
+
+ void Clear();
+
+ bool Close(int fd);
+
+ bool Duplicate(int fd, int dup_fd);
+
+ bool Open(int fd, const FileSpec &file_spec, bool read, bool write);
+
+ int GetFD() const { return m_fd; }
+
+ Action GetAction() const { return m_action; }
+
+ int GetActionArgument() const { return m_arg; }
+
+ llvm::StringRef GetPath() const;
+
+ const FileSpec &GetFileSpec() const;
+
+ void Dump(Stream &stream) const;
+
+protected:
+ Action m_action; // The action for this file
+ int m_fd; // An existing file descriptor
+ int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
+ FileSpec
+ m_file_spec; // A file spec to use for opening after fork or posix_spawn
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/FileCache.h b/linux-x64/clang/include/lldb/Host/FileCache.h
new file mode 100644
index 0000000..0c1ef19
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/FileCache.h
@@ -0,0 +1,46 @@
+//===-- FileCache.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#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/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+
+namespace lldb_private {
+class FileCache {
+private:
+ FileCache() {}
+
+ typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
+
+public:
+ static FileCache &GetInstance();
+
+ lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
+ 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, Status &error);
+ uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
+ uint64_t dst_len, Status &error);
+
+private:
+ static FileCache *m_instance;
+
+ FDToFileMap m_cache;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/FileSystem.h b/linux-x64/clang/include/lldb/Host/FileSystem.h
new file mode 100644
index 0000000..865b09b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/FileSystem.h
@@ -0,0 +1,196 @@
+//===-- FileSystem.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_FileSystem_h
+#define liblldb_Host_FileSystem_h
+
+#include "lldb/Host/File.h"
+#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/FileCollector.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/Chrono.h"
+#include "llvm/Support/VirtualFileSystem.h"
+
+#include "lldb/lldb-types.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+namespace lldb_private {
+class FileSystem {
+public:
+ static const char *DEV_NULL;
+ static const char *PATH_CONVERSION_ERROR;
+
+ FileSystem()
+ : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
+ m_mapped(false) {}
+ FileSystem(FileCollector &collector)
+ : m_fs(llvm::vfs::getRealFileSystem()), m_collector(&collector),
+ m_mapped(false) {}
+ FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
+ bool mapped = false)
+ : m_fs(fs), m_collector(nullptr), m_mapped(mapped) {}
+
+ FileSystem(const FileSystem &fs) = delete;
+ FileSystem &operator=(const FileSystem &fs) = delete;
+
+ static FileSystem &Instance();
+
+ static void Initialize();
+ static void Initialize(FileCollector &collector);
+ static llvm::Error Initialize(const FileSpec &mapping);
+ static void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
+ static void Terminate();
+
+ Status Symlink(const FileSpec &src, const FileSpec &dst);
+ Status Readlink(const FileSpec &src, FileSpec &dst);
+
+ Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
+
+ /// Wraps ::fopen in a platform-independent way.
+ FILE *Fopen(const char *path, const char *mode);
+
+ /// Wraps ::open in a platform-independent way.
+ int Open(const char *path, int flags, int mode);
+
+ Status Open(File &File, const FileSpec &file_spec, uint32_t options,
+ uint32_t permissions = lldb::eFilePermissionsFileDefault,
+ bool should_close_fd = true);
+
+ /// Get a directory iterator.
+ /// \{
+ llvm::vfs::directory_iterator DirBegin(const FileSpec &file_spec,
+ std::error_code &ec);
+ llvm::vfs::directory_iterator DirBegin(const llvm::Twine &dir,
+ std::error_code &ec);
+ /// \}
+
+ /// Returns the Status object for the given file.
+ /// \{
+ llvm::ErrorOr<llvm::vfs::Status> GetStatus(const FileSpec &file_spec) const;
+ llvm::ErrorOr<llvm::vfs::Status> GetStatus(const llvm::Twine &path) const;
+ /// \}
+
+ /// Returns the modification time of the given file.
+ /// \{
+ llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const;
+ llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const;
+ /// \}
+
+ /// Returns the on-disk size of the given file in bytes.
+ /// \{
+ uint64_t GetByteSize(const FileSpec &file_spec) const;
+ uint64_t GetByteSize(const llvm::Twine &path) const;
+ /// \}
+
+ /// Return the current permissions of the given file.
+ ///
+ /// Returns a bitmask for the current permissions of the file (zero or more
+ /// of the permission bits defined in File::Permissions).
+ /// \{
+ uint32_t GetPermissions(const FileSpec &file_spec) const;
+ uint32_t GetPermissions(const llvm::Twine &path) const;
+ uint32_t GetPermissions(const FileSpec &file_spec, std::error_code &ec) const;
+ uint32_t GetPermissions(const llvm::Twine &path, std::error_code &ec) const;
+ /// \}
+
+ /// Returns whether the given file exists.
+ /// \{
+ bool Exists(const FileSpec &file_spec) const;
+ bool Exists(const llvm::Twine &path) const;
+ /// \}
+
+ /// Returns whether the given file is readable.
+ /// \{
+ bool Readable(const FileSpec &file_spec) const;
+ bool Readable(const llvm::Twine &path) const;
+ /// \}
+
+ /// Returns whether the given path is a directory.
+ /// \{
+ bool IsDirectory(const FileSpec &file_spec) const;
+ bool IsDirectory(const llvm::Twine &path) const;
+ /// \}
+
+ /// Returns whether the given path is local to the file system.
+ /// \{
+ bool IsLocal(const FileSpec &file_spec) const;
+ bool IsLocal(const llvm::Twine &path) const;
+ /// \}
+
+ /// Make the given file path absolute.
+ /// \{
+ std::error_code MakeAbsolute(llvm::SmallVectorImpl<char> &path) const;
+ std::error_code MakeAbsolute(FileSpec &file_spec) const;
+ /// \}
+
+ /// Resolve path to make it canonical.
+ /// \{
+ void Resolve(llvm::SmallVectorImpl<char> &path);
+ void Resolve(FileSpec &file_spec);
+ /// \}
+
+ //// Create memory buffer from path.
+ /// \{
+ std::shared_ptr<DataBufferLLVM> CreateDataBuffer(const llvm::Twine &path,
+ uint64_t size = 0,
+ uint64_t offset = 0);
+ std::shared_ptr<DataBufferLLVM> CreateDataBuffer(const FileSpec &file_spec,
+ uint64_t size = 0,
+ uint64_t offset = 0);
+ /// \}
+
+ /// Call into the Host to see if it can help find the file.
+ bool ResolveExecutableLocation(FileSpec &file_spec);
+
+ enum EnumerateDirectoryResult {
+ /// Enumerate next entry in the current directory.
+ eEnumerateDirectoryResultNext,
+ /// Recurse into the current entry if it is a directory or symlink, or next
+ /// if not.
+ eEnumerateDirectoryResultEnter,
+ /// Stop directory enumerations at any level.
+ eEnumerateDirectoryResultQuit
+ };
+
+ typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
+ void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef);
+
+ typedef std::function<EnumerateDirectoryResult(
+ llvm::sys::fs::file_type file_type, llvm::StringRef)>
+ DirectoryCallback;
+
+ void EnumerateDirectory(llvm::Twine path, bool find_directories,
+ bool find_files, bool find_other,
+ EnumerateDirectoryCallbackType callback,
+ void *callback_baton);
+
+ std::error_code GetRealPath(const llvm::Twine &path,
+ llvm::SmallVectorImpl<char> &output) const;
+
+ llvm::ErrorOr<std::string> GetExternalPath(const llvm::Twine &path);
+ llvm::ErrorOr<std::string> GetExternalPath(const FileSpec &file_spec);
+
+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> GetVirtualFileSystem() {
+ return m_fs;
+ }
+
+private:
+ static llvm::Optional<FileSystem> &InstanceImpl();
+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
+ FileCollector *m_collector;
+ bool m_mapped;
+};
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/Host.h b/linux-x64/clang/include/lldb/Host/Host.h
new file mode 100644
index 0000000..884c5cf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Host.h
@@ -0,0 +1,248 @@
+//===-- Host.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_HOST_HOST_H
+#define LLDB_HOST_HOST_H
+
+#include "lldb/Host/File.h"
+#include "lldb/Host/HostThread.h"
+#include "lldb/Utility/Environment.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Timeout.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 {
+
+class FileAction;
+class ProcessLaunchInfo;
+class ProcessInstanceInfo;
+class ProcessInstanceInfoList;
+class ProcessInstanceInfoMatch;
+
+// 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);
+};
+
+inline bool operator==(WaitStatus a, WaitStatus b) {
+ return a.type == b.type && a.status == b.status;
+}
+
+inline bool operator!=(WaitStatus a, WaitStatus b) { return !(a == b); }
+
+/// \class Host Host.h "lldb/Host/Host.h"
+/// A class that provides host computer information.
+///
+/// Host is a class that answers information about the host operating system.
+class Host {
+public:
+ typedef std::function<bool(
+ lldb::pid_t pid, bool exited,
+ int signal, // Zero for no signal
+ int status)> // Exit value of process if signal is zero
+ MonitorChildProcessCallback;
+
+ /// Start monitoring a child process.
+ ///
+ /// Allows easy monitoring of child processes. \a callback will be called
+ /// when the child process exits or if it gets a signal. The callback will
+ /// only be called with signals if \a monitor_signals is \b true. \a
+ /// callback will usually be called from another thread so the callback
+ /// function must be thread safe.
+ ///
+ /// When the callback gets called, the return value indicates if monitoring
+ /// should stop. If \b true is returned from \a callback the information
+ /// will be removed. If \b false is returned then monitoring will continue.
+ /// If the child process exits, the monitoring will automatically stop after
+ /// the callback returned regardless of the callback return value.
+ ///
+ /// \param[in] callback
+ /// A function callback to call when a child receives a signal
+ /// (if \a monitor_signals is true) or a child exits.
+ ///
+ /// \param[in] pid
+ /// The process ID of a child process to monitor, -1 for all
+ /// processes.
+ ///
+ /// \param[in] monitor_signals
+ /// If \b true the callback will get called when the child
+ /// process gets a signal. If \b false, the callback will only
+ /// get called if the child process exits.
+ ///
+ /// \return
+ /// A thread handle that can be used to cancel the thread that
+ /// was spawned to monitor \a pid.
+ ///
+ /// \see static void Host::StopMonitoringChildProcess (uint32_t)
+ static llvm::Expected<HostThread>
+ StartMonitoringChildProcess(const MonitorChildProcessCallback &callback,
+ lldb::pid_t pid, bool monitor_signals);
+
+ enum SystemLogType { eSystemLogWarning, eSystemLogError };
+
+ static void SystemLog(SystemLogType type, const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ static void SystemLog(SystemLogType type, const char *format, va_list args);
+
+ /// Get the process ID for the calling process.
+ ///
+ /// \return
+ /// The process ID for the current process.
+ static lldb::pid_t GetCurrentProcessID();
+
+ static void Kill(lldb::pid_t pid, int signo);
+
+ /// Get the thread token (the one returned by ThreadCreate when the thread
+ /// was created) for the calling thread in the current process.
+ ///
+ /// \return
+ /// The thread token for the calling thread in the current process.
+ static lldb::thread_t GetCurrentThread();
+
+ static const char *GetSignalAsCString(int signo);
+
+ /// Given an address in the current process (the process that is running the
+ /// LLDB code), return the name of the module that it comes from. This can
+ /// be useful when you need to know the path to the shared library that your
+ /// code is running in for loading resources that are relative to your
+ /// binary.
+ ///
+ /// \param[in] host_addr
+ /// The pointer to some code in the current process.
+ ///
+ /// \return
+ /// \b A file spec with the module that contains \a host_addr,
+ /// which may be invalid if \a host_addr doesn't fall into
+ /// any valid module address range.
+ static FileSpec GetModuleFileSpecForHostAddress(const void *host_addr);
+
+ /// If you have an executable that is in a bundle and want to get back to
+ /// the bundle directory from the path itself, this function will change a
+ /// path to a file within a bundle to the bundle directory itself.
+ ///
+ /// \param[in] file
+ /// A file spec that might point to a file in a bundle.
+ ///
+ /// \param[out] bundle_directory
+ /// An object will be filled in with the bundle directory for
+ /// the bundle when \b true is returned. Otherwise \a file is
+ /// left untouched and \b false is returned.
+ ///
+ /// \return
+ /// \b true if \a file was resolved in \a bundle_directory,
+ /// \b false otherwise.
+ static bool GetBundleDirectory(const FileSpec &file,
+ FileSpec &bundle_directory);
+
+ /// When executable files may live within a directory, where the directory
+ /// represents an executable bundle (like the MacOSX app bundles), then
+ /// locate the executable within the containing bundle.
+ ///
+ /// \param[in,out] file
+ /// A file spec that currently points to the bundle that will
+ /// be filled in with the executable path within the bundle
+ /// if \b true is returned. Otherwise \a file is left untouched.
+ ///
+ /// \return
+ /// \b true if \a file was resolved, \b false if this function
+ /// was not able to resolve the path.
+ static bool ResolveExecutableInBundle(FileSpec &file);
+
+ static uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &proc_infos);
+
+ typedef std::map<lldb::pid_t, bool> TidMap;
+ typedef std::pair<lldb::pid_t, bool> TidPair;
+ static bool FindProcessThreads(const lldb::pid_t pid, TidMap &tids_to_attach);
+
+ static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info);
+
+ /// Launch the process specified in launch_info. The monitoring callback in
+ /// launch_info must be set, and it will be called when the process
+ /// terminates.
+ static Status LaunchProcess(ProcessLaunchInfo &launch_info);
+
+ /// Perform expansion of the command-line for this launch info This can
+ /// potentially involve wildcard expansion
+ /// environment variable replacement, and whatever other
+ /// argument magic the platform defines as part of its typical
+ /// user experience
+ static Status ShellExpandArguments(ProcessLaunchInfo &launch_info);
+
+ /// Run a shell command.
+ /// \arg command shouldn't be NULL
+ /// \arg working_dir Pass empty FileSpec to use the current working directory
+ /// \arg status_ptr Pass NULL if you don't want the process exit status
+ /// \arg signo_ptr Pass NULL if you don't want the signal that caused the
+ /// process to exit
+ /// \arg command_output Pass NULL if you don't want the command output
+ /// \arg hide_stderr if this is false, redirect stderr to stdout
+ /// TODO: Convert this function to take a StringRef.
+ static Status RunShellCommand(const char *command,
+ const FileSpec &working_dir, int *status_ptr,
+ int *signo_ptr, std::string *command_output,
+ const Timeout<std::micro> &timeout,
+ bool run_in_default_shell = true,
+ bool hide_stderr = false);
+
+ /// Run a shell command.
+ /// \arg working_dir Pass empty FileSpec to use the current working directory
+ /// \arg status_ptr Pass NULL if you don't want the process exit status
+ /// \arg signo_ptr Pass NULL if you don't want the signal that caused the
+ /// process to exit
+ /// \arg command_output Pass NULL if you don't want the command output
+ /// \arg hide_stderr if this is false, redirect stderr to stdout
+ static Status RunShellCommand(const Args &args, const FileSpec &working_dir,
+ int *status_ptr, int *signo_ptr,
+ std::string *command_output,
+ const Timeout<std::micro> &timeout,
+ bool run_in_default_shell = true,
+ bool hide_stderr = false);
+
+ static bool OpenFileInExternalEditor(const FileSpec &file_spec,
+ uint32_t line_no);
+
+ static Environment GetEnvironment();
+
+ static std::unique_ptr<Connection>
+ CreateDefaultConnection(llvm::StringRef url);
+};
+
+} // namespace lldb_private
+
+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/linux-x64/clang/include/lldb/Host/HostGetOpt.h b/linux-x64/clang/include/lldb/Host/HostGetOpt.h
new file mode 100644
index 0000000..dedeb2e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostGetOpt.h
@@ -0,0 +1,23 @@
+//===-- HostGetOpt.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#pragma once
+
+#if !defined(_MSC_VER) && !defined(__NetBSD__)
+
+#ifdef _WIN32
+#define _BSD_SOURCE // Required so that getopt.h defines optreset
+#endif
+
+#include <getopt.h>
+#include <unistd.h>
+
+#else
+
+#include <lldb/Host/common/GetOptInc.h>
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostInfo.h b/linux-x64/clang/include/lldb/Host/HostInfo.h
new file mode 100644
index 0000000..196127d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostInfo.h
@@ -0,0 +1,69 @@
+//===-- HostInfo.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostInfo_h_
+#define lldb_Host_HostInfo_h_
+
+/// \class HostInfo HostInfo.h "lldb/Host/HostInfo.h"
+/// A class that provides host computer information.
+///
+/// HostInfo is a class that answers information about the host operating
+/// system. Note that HostInfo is NOT intended to be used to manipulate or
+/// control the operating system.
+///
+/// HostInfo is implemented in an OS-specific class (for example
+/// HostInfoWindows) in a separate file, and then typedefed to HostInfo here.
+/// Users of the class reference it as HostInfo::method().
+///
+/// Not all hosts provide the same functionality. It is important that
+/// methods only be implemented at the lowest level at which they make sense.
+/// It should be up to the clients of the class to ensure that they not
+/// attempt to call a method which doesn't make sense for a particular
+/// platform. For example, when implementing a method that only makes sense
+/// on a posix-compliant system, implement it on HostInfoPosix, and not on
+/// HostInfoBase with a default implementation. This way, users of HostInfo
+/// are required to think about the implications of calling a particular
+/// method and if used in a context where the method doesn't make sense, will
+/// generate a compiler error.
+///
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/HostInfoWindows.h"
+#define HOST_INFO_TYPE HostInfoWindows
+#elif defined(__linux__)
+#if defined(__ANDROID__)
+#include "lldb/Host/android/HostInfoAndroid.h"
+#define HOST_INFO_TYPE HostInfoAndroid
+#else
+#include "lldb/Host/linux/HostInfoLinux.h"
+#define HOST_INFO_TYPE HostInfoLinux
+#endif
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
+#define HOST_INFO_TYPE HostInfoFreeBSD
+#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
+#else
+#include "lldb/Host/posix/HostInfoPosix.h"
+#define HOST_INFO_TYPE HostInfoPosix
+#endif
+
+namespace lldb_private {
+typedef HOST_INFO_TYPE HostInfo;
+}
+
+#undef HOST_INFO_TYPE
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostInfoBase.h b/linux-x64/clang/include/lldb/Host/HostInfoBase.h
new file mode 100644
index 0000000..6f66889
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostInfoBase.h
@@ -0,0 +1,114 @@
+//===-- HostInfoBase.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostInfoBase_h_
+#define lldb_Host_HostInfoBase_h_
+
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UserIDResolver.h"
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <stdint.h>
+
+#include <string>
+
+namespace lldb_private {
+
+class FileSpec;
+
+class HostInfoBase {
+private:
+ // Static class, unconstructable.
+ HostInfoBase() {}
+ ~HostInfoBase() {}
+
+public:
+ static void Initialize();
+ static void Terminate();
+
+ /// Gets the host target triple as a const string.
+ ///
+ /// \return
+ /// A const string object containing the host target triple.
+ static llvm::StringRef GetTargetTriple();
+
+ /// Gets the host architecture.
+ ///
+ /// \return
+ /// A const architecture object that represents the host
+ /// architecture.
+ enum ArchitectureKind {
+ eArchKindDefault, // The overall default architecture that applications will
+ // run on this host
+ eArchKind32, // If this host supports 32 bit programs, return the default 32
+ // bit arch
+ eArchKind64 // If this host supports 64 bit programs, return the default 64
+ // bit arch
+ };
+
+ static const ArchSpec &
+ GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
+
+ static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
+
+ /// Returns the directory containing the lldb shared library. Only the
+ /// directory member of the FileSpec is filled in.
+ static FileSpec GetShlibDir();
+
+ /// Returns the directory containing the support executables (debugserver,
+ /// ...). Only the directory member of the FileSpec is filled in.
+ static FileSpec GetSupportExeDir();
+
+ /// Returns the directory containing the lldb headers. Only the directory
+ /// member of the FileSpec is filled in.
+ static FileSpec GetHeaderDir();
+
+ /// Returns the directory containing the system plugins. Only the directory
+ /// member of the FileSpec is filled in.
+ static FileSpec GetSystemPluginDir();
+
+ /// Returns the directory containing the user plugins. Only the directory
+ /// member of the FileSpec is filled in.
+ static FileSpec GetUserPluginDir();
+
+ /// Returns the proces temporary directory. This directory will be cleaned up
+ /// when this process exits. Only the directory member of the FileSpec is
+ /// filled in.
+ static FileSpec GetProcessTempDir();
+
+ /// Returns the global temporary directory. This directory will **not** be
+ /// cleaned up when this process exits. Only the directory member of the
+ /// FileSpec is filled in.
+ static FileSpec GetGlobalTempDir();
+
+ /// If the triple does not specify the vendor, os, and environment parts, we
+ /// "augment" these using information from the host and return the resulting
+ /// ArchSpec object.
+ static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
+
+ static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
+ llvm::StringRef dir);
+
+protected:
+ static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
+ static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
+ static bool ComputeHeaderDirectory(FileSpec &file_spec);
+ static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+ static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+ ArchSpec &arch_64);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeProcess.h b/linux-x64/clang/include/lldb/Host/HostNativeProcess.h
new file mode 100644
index 0000000..c86a2ae
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostNativeProcess.h
@@ -0,0 +1,24 @@
+//===-- HostNativeProcess.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeProcess_h_
+#define lldb_Host_HostNativeProcess_h_
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/HostProcessWindows.h"
+namespace lldb_private {
+typedef HostProcessWindows HostNativeProcess;
+}
+#else
+#include "lldb/Host/posix/HostProcessPosix.h"
+namespace lldb_private {
+typedef HostProcessPosix HostNativeProcess;
+}
+#endif
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h b/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h
new file mode 100644
index 0000000..aaa517d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h
@@ -0,0 +1,47 @@
+//===-- HostNativeProcessBase.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeProcessBase_h_
+#define lldb_Host_HostNativeProcessBase_h_
+
+#include "lldb/Host/HostProcess.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+class HostThread;
+
+class HostNativeProcessBase {
+ DISALLOW_COPY_AND_ASSIGN(HostNativeProcessBase);
+
+public:
+ HostNativeProcessBase() : m_process(LLDB_INVALID_PROCESS) {}
+ explicit HostNativeProcessBase(lldb::process_t process)
+ : m_process(process) {}
+ virtual ~HostNativeProcessBase() {}
+
+ virtual Status Terminate() = 0;
+ virtual Status GetMainModule(FileSpec &file_spec) const = 0;
+
+ virtual lldb::pid_t GetProcessId() const = 0;
+ virtual bool IsRunning() const = 0;
+
+ lldb::process_t GetSystemHandle() const { return m_process; }
+
+ virtual llvm::Expected<HostThread>
+ StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+ bool monitor_signals) = 0;
+
+protected:
+ lldb::process_t m_process;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThread.h b/linux-x64/clang/include/lldb/Host/HostNativeThread.h
new file mode 100644
index 0000000..8bf6584
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThread.h
@@ -0,0 +1,22 @@
+//===-- HostNativeThread.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeThread_h_
+#define lldb_Host_HostNativeThread_h_
+
+#include "HostNativeThreadForward.h"
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/HostThreadWindows.h"
+#elif defined(__APPLE__)
+#include "lldb/Host/macosx/HostThreadMacOSX.h"
+#else
+#include "lldb/Host/posix/HostThreadPosix.h"
+#endif
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h b/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h
new file mode 100644
index 0000000..a196f0b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h
@@ -0,0 +1,52 @@
+//===-- HostNativeThreadBase.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeThreadBase_h_
+#define lldb_Host_HostNativeThreadBase_h_
+
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+#if defined(_WIN32)
+#define THREAD_ROUTINE __stdcall
+#else
+#define THREAD_ROUTINE
+#endif
+
+class HostNativeThreadBase {
+ friend class ThreadLauncher;
+ DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
+
+public:
+ HostNativeThreadBase();
+ explicit HostNativeThreadBase(lldb::thread_t thread);
+ virtual ~HostNativeThreadBase() {}
+
+ virtual Status Join(lldb::thread_result_t *result) = 0;
+ virtual Status Cancel() = 0;
+ virtual bool IsJoinable() const;
+ virtual void Reset();
+ virtual bool EqualsThread(lldb::thread_t thread) const;
+ lldb::thread_t Release();
+
+ lldb::thread_t GetSystemHandle() const;
+ lldb::thread_result_t GetResult() const;
+
+protected:
+ static lldb::thread_result_t THREAD_ROUTINE
+ ThreadCreateTrampoline(lldb::thread_arg_t arg);
+
+ lldb::thread_t m_thread;
+ lldb::thread_result_t m_result;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h b/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h
new file mode 100644
index 0000000..261d3c7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h
@@ -0,0 +1,25 @@
+//===-- HostNativeThreadForward.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostNativeThreadForward_h_
+#define lldb_Host_HostNativeThreadForward_h_
+
+namespace lldb_private {
+#if defined(_WIN32)
+class HostThreadWindows;
+typedef HostThreadWindows HostNativeThread;
+#elif defined(__APPLE__)
+class HostThreadMacOSX;
+typedef HostThreadMacOSX HostNativeThread;
+#else
+class HostThreadPosix;
+typedef HostThreadPosix HostNativeThread;
+#endif
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostProcess.h b/linux-x64/clang/include/lldb/Host/HostProcess.h
new file mode 100644
index 0000000..d48ff1f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostProcess.h
@@ -0,0 +1,58 @@
+//===-- HostProcess.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostProcess_h_
+#define lldb_Host_HostProcess_h_
+
+#include "lldb/Host/Host.h"
+#include "lldb/lldb-types.h"
+
+/// \class HostInfo HostInfo.h "lldb/Host/HostProcess.h"
+/// A class that represents a running process on the host machine.
+///
+/// HostProcess allows querying and manipulation of processes running on the
+/// host machine. It is not intended to be represent a process which is being
+/// debugged, although the native debug engine of a platform may likely back
+/// inferior processes by a HostProcess.
+///
+/// HostProcess is implemented using static polymorphism so that on any given
+/// platform, an instance of HostProcess will always be able to bind
+/// statically to the concrete Process implementation for that platform. See
+/// HostInfo for more details.
+///
+
+namespace lldb_private {
+
+class HostNativeProcessBase;
+class HostThread;
+
+class HostProcess {
+public:
+ HostProcess();
+ HostProcess(lldb::process_t process);
+ ~HostProcess();
+
+ Status Terminate();
+ Status GetMainModule(FileSpec &file_spec) const;
+
+ lldb::pid_t GetProcessId() const;
+ bool IsRunning() const;
+
+ llvm::Expected<HostThread>
+ StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+ bool monitor_signals);
+
+ HostNativeProcessBase &GetNativeProcess();
+ const HostNativeProcessBase &GetNativeProcess() const;
+
+private:
+ std::shared_ptr<HostNativeProcessBase> m_native_process;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/HostThread.h b/linux-x64/clang/include/lldb/Host/HostThread.h
new file mode 100644
index 0000000..7bf2a1d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/HostThread.h
@@ -0,0 +1,51 @@
+//===-- HostThread.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostThread_h_
+#define lldb_Host_HostThread_h_
+
+#include "lldb/Host/HostNativeThreadForward.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-types.h"
+
+#include <memory>
+
+namespace lldb_private {
+
+class HostNativeThreadBase;
+
+/// \class HostInfo HostInfo.h "lldb/Host/HostThread.h"
+/// A class that represents a thread running inside of a process on the
+/// local machine.
+///
+/// HostThread allows querying and manipulation of threads running on the host
+/// machine.
+///
+class HostThread {
+public:
+ HostThread();
+ HostThread(lldb::thread_t thread);
+
+ Status Join(lldb::thread_result_t *result);
+ Status Cancel();
+ void Reset();
+ lldb::thread_t Release();
+
+ bool IsJoinable() const;
+ HostNativeThread &GetNativeThread();
+ const HostNativeThread &GetNativeThread() const;
+ lldb::thread_result_t GetResult() const;
+
+ bool EqualsThread(lldb::thread_t thread) const;
+
+private:
+ std::shared_ptr<HostNativeThreadBase> m_native_thread;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/LockFile.h b/linux-x64/clang/include/lldb/Host/LockFile.h
new file mode 100644
index 0000000..2a1cd3d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/LockFile.h
@@ -0,0 +1,24 @@
+//===-- LockFile.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_LockFile_h_
+#define liblldb_Host_LockFile_h_
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/LockFileWindows.h"
+namespace lldb_private {
+typedef LockFileWindows LockFile;
+}
+#else
+#include "lldb/Host/posix/LockFilePosix.h"
+namespace lldb_private {
+typedef LockFilePosix LockFile;
+}
+#endif
+
+#endif // liblldb_Host_LockFile_h_
diff --git a/linux-x64/clang/include/lldb/Host/LockFileBase.h b/linux-x64/clang/include/lldb/Host/LockFileBase.h
new file mode 100644
index 0000000..be9e258
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/LockFileBase.h
@@ -0,0 +1,56 @@
+//===-- LockFileBase.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_LockFileBase_h_
+#define liblldb_Host_LockFileBase_h_
+
+#include "lldb/Utility/Status.h"
+
+#include <functional>
+
+namespace lldb_private {
+
+class LockFileBase {
+public:
+ virtual ~LockFileBase() = default;
+
+ bool IsLocked() const;
+
+ Status WriteLock(const uint64_t start, const uint64_t len);
+ Status TryWriteLock(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);
+
+ Status Unlock();
+
+protected:
+ using Locker = std::function<Status(const uint64_t, const uint64_t)>;
+
+ LockFileBase(int fd);
+
+ virtual bool IsValidFile() const;
+
+ 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 Status DoReadLock(const uint64_t start, const uint64_t len) = 0;
+ virtual Status DoTryReadLock(const uint64_t start, const uint64_t len) = 0;
+
+ virtual Status DoUnlock() = 0;
+
+ Status DoLock(const Locker &locker, const uint64_t start, const uint64_t len);
+
+ int m_fd; // not owned.
+ bool m_locked;
+ uint64_t m_start;
+ uint64_t m_len;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/MainLoop.h b/linux-x64/clang/include/lldb/Host/MainLoop.h
new file mode 100644
index 0000000..d59aa28
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/MainLoop.h
@@ -0,0 +1,111 @@
+//===-- MainLoop.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_MainLoop_h_
+#define lldb_Host_MainLoop_h_
+
+#include "lldb/Host/Config.h"
+#include "lldb/Host/MainLoopBase.h"
+#include "llvm/ADT/DenseMap.h"
+#include <csignal>
+
+#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__)
+#define SIGNAL_POLLING_UNSUPPORTED 1
+#endif
+
+namespace lldb_private {
+
+// 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/linux-x64/clang/include/lldb/Host/MainLoopBase.h b/linux-x64/clang/include/lldb/Host/MainLoopBase.h
new file mode 100644
index 0000000..3fee2b2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/MainLoopBase.h
@@ -0,0 +1,87 @@
+//===-- MainLoopBase.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_MainLoopBase_h_
+#define lldb_Host_posix_MainLoopBase_h_
+
+#include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Status.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <functional>
+
+namespace lldb_private {
+
+// The purpose of this class is to enable multiplexed processing of data from
+// different sources without resorting to multi-threading. Clients can register
+// IOObjects, which will be monitored for readability, and when they become
+// ready, the specified callback will be invoked. Monitoring for writability is
+// not supported, but can be easily added if needed.
+//
+// The RegisterReadObject function return a handle, which controls the duration
+// of the monitoring. When this handle is destroyed, the callback is
+// deregistered.
+//
+// This class simply defines the interface common for all platforms, actual
+// implementations are platform-specific.
+class MainLoopBase {
+private:
+ class ReadHandle;
+
+public:
+ MainLoopBase() {}
+ virtual ~MainLoopBase() {}
+
+ typedef std::unique_ptr<ReadHandle> ReadHandleUP;
+
+ typedef std::function<void(MainLoopBase &)> Callback;
+
+ virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp,
+ const Callback &callback,
+ 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 Status Run() { llvm_unreachable("Not implemented"); }
+
+ // Requests the exit of the Run() function.
+ virtual void RequestTermination() { llvm_unreachable("Not implemented"); }
+
+protected:
+ ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp) {
+ return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle()));
+ }
+
+ virtual void UnregisterReadObject(IOObject::WaitableHandle handle) {
+ llvm_unreachable("Not implemented");
+ }
+
+private:
+ class ReadHandle {
+ public:
+ ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
+
+ private:
+ ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
+ : m_mainloop(mainloop), m_handle(handle) {}
+
+ MainLoopBase &m_mainloop;
+ IOObject::WaitableHandle m_handle;
+
+ friend class MainLoopBase;
+ DISALLOW_COPY_AND_ASSIGN(ReadHandle);
+ };
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Host_posix_MainLoopBase_h_
diff --git a/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h b/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h
new file mode 100644
index 0000000..59111a0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h
@@ -0,0 +1,34 @@
+//===-- MonitoringProcessLauncher.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_MonitoringProcessLauncher_h_
+#define lldb_Host_MonitoringProcessLauncher_h_
+
+#include <memory>
+#include "lldb/Host/ProcessLauncher.h"
+
+namespace lldb_private {
+
+class MonitoringProcessLauncher : public ProcessLauncher {
+public:
+ explicit MonitoringProcessLauncher(
+ std::unique_ptr<ProcessLauncher> delegate_launcher);
+
+ /// Launch the process specified in launch_info. The monitoring callback in
+ /// launch_info must be set, and it will be called when the process
+ /// terminates.
+ HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+ Status &error) override;
+
+private:
+ std::unique_ptr<ProcessLauncher> m_delegate_launcher;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Host_MonitoringProcessLauncher_h_
diff --git a/linux-x64/clang/include/lldb/Host/OptionParser.h b/linux-x64/clang/include/lldb/Host/OptionParser.h
new file mode 100644
index 0000000..ca05946
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/OptionParser.h
@@ -0,0 +1,50 @@
+//===-- OptionParser.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionParser_h_
+#define liblldb_OptionParser_h_
+
+#include <mutex>
+#include <string>
+
+#include "llvm/ADT/StringRef.h"
+
+struct option;
+
+namespace lldb_private {
+
+struct OptionDefinition;
+
+struct Option {
+ // The definition of the option that this refers to.
+ const OptionDefinition *definition;
+ // if not NULL, set *flag to val when option found
+ int *flag;
+ // if flag not NULL, value to set *flag to; else return value
+ int val;
+};
+
+class OptionParser {
+public:
+ enum OptionArgument { eNoArgument = 0, eRequiredArgument, eOptionalArgument };
+
+ static void Prepare(std::unique_lock<std::mutex> &lock);
+
+ static void EnableError(bool error);
+
+ static int Parse(int argc, char *const argv[], llvm::StringRef optstring,
+ const Option *longopts, int *longindex);
+
+ static char *GetOptionArgument();
+ static int GetOptionIndex();
+ static int GetOptionErrorCause();
+ static std::string GetShortOptionString(struct option *long_options);
+};
+}
+
+#endif // liblldb_OptionParser_h_
diff --git a/linux-x64/clang/include/lldb/Host/Pipe.h b/linux-x64/clang/include/lldb/Host/Pipe.h
new file mode 100644
index 0000000..ea75342
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Pipe.h
@@ -0,0 +1,24 @@
+//===-- Pipe.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_Pipe_h_
+#define liblldb_Host_Pipe_h_
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/PipeWindows.h"
+namespace lldb_private {
+typedef PipeWindows Pipe;
+}
+#else
+#include "lldb/Host/posix/PipePosix.h"
+namespace lldb_private {
+typedef PipePosix Pipe;
+}
+#endif
+
+#endif // liblldb_Host_Pipe_h_
diff --git a/linux-x64/clang/include/lldb/Host/PipeBase.h b/linux-x64/clang/include/lldb/Host/PipeBase.h
new file mode 100644
index 0000000..1aa4db3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/PipeBase.h
@@ -0,0 +1,67 @@
+//===-- PipeBase.h -----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_PipeBase_h_
+#define liblldb_Host_PipeBase_h_
+
+#include <chrono>
+#include <string>
+
+#include "lldb/Utility/Status.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+class PipeBase {
+public:
+ virtual ~PipeBase();
+
+ 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 Status OpenAsReader(llvm::StringRef name,
+ bool child_process_inherit) = 0;
+
+ 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;
+
+ virtual bool CanRead() const = 0;
+ virtual bool CanWrite() const = 0;
+
+ virtual lldb::pipe_t GetReadPipe() const = 0;
+ virtual lldb::pipe_t GetWritePipe() const = 0;
+
+ virtual int GetReadFileDescriptor() const = 0;
+ virtual int GetWriteFileDescriptor() const = 0;
+ virtual int ReleaseReadFileDescriptor() = 0;
+ virtual int ReleaseWriteFileDescriptor() = 0;
+ virtual void CloseReadFileDescriptor() = 0;
+ virtual void CloseWriteFileDescriptor() = 0;
+
+ // Close both descriptors
+ virtual void Close() = 0;
+
+ // Delete named pipe.
+ virtual Status Delete(llvm::StringRef name) = 0;
+
+ 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);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/PosixApi.h b/linux-x64/clang/include/lldb/Host/PosixApi.h
new file mode 100644
index 0000000..04ca3a8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/PosixApi.h
@@ -0,0 +1,23 @@
+//===-- PosixApi.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_PosixApi_h
+#define liblldb_Host_PosixApi_h
+
+// This file defines platform specific functions, macros, and types necessary
+// to provide a minimum level of compatibility across all platforms to rely on
+// various posix api functionality.
+
+#if defined(_WIN32)
+#include "lldb/Host/windows/PosixApi.h"
+#else
+#include <unistd.h>
+#include <csignal>
+#endif
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h b/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h
new file mode 100644
index 0000000..d068aa6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h
@@ -0,0 +1,168 @@
+//===-- ProcessLaunchInfo.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ProcessLaunch_Info_h
+#define liblldb_ProcessLaunch_Info_h
+
+// C++ Headers
+#include <string>
+
+// LLDB Headers
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/Host/FileAction.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Host/PseudoTerminal.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/ProcessInfo.h"
+
+namespace lldb_private {
+
+// ProcessLaunchInfo
+//
+// Describes any information that is required to launch a process.
+
+class ProcessLaunchInfo : public ProcessInfo {
+public:
+ ProcessLaunchInfo();
+
+ ProcessLaunchInfo(const FileSpec &stdin_file_spec,
+ const FileSpec &stdout_file_spec,
+ const FileSpec &stderr_file_spec,
+ const FileSpec &working_dir, uint32_t launch_flags);
+
+ void AppendFileAction(const FileAction &info) {
+ m_file_actions.push_back(info);
+ }
+
+ bool AppendCloseFileAction(int fd);
+
+ bool AppendDuplicateFileAction(int fd, int dup_fd);
+
+ bool AppendOpenFileAction(int fd, const FileSpec &file_spec, bool read,
+ bool write);
+
+ bool AppendSuppressFileAction(int fd, bool read, bool write);
+
+ // Redirect stdin/stdout/stderr to a pty, if no action for the respective file
+ // descriptor is specified. (So if stdin and stdout already have file actions,
+ // but stderr doesn't, then only stderr will be redirected to a pty.)
+ llvm::Error SetUpPtyRedirection();
+
+ size_t GetNumFileActions() const { return m_file_actions.size(); }
+
+ const FileAction *GetFileActionAtIndex(size_t idx) const;
+
+ const FileAction *GetFileActionForFD(int fd) const;
+
+ Flags &GetFlags() { return m_flags; }
+
+ const Flags &GetFlags() const { return m_flags; }
+
+ const FileSpec &GetWorkingDirectory() const;
+
+ void SetWorkingDirectory(const FileSpec &working_dir);
+
+ const char *GetProcessPluginName() const;
+
+ void SetProcessPluginName(llvm::StringRef plugin);
+
+ const FileSpec &GetShell() const;
+
+ void SetShell(const FileSpec &shell);
+
+ uint32_t GetResumeCount() const { return m_resume_count; }
+
+ void SetResumeCount(uint32_t c) { m_resume_count = c; }
+
+ bool GetLaunchInSeparateProcessGroup() const {
+ return m_flags.Test(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
+ }
+
+ void SetLaunchInSeparateProcessGroup(bool separate);
+
+ bool GetShellExpandArguments() const {
+ return m_flags.Test(lldb::eLaunchFlagShellExpandArguments);
+ }
+
+ void SetShellExpandArguments(bool expand);
+
+ void Clear();
+
+ bool ConvertArgumentsForLaunchingInShell(Status &error, bool localhost,
+ bool will_debug,
+ bool first_arg_is_full_shell_command,
+ int32_t num_resumes);
+
+ void
+ SetMonitorProcessCallback(const Host::MonitorChildProcessCallback &callback,
+ bool monitor_signals);
+
+ Host::MonitorChildProcessCallback GetMonitorProcessCallback() const {
+ return m_monitor_callback;
+ }
+
+ /// A Monitor callback which does not take any action on process events. Use
+ /// this if you don't need to take any particular action when the process
+ /// terminates, but you still need to reap it.
+ static bool NoOpMonitorCallback(lldb::pid_t pid, bool exited, int signal,
+ int status);
+
+ bool GetMonitorSignals() const { return m_monitor_signals; }
+
+ // If the LaunchInfo has a monitor callback, then arrange to monitor the
+ // process. Return true if the LaunchInfo has taken care of monitoring the
+ // process, and false if the caller might want to monitor the process
+ // themselves.
+
+ bool MonitorProcess() const;
+
+ PseudoTerminal &GetPTY() { return *m_pty; }
+
+ // Get and set the actual listener that will be used for the process events
+ lldb::ListenerSP GetListener() const { return m_listener_sp; }
+
+ void SetListener(const lldb::ListenerSP &listener_sp) {
+ m_listener_sp = listener_sp;
+ }
+
+ lldb::ListenerSP GetHijackListener() const { return m_hijack_listener_sp; }
+
+ void SetHijackListener(const lldb::ListenerSP &listener_sp) {
+ m_hijack_listener_sp = listener_sp;
+ }
+
+ void SetLaunchEventData(const char *data) { m_event_data.assign(data); }
+
+ const char *GetLaunchEventData() const { return m_event_data.c_str(); }
+
+ void SetDetachOnError(bool enable);
+
+ bool GetDetachOnError() const {
+ return m_flags.Test(lldb::eLaunchFlagDetachOnError);
+ }
+
+protected:
+ FileSpec m_working_dir;
+ std::string m_plugin_name;
+ FileSpec m_shell;
+ Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
+ std::vector<FileAction> m_file_actions; // File actions for any other files
+ std::shared_ptr<PseudoTerminal> m_pty;
+ uint32_t m_resume_count; // How many times do we resume after launching
+ Host::MonitorChildProcessCallback m_monitor_callback;
+ void *m_monitor_callback_baton;
+ bool m_monitor_signals;
+ std::string m_event_data; // A string passed to the plugin launch, having no
+ // meaning to the upper levels of lldb.
+ lldb::ListenerSP m_listener_sp;
+ lldb::ListenerSP m_hijack_listener_sp;
+};
+}
+
+#endif // liblldb_ProcessLaunch_Info_h
diff --git a/linux-x64/clang/include/lldb/Host/ProcessLauncher.h b/linux-x64/clang/include/lldb/Host/ProcessLauncher.h
new file mode 100644
index 0000000..a5b6a6c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/ProcessLauncher.h
@@ -0,0 +1,26 @@
+//===-- ProcessLauncher.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_ProcessLauncher_h_
+#define lldb_Host_ProcessLauncher_h_
+
+namespace lldb_private {
+
+class ProcessLaunchInfo;
+class Status;
+class HostProcess;
+
+class ProcessLauncher {
+public:
+ virtual ~ProcessLauncher() {}
+ virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+ Status &error) = 0;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/ProcessRunLock.h b/linux-x64/clang/include/lldb/Host/ProcessRunLock.h
new file mode 100644
index 0000000..4927fbb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/ProcessRunLock.h
@@ -0,0 +1,83 @@
+//===-- ProcessRunLock.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ProcessRunLock_h_
+#define liblldb_ProcessRunLock_h_
+
+#include <stdint.h>
+#include <time.h>
+
+#include "lldb/lldb-defines.h"
+
+/// Enumerations for broadcasting.
+namespace lldb_private {
+
+/// \class ProcessRunLock ProcessRunLock.h "lldb/Host/ProcessRunLock.h"
+/// A class used to prevent the process from starting while other
+/// threads are accessing its data, and prevent access to its data while it is
+/// running.
+
+class ProcessRunLock {
+public:
+ ProcessRunLock();
+ ~ProcessRunLock();
+
+ bool ReadTryLock();
+ bool ReadUnlock();
+ bool SetRunning();
+ bool TrySetRunning();
+ bool SetStopped();
+
+ class ProcessRunLocker {
+ public:
+ ProcessRunLocker() : m_lock(nullptr) {}
+
+ ~ProcessRunLocker() { Unlock(); }
+
+ // Try to lock the read lock, but only do so if there are no writers.
+ bool TryLock(ProcessRunLock *lock) {
+ if (m_lock) {
+ if (m_lock == lock)
+ return true; // We already have this lock locked
+ else
+ Unlock();
+ }
+ if (lock) {
+ if (lock->ReadTryLock()) {
+ m_lock = lock;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected:
+ void Unlock() {
+ if (m_lock) {
+ m_lock->ReadUnlock();
+ m_lock = nullptr;
+ }
+ }
+
+ ProcessRunLock *m_lock;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
+ };
+
+protected:
+ lldb::rwlock_t m_rwlock;
+ bool m_running;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ProcessRunLock_h_
diff --git a/linux-x64/clang/include/lldb/Host/PseudoTerminal.h b/linux-x64/clang/include/lldb/Host/PseudoTerminal.h
new file mode 100644
index 0000000..8b27890
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/PseudoTerminal.h
@@ -0,0 +1,217 @@
+//===-- PseudoTerminal.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_HOST_PSEUDOTERMINAL_H
+#define LLDB_HOST_PSEUDOTERMINAL_H
+
+#include <fcntl.h>
+#include <string>
+
+#include "lldb/lldb-defines.h"
+
+namespace lldb_private {
+
+/// \class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h"
+/// A pseudo terminal helper class.
+///
+/// The pseudo terminal class abstracts the use of pseudo terminals on the
+/// host system.
+class PseudoTerminal {
+public:
+ enum {
+ invalid_fd = -1 ///< Invalid file descriptor value
+ };
+
+ /// Default constructor
+ ///
+ /// Constructs this object with invalid master and slave file descriptors.
+ PseudoTerminal();
+
+ /// Destructor
+ ///
+ /// The destructor will close the master and slave file descriptors if they
+ /// are valid and ownership has not been released using one of: @li
+ /// PseudoTerminal::ReleaseMasterFileDescriptor() @li
+ /// PseudoTerminal::ReleaseSaveFileDescriptor()
+ ~PseudoTerminal();
+
+ /// Close the master file descriptor if it is valid.
+ void CloseMasterFileDescriptor();
+
+ /// Close the slave file descriptor if it is valid.
+ void CloseSlaveFileDescriptor();
+
+ /// Fork a child process that uses pseudo terminals for its stdio.
+ ///
+ /// In the parent process, a call to this function results in a pid being
+ /// returned. If the pid is valid, the master file descriptor can be used
+ /// for read/write access to stdio of the child process.
+ ///
+ /// In the child process the stdin/stdout/stderr will already be routed to
+ /// the slave pseudo terminal and the master file descriptor will be closed
+ /// as it is no longer needed by the child process.
+ ///
+ /// This class will close the file descriptors for the master/slave when the
+ /// destructor is called. The file handles can be released using either: @li
+ /// PseudoTerminal::ReleaseMasterFileDescriptor() @li
+ /// PseudoTerminal::ReleaseSaveFileDescriptor()
+ ///
+ /// \param[out] error
+ /// An pointer to an error that can describe any errors that
+ /// occur. This can be NULL if no error status is desired.
+ ///
+ /// \return
+ /// \li \b Parent process: a child process ID that is greater
+ /// than zero, or -1 if the fork fails.
+ /// \li \b Child process: zero.
+ lldb::pid_t Fork(char *error_str, size_t error_len);
+
+ /// The master file descriptor accessor.
+ ///
+ /// This object retains ownership of the master file descriptor when this
+ /// accessor is used. Users can call the member function
+ /// PseudoTerminal::ReleaseMasterFileDescriptor() if this object should
+ /// release ownership of the slave file descriptor.
+ ///
+ /// \return
+ /// The master file descriptor, or PseudoTerminal::invalid_fd
+ /// if the master file descriptor is not currently valid.
+ ///
+ /// \see PseudoTerminal::ReleaseMasterFileDescriptor()
+ int GetMasterFileDescriptor() const;
+
+ /// The slave file descriptor accessor.
+ ///
+ /// This object retains ownership of the slave file descriptor when this
+ /// accessor is used. Users can call the member function
+ /// PseudoTerminal::ReleaseSlaveFileDescriptor() if this object should
+ /// release ownership of the slave file descriptor.
+ ///
+ /// \return
+ /// The slave file descriptor, or PseudoTerminal::invalid_fd
+ /// if the slave file descriptor is not currently valid.
+ ///
+ /// \see PseudoTerminal::ReleaseSlaveFileDescriptor()
+ int GetSlaveFileDescriptor() const;
+
+ /// Get the name of the slave pseudo terminal.
+ ///
+ /// A master pseudo terminal should already be valid prior to
+ /// calling this function.
+ ///
+ /// \param[out] error
+ /// An pointer to an error that can describe any errors that
+ /// occur. This can be NULL if no error status is desired.
+ ///
+ /// \return
+ /// The name of the slave pseudo terminal as a NULL terminated
+ /// C. This string that comes from static memory, so a copy of
+ /// the string should be made as subsequent calls can change
+ /// this value. NULL is returned if this object doesn't have
+ /// a valid master pseudo terminal opened or if the call to
+ /// \c ptsname() fails.
+ ///
+ /// \see PseudoTerminal::OpenFirstAvailableMaster()
+ const char *GetSlaveName(char *error_str, size_t error_len) const;
+
+ /// Open the first available pseudo terminal.
+ ///
+ /// Opens the first available pseudo terminal with \a oflag as the
+ /// permissions. The opened master file descriptor is stored in this object
+ /// and can be accessed by calling the
+ /// PseudoTerminal::GetMasterFileDescriptor() accessor. Clients can call the
+ /// PseudoTerminal::ReleaseMasterFileDescriptor() accessor function if they
+ /// wish to use the master file descriptor beyond the lifespan of this
+ /// object.
+ ///
+ /// If this object still has a valid master file descriptor when its
+ /// destructor is called, it will close it.
+ ///
+ /// \param[in] oflag
+ /// Flags to use when calling \c posix_openpt(\a oflag).
+ /// A value of "O_RDWR|O_NOCTTY" is suggested.
+ ///
+ /// \param[out] error
+ /// An pointer to an error that can describe any errors that
+ /// occur. This can be NULL if no error status is desired.
+ ///
+ /// \return
+ /// \li \b true when the master files descriptor is
+ /// successfully opened.
+ /// \li \b false if anything goes wrong.
+ ///
+ /// \see PseudoTerminal::GetMasterFileDescriptor() @see
+ /// PseudoTerminal::ReleaseMasterFileDescriptor()
+ bool OpenFirstAvailableMaster(int oflag, char *error_str, size_t error_len);
+
+ /// Open the slave for the current master pseudo terminal.
+ ///
+ /// A master pseudo terminal should already be valid prior to
+ /// calling this function. The opened slave file descriptor is stored in
+ /// this object and can be accessed by calling the
+ /// PseudoTerminal::GetSlaveFileDescriptor() accessor. Clients can call the
+ /// PseudoTerminal::ReleaseSlaveFileDescriptor() accessor function if they
+ /// wish to use the slave file descriptor beyond the lifespan of this
+ /// object.
+ ///
+ /// If this object still has a valid slave file descriptor when its
+ /// destructor is called, it will close it.
+ ///
+ /// \param[in] oflag
+ /// Flags to use when calling \c open(\a oflag).
+ ///
+ /// \param[out] error
+ /// An pointer to an error that can describe any errors that
+ /// occur. This can be NULL if no error status is desired.
+ ///
+ /// \return
+ /// \li \b true when the master files descriptor is
+ /// successfully opened.
+ /// \li \b false if anything goes wrong.
+ ///
+ /// \see PseudoTerminal::OpenFirstAvailableMaster() @see
+ /// PseudoTerminal::GetSlaveFileDescriptor() @see
+ /// PseudoTerminal::ReleaseSlaveFileDescriptor()
+ bool OpenSlave(int oflag, char *error_str, size_t error_len);
+
+ /// Release the master file descriptor.
+ ///
+ /// Releases ownership of the master pseudo terminal file descriptor without
+ /// closing it. The destructor for this class will close the master file
+ /// descriptor if the ownership isn't released using this call and the
+ /// master file descriptor has been opened.
+ ///
+ /// \return
+ /// The master file descriptor, or PseudoTerminal::invalid_fd
+ /// if the mast file descriptor is not currently valid.
+ int ReleaseMasterFileDescriptor();
+
+ /// Release the slave file descriptor.
+ ///
+ /// Release ownership of the slave pseudo terminal file descriptor without
+ /// closing it. The destructor for this class will close the slave file
+ /// descriptor if the ownership isn't released using this call and the slave
+ /// file descriptor has been opened.
+ ///
+ /// \return
+ /// The slave file descriptor, or PseudoTerminal::invalid_fd
+ /// if the slave file descriptor is not currently valid.
+ int ReleaseSlaveFileDescriptor();
+
+protected:
+ // Member variables
+ int m_master_fd; ///< The file descriptor for the master.
+ int m_slave_fd; ///< The file descriptor for the slave.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(PseudoTerminal);
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_PseudoTerminal_h_
diff --git a/linux-x64/clang/include/lldb/Host/SafeMachO.h b/linux-x64/clang/include/lldb/Host/SafeMachO.h
new file mode 100644
index 0000000..ec9887e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/SafeMachO.h
@@ -0,0 +1,115 @@
+//===-- SafeMachO.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef liblldb_SafeMachO_h_
+#define liblldb_SafeMachO_h_
+
+// This header file is required to work around collisions between the defines
+// in mach/machine.h, and enum members of the same name in llvm's MachO.h. If
+// you want to use llvm/Support/MachO.h, use this file instead. The caveats
+// are: 1) You can only use the MachO.h enums, you can't use the defines. That
+// won't make a difference since the values
+// are the same.
+// 2) If you need any header file that relies on mach/machine.h, you must
+// include that first. 3) This isn't a total solution, it doesn't undef every
+// define that MachO.h has borrowed from various system headers,
+// only the ones that come from mach/machine.h because that is the one we
+// ended up pulling in from various places.
+//
+
+#undef CPU_ARCH_MASK
+#undef CPU_ARCH_ABI64
+
+#undef CPU_TYPE_ANY
+#undef CPU_TYPE_X86
+#undef CPU_TYPE_I386
+#undef CPU_TYPE_X86_64
+#undef CPU_TYPE_MC98000
+#undef CPU_TYPE_ARM
+#undef CPU_TYPE_ARM64
+#undef CPU_TYPE_SPARC
+#undef CPU_TYPE_POWERPC
+#undef CPU_TYPE_POWERPC64
+
+#undef CPU_SUB_TYPE_MASK
+#undef CPU_SUB_TYPE_LIB64
+
+#undef CPU_SUBTYPE_MULTIPLE
+
+#undef CPU_SUBTYPE_I386_ALL
+#undef CPU_SUBTYPE_386
+#undef CPU_SUBTYPE_486
+#undef CPU_SUBTYPE_486SX
+#undef CPU_SUBTYPE_586
+#undef CPU_SUBTYPE_PENT
+#undef CPU_SUBTYPE_PENTPRO
+#undef CPU_SUBTYPE_PENTII_M3
+#undef CPU_SUBTYPE_PENTII_M5
+#undef CPU_SUBTYPE_CELERON
+#undef CPU_SUBTYPE_CELERON_MOBILE
+#undef CPU_SUBTYPE_PENTIUM_3
+#undef CPU_SUBTYPE_PENTIUM_3_M
+#undef CPU_SUBTYPE_PENTIUM_3_XEON
+#undef CPU_SUBTYPE_PENTIUM_M
+#undef CPU_SUBTYPE_PENTIUM_4
+#undef CPU_SUBTYPE_PENTIUM_4_M
+#undef CPU_SUBTYPE_ITANIUM
+#undef CPU_SUBTYPE_ITANIUM_2
+#undef CPU_SUBTYPE_XEON
+#undef CPU_SUBTYPE_XEON_MP
+
+#undef CPU_SUBTYPE_X86_ALL
+#undef CPU_SUBTYPE_X86_64_ALL
+#undef CPU_SUBTYPE_X86_ARCH1
+#undef CPU_SUBTYPE_X86_64_H
+
+#undef CPU_SUBTYPE_INTEL
+#undef CPU_SUBTYPE_INTEL_FAMILY
+#undef CPU_SUBTYPE_INTEL_FAMILY_MAX
+#undef CPU_SUBTYPE_INTEL_MODEL
+#undef CPU_SUBTYPE_INTEL_MODEL_ALL
+
+#undef CPU_SUBTYPE_ARM
+#undef CPU_SUBTYPE_ARM_ALL
+#undef CPU_SUBTYPE_ARM_V4T
+#undef CPU_SUBTYPE_ARM_V6
+#undef CPU_SUBTYPE_ARM_V5
+#undef CPU_SUBTYPE_ARM_V5TEJ
+#undef CPU_SUBTYPE_ARM_XSCALE
+#undef CPU_SUBTYPE_ARM_V7
+
+#undef CPU_SUBTYPE_ARM_V7S
+#undef CPU_SUBTYPE_ARM_V7K
+#undef CPU_SUBTYPE_ARM_V6M
+#undef CPU_SUBTYPE_ARM_V7M
+#undef CPU_SUBTYPE_ARM_V7EM
+
+#undef CPU_SUBTYPE_ARM64_ALL
+
+#undef CPU_SUBTYPE_SPARC_ALL
+
+#undef CPU_SUBTYPE_POWERPC
+#undef CPU_SUBTYPE_POWERPC_ALL
+#undef CPU_SUBTYPE_POWERPC_601
+#undef CPU_SUBTYPE_POWERPC_602
+#undef CPU_SUBTYPE_POWERPC_603
+#undef CPU_SUBTYPE_POWERPC_603e
+#undef CPU_SUBTYPE_POWERPC_603ev
+#undef CPU_SUBTYPE_POWERPC_604
+#undef CPU_SUBTYPE_POWERPC_604e
+#undef CPU_SUBTYPE_POWERPC_620
+#undef CPU_SUBTYPE_POWERPC_750
+#undef CPU_SUBTYPE_POWERPC_7400
+#undef CPU_SUBTYPE_POWERPC_7450
+#undef CPU_SUBTYPE_POWERPC_970
+
+#undef CPU_SUBTYPE_MC980000_ALL
+#undef CPU_SUBTYPE_MC98601
+
+#include "llvm/BinaryFormat/MachO.h"
+
+#endif // liblldb_SafeMachO_h_
diff --git a/linux-x64/clang/include/lldb/Host/Socket.h b/linux-x64/clang/include/lldb/Host/Socket.h
new file mode 100644
index 0000000..6f96bd7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Socket.h
@@ -0,0 +1,129 @@
+//===-- Socket.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_Socket_h_
+#define liblldb_Host_Socket_h_
+
+#include <memory>
+#include <string>
+
+#include "lldb/lldb-private.h"
+
+#include "lldb/Host/SocketAddress.h"
+#include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Predicate.h"
+#include "lldb/Utility/Status.h"
+
+#ifdef _WIN32
+#include "lldb/Host/windows/windows.h"
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
+namespace llvm {
+class StringRef;
+}
+
+namespace lldb_private {
+
+#if defined(_MSC_VER)
+typedef SOCKET NativeSocket;
+#else
+typedef int NativeSocket;
+#endif
+
+class Socket : public IOObject {
+public:
+ enum SocketProtocol {
+ ProtocolTcp,
+ ProtocolUdp,
+ ProtocolUnixDomain,
+ ProtocolUnixAbstract
+ };
+
+ static const NativeSocket kInvalidSocketValue;
+
+ ~Socket() override;
+
+ static llvm::Error Initialize();
+ static void Terminate();
+
+ static std::unique_ptr<Socket> Create(const SocketProtocol protocol,
+ bool child_processes_inherit,
+ Status &error);
+
+ 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 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 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);
+
+ int GetOption(int level, int option_name, int &option_value);
+ int SetOption(int level, int option_name, int option_value);
+
+ NativeSocket GetNativeSocket() const { return m_socket; }
+ SocketProtocol GetSocketProtocol() const { return m_protocol; }
+
+ Status Read(void *buf, size_t &num_bytes) override;
+ Status Write(const void *buf, size_t &num_bytes) 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, Status *error_ptr);
+
+ // If this Socket is connected then return the URI used to connect.
+ virtual std::string GetRemoteConnectionURI() const { return ""; };
+
+protected:
+ 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(Status &error);
+ static NativeSocket CreateSocket(const int domain, const int type,
+ const int protocol,
+ bool child_processes_inherit, Status &error);
+ static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr,
+ socklen_t *addrlen,
+ bool child_processes_inherit, Status &error);
+
+ SocketProtocol m_protocol;
+ NativeSocket m_socket;
+ bool m_child_processes_inherit;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Host_Socket_h_
diff --git a/linux-x64/clang/include/lldb/Host/SocketAddress.h b/linux-x64/clang/include/lldb/Host/SocketAddress.h
new file mode 100644
index 0000000..620827f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/SocketAddress.h
@@ -0,0 +1,190 @@
+//===-- SocketAddress.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SocketAddress_h_
+#define liblldb_SocketAddress_h_
+
+#include <stdint.h>
+
+#ifdef _WIN32
+#include "lldb/Host/windows/windows.h"
+#include <winsock2.h>
+#include <ws2tcpip.h>
+typedef ADDRESS_FAMILY sa_family_t;
+#else
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#endif
+
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#endif
+
+#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);
+ SocketAddress(const struct sockaddr_storage &s);
+ ~SocketAddress();
+
+ // Operators
+ const SocketAddress &operator=(const SocketAddress &rhs);
+
+ const SocketAddress &operator=(const struct addrinfo *addr_info);
+
+ const SocketAddress &operator=(const struct sockaddr &s);
+
+ const SocketAddress &operator=(const struct sockaddr_in &s);
+
+ const SocketAddress &operator=(const struct sockaddr_in6 &s);
+
+ 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
+ void Clear();
+
+ // Get the length for the current socket address family
+ socklen_t GetLength() const;
+
+ // Get the max length for the largest socket address supported.
+ static socklen_t GetMaxLength();
+
+ // Get the socket address family
+ sa_family_t GetFamily() const;
+
+ // Set the socket address family
+ void SetFamily(sa_family_t family);
+
+ // Get the address
+ std::string GetIPAddress() const;
+
+ // Get the port if the socket address for the family has a port
+ uint16_t GetPort() const;
+
+ // Set the port if the socket address for the family has a port. The family
+ // must be set correctly prior to calling this function.
+ bool SetPort(uint16_t port);
+
+ // Set the socket address according to the first match from a call to
+ // getaddrinfo() (or equivalent functions for systems that don't have
+ // getaddrinfo(). If "addr_info_ptr" is not NULL, it will get filled in with
+ // the match that was used to populate this socket address.
+ bool
+ getaddrinfo(const char *host, // Hostname ("foo.bar.com" or "foo" or IP
+ // address string ("123.234.12.1" or
+ // "2001:0db8:85a3:0000:0000:8a2e:0370:7334")
+ const char *service, // Protocol name ("tcp", "http", etc) or a
+ // raw port number string ("81")
+ int ai_family = PF_UNSPEC, int ai_socktype = 0,
+ int ai_protocol = 0, int ai_flags = 0);
+
+ // Quick way to set the SocketAddress to localhost given the family. Returns
+ // true if successful, false if "family" doesn't support localhost or if
+ // "family" is not supported by this class.
+ bool SetToLocalhost(sa_family_t family, uint16_t port);
+
+ bool SetToAnyAddress(sa_family_t family, uint16_t port);
+
+ // Returns true if there is a valid socket address in this object.
+ 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() {
+ return m_socket_addr.sa;
+ }
+
+ const struct sockaddr &sockaddr() const { return m_socket_addr.sa; }
+
+ struct sockaddr_in &sockaddr_in() {
+ return m_socket_addr.sa_ipv4;
+ }
+
+ const struct sockaddr_in &sockaddr_in() const {
+ return m_socket_addr.sa_ipv4;
+ }
+
+ struct sockaddr_in6 &sockaddr_in6() {
+ return m_socket_addr.sa_ipv6;
+ }
+
+ const struct sockaddr_in6 &sockaddr_in6() const {
+ return m_socket_addr.sa_ipv6;
+ }
+
+ struct sockaddr_storage &sockaddr_storage() {
+ return m_socket_addr.sa_storage;
+ }
+
+ const struct sockaddr_storage &sockaddr_storage() const {
+ return m_socket_addr.sa_storage;
+ }
+
+ // Conversion operators to allow getting the contents of this class as a
+ // pointer to the appropriate structure. This allows an instance of this
+ // class to be used in calls that take one of the sockaddr structure variants
+ // without having to manually use the correct accessor function.
+
+ operator struct sockaddr *() { return &m_socket_addr.sa; }
+
+ operator const struct sockaddr *() const { return &m_socket_addr.sa; }
+
+ operator struct sockaddr_in *() { return &m_socket_addr.sa_ipv4; }
+
+ operator const struct sockaddr_in *() const { return &m_socket_addr.sa_ipv4; }
+
+ operator struct sockaddr_in6 *() { return &m_socket_addr.sa_ipv6; }
+
+ operator const struct sockaddr_in6 *() const {
+ return &m_socket_addr.sa_ipv6;
+ }
+
+ operator const struct sockaddr_storage *() const {
+ return &m_socket_addr.sa_storage;
+ }
+
+ operator struct sockaddr_storage *() { return &m_socket_addr.sa_storage; }
+
+protected:
+ typedef union sockaddr_tag {
+ struct sockaddr sa;
+ struct sockaddr_in sa_ipv4;
+ struct sockaddr_in6 sa_ipv6;
+ struct sockaddr_storage sa_storage;
+ } sockaddr_t;
+
+ // Classes that inherit from SocketAddress can see and modify these
+ sockaddr_t m_socket_addr;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SocketAddress_h_
diff --git a/linux-x64/clang/include/lldb/Host/StringConvert.h b/linux-x64/clang/include/lldb/Host/StringConvert.h
new file mode 100644
index 0000000..4b2c690
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/StringConvert.h
@@ -0,0 +1,40 @@
+//===-- StringConvert.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StringConvert_h_
+#define liblldb_StringConvert_h_
+
+#include <stdint.h>
+
+
+
+namespace lldb_private {
+
+namespace StringConvert {
+
+/// \namespace StringConvert StringConvert.h "lldb/Host/StringConvert.h"
+/// Utility classes for converting strings into Integers
+
+int32_t ToSInt32(const char *s, int32_t fail_value = 0, int base = 0,
+ bool *success_ptr = nullptr);
+
+uint32_t ToUInt32(const char *s, uint32_t fail_value = 0, int base = 0,
+ bool *success_ptr = nullptr);
+
+int64_t ToSInt64(const char *s, int64_t fail_value = 0, int base = 0,
+ bool *success_ptr = nullptr);
+
+uint64_t ToUInt64(const char *s, uint64_t fail_value = 0, int base = 0,
+ bool *success_ptr = nullptr);
+
+double ToDouble(const char *s, double fail_value = 0.0,
+ bool *success_ptr = nullptr);
+} // namespace StringConvert
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/TaskPool.h b/linux-x64/clang/include/lldb/Host/TaskPool.h
new file mode 100644
index 0000000..49805ce
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/TaskPool.h
@@ -0,0 +1,92 @@
+//===--------------------- TaskPool.h ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_TaskPool_h_
+#define utility_TaskPool_h_
+
+#include "llvm/ADT/STLExtras.h"
+#include <functional>
+#include <future>
+#include <list>
+#include <memory>
+#include <mutex>
+#include <type_traits>
+
+namespace lldb_private {
+
+// Global TaskPool class for running tasks in parallel on a set of worker
+// thread created the first time the task pool is used. The TaskPool provide no
+// guarantee about the order the task will be run and about what tasks will run
+// in parallel. None of the task added to the task pool should block on
+// something (mutex, future, condition variable) what will be set only by the
+// completion of an other task on the task pool as they may run on the same
+// thread sequentally.
+class TaskPool {
+public:
+ // Add a new task to the task pool and return a std::future belonging to the
+ // newly created task. The caller of this function has to wait on the future
+ // for this task to complete.
+ template <typename F, typename... Args>
+ static std::future<typename std::result_of<F(Args...)>::type>
+ AddTask(F &&f, Args &&... args);
+
+ // Run all of the specified tasks on the task pool and wait until all of them
+ // are finished before returning. This method is intended to be used for
+ // small number tasks where listing them as function arguments is acceptable.
+ // For running large number of tasks you should use AddTask for each task and
+ // then call wait() on each returned future.
+ template <typename... T> static void RunTasks(T &&... tasks);
+
+private:
+ TaskPool() = delete;
+
+ template <typename... T> struct RunTaskImpl;
+
+ static void AddTaskImpl(std::function<void()> &&task_fn);
+};
+
+template <typename F, typename... Args>
+std::future<typename std::result_of<F(Args...)>::type>
+TaskPool::AddTask(F &&f, Args &&... args) {
+ auto task_sp = std::make_shared<
+ std::packaged_task<typename std::result_of<F(Args...)>::type()>>(
+ std::bind(std::forward<F>(f), std::forward<Args>(args)...));
+
+ AddTaskImpl([task_sp]() { (*task_sp)(); });
+
+ return task_sp->get_future();
+}
+
+template <typename... T> void TaskPool::RunTasks(T &&... tasks) {
+ RunTaskImpl<T...>::Run(std::forward<T>(tasks)...);
+}
+
+template <typename Head, typename... Tail>
+struct TaskPool::RunTaskImpl<Head, Tail...> {
+ static void Run(Head &&h, Tail &&... t) {
+ auto f = AddTask(std::forward<Head>(h));
+ RunTaskImpl<Tail...>::Run(std::forward<Tail>(t)...);
+ f.wait();
+ }
+};
+
+template <> struct TaskPool::RunTaskImpl<> {
+ static void Run() {}
+};
+
+// 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);
+
+unsigned GetHardwareConcurrencyHint();
+
+} // namespace lldb_private
+
+#endif // #ifndef utility_TaskPool_h_
diff --git a/linux-x64/clang/include/lldb/Host/Terminal.h b/linux-x64/clang/include/lldb/Host/Terminal.h
new file mode 100644
index 0000000..e5e96ee
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Terminal.h
@@ -0,0 +1,182 @@
+//===-- Terminal.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Terminal_h_
+#define liblldb_Terminal_h_
+#if defined(__cplusplus)
+
+#include "lldb/Host/Config.h"
+#include "lldb/lldb-private.h"
+
+struct termios;
+
+namespace lldb_private {
+
+class Terminal {
+public:
+ Terminal(int fd = -1) : m_fd(fd) {}
+
+ ~Terminal() {}
+
+ bool IsATerminal() const;
+
+ int GetFileDescriptor() const { return m_fd; }
+
+ void SetFileDescriptor(int fd) { m_fd = fd; }
+
+ bool FileDescriptorIsValid() const { return m_fd != -1; }
+
+ void Clear() { m_fd = -1; }
+
+ bool SetEcho(bool enabled);
+
+ bool SetCanonical(bool enabled);
+
+protected:
+ int m_fd; // This may or may not be a terminal file descriptor
+};
+
+/// \class State Terminal.h "lldb/Host/Terminal.h"
+/// A terminal state saving/restoring class.
+///
+/// This class can be used to remember the terminal state for a file
+/// descriptor and later restore that state as it originally was.
+class TerminalState {
+public:
+ /// Default constructor
+ TerminalState();
+
+ /// Destructor
+ ~TerminalState();
+
+ /// Save the TTY state for \a fd.
+ ///
+ /// Save the current state of the TTY for the file descriptor "fd" and if
+ /// "save_process_group" is true, attempt to save the process group info for
+ /// the TTY.
+ ///
+ /// \param[in] fd
+ /// The file descriptor to save the state of.
+ ///
+ /// \param[in] save_process_group
+ /// If \b true, save the process group settings, else do not
+ /// save the process group settings for a TTY.
+ ///
+ /// \return
+ /// Returns \b true if \a fd describes a TTY and if the state
+ /// was able to be saved, \b false otherwise.
+ bool Save(int fd, bool save_process_group);
+
+ /// Restore the TTY state to the cached state.
+ ///
+ /// Restore the state of the TTY using the cached values from a previous
+ /// call to TerminalState::Save(int,bool).
+ ///
+ /// \return
+ /// Returns \b true if the TTY state was successfully restored,
+ /// \b false otherwise.
+ bool Restore() const;
+
+ /// Test for valid cached TTY state information.
+ ///
+ /// \return
+ /// Returns \b true if this object has valid saved TTY state
+ /// settings that can be used to restore a previous state,
+ /// \b false otherwise.
+ bool IsValid() const;
+
+ void Clear();
+
+protected:
+ /// Test if tflags is valid.
+ ///
+ /// \return
+ /// Returns \b true if \a m_tflags is valid and can be restored,
+ /// \b false otherwise.
+ bool TFlagsIsValid() const;
+
+ /// Test if ttystate is valid.
+ ///
+ /// \return
+ /// Returns \b true if \a m_ttystate is valid and can be
+ /// restored, \b false otherwise.
+ bool TTYStateIsValid() const;
+
+ /// Test if the process group information is valid.
+ ///
+ /// \return
+ /// Returns \b true if \a m_process_group is valid and can be
+ /// restored, \b false otherwise.
+ bool ProcessGroupIsValid() const;
+
+ // Member variables
+ Terminal m_tty; ///< A terminal
+ int m_tflags; ///< Cached tflags information.
+#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
+ std::unique_ptr<struct termios>
+ m_termios_up; ///< Cached terminal state information.
+#endif
+ lldb::pid_t m_process_group; ///< Cached process group information.
+};
+
+/// \class TerminalStateSwitcher Terminal.h "lldb/Host/Terminal.h"
+/// A TTY state switching class.
+///
+/// This class can be used to remember 2 TTY states for a given file
+/// descriptor and switch between the two states.
+class TerminalStateSwitcher {
+public:
+ /// Constructor
+ TerminalStateSwitcher();
+
+ /// Destructor
+ ~TerminalStateSwitcher();
+
+ /// Get the number of possible states to save.
+ ///
+ /// \return
+ /// The number of states that this TTY switcher object contains.
+ uint32_t GetNumberOfStates() const;
+
+ /// Restore the TTY state for state at index \a idx.
+ ///
+ /// \return
+ /// Returns \b true if the TTY state was successfully restored,
+ /// \b false otherwise.
+ bool Restore(uint32_t idx) const;
+
+ /// Save the TTY state information for the state at index \a idx. The TTY
+ /// state is saved for the file descriptor \a fd and the process group
+ /// information will also be saved if requested by \a save_process_group.
+ ///
+ /// \param[in] idx
+ /// The index into the state array where the state should be
+ /// saved.
+ ///
+ /// \param[in] fd
+ /// The file descriptor for which to save the settings.
+ ///
+ /// \param[in] save_process_group
+ /// If \b true, save the process group information for the TTY.
+ ///
+ /// \return
+ /// Returns \b true if the save was successful, \b false
+ /// otherwise.
+ bool Save(uint32_t idx, int fd, bool save_process_group);
+
+protected:
+ // Member variables
+ mutable uint32_t m_currentState; ///< The currently active TTY state index.
+ TerminalState
+ m_ttystates[2]; ///< The array of TTY states that holds saved TTY info.
+};
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+#endif // #ifndef liblldb_Terminal_h_
diff --git a/linux-x64/clang/include/lldb/Host/ThreadLauncher.h b/linux-x64/clang/include/lldb/Host/ThreadLauncher.h
new file mode 100644
index 0000000..e45ffa9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/ThreadLauncher.h
@@ -0,0 +1,42 @@
+//===-- ThreadLauncher.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_ThreadLauncher_h_
+#define lldb_Host_ThreadLauncher_h_
+
+#include "lldb/Host/HostThread.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+
+namespace lldb_private {
+
+class ThreadLauncher {
+public:
+ static llvm::Expected<HostThread>
+ LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_function,
+ lldb::thread_arg_t thread_arg,
+ size_t min_stack_byte_size = 0); // Minimum stack size in bytes,
+ // set stack size to zero for
+ // default platform thread stack
+ // size
+
+ struct HostThreadCreateInfo {
+ std::string thread_name;
+ lldb::thread_func_t thread_fptr;
+ lldb::thread_arg_t thread_arg;
+
+ HostThreadCreateInfo(const char *name, lldb::thread_func_t fptr,
+ lldb::thread_arg_t arg)
+ : thread_name(name ? name : ""), thread_fptr(fptr), thread_arg(arg) {}
+ };
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/Time.h b/linux-x64/clang/include/lldb/Host/Time.h
new file mode 100644
index 0000000..b27eb08
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/Time.h
@@ -0,0 +1,25 @@
+//===-- Time.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Include system time headers, adding missing functions as necessary
+
+#ifndef liblldb_Host_Time_h_
+#define liblldb_Host_Time_h_
+
+#ifdef __ANDROID__
+#include <android/api-level.h>
+#endif
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#include <time64.h>
+extern time_t timegm(struct tm *t);
+#else
+#include <time.h>
+#endif
+
+#endif // liblldb_Host_Time_h_
diff --git a/linux-x64/clang/include/lldb/Host/XML.h b/linux-x64/clang/include/lldb/Host/XML.h
new file mode 100644
index 0000000..625cf43
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/XML.h
@@ -0,0 +1,180 @@
+//===-- XML.h ---------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_XML_h_
+#define liblldb_XML_h_
+
+#if defined(LIBXML2_DEFINED)
+#include <libxml/xmlreader.h>
+#endif
+
+#include <functional>
+#include <string>
+#include <vector>
+
+#include "llvm/ADT/StringRef.h"
+
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+#if defined(LIBXML2_DEFINED)
+typedef xmlNodePtr XMLNodeImpl;
+typedef xmlDocPtr XMLDocumentImpl;
+#else
+typedef void *XMLNodeImpl;
+typedef void *XMLDocumentImpl;
+#endif
+
+class XMLNode;
+
+typedef std::vector<std::string> NamePath;
+typedef std::function<bool(const XMLNode &node)> NodeCallback;
+typedef std::function<bool(const llvm::StringRef &name,
+ const llvm::StringRef &value)>
+ AttributeCallback;
+
+class XMLNode {
+public:
+ XMLNode();
+
+ XMLNode(XMLNodeImpl node);
+
+ ~XMLNode();
+
+ explicit operator bool() const { return IsValid(); }
+
+ void Clear();
+
+ bool IsValid() const;
+
+ bool IsElement() const;
+
+ llvm::StringRef GetName() const;
+
+ bool GetElementText(std::string &text) const;
+
+ bool GetElementTextAsUnsigned(uint64_t &value, uint64_t fail_value = 0,
+ int base = 0) const;
+
+ bool GetElementTextAsFloat(double &value, double fail_value = 0.0) const;
+
+ bool NameIs(const char *name) const;
+
+ XMLNode GetParent() const;
+
+ XMLNode GetSibling() const;
+
+ XMLNode GetChild() const;
+
+ llvm::StringRef GetAttributeValue(const char *name,
+ const char *fail_value = nullptr) const;
+
+ bool GetAttributeValueAsUnsigned(const char *name, uint64_t &value,
+ uint64_t fail_value = 0, int base = 0) const;
+
+ XMLNode FindFirstChildElementWithName(const char *name) const;
+
+ XMLNode GetElementForPath(const NamePath &path);
+
+ // Iterate through all sibling nodes of any type
+ void ForEachSiblingNode(NodeCallback const &callback) const;
+
+ // Iterate through only the sibling nodes that are elements
+ void ForEachSiblingElement(NodeCallback const &callback) const;
+
+ // Iterate through only the sibling nodes that are elements and whose name
+ // matches \a name.
+ void ForEachSiblingElementWithName(const char *name,
+ NodeCallback const &callback) const;
+
+ void ForEachChildNode(NodeCallback const &callback) const;
+
+ void ForEachChildElement(NodeCallback const &callback) const;
+
+ void ForEachChildElementWithName(const char *name,
+ NodeCallback const &callback) const;
+
+ void ForEachAttribute(AttributeCallback const &callback) const;
+
+protected:
+ XMLNodeImpl m_node;
+};
+
+class XMLDocument {
+public:
+ XMLDocument();
+
+ ~XMLDocument();
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool IsValid() const;
+
+ void Clear();
+
+ bool ParseFile(const char *path);
+
+ bool ParseMemory(const char *xml, size_t xml_length,
+ const char *url = "untitled.xml");
+
+ // If \a name is nullptr, just get the root element node, else only return a
+ // value XMLNode if the name of the root element matches \a name.
+ XMLNode GetRootElement(const char *required_name = nullptr);
+
+ llvm::StringRef GetErrors() const;
+
+ static void ErrorCallback(void *ctx, const char *format, ...);
+
+ static bool XMLEnabled();
+
+protected:
+ XMLDocumentImpl m_document;
+ StreamString m_errors;
+};
+
+class ApplePropertyList {
+public:
+ ApplePropertyList();
+
+ ApplePropertyList(const char *path);
+
+ ~ApplePropertyList();
+
+ bool ParseFile(const char *path);
+
+ llvm::StringRef GetErrors() const;
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool IsValid() const;
+
+ XMLNode GetValueNode(const char *key) const;
+
+ bool GetValueAsString(const char *key, std::string &value) const;
+
+ StructuredData::ObjectSP GetStructuredData();
+
+protected:
+ // Using a node returned from GetValueNode() extract its value as a string
+ // (if possible). Array and dictionary nodes will return false as they have
+ // no string value. Boolean nodes will return true and \a value will be
+ // "true" or "false" as the string value comes from the element name itself.
+ // All other nodes will return the text content of the XMLNode.
+ static bool ExtractStringFromValueNode(const XMLNode &node,
+ std::string &value);
+
+ XMLDocument m_xml_doc;
+ XMLNode m_dict_node;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_XML_h_
diff --git a/linux-x64/clang/include/lldb/Host/android/HostInfoAndroid.h b/linux-x64/clang/include/lldb/Host/android/HostInfoAndroid.h
new file mode 100644
index 0000000..c764121
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/android/HostInfoAndroid.h
@@ -0,0 +1,32 @@
+//===-- HostInfoAndroid.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_android_HostInfoAndroid_h_
+#define lldb_Host_android_HostInfoAndroid_h_
+
+#include "lldb/Host/linux/HostInfoLinux.h"
+
+namespace lldb_private {
+
+class HostInfoAndroid : public HostInfoLinux {
+ friend class HostInfoBase;
+
+public:
+ static FileSpec GetDefaultShell();
+ static FileSpec ResolveLibraryPath(const std::string &path,
+ const ArchSpec &arch);
+
+protected:
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+ ArchSpec &arch_64);
+ static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
+};
+
+} // end of namespace lldb_private
+
+#endif // #ifndef lldb_Host_android_HostInfoAndroid_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/GetOptInc.h b/linux-x64/clang/include/lldb/Host/common/GetOptInc.h
new file mode 100644
index 0000000..c69f722
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/GetOptInc.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "lldb/lldb-defines.h"
+
+#if defined(_MSC_VER)
+#define REPLACE_GETOPT
+#define REPLACE_GETOPT_LONG
+#endif
+#if defined(_MSC_VER) || defined(__NetBSD__)
+#define REPLACE_GETOPT_LONG_ONLY
+#endif
+
+#if defined(REPLACE_GETOPT)
+// from getopt.h
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+// option structure
+struct option {
+ const char *name;
+ // has_arg can't be an enum because some compilers complain about type
+ // mismatches in all the code that assumes it is an int.
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+int getopt(int argc, char *const argv[], const char *optstring);
+
+// from getopt.h
+extern char *optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
+
+// defined in unistd.h
+extern int optreset;
+#else
+#include <getopt.h>
+#include <unistd.h>
+#endif
+
+#if defined(REPLACE_GETOPT_LONG)
+int getopt_long(int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longindex);
+#endif
+
+#if defined(REPLACE_GETOPT_LONG_ONLY)
+int getopt_long_only(int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longindex);
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h b/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h
new file mode 100644
index 0000000..c2725b2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h
@@ -0,0 +1,26 @@
+//===-- NativeBreakpointList.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_NativeBreakpointList_h_
+#define liblldb_NativeBreakpointList_h_
+
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-types.h"
+#include <map>
+
+namespace lldb_private {
+
+struct HardwareBreakpoint {
+ lldb::addr_t m_addr;
+ size_t m_size;
+};
+
+using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>;
+}
+
+#endif // ifndef liblldb_NativeBreakpointList_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h b/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h
new file mode 100644
index 0000000..f05b8d0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h
@@ -0,0 +1,437 @@
+//===-- NativeProcessProtocol.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_NativeProcessProtocol_h_
+#define liblldb_NativeProcessProtocol_h_
+
+#include "NativeBreakpointList.h"
+#include "NativeThreadProtocol.h"
+#include "NativeWatchpointList.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Host/MainLoop.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/TraceOptions.h"
+#include "lldb/lldb-private-forward.h"
+#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 <mutex>
+#include <unordered_map>
+#include <vector>
+
+namespace lldb_private {
+class MemoryRegionInfo;
+class ResumeActionList;
+
+// NativeProcessProtocol
+class NativeProcessProtocol {
+public:
+ virtual ~NativeProcessProtocol() {}
+
+ virtual Status Resume(const ResumeActionList &resume_actions) = 0;
+
+ virtual Status Halt() = 0;
+
+ virtual Status Detach() = 0;
+
+ /// Sends a process a UNIX signal \a signal.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status Signal(int signo) = 0;
+
+ /// Tells a process to interrupt all operations as if by a Ctrl-C.
+ ///
+ /// The default implementation will send a local host's equivalent of
+ /// a SIGSTOP to the process via the NativeProcessProtocol::Signal()
+ /// operation.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status Interrupt();
+
+ 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 Status GetMemoryRegionInfo(lldb::addr_t load_addr,
+ MemoryRegionInfo &range_info);
+
+ virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size,
+ size_t &bytes_read) = 0;
+
+ Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
+ size_t &bytes_read);
+
+ virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
+ size_t &bytes_written) = 0;
+
+ virtual Status AllocateMemory(size_t size, uint32_t permissions,
+ lldb::addr_t &addr) = 0;
+
+ virtual Status DeallocateMemory(lldb::addr_t addr) = 0;
+
+ virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
+
+ virtual bool IsAlive() const;
+
+ virtual size_t UpdateThreads() = 0;
+
+ virtual const ArchSpec &GetArchitecture() const = 0;
+
+ // Breakpoint functions
+ virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
+ bool hardware) = 0;
+
+ virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false);
+
+ // Hardware Breakpoint functions
+ virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const;
+
+ virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
+
+ virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr);
+
+ // Watchpoint functions
+ virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const;
+
+ virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
+ GetHardwareDebugSupportInfo() const;
+
+ virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
+ uint32_t watch_flags, bool hardware);
+
+ virtual Status RemoveWatchpoint(lldb::addr_t addr);
+
+ // Accessors
+ lldb::pid_t GetID() const { return m_pid; }
+
+ lldb::StateType GetState() const;
+
+ bool IsRunning() const {
+ return m_state == lldb::eStateRunning || IsStepping();
+ }
+
+ bool IsStepping() const { return m_state == lldb::eStateStepping; }
+
+ bool CanResume() const { return m_state == lldb::eStateStopped; }
+
+ lldb::ByteOrder GetByteOrder() const {
+ return GetArchitecture().GetByteOrder();
+ }
+
+ uint32_t GetAddressByteSize() const {
+ return GetArchitecture().GetAddressByteSize();
+ }
+
+ virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+ GetAuxvData() const = 0;
+
+ // Exit Status
+ virtual llvm::Optional<WaitStatus> GetExitStatus();
+
+ virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
+
+ // Access to threads
+ NativeThreadProtocol *GetThreadAtIndex(uint32_t idx);
+
+ NativeThreadProtocol *GetThreadByID(lldb::tid_t tid);
+
+ void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; }
+
+ lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; }
+
+ NativeThreadProtocol *GetCurrentThread() {
+ return GetThreadByID(m_current_thread_id);
+ }
+
+ // Access to inferior stdio
+ virtual int GetTerminalFileDescriptor() { return m_terminal_fd; }
+
+ // Stop id interface
+
+ uint32_t GetStopID() const;
+
+ // Callbacks for low-level process state changes
+ class NativeDelegate {
+ public:
+ virtual ~NativeDelegate() {}
+
+ virtual void InitializeDelegate(NativeProcessProtocol *process) = 0;
+
+ virtual void ProcessStateChanged(NativeProcessProtocol *process,
+ lldb::StateType state) = 0;
+
+ virtual void DidExec(NativeProcessProtocol *process) = 0;
+ };
+
+ /// Register a native delegate.
+ ///
+ /// Clients can register nofication callbacks by passing in a
+ /// NativeDelegate impl and passing it into this function.
+ ///
+ /// Note: it is required that the lifetime of the
+ /// native_delegate outlive the NativeProcessProtocol.
+ ///
+ /// \param[in] native_delegate
+ /// A NativeDelegate impl to be called when certain events
+ /// happen within the NativeProcessProtocol or related threads.
+ ///
+ /// \return
+ /// true if the delegate was registered successfully;
+ /// false if the delegate was already registered.
+ ///
+ /// \see NativeProcessProtocol::NativeDelegate.
+ bool RegisterNativeDelegate(NativeDelegate &native_delegate);
+
+ /// Unregister a native delegate previously registered.
+ ///
+ /// \param[in] native_delegate
+ /// A NativeDelegate impl previously registered with this process.
+ ///
+ /// \return Returns \b true if the NativeDelegate was
+ /// successfully removed from the process, \b false otherwise.
+ ///
+ /// \see NativeProcessProtocol::NativeDelegate
+ bool UnregisterNativeDelegate(NativeDelegate &native_delegate);
+
+ 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;
+
+ 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;
+ };
+
+ /// StartTracing API for starting a tracing instance with the
+ /// TraceOptions on a specific thread or process.
+ ///
+ /// \param[in] config
+ /// The configuration to use when starting tracing.
+ ///
+ /// \param[out] error
+ /// Status indicates what went wrong.
+ ///
+ /// \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[in] thread
+ /// Thread is needed when the complete process is being traced
+ /// and the user wishes to stop tracing on a particular thread.
+ ///
+ /// \return
+ /// Status indicating what went wrong.
+ virtual Status StopTrace(lldb::user_id_t traceid,
+ lldb::tid_t thread = LLDB_INVALID_THREAD_ID) {
+ return Status("Not implemented");
+ }
+
+ /// This API provides the trace data collected in the form of raw
+ /// data.
+ ///
+ /// \param[in] traceid thread
+ /// The traceid and thread provide the context for the trace
+ /// 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[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
+ /// The size of the data actually read.
+ 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:
+ struct SoftwareBreakpoint {
+ uint32_t ref_count;
+ llvm::SmallVector<uint8_t, 4> saved_opcodes;
+ llvm::ArrayRef<uint8_t> breakpoint_opcodes;
+ };
+
+ std::unordered_map<lldb::addr_t, SoftwareBreakpoint> m_software_breakpoints;
+ lldb::pid_t m_pid;
+
+ std::vector<std::unique_ptr<NativeThreadProtocol>> m_threads;
+ lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID;
+ mutable std::recursive_mutex m_threads_mutex;
+
+ lldb::StateType m_state = lldb::eStateInvalid;
+ mutable std::recursive_mutex m_state_mutex;
+
+ llvm::Optional<WaitStatus> m_exit_status;
+
+ std::recursive_mutex m_delegates_mutex;
+ std::vector<NativeDelegate *> m_delegates;
+ NativeWatchpointList m_watchpoint_list;
+ HardwareBreakpointMap m_hw_breakpoints_map;
+ int m_terminal_fd;
+ 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, int terminal_fd,
+ NativeDelegate &delegate);
+
+ // interface for state handling
+ void SetState(lldb::StateType state, bool notify_delegates = true);
+
+ // Derived classes need not implement this. It can be used as a hook to
+ // clear internal caches that should be invalidated when stop ids change.
+ //
+ // Note this function is called with the state mutex obtained by the caller.
+ virtual void DoStopIDBumped(uint32_t newBumpId);
+
+ // interface for software breakpoints
+
+ Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint);
+ Status RemoveSoftwareBreakpoint(lldb::addr_t addr);
+
+ virtual llvm::Expected<llvm::ArrayRef<uint8_t>>
+ GetSoftwareBreakpointTrapOpcode(size_t size_hint);
+
+ /// Return the offset of the PC relative to the software breakpoint that was hit. If an
+ /// architecture (e.g. arm) reports breakpoint hits before incrementing the PC, this offset
+ /// will be 0. If an architecture (e.g. intel) reports breakpoints hits after incrementing the
+ /// PC, this offset will be the size of the breakpoint opcode.
+ virtual size_t GetSoftwareBreakpointPCOffset();
+
+ // Adjust the thread's PC after hitting a software breakpoint. On
+ // architectures where the PC points after the breakpoint instruction, this
+ // resets it to point to the breakpoint itself.
+ void FixupBreakpointPCAsNeeded(NativeThreadProtocol &thread);
+
+ /// Notify the delegate that an exec occurred.
+ ///
+ /// Provide a mechanism for a delegate to clear out any exec-
+ /// sensitive data.
+ void NotifyDidExec();
+
+ NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid);
+
+private:
+ void SynchronouslyNotifyProcessStateChanged(lldb::StateType state);
+ llvm::Expected<SoftwareBreakpoint>
+ EnableSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint);
+};
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeProcessProtocol_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h b/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h
new file mode 100644
index 0000000..6bba8f2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h
@@ -0,0 +1,178 @@
+//===-- NativeRegisterContext.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_NativeRegisterContext_h_
+#define liblldb_NativeRegisterContext_h_
+
+#include "lldb/Host/common/NativeWatchpointList.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class NativeThreadProtocol;
+
+class NativeRegisterContext
+ : public std::enable_shared_from_this<NativeRegisterContext> {
+public:
+ // Constructors and Destructors
+ NativeRegisterContext(NativeThreadProtocol &thread);
+
+ virtual ~NativeRegisterContext();
+
+ // void
+ // InvalidateIfNeeded (bool force);
+
+ // Subclasses must override these functions
+ // virtual void
+ // InvalidateAllRegisters () = 0;
+
+ virtual uint32_t GetRegisterCount() const = 0;
+
+ virtual uint32_t GetUserRegisterCount() const = 0;
+
+ virtual const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg) const = 0;
+
+ const char *GetRegisterSetNameForRegisterAtIndex(uint32_t reg_index) const;
+
+ virtual uint32_t GetRegisterSetCount() const = 0;
+
+ virtual const RegisterSet *GetRegisterSet(uint32_t set_index) const = 0;
+
+ virtual Status ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) = 0;
+
+ virtual Status WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) = 0;
+
+ virtual Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0;
+
+ virtual Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0;
+
+ uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind,
+ uint32_t num) const;
+
+ // Subclasses can override these functions if desired
+ virtual uint32_t NumSupportedHardwareBreakpoints();
+
+ virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
+
+ 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,
+ uint32_t watch_flags);
+
+ virtual bool ClearHardwareWatchpoint(uint32_t hw_index);
+
+ virtual Status ClearAllHardwareWatchpoints();
+
+ virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit);
+
+ virtual Status GetWatchpointHitIndex(uint32_t &wp_index,
+ lldb::addr_t trap_addr);
+
+ virtual Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant);
+
+ virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index);
+
+ // MIPS Linux kernel returns a masked address (last 3bits are masked)
+ // when a HW watchpoint is hit. However user may not have set a watchpoint on
+ // this address. This function emulates the instruction at PC and finds the
+ // base address used in the load/store instruction. This gives the exact
+ // address used to read/write the variable being watched. For example: 'n' is
+ // at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at 'm',
+ // then watch exception is generated even when 'n' is read/written. This
+ // function returns address of 'n' so that client can check whether a
+ // watchpoint is set on this address or not.
+ virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index);
+
+ virtual bool HardwareSingleStep(bool enable);
+
+ virtual Status
+ ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t src_addr, size_t src_len,
+ RegisterValue ®_value);
+
+ virtual Status
+ WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t dst_addr, size_t dst_len,
+ const RegisterValue ®_value);
+
+ // Subclasses should not override these
+ virtual lldb::tid_t GetThreadID() const;
+
+ virtual NativeThreadProtocol &GetThread() { return m_thread; }
+
+ const RegisterInfo *GetRegisterInfoByName(llvm::StringRef reg_name,
+ uint32_t start_idx = 0);
+
+ const RegisterInfo *GetRegisterInfo(uint32_t reg_kind, uint32_t reg_num);
+
+ lldb::addr_t GetPC(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ virtual lldb::addr_t
+ GetPCfromBreakpointLocation(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Status SetPC(lldb::addr_t pc);
+
+ lldb::addr_t GetSP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Status SetSP(lldb::addr_t sp);
+
+ lldb::addr_t GetFP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ Status SetFP(lldb::addr_t fp);
+
+ const char *GetRegisterName(uint32_t reg);
+
+ lldb::addr_t GetReturnAddress(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+
+ lldb::addr_t GetFlags(lldb::addr_t fail_value = 0);
+
+ lldb::addr_t ReadRegisterAsUnsigned(uint32_t reg, lldb::addr_t fail_value);
+
+ lldb::addr_t ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
+ lldb::addr_t fail_value);
+
+ Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval);
+
+ Status WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval);
+
+ // uint32_t
+ // GetStopID () const
+ // {
+ // return m_stop_id;
+ // }
+
+ // void
+ // SetStopID (uint32_t stop_id)
+ // {
+ // m_stop_id = stop_id;
+ // }
+
+protected:
+ // Classes that inherit from RegisterContext can see and modify these
+ NativeThreadProtocol
+ &m_thread; // The thread that this register context belongs to.
+ // uint32_t m_stop_id; // The stop ID that any data in this
+ // context is valid for
+
+private:
+ // For RegisterContext only
+ DISALLOW_COPY_AND_ASSIGN(NativeRegisterContext);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_NativeRegisterContext_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h b/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h
new file mode 100644
index 0000000..36ae679
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h
@@ -0,0 +1,56 @@
+//===-- NativeThreadProtocol.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_NativeThreadProtocol_h_
+#define liblldb_NativeThreadProtocol_h_
+
+#include <memory>
+
+#include "lldb/Host/Debug.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+// NativeThreadProtocol
+class NativeThreadProtocol {
+public:
+ NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
+
+ virtual ~NativeThreadProtocol() {}
+
+ virtual std::string GetName() = 0;
+
+ virtual lldb::StateType GetState() = 0;
+
+ virtual NativeRegisterContext &GetRegisterContext() = 0;
+
+ virtual bool GetStopReason(ThreadStopInfo &stop_info,
+ std::string &description) = 0;
+
+ lldb::tid_t GetID() const { return m_tid; }
+
+ NativeProcessProtocol &GetProcess() { return m_process; }
+
+ // Thread-specific watchpoints
+ virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
+ uint32_t watch_flags, bool hardware) = 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:
+ NativeProcessProtocol &m_process;
+ lldb::tid_t m_tid;
+};
+}
+
+#endif // #ifndef liblldb_NativeThreadProtocol_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h b/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h
new file mode 100644
index 0000000..c83ba1e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h
@@ -0,0 +1,41 @@
+//===-- NativeWatchpointList.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_NativeWatchpointList_h_
+#define liblldb_NativeWatchpointList_h_
+
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-private-forward.h"
+
+#include <map>
+
+namespace lldb_private {
+struct NativeWatchpoint {
+ lldb::addr_t m_addr;
+ size_t m_size;
+ uint32_t m_watch_flags;
+ bool m_hardware;
+};
+
+class NativeWatchpointList {
+public:
+ Status Add(lldb::addr_t addr, size_t size, uint32_t watch_flags,
+ bool hardware);
+
+ Status Remove(lldb::addr_t addr);
+
+ using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>;
+
+ const WatchpointMap &GetWatchpointMap() const;
+
+private:
+ WatchpointMap m_watchpoints;
+};
+}
+
+#endif // ifndef liblldb_NativeWatchpointList_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/TCPSocket.h b/linux-x64/clang/include/lldb/Host/common/TCPSocket.h
new file mode 100644
index 0000000..faf3bb6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/TCPSocket.h
@@ -0,0 +1,60 @@
+//===-- TCPSocket.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TCPSocket_h_
+#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(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;
+
+ // returns ip address string or empty string if error
+ std::string GetLocalIPAddress() const;
+
+ // must be connected
+ // returns port number or 0 if error
+ uint16_t GetRemotePortNumber() const;
+
+ // must be connected
+ // returns ip address string or empty string if error
+ std::string GetRemoteIPAddress() const;
+
+ int SetOptionNoDelay();
+ int SetOptionReuseAddress();
+
+ 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;
+
+ std::string GetRemoteConnectionURI() const override;
+
+private:
+ TCPSocket(NativeSocket socket, const TCPSocket &listen_socket);
+
+ void CloseListenSockets();
+
+ std::map<int, SocketAddress> m_listen_sockets;
+};
+}
+
+#endif // ifndef liblldb_TCPSocket_h_
diff --git a/linux-x64/clang/include/lldb/Host/common/UDPSocket.h b/linux-x64/clang/include/lldb/Host/common/UDPSocket.h
new file mode 100644
index 0000000..b7b6db6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/common/UDPSocket.h
@@ -0,0 +1,36 @@
+//===-- UDPSocket.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UDPSocket_h_
+#define liblldb_UDPSocket_h_
+
+#include "lldb/Host/Socket.h"
+
+namespace lldb_private {
+class UDPSocket : public Socket {
+public:
+ UDPSocket(bool should_close, bool child_processes_inherit);
+
+ static Status Connect(llvm::StringRef name, bool child_processes_inherit,
+ Socket *&socket);
+
+ std::string GetRemoteConnectionURI() const override;
+
+private:
+ UDPSocket(NativeSocket socket);
+
+ size_t Send(const void *buf, const size_t num_bytes) override;
+ Status Connect(llvm::StringRef name) override;
+ Status Listen(llvm::StringRef name, int backlog) override;
+ Status Accept(Socket *&socket) override;
+
+ SocketAddress m_sockaddr;
+};
+}
+
+#endif // ifndef liblldb_UDPSocket_h_
diff --git a/linux-x64/clang/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/linux-x64/clang/include/lldb/Host/freebsd/HostInfoFreeBSD.h
new file mode 100644
index 0000000..56f20bb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/freebsd/HostInfoFreeBSD.h
@@ -0,0 +1,27 @@
+//===-- HostInfoFreeBSD.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_
+#define lldb_Host_freebsd_HostInfoFreeBSD_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class HostInfoFreeBSD : public HostInfoPosix {
+public:
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/linux/AbstractSocket.h b/linux-x64/clang/include/lldb/Host/linux/AbstractSocket.h
new file mode 100644
index 0000000..78a567a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/linux/AbstractSocket.h
@@ -0,0 +1,25 @@
+//===-- AbstractSocket.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AbstractSocket_h_
+#define liblldb_AbstractSocket_h_
+
+#include "lldb/Host/posix/DomainSocket.h"
+
+namespace lldb_private {
+class AbstractSocket : public DomainSocket {
+public:
+ AbstractSocket(bool child_processes_inherit);
+
+protected:
+ size_t GetNameOffset() const override;
+ void DeleteSocketFile(llvm::StringRef name) override;
+};
+}
+
+#endif // ifndef liblldb_AbstractSocket_h_
diff --git a/linux-x64/clang/include/lldb/Host/linux/HostInfoLinux.h b/linux-x64/clang/include/lldb/Host/linux/HostInfoLinux.h
new file mode 100644
index 0000000..b1c7f9c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/linux/HostInfoLinux.h
@@ -0,0 +1,47 @@
+//===-- HostInfoLinux.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_linux_HostInfoLinux_h_
+#define lldb_Host_linux_HostInfoLinux_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
+
+#include <string>
+
+namespace lldb_private {
+
+class HostInfoLinux : public HostInfoPosix {
+ friend class HostInfoBase;
+
+private:
+ // Static class, unconstructable.
+ HostInfoLinux();
+ ~HostInfoLinux();
+
+public:
+ static void Initialize();
+
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static llvm::StringRef GetDistributionId();
+ static FileSpec GetProgramFileSpec();
+
+protected:
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+ static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+ ArchSpec &arch_64);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/linux/Ptrace.h b/linux-x64/clang/include/lldb/Host/linux/Ptrace.h
new file mode 100644
index 0000000..c54b75f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/linux/Ptrace.h
@@ -0,0 +1,56 @@
+//===-- Ptrace.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines ptrace functions & structures
+
+#ifndef liblldb_Host_linux_Ptrace_h_
+#define liblldb_Host_linux_Ptrace_h_
+
+#include <sys/ptrace.h>
+
+#ifndef __GLIBC__
+typedef int __ptrace_request;
+#endif
+
+#define DEBUG_PTRACE_MAXBYTES 20
+
+// Support ptrace extensions even when compiled without required kernel support
+#ifndef PTRACE_GETREGS
+#define PTRACE_GETREGS 12
+#endif
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS 13
+#endif
+#ifndef PTRACE_GETFPREGS
+#define PTRACE_GETFPREGS 14
+#endif
+#ifndef PTRACE_SETFPREGS
+#define PTRACE_SETFPREGS 15
+#endif
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL 30
+#endif
+#ifndef ARCH_GET_FS
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
+#endif
+
+#define LLDB_PTRACE_NT_ARM_TLS 0x401 // ARM TLS register
+
+#endif // liblldb_Host_linux_Ptrace_h_
diff --git a/linux-x64/clang/include/lldb/Host/linux/Support.h b/linux-x64/clang/include/lldb/Host/linux/Support.h
new file mode 100644
index 0000000..d1eb7f8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/linux/Support.h
@@ -0,0 +1,29 @@
+//===-- Support.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_HOST_LINUX_SUPPORT_H
+#define LLDB_HOST_LINUX_SUPPORT_H
+
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <memory>
+
+namespace lldb_private {
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(const llvm::Twine &file);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_LINUX_SUPPORT_H
diff --git a/linux-x64/clang/include/lldb/Host/linux/Uio.h b/linux-x64/clang/include/lldb/Host/linux/Uio.h
new file mode 100644
index 0000000..460bd6c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/linux/Uio.h
@@ -0,0 +1,23 @@
+//===-- Uio.h ---------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_linux_Uio_h_
+#define liblldb_Host_linux_Uio_h_
+
+#include "lldb/Host/Config.h"
+#include <sys/uio.h>
+
+// We shall provide our own implementation of process_vm_readv if it is not
+// present
+#if !HAVE_PROCESS_VM_READV
+ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
+ unsigned long liovcnt, const struct iovec *remote_iov,
+ unsigned long riovcnt, unsigned long flags);
+#endif
+
+#endif // liblldb_Host_linux_Uio_h_
diff --git a/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h b/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h
new file mode 100644
index 0000000..d49e27a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -0,0 +1,44 @@
+//===-- HostInfoMacOSX.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_macosx_HostInfoMacOSX_h_
+#define lldb_Host_macosx_HostInfoMacOSX_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class ArchSpec;
+
+class HostInfoMacOSX : public HostInfoPosix {
+ friend class HostInfoBase;
+
+private:
+ // Static class, unconstructable.
+ HostInfoMacOSX() = delete;
+ ~HostInfoMacOSX() = delete;
+
+public:
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+
+protected:
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+ ArchSpec &arch_64);
+ static bool ComputeHeaderDirectory(FileSpec &file_spec);
+ static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+ static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h b/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h
new file mode 100644
index 0000000..4247de6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h
@@ -0,0 +1,28 @@
+//===-- HostThreadMacOSX.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_macosx_HostThreadMacOSX_h_
+#define lldb_Host_macosx_HostThreadMacOSX_h_
+
+#include "lldb/Host/posix/HostThreadPosix.h"
+
+namespace lldb_private {
+
+class HostThreadMacOSX : public HostThreadPosix {
+ friend class ThreadLauncher;
+
+public:
+ HostThreadMacOSX();
+ HostThreadMacOSX(lldb::thread_t thread);
+
+protected:
+ static lldb::thread_result_t ThreadCreateTrampoline(lldb::thread_arg_t arg);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/netbsd/HostInfoNetBSD.h b/linux-x64/clang/include/lldb/Host/netbsd/HostInfoNetBSD.h
new file mode 100644
index 0000000..f9ad66e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/netbsd/HostInfoNetBSD.h
@@ -0,0 +1,27 @@
+//===-- HostInfoNetBSD.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_netbsd_HostInfoNetBSD_h_
+#define lldb_Host_netbsd_HostInfoNetBSD_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class HostInfoNetBSD : public HostInfoPosix {
+public:
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/linux-x64/clang/include/lldb/Host/openbsd/HostInfoOpenBSD.h
new file mode 100644
index 0000000..7ec1d5f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/openbsd/HostInfoOpenBSD.h
@@ -0,0 +1,27 @@
+//===-- HostInfoOpenBSD.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_openbsd_HostInfoOpenBSD_h_
+#define lldb_Host_openbsd_HostInfoOpenBSD_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class HostInfoOpenBSD : public HostInfoPosix {
+public:
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static FileSpec GetProgramFileSpec();
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
new file mode 100644
index 0000000..b25fc47
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -0,0 +1,124 @@
+//===-- ConnectionFileDescriptorPosix.h -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
+#define liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/Host/Pipe.h"
+#include "lldb/Utility/Connection.h"
+#include "lldb/Utility/IOObject.h"
+#include "lldb/Utility/Predicate.h"
+
+namespace lldb_private {
+
+class Status;
+class Socket;
+class SocketAddress;
+
+class ConnectionFileDescriptor : public Connection {
+public:
+ static const char *LISTEN_SCHEME;
+ static const char *ACCEPT_SCHEME;
+ static const char *UNIX_ACCEPT_SCHEME;
+ static const char *CONNECT_SCHEME;
+ static const char *TCP_CONNECT_SCHEME;
+ static const char *UDP_SCHEME;
+ static const char *UNIX_CONNECT_SCHEME;
+ static const char *UNIX_ABSTRACT_CONNECT_SCHEME;
+ static const char *FD_SCHEME;
+ static const char *FILE_SCHEME;
+
+ ConnectionFileDescriptor(bool child_processes_inherit = false);
+
+ ConnectionFileDescriptor(int fd, bool owns_fd);
+
+ ConnectionFileDescriptor(Socket *socket);
+
+ ~ConnectionFileDescriptor() override;
+
+ bool IsConnected() const override;
+
+ lldb::ConnectionStatus Connect(llvm::StringRef s, Status *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, Status *error_ptr) override;
+
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
+ Status *error_ptr) override;
+
+ std::string GetURI() override;
+
+ lldb::ConnectionStatus BytesAvailable(const Timeout<std::micro> &timeout,
+ Status *error_ptr);
+
+ bool InterruptRead() override;
+
+ lldb::IOObjectSP GetReadObject() override { return m_read_sp; }
+
+ uint16_t GetListeningPort(const Timeout<std::micro> &timeout);
+
+ bool GetChildProcessesInherit() const;
+ void SetChildProcessesInherit(bool child_processes_inherit);
+
+protected:
+ void OpenCommandPipe();
+
+ void CloseCommandPipe();
+
+ lldb::ConnectionStatus SocketListenAndAccept(llvm::StringRef host_and_port,
+ Status *error_ptr);
+
+ lldb::ConnectionStatus ConnectTCP(llvm::StringRef host_and_port,
+ Status *error_ptr);
+
+ lldb::ConnectionStatus ConnectUDP(llvm::StringRef args, Status *error_ptr);
+
+ lldb::ConnectionStatus NamedSocketConnect(llvm::StringRef socket_name,
+ Status *error_ptr);
+
+ lldb::ConnectionStatus NamedSocketAccept(llvm::StringRef socket_name,
+ Status *error_ptr);
+
+ lldb::ConnectionStatus UnixAbstractSocketConnect(llvm::StringRef socket_name,
+ Status *error_ptr);
+
+ lldb::IOObjectSP m_read_sp;
+ lldb::IOObjectSP m_write_sp;
+
+ Predicate<uint16_t>
+ m_port_predicate; // Used when binding to port zero to wait for the thread
+ // that creates the socket, binds and listens to
+ // resolve the port number.
+
+ Pipe m_pipe;
+ std::recursive_mutex m_mutex;
+ std::atomic<bool> m_shutting_down; // This marks that we are shutting down so
+ // if we get woken up from
+ // BytesAvailable to disconnect, we won't try to read again.
+ bool m_waiting_for_accept;
+ bool m_child_processes_inherit;
+
+ std::string m_uri;
+
+private:
+ void InitializeSocket(Socket *socket);
+
+ DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ConnectionFileDescriptor_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h b/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h
new file mode 100644
index 0000000..e407ce1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h
@@ -0,0 +1,37 @@
+//===-- DomainSocket.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DomainSocket_h_
+#define liblldb_DomainSocket_h_
+
+#include "lldb/Host/Socket.h"
+
+namespace lldb_private {
+class DomainSocket : public Socket {
+public:
+ DomainSocket(bool should_close, bool child_processes_inherit);
+
+ Status Connect(llvm::StringRef name) override;
+ Status Listen(llvm::StringRef name, int backlog) override;
+ Status Accept(Socket *&socket) override;
+
+ std::string GetRemoteConnectionURI() const override;
+
+protected:
+ DomainSocket(SocketProtocol protocol, bool child_processes_inherit);
+
+ virtual size_t GetNameOffset() const;
+ virtual void DeleteSocketFile(llvm::StringRef name);
+ std::string GetSocketName() const;
+
+private:
+ DomainSocket(NativeSocket socket, const DomainSocket &listen_socket);
+};
+}
+
+#endif // ifndef liblldb_DomainSocket_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/Fcntl.h b/linux-x64/clang/include/lldb/Host/posix/Fcntl.h
new file mode 100644
index 0000000..31cc293
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/Fcntl.h
@@ -0,0 +1,24 @@
+//===-- Fcntl.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines fcntl functions & structures
+
+#ifndef liblldb_Host_posix_Fcntl_h_
+#define liblldb_Host_posix_Fcntl_h_
+
+#ifdef __ANDROID__
+#include <android/api-level.h>
+#endif
+
+#include <fcntl.h>
+
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
+#endif
+
+#endif // liblldb_Host_posix_Fcntl_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h
new file mode 100644
index 0000000..2691013
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h
@@ -0,0 +1,43 @@
+//===-- HostInfoPosix.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_HostInfoPosix_h_
+#define lldb_Host_posix_HostInfoPosix_h_
+
+#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Utility/FileSpec.h"
+
+namespace lldb_private {
+
+class UserIDResolver;
+
+class HostInfoPosix : public HostInfoBase {
+ friend class HostInfoBase;
+
+public:
+ static size_t GetPageSize();
+ static bool GetHostname(std::string &s);
+
+ static uint32_t GetUserID();
+ static uint32_t GetGroupID();
+ static uint32_t GetEffectiveUserID();
+ static uint32_t GetEffectiveGroupID();
+
+ static FileSpec GetDefaultShell();
+
+ static bool GetEnvironmentVar(const std::string &var_name, std::string &var);
+
+ static UserIDResolver &GetUserIDResolver();
+
+protected:
+ static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+ static bool ComputeHeaderDirectory(FileSpec &file_spec);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h
new file mode 100644
index 0000000..a313358
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h
@@ -0,0 +1,42 @@
+//===-- HostProcessPosix.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostProcesPosix_h_
+#define lldb_Host_HostProcesPosix_h_
+
+#include "lldb/Host/HostNativeProcessBase.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+class FileSpec;
+
+class HostProcessPosix : public HostNativeProcessBase {
+public:
+ HostProcessPosix();
+ HostProcessPosix(lldb::process_t process);
+ ~HostProcessPosix() override;
+
+ virtual Status Signal(int signo) const;
+ static Status Signal(lldb::process_t process, int signo);
+
+ Status Terminate() override;
+ Status GetMainModule(FileSpec &file_spec) const override;
+
+ lldb::pid_t GetProcessId() const override;
+ bool IsRunning() const override;
+
+ llvm::Expected<HostThread>
+ StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+ bool monitor_signals) override;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Host_HostProcesPosix_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h
new file mode 100644
index 0000000..54012e1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h
@@ -0,0 +1,32 @@
+//===-- HostThreadPosix.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_HostThreadPosix_h_
+#define lldb_Host_posix_HostThreadPosix_h_
+
+#include "lldb/Host/HostNativeThreadBase.h"
+
+namespace lldb_private {
+
+class HostThreadPosix : public HostNativeThreadBase {
+ DISALLOW_COPY_AND_ASSIGN(HostThreadPosix);
+
+public:
+ HostThreadPosix();
+ HostThreadPosix(lldb::thread_t thread);
+ ~HostThreadPosix() override;
+
+ Status Join(lldb::thread_result_t *result) override;
+ Status Cancel() override;
+
+ Status Detach();
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Host_posix_HostThreadPosix_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/LockFilePosix.h b/linux-x64/clang/include/lldb/Host/posix/LockFilePosix.h
new file mode 100644
index 0000000..63333bf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/LockFilePosix.h
@@ -0,0 +1,35 @@
+//===-- LockFilePosix.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_LockFilePosix_h_
+#define liblldb_Host_posix_LockFilePosix_h_
+
+#include "lldb/Host/LockFileBase.h"
+
+namespace lldb_private {
+
+class LockFilePosix : public LockFileBase {
+public:
+ explicit LockFilePosix(int fd);
+ ~LockFilePosix() override;
+
+protected:
+ Status DoWriteLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoTryWriteLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoReadLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoTryReadLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoUnlock() override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Host_posix_LockFilePosix_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/PipePosix.h b/linux-x64/clang/include/lldb/Host/posix/PipePosix.h
new file mode 100644
index 0000000..df341f2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/PipePosix.h
@@ -0,0 +1,80 @@
+//===-- PipePosix.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_PipePosix_h_
+#define liblldb_Host_posix_PipePosix_h_
+#if defined(__cplusplus)
+
+#include "lldb/Host/PipeBase.h"
+
+namespace lldb_private {
+
+/// \class PipePosix PipePosix.h "lldb/Host/posix/PipePosix.h"
+/// A posix-based implementation of Pipe, a class that abtracts
+/// unix style pipes.
+///
+/// A class that abstracts the LLDB core from host pipe functionality.
+class PipePosix : public PipeBase {
+public:
+ static int kInvalidDescriptor;
+
+ PipePosix();
+ PipePosix(lldb::pipe_t read, lldb::pipe_t write);
+ PipePosix(const PipePosix &) = delete;
+ PipePosix(PipePosix &&pipe_posix);
+ PipePosix &operator=(const PipePosix &) = delete;
+ PipePosix &operator=(PipePosix &&pipe_posix);
+
+ ~PipePosix() override;
+
+ 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;
+
+ bool CanRead() const override;
+ bool CanWrite() const override;
+
+ lldb::pipe_t GetReadPipe() const override {
+ return lldb::pipe_t(GetReadFileDescriptor());
+ }
+ lldb::pipe_t GetWritePipe() const override {
+ return lldb::pipe_t(GetWriteFileDescriptor());
+ }
+
+ int GetReadFileDescriptor() const override;
+ int GetWriteFileDescriptor() const override;
+ int ReleaseReadFileDescriptor() override;
+ int ReleaseWriteFileDescriptor() override;
+ void CloseReadFileDescriptor() override;
+ void CloseWriteFileDescriptor() override;
+
+ // Close both descriptors
+ void Close() override;
+
+ Status Delete(llvm::StringRef name) 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];
+};
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Host_posix_PipePosix_h_
diff --git a/linux-x64/clang/include/lldb/Host/posix/ProcessLauncherPosixFork.h b/linux-x64/clang/include/lldb/Host/posix/ProcessLauncherPosixFork.h
new file mode 100644
index 0000000..15e2d6d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/posix/ProcessLauncherPosixFork.h
@@ -0,0 +1,24 @@
+//===-- ProcessLauncherPosixFork.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_ProcessLauncherPosixFork_h_
+#define lldb_Host_posix_ProcessLauncherPosixFork_h_
+
+#include "lldb/Host/ProcessLauncher.h"
+
+namespace lldb_private {
+
+class ProcessLauncherPosixFork : public ProcessLauncher {
+public:
+ HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+ Status &error) override;
+};
+
+} // end of namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/AutoHandle.h b/linux-x64/clang/include/lldb/Host/windows/AutoHandle.h
new file mode 100644
index 0000000..5c0de89
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/AutoHandle.h
@@ -0,0 +1,36 @@
+//===-- AutoHandle.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_Host_windows_AutoHandle_h_
+#define LLDB_lldb_Host_windows_AutoHandle_h_
+
+#include "lldb/Host/windows/windows.h"
+
+namespace lldb_private {
+
+class AutoHandle {
+public:
+ AutoHandle(HANDLE handle, HANDLE invalid_value = INVALID_HANDLE_VALUE)
+ : m_handle(handle), m_invalid_value(invalid_value) {}
+
+ ~AutoHandle() {
+ if (m_handle != m_invalid_value)
+ ::CloseHandle(m_handle);
+ }
+
+ bool IsValid() const { return m_handle != m_invalid_value; }
+
+ HANDLE get() const { return m_handle; }
+
+private:
+ HANDLE m_handle;
+ HANDLE m_invalid_value;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h b/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h
new file mode 100644
index 0000000..8856708
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h
@@ -0,0 +1,63 @@
+//===-- ConnectionGenericFileWindows.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_windows_ConnectionGenericFileWindows_h_
+#define liblldb_Host_windows_ConnectionGenericFileWindows_h_
+
+#include "lldb/Host/windows/windows.h"
+#include "lldb/Utility/Connection.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+class Status;
+
+class ConnectionGenericFile : public lldb_private::Connection {
+public:
+ ConnectionGenericFile();
+
+ ConnectionGenericFile(lldb::file_t file, bool owns_file);
+
+ ~ConnectionGenericFile() override;
+
+ bool IsConnected() const override;
+
+ lldb::ConnectionStatus Connect(llvm::StringRef s, Status *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, Status *error_ptr) override;
+
+ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
+ Status *error_ptr) override;
+
+ std::string GetURI() override;
+
+ bool InterruptRead() override;
+
+protected:
+ OVERLAPPED m_overlapped;
+ HANDLE m_file;
+ HANDLE m_event_handles[2];
+ bool m_owns_file;
+ LARGE_INTEGER m_file_position;
+
+ enum { kBytesAvailableEvent, kInterruptEvent };
+
+private:
+ void InitializeEventHandles();
+ void IncrementFilePointer(DWORD amount);
+
+ std::string m_uri;
+
+ DISALLOW_COPY_AND_ASSIGN(ConnectionGenericFile);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/HostInfoWindows.h b/linux-x64/clang/include/lldb/Host/windows/HostInfoWindows.h
new file mode 100644
index 0000000..209d9da
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/HostInfoWindows.h
@@ -0,0 +1,48 @@
+//===-- HostInfoWindows.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_windows_HostInfoWindows_h_
+#define lldb_Host_windows_HostInfoWindows_h_
+
+#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+class UserIDResolver;
+
+class HostInfoWindows : public HostInfoBase {
+ friend class HostInfoBase;
+
+private:
+ // Static class, unconstructable.
+ HostInfoWindows();
+ ~HostInfoWindows();
+
+public:
+ static void Initialize();
+ static void Terminate();
+
+ static size_t GetPageSize();
+ static UserIDResolver &GetUserIDResolver();
+
+ static llvm::VersionTuple GetOSVersion();
+ static bool GetOSBuildString(std::string &s);
+ static bool GetOSKernelDescription(std::string &s);
+ static bool GetHostname(std::string &s);
+ static FileSpec GetProgramFileSpec();
+ static FileSpec GetDefaultShell();
+
+ static bool GetEnvironmentVar(const std::string &var_name, std::string &var);
+
+private:
+ static FileSpec m_program_filespec;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/HostProcessWindows.h b/linux-x64/clang/include/lldb/Host/windows/HostProcessWindows.h
new file mode 100644
index 0000000..925d565
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/HostProcessWindows.h
@@ -0,0 +1,46 @@
+//===-- HostProcessWindows.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_HostProcessWindows_h_
+#define lldb_Host_HostProcessWindows_h_
+
+#include "lldb/Host/HostNativeProcessBase.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+class FileSpec;
+
+class HostProcessWindows : public HostNativeProcessBase {
+public:
+ HostProcessWindows();
+ explicit HostProcessWindows(lldb::process_t process);
+ ~HostProcessWindows();
+
+ void SetOwnsHandle(bool owns);
+
+ Status Terminate() override;
+ Status GetMainModule(FileSpec &file_spec) const override;
+
+ lldb::pid_t GetProcessId() const override;
+ bool IsRunning() const override;
+
+ virtual llvm::Expected<HostThread>
+ StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+ bool monitor_signals) override;
+
+private:
+ static lldb::thread_result_t MonitorThread(void *thread_arg);
+
+ void Close();
+
+ bool m_owns_handle;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h b/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h
new file mode 100644
index 0000000..be3f7fe
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h
@@ -0,0 +1,40 @@
+//===-- HostThreadWindows.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_windows_HostThreadWindows_h_
+#define lldb_Host_windows_HostThreadWindows_h_
+
+#include "lldb/Host/HostNativeThreadBase.h"
+
+#include "llvm/ADT/SmallString.h"
+
+namespace lldb_private {
+
+class HostThreadWindows : public HostNativeThreadBase {
+ DISALLOW_COPY_AND_ASSIGN(HostThreadWindows);
+
+public:
+ HostThreadWindows();
+ HostThreadWindows(lldb::thread_t thread);
+ virtual ~HostThreadWindows();
+
+ void SetOwnsHandle(bool owns);
+
+ virtual Status Join(lldb::thread_result_t *result);
+ virtual Status Cancel();
+ virtual void Reset();
+ virtual bool EqualsThread(lldb::thread_t thread) const;
+
+ lldb::tid_t GetThreadId() const;
+
+private:
+ bool m_owns_handle;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/LockFileWindows.h b/linux-x64/clang/include/lldb/Host/windows/LockFileWindows.h
new file mode 100644
index 0000000..0312d14
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/LockFileWindows.h
@@ -0,0 +1,41 @@
+//===-- LockFileWindows.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_LockFileWindows_h_
+#define liblldb_Host_posix_LockFileWindows_h_
+
+#include "lldb/Host/LockFileBase.h"
+#include "lldb/Host/windows/windows.h"
+
+namespace lldb_private {
+
+class LockFileWindows : public LockFileBase {
+public:
+ explicit LockFileWindows(int fd);
+ ~LockFileWindows();
+
+protected:
+ Status DoWriteLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoTryWriteLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoReadLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoTryReadLock(const uint64_t start, const uint64_t len) override;
+
+ Status DoUnlock() override;
+
+ bool IsValidFile() const override;
+
+private:
+ HANDLE m_file;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Host_posix_LockFileWindows_h_
diff --git a/linux-x64/clang/include/lldb/Host/windows/PipeWindows.h b/linux-x64/clang/include/lldb/Host/windows/PipeWindows.h
new file mode 100644
index 0000000..4b5be28
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/PipeWindows.h
@@ -0,0 +1,89 @@
+//===-- PipeWindows.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_windows_PipeWindows_h_
+#define liblldb_Host_windows_PipeWindows_h_
+
+#include "lldb/Host/PipeBase.h"
+#include "lldb/Host/windows/windows.h"
+
+namespace lldb_private {
+
+/// \class Pipe PipeWindows.h "lldb/Host/windows/PipeWindows.h"
+/// A windows-based implementation of Pipe, a class that abtracts
+/// unix style pipes.
+///
+/// A class that abstracts the LLDB core from host pipe functionality.
+class PipeWindows : public PipeBase {
+public:
+ static const int kInvalidDescriptor = -1;
+
+public:
+ PipeWindows();
+ PipeWindows(lldb::pipe_t read, lldb::pipe_t write);
+ ~PipeWindows() override;
+
+ // Create an unnamed pipe.
+ Status CreateNew(bool child_process_inherit) override;
+
+ // Create a named pipe.
+ Status CreateNewNamed(bool child_process_inherit);
+ 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;
+
+ bool CanRead() const override;
+ bool CanWrite() const override;
+
+ lldb::pipe_t GetReadPipe() const override { return lldb::pipe_t(m_read); }
+ lldb::pipe_t GetWritePipe() const override { return lldb::pipe_t(m_write); }
+
+ int GetReadFileDescriptor() const override;
+ int GetWriteFileDescriptor() const override;
+ int ReleaseReadFileDescriptor() override;
+ int ReleaseWriteFileDescriptor() override;
+ void CloseReadFileDescriptor() override;
+ void CloseWriteFileDescriptor() override;
+
+ void Close() override;
+
+ Status Delete(llvm::StringRef name) 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;
+
+ // PipeWindows specific methods. These allow access to the underlying OS
+ // handle.
+ HANDLE GetReadNativeHandle();
+ HANDLE GetWriteNativeHandle();
+
+private:
+ Status OpenNamedPipe(llvm::StringRef name, bool child_process_inherit,
+ bool is_read);
+
+ HANDLE m_read;
+ HANDLE m_write;
+
+ int m_read_fd;
+ int m_write_fd;
+
+ OVERLAPPED m_read_overlapped;
+ OVERLAPPED m_write_overlapped;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Host_posix_PipePosix_h_
diff --git a/linux-x64/clang/include/lldb/Host/windows/PosixApi.h b/linux-x64/clang/include/lldb/Host/windows/PosixApi.h
new file mode 100644
index 0000000..6a6ed3e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/PosixApi.h
@@ -0,0 +1,117 @@
+//===-- windows/PosixApi.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_windows_PosixApi_h
+#define liblldb_Host_windows_PosixApi_h
+
+#include "lldb/Host/Config.h"
+#include "llvm/Support/Compiler.h"
+#if !defined(_WIN32)
+#error "windows/PosixApi.h being #included on non Windows system!"
+#endif
+
+// va_start, va_end, etc macros.
+#include <stdarg.h>
+
+// time_t, timespec, etc.
+#include <time.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 32768
+#endif
+
+#define O_NOCTTY 0
+#define O_NONBLOCK 0
+#define SIGTRAP 5
+#define SIGKILL 9
+#define SIGSTOP 20
+
+#if defined(_MSC_VER)
+#define S_IRUSR S_IREAD /* read, user */
+#define S_IWUSR S_IWRITE /* write, user */
+#define S_IXUSR 0 /* execute, user */
+#endif
+#define S_IRGRP 0 /* read, group */
+#define S_IWGRP 0 /* write, group */
+#define S_IXGRP 0 /* execute, group */
+#define S_IROTH 0 /* read, others */
+#define S_IWOTH 0 /* write, others */
+#define S_IXOTH 0 /* execute, others */
+#define S_IRWXU 0
+#define S_IRWXG 0
+#define S_IRWXO 0
+
+#if HAVE_SYS_TYPES_H
+// pyconfig.h typedefs this. We require python headers to be included before
+// any LLDB headers, but there's no way to prevent python's pid_t definition
+// from leaking, so this is the best option.
+#ifndef NO_PID_T
+#include <sys/types.h>
+#endif
+#endif // HAVE_SYS_TYPES_H
+
+#ifdef _MSC_VER
+
+// PRIxxx format macros for printf()
+#include <inttypes.h>
+
+// open(), close(), creat(), etc.
+#include <io.h>
+
+typedef unsigned short mode_t;
+
+// pyconfig.h typedefs this. We require python headers to be included before
+// any LLDB headers, but there's no way to prevent python's pid_t definition
+// from leaking, so this is the best option.
+#ifndef NO_PID_T
+typedef uint32_t pid_t;
+#endif
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#define S_IFDIR _S_IFDIR
+
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
+#endif
+
+#endif // _MSC_VER
+
+// Various useful posix functions that are not present in Windows. We provide
+// custom implementations.
+int vasprintf(char **ret, const char *fmt, va_list ap);
+char *strcasestr(const char *s, const char *find);
+char *realpath(const char *name, char *resolved);
+
+#ifdef _MSC_VER
+
+char *basename(char *path);
+char *dirname(char *path);
+
+int strcasecmp(const char *s1, const char *s2);
+int strncasecmp(const char *s1, const char *s2, size_t n);
+
+#endif // _MSC_VER
+
+// empty functions
+inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
+
+inline int strerror_r(int errnum, char *buf, size_t buflen) {
+ LLVM_BUILTIN_UNREACHABLE;
+}
+
+inline int unlockpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
+inline int grantpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
+inline char *ptsname(int fd) { LLVM_BUILTIN_UNREACHABLE; }
+
+inline pid_t fork(void) { LLVM_BUILTIN_UNREACHABLE; }
+inline pid_t setsid(void) { LLVM_BUILTIN_UNREACHABLE; }
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h b/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h
new file mode 100644
index 0000000..e765f1e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h
@@ -0,0 +1,29 @@
+//===-- ProcessLauncherWindows.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_windows_ProcessLauncherWindows_h_
+#define lldb_Host_windows_ProcessLauncherWindows_h_
+
+#include "lldb/Host/ProcessLauncher.h"
+#include "lldb/Host/windows/windows.h"
+
+namespace lldb_private {
+
+class ProcessLaunchInfo;
+
+class ProcessLauncherWindows : public ProcessLauncher {
+public:
+ virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+ Status &error);
+
+protected:
+ HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Host/windows/editlinewin.h b/linux-x64/clang/include/lldb/Host/windows/editlinewin.h
new file mode 100644
index 0000000..7575f67
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/editlinewin.h
@@ -0,0 +1,115 @@
+//===-- editlinewin.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#pragma once
+
+#include <stdio.h>
+
+// EditLine editor function return codes.
+// For user-defined function interface
+#define CC_NORM 0
+#define CC_NEWLINE 1
+#define CC_EOF 2
+#define CC_ARGHACK 3
+#define CC_REFRESH 4
+#define CC_CURSOR 5
+#define CC_ERROR 6
+#define CC_FATAL 7
+#define CC_REDISPLAY 8
+#define CC_REFRESH_BEEP 9
+
+// el_set/el_get parameters
+#define EL_PROMPT 0 // , el_pfunc_t
+#define EL_TERMINAL 1 // , const char *
+#define EL_EDITOR 2 // , const char *
+#define EL_SIGNAL 3 // , int);
+#define EL_BIND 4 // , const char *, ..., NULL
+#define EL_TELLTC 5 // , const char *, ..., NULL
+#define EL_SETTC 6 // , const char *, ..., NULL
+#define EL_ECHOTC 7 // , const char *, ..., NULL
+#define EL_SETTY 8 // , const char *, ..., NULL
+#define EL_ADDFN 9 // , const char *, const char *, el_func_t
+#define EL_HIST 10 // , hist_fun_t, const char *
+#define EL_EDITMODE 11 // , int
+#define EL_RPROMPT 12 // , el_pfunc_t
+#define EL_GETCFN 13 // , el_rfunc_t
+#define EL_CLIENTDATA 14 // , void *
+#define EL_UNBUFFERED 15 // , int
+#define EL_PREP_TERM 16 // , int
+#define EL_GETTC 17 // , const char *, ..., NULL
+#define EL_GETFP 18 // , int, FILE **
+#define EL_SETFP 19 // , int, FILE *
+#define EL_REFRESH 20 // , void
+#define EL_PROMPT_ESC 21 // , prompt_func, Char); set/get
+
+#define EL_BUILTIN_GETCFN (NULL)
+
+// history defines
+#define H_FUNC 0 // , UTSL
+#define H_SETSIZE 1 // , const int
+#define H_GETSIZE 2 // , void
+#define H_FIRST 3 // , void
+#define H_LAST 4 // , void
+#define H_PREV 5 // , void
+#define H_NEXT 6 // , void
+#define H_CURR 8 // , const int
+#define H_SET 7 // , int
+#define H_ADD 9 // , const char *
+#define H_ENTER 10 // , const char *
+#define H_APPEND 11 // , const char *
+#define H_END 12 // , void
+#define H_NEXT_STR 13 // , const char *
+#define H_PREV_STR 14 // , const char *
+#define H_NEXT_EVENT 15 // , const int
+#define H_PREV_EVENT 16 // , const int
+#define H_LOAD 17 // , const char *
+#define H_SAVE 18 // , const char *
+#define H_CLEAR 19 // , void
+#define H_SETUNIQUE 20 // , int
+#define H_GETUNIQUE 21 // , void
+#define H_DEL 22 // , int
+
+struct EditLine {};
+
+struct LineInfo {
+ const char *buffer;
+ const char *cursor;
+ const char *lastchar;
+};
+
+struct History {};
+
+struct HistEvent {
+ int num;
+ const char *str;
+};
+
+extern "C" {
+// edit line API
+EditLine *el_init(const char *, FILE *, FILE *, FILE *);
+const char *el_gets(EditLine *, int *);
+int el_set(EditLine *, int, ...);
+
+void el_end(EditLine *);
+void el_reset(EditLine *);
+int el_getc(EditLine *, char *);
+void el_push(EditLine *, const char *);
+void el_beep(EditLine *);
+int el_parse(EditLine *, int, const char **);
+int el_get(EditLine *, int, ...);
+int el_source(EditLine *, const char *);
+void el_resize(EditLine *);
+const LineInfo *el_line(EditLine *);
+int el_insertstr(EditLine *, const char *);
+void el_deletestr(EditLine *, int);
+
+// history API
+History *history_init(void);
+void history_end(History *);
+int history(History *, HistEvent *, int, ...);
+};
diff --git a/linux-x64/clang/include/lldb/Host/windows/windows.h b/linux-x64/clang/include/lldb/Host/windows/windows.h
new file mode 100644
index 0000000..11594c6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/windows/windows.h
@@ -0,0 +1,31 @@
+//===-- windows.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_windows_h_
+#define LLDB_lldb_windows_h_
+
+#define NTDDI_VERSION NTDDI_VISTA
+#undef _WIN32_WINNT // undef a previous definition to avoid warning
+#define _WIN32_WINNT _WIN32_WINNT_VISTA
+#define WIN32_LEAN_AND_MEAN
+#define NOGDI
+#undef NOMINMAX // undef a previous definition to avoid warning
+#define NOMINMAX
+#include <windows.h>
+#undef GetUserName
+#undef LoadImage
+#undef CreateProcess
+#undef Yield
+#undef far
+#undef near
+#undef FAR
+#undef NEAR
+#define FAR
+#define NEAR
+
+#endif // LLDB_lldb_windows_h_
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h b/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h
new file mode 100644
index 0000000..e616ad1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h
@@ -0,0 +1,28 @@
+//===-- SystemInitializer.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
+#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
+
+#include "llvm/Support/Error.h"
+
+#include <string>
+
+namespace lldb_private {
+
+class SystemInitializer {
+public:
+ SystemInitializer();
+ virtual ~SystemInitializer();
+
+ virtual llvm::Error Initialize() = 0;
+ virtual void Terminate() = 0;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h b/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h
new file mode 100644
index 0000000..ad7e58e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h
@@ -0,0 +1,34 @@
+//===-- SystemInitializerCommon.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+
+#include "SystemInitializer.h"
+
+namespace lldb_private {
+/// Initializes common lldb functionality.
+///
+/// This class is responsible for initializing a subset of lldb
+/// useful to both debug servers and debug clients. Debug servers
+/// do not use all of LLDB and desire small binary sizes, so this
+/// functionality is separate. This class is used by constructing
+/// an instance of SystemLifetimeManager with this class passed to
+/// the constructor.
+class SystemInitializerCommon : public SystemInitializer {
+public:
+ SystemInitializerCommon();
+ ~SystemInitializerCommon() override;
+
+ llvm::Error Initialize() override;
+ void Terminate() override;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h b/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h
new file mode 100644
index 0000000..2e99b86
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h
@@ -0,0 +1,41 @@
+//===-- SystemLifetimeManager.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
+#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
+
+#include "lldb/Initialization/SystemInitializer.h"
+#include "lldb/lldb-private-types.h"
+#include "llvm/Support/Error.h"
+
+#include <memory>
+#include <mutex>
+
+namespace lldb_private {
+
+class SystemLifetimeManager {
+public:
+ SystemLifetimeManager();
+ ~SystemLifetimeManager();
+
+ llvm::Error Initialize(std::unique_ptr<SystemInitializer> initializer,
+ LoadPluginCallbackType plugin_callback);
+ void Terminate();
+
+private:
+ std::recursive_mutex m_mutex;
+ std::unique_ptr<SystemInitializer> m_initializer;
+ bool m_initialized;
+
+ // Noncopyable.
+ SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
+ SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h b/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h
new file mode 100644
index 0000000..c2a7a38
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h
@@ -0,0 +1,84 @@
+//===-- CommandAlias.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandAlias_h_
+#define liblldb_CommandAlias_h_
+
+#include <memory>
+
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+class CommandAlias : public CommandObject {
+public:
+ typedef std::unique_ptr<CommandAlias> UniquePointer;
+
+ CommandAlias(CommandInterpreter &interpreter, lldb::CommandObjectSP cmd_sp,
+ llvm::StringRef options_args, llvm::StringRef name,
+ llvm::StringRef help = llvm::StringRef(),
+ llvm::StringRef syntax = llvm::StringRef(), uint32_t flags = 0);
+
+ void GetAliasExpansion(StreamString &help_string) const;
+
+ bool IsValid() const { return m_underlying_command_sp && m_option_args_sp; }
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool WantsRawCommandString() override;
+
+ bool WantsCompletion() override;
+
+ int HandleCompletion(CompletionRequest &request) override;
+
+ int HandleArgumentCompletion(
+ CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override;
+
+ Options *GetOptions() override;
+
+ bool IsAlias() override { return true; }
+
+ bool IsDashDashCommand() override;
+
+ llvm::StringRef GetHelp() override;
+
+ llvm::StringRef GetHelpLong() override;
+
+ void SetHelp(llvm::StringRef str) override;
+
+ void SetHelpLong(llvm::StringRef str) override;
+
+ bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+ lldb::CommandObjectSP GetUnderlyingCommand() {
+ return m_underlying_command_sp;
+ }
+ OptionArgVectorSP GetOptionArguments() const { return m_option_args_sp; }
+ const char *GetOptionString() { return m_option_string.c_str(); }
+
+ // this takes an alias - potentially nested (i.e. an alias to an alias) and
+ // expands it all the way to a non-alias command
+ std::pair<lldb::CommandObjectSP, OptionArgVectorSP> Desugar();
+
+protected:
+ bool IsNestedAlias();
+
+private:
+ lldb::CommandObjectSP m_underlying_command_sp;
+ std::string m_option_string;
+ OptionArgVectorSP m_option_args_sp;
+ LazyBool m_is_dashdash_alias;
+ bool m_did_set_help : 1;
+ bool m_did_set_help_long : 1;
+};
+} // namespace lldb_private
+
+#endif // liblldb_CommandAlias_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h b/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h
new file mode 100644
index 0000000..3d09db5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h
@@ -0,0 +1,203 @@
+//===-- CommandCompletions.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_CommandCompletions_h_
+#define lldb_CommandCompletions_h_
+
+#include <set>
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/Twine.h"
+
+namespace lldb_private {
+class TildeExpressionResolver;
+class CommandCompletions {
+public:
+ // This is the command completion callback that is used to complete the
+ // argument of the option it is bound to (in the OptionDefinition table
+ // below). Return the total number of matches.
+ typedef int (*CompletionCallback)(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ // A search filter to limit the search...
+ lldb_private::SearchFilter *searcher);
+ enum CommonCompletionTypes {
+ eNoCompletion = 0u,
+ eSourceFileCompletion = (1u << 0),
+ eDiskFileCompletion = (1u << 1),
+ eDiskDirectoryCompletion = (1u << 2),
+ eSymbolCompletion = (1u << 3),
+ eModuleCompletion = (1u << 4),
+ eSettingsNameCompletion = (1u << 5),
+ ePlatformPluginCompletion = (1u << 6),
+ eArchitectureCompletion = (1u << 7),
+ eVariablePathCompletion = (1u << 8),
+ // This item serves two purposes. It is the last element in the enum, so
+ // you can add custom enums starting from here in your Option class. Also
+ // if you & in this bit the base code will not process the option.
+ eCustomCompletion = (1u << 9)
+ };
+
+ struct CommonCompletionElement {
+ uint32_t type;
+ CompletionCallback callback;
+ };
+
+ static bool InvokeCommonCompletionCallbacks(
+ CommandInterpreter &interpreter, uint32_t completion_mask,
+ lldb_private::CompletionRequest &request, SearchFilter *searcher);
+
+ // These are the generic completer functions:
+ static int DiskFiles(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static int DiskFiles(const llvm::Twine &partial_file_name,
+ StringList &matches, TildeExpressionResolver &Resolver);
+
+ static int DiskDirectories(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static int DiskDirectories(const llvm::Twine &partial_file_name,
+ StringList &matches,
+ TildeExpressionResolver &Resolver);
+
+ static int SourceFiles(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static int Modules(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static int Symbols(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static int SettingsNames(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static int PlatformPluginNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static int ArchitectureNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static int VariablePath(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ // The Completer class is a convenient base class for building searchers that
+ // go along with the SearchFilter passed to the standard Completer functions.
+ class Completer : public Searcher {
+ public:
+ Completer(CommandInterpreter &interpreter, CompletionRequest &request);
+
+ ~Completer() override;
+
+ CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
+ Address *addr, bool complete) override = 0;
+
+ lldb::SearchDepth GetDepth() override = 0;
+
+ virtual size_t DoCompletion(SearchFilter *filter) = 0;
+
+ protected:
+ CommandInterpreter &m_interpreter;
+ CompletionRequest &m_request;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Completer);
+ };
+
+ // SourceFileCompleter implements the source file completer
+ class SourceFileCompleter : public Completer {
+ public:
+ SourceFileCompleter(CommandInterpreter &interpreter,
+ bool include_support_files, CompletionRequest &request);
+
+ lldb::SearchDepth GetDepth() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
+
+ size_t DoCompletion(SearchFilter *filter) override;
+
+ private:
+ bool m_include_support_files;
+ FileSpecList m_matching_files;
+ const char *m_file_name;
+ const char *m_dir_name;
+
+ DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
+ };
+
+ // ModuleCompleter implements the module completer
+ class ModuleCompleter : public Completer {
+ public:
+ ModuleCompleter(CommandInterpreter &interpreter,
+ CompletionRequest &request);
+
+ lldb::SearchDepth GetDepth() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
+
+ size_t DoCompletion(SearchFilter *filter) override;
+
+ private:
+ const char *m_file_name;
+ const char *m_dir_name;
+
+ DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
+ };
+
+ // SymbolCompleter implements the symbol completer
+ class SymbolCompleter : public Completer {
+ public:
+ SymbolCompleter(CommandInterpreter &interpreter,
+ CompletionRequest &request);
+
+ lldb::SearchDepth GetDepth() override;
+
+ Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+ SymbolContext &context,
+ Address *addr,
+ bool complete) override;
+
+ size_t DoCompletion(SearchFilter *filter) override;
+
+ private:
+ // struct NameCmp {
+ // bool operator() (const ConstString& lhs, const ConstString&
+ // rhs) const
+ // {
+ // return lhs < rhs;
+ // }
+ // };
+
+ RegularExpression m_regex;
+ typedef std::set<ConstString> collection;
+ collection m_match_set;
+
+ DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
+ };
+
+private:
+ static CommonCompletionElement g_common_completions[];
+};
+
+} // namespace lldb_private
+
+#endif // lldb_CommandCompletions_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h b/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h
new file mode 100644
index 0000000..c1386f8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h
@@ -0,0 +1,58 @@
+//===-- CommandHistory.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandHistory_h_
+#define liblldb_CommandHistory_h_
+
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class CommandHistory {
+public:
+ CommandHistory();
+
+ ~CommandHistory();
+
+ size_t GetSize() const;
+
+ bool IsEmpty() const;
+
+ llvm::Optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
+
+ llvm::StringRef GetStringAtIndex(size_t idx) const;
+
+ llvm::StringRef operator[](size_t idx) const;
+
+ llvm::StringRef GetRecentmostString() const;
+
+ void AppendString(llvm::StringRef str, bool reject_if_dupe = true);
+
+ void Clear();
+
+ void Dump(Stream &stream, size_t start_idx = 0,
+ size_t stop_idx = SIZE_MAX) const;
+
+ static const char g_repeat_char = '!';
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CommandHistory);
+
+ typedef std::vector<std::string> History;
+ mutable std::recursive_mutex m_mutex;
+ History m_history;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandHistory_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h b/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h
new file mode 100644
index 0000000..c3dd660
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h
@@ -0,0 +1,606 @@
+//===-- CommandInterpreter.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandInterpreter_h_
+#define liblldb_CommandInterpreter_h_
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/IOHandler.h"
+#include "lldb/Interpreter/CommandAlias.h"
+#include "lldb/Interpreter/CommandHistory.h"
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+#include <mutex>
+
+namespace lldb_private {
+
+class CommandInterpreterRunOptions {
+public:
+ /// Construct a CommandInterpreterRunOptions object. This class is used to
+ /// control all the instances where we run multiple commands, e.g.
+ /// HandleCommands, HandleCommandsFromFile, RunCommandInterpreter.
+ ///
+ /// The meanings of the options in this object are:
+ ///
+ /// \param[in] stop_on_continue
+ /// If \b true, execution will end on the first command that causes the
+ /// process in the execution context to continue. If \b false, we won't
+ /// check the execution status.
+ /// \param[in] stop_on_error
+ /// If \b true, execution will end on the first command that causes an
+ /// error.
+ /// \param[in] stop_on_crash
+ /// If \b true, when a command causes the target to run, and the end of the
+ /// run is a signal or exception, stop executing the commands.
+ /// \param[in] echo_commands
+ /// If \b true, echo the command before executing it. If \b false, execute
+ /// silently.
+ /// \param[in] echo_comments
+ /// If \b true, echo command even if it is a pure comment line. If
+ /// \b false, print no ouput in this case. This setting has an effect only
+ /// if \param echo_commands is \b true.
+ /// \param[in] print_results
+ /// If \b true and the command succeeds, print the results of the command
+ /// after executing it. If \b false, execute silently.
+ /// \param[in] print_errors
+ /// If \b true and the command fails, print the results of the command
+ /// after executing it. If \b false, execute silently.
+ /// \param[in] add_to_history
+ /// If \b true add the commands to the command history. If \b false, don't
+ /// add them.
+ CommandInterpreterRunOptions(LazyBool stop_on_continue,
+ LazyBool stop_on_error, LazyBool stop_on_crash,
+ LazyBool echo_commands, LazyBool echo_comments,
+ LazyBool print_results, LazyBool print_errors,
+ LazyBool add_to_history)
+ : m_stop_on_continue(stop_on_continue), m_stop_on_error(stop_on_error),
+ m_stop_on_crash(stop_on_crash), m_echo_commands(echo_commands),
+ m_echo_comment_commands(echo_comments), m_print_results(print_results),
+ m_print_errors(print_errors), m_add_to_history(add_to_history) {}
+
+ CommandInterpreterRunOptions()
+ : m_stop_on_continue(eLazyBoolCalculate),
+ m_stop_on_error(eLazyBoolCalculate),
+ m_stop_on_crash(eLazyBoolCalculate),
+ m_echo_commands(eLazyBoolCalculate),
+ m_echo_comment_commands(eLazyBoolCalculate),
+ m_print_results(eLazyBoolCalculate), m_print_errors(eLazyBoolCalculate),
+ m_add_to_history(eLazyBoolCalculate) {}
+
+ void SetSilent(bool silent) {
+ LazyBool value = silent ? eLazyBoolNo : eLazyBoolYes;
+
+ m_print_results = value;
+ m_print_errors = value;
+ m_echo_commands = value;
+ m_echo_comment_commands = value;
+ m_add_to_history = value;
+ }
+ // These return the default behaviors if the behavior is not
+ // eLazyBoolCalculate. But I've also left the ivars public since for
+ // different ways of running the interpreter you might want to force
+ // different defaults... In that case, just grab the LazyBool ivars directly
+ // and do what you want with eLazyBoolCalculate.
+ bool GetStopOnContinue() const { return DefaultToNo(m_stop_on_continue); }
+
+ void SetStopOnContinue(bool stop_on_continue) {
+ m_stop_on_continue = stop_on_continue ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetStopOnError() const { return DefaultToNo(m_stop_on_error); }
+
+ void SetStopOnError(bool stop_on_error) {
+ m_stop_on_error = stop_on_error ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetStopOnCrash() const { return DefaultToNo(m_stop_on_crash); }
+
+ void SetStopOnCrash(bool stop_on_crash) {
+ m_stop_on_crash = stop_on_crash ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetEchoCommands() const { return DefaultToYes(m_echo_commands); }
+
+ void SetEchoCommands(bool echo_commands) {
+ m_echo_commands = echo_commands ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetEchoCommentCommands() const {
+ return DefaultToYes(m_echo_comment_commands);
+ }
+
+ void SetEchoCommentCommands(bool echo_comments) {
+ m_echo_comment_commands = echo_comments ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetPrintResults() const { return DefaultToYes(m_print_results); }
+
+ void SetPrintResults(bool print_results) {
+ m_print_results = print_results ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetPrintErrors() const { return DefaultToYes(m_print_errors); }
+
+ void SetPrintErrors(bool print_errors) {
+ m_print_errors = print_errors ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetAddToHistory() const { return DefaultToYes(m_add_to_history); }
+
+ void SetAddToHistory(bool add_to_history) {
+ m_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ LazyBool m_stop_on_continue;
+ LazyBool m_stop_on_error;
+ LazyBool m_stop_on_crash;
+ LazyBool m_echo_commands;
+ LazyBool m_echo_comment_commands;
+ LazyBool m_print_results;
+ LazyBool m_print_errors;
+ LazyBool m_add_to_history;
+
+private:
+ static bool DefaultToYes(LazyBool flag) {
+ switch (flag) {
+ case eLazyBoolNo:
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ static bool DefaultToNo(LazyBool flag) {
+ switch (flag) {
+ case eLazyBoolYes:
+ return true;
+ default:
+ return false;
+ }
+ }
+};
+
+class CommandInterpreter : public Broadcaster,
+ public Properties,
+ public IOHandlerDelegate {
+public:
+ enum {
+ eBroadcastBitThreadShouldExit = (1 << 0),
+ eBroadcastBitResetPrompt = (1 << 1),
+ eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
+ eBroadcastBitAsynchronousOutputData = (1 << 3),
+ eBroadcastBitAsynchronousErrorData = (1 << 4)
+ };
+
+ enum ChildrenTruncatedWarningStatus // tristate boolean to manage children
+ // truncation warning
+ { eNoTruncation = 0, // never truncated
+ eUnwarnedTruncation = 1, // truncated but did not notify
+ eWarnedTruncation = 2 // truncated and notified
+ };
+
+ enum CommandTypes {
+ eCommandTypesBuiltin = 0x0001, // native commands such as "frame"
+ eCommandTypesUserDef = 0x0002, // scripted commands
+ eCommandTypesAliases = 0x0004, // aliases such as "po"
+ eCommandTypesHidden = 0x0008, // commands prefixed with an underscore
+ eCommandTypesAllThem = 0xFFFF // all commands
+ };
+
+ CommandInterpreter(Debugger &debugger, bool synchronous_execution);
+
+ ~CommandInterpreter() override;
+
+ // These two functions fill out the Broadcaster interface:
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+ void SourceInitFileCwd(CommandReturnObject &result);
+ void SourceInitFileHome(CommandReturnObject &result);
+
+ bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
+ bool can_replace);
+
+ bool AddUserCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
+ bool can_replace);
+
+ lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd,
+ bool include_aliases) const;
+
+ CommandObject *GetCommandObject(llvm::StringRef cmd,
+ StringList *matches = nullptr,
+ StringList *descriptions = nullptr) const;
+
+ bool CommandExists(llvm::StringRef cmd) const;
+
+ bool AliasExists(llvm::StringRef cmd) const;
+
+ bool UserCommandExists(llvm::StringRef cmd) const;
+
+ CommandAlias *AddAlias(llvm::StringRef alias_name,
+ lldb::CommandObjectSP &command_obj_sp,
+ llvm::StringRef args_string = llvm::StringRef());
+
+ // Remove a command if it is removable (python or regex command)
+ bool RemoveCommand(llvm::StringRef cmd);
+
+ bool RemoveAlias(llvm::StringRef alias_name);
+
+ bool GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const;
+
+ bool RemoveUser(llvm::StringRef alias_name);
+
+ void RemoveAllUser() { m_user_dict.clear(); }
+
+ const CommandAlias *GetAlias(llvm::StringRef alias_name) const;
+
+ CommandObject *BuildAliasResult(llvm::StringRef alias_name,
+ std::string &raw_input_string,
+ std::string &alias_result,
+ CommandReturnObject &result);
+
+ bool HandleCommand(const char *command_line, LazyBool add_to_history,
+ CommandReturnObject &result,
+ ExecutionContext *override_context = nullptr,
+ bool repeat_on_empty_command = true,
+ bool no_context_switching = false);
+
+ bool WasInterrupted() const;
+
+ /// Execute a list of commands in sequence.
+ ///
+ /// \param[in] commands
+ /// The list of commands to execute.
+ /// \param[in,out] context
+ /// The execution context in which to run the commands. Can be nullptr in
+ /// which case the default
+ /// context will be used.
+ /// \param[in] options
+ /// This object holds the options used to control when to stop, whether to
+ /// execute commands,
+ /// etc.
+ /// \param[out] result
+ /// This is marked as succeeding with no output if all commands execute
+ /// safely,
+ /// and failed with some explanation if we aborted executing the commands
+ /// at some point.
+ void HandleCommands(const StringList &commands, ExecutionContext *context,
+ CommandInterpreterRunOptions &options,
+ CommandReturnObject &result);
+
+ /// Execute a list of commands from a file.
+ ///
+ /// \param[in] file
+ /// The file from which to read in commands.
+ /// \param[in,out] context
+ /// The execution context in which to run the commands. Can be nullptr in
+ /// which case the default
+ /// context will be used.
+ /// \param[in] options
+ /// This object holds the options used to control when to stop, whether to
+ /// execute commands,
+ /// etc.
+ /// \param[out] result
+ /// This is marked as succeeding with no output if all commands execute
+ /// safely,
+ /// and failed with some explanation if we aborted executing the commands
+ /// at some point.
+ void HandleCommandsFromFile(FileSpec &file, ExecutionContext *context,
+ CommandInterpreterRunOptions &options,
+ CommandReturnObject &result);
+
+ CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
+
+ // This handles command line completion. You are given a pointer to the
+ // command string buffer, to the current cursor, and to the end of the string
+ // (in case it is not NULL terminated). You also passed in an StringList
+ // object to fill with the returns. The first element of the array will be
+ // filled with the string that you would need to insert at the cursor point
+ // to complete the cursor point to the longest common matching prefix. If you
+ // want to limit the number of elements returned, set max_return_elements to
+ // the number of elements you want returned. Otherwise set
+ // max_return_elements to -1. If you want to start some way into the match
+ // list, then set match_start_point to the desired start point. Returns: -1
+ // if the completion character should be inserted -2 if the entire command
+ // line should be deleted and replaced with matches.GetStringAtIndex(0)
+ // INT_MAX if the number of matches is > max_return_elements, but it is
+ // expensive to compute. Otherwise, returns the number of matches.
+ //
+ // FIXME: Only max_return_elements == -1 is supported at present.
+ int HandleCompletion(const char *current_line, const char *cursor,
+ const char *last_char, int match_start_point,
+ int max_return_elements, StringList &matches,
+ StringList &descriptions);
+
+ // This version just returns matches, and doesn't compute the substring. It
+ // is here so the Help command can call it for the first argument. It uses
+ // a CompletionRequest for simplicity reasons.
+ int HandleCompletionMatches(CompletionRequest &request);
+
+ int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
+ bool include_aliases,
+ StringList &matches,
+ StringList &descriptions);
+
+ void GetHelp(CommandReturnObject &result,
+ uint32_t types = eCommandTypesAllThem);
+
+ void GetAliasHelp(const char *alias_name, StreamString &help_string);
+
+ void OutputFormattedHelpText(Stream &strm, llvm::StringRef prefix,
+ llvm::StringRef help_text);
+
+ void OutputFormattedHelpText(Stream &stream, llvm::StringRef command_word,
+ llvm::StringRef separator,
+ llvm::StringRef help_text, size_t max_word_len);
+
+ // this mimics OutputFormattedHelpText but it does perform a much simpler
+ // formatting, basically ensuring line alignment. This is only good if you
+ // have some complicated layout for your help text and want as little help as
+ // reasonable in properly displaying it. Most of the times, you simply want
+ // to type some text and have it printed in a reasonable way on screen. If
+ // so, use OutputFormattedHelpText
+ void OutputHelpText(Stream &stream, llvm::StringRef command_word,
+ llvm::StringRef separator, llvm::StringRef help_text,
+ uint32_t max_word_len);
+
+ Debugger &GetDebugger() { return m_debugger; }
+
+ ExecutionContext GetExecutionContext() {
+ const bool thread_and_frame_only_if_stopped = true;
+ return m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped);
+ }
+
+ void UpdateExecutionContext(ExecutionContext *override_context);
+
+ lldb::PlatformSP GetPlatform(bool prefer_target_platform);
+
+ const char *ProcessEmbeddedScriptCommands(const char *arg);
+
+ void UpdatePrompt(llvm::StringRef prompt);
+
+ bool Confirm(llvm::StringRef message, bool default_answer);
+
+ void LoadCommandDictionary();
+
+ void Initialize();
+
+ void Clear();
+
+ bool HasCommands() const;
+
+ bool HasAliases() const;
+
+ bool HasUserCommands() const;
+
+ bool HasAliasOptions() const;
+
+ void BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
+ const char *alias_name, Args &cmd_args,
+ std::string &raw_input_string,
+ CommandReturnObject &result);
+
+ int GetOptionArgumentPosition(const char *in_string);
+
+ void SkipLLDBInitFiles(bool skip_lldbinit_files) {
+ m_skip_lldbinit_files = skip_lldbinit_files;
+ }
+
+ void SkipAppInitFiles(bool skip_app_init_files) {
+ m_skip_app_init_files = skip_app_init_files;
+ }
+
+ bool GetSynchronous();
+
+ void FindCommandsForApropos(llvm::StringRef word, StringList &commands_found,
+ StringList &commands_help,
+ bool search_builtin_commands,
+ bool search_user_commands,
+ bool search_alias_commands);
+
+ bool GetBatchCommandMode() { return m_batch_command_mode; }
+
+ bool SetBatchCommandMode(bool value) {
+ const bool old_value = m_batch_command_mode;
+ m_batch_command_mode = value;
+ return old_value;
+ }
+
+ void ChildrenTruncated() {
+ if (m_truncation_warning == eNoTruncation)
+ m_truncation_warning = eUnwarnedTruncation;
+ }
+
+ bool TruncationWarningNecessary() {
+ return (m_truncation_warning == eUnwarnedTruncation);
+ }
+
+ void TruncationWarningGiven() { m_truncation_warning = eWarnedTruncation; }
+
+ const char *TruncationWarningText() {
+ return "*** Some of your variables have more members than the debugger "
+ "will show by default. To show all of them, you can either use the "
+ "--show-all-children option to %s or raise the limit by changing "
+ "the target.max-children-count setting.\n";
+ }
+
+ CommandHistory &GetCommandHistory() { return m_command_history; }
+
+ bool IsActive();
+
+ void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
+ CommandInterpreterRunOptions &options);
+ void GetLLDBCommandsFromIOHandler(const char *prompt,
+ IOHandlerDelegate &delegate,
+ bool asynchronously, void *baton);
+
+ void GetPythonCommandsFromIOHandler(const char *prompt,
+ IOHandlerDelegate &delegate,
+ bool asynchronously, void *baton);
+
+ const char *GetCommandPrefix();
+
+ // Properties
+ bool GetExpandRegexAliases() const;
+
+ bool GetPromptOnQuit() const;
+
+ void SetPromptOnQuit(bool b);
+
+ bool GetEchoCommands() const;
+ void SetEchoCommands(bool b);
+
+ bool GetEchoCommentCommands() const;
+ void SetEchoCommentCommands(bool b);
+
+ /// Specify if the command interpreter should allow that the user can
+ /// specify a custom exit code when calling 'quit'.
+ void AllowExitCodeOnQuit(bool allow);
+
+ /// Sets the exit code for the quit command.
+ /// \param[in] exit_code
+ /// The exit code that the driver should return on exit.
+ /// \return True if the exit code was successfully set; false if the
+ /// interpreter doesn't allow custom exit codes.
+ /// \see AllowExitCodeOnQuit
+ LLVM_NODISCARD bool SetQuitExitCode(int exit_code);
+
+ /// Returns the exit code that the user has specified when running the
+ /// 'quit' command.
+ /// \param[out] exited
+ /// Set to true if the user has called quit with a custom exit code.
+ int GetQuitExitCode(bool &exited) const;
+
+ void ResolveCommand(const char *command_line, CommandReturnObject &result);
+
+ bool GetStopCmdSourceOnError() const;
+
+ uint32_t GetNumErrors() const { return m_num_errors; }
+
+ bool GetQuitRequested() const { return m_quit_requested; }
+
+ lldb::IOHandlerSP
+ GetIOHandler(bool force_create = false,
+ CommandInterpreterRunOptions *options = nullptr);
+
+ bool GetStoppedForCrash() const { return m_stopped_for_crash; }
+
+ bool GetSpaceReplPrompts() const;
+
+protected:
+ friend class Debugger;
+
+ // IOHandlerDelegate functions
+ void IOHandlerInputComplete(IOHandler &io_handler,
+ std::string &line) override;
+
+ ConstString IOHandlerGetControlSequence(char ch) override {
+ if (ch == 'd')
+ return ConstString("quit\n");
+ return ConstString();
+ }
+
+ bool IOHandlerInterrupt(IOHandler &io_handler) override;
+
+ size_t GetProcessOutput();
+
+ void SetSynchronous(bool value);
+
+ lldb::CommandObjectSP GetCommandSP(llvm::StringRef cmd,
+ bool include_aliases = true,
+ bool exact = true,
+ StringList *matches = nullptr,
+ StringList *descriptions = nullptr) const;
+
+private:
+ Status PreprocessCommand(std::string &command);
+
+ void SourceInitFile(FileSpec file, CommandReturnObject &result);
+
+ // Completely resolves aliases and abbreviations, returning a pointer to the
+ // final command object and updating command_line to the fully substituted
+ // and translated command.
+ CommandObject *ResolveCommandImpl(std::string &command_line,
+ CommandReturnObject &result);
+
+ void FindCommandsForApropos(llvm::StringRef word, StringList &commands_found,
+ StringList &commands_help,
+ CommandObject::CommandMap &command_map);
+
+ // An interruptible wrapper around the stream output
+ void PrintCommandOutput(Stream &stream, llvm::StringRef str);
+
+ bool EchoCommandNonInteractive(llvm::StringRef line,
+ const Flags &io_handler_flags) const;
+
+ // A very simple state machine which models the command handling transitions
+ enum class CommandHandlingState {
+ eIdle,
+ eInProgress,
+ eInterrupted,
+ };
+
+ std::atomic<CommandHandlingState> m_command_state{
+ CommandHandlingState::eIdle};
+
+ int m_iohandler_nesting_level = 0;
+
+ void StartHandlingCommand();
+ void FinishHandlingCommand();
+ bool InterruptCommand();
+
+ Debugger &m_debugger; // The debugger session that this interpreter is
+ // associated with
+ ExecutionContextRef m_exe_ctx_ref; // The current execution context to use
+ // when handling commands
+ bool m_synchronous_execution;
+ bool m_skip_lldbinit_files;
+ bool m_skip_app_init_files;
+ CommandObject::CommandMap m_command_dict; // Stores basic built-in commands
+ // (they cannot be deleted, removed
+ // or overwritten).
+ CommandObject::CommandMap
+ m_alias_dict; // Stores user aliases/abbreviations for commands
+ CommandObject::CommandMap m_user_dict; // Stores user-defined commands
+ CommandHistory m_command_history;
+ std::string m_repeat_command; // Stores the command that will be executed for
+ // an empty command string.
+ lldb::IOHandlerSP m_command_io_handler_sp;
+ char m_comment_char;
+ bool m_batch_command_mode;
+ ChildrenTruncatedWarningStatus m_truncation_warning; // Whether we truncated
+ // children and whether
+ // the user has been told
+ uint32_t m_command_source_depth;
+ std::vector<uint32_t> m_command_source_flags;
+ uint32_t m_num_errors;
+ bool m_quit_requested;
+ bool m_stopped_for_crash;
+
+ // The exit code the user has requested when calling the 'quit' command.
+ // No value means the user hasn't set a custom exit code so far.
+ llvm::Optional<int> m_quit_exit_code;
+ // If the driver is accepts custom exit codes for the 'quit' command.
+ bool m_allow_exit_code = false;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandInterpreter_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObject.h b/linux-x64/clang/include/lldb/Interpreter/CommandObject.h
new file mode 100644
index 0000000..31f7f12
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandObject.h
@@ -0,0 +1,431 @@
+//===-- CommandObject.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObject_h_
+#define liblldb_CommandObject_h_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/Interpreter/CommandCompletions.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/StringList.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// This function really deals with CommandObjectLists, but we didn't make a
+// CommandObjectList class, so I'm sticking it here. But we really should have
+// such a class. Anyway, it looks up the commands in the map that match the
+// partial string cmd_str, inserts the matches into matches, and returns the
+// number added.
+
+template <typename ValueType>
+int AddNamesMatchingPartialString(
+ const std::map<std::string, ValueType> &in_map, llvm::StringRef cmd_str,
+ StringList &matches, StringList *descriptions = nullptr) {
+ int number_added = 0;
+
+ const bool add_all = cmd_str.empty();
+
+ for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
+ if (add_all || (iter->first.find(cmd_str, 0) == 0)) {
+ ++number_added;
+ matches.AppendString(iter->first.c_str());
+ if (descriptions)
+ descriptions->AppendString(iter->second->GetHelp());
+ }
+ }
+
+ return number_added;
+}
+
+template <typename ValueType>
+size_t FindLongestCommandWord(std::map<std::string, ValueType> &dict) {
+ auto end = dict.end();
+ size_t max_len = 0;
+
+ for (auto pos = dict.begin(); pos != end; ++pos) {
+ size_t len = pos->first.size();
+ if (max_len < len)
+ max_len = len;
+ }
+ return max_len;
+}
+
+class CommandObject {
+public:
+ typedef llvm::StringRef(ArgumentHelpCallbackFunction)();
+
+ struct ArgumentHelpCallback {
+ ArgumentHelpCallbackFunction *help_callback;
+ bool self_formatting;
+
+ llvm::StringRef operator()() const { return (*help_callback)(); }
+
+ explicit operator bool() const { return (help_callback != nullptr); }
+ };
+
+ struct ArgumentTableEntry // Entries in the main argument information table
+ {
+ lldb::CommandArgumentType arg_type;
+ const char *arg_name;
+ CommandCompletions::CommonCompletionTypes completion_type;
+ ArgumentHelpCallback help_function;
+ const char *help_text;
+ };
+
+ struct CommandArgumentData // Used to build individual command argument lists
+ {
+ lldb::CommandArgumentType arg_type;
+ ArgumentRepetitionType arg_repetition;
+ uint32_t arg_opt_set_association; // This arg might be associated only with
+ // some particular option set(s).
+ CommandArgumentData()
+ : arg_type(lldb::eArgTypeNone), arg_repetition(eArgRepeatPlain),
+ arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg
+ // associates to all option
+ // sets.
+ {}
+ };
+
+ typedef std::vector<CommandArgumentData>
+ CommandArgumentEntry; // Used to build individual command argument lists
+
+ static ArgumentTableEntry g_arguments_data
+ [lldb::eArgTypeLastArg]; // Main argument information table
+
+ typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
+
+ CommandObject(CommandInterpreter &interpreter, llvm::StringRef name,
+ llvm::StringRef help = "", llvm::StringRef syntax = "",
+ uint32_t flags = 0);
+
+ virtual ~CommandObject();
+
+ static const char *
+ GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
+
+ static const char *
+ GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type);
+
+ CommandInterpreter &GetCommandInterpreter() { return m_interpreter; }
+ Debugger &GetDebugger();
+
+ virtual llvm::StringRef GetHelp();
+
+ virtual llvm::StringRef GetHelpLong();
+
+ virtual llvm::StringRef GetSyntax();
+
+ llvm::StringRef GetCommandName() const;
+
+ virtual void SetHelp(llvm::StringRef str);
+
+ virtual void SetHelpLong(llvm::StringRef str);
+
+ void SetSyntax(llvm::StringRef str);
+
+ // override this to return true if you want to enable the user to delete the
+ // Command object from the Command dictionary (aliases have their own
+ // deletion scheme, so they do not need to care about this)
+ virtual bool IsRemovable() const { return false; }
+
+ virtual bool IsMultiwordObject() { return false; }
+
+ virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; }
+
+ virtual bool IsAlias() { return false; }
+
+ // override this to return true if your command is somehow a "dash-dash" form
+ // of some other command (e.g. po is expr -O --); this is a powerful hint to
+ // the help system that one cannot pass options to this command
+ virtual bool IsDashDashCommand() { return false; }
+
+ virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) {
+ return lldb::CommandObjectSP();
+ }
+
+ virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) {
+ return nullptr;
+ }
+
+ virtual void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
+ StringList &commands_found,
+ StringList &commands_help) {}
+
+ void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help);
+
+ void GenerateHelpText(CommandReturnObject &result);
+
+ virtual void GenerateHelpText(Stream &result);
+
+ // this is needed in order to allow the SBCommand class to transparently try
+ // and load subcommands - it will fail on anything but a multiword command,
+ // but it avoids us doing type checkings and casts
+ virtual bool LoadSubCommand(llvm::StringRef cmd_name,
+ const lldb::CommandObjectSP &command_obj) {
+ return false;
+ }
+
+ virtual bool WantsRawCommandString() = 0;
+
+ // By default, WantsCompletion = !WantsRawCommandString. Subclasses who want
+ // raw command string but desire, for example, argument completion should
+ // override this method to return true.
+ virtual bool WantsCompletion() { return !WantsRawCommandString(); }
+
+ virtual Options *GetOptions();
+
+ static const ArgumentTableEntry *GetArgumentTable();
+
+ static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name);
+
+ static const ArgumentTableEntry *
+ FindArgumentDataByType(lldb::CommandArgumentType arg_type);
+
+ int GetNumArgumentEntries();
+
+ CommandArgumentEntry *GetArgumentEntryAtIndex(int idx);
+
+ static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type,
+ CommandInterpreter &interpreter);
+
+ static const char *GetArgumentName(lldb::CommandArgumentType arg_type);
+
+ // Generates a nicely formatted command args string for help command output.
+ // By default, all possible args are taken into account, for example, '<expr
+ // | variable-name>'. This can be refined by passing a second arg specifying
+ // which option set(s) we are interested, which could then, for example,
+ // produce either '<expr>' or '<variable-name>'.
+ void GetFormattedCommandArguments(Stream &str,
+ uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
+
+ bool IsPairType(ArgumentRepetitionType arg_repeat_type);
+
+ bool ParseOptions(Args &args, CommandReturnObject &result);
+
+ void SetCommandName(llvm::StringRef name);
+
+ /// This default version handles calling option argument completions and then
+ /// calls HandleArgumentCompletion if the cursor is on an argument, not an
+ /// option. Don't override this method, override HandleArgumentCompletion
+ /// instead unless you have special reasons.
+ ///
+ /// \param[in/out] request
+ /// The completion request that needs to be answered.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to make a
+ /// distinction between
+ /// total number of matches, and the window the user wants returned.
+ ///
+ /// \return
+ /// \btrue if we were in an option, \bfalse otherwise.
+ virtual int HandleCompletion(CompletionRequest &request);
+
+ /// The input array contains a parsed version of the line. The insertion
+ /// point is given by cursor_index (the index in input of the word containing
+ /// the cursor) and cursor_char_position (the position of the cursor in that
+ /// word.)
+ /// We've constructed the map of options and their arguments as well if that
+ /// is helpful for the completion.
+ ///
+ /// \param[in/out] request
+ /// The completion request that needs to be answered.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to make a
+ /// distinction between
+ /// total number of matches, and the window the user wants returned.
+ ///
+ /// \return
+ /// The number of completions.
+ virtual int
+ HandleArgumentCompletion(CompletionRequest &request,
+ OptionElementVector &opt_element_vector) {
+ return 0;
+ }
+
+ bool HelpTextContainsWord(llvm::StringRef search_word,
+ bool search_short_help = true,
+ bool search_long_help = true,
+ bool search_syntax = true,
+ bool search_options = true);
+
+ /// The flags accessor.
+ ///
+ /// \return
+ /// A reference to the Flags member variable.
+ Flags &GetFlags() { return m_flags; }
+
+ /// The flags const accessor.
+ ///
+ /// \return
+ /// A const reference to the Flags member variable.
+ const Flags &GetFlags() const { return m_flags; }
+
+ /// Get the command that appropriate for a "repeat" of the current command.
+ ///
+ /// \param[in] current_command_line
+ /// The complete current command line.
+ ///
+ /// \return
+ /// nullptr if there is no special repeat command - it will use the
+ /// current command line.
+ /// Otherwise a pointer to the command to be repeated.
+ /// If the returned string is the empty string, the command won't be
+ /// repeated.
+ virtual const char *GetRepeatCommand(Args ¤t_command_args,
+ uint32_t index) {
+ return nullptr;
+ }
+
+ bool HasOverrideCallback() const {
+ return m_command_override_callback ||
+ m_deprecated_command_override_callback;
+ }
+
+ void SetOverrideCallback(lldb::CommandOverrideCallback callback,
+ void *baton) {
+ m_deprecated_command_override_callback = callback;
+ m_command_override_baton = baton;
+ }
+
+ void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback,
+ void *baton) {
+ m_command_override_callback = callback;
+ m_command_override_baton = baton;
+ }
+
+ bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) {
+ if (m_command_override_callback)
+ return m_command_override_callback(m_command_override_baton, argv,
+ result);
+ else if (m_deprecated_command_override_callback)
+ return m_deprecated_command_override_callback(m_command_override_baton,
+ argv);
+ else
+ return false;
+ }
+
+ virtual bool Execute(const char *args_string,
+ CommandReturnObject &result) = 0;
+
+protected:
+ bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result,
+ OptionGroupOptions &group_options,
+ ExecutionContext &exe_ctx);
+
+ virtual const char *GetInvalidTargetDescription() {
+ return "invalid target, create a target using the 'target create' command";
+ }
+
+ virtual const char *GetInvalidProcessDescription() {
+ return "invalid process";
+ }
+
+ virtual const char *GetInvalidThreadDescription() { return "invalid thread"; }
+
+ virtual const char *GetInvalidFrameDescription() { return "invalid frame"; }
+
+ virtual const char *GetInvalidRegContextDescription() {
+ return "invalid frame, no registers";
+ }
+
+ // This is for use in the command interpreter, when you either want the
+ // selected target, or if no target is present you want to prime the dummy
+ // target with entities that will be copied over to new targets.
+ Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
+ Target *GetDummyTarget();
+
+ // If a command needs to use the "current" thread, use this call. Command
+ // objects will have an ExecutionContext to use, and that may or may not have
+ // a thread in it. If it does, you should use that by default, if not, then
+ // use the ExecutionContext's target's selected thread, etc... This call
+ // insulates you from the details of this calculation.
+ Thread *GetDefaultThread();
+
+ /// Check the command to make sure anything required by this
+ /// command is available.
+ ///
+ /// \param[out] result
+ /// A command result object, if it is not okay to run the command
+ /// this will be filled in with a suitable error.
+ ///
+ /// \return
+ /// \b true if it is okay to run this command, \b false otherwise.
+ bool CheckRequirements(CommandReturnObject &result);
+
+ void Cleanup();
+
+ CommandInterpreter &m_interpreter;
+ ExecutionContext m_exe_ctx;
+ std::unique_lock<std::recursive_mutex> m_api_locker;
+ std::string m_cmd_name;
+ std::string m_cmd_help_short;
+ std::string m_cmd_help_long;
+ std::string m_cmd_syntax;
+ Flags m_flags;
+ std::vector<CommandArgumentEntry> m_arguments;
+ lldb::CommandOverrideCallback m_deprecated_command_override_callback;
+ lldb::CommandOverrideCallbackWithResult m_command_override_callback;
+ void *m_command_override_baton;
+
+ // Helper function to populate IDs or ID ranges as the command argument data
+ // to the specified command argument entry.
+ static void AddIDsArgumentData(CommandArgumentEntry &arg,
+ lldb::CommandArgumentType ID,
+ lldb::CommandArgumentType IDRange);
+};
+
+class CommandObjectParsed : public CommandObject {
+public:
+ CommandObjectParsed(CommandInterpreter &interpreter, const char *name,
+ const char *help = nullptr, const char *syntax = nullptr,
+ uint32_t flags = 0)
+ : CommandObject(interpreter, name, help, syntax, flags) {}
+
+ ~CommandObjectParsed() override = default;
+
+ bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+protected:
+ virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0;
+
+ bool WantsRawCommandString() override { return false; }
+};
+
+class CommandObjectRaw : public CommandObject {
+public:
+ CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name,
+ llvm::StringRef help = "", llvm::StringRef syntax = "",
+ uint32_t flags = 0)
+ : CommandObject(interpreter, name, help, syntax, flags) {}
+
+ ~CommandObjectRaw() override = default;
+
+ bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+protected:
+ virtual bool DoExecute(llvm::StringRef command,
+ CommandReturnObject &result) = 0;
+
+ bool WantsRawCommandString() override { return true; }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObject_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h b/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h
new file mode 100644
index 0000000..660e9d4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -0,0 +1,134 @@
+//===-- CommandObjectMultiword.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectMultiword_h_
+#define liblldb_CommandObjectMultiword_h_
+
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
+
+namespace lldb_private {
+
+// CommandObjectMultiword
+
+class CommandObjectMultiword : public CommandObject {
+ // These two want to iterate over the subcommand dictionary.
+ friend class CommandInterpreter;
+ friend class CommandObjectSyntax;
+
+public:
+ CommandObjectMultiword(CommandInterpreter &interpreter, const char *name,
+ const char *help = nullptr,
+ const char *syntax = nullptr, uint32_t flags = 0);
+
+ ~CommandObjectMultiword() override;
+
+ bool IsMultiwordObject() override { return true; }
+
+ CommandObjectMultiword *GetAsMultiwordCommand() override { return this; }
+
+ bool LoadSubCommand(llvm::StringRef cmd_name,
+ const lldb::CommandObjectSP &command_obj) override;
+
+ void GenerateHelpText(Stream &output_stream) override;
+
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) override;
+
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) override;
+
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
+ StringList &commands_found,
+ StringList &commands_help) override;
+
+ bool WantsRawCommandString() override { return false; }
+
+ int HandleCompletion(CompletionRequest &request) override;
+
+ const char *GetRepeatCommand(Args ¤t_command_args,
+ uint32_t index) override;
+
+ bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+ bool IsRemovable() const override { return m_can_be_removed; }
+
+ void SetRemovable(bool removable) { m_can_be_removed = removable; }
+
+protected:
+ CommandObject::CommandMap &GetSubcommandDictionary() {
+ return m_subcommand_dict;
+ }
+
+ CommandObject::CommandMap m_subcommand_dict;
+ bool m_can_be_removed;
+};
+
+class CommandObjectProxy : public CommandObject {
+public:
+ CommandObjectProxy(CommandInterpreter &interpreter, const char *name,
+ const char *help = nullptr, const char *syntax = nullptr,
+ uint32_t flags = 0);
+
+ ~CommandObjectProxy() override;
+
+ // Subclasses must provide a command object that will be transparently used
+ // for this object.
+ virtual CommandObject *GetProxyCommandObject() = 0;
+
+ llvm::StringRef GetHelpLong() override;
+
+ bool IsRemovable() const override;
+
+ bool IsMultiwordObject() override;
+
+ CommandObjectMultiword *GetAsMultiwordCommand() override;
+
+ void GenerateHelpText(Stream &result) override;
+
+ lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) override;
+
+ CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd,
+ StringList *matches = nullptr) override;
+
+ void AproposAllSubCommands(llvm::StringRef prefix,
+ llvm::StringRef search_word,
+ StringList &commands_found,
+ StringList &commands_help) override;
+
+ bool LoadSubCommand(llvm::StringRef cmd_name,
+ const lldb::CommandObjectSP &command_obj) override;
+
+ bool WantsRawCommandString() override;
+
+ bool WantsCompletion() override;
+
+ Options *GetOptions() override;
+
+ int HandleCompletion(CompletionRequest &request) override;
+
+ int HandleArgumentCompletion(
+ CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override;
+
+ const char *GetRepeatCommand(Args ¤t_command_args,
+ uint32_t index) override;
+
+ bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+protected:
+ // These two want to iterate over the subcommand dictionary.
+ friend class CommandInterpreter;
+ friend class CommandObjectSyntax;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectMultiword_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h b/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h
new file mode 100644
index 0000000..7f06e26
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h
@@ -0,0 +1,59 @@
+//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandObjectRegexCommand_h_
+#define liblldb_CommandObjectRegexCommand_h_
+
+#include <list>
+
+#include "lldb/Interpreter/CommandObject.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/RegularExpression.h"
+
+namespace lldb_private {
+
+// CommandObjectRegexCommand
+
+class CommandObjectRegexCommand : public CommandObjectRaw {
+public:
+ CommandObjectRegexCommand(CommandInterpreter &interpreter, llvm::StringRef name,
+ llvm::StringRef help, llvm::StringRef syntax,
+ uint32_t max_matches, uint32_t completion_type_mask,
+ bool is_removable);
+
+ ~CommandObjectRegexCommand() override;
+
+ bool IsRemovable() const override { return m_is_removable; }
+
+ bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
+
+ bool HasRegexEntries() const { return !m_entries.empty(); }
+
+ int HandleCompletion(CompletionRequest &request) override;
+
+protected:
+ bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
+
+ struct Entry {
+ RegularExpression regex;
+ std::string command;
+ };
+
+ typedef std::list<Entry> EntryCollection;
+ const uint32_t m_max_matches;
+ const uint32_t m_completion_type_mask;
+ EntryCollection m_entries;
+ bool m_is_removable;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CommandObjectRegexCommand);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandObjectRegexCommand_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h b/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h
new file mode 100644
index 0000000..5483c15
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h
@@ -0,0 +1,28 @@
+//===-- CommandOptionValidators.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandOptionValidators_h_
+#define liblldb_CommandOptionValidators_h_
+
+#include "lldb/lldb-private-types.h"
+
+namespace lldb_private {
+
+class Platform;
+class ExecutionContext;
+
+class PosixPlatformCommandOptionValidator : public OptionValidator {
+ bool IsValid(Platform &platform,
+ const ExecutionContext &target) const override;
+ const char *ShortConditionString() const override;
+ const char *LongConditionString() const override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandOptionValidators_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h b/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h
new file mode 100644
index 0000000..a5f6126
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h
@@ -0,0 +1,177 @@
+//===-- CommandReturnObject.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CommandReturnObject_h_
+#define liblldb_CommandReturnObject_h_
+
+#include "lldb/Core/STLUtils.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StreamTee.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FormatVariadic.h"
+
+#include <memory>
+
+namespace lldb_private {
+
+class CommandReturnObject {
+public:
+ CommandReturnObject();
+
+ ~CommandReturnObject();
+
+ llvm::StringRef GetOutputData() {
+ lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
+ if (stream_sp)
+ return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return llvm::StringRef();
+ }
+
+ llvm::StringRef GetErrorData() {
+ lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
+ if (stream_sp)
+ return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return llvm::StringRef();
+ }
+
+ Stream &GetOutputStream() {
+ // Make sure we at least have our normal string stream output stream
+ lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
+ if (!stream_sp) {
+ stream_sp.reset(new StreamString());
+ m_out_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
+ }
+ return m_out_stream;
+ }
+
+ Stream &GetErrorStream() {
+ // Make sure we at least have our normal string stream output stream
+ lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
+ if (!stream_sp) {
+ stream_sp.reset(new StreamString());
+ m_err_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
+ }
+ return m_err_stream;
+ }
+
+ void SetImmediateOutputFile(FILE *fh, bool transfer_fh_ownership = false) {
+ lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+ m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+ }
+
+ void SetImmediateErrorFile(FILE *fh, bool transfer_fh_ownership = false) {
+ lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+ m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+ }
+
+ void SetImmediateOutputStream(const lldb::StreamSP &stream_sp) {
+ m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+ }
+
+ void SetImmediateErrorStream(const lldb::StreamSP &stream_sp) {
+ m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+ }
+
+ lldb::StreamSP GetImmediateOutputStream() {
+ return m_out_stream.GetStreamAtIndex(eImmediateStreamIndex);
+ }
+
+ lldb::StreamSP GetImmediateErrorStream() {
+ return m_err_stream.GetStreamAtIndex(eImmediateStreamIndex);
+ }
+
+ void Clear();
+
+ void AppendMessage(llvm::StringRef in_string);
+
+ void AppendMessageWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ void AppendRawWarning(llvm::StringRef in_string);
+
+ void AppendWarning(llvm::StringRef in_string);
+
+ void AppendWarningWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ void AppendError(llvm::StringRef in_string);
+
+ void AppendRawError(llvm::StringRef in_string);
+
+ void AppendErrorWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ template <typename... Args>
+ void AppendMessageWithFormatv(const char *format, Args &&... args) {
+ AppendMessage(llvm::formatv(format, std::forward<Args>(args)...).str());
+ }
+
+ template <typename... Args>
+ void AppendWarningWithFormatv(const char *format, Args &&... args) {
+ AppendWarning(llvm::formatv(format, std::forward<Args>(args)...).str());
+ }
+
+ template <typename... Args>
+ void AppendErrorWithFormatv(const char *format, Args &&... args) {
+ AppendError(llvm::formatv(format, std::forward<Args>(args)...).str());
+ }
+
+ void SetError(const Status &error, const char *fallback_error_cstr = nullptr);
+
+ void SetError(llvm::StringRef error_cstr);
+
+ lldb::ReturnStatus GetStatus();
+
+ void SetStatus(lldb::ReturnStatus status);
+
+ bool Succeeded();
+
+ bool HasResult();
+
+ bool GetDidChangeProcessState();
+
+ void SetDidChangeProcessState(bool b);
+
+ bool GetInteractive() const;
+
+ void SetInteractive(bool b);
+
+ bool GetAbnormalStopWasExpected() const {
+ return m_abnormal_stop_was_expected;
+ }
+
+ void SetAbnormalStopWasExpected(bool signal_was_expected) {
+ m_abnormal_stop_was_expected = signal_was_expected;
+ }
+
+private:
+ enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
+
+ StreamTee m_out_stream;
+ StreamTee m_err_stream;
+
+ lldb::ReturnStatus m_status;
+ bool m_did_change_process_state;
+ bool m_interactive; // If true, then the input handle from the debugger will
+ // be hooked up
+ bool m_abnormal_stop_was_expected; // This is to support
+ // eHandleCommandFlagStopOnCrash vrs.
+ // attach.
+ // The attach command often ends up with the process stopped due to a signal.
+ // Normally that would mean stop on crash should halt batch execution, but we
+ // obviously don't want that for attach. Using this flag, the attach command
+ // (and anything else for which this is relevant) can say that the signal is
+ // expected, and batch command execution can continue.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CommandReturnObject_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionArgParser.h b/linux-x64/clang/include/lldb/Interpreter/OptionArgParser.h
new file mode 100644
index 0000000..ce901b0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionArgParser.h
@@ -0,0 +1,42 @@
+//===-- OptionArgParser.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_OPTIONARGPARSER_H
+#define LLDB_INTERPRETER_OPTIONARGPARSER_H
+
+#include "lldb/lldb-private-types.h"
+
+namespace lldb_private {
+
+struct OptionArgParser {
+ static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx,
+ llvm::StringRef s, lldb::addr_t fail_value,
+ Status *error);
+
+ static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr);
+
+ static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr);
+
+ static int64_t ToOptionEnum(llvm::StringRef s,
+ const OptionEnumValues &enum_values,
+ int32_t fail_value, Status &error);
+
+ static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s,
+ lldb::ScriptLanguage fail_value,
+ bool *success_ptr);
+
+ // TODO: Use StringRef
+ static Status ToFormat(const char *s, lldb::Format &format,
+ size_t *byte_size_ptr); // If non-NULL, then a
+ // byte size can precede
+ // the format character
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_OPTIONARGPARSER_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h
new file mode 100644
index 0000000..4b7f9fe
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h
@@ -0,0 +1,45 @@
+//===-- OptionGroupArchitecture.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupArchitecture_h_
+#define liblldb_OptionGroupArchitecture_h_
+
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
+
+namespace lldb_private {
+
+// OptionGroupArchitecture
+
+class OptionGroupArchitecture : public OptionGroup {
+public:
+ OptionGroupArchitecture();
+
+ ~OptionGroupArchitecture() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ bool GetArchitecture(Platform *platform, ArchSpec &arch);
+
+ bool ArchitectureWasSpecified() const { return !m_arch_str.empty(); }
+
+ llvm::StringRef GetArchitectureName() const { return m_arch_str; }
+
+protected:
+ std::string m_arch_str; // Save the arch triple in case a platform is
+ // specified after the architecture
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupArchitecture_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h
new file mode 100644
index 0000000..7749045
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h
@@ -0,0 +1,51 @@
+//===-- OptionGroupBoolean.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupBoolean_h_
+#define liblldb_OptionGroupBoolean_h_
+
+#include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+// OptionGroupBoolean
+
+class OptionGroupBoolean : public OptionGroup {
+public:
+ // When 'no_argument_toggle_default' is true, then setting the option value
+ // does NOT require an argument, it sets the boolean value to the inverse of
+ // the default value
+ OptionGroupBoolean(uint32_t usage_mask, bool required,
+ const char *long_option, int short_option,
+ const char *usage_text, bool default_value,
+ bool no_argument_toggle_default);
+
+ ~OptionGroupBoolean() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
+ }
+
+ 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;
+
+ OptionValueBoolean &GetOptionValue() { return m_value; }
+
+ const OptionValueBoolean &GetOptionValue() const { return m_value; }
+
+protected:
+ OptionValueBoolean m_value;
+ OptionDefinition m_option_definition;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupBoolean_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h
new file mode 100644
index 0000000..cce3714
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h
@@ -0,0 +1,81 @@
+//===-- OptionGroupFile.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupFile_h_
+#define liblldb_OptionGroupFile_h_
+
+#include "lldb/Interpreter/OptionValueFileSpec.h"
+#include "lldb/Interpreter/OptionValueFileSpecList.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupFile
+
+class OptionGroupFile : public OptionGroup {
+public:
+ OptionGroupFile(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text);
+
+ ~OptionGroupFile() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
+ }
+
+ 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;
+
+ OptionValueFileSpec &GetOptionValue() { return m_file; }
+
+ const OptionValueFileSpec &GetOptionValue() const { return m_file; }
+
+protected:
+ OptionValueFileSpec m_file;
+ OptionDefinition m_option_definition;
+};
+
+// OptionGroupFileList
+
+class OptionGroupFileList : public OptionGroup {
+public:
+ OptionGroupFileList(uint32_t usage_mask, bool required,
+ const char *long_option, int short_option,
+ uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text);
+
+ ~OptionGroupFileList() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
+ }
+
+ 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;
+
+ OptionValueFileSpecList &GetOptionValue() { return m_file_list; }
+
+ const OptionValueFileSpecList &GetOptionValue() const { return m_file_list; }
+
+protected:
+ OptionValueFileSpecList m_file_list;
+ OptionDefinition m_option_definition;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupFile_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h
new file mode 100644
index 0000000..1b5020a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h
@@ -0,0 +1,81 @@
+//===-- OptionGroupFormat.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupFormat_h_
+#define liblldb_OptionGroupFormat_h_
+
+#include "lldb/Interpreter/OptionValueFormat.h"
+#include "lldb/Interpreter/OptionValueSInt64.h"
+#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupFormat
+
+class OptionGroupFormat : public OptionGroup {
+public:
+ static const uint32_t OPTION_GROUP_FORMAT = LLDB_OPT_SET_1;
+ static const uint32_t OPTION_GROUP_GDB_FMT = LLDB_OPT_SET_2;
+ static const uint32_t OPTION_GROUP_SIZE = LLDB_OPT_SET_3;
+ static const uint32_t OPTION_GROUP_COUNT = LLDB_OPT_SET_4;
+
+ OptionGroupFormat(
+ lldb::Format default_format,
+ uint64_t default_byte_size =
+ UINT64_MAX, // Pass UINT64_MAX to disable the "--size" option
+ uint64_t default_count =
+ UINT64_MAX); // Pass UINT64_MAX to disable the "--count" option
+
+ ~OptionGroupFormat() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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::Format GetFormat() const { return m_format.GetCurrentValue(); }
+
+ OptionValueFormat &GetFormatValue() { return m_format; }
+
+ const OptionValueFormat &GetFormatValue() const { return m_format; }
+
+ OptionValueUInt64 &GetByteSizeValue() { return m_byte_size; }
+
+ const OptionValueUInt64 &GetByteSizeValue() const { return m_byte_size; }
+
+ OptionValueUInt64 &GetCountValue() { return m_count; }
+
+ const OptionValueUInt64 &GetCountValue() const { return m_count; }
+
+ bool HasGDBFormat() const { return m_has_gdb_format; }
+
+ bool AnyOptionWasSet() const {
+ return m_format.OptionWasSet() || m_byte_size.OptionWasSet() ||
+ m_count.OptionWasSet();
+ }
+
+protected:
+ bool ParserGDBFormatLetter(ExecutionContext *execution_context,
+ char format_letter, lldb::Format &format,
+ uint32_t &byte_size);
+
+ OptionValueFormat m_format;
+ OptionValueUInt64 m_byte_size;
+ OptionValueUInt64 m_count;
+ char m_prev_gdb_format;
+ char m_prev_gdb_size;
+ bool m_has_gdb_format;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupFormat_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h
new file mode 100644
index 0000000..82d68b7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h
@@ -0,0 +1,48 @@
+//===-- OptionGroupOutputFile.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupOutputFile_h_
+#define liblldb_OptionGroupOutputFile_h_
+
+#include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/OptionValueFileSpec.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+// OptionGroupOutputFile
+
+class OptionGroupOutputFile : public OptionGroup {
+public:
+ OptionGroupOutputFile();
+
+ ~OptionGroupOutputFile() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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;
+
+ const OptionValueFileSpec &GetFile() { return m_file; }
+
+ const OptionValueBoolean &GetAppend() { return m_append; }
+
+ bool AnyOptionWasSet() const {
+ return m_file.OptionWasSet() || m_append.OptionWasSet();
+ }
+
+protected:
+ OptionValueFileSpec m_file;
+ OptionValueBoolean m_append;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupOutputFile_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h
new file mode 100644
index 0000000..ea5a3f3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -0,0 +1,73 @@
+//===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupPlatform_h_
+#define liblldb_OptionGroupPlatform_h_
+
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ConstString.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+// PlatformOptionGroup
+//
+// Make platform options available to any commands that need the settings.
+class OptionGroupPlatform : public OptionGroup {
+public:
+ OptionGroupPlatform(bool include_platform_option)
+ : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
+ m_include_platform_option(include_platform_option) {}
+
+ ~OptionGroupPlatform() override = default;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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, Status &error,
+ ArchSpec &platform_arch) const;
+
+ bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
+
+ void SetPlatformName(const char *platform_name) {
+ if (platform_name && platform_name[0])
+ m_platform_name.assign(platform_name);
+ else
+ m_platform_name.clear();
+ }
+
+ ConstString GetSDKRootDirectory() const { return m_sdk_sysroot; }
+
+ void SetSDKRootDirectory(ConstString sdk_root_directory) {
+ m_sdk_sysroot = sdk_root_directory;
+ }
+
+ ConstString GetSDKBuild() const { return m_sdk_build; }
+
+ void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; }
+
+ bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
+
+protected:
+ std::string m_platform_name;
+ ConstString m_sdk_sysroot;
+ ConstString m_sdk_build;
+ llvm::VersionTuple m_os_version;
+ bool m_include_platform_option;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupPlatform_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h
new file mode 100644
index 0000000..ce10589
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h
@@ -0,0 +1,48 @@
+//===-- OptionGroupString.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupString_h_
+#define liblldb_OptionGroupString_h_
+
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+// OptionGroupString
+
+class OptionGroupString : public OptionGroup {
+public:
+ OptionGroupString(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text, const char *default_value);
+
+ ~OptionGroupString() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
+ }
+
+ 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;
+
+ OptionValueString &GetOptionValue() { return m_value; }
+
+ const OptionValueString &GetOptionValue() const { return m_value; }
+
+protected:
+ OptionValueString m_value;
+ OptionDefinition m_option_definition;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupString_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h
new file mode 100644
index 0000000..12f08a3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h
@@ -0,0 +1,49 @@
+//===-- OptionGroupUInt64.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupUInt64_h_
+#define liblldb_OptionGroupUInt64_h_
+
+#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupUInt64
+
+class OptionGroupUInt64 : public OptionGroup {
+public:
+ OptionGroupUInt64(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text, uint64_t default_value);
+
+ ~OptionGroupUInt64() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
+ }
+
+ 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;
+
+ OptionValueUInt64 &GetOptionValue() { return m_value; }
+
+ const OptionValueUInt64 &GetOptionValue() const { return m_value; }
+
+protected:
+ OptionValueUInt64 m_value;
+ OptionDefinition m_option_definition;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupUInt64_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h
new file mode 100644
index 0000000..22fc3a1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h
@@ -0,0 +1,41 @@
+//===-- OptionGroupUUID.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupUUID_h_
+#define liblldb_OptionGroupUUID_h_
+
+#include "lldb/Interpreter/OptionValueUUID.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupUUID
+
+class OptionGroupUUID : public OptionGroup {
+public:
+ OptionGroupUUID();
+
+ ~OptionGroupUUID() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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;
+
+ const OptionValueUUID &GetOptionValue() const { return m_uuid; }
+
+protected:
+ OptionValueUUID m_uuid;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupUUID_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
new file mode 100644
index 0000000..5a1bbc9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
@@ -0,0 +1,58 @@
+//===-- OptionGroupValueObjectDisplay.h -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupValueObjectDisplay_h_
+#define liblldb_OptionGroupValueObjectDisplay_h_
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupValueObjectDisplay
+
+class OptionGroupValueObjectDisplay : public OptionGroup {
+public:
+ OptionGroupValueObjectDisplay();
+
+ ~OptionGroupValueObjectDisplay() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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;
+
+ bool AnyOptionWasSet() const {
+ return show_types || no_summary_depth != 0 || show_location ||
+ flat_output || use_objc || max_depth != UINT32_MAX ||
+ ptr_depth != 0 || !use_synth || be_raw || ignore_cap ||
+ run_validator;
+ }
+
+ DumpValueObjectOptions GetAsDumpOptions(
+ LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity =
+ eLanguageRuntimeDescriptionDisplayVerbosityFull,
+ lldb::Format format = lldb::eFormatDefault,
+ lldb::TypeSummaryImplSP summary_sp = lldb::TypeSummaryImplSP());
+
+ bool show_types : 1, show_location : 1, flat_output : 1, use_objc : 1,
+ use_synth : 1, be_raw : 1, ignore_cap : 1, run_validator : 1;
+
+ uint32_t no_summary_depth;
+ uint32_t max_depth;
+ uint32_t ptr_depth;
+ uint32_t elem_count;
+ lldb::DynamicValueType use_dynamic;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupValueObjectDisplay_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h
new file mode 100644
index 0000000..0c042f4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h
@@ -0,0 +1,49 @@
+//===-- OptionGroupVariable.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupVariable_h_
+#define liblldb_OptionGroupVariable_h_
+
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupVariable
+
+class OptionGroupVariable : public OptionGroup {
+public:
+ OptionGroupVariable(bool show_frame_options);
+
+ ~OptionGroupVariable() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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;
+
+ bool include_frame_options : 1,
+ show_args : 1, // Frame option only (include_frame_options == true)
+ show_recognized_args : 1, // Frame option only (include_frame_options ==
+ // true)
+ show_locals : 1, // Frame option only (include_frame_options == true)
+ show_globals : 1, // Frame option only (include_frame_options == true)
+ use_regex : 1, show_scope : 1, show_decl : 1;
+ OptionValueString summary; // the name of a named summary
+ OptionValueString summary_string; // a summary string
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupVariable);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupVariable_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h
new file mode 100644
index 0000000..3729c00
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h
@@ -0,0 +1,54 @@
+//===-- OptionGroupWatchpoint.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionGroupWatchpoint_h_
+#define liblldb_OptionGroupWatchpoint_h_
+
+#include "lldb/Interpreter/Options.h"
+
+namespace lldb_private {
+
+// OptionGroupWatchpoint
+
+class OptionGroupWatchpoint : public OptionGroup {
+public:
+ OptionGroupWatchpoint();
+
+ ~OptionGroupWatchpoint() override;
+
+ static bool IsWatchSizeSupported(uint32_t watch_size);
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ 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;
+
+ // Note:
+ // eWatchRead == LLDB_WATCH_TYPE_READ; and
+ // eWatchWrite == LLDB_WATCH_TYPE_WRITE
+ enum WatchType {
+ eWatchInvalid = 0,
+ eWatchRead,
+ eWatchWrite,
+ eWatchReadWrite
+ };
+
+ WatchType watch_type;
+ uint32_t watch_size;
+ bool watch_type_specified;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionGroupWatchpoint_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValue.h b/linux-x64/clang/include/lldb/Interpreter/OptionValue.h
new file mode 100644
index 0000000..0b85bc1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValue.h
@@ -0,0 +1,337 @@
+//===-- OptionValue.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValue_h_
+#define liblldb_OptionValue_h_
+
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Utility/CompletionRequest.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 {
+
+// OptionValue
+class OptionValue {
+public:
+ enum Type {
+ eTypeInvalid = 0,
+ eTypeArch,
+ eTypeArgs,
+ eTypeArray,
+ eTypeBoolean,
+ eTypeChar,
+ eTypeDictionary,
+ eTypeEnum,
+ eTypeFileSpec,
+ eTypeFileSpecList,
+ eTypeFormat,
+ eTypeLanguage,
+ eTypePathMap,
+ eTypeProperties,
+ eTypeRegex,
+ eTypeSInt64,
+ eTypeString,
+ eTypeUInt64,
+ eTypeUUID,
+ eTypeFormatEntity
+ };
+
+ enum {
+ eDumpOptionName = (1u << 0),
+ eDumpOptionType = (1u << 1),
+ eDumpOptionValue = (1u << 2),
+ eDumpOptionDescription = (1u << 3),
+ eDumpOptionRaw = (1u << 4),
+ eDumpOptionCommand = (1u << 5),
+ eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue),
+ eDumpGroupHelp =
+ (eDumpOptionName | eDumpOptionType | eDumpOptionDescription),
+ eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue)
+ };
+
+ OptionValue()
+ : m_callback(nullptr), m_baton(nullptr), m_value_was_set(false) {}
+
+ OptionValue(const OptionValue &rhs)
+ : m_callback(rhs.m_callback), m_baton(rhs.m_baton),
+ m_value_was_set(rhs.m_value_was_set) {}
+
+ virtual ~OptionValue() = default;
+
+ // Subclasses should override these functions
+ virtual Type GetType() const = 0;
+
+ // If this value is always hidden, the avoid showing any info on this value,
+ // just show the info for the child values.
+ virtual bool ValueIsTransparent() const {
+ return GetType() == eTypeProperties;
+ }
+
+ virtual const char *GetTypeAsCString() const {
+ return GetBuiltinTypeAsCString(GetType());
+ }
+
+ static const char *GetBuiltinTypeAsCString(Type t);
+
+ virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) = 0;
+
+ virtual Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign);
+
+ virtual bool Clear() = 0;
+
+ virtual lldb::OptionValueSP DeepCopy() const = 0;
+
+ virtual size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request);
+
+ // Subclasses can override these functions
+ virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ 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 Status SetSubValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op, llvm::StringRef name,
+ llvm::StringRef value);
+
+ virtual bool IsAggregateValue() const { return false; }
+
+ virtual ConstString GetName() const { return ConstString(); }
+
+ virtual bool DumpQualifiedName(Stream &strm) const;
+
+ // Subclasses should NOT override these functions as they use the above
+ // functions to implement functionality
+ uint32_t GetTypeAsMask() { return 1u << GetType(); }
+
+ static uint32_t ConvertTypeToMask(OptionValue::Type type) {
+ return 1u << type;
+ }
+
+ static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask) {
+ // If only one bit is set, then return an appropriate enumeration
+ switch (type_mask) {
+ case 1u << eTypeArch:
+ return eTypeArch;
+ case 1u << eTypeArgs:
+ return eTypeArgs;
+ case 1u << eTypeArray:
+ return eTypeArray;
+ case 1u << eTypeBoolean:
+ return eTypeBoolean;
+ case 1u << eTypeChar:
+ return eTypeChar;
+ case 1u << eTypeDictionary:
+ return eTypeDictionary;
+ case 1u << eTypeEnum:
+ return eTypeEnum;
+ case 1u << eTypeFileSpec:
+ return eTypeFileSpec;
+ case 1u << eTypeFileSpecList:
+ return eTypeFileSpecList;
+ case 1u << eTypeFormat:
+ return eTypeFormat;
+ case 1u << eTypeLanguage:
+ return eTypeLanguage;
+ case 1u << eTypePathMap:
+ return eTypePathMap;
+ case 1u << eTypeProperties:
+ return eTypeProperties;
+ case 1u << eTypeRegex:
+ return eTypeRegex;
+ case 1u << eTypeSInt64:
+ return eTypeSInt64;
+ case 1u << eTypeString:
+ return eTypeString;
+ case 1u << eTypeUInt64:
+ return eTypeUInt64;
+ case 1u << eTypeUUID:
+ return eTypeUUID;
+ }
+ // Else return invalid
+ return eTypeInvalid;
+ }
+
+ static lldb::OptionValueSP
+ CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask,
+ 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 returned
+ uint64_t GetUInt64Value(uint64_t fail_value, bool *success_ptr);
+
+ OptionValueArch *GetAsArch();
+
+ const OptionValueArch *GetAsArch() const;
+
+ OptionValueArray *GetAsArray();
+
+ const OptionValueArray *GetAsArray() const;
+
+ OptionValueArgs *GetAsArgs();
+
+ const OptionValueArgs *GetAsArgs() const;
+
+ OptionValueBoolean *GetAsBoolean();
+
+ OptionValueChar *GetAsChar();
+
+ const OptionValueBoolean *GetAsBoolean() const;
+
+ const OptionValueChar *GetAsChar() const;
+
+ OptionValueDictionary *GetAsDictionary();
+
+ const OptionValueDictionary *GetAsDictionary() const;
+
+ OptionValueEnumeration *GetAsEnumeration();
+
+ const OptionValueEnumeration *GetAsEnumeration() const;
+
+ OptionValueFileSpec *GetAsFileSpec();
+
+ const OptionValueFileSpec *GetAsFileSpec() const;
+
+ OptionValueFileSpecList *GetAsFileSpecList();
+
+ const OptionValueFileSpecList *GetAsFileSpecList() const;
+
+ OptionValueFormat *GetAsFormat();
+
+ const OptionValueFormat *GetAsFormat() const;
+
+ OptionValueLanguage *GetAsLanguage();
+
+ const OptionValueLanguage *GetAsLanguage() const;
+
+ OptionValuePathMappings *GetAsPathMappings();
+
+ const OptionValuePathMappings *GetAsPathMappings() const;
+
+ OptionValueProperties *GetAsProperties();
+
+ const OptionValueProperties *GetAsProperties() const;
+
+ OptionValueRegex *GetAsRegex();
+
+ const OptionValueRegex *GetAsRegex() const;
+
+ OptionValueSInt64 *GetAsSInt64();
+
+ const OptionValueSInt64 *GetAsSInt64() const;
+
+ OptionValueString *GetAsString();
+
+ const OptionValueString *GetAsString() const;
+
+ OptionValueUInt64 *GetAsUInt64();
+
+ const OptionValueUInt64 *GetAsUInt64() const;
+
+ OptionValueUUID *GetAsUUID();
+
+ const OptionValueUUID *GetAsUUID() const;
+
+ OptionValueFormatEntity *GetAsFormatEntity();
+
+ const OptionValueFormatEntity *GetAsFormatEntity() const;
+
+ bool GetBooleanValue(bool fail_value = false) const;
+
+ bool SetBooleanValue(bool new_value);
+
+ char GetCharValue(char fail_value) const;
+
+ char SetCharValue(char new_value);
+
+ int64_t GetEnumerationValue(int64_t fail_value = -1) const;
+
+ bool SetEnumerationValue(int64_t value);
+
+ FileSpec GetFileSpecValue() const;
+
+ bool SetFileSpecValue(const FileSpec &file_spec);
+
+ FileSpecList GetFileSpecListValue() const;
+
+ lldb::Format
+ GetFormatValue(lldb::Format fail_value = lldb::eFormatDefault) const;
+
+ bool SetFormatValue(lldb::Format new_value);
+
+ lldb::LanguageType GetLanguageValue(
+ lldb::LanguageType fail_value = lldb::eLanguageTypeUnknown) const;
+
+ bool SetLanguageValue(lldb::LanguageType new_language);
+
+ const FormatEntity::Entry *GetFormatEntity() const;
+
+ const RegularExpression *GetRegexValue() const;
+
+ int64_t GetSInt64Value(int64_t fail_value = 0) const;
+
+ bool SetSInt64Value(int64_t new_value);
+
+ llvm::StringRef GetStringValue(llvm::StringRef fail_value) const;
+ llvm::StringRef GetStringValue() const { return GetStringValue(llvm::StringRef()); }
+
+ bool SetStringValue(llvm::StringRef new_value);
+
+ uint64_t GetUInt64Value(uint64_t fail_value = 0) const;
+
+ bool SetUInt64Value(uint64_t new_value);
+
+ UUID GetUUIDValue() const;
+
+ bool SetUUIDValue(const UUID &uuid);
+
+ bool OptionWasSet() const { return m_value_was_set; }
+
+ void SetOptionWasSet() { m_value_was_set = true; }
+
+ void SetParent(const lldb::OptionValueSP &parent_sp) {
+ m_parent_wp = parent_sp;
+ }
+
+ void SetValueChangedCallback(OptionValueChangedCallback callback,
+ void *baton) {
+ assert(m_callback == nullptr);
+ m_callback = callback;
+ m_baton = baton;
+ }
+
+ void NotifyValueChanged() {
+ if (m_callback)
+ m_callback(m_baton, this);
+ }
+
+protected:
+ lldb::OptionValueWP m_parent_wp;
+ OptionValueChangedCallback m_callback;
+ void *m_baton;
+ bool m_value_was_set; // This can be used to see if a value has been set
+ // by a call to SetValueFromCString(). It is often
+ // handy to know if an option value was set from the
+ // command line or as a setting, versus if we just have
+ // the default value that was already populated in the
+ // option value.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValue_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h
new file mode 100644
index 0000000..f8f4068
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h
@@ -0,0 +1,84 @@
+//===-- OptionValueArch.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueArch_h_
+#define liblldb_OptionValueArch_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/CompletionRequest.h"
+
+namespace lldb_private {
+
+class OptionValueArch : public OptionValue {
+public:
+ OptionValueArch() : OptionValue(), m_current_value(), m_default_value() {}
+
+ OptionValueArch(const char *triple)
+ : OptionValue(), m_current_value(triple), m_default_value() {
+ m_default_value = m_current_value;
+ }
+
+ OptionValueArch(const ArchSpec &value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueArch(const ArchSpec ¤t_value, const ArchSpec &default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueArch() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeArch; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ lldb_private::CompletionRequest &request) override;
+
+ // Subclass specific functions
+
+ ArchSpec &GetCurrentValue() { return m_current_value; }
+
+ const ArchSpec &GetCurrentValue() const { return m_current_value; }
+
+ const ArchSpec &GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
+ m_current_value = value;
+ if (set_value_was_set)
+ m_value_was_set = true;
+ }
+
+ void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
+
+protected:
+ ArchSpec m_current_value;
+ ArchSpec m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueArch_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h
new file mode 100644
index 0000000..0254b9a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h
@@ -0,0 +1,31 @@
+//===-- OptionValueArgs.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueArgs_h_
+#define liblldb_OptionValueArgs_h_
+
+#include "lldb/Interpreter/OptionValueArray.h"
+
+namespace lldb_private {
+
+class OptionValueArgs : public OptionValueArray {
+public:
+ OptionValueArgs()
+ : OptionValueArray(
+ OptionValue::ConvertTypeToMask(OptionValue::eTypeString)) {}
+
+ ~OptionValueArgs() override {}
+
+ size_t GetArgs(Args &args);
+
+ Type GetType() const override { return eTypeArgs; }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueArgs_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h
new file mode 100644
index 0000000..10f3bf5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h
@@ -0,0 +1,128 @@
+//===-- OptionValueArray.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueArray_h_
+#define liblldb_OptionValueArray_h_
+
+#include <vector>
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueArray : public OptionValue {
+public:
+ OptionValueArray(uint32_t type_mask = UINT32_MAX, bool raw_value_dump = false)
+ : m_type_mask(type_mask), m_values(), m_raw_value_dump(raw_value_dump) {}
+
+ ~OptionValueArray() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeArray; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_values.clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ llvm::StringRef name, bool will_modify,
+ Status &error) const override;
+
+ // Subclass specific functions
+
+ size_t GetSize() const { return m_values.size(); }
+
+ lldb::OptionValueSP operator[](size_t idx) const {
+ lldb::OptionValueSP value_sp;
+ if (idx < m_values.size())
+ value_sp = m_values[idx];
+ return value_sp;
+ }
+
+ lldb::OptionValueSP GetValueAtIndex(size_t idx) const {
+ lldb::OptionValueSP value_sp;
+ if (idx < m_values.size())
+ value_sp = m_values[idx];
+ return value_sp;
+ }
+
+ bool AppendValue(const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain values of the type
+ // passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ m_values.push_back(value_sp);
+ return true;
+ }
+ return false;
+ }
+
+ bool InsertValue(size_t idx, const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain values of the type
+ // passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ if (idx < m_values.size())
+ m_values.insert(m_values.begin() + idx, value_sp);
+ else
+ m_values.push_back(value_sp);
+ return true;
+ }
+ return false;
+ }
+
+ bool ReplaceValue(size_t idx, const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain values of the type
+ // passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ if (idx < m_values.size()) {
+ m_values[idx] = value_sp;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool DeleteValue(size_t idx) {
+ if (idx < m_values.size()) {
+ m_values.erase(m_values.begin() + idx);
+ return true;
+ }
+ return false;
+ }
+
+ size_t GetArgs(Args &args) const;
+
+ Status SetArgs(const Args &args, VarSetOperationType op);
+
+protected:
+ typedef std::vector<lldb::OptionValueSP> collection;
+
+ uint32_t m_type_mask;
+ collection m_values;
+ bool m_raw_value_dump;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueArray_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h
new file mode 100644
index 0000000..2fc97d4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h
@@ -0,0 +1,88 @@
+//===-- OptionValueBoolean.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueBoolean_h_
+#define liblldb_OptionValueBoolean_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueBoolean : public OptionValue {
+public:
+ OptionValueBoolean(bool value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+ OptionValueBoolean(bool current_value, bool default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueBoolean() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeBoolean; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+ // Subclass specific functions
+
+ /// Convert to bool operator.
+ ///
+ /// This allows code to check a OptionValueBoolean in conditions.
+ ///
+ /// \code
+ /// OptionValueBoolean bool_value(...);
+ /// if (bool_value)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// /b True this object contains a valid namespace decl, \b
+ /// false otherwise.
+ explicit operator bool() const { return m_current_value; }
+
+ const bool &operator=(bool b) {
+ m_current_value = b;
+ return m_current_value;
+ }
+
+ bool GetCurrentValue() const { return m_current_value; }
+
+ bool GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(bool value) { m_current_value = value; }
+
+ void SetDefaultValue(bool value) { m_default_value = value; }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+protected:
+ bool m_current_value;
+ bool m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueBoolean_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h
new file mode 100644
index 0000000..d866136
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h
@@ -0,0 +1,71 @@
+//===-- OptionValueChar.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueChar_h_
+#define liblldb_OptionValueChar_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueChar : public OptionValue {
+public:
+ OptionValueChar(char value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueChar(char current_value, char default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueChar() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeChar; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ // Subclass specific functions
+
+ const char &operator=(char c) {
+ m_current_value = c;
+ return m_current_value;
+ }
+
+ char GetCurrentValue() const { return m_current_value; }
+
+ char GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(char value) { m_current_value = value; }
+
+ void SetDefaultValue(char value) { m_default_value = value; }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+protected:
+ char m_current_value;
+ char m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueChar_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h
new file mode 100644
index 0000000..8785d38
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h
@@ -0,0 +1,84 @@
+//===-- OptionValueDictionary.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueDictionary_h_
+#define liblldb_OptionValueDictionary_h_
+
+#include <map>
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueDictionary : public OptionValue {
+public:
+ OptionValueDictionary(uint32_t type_mask = UINT32_MAX,
+ bool raw_value_dump = true)
+ : OptionValue(), m_type_mask(type_mask), m_values(),
+ m_raw_value_dump(raw_value_dump) {}
+
+ ~OptionValueDictionary() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeDictionary; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_values.clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ bool IsHomogenous() const {
+ return ConvertTypeMaskToType(m_type_mask) != eTypeInvalid;
+ }
+
+ // Subclass specific functions
+
+ size_t GetNumValues() const { return m_values.size(); }
+
+ lldb::OptionValueSP GetValueForKey(ConstString key) const;
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ llvm::StringRef name, bool will_modify,
+ Status &error) const override;
+
+ Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
+ llvm::StringRef name, llvm::StringRef value) override;
+
+ bool SetValueForKey(ConstString key,
+ const lldb::OptionValueSP &value_sp,
+ bool can_replace = true);
+
+ bool DeleteValueForKey(ConstString key);
+
+ size_t GetArgs(Args &args) const;
+
+ Status SetArgs(const Args &args, VarSetOperationType op);
+
+protected:
+ typedef std::map<ConstString, lldb::OptionValueSP> collection;
+ uint32_t m_type_mask;
+ collection m_values;
+ bool m_raw_value_dump;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueDictionary_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h
new file mode 100644
index 0000000..71f3ab5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -0,0 +1,86 @@
+//===-- OptionValueEnumeration.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueEnumeration_h_
+#define liblldb_OptionValueEnumeration_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 {
+
+class OptionValueEnumeration : public OptionValue {
+public:
+ typedef int64_t enum_type;
+ struct EnumeratorInfo {
+ enum_type value;
+ const char *description;
+ };
+ typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
+ typedef EnumerationMap::Entry EnumerationMapEntry;
+
+ OptionValueEnumeration(const OptionEnumValues &enumerators, enum_type value);
+
+ ~OptionValueEnumeration() override;
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeEnum; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+ // Subclass specific functions
+
+ enum_type operator=(enum_type value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ enum_type GetCurrentValue() const { return m_current_value; }
+
+ enum_type GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(enum_type value) { m_current_value = value; }
+
+ void SetDefaultValue(enum_type value) { m_default_value = value; }
+
+protected:
+ void SetEnumerations(const OptionEnumValues &enumerators);
+
+ enum_type m_current_value;
+ enum_type m_default_value;
+ EnumerationMap m_enumerations;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueEnumeration_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h
new file mode 100644
index 0000000..aa1022a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h
@@ -0,0 +1,89 @@
+//===-- OptionValueFileSpec.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueFileSpec_h_
+#define liblldb_OptionValueFileSpec_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/Chrono.h"
+
+namespace lldb_private {
+
+class OptionValueFileSpec : public OptionValue {
+public:
+ OptionValueFileSpec(bool resolve = true);
+
+ OptionValueFileSpec(const FileSpec &value, bool resolve = true);
+
+ OptionValueFileSpec(const FileSpec ¤t_value,
+ const FileSpec &default_value, bool resolve = true);
+
+ ~OptionValueFileSpec() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeFileSpec; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ m_data_sp.reset();
+ m_data_mod_time = llvm::sys::TimePoint<>();
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+ // Subclass specific functions
+
+ FileSpec &GetCurrentValue() { return m_current_value; }
+
+ const FileSpec &GetCurrentValue() const { return m_current_value; }
+
+ const FileSpec &GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
+ m_current_value = value;
+ if (set_value_was_set)
+ m_value_was_set = true;
+ m_data_sp.reset();
+ }
+
+ void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
+
+ const lldb::DataBufferSP &GetFileContents();
+
+ void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
+
+protected:
+ FileSpec m_current_value;
+ FileSpec m_default_value;
+ lldb::DataBufferSP m_data_sp;
+ llvm::sys::TimePoint<> m_data_mod_time;
+ uint32_t m_completion_mask;
+ bool m_resolve;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueFileSpec_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h
new file mode 100644
index 0000000..5607437
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h
@@ -0,0 +1,77 @@
+//===-- OptionValueFileSpecList.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueFileSpecList_h_
+#define liblldb_OptionValueFileSpecList_h_
+
+#include <mutex>
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueFileSpecList : public OptionValue {
+public:
+ OptionValueFileSpecList() : OptionValue(), m_current_value() {}
+
+ OptionValueFileSpecList(const FileSpecList ¤t_value)
+ : OptionValue(), m_current_value(current_value) {}
+
+ ~OptionValueFileSpecList() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeFileSpecList; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
+ m_current_value.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ // Subclass specific functions
+
+ FileSpecList GetCurrentValue() const {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
+ return m_current_value;
+ }
+
+ void SetCurrentValue(const FileSpecList &value) {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
+ m_current_value = value;
+ }
+
+ void AppendCurrentValue(const FileSpec &value) {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
+ m_current_value.Append(value);
+ }
+
+protected:
+ mutable std::recursive_mutex m_mutex;
+ FileSpecList m_current_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueFileSpecList_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h
new file mode 100644
index 0000000..020f4ae
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h
@@ -0,0 +1,66 @@
+//===-- OptionValueFormat.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueFormat_h_
+#define liblldb_OptionValueFormat_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueFormat : public OptionValue {
+public:
+ OptionValueFormat(lldb::Format value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueFormat() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeFormat; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ lldb::Format GetCurrentValue() const { return m_current_value; }
+
+ lldb::Format GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(lldb::Format value) { m_current_value = value; }
+
+ void SetDefaultValue(lldb::Format value) { m_default_value = value; }
+
+protected:
+ lldb::Format m_current_value;
+ lldb::Format m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueFormat_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h
new file mode 100644
index 0000000..b05be95
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h
@@ -0,0 +1,67 @@
+//===-- OptionValueFormatEntity.h --------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueFormatEntity_h_
+#define liblldb_OptionValueFormatEntity_h_
+
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueFormatEntity : public OptionValue {
+public:
+ OptionValueFormatEntity(const char *default_format);
+
+ ~OptionValueFormatEntity() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeFormatEntity; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override;
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+ // Subclass specific functions
+
+ FormatEntity::Entry &GetCurrentValue() { return m_current_entry; }
+
+ const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; }
+
+ void SetCurrentValue(const FormatEntity::Entry &value) {
+ m_current_entry = value;
+ }
+
+ FormatEntity::Entry &GetDefaultValue() { return m_default_entry; }
+
+ const FormatEntity::Entry &GetDefaultValue() const { return m_default_entry; }
+
+protected:
+ std::string m_current_format;
+ std::string m_default_format;
+ FormatEntity::Entry m_current_entry;
+ FormatEntity::Entry m_default_entry;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueFormatEntity_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h
new file mode 100644
index 0000000..505dc89
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h
@@ -0,0 +1,69 @@
+//===-- OptionValueLanguage.h -------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueLanguage_h_
+#define liblldb_OptionValueLanguage_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/lldb-enumerations.h"
+
+namespace lldb_private {
+
+class OptionValueLanguage : public OptionValue {
+public:
+ OptionValueLanguage(lldb::LanguageType value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueLanguage(lldb::LanguageType current_value,
+ lldb::LanguageType default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueLanguage() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeLanguage; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ lldb::LanguageType GetCurrentValue() const { return m_current_value; }
+
+ lldb::LanguageType GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(lldb::LanguageType value) { m_current_value = value; }
+
+ void SetDefaultValue(lldb::LanguageType value) { m_default_value = value; }
+
+protected:
+ lldb::LanguageType m_current_value;
+ lldb::LanguageType m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueLanguage_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h b/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h
new file mode 100644
index 0000000..35c2af4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h
@@ -0,0 +1,61 @@
+//===-- OptionValuePathMappings.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValuePathMappings_h_
+#define liblldb_OptionValuePathMappings_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Target/PathMappingList.h"
+
+namespace lldb_private {
+
+class OptionValuePathMappings : public OptionValue {
+public:
+ OptionValuePathMappings(bool notify_changes)
+ : OptionValue(), m_path_mappings(), m_notify_changes(notify_changes) {}
+
+ ~OptionValuePathMappings() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypePathMap; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_path_mappings.Clear(m_notify_changes);
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ // Subclass specific functions
+
+ PathMappingList &GetCurrentValue() { return m_path_mappings; }
+
+ const PathMappingList &GetCurrentValue() const { return m_path_mappings; }
+
+protected:
+ PathMappingList m_path_mappings;
+ bool m_notify_changes;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValuePathMappings_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h
new file mode 100644
index 0000000..bea2b3c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h
@@ -0,0 +1,222 @@
+//===-- OptionValueProperties.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueProperties_h_
+#define liblldb_OptionValueProperties_h_
+
+#include <vector>
+
+#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 {
+
+class OptionValueProperties
+ : public OptionValue,
+ public std::enable_shared_from_this<OptionValueProperties> {
+public:
+ OptionValueProperties()
+ : OptionValue(), m_name(), m_properties(), m_name_to_index() {}
+
+ OptionValueProperties(ConstString name);
+
+ OptionValueProperties(const OptionValueProperties &global_properties);
+
+ ~OptionValueProperties() override = default;
+
+ Type GetType() const override { return eTypeProperties; }
+
+ bool Clear() override;
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ ConstString GetName() const override { return m_name; }
+
+ 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;
+
+ void Apropos(llvm::StringRef keyword,
+ std::vector<const Property *> &matching_properties) const;
+
+ void Initialize(const PropertyDefinitions &setting_definitions);
+
+ // bool
+ // GetQualifiedName (Stream &strm);
+
+ // Subclass specific functions
+
+ virtual size_t GetNumProperties() const;
+
+ // Get the index of a property given its exact name in this property
+ // collection, "name" can't be a path to a property path that refers to a
+ // property within a property
+ virtual uint32_t GetPropertyIndex(ConstString name) const;
+
+ // Get a property by exact name exists in this property collection, name can
+ // not be a path to a property path that refers to a property within a
+ // property
+ virtual const Property *GetProperty(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ ConstString name) const;
+
+ virtual const Property *GetPropertyAtIndex(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ uint32_t idx) const;
+
+ // Property can be be a property path like
+ // "target.process.extra-startup-command"
+ virtual const Property *GetPropertyAtPath(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ llvm::StringRef property_path) const;
+
+ virtual lldb::OptionValueSP
+ GetPropertyValueAtIndex(const ExecutionContext *exe_ctx, bool will_modify,
+ uint32_t idx) const;
+
+ virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
+ ConstString key,
+ bool value_will_be_modified) const;
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ llvm::StringRef name,
+ bool value_will_be_modified,
+ Status &error) const 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 {
+ return false;
+ }
+
+ OptionValueArch *
+ GetPropertyAtIndexAsOptionValueArch(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ OptionValueLanguage *
+ GetPropertyAtIndexAsOptionValueLanguage(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ bool GetPropertyAtIndexAsArgs(const ExecutionContext *exe_ctx, uint32_t idx,
+ Args &args) const;
+
+ bool SetPropertyAtIndexFromArgs(const ExecutionContext *exe_ctx, uint32_t idx,
+ const Args &args);
+
+ bool GetPropertyAtIndexAsBoolean(const ExecutionContext *exe_ctx,
+ uint32_t idx, bool fail_value) const;
+
+ bool SetPropertyAtIndexAsBoolean(const ExecutionContext *exe_ctx,
+ uint32_t idx, bool new_value);
+
+ OptionValueDictionary *
+ GetPropertyAtIndexAsOptionValueDictionary(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ int64_t GetPropertyAtIndexAsEnumeration(const ExecutionContext *exe_ctx,
+ uint32_t idx,
+ int64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsEnumeration(const ExecutionContext *exe_ctx,
+ uint32_t idx, int64_t new_value);
+
+ const FormatEntity::Entry *
+ GetPropertyAtIndexAsFormatEntity(const ExecutionContext *exe_ctx,
+ uint32_t idx);
+
+ const RegularExpression *
+ GetPropertyAtIndexAsOptionValueRegex(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ OptionValueSInt64 *
+ GetPropertyAtIndexAsOptionValueSInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ int64_t GetPropertyAtIndexAsSInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx, int64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsSInt64(const ExecutionContext *exe_ctx, uint32_t idx,
+ int64_t new_value);
+
+ uint64_t GetPropertyAtIndexAsUInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx, uint64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsUInt64(const ExecutionContext *exe_ctx, uint32_t idx,
+ uint64_t new_value);
+
+ llvm::StringRef GetPropertyAtIndexAsString(const ExecutionContext *exe_ctx,
+ uint32_t idx,
+ llvm::StringRef fail_value) const;
+
+ bool SetPropertyAtIndexAsString(const ExecutionContext *exe_ctx, uint32_t idx,
+ llvm::StringRef new_value);
+
+ OptionValueString *
+ GetPropertyAtIndexAsOptionValueString(const ExecutionContext *exe_ctx,
+ bool will_modify, uint32_t idx) const;
+
+ OptionValueFileSpec *
+ GetPropertyAtIndexAsOptionValueFileSpec(const ExecutionContext *exe_ctx,
+ bool will_modify, uint32_t idx) const;
+
+ FileSpec GetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ bool SetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
+ uint32_t idx, const FileSpec &file_spec);
+
+ OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
+ const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
+
+ OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
+ const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
+
+ void AppendProperty(ConstString name, ConstString desc,
+ bool is_global, const lldb::OptionValueSP &value_sp);
+
+ lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
+ ConstString name);
+
+ void SetValueChangedCallback(uint32_t property_idx,
+ OptionValueChangedCallback callback,
+ void *baton);
+
+protected:
+ Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
+ }
+
+ const Property *ProtectedGetPropertyAtIndex(uint32_t idx) const {
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
+ }
+
+ typedef UniqueCStringMap<size_t> NameToIndex;
+
+ ConstString m_name;
+ std::vector<Property> m_properties;
+ NameToIndex m_name_to_index;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueProperties_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h
new file mode 100644
index 0000000..f5b2557
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h
@@ -0,0 +1,66 @@
+//===-- OptionValueRegex.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueRegex_h_
+#define liblldb_OptionValueRegex_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Utility/RegularExpression.h"
+
+namespace lldb_private {
+
+class OptionValueRegex : public OptionValue {
+public:
+ OptionValueRegex(const char *value = nullptr)
+ : OptionValue(), m_regex(llvm::StringRef::withNullAsEmpty(value)) {}
+
+ ~OptionValueRegex() override = default;
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeRegex; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_regex.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+ const RegularExpression *GetCurrentValue() const {
+ return (m_regex.IsValid() ? &m_regex : nullptr);
+ }
+
+ void SetCurrentValue(const char *value) {
+ if (value && value[0])
+ m_regex.Compile(llvm::StringRef(value));
+ else
+ m_regex.Clear();
+ }
+
+ bool IsValid() const { return m_regex.IsValid(); }
+
+protected:
+ RegularExpression m_regex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueRegex_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h
new file mode 100644
index 0000000..c2e8ff4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h
@@ -0,0 +1,105 @@
+//===-- OptionValueSInt64.h --------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueSInt64_h_
+#define liblldb_OptionValueSInt64_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueSInt64 : public OptionValue {
+public:
+ OptionValueSInt64()
+ : OptionValue(), m_current_value(0), m_default_value(0),
+ m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
+
+ OptionValueSInt64(int64_t value)
+ : OptionValue(), m_current_value(value), m_default_value(value),
+ m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
+
+ OptionValueSInt64(int64_t current_value, int64_t default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value), m_min_value(INT64_MIN),
+ m_max_value(INT64_MAX) {}
+
+ OptionValueSInt64(const OptionValueSInt64 &rhs)
+ : OptionValue(rhs), m_current_value(rhs.m_current_value),
+ m_default_value(rhs.m_default_value), m_min_value(rhs.m_min_value),
+ m_max_value(rhs.m_max_value) {}
+
+ ~OptionValueSInt64() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeSInt64; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ const int64_t &operator=(int64_t value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ int64_t GetCurrentValue() const { return m_current_value; }
+
+ int64_t GetDefaultValue() const { return m_default_value; }
+
+ bool SetCurrentValue(int64_t value) {
+ if (value >= m_min_value && value <= m_max_value) {
+ m_current_value = value;
+ return true;
+ }
+ return false;
+ }
+
+ bool SetDefaultValue(int64_t value) {
+ if (value >= m_min_value && value <= m_max_value) {
+ m_default_value = value;
+ return true;
+ }
+ return false;
+ }
+
+ void SetMinimumValue(int64_t v) { m_min_value = v; }
+
+ int64_t GetMinimumValue() const { return m_min_value; }
+
+ void SetMaximumValue(int64_t v) { m_max_value = v; }
+
+ int64_t GetMaximumValue() const { return m_max_value; }
+
+protected:
+ int64_t m_current_value;
+ int64_t m_default_value;
+ int64_t m_min_value;
+ int64_t m_max_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueSInt64_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h
new file mode 100644
index 0000000..d9e76d8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h
@@ -0,0 +1,139 @@
+//===-- OptionValueString.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueString_h_
+#define liblldb_OptionValueString_h_
+
+#include <string>
+
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueString : public OptionValue {
+public:
+ typedef Status (*ValidatorCallback)(const char *string, void *baton);
+
+ enum Options { eOptionEncodeCharacterEscapeSequences = (1u << 0) };
+
+ OptionValueString()
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {}
+
+ OptionValueString(ValidatorCallback validator, void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {}
+
+ OptionValueString(const char *value)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {
+ if (value && value[0]) {
+ m_current_value.assign(value);
+ m_default_value.assign(value);
+ }
+ }
+
+ OptionValueString(const char *current_value, const char *default_value)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {
+ if (current_value && current_value[0])
+ m_current_value.assign(current_value);
+ if (default_value && default_value[0])
+ m_default_value.assign(default_value);
+ }
+
+ OptionValueString(const char *value, ValidatorCallback validator,
+ void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {
+ if (value && value[0]) {
+ m_current_value.assign(value);
+ m_default_value.assign(value);
+ }
+ }
+
+ OptionValueString(const char *current_value, const char *default_value,
+ ValidatorCallback validator, void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {
+ if (current_value && current_value[0])
+ m_current_value.assign(current_value);
+ if (default_value && default_value[0])
+ m_default_value.assign(default_value);
+ }
+
+ ~OptionValueString() override = default;
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeString; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ Flags &GetOptions() { return m_options; }
+
+ const Flags &GetOptions() const { return m_options; }
+
+ const char *operator=(const char *value) {
+ SetCurrentValue(llvm::StringRef::withNullAsEmpty(value));
+ return m_current_value.c_str();
+ }
+
+ const char *GetCurrentValue() const { return m_current_value.c_str(); }
+ llvm::StringRef GetCurrentValueAsRef() const { return m_current_value; }
+
+ const char *GetDefaultValue() const { return m_default_value.c_str(); }
+ llvm::StringRef GetDefaultValueAsRef() const { return m_default_value; }
+
+ Status SetCurrentValue(const char *) = delete;
+ Status SetCurrentValue(llvm::StringRef value);
+
+ Status AppendToCurrentValue(const char *value);
+
+ void SetDefaultValue(const char *value) {
+ if (value && value[0])
+ m_default_value.assign(value);
+ else
+ m_default_value.clear();
+ }
+
+ bool IsCurrentValueEmpty() const { return m_current_value.empty(); }
+
+ bool IsDefaultValueEmpty() const { return m_default_value.empty(); }
+
+protected:
+ std::string m_current_value;
+ std::string m_default_value;
+ Flags m_options;
+ ValidatorCallback m_validator;
+ void *m_validator_baton;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueString_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h
new file mode 100644
index 0000000..5978cdb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h
@@ -0,0 +1,82 @@
+//===-- OptionValueUInt64.h --------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueUInt64_h_
+#define liblldb_OptionValueUInt64_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueUInt64 : public OptionValue {
+public:
+ OptionValueUInt64() : OptionValue(), m_current_value(0), m_default_value(0) {}
+
+ OptionValueUInt64(uint64_t value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueUInt64(uint64_t current_value, uint64_t default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueUInt64() override {}
+
+ // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
+ // inside of a lldb::OptionValueSP object if all goes well. If the 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 *, Status &) = delete;
+ static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error);
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeUInt64; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ const uint64_t &operator=(uint64_t value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ operator uint64_t() const { return m_current_value; }
+
+ uint64_t GetCurrentValue() const { return m_current_value; }
+
+ uint64_t GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(uint64_t value) { m_current_value = value; }
+
+ void SetDefaultValue(uint64_t value) { m_default_value = value; }
+
+protected:
+ uint64_t m_current_value;
+ uint64_t m_default_value;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueUInt64_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h
new file mode 100644
index 0000000..7273e35
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h
@@ -0,0 +1,64 @@
+//===-- OptionValueUUID.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValueUUID_h_
+#define liblldb_OptionValueUUID_h_
+
+#include "lldb/Utility/UUID.h"
+#include "lldb/Interpreter/OptionValue.h"
+
+namespace lldb_private {
+
+class OptionValueUUID : public OptionValue {
+public:
+ OptionValueUUID() : OptionValue(), m_uuid() {}
+
+ OptionValueUUID(const UUID &uuid) : OptionValue(), m_uuid(uuid) {}
+
+ ~OptionValueUUID() override {}
+
+ // Virtual subclass pure virtual overrides
+
+ OptionValue::Type GetType() const override { return eTypeUUID; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ bool Clear() override {
+ m_uuid.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ // Subclass specific functions
+
+ UUID &GetCurrentValue() { return m_uuid; }
+
+ const UUID &GetCurrentValue() const { return m_uuid; }
+
+ void SetCurrentValue(const UUID &value) { m_uuid = value; }
+
+ size_t AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+protected:
+ UUID m_uuid;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OptionValueUUID_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValues.h b/linux-x64/clang/include/lldb/Interpreter/OptionValues.h
new file mode 100644
index 0000000..d90b286
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValues.h
@@ -0,0 +1,33 @@
+//===-- OptionValues.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OptionValues_h_
+#define liblldb_OptionValues_h_
+
+#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Interpreter/OptionValueArch.h"
+#include "lldb/Interpreter/OptionValueArgs.h"
+#include "lldb/Interpreter/OptionValueArray.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/OptionValueChar.h"
+#include "lldb/Interpreter/OptionValueDictionary.h"
+#include "lldb/Interpreter/OptionValueEnumeration.h"
+#include "lldb/Interpreter/OptionValueFileSpec.h"
+#include "lldb/Interpreter/OptionValueFileSpecList.h"
+#include "lldb/Interpreter/OptionValueFormat.h"
+#include "lldb/Interpreter/OptionValueFormatEntity.h"
+#include "lldb/Interpreter/OptionValueLanguage.h"
+#include "lldb/Interpreter/OptionValuePathMappings.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
+#include "lldb/Interpreter/OptionValueRegex.h"
+#include "lldb/Interpreter/OptionValueSInt64.h"
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/OptionValueUUID.h"
+
+#endif // liblldb_OptionValues_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/Options.h b/linux-x64/clang/include/lldb/Interpreter/Options.h
new file mode 100644
index 0000000..a008d51
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/Options.h
@@ -0,0 +1,338 @@
+//===-- Options.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Options_h_
+#define liblldb_Options_h_
+
+#include <set>
+#include <vector>
+
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lldb_private {
+
+struct Option;
+
+typedef std::vector<std::tuple<std::string, int, std::string>> OptionArgVector;
+typedef std::shared_ptr<OptionArgVector> OptionArgVectorSP;
+
+struct OptionArgElement {
+ enum { eUnrecognizedArg = -1, eBareDash = -2, eBareDoubleDash = -3 };
+
+ OptionArgElement(int defs_index, int pos, int arg_pos)
+ : opt_defs_index(defs_index), opt_pos(pos), opt_arg_pos(arg_pos) {}
+
+ int opt_defs_index;
+ int opt_pos;
+ int opt_arg_pos;
+};
+
+typedef std::vector<OptionArgElement> OptionElementVector;
+
+static inline bool isprint8(int ch) {
+ if (ch & 0xffffff00u)
+ return false;
+ return isprint(ch);
+}
+
+/// \class Options Options.h "lldb/Interpreter/Options.h"
+/// A command line option parsing protocol class.
+///
+/// Options is designed to be subclassed to contain all needed options for a
+/// given command. The options can be parsed by calling the Parse function.
+///
+/// The options are specified using the format defined for the libc options
+/// parsing function getopt_long_only: \code
+/// #include <getopt.h>
+/// int getopt_long_only(int argc, char * const *argv, const char
+/// *optstring, const struct option *longopts, int *longindex);
+/// \endcode
+///
+class Options {
+public:
+ Options();
+
+ virtual ~Options();
+
+ void BuildGetoptTable();
+
+ void BuildValidOptionSets();
+
+ uint32_t NumCommandOptions();
+
+ /// Get the option definitions to use when parsing Args options.
+ ///
+ /// \see Args::ParseOptions (Options&)
+ /// \see man getopt_long_only
+ Option *GetLongOptions();
+
+ // This gets passed the short option as an integer...
+ void OptionSeen(int short_option);
+
+ bool VerifyOptions(CommandReturnObject &result);
+
+ // Verify that the options given are in the options table and can be used
+ // together, but there may be some required options that are missing (used to
+ // verify options that get folded into command aliases).
+ bool VerifyPartialOptions(CommandReturnObject &result);
+
+ void OutputFormattedUsageText(Stream &strm,
+ const OptionDefinition &option_def,
+ uint32_t output_max_columns);
+
+ void GenerateOptionUsage(Stream &strm, CommandObject *cmd,
+ uint32_t screen_width);
+
+ bool SupportsLongOption(const char *long_option);
+
+ // The following two pure virtual functions must be defined by every class
+ // that inherits from this class.
+
+ virtual llvm::ArrayRef<OptionDefinition> GetDefinitions() {
+ return llvm::ArrayRef<OptionDefinition>();
+ }
+
+ // Call this prior to parsing any options. This call will call the subclass
+ // OptionParsingStarting() and will avoid the need for all
+ // OptionParsingStarting() function instances from having to call the
+ // Option::OptionParsingStarting() like they did before. This was error prone
+ // and subclasses shouldn't have to do it.
+ void NotifyOptionParsingStarting(ExecutionContext *execution_context);
+
+ /// Parse the provided arguments.
+ ///
+ /// The parsed options are set via calls to SetOptionValue. In case of a
+ /// successful parse, the function returns a copy of the input arguments
+ /// with the parsed options removed. Otherwise, it returns an error.
+ ///
+ /// param[in] platform_sp
+ /// The platform used for option validation. This is necessary
+ /// because an empty execution_context is not enough to get us
+ /// to a reasonable platform. If the platform isn't given,
+ /// we'll try to get it from the execution context. If we can't
+ /// get it from the execution context, we'll skip validation.
+ ///
+ /// param[in] require_validation
+ /// When true, it will fail option parsing if validation could
+ /// not occur due to not having a platform.
+ llvm::Expected<Args> Parse(const Args &args,
+ ExecutionContext *execution_context,
+ lldb::PlatformSP platform_sp,
+ bool require_validation);
+
+ llvm::Expected<Args> ParseAlias(const Args &args,
+ OptionArgVector *option_arg_vector,
+ std::string &input_line);
+
+ OptionElementVector ParseForCompletion(const Args &args,
+ uint32_t cursor_index);
+
+ Status NotifyOptionParsingFinished(ExecutionContext *execution_context);
+
+ /// Set the value of an option.
+ ///
+ /// \param[in] option_idx
+ /// The index into the "struct option" array that was returned
+ /// by Options::GetLongOptions().
+ ///
+ /// \param[in] option_arg
+ /// The argument value for the option that the user entered, or
+ /// nullptr if there is no argument for the current option.
+ ///
+ /// \param[in] execution_context
+ /// The execution context to use for evaluating the option.
+ /// May be nullptr if the option is to be evaluated outside any
+ /// particular context.
+ ///
+ /// \see Args::ParseOptions (Options&)
+ /// \see man getopt_long_only
+ 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 option,
+ /// and if so completing it.
+ ///
+ /// \param[in/out] request
+ /// The completion request that we need to act upon.
+ ///
+ /// \param[in] interpreter
+ /// The interpreter that's doing the completing.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to
+ /// make a distinction between total number of matches, and the window the
+ /// user wants returned.
+ ///
+ /// \return
+ /// \btrue if we were in an option, \bfalse otherwise.
+ bool HandleOptionCompletion(lldb_private::CompletionRequest &request,
+ OptionElementVector &option_map,
+ CommandInterpreter &interpreter);
+
+ /// Handles the generic bits of figuring out whether we are in an option,
+ /// and if so completing it.
+ ///
+ /// \param[in/out] request
+ /// The completion request that we need to act upon.
+ ///
+ /// \param[in] interpreter
+ /// The command interpreter doing the completion.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to
+ /// make a distinction between total number of matches, and the window the
+ /// user wants returned.
+ ///
+ /// \return
+ /// \btrue if we were in an option, \bfalse otherwise.
+ virtual bool
+ HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
+ OptionElementVector &opt_element_vector,
+ int opt_element_index,
+ CommandInterpreter &interpreter);
+
+protected:
+ // This is a set of options expressed as indexes into the options table for
+ // this Option.
+ typedef std::set<int> OptionSet;
+ typedef std::vector<OptionSet> OptionSetVector;
+
+ std::vector<Option> m_getopt_table;
+ OptionSet m_seen_options;
+ OptionSetVector m_required_options;
+ OptionSetVector m_optional_options;
+
+ OptionSetVector &GetRequiredOptions() {
+ BuildValidOptionSets();
+ return m_required_options;
+ }
+
+ OptionSetVector &GetOptionalOptions() {
+ BuildValidOptionSets();
+ return m_optional_options;
+ }
+
+ bool IsASubset(const OptionSet &set_a, const OptionSet &set_b);
+
+ size_t OptionsSetDiff(const OptionSet &set_a, const OptionSet &set_b,
+ OptionSet &diffs);
+
+ void OptionsSetUnion(const OptionSet &set_a, const OptionSet &set_b,
+ OptionSet &union_set);
+
+ // Subclasses must reset their option values prior to starting a new option
+ // parse. Each subclass must override this function and revert all option
+ // settings to default values.
+ virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0;
+
+ 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
+ Status error;
+ return error;
+ }
+};
+
+class OptionGroup {
+public:
+ OptionGroup() = default;
+
+ virtual ~OptionGroup() = default;
+
+ virtual llvm::ArrayRef<OptionDefinition> GetDefinitions() = 0;
+
+ virtual Status SetOptionValue(uint32_t option_idx,
+ llvm::StringRef option_value,
+ ExecutionContext *execution_context) = 0;
+
+ virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0;
+
+ 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
+ Status error;
+ return error;
+ }
+};
+
+class OptionGroupOptions : public Options {
+public:
+ OptionGroupOptions()
+ : Options(), m_option_defs(), m_option_infos(), m_did_finalize(false) {}
+
+ ~OptionGroupOptions() override = default;
+
+ /// Append options from a OptionGroup class.
+ ///
+ /// Append all options from \a group using the exact same option groups that
+ /// each option is defined with.
+ ///
+ /// \param[in] group
+ /// A group of options to take option values from and copy their
+ /// definitions into this class.
+ void Append(OptionGroup *group);
+
+ /// Append options from a OptionGroup class.
+ ///
+ /// Append options from \a group that have a usage mask that has any bits in
+ /// "src_mask" set. After the option definition is copied into the options
+ /// definitions in this class, set the usage_mask to "dst_mask".
+ ///
+ /// \param[in] group
+ /// A group of options to take option values from and copy their
+ /// definitions into this class.
+ ///
+ /// \param[in] src_mask
+ /// When copying options from \a group, you might only want some of
+ /// the options to be appended to this group. This mask allows you
+ /// to control which options from \a group get added. It also allows
+ /// you to specify the same options from \a group multiple times
+ /// for different option sets.
+ ///
+ /// \param[in] dst_mask
+ /// Set the usage mask for any copied options to \a dst_mask after
+ /// copying the option definition.
+ void Append(OptionGroup *group, uint32_t src_mask, uint32_t dst_mask);
+
+ void Finalize();
+
+ bool DidFinalize() { return m_did_finalize; }
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ Status OptionParsingFinished(ExecutionContext *execution_context) override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ assert(m_did_finalize);
+ return m_option_defs;
+ }
+
+ const OptionGroup *GetGroupWithOption(char short_opt);
+
+ struct OptionInfo {
+ OptionInfo(OptionGroup *g, uint32_t i) : option_group(g), option_index(i) {}
+ OptionGroup *option_group; // The group that this option came from
+ uint32_t option_index; // The original option index from the OptionGroup
+ };
+ typedef std::vector<OptionInfo> OptionInfos;
+
+ std::vector<OptionDefinition> m_option_defs;
+ OptionInfos m_option_infos;
+ bool m_did_finalize;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Options_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/Property.h b/linux-x64/clang/include/lldb/Interpreter/Property.h
new file mode 100644
index 0000000..797aee4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/Property.h
@@ -0,0 +1,79 @@
+//===-- Property.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Property_h_
+#define liblldb_Property_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 {
+
+// A structure that can be used to create a global table for all properties.
+// Property class instances can be constructed using one of these.
+struct PropertyDefinition {
+ const char *name;
+ OptionValue::Type type;
+ bool global; // false == this setting is a global setting by default
+ uintptr_t default_uint_value;
+ const char *default_cstr_value;
+ OptionEnumValues enum_values;
+ const char *description;
+};
+
+using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
+
+class Property {
+public:
+ Property(const PropertyDefinition &definition);
+
+ Property(ConstString name, ConstString desc, bool is_global,
+ const lldb::OptionValueSP &value_sp);
+
+ llvm::StringRef GetName() const { return m_name.GetStringRef(); }
+ llvm::StringRef GetDescription() const {
+ return m_description.GetStringRef();
+ }
+
+ const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
+
+ void SetOptionValue(const lldb::OptionValueSP &value_sp) {
+ m_value_sp = value_sp;
+ }
+
+ bool IsValid() const { return (bool)m_value_sp; }
+
+ bool IsGlobal() const { return m_is_global; }
+
+ void Dump(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) const;
+
+ bool DumpQualifiedName(Stream &strm) const;
+
+ void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
+ uint32_t output_width,
+ bool display_qualified_name) const;
+
+ void SetValueChangedCallback(OptionValueChangedCallback callback,
+ void *baton);
+
+protected:
+ ConstString m_name;
+ ConstString m_description;
+ lldb::OptionValueSP m_value_sp;
+ bool m_is_global;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Property_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h b/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h
new file mode 100644
index 0000000..c8fa390
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h
@@ -0,0 +1,477 @@
+//===-- ScriptInterpreter.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ScriptInterpreter_h_
+#define liblldb_ScriptInterpreter_h_
+
+#include "lldb/lldb-private.h"
+
+#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
+
+#include "lldb/Host/PseudoTerminal.h"
+
+namespace lldb_private {
+
+class ScriptInterpreterLocker {
+public:
+ ScriptInterpreterLocker() = default;
+
+ virtual ~ScriptInterpreterLocker() = default;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptInterpreterLocker);
+};
+
+class ScriptInterpreter : public PluginInterface {
+public:
+ enum ScriptReturnType {
+ eScriptReturnTypeCharPtr,
+ eScriptReturnTypeBool,
+ eScriptReturnTypeShortInt,
+ eScriptReturnTypeShortIntUnsigned,
+ eScriptReturnTypeInt,
+ eScriptReturnTypeIntUnsigned,
+ eScriptReturnTypeLongInt,
+ eScriptReturnTypeLongIntUnsigned,
+ eScriptReturnTypeLongLong,
+ eScriptReturnTypeLongLongUnsigned,
+ eScriptReturnTypeFloat,
+ eScriptReturnTypeDouble,
+ eScriptReturnTypeChar,
+ eScriptReturnTypeCharStrOrNone,
+ eScriptReturnTypeOpaqueObject
+ };
+
+ ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang);
+
+ ~ScriptInterpreter() override;
+
+ struct ExecuteScriptOptions {
+ public:
+ ExecuteScriptOptions()
+ : m_enable_io(true), m_set_lldb_globals(true), m_maskout_errors(true) {}
+
+ bool GetEnableIO() const { return m_enable_io; }
+
+ bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
+
+ bool GetMaskoutErrors() const { return m_maskout_errors; }
+
+ ExecuteScriptOptions &SetEnableIO(bool enable) {
+ m_enable_io = enable;
+ return *this;
+ }
+
+ ExecuteScriptOptions &SetSetLLDBGlobals(bool set) {
+ m_set_lldb_globals = set;
+ return *this;
+ }
+
+ ExecuteScriptOptions &SetMaskoutErrors(bool maskout) {
+ m_maskout_errors = maskout;
+ return *this;
+ }
+
+ private:
+ bool m_enable_io;
+ bool m_set_lldb_globals;
+ bool m_maskout_errors;
+ };
+
+ virtual bool Interrupt() { return false; }
+
+ virtual bool ExecuteOneLine(
+ llvm::StringRef command, CommandReturnObject *result,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) = 0;
+
+ virtual void ExecuteInterpreterLoop() = 0;
+
+ virtual bool ExecuteOneLineWithReturn(
+ llvm::StringRef in_string, ScriptReturnType return_type, void *ret_value,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
+ return true;
+ }
+
+ virtual Status ExecuteMultipleLines(
+ const char *in_string,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
+ Status error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual Status
+ ExportFunctionDefinitionToInterpreter(StringList &function_def) {
+ Status error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual Status GenerateBreakpointCommandCallbackData(StringList &input,
+ std::string &output) {
+ Status error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual bool GenerateWatchpointCommandCallbackData(StringList &input,
+ std::string &output) {
+ return false;
+ }
+
+ virtual bool GenerateTypeScriptFunction(const char *oneliner,
+ std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateTypeScriptFunction(StringList &input,
+ std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateScriptAliasFunction(StringList &input,
+ std::string &output) {
+ return false;
+ }
+
+ virtual bool GenerateTypeSynthClass(StringList &input, std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateTypeSynthClass(const char *oneliner, std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual StructuredData::ObjectSP
+ CreateSyntheticScriptedProvider(const char *class_name,
+ lldb::ValueObjectSP valobj) {
+ return StructuredData::ObjectSP();
+ }
+
+ virtual StructuredData::GenericSP
+ CreateScriptCommandObject(const char *class_name) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::GenericSP
+ CreateFrameRecognizer(const char *class_name) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual lldb::ValueObjectListSP GetRecognizedArguments(
+ const StructuredData::ObjectSP &implementor,
+ lldb::StackFrameSP frame_sp) {
+ return lldb::ValueObjectListSP();
+ }
+
+ virtual StructuredData::GenericSP
+ OSPlugin_CreatePluginObject(const char *class_name,
+ lldb::ProcessSP process_sp) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual StructuredData::ArraySP
+ OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp) {
+ return StructuredData::ArraySP();
+ }
+
+ virtual StructuredData::StringSP
+ OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp,
+ lldb::tid_t thread_id) {
+ return StructuredData::StringSP();
+ }
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp,
+ lldb::tid_t tid, lldb::addr_t context) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual StructuredData::ObjectSP
+ CreateScriptedThreadPlan(const char *class_name,
+ lldb::ThreadPlanSP thread_plan_sp) {
+ return StructuredData::ObjectSP();
+ }
+
+ virtual bool
+ ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp,
+ Event *event, bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual bool
+ ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp,
+ Event *event, bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual bool
+ ScriptedThreadPlanIsStale(StructuredData::ObjectSP implementor_sp,
+ bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual lldb::StateType
+ ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp,
+ bool &script_error) {
+ script_error = true;
+ return lldb::eStateStepping;
+ }
+
+ virtual StructuredData::GenericSP
+ CreateScriptedBreakpointResolver(const char *class_name,
+ StructuredDataImpl *args_data,
+ lldb::BreakpointSP &bkpt_sp) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual bool
+ ScriptedBreakpointResolverSearchCallback(StructuredData::GenericSP implementor_sp,
+ SymbolContext *sym_ctx)
+ {
+ return false;
+ }
+
+ virtual lldb::SearchDepth
+ ScriptedBreakpointResolverSearchDepth(StructuredData::GenericSP implementor_sp)
+ {
+ return lldb::eSearchDepthModule;
+ }
+
+ virtual StructuredData::ObjectSP
+ 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::Status &error) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual Status GenerateFunction(const char *signature,
+ const StringList &input) {
+ Status error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ virtual void CollectDataForBreakpointCommandCallback(
+ std::vector<BreakpointOptions *> &options, CommandReturnObject &result);
+
+ virtual void
+ CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options,
+ CommandReturnObject &result);
+
+ /// Set the specified text as the callback for the breakpoint.
+ Status
+ SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *callback_text);
+
+ virtual Status SetBreakpointCommandCallback(BreakpointOptions *bp_options,
+ const char *callback_text) {
+ Status error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ /// This one is for deserialization:
+ virtual Status SetBreakpointCommandCallback(
+ BreakpointOptions *bp_options,
+ std::unique_ptr<BreakpointOptions::CommandData> &data_up) {
+ Status error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ void SetBreakpointCommandCallbackFunction(
+ std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *function_name);
+
+ /// Set a one-liner as the callback for the breakpoint.
+ virtual void
+ SetBreakpointCommandCallbackFunction(BreakpointOptions *bp_options,
+ const char *function_name) {}
+
+ /// Set a one-liner as the callback for the watchpoint.
+ virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options,
+ const char *oneliner) {}
+
+ virtual bool GetScriptedSummary(const char *function_name,
+ lldb::ValueObjectSP valobj,
+ StructuredData::ObjectSP &callee_wrapper_sp,
+ const TypeSummaryOptions &options,
+ std::string &retval) {
+ return false;
+ }
+
+ virtual void Clear() {
+ // Clean up any ref counts to SBObjects that might be in global variables
+ }
+
+ virtual size_t
+ CalculateNumChildren(const StructuredData::ObjectSP &implementor,
+ uint32_t max) {
+ return 0;
+ }
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) {
+ return lldb::ValueObjectSP();
+ }
+
+ virtual int
+ GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor,
+ const char *child_name) {
+ return UINT32_MAX;
+ }
+
+ virtual bool
+ UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor) {
+ return false;
+ }
+
+ virtual bool MightHaveChildrenSynthProviderInstance(
+ const StructuredData::ObjectSP &implementor) {
+ return true;
+ }
+
+ virtual lldb::ValueObjectSP
+ GetSyntheticValue(const StructuredData::ObjectSP &implementor) {
+ return nullptr;
+ }
+
+ virtual ConstString
+ GetSyntheticTypeName(const StructuredData::ObjectSP &implementor) {
+ return ConstString();
+ }
+
+ virtual bool
+ RunScriptBasedCommand(const char *impl_function, llvm::StringRef args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject &cmd_retobj,
+ Status &error,
+ const lldb_private::ExecutionContext &exe_ctx) {
+ return false;
+ }
+
+ virtual bool RunScriptBasedCommand(
+ StructuredData::GenericSP impl_obj_sp, llvm::StringRef args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject &cmd_retobj, Status &error,
+ const lldb_private::ExecutionContext &exe_ctx) {
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ Process *process, std::string &output,
+ Status &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread,
+ std::string &output, Status &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target,
+ std::string &output, Status &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ StackFrame *frame, std::string &output,
+ Status &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ ValueObject *value, std::string &output,
+ Status &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool GetDocumentationForItem(const char *item, std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool
+ GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp,
+ std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual uint32_t
+ GetFlagsForCommandObject(StructuredData::GenericSP cmd_obj_sp) {
+ return 0;
+ }
+
+ virtual bool GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp,
+ std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool CheckObjectExists(const char *name) { return false; }
+
+ virtual bool
+ LoadScriptingModule(const char *filename, bool can_reload, bool init_session,
+ lldb_private::Status &error,
+ StructuredData::ObjectSP *module_sp = nullptr) {
+ error.SetErrorString("loading unimplemented");
+ return false;
+ }
+
+ virtual bool IsReservedWord(const char *word) { return false; }
+
+ virtual std::unique_ptr<ScriptInterpreterLocker> AcquireInterpreterLock();
+
+ const char *GetScriptInterpreterPtyName();
+
+ int GetMasterFileDescriptor();
+
+ static std::string LanguageToString(lldb::ScriptLanguage language);
+
+ static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
+
+ virtual void ResetOutputFileHandle(FILE *new_fh) {} // By default, do nothing.
+
+ lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
+
+protected:
+ Debugger &m_debugger;
+ lldb::ScriptLanguage m_script_lang;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ScriptInterpreter_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h b/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h
new file mode 100644
index 0000000..a74b444
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h
@@ -0,0 +1,68 @@
+//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ArmUnwindInfo_h_
+#define liblldb_ArmUnwindInfo_h_
+
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/lldb-private.h"
+#include <vector>
+
+/*
+ * Unwind information reader and parser for the ARM exception handling ABI
+ *
+ * Implemented based on:
+ * Exception Handling ABI for the ARM Architecture
+ * Document number: ARM IHI 0038A (current through ABI r2.09)
+ * Date of Issue: 25th January 2007, reissued 30th November 2012
+ * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
+ */
+
+namespace lldb_private {
+
+class ArmUnwindInfo {
+public:
+ ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx,
+ lldb::SectionSP &arm_extab);
+
+ ~ArmUnwindInfo();
+
+ bool GetUnwindPlan(Target &target, const Address &addr,
+ UnwindPlan &unwind_plan);
+
+private:
+ struct ArmExidxEntry {
+ ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
+
+ bool operator<(const ArmExidxEntry &other) const;
+
+ uint32_t file_address;
+ lldb::addr_t address;
+ uint32_t data;
+ };
+
+ const uint8_t *GetExceptionHandlingTableEntry(const Address &addr);
+
+ uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const;
+
+ uint64_t GetULEB128(const uint32_t *data, uint16_t &offset,
+ uint16_t max_offset) const;
+
+ const lldb::ByteOrder m_byte_order;
+ lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
+ lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
+ DataExtractor m_arm_exidx_data; // .ARM.exidx section data
+ DataExtractor m_arm_extab_data; // .ARM.extab section data
+ std::vector<ArmExidxEntry> m_exidx_entries;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ArmUnwindInfo_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/Block.h b/linux-x64/clang/include/lldb/Symbol/Block.h
new file mode 100644
index 0000000..36d0944
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Block.h
@@ -0,0 +1,404 @@
+//===-- Block.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Block_h_
+#define liblldb_Block_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+#include <vector>
+
+namespace lldb_private {
+
+/// \class Block Block.h "lldb/Symbol/Block.h"
+/// A class that describes a single lexical block.
+///
+/// A Function object owns a BlockList object which owns one or more
+/// Block objects. The BlockList object contains a section offset address
+/// range, and Block objects contain one or more ranges which are offsets into
+/// that range. Blocks are can have discontiguous ranges within the BlockList
+/// address range, and each block can contain child blocks each with their own
+/// sets of ranges.
+///
+/// Each block has a variable list that represents local, argument, and static
+/// variables that are scoped to the block.
+///
+/// Inlined functions are represented by attaching a InlineFunctionInfo shared
+/// pointer object to a block. Inlined functions are represented as named
+/// blocks.
+class Block : public UserID, public SymbolContextScope {
+public:
+ typedef RangeArray<uint32_t, uint32_t, 1> RangeList;
+ typedef RangeList::Entry Range;
+
+ /// Construct with a User ID \a uid, \a depth.
+ ///
+ /// Initialize this block with the specified UID \a uid. The \a depth in the
+ /// \a block_list is used to represent the parent, sibling, and child block
+ /// information and also allows for partial parsing at the block level.
+ ///
+ /// \param[in] uid
+ /// The UID for a given block. This value is given by the
+ /// SymbolFile plug-in and can be any value that helps the
+ /// SymbolFile plug-in to match this block back to the debug
+ /// information data that it parses for further or more in
+ /// depth parsing. Common values would be the index into a
+ /// table, or an offset into the debug information.
+ ///
+ /// \param[in] depth
+ /// The integer depth of this block in the block list hierarchy.
+ ///
+ /// \param[in] block_list
+ /// The block list that this object belongs to.
+ ///
+ /// \see BlockList
+ Block(lldb::user_id_t uid);
+
+ /// Destructor.
+ ~Block() override;
+
+ /// Add a child to this object.
+ ///
+ /// \param[in] child_block_sp
+ /// A shared pointer to a child block that will get added to
+ /// this block.
+ void AddChild(const lldb::BlockSP &child_block_sp);
+
+ /// Add a new offset range to this block.
+ ///
+ /// \param[in] start_offset
+ /// An offset into this Function's address range that
+ /// describes the start address of a range for this block.
+ ///
+ /// \param[in] end_offset
+ /// An offset into this Function's address range that
+ /// describes the end address of a range for this block.
+ void AddRange(const Range &range);
+
+ void FinalizeRanges();
+
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// \see SymbolContextScope
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ Function *CalculateSymbolContextFunction() override;
+
+ Block *CalculateSymbolContextBlock() override;
+
+ /// Check if an offset is in one of the block offset ranges.
+ ///
+ /// \param[in] range_offset
+ /// An offset into the Function's address range.
+ ///
+ /// \return
+ /// Returns \b true if \a range_offset falls in one of this
+ /// block's ranges, \b false otherwise.
+ bool Contains(lldb::addr_t range_offset) const;
+
+ /// Check if a offset range is in one of the block offset ranges.
+ ///
+ /// \param[in] range
+ /// An offset range into the Function's address range.
+ ///
+ /// \return
+ /// Returns \b true if \a range falls in one of this
+ /// block's ranges, \b false otherwise.
+ bool Contains(const Range &range) const;
+
+ /// Check if this object contains "block" as a child block at any depth.
+ ///
+ /// \param[in] block
+ /// A potential child block.
+ ///
+ /// \return
+ /// Returns \b true if \a block is a child of this block, \b
+ /// false otherwise.
+ bool Contains(const Block *block) const;
+
+ /// Dump the block contents.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] base_addr
+ /// The resolved start address of the Function's address
+ /// range. This should be resolved as the file or load address
+ /// prior to passing the value into this function for dumping.
+ ///
+ /// \param[in] depth
+ /// Limit the number of levels deep that this function should
+ /// print as this block can contain child blocks. Specify
+ /// INT_MAX to dump all child blocks.
+ ///
+ /// \param[in] show_context
+ /// If \b true, variables will dump their context information.
+ void Dump(Stream *s, lldb::addr_t base_addr, int32_t depth,
+ bool show_context) const;
+
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// \see SymbolContextScope
+ void DumpSymbolContext(Stream *s) override;
+
+ void DumpAddressRanges(Stream *s, lldb::addr_t base_addr);
+
+ void GetDescription(Stream *s, Function *function,
+ lldb::DescriptionLevel level, Target *target) const;
+
+ /// Get the parent block.
+ ///
+ /// \return
+ /// The parent block pointer, or nullptr if this block has no
+ /// parent.
+ Block *GetParent() const;
+
+ /// Get the inlined block that contains this block.
+ ///
+ /// \return
+ /// If this block contains inlined function info, it will return
+ /// this block, else parent blocks will be searched to see if
+ /// any contain this block. nullptr will be returned if this block
+ /// nor any parent blocks are inlined function blocks.
+ Block *GetContainingInlinedBlock();
+
+ /// Get the inlined parent block for this block.
+ ///
+ /// \return
+ /// The parent block pointer, or nullptr if this block has no
+ /// parent.
+ Block *GetInlinedParent();
+
+ //------------------------------------------------------------------
+ /// Get the inlined block at the given call site that contains this block.
+ ///
+ /// @param[in] find_call_site
+ /// a declaration with the file and line of the call site to find.
+ ///
+ /// @return
+ /// If this block contains inlined function info and is at the call
+ /// site given by the file and line at the given \b declaration, then
+ /// it will return this block, otherwise the parent blocks will be
+ /// searched to see if any is at the call site. nullptr will be returned
+ /// if no block is found at the call site.
+ //------------------------------------------------------------------
+ Block *
+ GetContainingInlinedBlockWithCallSite(const Declaration &find_call_site);
+
+ /// Get the sibling block for this block.
+ ///
+ /// \return
+ /// The sibling block pointer, or nullptr if this block has no
+ /// sibling.
+ Block *GetSibling() const;
+
+ /// Get the first child block.
+ ///
+ /// \return
+ /// The first child block pointer, or nullptr if this block has no
+ /// children.
+ Block *GetFirstChild() const {
+ return (m_children.empty() ? nullptr : m_children.front().get());
+ }
+
+ /// Get the variable list for this block only.
+ ///
+ /// \param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned.
+ ///
+ /// \return
+ /// A variable list shared pointer that contains all variables
+ /// for this block.
+ lldb::VariableListSP GetBlockVariableList(bool can_create);
+
+ /// Get the variable list for this block and optionally all child blocks if
+ /// \a get_child_variables is \b true.
+ ///
+ /// \param[in] get_child_variables
+ /// If \b true, all variables from all child blocks will be
+ /// added to the variable list.
+ ///
+ /// \param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned. Passing \b true for this parameter can be used
+ /// to see the current state of what has been parsed up to this
+ /// point.
+ ///
+ /// \param[in] add_inline_child_block_variables
+ /// If this is \b false, no child variables of child blocks
+ /// that are inlined functions will be gotten. If \b true then
+ /// all child variables will be added regardless of whether they
+ /// come from inlined functions or not.
+ ///
+ /// \return
+ /// A variable list shared pointer that contains all variables
+ /// for this block.
+ uint32_t AppendBlockVariables(bool can_create, bool get_child_block_variables,
+ bool stop_if_child_block_is_inlined_function,
+ const std::function<bool(Variable *)> &filter,
+ VariableList *variable_list);
+
+ /// Appends the variables from this block, and optionally from all parent
+ /// blocks, to \a variable_list.
+ ///
+ /// \param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned. Passing \b true for this parameter can be used
+ /// to see the current state of what has been parsed up to this
+ /// point.
+ ///
+ /// \param[in] get_parent_variables
+ /// If \b true, all variables from all parent blocks will be
+ /// added to the variable list.
+ ///
+ /// \param[in] stop_if_block_is_inlined_function
+ /// If \b true, all variables from all parent blocks will be
+ /// added to the variable list until there are no parent blocks
+ /// or the parent block has inlined function info.
+ ///
+ /// \param[in,out] variable_list
+ /// All variables in this block, and optionally all parent
+ /// blocks will be added to this list.
+ ///
+ /// \return
+ /// The number of variable that were appended to \a
+ /// variable_list.
+ uint32_t AppendVariables(bool can_create, bool get_parent_variables,
+ bool stop_if_block_is_inlined_function,
+ const std::function<bool(Variable *)> &filter,
+ VariableList *variable_list);
+
+ /// Get const accessor for any inlined function information.
+ ///
+ /// \return
+ /// A const pointer to any inlined function information, or nullptr
+ /// if this is a regular block.
+ const InlineFunctionInfo *GetInlinedFunctionInfo() const {
+ return m_inlineInfoSP.get();
+ }
+
+ /// Get the symbol file which contains debug info for this block's
+ /// symbol context module.
+ ///
+ /// \return A pointer to the symbol file or nullptr.
+ SymbolFile *GetSymbolFile();
+
+ CompilerDeclContext GetDeclContext();
+
+ /// Get the memory cost of this object.
+ ///
+ /// Returns the cost of this object plus any owned objects from the ranges,
+ /// variables, and inline function information.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ size_t MemorySize() const;
+
+ /// Set accessor for any inlined function information.
+ ///
+ /// \param[in] name
+ /// The method name for the inlined function. This value should
+ /// not be nullptr.
+ ///
+ /// \param[in] mangled
+ /// The mangled method name for the inlined function. This can
+ /// be nullptr if there is no mangled name for an inlined function
+ /// or if the name is the same as \a name.
+ ///
+ /// \param[in] decl_ptr
+ /// A optional pointer to declaration information for the
+ /// inlined function information. This value can be nullptr to
+ /// indicate that no declaration information is available.
+ ///
+ /// \param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ void SetInlinedFunctionInfo(const char *name, const char *mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ void SetParentScope(SymbolContextScope *parent_scope) {
+ m_parent_scope = parent_scope;
+ }
+
+ /// Set accessor for the variable list.
+ ///
+ /// Called by the SymbolFile plug-ins after they have parsed the variable
+ /// lists and are ready to hand ownership of the list over to this object.
+ ///
+ /// \param[in] variable_list_sp
+ /// A shared pointer to a VariableList.
+ void SetVariableList(lldb::VariableListSP &variable_list_sp) {
+ m_variable_list_sp = variable_list_sp;
+ }
+
+ bool BlockInfoHasBeenParsed() const { return m_parsed_block_info; }
+
+ void SetBlockInfoHasBeenParsed(bool b, bool set_children);
+
+ Block *FindBlockByID(lldb::user_id_t block_id);
+
+ size_t GetNumRanges() const { return m_ranges.GetSize(); }
+
+ bool GetRangeContainingOffset(const lldb::addr_t offset, Range &range);
+
+ bool GetRangeContainingAddress(const Address &addr, AddressRange &range);
+
+ bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target,
+ AddressRange &range);
+
+ uint32_t GetRangeIndexContainingAddress(const Address &addr);
+
+ // Since blocks might have multiple discontiguous address ranges, we need to
+ // be able to get at any of the address ranges in a block.
+ bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range);
+
+ bool GetStartAddress(Address &addr);
+
+ void SetDidParseVariables(bool b, bool set_children);
+
+protected:
+ typedef std::vector<lldb::BlockSP> collection;
+ // Member variables.
+ SymbolContextScope *m_parent_scope;
+ collection m_children;
+ RangeList m_ranges;
+ lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information.
+ lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local,
+ ///static and parameter variables
+ ///scoped to this block.
+ bool m_parsed_block_info : 1, ///< Set to true if this block and it's children
+ ///have all been parsed
+ m_parsed_block_variables : 1, m_parsed_child_blocks : 1;
+
+ // A parent of child blocks can be asked to find a sibling block given
+ // one of its child blocks
+ Block *GetSiblingForChild(const Block *child_block) const;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Block);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Block_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h b/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h
new file mode 100644
index 0000000..dda9f43
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h
@@ -0,0 +1,1057 @@
+//===-- ClangASTContext.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangASTContext_h_
+#define liblldb_ClangASTContext_h_
+
+#include <stdint.h>
+
+#include <functional>
+#include <initializer_list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/ExternalASTMerger.h"
+#include "clang/AST/TemplateBase.h"
+#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/SmallVector.h"
+
+#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
+#include "lldb/Core/ClangForward.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-enumerations.h"
+
+class DWARFASTParserClang;
+class PDBASTParser;
+
+namespace lldb_private {
+
+class Declaration;
+
+class ClangASTContext : public TypeSystem {
+public:
+ typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
+ typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
+ clang::ObjCInterfaceDecl *);
+
+ // llvm casting support
+ static bool classof(const TypeSystem *ts) {
+ return ts->getKind() == TypeSystem::eKindClang;
+ }
+
+ // Constructors and Destructors
+ ClangASTContext(const char *triple = nullptr);
+
+ ~ClangASTContext() override;
+
+ void Finalize() override;
+
+ // PluginInterface functions
+ ConstString GetPluginName() override;
+
+ uint32_t GetPluginVersion() override;
+
+ static ConstString GetPluginNameStatic();
+
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module, Target *target);
+
+ static void EnumerateSupportedLanguages(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void Initialize();
+
+ static void Terminate();
+
+ static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx);
+
+ clang::ASTContext *getASTContext();
+
+ void setASTContext(clang::ASTContext *ast_ctx);
+
+ clang::Builtin::Context *getBuiltinContext();
+
+ clang::IdentifierTable *getIdentifierTable();
+
+ clang::LangOptions *getLanguageOptions();
+
+ clang::SelectorTable *getSelectorTable();
+
+ clang::FileManager *getFileManager();
+
+ clang::SourceManager *getSourceManager();
+
+ clang::DiagnosticsEngine *getDiagnosticsEngine();
+
+ clang::DiagnosticConsumer *getDiagnosticConsumer();
+
+ clang::MangleContext *getMangleContext();
+
+ std::shared_ptr<clang::TargetOptions> &getTargetOptions();
+
+ clang::TargetInfo *getTargetInfo();
+
+ void setSema(clang::Sema *s);
+ clang::Sema *getSema() { return m_sema; }
+
+ void Clear();
+
+ const char *GetTargetTriple();
+
+ void SetTargetTriple(const char *target_triple);
+
+ void SetArchitecture(const ArchSpec &arch);
+
+ bool HasExternalSource();
+
+ void SetExternalSource(
+ llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
+
+ void RemoveExternalSource();
+
+ bool GetCompleteDecl(clang::Decl *decl) {
+ return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
+ }
+
+ static void DumpDeclHiearchy(clang::Decl *decl);
+
+ static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
+
+ static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
+
+ static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
+
+ void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id);
+
+ void SetMetadata(const void *object, ClangASTMetadata &meta_data) {
+ SetMetadata(getASTContext(), object, meta_data);
+ }
+
+ static void SetMetadata(clang::ASTContext *ast, const void *object,
+ ClangASTMetadata &meta_data);
+
+ ClangASTMetadata *GetMetadata(const void *object) {
+ return GetMetadata(getASTContext(), object);
+ }
+
+ static ClangASTMetadata *GetMetadata(clang::ASTContext *ast,
+ const void *object);
+
+ // Basic Types
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) override;
+
+ static CompilerType GetBuiltinTypeForEncodingAndBitSize(
+ clang::ASTContext *ast, lldb::Encoding encoding, uint32_t bit_size);
+
+ CompilerType GetBasicType(lldb::BasicType type);
+
+ static CompilerType GetBasicType(clang::ASTContext *ast,
+ lldb::BasicType type);
+
+ static CompilerType GetBasicType(clang::ASTContext *ast,
+ ConstString name);
+
+ static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
+
+ CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(const char *type_name,
+ uint32_t dw_ate,
+ uint32_t bit_size);
+
+ CompilerType GetCStringType(bool is_const);
+
+ static CompilerType GetUnknownAnyType(clang::ASTContext *ast);
+
+ CompilerType GetUnknownAnyType() {
+ return ClangASTContext::GetUnknownAnyType(getASTContext());
+ }
+
+ static clang::DeclContext *GetDeclContextForType(clang::QualType type);
+
+ static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
+
+ uint32_t GetPointerByteSize() override;
+
+ static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
+
+ clang::DeclContext *GetTranslationUnitDecl() {
+ return GetTranslationUnitDecl(getASTContext());
+ }
+
+ static clang::Decl *CopyDecl(clang::ASTContext *dest_context,
+ clang::ASTContext *source_context,
+ clang::Decl *source_decl);
+
+ static bool AreTypesSame(CompilerType type1, CompilerType type2,
+ bool ignore_qualifiers = false);
+
+ static CompilerType GetTypeForDecl(clang::NamedDecl *decl);
+
+ static CompilerType GetTypeForDecl(clang::TagDecl *decl);
+
+ static CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
+
+ template <typename RecordDeclType>
+ CompilerType
+ GetTypeForIdentifier(ConstString type_name,
+ clang::DeclContext *decl_context = nullptr) {
+ CompilerType compiler_type;
+
+ if (type_name.GetLength()) {
+ clang::ASTContext *ast = getASTContext();
+ if (ast) {
+ if (!decl_context)
+ decl_context = ast->getTranslationUnitDecl();
+
+ clang::IdentifierInfo &myIdent =
+ ast->Idents.get(type_name.GetCString());
+ clang::DeclarationName myName =
+ ast->DeclarationNames.getIdentifier(&myIdent);
+
+ clang::DeclContext::lookup_result result =
+ decl_context->lookup(myName);
+
+ if (!result.empty()) {
+ clang::NamedDecl *named_decl = result[0];
+ if (const RecordDeclType *record_decl =
+ llvm::dyn_cast<RecordDeclType>(named_decl))
+ compiler_type.SetCompilerType(
+ ast, clang::QualType(record_decl->getTypeForDecl(), 0));
+ }
+ }
+ }
+
+ return compiler_type;
+ }
+
+ CompilerType CreateStructForIdentifier(
+ ConstString type_name,
+ const std::initializer_list<std::pair<const char *, CompilerType>>
+ &type_fields,
+ bool packed = false);
+
+ CompilerType GetOrCreateStructForIdentifier(
+ ConstString type_name,
+ const std::initializer_list<std::pair<const char *, CompilerType>>
+ &type_fields,
+ bool packed = false);
+
+ static bool IsOperator(const char *name,
+ clang::OverloadedOperatorKind &op_kind);
+
+ // Structure, Unions, Classes
+
+ static clang::AccessSpecifier
+ ConvertAccessTypeToAccessSpecifier(lldb::AccessType access);
+
+ static clang::AccessSpecifier
+ UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
+
+ static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
+ bool omit_empty_base_classes);
+
+ CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type, const char *name,
+ int kind, lldb::LanguageType language,
+ ClangASTMetadata *metadata = nullptr);
+
+ class TemplateParameterInfos {
+ public:
+ bool IsValid() const {
+ if (args.empty())
+ return false;
+ 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 *
+ CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx,
+ clang::FunctionDecl *func_decl, const char *name,
+ const TemplateParameterInfos &infos);
+
+ void CreateFunctionTemplateSpecializationInfo(
+ clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
+ const TemplateParameterInfos &infos);
+
+ clang::ClassTemplateDecl *
+ CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type, const char *class_name,
+ int kind, const TemplateParameterInfos &infos);
+
+ clang::TemplateTemplateParmDecl *
+ CreateTemplateTemplateParmDecl(const char *template_name);
+
+ clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
+ clang::DeclContext *decl_ctx,
+ clang::ClassTemplateDecl *class_template_decl, int kind,
+ const TemplateParameterInfos &infos);
+
+ CompilerType
+ CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
+ class_template_specialization_decl);
+
+ static clang::DeclContext *
+ GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl);
+
+ static clang::DeclContext *
+ GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl);
+
+ static bool CheckOverloadedOperatorKindParameterCount(
+ bool is_method, clang::OverloadedOperatorKind op_kind,
+ uint32_t num_params);
+
+ bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
+
+ static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field,
+ uint32_t &bitfield_bit_size);
+
+ static bool RecordHasFields(const clang::RecordDecl *record_decl);
+
+ CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx,
+ bool isForwardDecl, bool isInternal,
+ ClangASTMetadata *metadata = nullptr);
+
+ bool SetTagTypeKind(clang::QualType type, int kind) const;
+
+ bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl,
+ int default_accessibility,
+ int *assigned_accessibilities,
+ size_t num_assigned_accessibilities);
+
+ // Returns a mask containing bits from the ClangASTContext::eTypeXXX
+ // enumerations
+
+ // Namespace Declarations
+
+ clang::NamespaceDecl *
+ GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
+ bool is_inline = false);
+
+ static clang::NamespaceDecl *
+ GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name,
+ clang::DeclContext *decl_ctx,
+ bool is_inline = false);
+
+ // Function Types
+
+ clang::FunctionDecl *
+ CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name,
+ const CompilerType &function_Type, int storage,
+ bool is_inline);
+
+ static CompilerType CreateFunctionType(clang::ASTContext *ast,
+ const CompilerType &result_type,
+ const CompilerType *args,
+ unsigned num_args, bool is_variadic,
+ unsigned type_quals,
+ clang::CallingConv cc);
+
+ static CompilerType CreateFunctionType(clang::ASTContext *ast,
+ const CompilerType &result_type,
+ const CompilerType *args,
+ unsigned num_args, bool is_variadic,
+ unsigned type_quals) {
+ return ClangASTContext::CreateFunctionType(
+ ast, result_type, args, num_args, is_variadic, type_quals, clang::CC_C);
+ }
+
+ CompilerType CreateFunctionType(const CompilerType &result_type,
+ const CompilerType *args, unsigned num_args,
+ bool is_variadic, unsigned type_quals) {
+ return ClangASTContext::CreateFunctionType(
+ getASTContext(), result_type, args, num_args, is_variadic, type_quals);
+ }
+
+ CompilerType CreateFunctionType(const CompilerType &result_type,
+ const CompilerType *args, unsigned num_args,
+ bool is_variadic, unsigned type_quals,
+ clang::CallingConv cc) {
+ return ClangASTContext::CreateFunctionType(getASTContext(), result_type,
+ args, num_args, is_variadic,
+ type_quals, cc);
+ }
+
+ clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
+ const char *name,
+ const CompilerType ¶m_type,
+ int storage);
+
+ void SetFunctionParameters(clang::FunctionDecl *function_decl,
+ clang::ParmVarDecl **params, unsigned num_params);
+
+ CompilerType CreateBlockPointerType(const CompilerType &function_type);
+
+ // Array Types
+
+ CompilerType CreateArrayType(const CompilerType &element_type,
+ size_t element_count, bool is_vector);
+
+ // Enumeration Types
+ CompilerType CreateEnumerationType(const char *name,
+ clang::DeclContext *decl_ctx,
+ const Declaration &decl,
+ const CompilerType &integer_qual_type,
+ bool is_scoped);
+
+ // Integer type functions
+
+ static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast,
+ size_t bit_size, bool is_signed);
+
+ CompilerType GetPointerSizedIntType(bool is_signed) {
+ return GetPointerSizedIntType(getASTContext(), is_signed);
+ }
+
+ static CompilerType GetPointerSizedIntType(clang::ASTContext *ast,
+ bool is_signed);
+
+ // Floating point functions
+
+ static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
+ size_t bit_size);
+
+ // TypeSystem methods
+ DWARFASTParser *GetDWARFParser() override;
+ PDBASTParser *GetPDBParser() override;
+
+ // ClangASTContext callbacks for external source lookups.
+ static void CompleteTagDecl(void *baton, clang::TagDecl *);
+
+ static void CompleteObjCInterfaceDecl(void *baton,
+ clang::ObjCInterfaceDecl *);
+
+ static bool LayoutRecordType(
+ void *baton, const clang::RecordDecl *record_decl, uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &base_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &vbase_offsets);
+
+ // CompilerDecl override functions
+ ConstString DeclGetName(void *opaque_decl) override;
+
+ ConstString DeclGetMangledName(void *opaque_decl) override;
+
+ CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
+
+ CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
+
+ size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
+
+ CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
+ size_t arg_idx) override;
+
+ // CompilerDeclContext override functions
+
+ std::vector<CompilerDecl>
+ DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
+ const bool ignore_using_decls) override;
+
+ bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
+
+ ConstString DeclContextGetName(void *opaque_decl_ctx) override;
+
+ ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
+
+ bool DeclContextIsClassMethod(void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override;
+
+ bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
+ void *other_opaque_decl_ctx) override;
+
+ // Clang specific clang::DeclContext functions
+
+ static clang::DeclContext *
+ DeclContextGetAsDeclContext(const CompilerDeclContext &dc);
+
+ static clang::ObjCMethodDecl *
+ DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc);
+
+ static clang::CXXMethodDecl *
+ DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc);
+
+ static clang::FunctionDecl *
+ DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc);
+
+ static clang::NamespaceDecl *
+ DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc);
+
+ static ClangASTMetadata *DeclContextGetMetaData(const CompilerDeclContext &dc,
+ const void *object);
+
+ static clang::ASTContext *
+ DeclContextGetClangASTContext(const CompilerDeclContext &dc);
+
+ // Tests
+
+ bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) override;
+
+ bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) override;
+
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsAnonymousType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) override;
+
+ static bool IsCXXClassType(const CompilerType &type);
+
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
+ bool &is_complex) override;
+
+ bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr) override;
+
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) override;
+
+ size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) override;
+
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) override;
+
+ bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
+
+ bool IsEnumerationType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
+
+ static bool IsObjCClassType(const CompilerType &type);
+
+ static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
+ bool check_superclass);
+
+ static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
+
+ static bool IsObjCObjectPointerType(const CompilerType &type,
+ CompilerType *target_type = nullptr);
+
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+
+ static bool IsClassType(lldb::opaque_compiler_type_t type);
+
+ static bool IsEnumType(lldb::opaque_compiler_type_t type);
+
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) override;
+
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) override;
+
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) override;
+
+ bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type, bool *is_rvalue) override;
+
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
+
+ bool CanPassInRegisters(const CompilerType &type) override;
+
+ bool SupportsLanguage(lldb::LanguageType language) override;
+
+ static bool GetCXXClassName(const CompilerType &type,
+ std::string &class_name);
+
+ static bool GetObjCClassName(const CompilerType &type,
+ std::string &class_name);
+
+ // Type Completion
+
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ // Accessors
+
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type) override;
+
+ lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
+
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+
+ // Creating related types
+
+ // Using the current type, create a new typedef to that type using
+ // "typedef_name" as the name and "decl_ctx" as the decl context.
+ static CompilerType
+ CreateTypedefType(const CompilerType &type, const char *typedef_name,
+ const CompilerDeclContext &compiler_decl_ctx);
+
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride) override;
+
+ CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
+ uint64_t size) override;
+
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+
+ CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetLValueReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetRValueReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
+ const char *name,
+ const CompilerDeclContext &decl_ctx) override;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+
+ // Create related types using the current type's AST
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+
+ // Exploring the type
+
+ llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) {
+ if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
+ return (*bit_size + 7) / 8;
+ return llvm::None;
+ }
+
+ llvm::Optional<uint64_t>
+ GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
+
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) override;
+
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
+
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) override;
+
+ CompilerType GetBuiltinTypeByName(ConstString name) override;
+
+ lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+
+ static lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type,
+ ConstString name);
+
+ void ForEachEnumerator(
+ lldb::opaque_compiler_type_t type,
+ std::function<bool(const CompilerType &integer_type,
+ ConstString name,
+ const llvm::APSInt &value)> const &callback) override;
+
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
+
+ uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ static uint32_t GetNumPointeeChildren(clang::QualType type);
+
+ CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) override;
+
+ // Lookup a child given a name. This function will match base class names and
+ // member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) override;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
+
+ size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
+
+ lldb::TemplateArgumentKind
+ GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+ CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+ llvm::Optional<CompilerType::IntegralTemplateArgument>
+ GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+
+ CompilerType GetTypeForFormatters(void *type) override;
+
+#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
+ // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx
+ // could not be found in decl_ctx.
+ uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
+ clang::DeclContext *child_decl_ctx,
+ ConstString *child_name = nullptr,
+ CompilerType *child_type = nullptr);
+
+ // Modifying RecordType
+ static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
+ llvm::StringRef name,
+ const CompilerType &field_type,
+ lldb::AccessType access,
+ uint32_t bitfield_bit_size);
+
+ static void BuildIndirectFields(const CompilerType &type);
+
+ static void SetIsPacked(const CompilerType &type);
+
+ static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
+ llvm::StringRef name,
+ const CompilerType &var_type,
+ lldb::AccessType access);
+
+ clang::CXXMethodDecl *
+ AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name,
+ const char *mangled_name,
+ const CompilerType &method_type,
+ lldb::AccessType access, bool is_virtual,
+ bool is_static, bool is_inline, bool is_explicit,
+ bool is_attr_used, bool is_artificial);
+
+ void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type);
+
+ // C++ Base Classes
+ std::unique_ptr<clang::CXXBaseSpecifier>
+ CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type,
+ lldb::AccessType access, bool is_virtual,
+ bool base_of_class);
+
+ bool TransferBaseClasses(
+ lldb::opaque_compiler_type_t type,
+ std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
+
+ static bool SetObjCSuperClass(const CompilerType &type,
+ const CompilerType &superclass_compiler_type);
+
+ static bool AddObjCClassProperty(const CompilerType &type,
+ const char *property_name,
+ const CompilerType &property_compiler_type,
+ clang::ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes,
+ ClangASTMetadata *metadata);
+
+ static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
+ const CompilerType &type,
+ const char *name, // the full symbol name as seen in the symbol table
+ // (lldb::opaque_compiler_type_t type, "-[NString
+ // stringWithCString:]")
+ const CompilerType &method_compiler_type, lldb::AccessType access,
+ bool is_artificial, bool is_variadic);
+
+ static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
+ bool has_extern);
+
+ static bool GetHasExternalStorage(const CompilerType &type);
+ // Tag Declarations
+ static bool StartTagDeclarationDefinition(const CompilerType &type);
+
+ static bool CompleteTagDeclarationDefinition(const CompilerType &type);
+
+ // Modifying Enumeration types
+ clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
+ const CompilerType &enum_type, const Declaration &decl, const char *name,
+ int64_t enum_value, uint32_t enum_value_bit_size);
+ clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
+ const CompilerType &enum_type, const Declaration &decl, const char *name,
+ const llvm::APSInt &value);
+
+ CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
+
+ // Pointers & References
+
+ // Call this function using the class type when you want to make a member
+ // pointer type to pointee_type.
+ static CompilerType CreateMemberPointerType(const CompilerType &type,
+ const CompilerType &pointee_type);
+
+ // Converts "s" to a floating point value and place resulting floating point
+ // bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) override;
+
+ // Dumping types
+#ifndef NDEBUG
+ /// Convenience LLVM-style dump method for use in the debugger only.
+ /// In contrast to the other \p Dump() methods this directly invokes
+ /// \p clang::QualType::dump().
+ LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
+#endif
+
+ void Dump(Stream &s);
+
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ bool show_types, bool show_summary, bool verbose,
+ uint32_t depth) override;
+
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
+
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
+
+ void DumpTypeDescription(
+ lldb::opaque_compiler_type_t type) override; // Dump to stdout
+
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) override;
+
+ static void DumpTypeName(const CompilerType &type);
+
+ static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
+
+ static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
+
+ static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
+
+ static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
+
+ clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
+
+ static clang::ObjCInterfaceDecl *
+ GetAsObjCInterfaceDecl(const CompilerType &type);
+
+ clang::ClassTemplateDecl *ParseClassTemplateDecl(
+ clang::DeclContext *decl_ctx, lldb::AccessType access_type,
+ const char *parent_name, int tag_decl_kind,
+ const ClangASTContext::TemplateParameterInfos &template_param_infos);
+
+ clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx);
+
+ clang::UsingDirectiveDecl *
+ CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
+ clang::NamespaceDecl *ns_decl);
+
+ clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
+ clang::NamedDecl *target);
+
+ clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
+ const char *name,
+ clang::QualType type);
+
+ static lldb::opaque_compiler_type_t
+ GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
+
+ static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type);
+ return clang::QualType();
+ }
+
+ static clang::QualType
+ GetCanonicalQualType(lldb::opaque_compiler_type_t type) {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
+ return clang::QualType();
+ }
+
+ clang::DeclarationName
+ GetDeclarationName(const char *name, const CompilerType &function_clang_type);
+
+ virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() {
+ return m_origins;
+ }
+protected:
+ const clang::ClassTemplateSpecializationDecl *
+ GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
+
+ // Classes that inherit from ClangASTContext can see and modify these
+ // clang-format off
+ std::string m_target_triple;
+ std::unique_ptr<clang::ASTContext> m_ast_up;
+ std::unique_ptr<clang::LangOptions> m_language_options_up;
+ std::unique_ptr<clang::FileManager> m_file_manager_up;
+ std::unique_ptr<clang::FileSystemOptions> m_file_system_options_up;
+ std::unique_ptr<clang::SourceManager> m_source_manager_up;
+ std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
+ std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
+ std::shared_ptr<clang::TargetOptions> m_target_options_rp;
+ std::unique_ptr<clang::TargetInfo> m_target_info_up;
+ std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
+ std::unique_ptr<clang::SelectorTable> m_selector_table_up;
+ std::unique_ptr<clang::Builtin::Context> m_builtins_up;
+ std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
+ std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
+ std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
+ std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
+ CompleteTagDeclCallback m_callback_tag_decl;
+ CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
+ void * m_callback_baton;
+ clang::ExternalASTMerger::OriginMap m_origins;
+ uint32_t m_pointer_byte_size;
+ bool m_ast_owned;
+ bool m_can_evaluate_expressions;
+ /// The sema associated that is currently used to build this ASTContext.
+ /// May be null if we are already done parsing this ASTContext or the
+ /// ASTContext wasn't created by parsing source code.
+ clang::Sema * m_sema = nullptr;
+ // clang-format on
+private:
+ // For ClangASTContext only
+ ClangASTContext(const ClangASTContext &);
+ const ClangASTContext &operator=(const ClangASTContext &);
+};
+
+class ClangASTContextForExpressions : public ClangASTContext {
+public:
+ ClangASTContextForExpressions(Target &target);
+
+ ~ClangASTContextForExpressions() override = default;
+
+ UserExpression *
+ GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ValueObject *ctx_obj) override;
+
+ FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
+ const Address &function_address,
+ const ValueList &arg_value_list,
+ const char *name) override;
+
+ UtilityFunction *GetUtilityFunction(const char *text,
+ const char *name) override;
+
+ PersistentExpressionState *GetPersistentExpressionState() override;
+
+ clang::ExternalASTMerger &GetMergerUnchecked();
+
+ const clang::ExternalASTMerger::OriginMap &GetOriginMap() override {
+ return GetMergerUnchecked().GetOrigins();
+ }
+private:
+ lldb::TargetWP m_target_wp;
+ lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
+ ///persistent
+ ///variables
+ ///associated with
+ ///this process for
+ ///the expression
+ ///parser.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ClangASTContext_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h b/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h
new file mode 100644
index 0000000..353b123
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h
@@ -0,0 +1,401 @@
+//===-- ClangASTImporter.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangASTImporter_h_
+#define liblldb_ClangASTImporter_h_
+
+#include <map>
+#include <memory>
+#include <set>
+#include <vector>
+
+#include "clang/AST/ASTImporter.h"
+#include "clang/AST/CharUnits.h"
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/Symbol/CxxModuleHandler.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/DenseMap.h"
+
+namespace lldb_private {
+
+class ClangASTMetrics {
+public:
+ static void DumpCounters(Log *log);
+ static void ClearLocalCounters() { local_counters = {0, 0, 0, 0, 0, 0}; }
+
+ static void RegisterVisibleQuery() {
+ ++global_counters.m_visible_query_count;
+ ++local_counters.m_visible_query_count;
+ }
+
+ static void RegisterLexicalQuery() {
+ ++global_counters.m_lexical_query_count;
+ ++local_counters.m_lexical_query_count;
+ }
+
+ static void RegisterLLDBImport() {
+ ++global_counters.m_lldb_import_count;
+ ++local_counters.m_lldb_import_count;
+ }
+
+ static void RegisterClangImport() {
+ ++global_counters.m_clang_import_count;
+ ++local_counters.m_clang_import_count;
+ }
+
+ static void RegisterDeclCompletion() {
+ ++global_counters.m_decls_completed_count;
+ ++local_counters.m_decls_completed_count;
+ }
+
+ static void RegisterRecordLayout() {
+ ++global_counters.m_record_layout_count;
+ ++local_counters.m_record_layout_count;
+ }
+
+private:
+ struct Counters {
+ uint64_t m_visible_query_count;
+ uint64_t m_lexical_query_count;
+ uint64_t m_lldb_import_count;
+ uint64_t m_clang_import_count;
+ uint64_t m_decls_completed_count;
+ uint64_t m_record_layout_count;
+ };
+
+ static Counters global_counters;
+ static Counters local_counters;
+
+ static void DumpCounters(Log *log, Counters &counters);
+};
+
+class ClangASTImporter {
+public:
+ struct LayoutInfo {
+ LayoutInfo()
+ : bit_size(0), alignment(0), field_offsets(), base_offsets(),
+ vbase_offsets() {}
+ uint64_t bit_size;
+ uint64_t alignment;
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ vbase_offsets;
+ };
+
+ ClangASTImporter()
+ : m_file_manager(clang::FileSystemOptions(),
+ FileSystem::Instance().GetVirtualFileSystem()) {}
+
+ clang::QualType CopyType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx, clang::QualType type);
+
+ lldb::opaque_compiler_type_t CopyType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ lldb::opaque_compiler_type_t type);
+
+ CompilerType CopyType(ClangASTContext &dst, const CompilerType &src_type);
+
+ clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx,
+ clang::Decl *decl);
+
+ lldb::opaque_compiler_type_t DeportType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ lldb::opaque_compiler_type_t type);
+
+ clang::Decl *DeportDecl(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx, clang::Decl *decl);
+
+ void InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout);
+
+ bool LayoutRecordType(
+ const clang::RecordDecl *record_decl, uint64_t &bit_size,
+ uint64_t &alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &base_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &vbase_offsets);
+
+ bool CanImport(const CompilerType &type);
+
+ bool Import(const CompilerType &type);
+
+ bool CompleteType(const CompilerType &compiler_type);
+
+ void CompleteDecl(clang::Decl *decl);
+
+ bool CompleteTagDecl(clang::TagDecl *decl);
+
+ bool CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin);
+
+ bool CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *interface_decl);
+
+ bool CompleteAndFetchChildren(clang::QualType type);
+
+ bool RequireCompleteType(clang::QualType type);
+
+ bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
+ clang::ASTContext **original_ctx) {
+ DeclOrigin origin = GetDeclOrigin(decl);
+
+ if (original_decl)
+ *original_decl = origin.decl;
+
+ if (original_ctx)
+ *original_ctx = origin.ctx;
+
+ return origin.Valid();
+ }
+
+ void SetDeclOrigin(const clang::Decl *decl, clang::Decl *original_decl);
+
+ ClangASTMetadata *GetDeclMetadata(const clang::Decl *decl);
+
+ //
+ // Namespace maps
+ //
+
+ typedef std::vector<std::pair<lldb::ModuleSP, CompilerDeclContext>>
+ NamespaceMap;
+ typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
+
+ void RegisterNamespaceMap(const clang::NamespaceDecl *decl,
+ NamespaceMapSP &namespace_map);
+
+ NamespaceMapSP GetNamespaceMap(const clang::NamespaceDecl *decl);
+
+ void BuildNamespaceMap(const clang::NamespaceDecl *decl);
+
+ //
+ // Completers for maps
+ //
+
+ class MapCompleter {
+ public:
+ virtual ~MapCompleter();
+
+ virtual void CompleteNamespaceMap(NamespaceMapSP &namespace_map,
+ ConstString name,
+ NamespaceMapSP &parent_map) const = 0;
+ };
+
+ void InstallMapCompleter(clang::ASTContext *dst_ctx,
+ MapCompleter &completer) {
+ ASTContextMetadataSP context_md;
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter == m_metadata_map.end()) {
+ context_md = ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
+ m_metadata_map[dst_ctx] = context_md;
+ } else {
+ context_md = context_md_iter->second;
+ }
+
+ context_md->m_map_completer = &completer;
+ }
+
+ void ForgetDestination(clang::ASTContext *dst_ctx);
+ void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
+
+private:
+ struct DeclOrigin {
+ DeclOrigin() : ctx(nullptr), decl(nullptr) {}
+
+ DeclOrigin(clang::ASTContext *_ctx, clang::Decl *_decl)
+ : ctx(_ctx), decl(_decl) {}
+
+ DeclOrigin(const DeclOrigin &rhs) {
+ ctx = rhs.ctx;
+ decl = rhs.decl;
+ }
+
+ void operator=(const DeclOrigin &rhs) {
+ ctx = rhs.ctx;
+ decl = rhs.decl;
+ }
+
+ bool Valid() { return (ctx != nullptr || decl != nullptr); }
+
+ clang::ASTContext *ctx;
+ clang::Decl *decl;
+ };
+
+ typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
+
+ /// ASTImporter that intercepts and records the import process of the
+ /// underlying ASTImporter.
+ ///
+ /// This class updates the map from declarations to their original
+ /// declarations and can record and complete declarations that have been
+ /// imported in a certain interval.
+ ///
+ /// When intercepting a declaration import, the ASTImporterDelegate uses the
+ /// CxxModuleHandler to replace any missing or malformed declarations with
+ /// their counterpart from a C++ module.
+ class ASTImporterDelegate : public clang::ASTImporter {
+ public:
+ ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
+ clang::ASTContext *source_ctx)
+ : clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
+ master.m_file_manager, true /*minimal*/),
+ m_decls_to_deport(nullptr), m_decls_already_deported(nullptr),
+ m_master(master), m_source_ctx(source_ctx) {}
+
+ /// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
+ /// and deattaches it at the end of the scope. Supports being used multiple
+ /// times on the same ASTImporterDelegate instance in nested scopes.
+ class CxxModuleScope {
+ /// The handler we attach to the ASTImporterDelegate.
+ CxxModuleHandler m_handler;
+ /// The ASTImporterDelegate we are supposed to attach the handler to.
+ ASTImporterDelegate &m_delegate;
+ /// True iff we attached the handler to the ASTImporterDelegate.
+ bool m_valid = false;
+
+ public:
+ CxxModuleScope(ASTImporterDelegate &delegate, clang::ASTContext *dst_ctx)
+ : m_delegate(delegate) {
+ // If the delegate doesn't have a CxxModuleHandler yet, create one
+ // and attach it.
+ if (!delegate.m_std_handler) {
+ m_handler = CxxModuleHandler(delegate, dst_ctx);
+ m_valid = true;
+ delegate.m_std_handler = &m_handler;
+ }
+ }
+ ~CxxModuleScope() {
+ if (m_valid) {
+ // Make sure no one messed with the handler we placed.
+ assert(m_delegate.m_std_handler == &m_handler);
+ m_delegate.m_std_handler = nullptr;
+ }
+ }
+ };
+
+ protected:
+ llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
+
+ public:
+ // A call to "InitDeportWorkQueues" puts the delegate into deport mode.
+ // In deport mode, every copied Decl that could require completion is
+ // recorded and placed into the decls_to_deport set.
+ //
+ // A call to "ExecuteDeportWorkQueues" completes all the Decls that
+ // are in decls_to_deport, adding any Decls it sees along the way that it
+ // hasn't already deported. It proceeds until decls_to_deport is empty.
+ //
+ // These calls must be paired. Leaving a delegate in deport mode or trying
+ // to start deport delegate with a new pair of queues will result in an
+ // assertion failure.
+
+ void
+ InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport,
+ std::set<clang::NamedDecl *> *decls_already_deported);
+ void ExecuteDeportWorkQueues();
+
+ void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
+
+ void Imported(clang::Decl *from, clang::Decl *to) override;
+
+ clang::Decl *GetOriginalDecl(clang::Decl *To) override;
+
+ /// Decls we should ignore when mapping decls back to their original
+ /// ASTContext. Used by the CxxModuleHandler to mark declarations that
+ /// were created from the 'std' C++ module to prevent that the Importer
+ /// tries to sync them with the broken equivalent in the debug info AST.
+ std::set<clang::Decl *> m_decls_to_ignore;
+ std::set<clang::NamedDecl *> *m_decls_to_deport;
+ std::set<clang::NamedDecl *> *m_decls_already_deported;
+ ClangASTImporter &m_master;
+ clang::ASTContext *m_source_ctx;
+ CxxModuleHandler *m_std_handler = nullptr;
+ };
+
+ typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
+ typedef std::map<clang::ASTContext *, ImporterDelegateSP> DelegateMap;
+ typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP>
+ NamespaceMetaMap;
+
+ struct ASTContextMetadata {
+ ASTContextMetadata(clang::ASTContext *dst_ctx)
+ : m_dst_ctx(dst_ctx), m_delegates(), m_origins(), m_namespace_maps(),
+ m_map_completer(nullptr) {}
+
+ clang::ASTContext *m_dst_ctx;
+ DelegateMap m_delegates;
+ OriginMap m_origins;
+
+ NamespaceMetaMap m_namespace_maps;
+ MapCompleter *m_map_completer;
+ };
+
+ typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP;
+ typedef std::map<const clang::ASTContext *, ASTContextMetadataSP>
+ ContextMetadataMap;
+
+ ContextMetadataMap m_metadata_map;
+
+ ASTContextMetadataSP GetContextMetadata(clang::ASTContext *dst_ctx) {
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter == m_metadata_map.end()) {
+ ASTContextMetadataSP context_md =
+ ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
+ m_metadata_map[dst_ctx] = context_md;
+ return context_md;
+ } else {
+ return context_md_iter->second;
+ }
+ }
+
+ ASTContextMetadataSP MaybeGetContextMetadata(clang::ASTContext *dst_ctx) {
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter != m_metadata_map.end())
+ return context_md_iter->second;
+ else
+ return ASTContextMetadataSP();
+ }
+
+ ImporterDelegateSP GetDelegate(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx) {
+ ASTContextMetadataSP context_md = GetContextMetadata(dst_ctx);
+
+ DelegateMap &delegates = context_md->m_delegates;
+ DelegateMap::iterator delegate_iter = delegates.find(src_ctx);
+
+ if (delegate_iter == delegates.end()) {
+ ImporterDelegateSP delegate =
+ ImporterDelegateSP(new ASTImporterDelegate(*this, dst_ctx, src_ctx));
+ delegates[src_ctx] = delegate;
+ return delegate;
+ } else {
+ return delegate_iter->second;
+ }
+ }
+
+ DeclOrigin GetDeclOrigin(const clang::Decl *decl);
+
+ clang::FileManager m_file_manager;
+ typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo>
+ RecordDeclToLayoutMap;
+
+ RecordDeclToLayoutMap m_record_decl_to_layout_map;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ClangASTImporter_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
new file mode 100644
index 0000000..a2d4f81
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -0,0 +1,138 @@
+//===-- ClangExternalASTSourceCallbacks.h -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangExternalASTSourceCallbacks_h_
+#define liblldb_ClangExternalASTSourceCallbacks_h_
+
+#include <stdint.h>
+
+#include "clang/AST/CharUnits.h"
+#include "llvm/ADT/DenseMap.h"
+
+#include "lldb/Core/ClangForward.h"
+#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-enumerations.h"
+
+namespace lldb_private {
+
+class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon {
+public:
+ typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
+ typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
+ clang::ObjCInterfaceDecl *);
+ typedef void (*FindExternalVisibleDeclsByNameCallback)(
+ void *baton, const clang::DeclContext *DC, clang::DeclarationName Name,
+ llvm::SmallVectorImpl<clang::NamedDecl *> *results);
+ typedef bool (*LayoutRecordTypeCallback)(
+ void *baton, const clang::RecordDecl *Record, uint64_t &Size,
+ uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &VirtualBaseOffsets);
+
+ ClangExternalASTSourceCallbacks(
+ CompleteTagDeclCallback tag_decl_callback,
+ CompleteObjCInterfaceDeclCallback objc_decl_callback,
+ FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
+ void *callback_baton)
+ : m_callback_tag_decl(tag_decl_callback),
+ m_callback_objc_decl(objc_decl_callback),
+ m_callback_find_by_name(find_by_name_callback),
+ m_callback_layout_record_type(layout_record_type_callback),
+ m_callback_baton(callback_baton) {}
+
+ // clang::ExternalASTSource
+
+ clang::Decl *GetExternalDecl(uint32_t ID) override {
+ // This method only needs to be implemented if the AST source ever passes
+ // back decl sets as VisibleDeclaration objects.
+ return nullptr;
+ }
+
+ clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
+ // This operation is meant to be used via a LazyOffsetPtr. It only needs
+ // to be implemented if the AST source uses methods like
+ // FunctionDecl::setLazyBody when building decls.
+ return nullptr;
+ }
+
+ clang::Selector GetExternalSelector(uint32_t ID) override {
+ // This operation only needs to be implemented if the AST source returns
+ // non-zero for GetNumKnownSelectors().
+ return clang::Selector();
+ }
+
+ uint32_t GetNumExternalSelectors() override { return 0; }
+
+ clang::CXXBaseSpecifier *
+ GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
+ return nullptr;
+ }
+
+ virtual void MaterializeVisibleDecls(const clang::DeclContext *decl_ctx) {}
+
+ void FindExternalLexicalDecls(
+ const clang::DeclContext *DC,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &Result) override;
+
+ bool
+ FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx,
+ clang::DeclarationName decl_name) override;
+
+ void CompleteType(clang::TagDecl *tag_decl) override;
+
+ void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
+
+ bool layoutRecordType(
+ const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &VirtualBaseOffsets) override;
+
+ void SetExternalSourceCallbacks(
+ CompleteTagDeclCallback tag_decl_callback,
+ CompleteObjCInterfaceDeclCallback objc_decl_callback,
+ FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
+ void *callback_baton) {
+ m_callback_tag_decl = tag_decl_callback;
+ m_callback_objc_decl = objc_decl_callback;
+ m_callback_find_by_name = find_by_name_callback;
+ m_callback_layout_record_type = layout_record_type_callback;
+ m_callback_baton = callback_baton;
+ }
+
+ void RemoveExternalSourceCallbacks(void *callback_baton) {
+ if (callback_baton == m_callback_baton) {
+ m_callback_tag_decl = nullptr;
+ m_callback_objc_decl = nullptr;
+ m_callback_find_by_name = nullptr;
+ m_callback_layout_record_type = nullptr;
+ }
+ }
+
+protected:
+ // Classes that inherit from ClangExternalASTSourceCallbacks can see and
+ // modify these
+ CompleteTagDeclCallback m_callback_tag_decl;
+ CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
+ FindExternalVisibleDeclsByNameCallback m_callback_find_by_name;
+ LayoutRecordTypeCallback m_callback_layout_record_type;
+ void *m_callback_baton;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ClangExternalASTSourceCallbacks_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h
new file mode 100644
index 0000000..8e69f6d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h
@@ -0,0 +1,143 @@
+//===-- ClangExternalASTSourceCommon.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ClangExternalASTSourceCommon_h
+#define liblldb_ClangExternalASTSourceCommon_h
+
+// Clang headers like to use NDEBUG inside of them to enable/disable debug
+// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
+// or another. This is bad because it means that if clang was built in release
+// mode, it assumes that you are building in release mode which is not always
+// the case. You can end up with functions that are defined as empty in header
+// files when NDEBUG is not defined, and this can cause link errors with the
+// clang .a files that you have since you might be missing functions in the .a
+// file. So we have to define NDEBUG when including clang headers to avoid any
+// mismatches. This is covered by rdar://problem/8691220
+
+#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
+#define LLDB_DEFINED_NDEBUG_FOR_CLANG
+#define NDEBUG
+// Need to include assert.h so it is as clang would expect it to be (disabled)
+#include <assert.h>
+#endif
+
+#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
+#undef NDEBUG
+#undef LLDB_DEFINED_NDEBUG_FOR_CLANG
+// Need to re-include assert.h so it is as _we_ would expect it to be (enabled)
+#include <assert.h>
+#endif
+
+#include "clang/AST/ExternalASTSource.h"
+
+#include "lldb/Core/dwarf.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+
+namespace lldb_private {
+
+class ClangASTMetadata {
+public:
+ ClangASTMetadata()
+ : m_user_id(0), m_union_is_user_id(false), m_union_is_isa_ptr(false),
+ m_has_object_ptr(false), m_is_self(false), m_is_dynamic_cxx(true) {}
+
+ bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx; }
+
+ void SetIsDynamicCXXType(bool b) { m_is_dynamic_cxx = b; }
+
+ void SetUserID(lldb::user_id_t user_id) {
+ m_user_id = user_id;
+ m_union_is_user_id = true;
+ m_union_is_isa_ptr = false;
+ }
+
+ lldb::user_id_t GetUserID() const {
+ if (m_union_is_user_id)
+ return m_user_id;
+ else
+ return LLDB_INVALID_UID;
+ }
+
+ void SetISAPtr(uint64_t isa_ptr) {
+ m_isa_ptr = isa_ptr;
+ m_union_is_user_id = false;
+ m_union_is_isa_ptr = true;
+ }
+
+ uint64_t GetISAPtr() const {
+ if (m_union_is_isa_ptr)
+ return m_isa_ptr;
+ else
+ return 0;
+ }
+
+ void SetObjectPtrName(const char *name) {
+ m_has_object_ptr = true;
+ if (strcmp(name, "self") == 0)
+ m_is_self = true;
+ else if (strcmp(name, "this") == 0)
+ m_is_self = false;
+ else
+ m_has_object_ptr = false;
+ }
+
+ lldb::LanguageType GetObjectPtrLanguage() const {
+ if (m_has_object_ptr) {
+ if (m_is_self)
+ return lldb::eLanguageTypeObjC;
+ else
+ return lldb::eLanguageTypeC_plus_plus;
+ }
+ return lldb::eLanguageTypeUnknown;
+ }
+
+ const char *GetObjectPtrName() const {
+ if (m_has_object_ptr) {
+ if (m_is_self)
+ return "self";
+ else
+ return "this";
+ } else
+ return nullptr;
+ }
+
+ bool HasObjectPtr() const { return m_has_object_ptr; }
+
+ void Dump(Stream *s);
+
+private:
+ union {
+ lldb::user_id_t m_user_id;
+ uint64_t m_isa_ptr;
+ };
+
+ bool m_union_is_user_id : 1, m_union_is_isa_ptr : 1, m_has_object_ptr : 1,
+ m_is_self : 1, m_is_dynamic_cxx : 1;
+};
+
+class ClangExternalASTSourceCommon : public clang::ExternalASTSource {
+public:
+ ClangExternalASTSourceCommon();
+ ~ClangExternalASTSourceCommon() override;
+
+ ClangASTMetadata *GetMetadata(const void *object);
+ void SetMetadata(const void *object, ClangASTMetadata &metadata);
+ bool HasMetadata(const void *object);
+
+ static ClangExternalASTSourceCommon *Lookup(clang::ExternalASTSource *source);
+
+private:
+ typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;
+
+ MetadataMap m_metadata;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ClangExternalASTSourceCommon_h
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangUtil.h b/linux-x64/clang/include/lldb/Symbol/ClangUtil.h
new file mode 100644
index 0000000..d610603
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ClangUtil.h
@@ -0,0 +1,36 @@
+//===-- ClangUtil.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// A collection of helper methods and data structures for manipulating clang
+// types and decls.
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SYMBOL_CLANGUTIL_H
+#define LLDB_SYMBOL_CLANGUTIL_H
+
+#include "clang/AST/Type.h"
+
+#include "lldb/Symbol/CompilerType.h"
+
+namespace clang {
+class TagDecl;
+}
+
+namespace lldb_private {
+struct ClangUtil {
+ static bool IsClangType(const CompilerType &ct);
+
+ static clang::QualType GetQualType(const CompilerType &ct);
+
+ static clang::QualType GetCanonicalQualType(const CompilerType &ct);
+
+ static CompilerType RemoveFastQualifiers(const CompilerType &ct);
+
+ static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h b/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h
new file mode 100644
index 0000000..2646661
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h
@@ -0,0 +1,167 @@
+//===-- CompactUnwindInfo.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompactUnwindInfo_h_
+#define liblldb_CompactUnwindInfo_h_
+
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/lldb-private.h"
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+
+// Compact Unwind info is an unwind format used on Darwin. The unwind
+// instructions for typical compiler-generated functions can be expressed in a
+// 32-bit encoding. The format includes a two-level index so the unwind
+// information for a function can be found by two binary searches in the
+// section. It can represent both stack frames that use a frame-pointer
+// register and frameless functions, on i386/x86_64 for instance. When a
+// function is too complex to be represented in the compact unwind format, it
+// calls out to eh_frame unwind instructions.
+
+// On Mac OS X / iOS, a function will have either a compact unwind
+// representation or an eh_frame representation. If lldb is going to benefit
+// from the compiler's description about saved register locations, it must be
+// able to read both sources of information.
+
+class CompactUnwindInfo {
+public:
+ CompactUnwindInfo(ObjectFile &objfile, lldb::SectionSP §ion);
+
+ ~CompactUnwindInfo();
+
+ bool GetUnwindPlan(Target &target, Address addr, UnwindPlan &unwind_plan);
+
+ bool IsValid(const lldb::ProcessSP &process_sp);
+
+private:
+ // The top level index entries of the compact unwind info
+ // (internal representation of struct
+ // unwind_info_section_header_index_entry)
+ // There are relatively few of these (one per 500/1000 functions, depending
+ // on format) so creating them on first scan will not be too costly.
+ struct UnwindIndex {
+ uint32_t function_offset; // The offset of the first function covered by
+ // this index
+ uint32_t second_level; // The offset (inside unwind_info sect) to the second
+ // level page for this index
+ // (either UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED)
+ uint32_t lsda_array_start; // The offset (inside unwind_info sect) LSDA
+ // array for this index
+ uint32_t lsda_array_end; // The offset to the LSDA array for the NEXT index
+ bool sentinal_entry; // There is an empty index at the end which provides
+ // the upper bound of
+ // function addresses that are described
+
+ UnwindIndex()
+ : function_offset(0), second_level(0), lsda_array_start(0),
+ lsda_array_end(0), sentinal_entry(false) {}
+
+ bool operator<(const CompactUnwindInfo::UnwindIndex &rhs) const {
+ return function_offset < rhs.function_offset;
+ }
+
+ bool operator==(const CompactUnwindInfo::UnwindIndex &rhs) const {
+ return function_offset == rhs.function_offset;
+ }
+ };
+
+ // An internal object used to store the information we retrieve about a
+ // function -- the encoding bits and possibly the LSDA/personality function.
+ struct FunctionInfo {
+ uint32_t encoding; // compact encoding 32-bit value for this function
+ Address lsda_address; // the address of the LSDA data for this function
+ Address personality_ptr_address; // the address where the personality
+ // routine addr can be found
+
+ uint32_t valid_range_offset_start; // first offset that this encoding is
+ // valid for (start of the function)
+ uint32_t
+ valid_range_offset_end; // the offset of the start of the next function
+ FunctionInfo()
+ : encoding(0), lsda_address(), personality_ptr_address(),
+ valid_range_offset_start(0), valid_range_offset_end(0) {}
+ };
+
+ struct UnwindHeader {
+ uint32_t version;
+ uint32_t common_encodings_array_offset;
+ uint32_t common_encodings_array_count;
+ uint32_t personality_array_offset;
+ uint32_t personality_array_count;
+
+ UnwindHeader()
+ : common_encodings_array_offset(0), common_encodings_array_count(0),
+ personality_array_offset(0), personality_array_count(0) {}
+ };
+
+ void ScanIndex(const lldb::ProcessSP &process_sp);
+
+ bool GetCompactUnwindInfoForFunction(Target &target, Address address,
+ FunctionInfo &unwind_info);
+
+ lldb::offset_t
+ BinarySearchRegularSecondPage(uint32_t entry_page_offset,
+ uint32_t entry_count, uint32_t function_offset,
+ uint32_t *entry_func_start_offset,
+ uint32_t *entry_func_end_offset);
+
+ uint32_t BinarySearchCompressedSecondPage(uint32_t entry_page_offset,
+ uint32_t entry_count,
+ uint32_t function_offset_to_find,
+ uint32_t function_offset_base,
+ uint32_t *entry_func_start_offset,
+ uint32_t *entry_func_end_offset);
+
+ uint32_t GetLSDAForFunctionOffset(uint32_t lsda_offset, uint32_t lsda_count,
+ uint32_t function_offset);
+
+ bool CreateUnwindPlan_x86_64(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_i386(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_arm64(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_armv7(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ ObjectFile &m_objfile;
+ lldb::SectionSP m_section_sp;
+ lldb::DataBufferSP m_section_contents_if_encrypted; // if the binary is
+ // encrypted, read the
+ // sect contents
+ // out of live memory and cache them here
+ std::mutex m_mutex;
+ std::vector<UnwindIndex> m_indexes;
+
+ LazyBool m_indexes_computed; // eLazyBoolYes once we've tried to parse the
+ // unwind info
+ // eLazyBoolNo means we cannot parse the unwind info & should not retry
+ // eLazyBoolCalculate means we haven't tried to parse it yet
+
+ DataExtractor m_unwindinfo_data;
+ bool m_unwindinfo_data_computed; // true once we've mapped in the unwindinfo
+ // data
+
+ UnwindHeader m_unwind_header;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CompactUnwindInfo_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/CompileUnit.h b/linux-x64/clang/include/lldb/Symbol/CompileUnit.h
new file mode 100644
index 0000000..c3ba2e2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CompileUnit.h
@@ -0,0 +1,422 @@
+//===-- CompileUnit.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompUnit_h_
+#define liblldb_CompUnit_h_
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Symbol/DebugMacros.h"
+#include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/SourceModule.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "llvm/ADT/DenseMap.h"
+
+namespace lldb_private {
+/// \class CompileUnit CompileUnit.h "lldb/Symbol/CompileUnit.h"
+/// A class that describes a compilation unit.
+///
+/// A representation of a compilation unit, or compiled source file.
+/// The UserID of the compile unit is specified by the SymbolFile plug-in and
+/// can have any value as long as the value is unique within the Module that
+/// owns this compile units.
+///
+/// Each compile unit has a list of functions, global and static variables,
+/// support file list (include files and inlined source files), and a line
+/// table.
+class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
+ public ModuleChild,
+ public FileSpec,
+ public UserID,
+ public SymbolContextScope {
+public:
+ /// Construct with a module, path, UID and language.
+ ///
+ /// Initialize the compile unit given the owning \a module, a path to
+ /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the
+ /// source language type.
+ ///
+ /// \param[in] module
+ /// The parent module that owns this compile unit. This value
+ /// must be a valid pointer value.
+ ///
+ /// \param[in] user_data
+ /// User data where the SymbolFile parser can store data.
+ ///
+ /// \param[in] pathname
+ /// The path to the source file for this compile unit.
+ ///
+ /// \param[in] uid
+ /// The user ID of the compile unit. This value is supplied by
+ /// the SymbolFile plug-in and should be a value that allows
+ /// the SymbolFile plug-in to easily locate and parse additional
+ /// information for the compile unit.
+ ///
+ /// \param[in] language
+ /// A language enumeration type that describes the main language
+ /// of this compile unit.
+ ///
+ /// \param[in] is_optimized
+ /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
+ /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
+ /// an extra call into SymbolVendor will be made to calculate if
+ /// the compile unit is optimized will be made when
+ /// CompileUnit::GetIsOptimized() is called.
+ ///
+ /// \see lldb::LanguageType
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
+ const char *pathname, lldb::user_id_t uid,
+ lldb::LanguageType language, lldb_private::LazyBool is_optimized);
+
+ /// Construct with a module, file spec, UID and language.
+ ///
+ /// Initialize the compile unit given the owning \a module, a path to
+ /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the
+ /// source language type.
+ ///
+ /// \param[in] module
+ /// The parent module that owns this compile unit. This value
+ /// must be a valid pointer value.
+ ///
+ /// \param[in] user_data
+ /// User data where the SymbolFile parser can store data.
+ ///
+ /// \param[in] file_spec
+ /// The file specification for the source file of this compile
+ /// unit.
+ ///
+ /// \param[in] uid
+ /// The user ID of the compile unit. This value is supplied by
+ /// the SymbolFile plug-in and should be a value that allows
+ /// the plug-in to easily locate and parse
+ /// additional information for the compile unit.
+ ///
+ /// \param[in] language
+ /// A language enumeration type that describes the main language
+ /// of this compile unit.
+ ///
+ /// \param[in] is_optimized
+ /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
+ /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
+ /// an extra call into SymbolVendor will be made to calculate if
+ /// the compile unit is optimized will be made when
+ /// CompileUnit::GetIsOptimized() is called.
+ ///
+ /// \see lldb::LanguageType
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
+ const FileSpec &file_spec, lldb::user_id_t uid,
+ lldb::LanguageType language, lldb_private::LazyBool is_optimized);
+
+ /// Destructor
+ ~CompileUnit() override;
+
+ /// Add a function to this compile unit.
+ ///
+ /// Typically called by the SymbolFile plug-ins as they partially parse the
+ /// debug information.
+ ///
+ /// \param[in] function_sp
+ /// A shared pointer to the Function object.
+ void AddFunction(lldb::FunctionSP &function_sp);
+
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// \see SymbolContextScope
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// \see SymbolContextScope
+ void DumpSymbolContext(Stream *s) override;
+
+ lldb::LanguageType GetLanguage();
+
+ void SetLanguage(lldb::LanguageType language) {
+ m_flags.Set(flagsParsedLanguage);
+ m_language = language;
+ }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ /// Apply a lambda to each function in this compile unit.
+ ///
+ /// This provides raw access to the function shared pointer list and will not
+ /// cause the SymbolFile plug-in to parse any unparsed functions.
+ ///
+ /// \note Prefer using FindFunctionByUID over this if possible.
+ ///
+ /// \param[in] lambda
+ /// The lambda that should be applied to every function. The lambda can
+ /// return true if the iteration should be aborted earlier.
+ void ForeachFunction(
+ llvm::function_ref<bool(const lldb::FunctionSP &)> lambda) const;
+
+ /// Dump the compile unit contents to the stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] show_context
+ /// If \b true, variables will dump their symbol context
+ /// information.
+ void Dump(Stream *s, bool show_context) const;
+
+ /// Find the line entry by line and optional inlined file spec.
+ ///
+ /// Finds the first line entry that has an index greater than \a start_idx
+ /// that matches \a line. If \a file_spec_ptr is NULL, then the search
+ /// matches line entries whose file matches the file for the compile unit.
+ /// If \a file_spec_ptr is not NULL, line entries must match the specified
+ /// file spec (for inlined line table entries).
+ ///
+ /// Multiple calls to this function can find all entries that match a given
+ /// file and line by starting with \a start_idx equal to zero, and calling
+ /// this function back with the return value + 1.
+ ///
+ /// \param[in] start_idx
+ /// The zero based index at which to start looking for matches.
+ ///
+ /// \param[in] line
+ /// The line number to search for.
+ ///
+ /// \param[in] file_spec_ptr
+ /// If non-NULL search for entries that match this file spec,
+ /// else if NULL, search for line entries that match the compile
+ /// unit file.
+ ///
+ /// \param[in] exact
+ /// If \btrue match only if there is a line table entry for this line
+ /// number.
+ /// If \bfalse, find the line table entry equal to or after this line
+ /// number.
+ ///
+ /// \param[out] line_entry
+ /// If non-NULL, a copy of the line entry that was found.
+ ///
+ /// \return
+ /// The zero based index of a matching line entry, or UINT32_MAX
+ /// if no matching line entry is found.
+ uint32_t FindLineEntry(uint32_t start_idx, uint32_t line,
+ const FileSpec *file_spec_ptr, bool exact,
+ LineEntry *line_entry);
+
+ /// Get the line table for the compile unit.
+ ///
+ /// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins
+ /// use this function to determine if the line table has be parsed yet.
+ /// Clients use this function to get the line table from a compile unit.
+ ///
+ /// \return
+ /// The line table object pointer, or NULL if this line table
+ /// hasn't been parsed yet.
+ LineTable *GetLineTable();
+
+ DebugMacros *GetDebugMacros();
+
+ /// Get the compile unit's support file list.
+ ///
+ /// The support file list is used by the line table, and any objects that
+ /// have valid Declaration objects.
+ ///
+ /// \return
+ /// A support file list object.
+ const FileSpecList &GetSupportFiles();
+
+ /// Get the compile unit's imported module list.
+ ///
+ /// This reports all the imports that the compile unit made, including the
+ /// current module.
+ ///
+ /// \return
+ /// A list of imported modules.
+ const std::vector<SourceModule> &GetImportedModules();
+
+ /// Get the SymbolFile plug-in user data.
+ ///
+ /// SymbolFile plug-ins can store user data to internal state or objects to
+ /// quickly allow them to parse more information for a given object.
+ ///
+ /// \return
+ /// The user data stored with the CompileUnit when it was
+ /// constructed.
+ void *GetUserData() const;
+
+ /// Get the variable list for a compile unit.
+ ///
+ /// Called by clients to get the variable list for a compile unit. The
+ /// variable list will contain all global and static variables that were
+ /// defined at the compile unit level.
+ ///
+ /// \param[in] can_create
+ /// If \b true, the variable list will be parsed on demand. If
+ /// \b false, the current variable list will be returned even
+ /// if it contains a NULL VariableList object (typically
+ /// called by dumping routines that want to display only what
+ /// has currently been parsed).
+ ///
+ /// \return
+ /// A shared pointer to a variable list, that can contain NULL
+ /// VariableList pointer if there are no global or static
+ /// variables.
+ lldb::VariableListSP GetVariableList(bool can_create);
+
+ /// Finds a function by user ID.
+ ///
+ /// Typically used by SymbolFile plug-ins when partially parsing the debug
+ /// information to see if the function has been parsed yet.
+ ///
+ /// \param[in] uid
+ /// The user ID of the function to find. This value is supplied
+ /// by the SymbolFile plug-in and should be a value that
+ /// allows the plug-in to easily locate and parse additional
+ /// information in the function.
+ ///
+ /// \return
+ /// A shared pointer to the function object that might contain
+ /// a NULL Function pointer.
+ lldb::FunctionSP FindFunctionByUID(lldb::user_id_t uid);
+
+ /// Set the line table for the compile unit.
+ ///
+ /// Called by the SymbolFile plug-in when if first parses the line table and
+ /// hands ownership of the line table to this object. The compile unit owns
+ /// the line table object and will delete the object when it is deleted.
+ ///
+ /// \param[in] line_table
+ /// A line table object pointer that this object now owns.
+ void SetLineTable(LineTable *line_table);
+
+ void SetDebugMacros(const DebugMacrosSP &debug_macros);
+
+ /// Set accessor for the variable list.
+ ///
+ /// Called by the SymbolFile plug-ins after they have parsed the variable
+ /// lists and are ready to hand ownership of the list over to this object.
+ ///
+ /// \param[in] variable_list_sp
+ /// A shared pointer to a VariableList.
+ void SetVariableList(lldb::VariableListSP &variable_list_sp);
+
+ /// Resolve symbol contexts by file and line.
+ ///
+ /// Given a file in \a file_spec, and a line number, find all instances and
+ /// append them to the supplied symbol context list \a sc_list.
+ ///
+ /// \param[in] file_spec
+ /// A file specification. If \a file_spec contains no directory
+ /// information, only the basename will be used when matching
+ /// contexts. If the directory in \a file_spec is valid, a
+ /// complete file specification match will be performed.
+ ///
+ /// \param[in] line
+ /// The line number to match against the compile unit's line
+ /// tables.
+ ///
+ /// \param[in] check_inlines
+ /// If \b true this function will also match any inline
+ /// file and line matches. If \b false, the compile unit's
+ /// file specification must match \a file_spec for any matches
+ /// to be returned.
+ ///
+ /// \param[in] exact
+ /// If true, only resolve the context if \a line exists in the line table.
+ /// If false, resolve the context to the closest line greater than \a line
+ /// in the line table.
+ ///
+ /// \param[in] resolve_scope
+ /// For each matching line entry, this bitfield indicates what
+ /// values within each SymbolContext that gets added to \a
+ /// sc_list will be resolved. See the SymbolContext::Scope
+ /// enumeration for a list of all available bits that can be
+ /// resolved. Only SymbolContext entries that can be resolved
+ /// using a LineEntry base address will be able to be resolved.
+ ///
+ /// \param[out] sc_list
+ /// A SymbolContext list class that will get any matching
+ /// entries appended to.
+ ///
+ /// \return
+ /// The number of new matches that were added to \a sc_list.
+ ///
+ /// \see enum SymbolContext::Scope
+ uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
+ bool check_inlines, bool exact,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContextList &sc_list);
+
+ /// Get whether compiler optimizations were enabled for this compile unit
+ ///
+ /// "optimized" means that the debug experience may be difficult for the
+ /// user to understand. Variables may not be available when the developer
+ /// would expect them, stepping through the source lines in the function may
+ /// appear strange, etc.
+ ///
+ /// \return
+ /// Returns 'true' if this compile unit was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this compile unit was built without optimization.
+ bool GetIsOptimized();
+
+ /// Returns the number of functions in this compile unit
+ size_t GetNumFunctions() const { return m_functions_by_uid.size(); }
+
+protected:
+ /// User data for the SymbolFile parser to store information into.
+ void *m_user_data;
+ /// The programming language enumeration value.
+ lldb::LanguageType m_language;
+ /// Compile unit flags that help with partial parsing.
+ Flags m_flags;
+ /// Maps UIDs to functions.
+ llvm::DenseMap<lldb::user_id_t, lldb::FunctionSP> m_functions_by_uid;
+ /// All modules, including the current module, imported by this
+ /// compile unit.
+ std::vector<SourceModule> m_imported_modules;
+ /// Files associated with this compile unit's line table and
+ /// declarations.
+ FileSpecList m_support_files;
+ /// Line table that will get parsed on demand.
+ std::unique_ptr<LineTable> m_line_table_up;
+ /// Debug macros that will get parsed on demand.
+ DebugMacrosSP m_debug_macros_sp;
+ /// Global and static variable list that will get parsed on demand.
+ lldb::VariableListSP m_variables;
+ /// eLazyBoolYes if this compile unit was compiled with
+ /// optimization.
+ lldb_private::LazyBool m_is_optimized;
+
+private:
+ enum {
+ flagsParsedAllFunctions =
+ (1u << 0), ///< Have we already parsed all our functions
+ flagsParsedVariables =
+ (1u << 1), ///< Have we already parsed globals and statics?
+ flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support
+ ///files for this compile unit?
+ flagsParsedLineTable =
+ (1u << 3), ///< Have we parsed the line table already?
+ flagsParsedLanguage = (1u << 4), ///< Have we parsed the language already?
+ flagsParsedImportedModules =
+ (1u << 5), ///< Have we parsed the imported modules already?
+ flagsParsedDebugMacros =
+ (1u << 6) ///< Have we parsed the debug macros already?
+ };
+
+ DISALLOW_COPY_AND_ASSIGN(CompileUnit);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CompUnit_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h b/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h
new file mode 100644
index 0000000..4817ec4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h
@@ -0,0 +1,87 @@
+//===-- CompilerDecl.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompilerDecl_h_
+#define liblldb_CompilerDecl_h_
+
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class CompilerDecl {
+public:
+ // Constructors and Destructors
+ CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {}
+
+ CompilerDecl(TypeSystem *type_system, void *decl)
+ : m_type_system(type_system), m_opaque_decl(decl) {}
+
+ ~CompilerDecl() {}
+
+ // Tests
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool operator<(const CompilerDecl &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl < rhs.m_opaque_decl;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const {
+ return m_type_system != nullptr && m_opaque_decl != nullptr;
+ }
+
+ bool IsClang() const;
+
+ // Accessors
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ void *GetOpaqueDecl() const { return m_opaque_decl; }
+
+ void SetDecl(TypeSystem *type_system, void *decl) {
+ m_type_system = type_system;
+ m_opaque_decl = decl;
+ }
+
+ void Clear() {
+ m_type_system = nullptr;
+ m_opaque_decl = nullptr;
+ }
+
+ ConstString GetName() const;
+
+ ConstString GetMangledName() const;
+
+ CompilerDeclContext GetDeclContext() const;
+
+ // If this decl represents a function, return the return type
+ CompilerType GetFunctionReturnType() const;
+
+ // If this decl represents a function, return the number of arguments for the
+ // function
+ size_t GetNumFunctionArguments() const;
+
+ // If this decl represents a function, return the argument type given a zero
+ // based argument index
+ CompilerType GetFunctionArgumentType(size_t arg_idx) const;
+
+private:
+ TypeSystem *m_type_system;
+ void *m_opaque_decl;
+};
+
+bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs);
+bool operator!=(const CompilerDecl &lhs, const CompilerDecl &rhs);
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_CompilerDecl_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h b/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h
new file mode 100644
index 0000000..e7958c0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h
@@ -0,0 +1,117 @@
+//===-- CompilerDeclContext.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompilerDeclContext_h_
+#define liblldb_CompilerDeclContext_h_
+
+#include <vector>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class CompilerDeclContext {
+public:
+ // Constructors and Destructors
+ CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {}
+
+ CompilerDeclContext(TypeSystem *type_system, void *decl_ctx)
+ : m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {}
+
+ ~CompilerDeclContext() {}
+
+ // Tests
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool operator<(const CompilerDeclContext &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const {
+ return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
+ }
+
+ bool IsClang() const;
+
+ std::vector<CompilerDecl> FindDeclByName(ConstString name,
+ const bool ignore_using_decls);
+
+ /// Checks if this decl context represents a method of a class.
+ ///
+ /// \param[out] language_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the language that respresents the method.
+ ///
+ /// \param[out] is_instance_method_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the method is an instance function (true)
+ /// or a class method (false indicating the function is static, or
+ /// doesn't require an instance of the class to be called).
+ ///
+ /// \param[out] language_object_name_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if implicit object name for the language
+ /// like "this" for C++, and "self" for Objective C.
+ ///
+ /// \return
+ /// Returns true if this is a decl context that represents a method
+ /// in a struct, union or class.
+ bool IsClassMethod(lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr);
+
+ /// Check if the given other decl context is contained in the lookup
+ /// of this decl context (for example because the other context is a nested
+ /// inline namespace).
+ ///
+ /// @param[in] other
+ /// The other decl context for which we should check if it is contained
+ /// in the lookoup of this context.
+ ///
+ /// @return
+ /// Returns true iff the other decl context is contained in the lookup
+ /// of this decl context.
+ bool IsContainedInLookup(CompilerDeclContext other) const;
+
+ // Accessors
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ void *GetOpaqueDeclContext() const { return m_opaque_decl_ctx; }
+
+ void SetDeclContext(TypeSystem *type_system, void *decl_ctx) {
+ m_type_system = type_system;
+ m_opaque_decl_ctx = decl_ctx;
+ }
+
+ void Clear() {
+ m_type_system = nullptr;
+ m_opaque_decl_ctx = nullptr;
+ }
+
+ ConstString GetName() const;
+
+ ConstString GetScopeQualifiedName() const;
+
+ bool IsStructUnionOrClass() const;
+
+private:
+ TypeSystem *m_type_system;
+ void *m_opaque_decl_ctx;
+};
+
+bool operator==(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+bool operator!=(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_CompilerDeclContext_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerType.h b/linux-x64/clang/include/lldb/Symbol/CompilerType.h
new file mode 100644
index 0000000..98d9165
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerType.h
@@ -0,0 +1,404 @@
+//===-- CompilerType.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CompilerType_h_
+#define liblldb_CompilerType_h_
+
+#include <functional>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/ClangForward.h"
+#include "lldb/lldb-private.h"
+#include "llvm/ADT/APSInt.h"
+
+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 opaque clang
+// type and often the ASTContext is needed when doing various type related
+// tasks, so this class allows both items to travel in a single very
+// lightweight class that can be used. There are many static equivalents of the
+// member functions that allow the ASTContext and the opaque clang QualType to
+// be specified for ease of use and to avoid code duplication.
+class CompilerType {
+public:
+ // Constructors and Destructors
+ CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
+ CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
+
+ CompilerType(const CompilerType &rhs)
+ : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
+
+ CompilerType() : m_type(nullptr), m_type_system(nullptr) {}
+
+ ~CompilerType();
+
+ // Operators
+
+ const CompilerType &operator=(const CompilerType &rhs) {
+ m_type = rhs.m_type;
+ m_type_system = rhs.m_type_system;
+ return *this;
+ }
+
+ // Tests
+
+ explicit operator bool() const {
+ return m_type != nullptr && m_type_system != nullptr;
+ }
+
+ bool operator<(const CompilerType &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_type < rhs.m_type;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const { return m_type != nullptr && m_type_system != nullptr; }
+
+ bool IsArrayType(CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) const;
+
+ bool IsVectorType(CompilerType *element_type, uint64_t *size) const;
+
+ bool IsArrayOfScalarType() const;
+
+ bool IsAggregateType() const;
+
+ bool IsAnonymousType() const;
+
+ bool IsBeingDefined() const;
+
+ bool IsCharType() const;
+
+ bool IsCompleteType() const;
+
+ bool IsConst() const;
+
+ bool IsCStringType(uint32_t &length) const;
+
+ bool IsDefined() const;
+
+ bool IsFloatingPointType(uint32_t &count, bool &is_complex) const;
+
+ bool IsFunctionType(bool *is_variadic_ptr = nullptr) const;
+
+ uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
+
+ size_t GetNumberOfFunctionArguments() const;
+
+ CompilerType GetFunctionArgumentAtIndex(const size_t index) const;
+
+ bool IsVariadicFunctionType() const;
+
+ bool IsFunctionPointerType() const;
+
+ bool IsBlockPointerType(CompilerType *function_pointer_type_ptr) const;
+
+ bool IsIntegerType(bool &is_signed) const;
+
+ bool IsEnumerationType(bool &is_signed) const;
+
+ bool IsIntegerOrEnumerationType(bool &is_signed) const;
+
+ bool IsPolymorphicClass() const;
+
+ bool
+ IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
+ return IsPossibleDynamicType(target_type, true, false);
+ }
+
+ bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) const;
+
+ bool IsPointerToScalarType() const;
+
+ bool IsRuntimeGeneratedType() const;
+
+ bool IsPointerType(CompilerType *pointee_type = nullptr) const;
+
+ bool IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
+
+ bool IsReferenceType(CompilerType *pointee_type = nullptr,
+ bool *is_rvalue = nullptr) const;
+
+ bool ShouldTreatScalarValueAsAddress() const;
+
+ bool IsScalarType() const;
+
+ bool IsTypedefType() const;
+
+ bool IsVoidType() const;
+
+ // Type Completion
+
+ bool GetCompleteType() const;
+
+ // AST related queries
+
+ size_t GetPointerByteSize() const;
+
+ // Accessors
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ ConstString GetConstQualifiedTypeName() const;
+
+ ConstString GetConstTypeName() const;
+
+ ConstString GetTypeName() const;
+
+ ConstString GetDisplayTypeName() const;
+
+ uint32_t
+ GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
+
+ lldb::LanguageType GetMinimumLanguage();
+
+ lldb::opaque_compiler_type_t GetOpaqueQualType() const { return m_type; }
+
+ lldb::TypeClass GetTypeClass() const;
+
+ void SetCompilerType(TypeSystem *type_system,
+ lldb::opaque_compiler_type_t type);
+
+ void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
+
+ unsigned GetTypeQualifiers() const;
+
+ // Creating related types
+
+ CompilerType GetArrayElementType(uint64_t *stride = nullptr) const;
+
+ CompilerType GetArrayType(uint64_t size) const;
+
+ CompilerType GetCanonicalType() const;
+
+ CompilerType GetFullyUnqualifiedType() const;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount() const;
+
+ CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const;
+
+ CompilerType GetFunctionReturnType() const;
+
+ size_t GetNumMemberFunctions() const;
+
+ TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx);
+
+ // If this type is a reference to a type (L value or R value reference),
+ // return a new type with the reference removed, else return the current type
+ // itself.
+ CompilerType GetNonReferenceType() const;
+
+ // If this type is a pointer type, return the type that the pointer points
+ // to, else return an invalid type.
+ CompilerType GetPointeeType() const;
+
+ // Return a new CompilerType that is a pointer to this type
+ CompilerType GetPointerType() const;
+
+ // Return a new CompilerType that is a L value reference to this type if this
+ // type is valid and the type system supports L value references, else return
+ // an invalid type.
+ CompilerType GetLValueReferenceType() const;
+
+ // Return a new CompilerType that is a R value reference to this type if this
+ // type is valid and the type system supports R value references, else return
+ // an invalid type.
+ CompilerType GetRValueReferenceType() const;
+
+ // Return a new CompilerType adds a const modifier to this type if this type
+ // is valid and the type system supports const modifiers, else return an
+ // invalid type.
+ CompilerType AddConstModifier() const;
+
+ // Return a new CompilerType adds a volatile modifier to this type if this
+ // type is valid and the type system supports volatile modifiers, else return
+ // an invalid type.
+ CompilerType AddVolatileModifier() const;
+
+ // Return a new CompilerType adds a restrict modifier to this type if this
+ // type is valid and the type system supports restrict modifiers, else return
+ // an invalid type.
+ CompilerType AddRestrictModifier() const;
+
+ // Create a typedef to this type using "name" as the name of the typedef this
+ // type is valid and the type system supports typedefs, else return an
+ // invalid type.
+ CompilerType CreateTypedef(const char *name,
+ const CompilerDeclContext &decl_ctx) const;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType() const;
+
+ // Create related types using the current type's AST
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const;
+
+ // Exploring the type
+
+ struct IntegralTemplateArgument;
+
+ /// Return the size of the type in bytes.
+ llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
+ /// Return the size of the type in bits.
+ llvm::Optional<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
+
+ lldb::Encoding GetEncoding(uint64_t &count) const;
+
+ lldb::Format GetFormat() const;
+
+ size_t GetTypeBitAlign() const;
+
+ uint32_t GetNumChildren(bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) const;
+
+ lldb::BasicType GetBasicTypeEnumeration() const;
+
+ static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
+
+ // If this type is an enumeration, iterate through all of its enumerators
+ // using a callback. If the callback returns true, keep iterating, else abort
+ // the iteration.
+ void ForEachEnumerator(
+ std::function<bool(const CompilerType &integer_type,
+ ConstString name,
+ const llvm::APSInt &value)> const &callback) const;
+
+ uint32_t GetNumFields() const;
+
+ CompilerType GetFieldAtIndex(size_t idx, std::string &name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) const;
+
+ uint32_t GetNumDirectBaseClasses() const;
+
+ uint32_t GetNumVirtualBaseClasses() const;
+
+ CompilerType GetDirectBaseClassAtIndex(size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
+ CompilerType GetVirtualBaseClassAtIndex(size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
+ uint32_t GetIndexOfFieldWithName(const char *name,
+ CompilerType *field_compiler_type = nullptr,
+ uint64_t *bit_offset_ptr = nullptr,
+ uint32_t *bitfield_bit_size_ptr = nullptr,
+ bool *is_bitfield_ptr = nullptr) const;
+
+ CompilerType GetChildCompilerTypeAtIndex(
+ ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
+ bool omit_empty_base_classes, bool ignore_array_bounds,
+ std::string &child_name, uint32_t &child_byte_size,
+ int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
+ bool &child_is_deref_of_parent, ValueObject *valobj,
+ uint64_t &language_flags) const;
+
+ // Lookup a child given a name. This function will match base class names and
+ // member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(const char *name,
+ bool omit_empty_base_classes) const;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) const;
+
+ size_t GetNumTemplateArguments() const;
+
+ lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const;
+ CompilerType GetTypeTemplateArgument(size_t idx) const;
+
+ // Returns the value of the template argument and its type.
+ llvm::Optional<IntegralTemplateArgument>
+ GetIntegralTemplateArgument(size_t idx) const;
+
+ CompilerType GetTypeForFormatters() const;
+
+ LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const;
+
+ bool IsMeaninglessWithoutDynamicResolution() const;
+
+ // Pointers & References
+
+ // Converts "s" to a floating point value and place resulting floating point
+ // bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(const char *s, uint8_t *dst,
+ size_t dst_size) const;
+
+ // Dumping types
+
+#ifndef NDEBUG
+ /// Convenience LLVM-style dump method for use in the debugger only.
+ /// Don't call this function from actual code.
+ LLVM_DUMP_METHOD void dump() const;
+#endif
+
+ void DumpValue(ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
+ const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size, uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, bool show_types,
+ bool show_summary, bool verbose, uint32_t depth);
+
+ bool DumpTypeValue(Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope);
+
+ void DumpSummary(ExecutionContext *exe_ctx, Stream *s,
+ const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size);
+
+ void DumpTypeDescription() const; // Dump to stdout
+
+ void DumpTypeDescription(Stream *s) const;
+
+ bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size, Scalar &value) const;
+
+ bool SetValueFromScalar(const Scalar &value, Stream &strm);
+
+ bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
+ AddressType address_type, DataExtractor &data);
+
+ bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
+ AddressType address_type, StreamString &new_value);
+
+ void Clear() {
+ m_type = nullptr;
+ m_type_system = nullptr;
+ }
+
+private:
+ lldb::opaque_compiler_type_t m_type;
+ TypeSystem *m_type_system;
+};
+
+bool operator==(const CompilerType &lhs, const CompilerType &rhs);
+bool operator!=(const CompilerType &lhs, const CompilerType &rhs);
+
+struct CompilerType::IntegralTemplateArgument {
+ llvm::APSInt value;
+ CompilerType type;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CompilerType_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h b/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h
new file mode 100644
index 0000000..f4aef36
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h
@@ -0,0 +1,65 @@
+//===-- CxxModuleHandler.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CxxModuleHandler_h_
+#define liblldb_CxxModuleHandler_h_
+
+#include "clang/AST/ASTImporter.h"
+#include "clang/Sema/Sema.h"
+#include "llvm/ADT/StringSet.h"
+
+namespace lldb_private {
+
+/// Handles importing decls into an ASTContext with an attached C++ module.
+///
+/// This class searches a C++ module (which must be attached to the target
+/// ASTContext) for an equivalent decl to the one that should be imported.
+/// If the decl that is found in the module is a suitable replacement
+/// for the decl that should be imported, the module decl will be treated as
+/// the result of the import process.
+///
+/// If the Decl that should be imported is a template specialization
+/// that doesn't exist yet in the target ASTContext (e.g. `std::vector<int>`),
+/// then this class tries to create the template specialization in the target
+/// ASTContext. This is only possible if the CxxModuleHandler can determine
+/// that instantiating this template is safe to do, e.g. because the target
+/// decl is a container class from the STL.
+class CxxModuleHandler {
+ /// The ASTImporter that should be used to import any Decls which aren't
+ /// directly handled by this class itself.
+ clang::ASTImporter *m_importer = nullptr;
+
+ /// The Sema instance of the target ASTContext.
+ clang::Sema *m_sema = nullptr;
+
+ /// List of template names this class currently supports. These are the
+ /// template names inside the 'std' namespace such as 'vector' or 'list'.
+ llvm::StringSet<> m_supported_templates;
+
+ /// Tries to manually instantiate the given foreign template in the target
+ /// context (designated by m_sema).
+ llvm::Optional<clang::Decl *> tryInstantiateStdTemplate(clang::Decl *d);
+
+public:
+ CxxModuleHandler() = default;
+ CxxModuleHandler(clang::ASTImporter &importer, clang::ASTContext *target);
+
+ /// Attempts to import the given decl into the target ASTContext by
+ /// deserializing it from the 'std' module. This function returns a Decl if a
+ /// Decl has been deserialized from the 'std' module. Otherwise this function
+ /// returns nothing.
+ llvm::Optional<clang::Decl *> Import(clang::Decl *d);
+
+ /// Returns true iff this instance is capable of importing any declarations
+ /// in the target ASTContext.
+ bool isValid() const { return m_sema != nullptr; }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CxxModuleHandler_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h b/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h
new file mode 100644
index 0000000..104075f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -0,0 +1,169 @@
+//===-- DWARFCallFrameInfo.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DWARFCallFrameInfo_h_
+#define liblldb_DWARFCallFrameInfo_h_
+
+#include <map>
+#include <mutex>
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Core/dwarf.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/Utility/VMRange.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// DWARFCallFrameInfo is a class which can read eh_frame and DWARF Call Frame
+// Information FDEs. It stores little information internally. Only two APIs
+// are exported - one to find the high/low pc values of a function given a text
+// address via the information in the eh_frame / debug_frame, and one to
+// generate an UnwindPlan based on the FDE in the eh_frame / debug_frame
+// section.
+
+class DWARFCallFrameInfo {
+public:
+ enum Type { EH, DWARF };
+
+ DWARFCallFrameInfo(ObjectFile &objfile, lldb::SectionSP §ion, Type type);
+
+ ~DWARFCallFrameInfo() = default;
+
+ // Locate an AddressRange that includes the provided Address in this object's
+ // eh_frame/debug_info Returns true if a range is found to cover that
+ // address.
+ bool GetAddressRange(Address addr, AddressRange &range);
+
+ /// Return an UnwindPlan based on the call frame information encoded in the
+ /// FDE of this DWARFCallFrameInfo section. The returned plan will be valid
+ /// (at least) for the given address.
+ bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan);
+
+ /// Return an UnwindPlan based on the call frame information encoded in the
+ /// FDE of this DWARFCallFrameInfo section. The returned plan will be valid
+ /// (at least) for some address in the given range.
+ bool GetUnwindPlan(const AddressRange &range, UnwindPlan &unwind_plan);
+
+ typedef RangeVector<lldb::addr_t, uint32_t> FunctionAddressAndSizeVector;
+
+ // Build a vector of file address and size for all functions in this Module
+ // based on the eh_frame FDE entries.
+ //
+ // The eh_frame information can be a useful source of file address and size
+ // of the functions in a Module. Often a binary's non-exported symbols are
+ // stripped before shipping so lldb won't know the start addr / size of many
+ // functions in the Module. But the eh_frame can help to give the addresses
+ // of these stripped symbols, at least.
+ //
+ // \param[out] function_info
+ // A vector provided by the caller is filled out. May be empty if no
+ // FDEs/no eh_frame
+ // is present in this Module.
+
+ void
+ GetFunctionAddressAndSizeVector(FunctionAddressAndSizeVector &function_info);
+
+ void ForEachFDEEntries(
+ const std::function<bool(lldb::addr_t, uint32_t, dw_offset_t)> &callback);
+
+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;
+ dw_offset_t inst_offset; // offset of CIE instructions in mCFIData
+ uint32_t inst_length; // length of CIE instructions in mCFIData
+ uint8_t ptr_encoding;
+ uint8_t lsda_addr_encoding; // The encoding of the LSDA address in the FDE
+ // augmentation data
+ lldb::addr_t personality_loc; // (file) address of the pointer to the
+ // personality routine
+ lldb_private::UnwindPlan::Row initial_row;
+
+ CIE(dw_offset_t offset)
+ : cie_offset(offset), version(-1), code_align(0), data_align(0),
+ return_addr_reg_num(LLDB_INVALID_REGNUM), inst_offset(0),
+ inst_length(0), ptr_encoding(0), lsda_addr_encoding(DW_EH_PE_omit),
+ personality_loc(LLDB_INVALID_ADDRESS), initial_row() {}
+ };
+
+ typedef std::shared_ptr<CIE> CIESP;
+
+ typedef std::map<dw_offset_t, CIESP> cie_map_t;
+
+ // Start address (file address), size, offset of FDE location used for
+ // finding an FDE for a given File address; the start address field is an
+ // offset into an individual Module.
+ typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t> FDEEntryMap;
+
+ bool IsEHFrame() const;
+
+ llvm::Optional<FDEEntryMap::Entry>
+ GetFirstFDEEntryInRange(const AddressRange &range);
+
+ void GetFDEIndex();
+
+ bool FDEToUnwindPlan(uint32_t offset, Address startaddr,
+ UnwindPlan &unwind_plan);
+
+ const CIE *GetCIE(dw_offset_t cie_offset);
+
+ void GetCFIData();
+
+ // Applies the specified DWARF opcode to the given row. This function handle
+ // the commands operates only on a single row (these are the ones what can
+ // appear both in
+ // CIE and in FDE).
+ // Returns true if the opcode is handled and false otherwise.
+ bool HandleCommonDwarfOpcode(uint8_t primary_opcode, uint8_t extended_opcode,
+ int32_t data_align, lldb::offset_t &offset,
+ UnwindPlan::Row &row);
+
+ ObjectFile &m_objfile;
+ lldb::SectionSP m_section_sp;
+ Flags m_flags = 0;
+ cie_map_t m_cie_map;
+
+ DataExtractor m_cfi_data;
+ bool m_cfi_data_initialized = false; // only copy the section into the DE once
+
+ FDEEntryMap m_fde_index;
+ 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
+
+ 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
+
+#endif // liblldb_DWARFCallFrameInfo_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/DebugMacros.h b/linux-x64/clang/include/lldb/Symbol/DebugMacros.h
new file mode 100644
index 0000000..d364299
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/DebugMacros.h
@@ -0,0 +1,97 @@
+//===-- DebugMacros.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DebugMacros_h_
+#define liblldb_DebugMacros_h_
+
+#include <memory>
+#include <vector>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class CompileUnit;
+class DebugMacros;
+typedef std::shared_ptr<DebugMacros> DebugMacrosSP;
+
+class DebugMacroEntry {
+public:
+ enum EntryType { INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT };
+
+public:
+ static DebugMacroEntry CreateDefineEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry CreateUndefEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry CreateStartFileEntry(uint32_t line,
+ uint32_t debug_line_file_idx);
+
+ static DebugMacroEntry CreateEndFileEntry();
+
+ static DebugMacroEntry
+ CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp);
+
+ DebugMacroEntry() : m_type(INVALID) {}
+
+ ~DebugMacroEntry() = default;
+
+ EntryType GetType() const { return m_type; }
+
+ uint64_t GetLineNumber() const { return m_line; }
+
+ ConstString GetMacroString() const { return m_str; }
+
+ const FileSpec &GetFileSpec(CompileUnit *comp_unit) const;
+
+ DebugMacros *GetIndirectDebugMacros() const {
+ return m_debug_macros_sp.get();
+ }
+
+private:
+ DebugMacroEntry(EntryType type, uint32_t line, uint32_t debug_line_file_idx,
+ const char *str);
+
+ DebugMacroEntry(EntryType type, const DebugMacrosSP &debug_macros_sp);
+
+ EntryType m_type : 3;
+ uint32_t m_line : 29;
+ uint32_t m_debug_line_file_idx;
+ ConstString m_str;
+ DebugMacrosSP m_debug_macros_sp;
+};
+
+class DebugMacros {
+public:
+ DebugMacros() = default;
+
+ ~DebugMacros() = default;
+
+ void AddMacroEntry(const DebugMacroEntry &entry) {
+ m_macro_entries.push_back(entry);
+ }
+
+ size_t GetNumMacroEntries() const { return m_macro_entries.size(); }
+
+ DebugMacroEntry GetMacroEntryAtIndex(const size_t index) const {
+ if (index < m_macro_entries.size())
+ return m_macro_entries[index];
+ else
+ return DebugMacroEntry();
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(DebugMacros);
+
+ std::vector<DebugMacroEntry> m_macro_entries;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DebugMacros_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/DeclVendor.h b/linux-x64/clang/include/lldb/Symbol/DeclVendor.h
new file mode 100644
index 0000000..9c10fe1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/DeclVendor.h
@@ -0,0 +1,77 @@
+//===-- DeclVendor.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DeclVendor_h_
+#define liblldb_DeclVendor_h_
+
+#include "lldb/Core/ClangForward.h"
+#include "lldb/lldb-defines.h"
+
+#include "clang/AST/ExternalASTMerger.h"
+
+#include <vector>
+
+namespace lldb_private {
+
+// The Decl vendor class is intended as a generic interface to search for named
+// declarations that are not necessarily backed by a specific symbol file.
+class DeclVendor {
+public:
+ // Constructors and Destructors
+ DeclVendor() {}
+
+ virtual ~DeclVendor() {}
+
+ /// Look up the set of Decls that the DeclVendor currently knows about
+ /// matching a given name.
+ ///
+ /// \param[in] name
+ /// The name to look for.
+ ///
+ /// \param[in] append
+ /// If true, FindDecls will clear "decls" when it starts.
+ ///
+ /// \param[in] max_matches
+ /// The maximum number of Decls to return. UINT32_MAX means "as
+ /// many as possible."
+ ///
+ /// \return
+ /// The number of Decls added to decls; will not exceed
+ /// max_matches.
+ virtual uint32_t FindDecls(ConstString name, bool append,
+ uint32_t max_matches,
+ std::vector<clang::NamedDecl *> &decls) = 0;
+
+ /// Look up the types that the DeclVendor currently knows about matching a
+ /// given name.
+ ///
+ /// \param[in] name
+ /// The name to look for.
+ ///
+ /// \param[in] max_matches
+ // The maximum number of matches. UINT32_MAX means "as many as possible".
+ ///
+ /// \return
+ /// The vector of CompilerTypes that was found.
+ std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
+
+ /// Interface for ExternalASTMerger. Returns an ImporterSource
+ /// allowing type completion.
+ ///
+ /// \return
+ /// An ImporterSource for this DeclVendor.
+ virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
+
+private:
+ // For DeclVendor only
+ DISALLOW_COPY_AND_ASSIGN(DeclVendor);
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Symbol/Declaration.h b/linux-x64/clang/include/lldb/Symbol/Declaration.h
new file mode 100644
index 0000000..63798f8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Declaration.h
@@ -0,0 +1,215 @@
+//===-- Declaration.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Declaration_h_
+#define liblldb_Declaration_h_
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class Declaration Declaration.h "lldb/Symbol/Declaration.h"
+/// A class that describes the declaration location of a
+/// lldb object.
+///
+/// The declarations include the file specification, line number, and the
+/// column info and can help track where functions, blocks, inlined functions,
+/// types, variables, any many other debug core objects were declared.
+class Declaration {
+public:
+ /// Default constructor.
+ Declaration()
+ : m_file(), m_line(0)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(0)
+#endif
+ {
+ }
+
+ /// Construct with file specification, and optional line and column.
+ ///
+ /// \param[in] file_spec
+ /// The file specification that describes where this was
+ /// declared.
+ ///
+ /// \param[in] line
+ /// The line number that describes where this was declared. Set
+ /// to zero if there is no line number information.
+ ///
+ /// \param[in] column
+ /// The column number that describes where this was declared.
+ /// Set to zero if there is no column number information.
+ Declaration(const FileSpec &file_spec, uint32_t line = 0, uint32_t column = 0)
+ : m_file(file_spec), m_line(line)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(column)
+#endif
+ {
+ }
+
+ /// Construct with a reference to another Declaration object.
+ Declaration(const Declaration &rhs)
+ : m_file(rhs.m_file), m_line(rhs.m_line)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(rhs.m_column)
+#endif
+ {
+ }
+
+ /// Construct with a pointer to another Declaration object.
+ Declaration(const Declaration *decl_ptr)
+ : m_file(), m_line(0)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(0)
+#endif
+ {
+ if (decl_ptr)
+ *this = *decl_ptr;
+ }
+
+ /// Clear the object's state.
+ ///
+ /// Sets the file specification to be empty, and the line and column to
+ /// zero.
+ void Clear() {
+ m_file.Clear();
+ m_line = 0;
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ m_column = 0;
+#endif
+ }
+
+ /// Compare two declaration objects.
+ ///
+ /// Compares the two file specifications from \a lhs and \a rhs. If the file
+ /// specifications are equal, then continue to compare the line number and
+ /// column numbers respectively.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const Declaration object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const Declaration object reference.
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ static int Compare(const Declaration &lhs, const Declaration &rhs);
+
+ /// Checks if this object has the same file and line as another declaration
+ /// object.
+ ///
+ /// \param[in] declaration
+ /// The const Declaration object to compare with.
+ ///
+ /// \return
+ /// Returns \b true if \b declaration is at the same file and
+ /// line, \b false otherwise.
+ bool FileAndLineEqual(const Declaration &declaration) const;
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ bool DumpStopContext(Stream *s, bool show_fullpaths) const;
+ /// Get accessor for the declaration column number.
+ ///
+ /// \return
+ /// Non-zero indicates a valid column number, zero indicates no
+ /// column information is available.
+ uint32_t GetColumn() const {
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ return m_column;
+#else
+ return 0;
+#endif
+ }
+
+ /// Get accessor for file specification.
+ ///
+ /// \return
+ /// A reference to the file specification object.
+ FileSpec &GetFile() { return m_file; }
+
+ /// Get const accessor for file specification.
+ ///
+ /// \return
+ /// A const reference to the file specification object.
+ const FileSpec &GetFile() const { return m_file; }
+
+ /// Get accessor for the declaration line number.
+ ///
+ /// \return
+ /// Non-zero indicates a valid line number, zero indicates no
+ /// line information is available.
+ uint32_t GetLine() const { return m_line; }
+
+ bool IsValid() const { return m_file && m_line != 0; }
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const;
+
+ /// Set accessor for the declaration column number.
+ ///
+ /// \param[in] column
+ /// Non-zero indicates a valid column number, zero indicates no
+ /// column information is available.
+ void SetColumn(uint32_t column) {
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ m_column = col;
+#endif
+ }
+
+ /// Set accessor for the declaration file specification.
+ ///
+ /// \param[in] file_spec
+ /// The new declaration file specification.
+ void SetFile(const FileSpec &file_spec) { m_file = file_spec; }
+
+ /// Set accessor for the declaration line number.
+ ///
+ /// \param[in] line
+ /// Non-zero indicates a valid line number, zero indicates no
+ /// line information is available.
+ void SetLine(uint32_t line) { m_line = line; }
+
+protected:
+ /// Member variables.
+ FileSpec m_file; ///< The file specification that points to the
+ ///< source file where the declaration occurred.
+ uint32_t m_line; ///< Non-zero values indicates a valid line number,
+ ///< zero indicates no line number information is available.
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ uint32_t m_column; ///< Non-zero values indicates a valid column number,
+ ///< zero indicates no column information is available.
+#endif
+};
+
+bool operator==(const Declaration &lhs, const Declaration &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_Declaration_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h b/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h
new file mode 100644
index 0000000..cc767d4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h
@@ -0,0 +1,149 @@
+#ifndef liblldb_FuncUnwinders_h
+#define liblldb_FuncUnwinders_h
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/lldb-private-enumerations.h"
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+
+class UnwindTable;
+
+class FuncUnwinders {
+public:
+ // FuncUnwinders objects are used to track UnwindPlans for a function (named
+ // or not - really just an address range)
+
+ // We'll record four different UnwindPlans for each address range:
+ //
+ // 1. Unwinding from a call site (a valid exception throw location)
+ // This is often sourced from the eh_frame exception handling info
+ // 2. Unwinding from a non-call site (any location in the function)
+ // This is often done by analyzing the function prologue assembly
+ // language instructions
+ // 3. A fast unwind method for this function which only retrieves a
+ // limited set of registers necessary to walk the stack
+ // 4. An architectural default unwind plan when none of the above are
+ // available for some reason.
+
+ // Additionally, FuncUnwinds object can be asked where the prologue
+ // instructions are finished for migrating breakpoints past the stack frame
+ // setup instructions when we don't have line table information.
+
+ FuncUnwinders(lldb_private::UnwindTable &unwind_table, AddressRange range);
+
+ ~FuncUnwinders();
+
+ lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target, Thread &thread);
+
+ lldb::UnwindPlanSP GetUnwindPlanAtNonCallSite(Target &target,
+ lldb_private::Thread &thread);
+
+ lldb::UnwindPlanSP GetUnwindPlanFastUnwind(Target &target,
+ lldb_private::Thread &thread);
+
+ lldb::UnwindPlanSP
+ GetUnwindPlanArchitectureDefault(lldb_private::Thread &thread);
+
+ lldb::UnwindPlanSP
+ GetUnwindPlanArchitectureDefaultAtFunctionEntry(lldb_private::Thread &thread);
+
+ Address &GetFirstNonPrologueInsn(Target &target);
+
+ const Address &GetFunctionStartAddress() const;
+
+ bool ContainsAddress(const Address &addr) const {
+ return m_range.ContainsFileAddress(addr);
+ }
+
+ // A function may have a Language Specific Data Area specified -- a block of
+ // data in
+ // the object file which is used in the processing of an exception throw /
+ // catch. If any of the UnwindPlans have the address of the LSDA region for
+ // this function, this will return it.
+ Address GetLSDAAddress(Target &target);
+
+ // A function may have a Personality Routine associated with it -- used in the
+ // processing of throwing an exception. If any of the UnwindPlans have the
+ // address of the personality routine, this will return it. Read the target-
+ // pointer at this address to get the personality function address.
+ Address GetPersonalityRoutinePtrAddress(Target &target);
+
+ // The following methods to retrieve specific unwind plans should rarely be
+ // used. Instead, clients should ask for the *behavior* they are looking for,
+ // using one of the above UnwindPlan retrieval methods.
+
+ lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread);
+
+ lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
+ Thread &thread);
+
+ lldb::UnwindPlanSP GetDebugFrameUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetDebugFrameAugmentedUnwindPlan(Target &target,
+ Thread &thread);
+
+ lldb::UnwindPlanSP GetCompactUnwindUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetArmUnwindUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetSymbolFileUnwindPlan(Thread &thread);
+
+ lldb::UnwindPlanSP GetArchDefaultUnwindPlan(Thread &thread);
+
+ lldb::UnwindPlanSP GetArchDefaultAtFuncEntryUnwindPlan(Thread &thread);
+
+private:
+ lldb::UnwindAssemblySP GetUnwindAssemblyProfiler(Target &target);
+
+ // Do a simplistic comparison for the register restore rule for getting the
+ // caller's pc value on two UnwindPlans -- returns LazyBoolYes if they have
+ // the same unwind rule for the pc, LazyBoolNo if they do not have the same
+ // unwind rule for the pc, and LazyBoolCalculate if it was unable to
+ // determine this for some reason.
+ lldb_private::LazyBool CompareUnwindPlansForIdenticalInitialPCLocation(
+ Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b);
+
+ UnwindTable &m_unwind_table;
+ AddressRange m_range;
+
+ std::recursive_mutex m_mutex;
+
+ lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
+ lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
+ 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_symbol_file_sp;
+ lldb::UnwindPlanSP m_unwind_plan_fast_sp;
+ lldb::UnwindPlanSP m_unwind_plan_arch_default_sp;
+ lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp;
+
+ // 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_plan_symbol_file : 1,
+ m_tried_unwind_fast : 1, m_tried_unwind_arch_default : 1,
+ m_tried_unwind_arch_default_at_func_entry : 1;
+
+ Address m_first_non_prologue_insn;
+
+ DISALLOW_COPY_AND_ASSIGN(FuncUnwinders);
+
+}; // class FuncUnwinders
+
+} // namespace lldb_private
+
+#endif // liblldb_FuncUnwinders_h
diff --git a/linux-x64/clang/include/lldb/Symbol/Function.h b/linux-x64/clang/include/lldb/Symbol/Function.h
new file mode 100644
index 0000000..f68a167
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Function.h
@@ -0,0 +1,576 @@
+//===-- Function.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Function_h_
+#define liblldb_Function_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Core/Mangled.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/Declaration.h"
+#include "lldb/Utility/UserID.h"
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lldb_private {
+
+/// \class FunctionInfo Function.h "lldb/Symbol/Function.h"
+/// A class that contains generic function information.
+///
+/// This provides generic function information that gets reused between inline
+/// functions and function types.
+class FunctionInfo {
+public:
+ /// Construct with the function method name and optional declaration
+ /// information.
+ ///
+ /// \param[in] name
+ /// A C string name for the method name for this function. This
+ /// value should not be the mangled named, but the simple method
+ /// name.
+ ///
+ /// \param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ FunctionInfo(const char *name, const Declaration *decl_ptr);
+
+ /// Construct with the function method name and optional declaration
+ /// information.
+ ///
+ /// \param[in] name
+ /// A name for the method name for this function. This value
+ /// should not be the mangled named, but the simple method name.
+ ///
+ /// \param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ FunctionInfo(ConstString name, const Declaration *decl_ptr);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since classes inherit from this class.
+ virtual ~FunctionInfo();
+
+ /// Compare two function information objects.
+ ///
+ /// First compares the method names, and if equal, then compares the
+ /// declaration information.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const FunctionInfo object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const FunctionInfo object reference.
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs);
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ /// Get accessor for the declaration information.
+ ///
+ /// \return
+ /// A reference to the declaration object.
+ Declaration &GetDeclaration();
+
+ /// Get const accessor for the declaration information.
+ ///
+ /// \return
+ /// A const reference to the declaration object.
+ const Declaration &GetDeclaration() const;
+
+ /// Get accessor for the method name.
+ ///
+ /// \return
+ /// A const reference to the method name object.
+ ConstString GetName() const;
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ virtual size_t MemorySize() const;
+
+protected:
+ // Member variables.
+ ConstString m_name; ///< Function method name (not a mangled name).
+ Declaration m_declaration; ///< Information describing where this function
+ ///information was defined.
+};
+
+/// \class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
+/// A class that describes information for an inlined function.
+class InlineFunctionInfo : public FunctionInfo {
+public:
+ /// Construct with the function method name, mangled name, and optional
+ /// declaration information.
+ ///
+ /// \param[in] name
+ /// A C string name for the method name for this function. This
+ /// value should not be the mangled named, but the simple method
+ /// name.
+ ///
+ /// \param[in] mangled
+ /// A C string name for the mangled name for this function. This
+ /// value can be NULL if there is no mangled information.
+ ///
+ /// \param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ ///
+ /// \param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ InlineFunctionInfo(const char *name, const char *mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ /// Construct with the function method name, mangled name, and optional
+ /// declaration information.
+ ///
+ /// \param[in] name
+ /// A name for the method name for this function. This value
+ /// should not be the mangled named, but the simple method name.
+ ///
+ /// \param[in] mangled
+ /// A name for the mangled name for this function. This value
+ /// can be empty if there is no mangled information.
+ ///
+ /// \param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ ///
+ /// \param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ InlineFunctionInfo(ConstString name, const Mangled &mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ /// Destructor.
+ ~InlineFunctionInfo() override;
+
+ /// Compare two inlined function information objects.
+ ///
+ /// First compares the FunctionInfo objects, and if equal, compares the
+ /// mangled names.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const InlineFunctionInfo object
+ /// reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const InlineFunctionInfo object
+ /// reference.
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs);
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ void DumpStopContext(Stream *s, lldb::LanguageType language) const;
+
+ ConstString GetName(lldb::LanguageType language) const;
+
+ ConstString GetDisplayName(lldb::LanguageType language) const;
+
+ /// Get accessor for the call site declaration information.
+ ///
+ /// \return
+ /// A reference to the declaration object.
+ Declaration &GetCallSite();
+
+ /// Get const accessor for the call site declaration information.
+ ///
+ /// \return
+ /// A const reference to the declaration object.
+ const Declaration &GetCallSite() const;
+
+ /// Get accessor for the mangled name object.
+ ///
+ /// \return
+ /// A reference to the mangled name object.
+ Mangled &GetMangled();
+
+ /// Get const accessor for the mangled name object.
+ ///
+ /// \return
+ /// A const reference to the mangled name object.
+ const Mangled &GetMangled() const;
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const override;
+
+private:
+ // Member variables.
+ Mangled m_mangled; ///< Mangled inlined function name (can be empty if there
+ ///is no mangled information).
+ Declaration m_call_decl;
+};
+
+class Function;
+
+/// \class CallEdge Function.h "lldb/Symbol/Function.h"
+///
+/// Represent a call made within a Function. This can be used to find a path
+/// in the call graph between two functions.
+class CallEdge {
+public:
+ /// Construct a call edge using a symbol name to identify the calling
+ /// function, and a return PC within the calling function to identify a
+ /// specific call site.
+ ///
+ /// TODO: A symbol name may not be globally unique. To disambiguate ODR
+ /// conflicts, it's necessary to determine the \c Target a call edge is
+ /// associated with before resolving it.
+ CallEdge(const char *symbol_name, lldb::addr_t return_pc);
+
+ CallEdge(CallEdge &&) = default;
+ CallEdge &operator=(CallEdge &&) = default;
+
+ /// Get the callee's definition.
+ ///
+ /// Note that this might lazily invoke the DWARF parser.
+ Function *GetCallee(ModuleList &images);
+
+ /// Get the load PC address of the instruction which executes after the call
+ /// returns. Returns LLDB_INVALID_ADDRESS iff this is a tail call. \p caller
+ /// is the Function containing this call, and \p target is the Target which
+ /// made the call.
+ lldb::addr_t GetReturnPCAddress(Function &caller, Target &target) const;
+
+ /// Like \ref GetReturnPCAddress, but returns an unslid function-local PC
+ /// offset.
+ lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
+
+private:
+ void ParseSymbolFileAndResolve(ModuleList &images);
+
+ /// Either the callee's mangled name or its definition, discriminated by
+ /// \ref resolved.
+ union {
+ const char *symbol_name;
+ Function *def;
+ } lazy_callee;
+
+ /// An invalid address if this is a tail call. Otherwise, the function-local
+ /// PC offset. Adding this PC offset to the function's base load address
+ /// gives the return PC for the call.
+ lldb::addr_t return_pc;
+
+ /// Whether or not an attempt was made to find the callee's definition.
+ bool resolved;
+
+ DISALLOW_COPY_AND_ASSIGN(CallEdge);
+};
+
+/// \class Function Function.h "lldb/Symbol/Function.h"
+/// A class that describes a function.
+///
+/// Functions belong to CompileUnit objects (Function::m_comp_unit), have
+/// unique user IDs (Function::UserID), know how to reconstruct their symbol
+/// context (Function::SymbolContextScope), have a specific function type
+/// (Function::m_type_uid), have a simple method name (FunctionInfo::m_name),
+/// be declared at a specific location (FunctionInfo::m_declaration), possibly
+/// have mangled names (Function::m_mangled), an optional return type
+/// (Function::m_type), and contains lexical blocks (Function::m_blocks).
+///
+/// The function information is split into a few pieces:
+/// \li The concrete instance information
+/// \li The abstract information
+///
+/// The abstract information is found in the function type (Type) that
+/// describes a function information, return type and parameter types.
+///
+/// The concrete information is the address range information and specific
+/// locations for an instance of this function.
+class Function : public UserID, public SymbolContextScope {
+public:
+ /// Construct with a compile unit, function UID, function type UID, optional
+ /// mangled name, function type, and a section offset based address range.
+ ///
+ /// \param[in] comp_unit
+ /// The compile unit to which this function belongs.
+ ///
+ /// \param[in] func_uid
+ /// The UID for this function. This value is provided by the
+ /// SymbolFile plug-in and can be any value that allows
+ /// the plug-in to quickly find and parse more detailed
+ /// information when and if more information is needed.
+ ///
+ /// \param[in] func_type_uid
+ /// The type UID for the function Type to allow for lazy type
+ /// parsing from the debug information.
+ ///
+ /// \param[in] mangled
+ /// The optional mangled name for this function. If empty, there
+ /// is no mangled information.
+ ///
+ /// \param[in] func_type
+ /// The optional function type. If NULL, the function type will
+ /// be parsed on demand when accessed using the
+ /// Function::GetType() function by asking the SymbolFile
+ /// plug-in to get the type for \a func_type_uid.
+ ///
+ /// \param[in] range
+ /// The section offset based address for this function.
+ Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
+ lldb::user_id_t func_type_uid, const Mangled &mangled,
+ Type *func_type, const AddressRange &range);
+
+ /// Destructor.
+ ~Function() override;
+
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// \see SymbolContextScope
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ Function *CalculateSymbolContextFunction() override;
+
+ const AddressRange &GetAddressRange() { return m_range; }
+
+ lldb::LanguageType GetLanguage() const;
+ /// Find the file and line number of the source location of the start of the
+ /// function. This will use the declaration if present and fall back on the
+ /// line table if that fails. So there may NOT be a line table entry for
+ /// this source file/line combo.
+ ///
+ /// \param[out] source_file
+ /// The source file.
+ ///
+ /// \param[out] line_no
+ /// The line number.
+ void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
+
+ /// Find the file and line number of the source location of the end of the
+ /// function.
+ ///
+ ///
+ /// \param[out] source_file
+ /// The source file.
+ ///
+ /// \param[out] line_no
+ /// The line number.
+ void GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
+
+ /// Get the outgoing call edges from this function, sorted by their return
+ /// PC addresses (in increasing order).
+ llvm::MutableArrayRef<CallEdge> GetCallEdges();
+
+ /// Get the outgoing tail-calling edges from this function. If none exist,
+ /// return None.
+ llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
+
+ /// Get accessor for the block list.
+ ///
+ /// \return
+ /// The block list object that describes all lexical blocks
+ /// in the function.
+ ///
+ /// \see BlockList
+ Block &GetBlock(bool can_create);
+
+ /// Get accessor for the compile unit that owns this function.
+ ///
+ /// \return
+ /// A compile unit object pointer.
+ CompileUnit *GetCompileUnit();
+
+ /// Get const accessor for the compile unit that owns this function.
+ ///
+ /// \return
+ /// A const compile unit object pointer.
+ const CompileUnit *GetCompileUnit() const;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
+
+ /// Get accessor for the frame base location.
+ ///
+ /// \return
+ /// A location expression that describes the function frame
+ /// base.
+ DWARFExpression &GetFrameBaseExpression() { return m_frame_base; }
+
+ /// Get const accessor for the frame base location.
+ ///
+ /// \return
+ /// A const compile unit object pointer.
+ const DWARFExpression &GetFrameBaseExpression() const { return m_frame_base; }
+
+ ConstString GetName() const;
+
+ ConstString GetNameNoArguments() const;
+
+ ConstString GetDisplayName() const;
+
+ const Mangled &GetMangled() const { return m_mangled; }
+
+ /// Get the DeclContext for this function, if available.
+ ///
+ /// \return
+ /// The DeclContext, or NULL if none exists.
+ CompilerDeclContext GetDeclContext();
+
+ /// Get accessor for the type that describes the function return value type,
+ /// and parameter types.
+ ///
+ /// \return
+ /// A type object pointer.
+ Type *GetType();
+
+ /// Get const accessor for the type that describes the function return value
+ /// type, and parameter types.
+ ///
+ /// \return
+ /// A const type object pointer.
+ const Type *GetType() const;
+
+ CompilerType GetCompilerType();
+
+ /// Get the size of the prologue instructions for this function. The
+ /// "prologue" instructions include any instructions given line number 0
+ /// immediately following the prologue end.
+ ///
+ /// \return
+ /// The size of the prologue.
+ uint32_t GetPrologueByteSize();
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] show_context
+ /// If \b true, variables will dump their symbol context
+ /// information.
+ void Dump(Stream *s, bool show_context) const;
+
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// \see SymbolContextScope
+ void DumpSymbolContext(Stream *s) override;
+
+ /// Get the memory cost of this object.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const;
+
+ /// Get whether compiler optimizations were enabled for this function
+ ///
+ /// The debug information may provide information about whether this
+ /// function was compiled with optimization or not. In this case,
+ /// "optimized" means that the debug experience may be difficult for the
+ /// user to understand. Variables may not be available when the developer
+ /// would expect them, stepping through the source lines in the function may
+ /// appear strange, etc.
+ ///
+ /// \return
+ /// Returns 'true' if this function was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this function was built without optimization.
+ bool GetIsOptimized();
+
+ /// Get whether this function represents a 'top-level' function
+ ///
+ /// The concept of a top-level function is language-specific, mostly meant
+ /// to represent the notion of scripting-style code that has global
+ /// visibility of the variables/symbols/functions/... defined within the
+ /// containing file/module
+ ///
+ /// If stopped in a top-level function, LLDB will expose global variables
+ /// as-if locals in the 'frame variable' command
+ ///
+ /// \return
+ /// Returns 'true' if this function is a top-level function,
+ /// 'false' otherwise.
+ bool IsTopLevelFunction();
+
+ lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx,
+ const char *flavor,
+ bool prefer_file_cache);
+
+ bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
+ bool prefer_file_cache, Stream &strm);
+
+protected:
+ enum {
+ flagsCalculatedPrologueSize =
+ (1 << 0) ///< Have we already tried to calculate the prologue size?
+ };
+
+ // Member variables.
+ CompileUnit *m_comp_unit; ///< The compile unit that owns this function.
+ lldb::user_id_t
+ m_type_uid; ///< The user ID of for the prototype Type for this function.
+ Type *m_type; ///< The function prototype type for this function that include
+ ///the function info (FunctionInfo), return type and parameters.
+ Mangled m_mangled; ///< The mangled function name if any, if empty, there is
+ ///no mangled information.
+ Block m_block; ///< All lexical blocks contained in this function.
+ AddressRange m_range; ///< The function address range that covers the widest
+ ///range needed to contain all blocks
+ DWARFExpression m_frame_base; ///< The frame base expression for variables
+ ///that are relative to the frame pointer.
+ Flags m_flags;
+ uint32_t
+ m_prologue_byte_size; ///< Compute the prologue size once and cache it
+
+ bool m_call_edges_resolved = false; ///< Whether call site info has been
+ /// parsed.
+ std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
+private:
+ DISALLOW_COPY_AND_ASSIGN(Function);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Function_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/LineEntry.h b/linux-x64/clang/include/lldb/Symbol/LineEntry.h
new file mode 100644
index 0000000..fe97a78
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/LineEntry.h
@@ -0,0 +1,187 @@
+//===-- LineEntry.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LineEntry_h_
+#define liblldb_LineEntry_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h"
+/// A line table entry class.
+struct LineEntry {
+ /// Default constructor.
+ ///
+ /// Initialize all member variables to invalid values.
+ LineEntry();
+
+ LineEntry(const lldb::SectionSP §ion_sp, lldb::addr_t section_offset,
+ lldb::addr_t byte_size, const FileSpec &file, uint32_t _line,
+ uint16_t _column, bool _is_start_of_statement,
+ bool _is_start_of_basic_block, bool _is_prologue_end,
+ bool _is_epilogue_begin, bool _is_terminal_entry);
+
+ /// Clear the object's state.
+ ///
+ /// Clears all member variables to invalid values.
+ void Clear();
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] comp_unit
+ /// The compile unit object that contains the support file
+ /// list so the line entry can dump the file name (since this
+ /// object contains a file index into the support file list).
+ ///
+ /// \param[in] show_file
+ /// If \b true, display the filename with the line entry which
+ /// requires that the compile unit object \a comp_unit be a
+ /// valid pointer.
+ ///
+ /// \param[in] style
+ /// The display style for the section offset address.
+ ///
+ /// \return
+ /// Returns \b true if the address was able to be displayed
+ /// using \a style. File and load addresses may be unresolved
+ /// and it may not be possible to display a valid address value.
+ /// Returns \b false if the address was not able to be properly
+ /// dumped.
+ ///
+ /// \see Address::DumpStyle
+ bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style,
+ Address::DumpStyle fallback_style, bool show_range) const;
+
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level, CompileUnit *cu,
+ Target *target, bool show_address_only) const;
+
+ /// Dumps information specific to a process that stops at this line entry to
+ /// the supplied stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] comp_unit
+ /// The compile unit object that contains the support file
+ /// list so the line entry can dump the file name (since this
+ /// object contains a file index into the support file list).
+ ///
+ /// \return
+ /// Returns \b true if the file and line were properly dumped,
+ /// \b false otherwise.
+ bool DumpStopContext(Stream *s, bool show_fullpaths) const;
+
+ /// Check if a line entry object is valid.
+ ///
+ /// \return
+ /// Returns \b true if the line entry contains a valid section
+ /// offset address, file index, and line number, \b false
+ /// otherwise.
+ bool IsValid() const;
+
+ /// Compare two LineEntry objects.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const LineEntry object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const LineEntry object reference.
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ static int Compare(const LineEntry &lhs, const LineEntry &rhs);
+
+ /// Give the range for this LineEntry + any additional LineEntries for this
+ /// same source line that are contiguous.
+ ///
+ /// A compiler may emit multiple line entries for a single source line,
+ /// e.g. to indicate subexpressions at different columns. This method will
+ /// get the AddressRange for all of the LineEntries for this source line
+ /// that are contiguous.
+ //
+ /// Line entries with a line number of 0 are treated specially - these are
+ /// compiler-generated line table entries that the user did not write in
+ /// their source code, and we want to skip past in the debugger. If this
+ /// LineEntry is for line 32, and the following LineEntry is for line 0, we
+ /// will extend the range to include the AddressRange of the line 0
+ /// LineEntry (and it will include the range of the following LineEntries
+ /// that match either 32 or 0.)
+ ///
+ /// When \b include_inlined_functions is \b true inlined functions with
+ /// a call site at this LineEntry will also be included in the complete
+ /// range.
+ ///
+ /// If the initial LineEntry this method is called on is a line #0, only the
+ /// range of contiuous LineEntries with line #0 will be included in the
+ /// complete range.
+ ///
+ /// @param[in] include_inlined_functions
+ /// Whether to include inlined functions at the same line or not.
+ ///
+ /// \return
+ /// The contiguous AddressRange for this source line.
+ AddressRange
+ GetSameLineContiguousAddressRange(bool include_inlined_functions) const;
+
+ /// Apply file mappings from target.source-map to the LineEntry's file.
+ ///
+ /// \param[in] target_sp
+ /// Shared pointer to the target this LineEntry belongs to.
+
+ void ApplyFileMappings(lldb::TargetSP target_sp);
+
+ // Member variables.
+ AddressRange range; ///< The section offset address range for this line entry.
+ FileSpec file; ///< The source file, possibly mapped by the target.source-map
+ ///setting
+ FileSpec original_file; ///< The original source file, from debug info.
+ uint32_t line; ///< The source line number, or zero if there is no line number
+ ///information.
+ uint16_t column; ///< The column number of the source line, or zero if there
+ ///is no column information.
+ uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning
+ ///of a statement.
+ is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of
+ ///a basic block.
+ is_prologue_end : 1, ///< Indicates this entry is one (of possibly many)
+ ///where execution should be suspended for an entry
+ ///breakpoint of a function.
+ is_epilogue_begin : 1, ///< Indicates this entry is one (of possibly many)
+ ///where execution should be suspended for an exit
+ ///breakpoint of a function.
+ is_terminal_entry : 1; ///< Indicates this entry is that of the first byte
+ ///after the end of a sequence of target machine
+ ///instructions.
+};
+
+/// Less than operator.
+///
+/// \param[in] lhs
+/// The Left Hand Side const LineEntry object reference.
+///
+/// \param[in] rhs
+/// The Right Hand Side const LineEntry object reference.
+///
+/// \return
+/// Returns \b true if lhs < rhs, false otherwise.
+bool operator<(const LineEntry &lhs, const LineEntry &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_LineEntry_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/LineTable.h b/linux-x64/clang/include/lldb/Symbol/LineTable.h
new file mode 100644
index 0000000..d24cc35
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/LineTable.h
@@ -0,0 +1,346 @@
+//===-- LineTable.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LineTable_h_
+#define liblldb_LineTable_h_
+
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/lldb-private.h"
+#include <vector>
+
+namespace lldb_private {
+
+/// \class LineSequence LineTable.h "lldb/Symbol/LineTable.h" An abstract base
+/// class used during symbol table creation.
+class LineSequence {
+public:
+ LineSequence();
+
+ virtual ~LineSequence() = default;
+
+ virtual void Clear() = 0;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(LineSequence);
+};
+
+/// \class LineTable LineTable.h "lldb/Symbol/LineTable.h"
+/// A line table class.
+class LineTable {
+public:
+ /// Construct with compile unit.
+ ///
+ /// \param[in] comp_unit
+ /// The compile unit to which this line table belongs.
+ LineTable(CompileUnit *comp_unit);
+
+ /// Destructor.
+ ~LineTable();
+
+ /// Adds a new line entry to this line table.
+ ///
+ /// All line entries are maintained in file address order.
+ ///
+ /// \param[in] line_entry
+ /// A const reference to a new line_entry to add to this line
+ /// table.
+ ///
+ /// \see Address::DumpStyle
+ // void
+ // AddLineEntry (const LineEntry& line_entry);
+
+ // Called when you can't guarantee the addresses are in increasing order
+ void InsertLineEntry(lldb::addr_t file_addr, uint32_t line, uint16_t column,
+ uint16_t file_idx, bool is_start_of_statement,
+ bool is_start_of_basic_block, bool is_prologue_end,
+ bool is_epilogue_begin, bool is_terminal_entry);
+
+ // Used to instantiate the LineSequence helper class
+ LineSequence *CreateLineSequenceContainer();
+
+ // Append an entry to a caller-provided collection that will later be
+ // inserted in this line table.
+ void AppendLineEntryToSequence(LineSequence *sequence, lldb::addr_t file_addr,
+ uint32_t line, uint16_t column,
+ uint16_t file_idx, bool is_start_of_statement,
+ bool is_start_of_basic_block,
+ bool is_prologue_end, bool is_epilogue_begin,
+ bool is_terminal_entry);
+
+ // Insert a sequence of entries into this line table.
+ void InsertSequence(LineSequence *sequence);
+
+ /// Dump all line entries in this line table to the stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] style
+ /// The display style for the address.
+ ///
+ /// \see Address::DumpStyle
+ void Dump(Stream *s, Target *target, Address::DumpStyle style,
+ Address::DumpStyle fallback_style, bool show_line_ranges);
+
+ void GetDescription(Stream *s, Target *target, lldb::DescriptionLevel level);
+
+ /// Find a line entry that contains the section offset address \a so_addr.
+ ///
+ /// \param[in] so_addr
+ /// A section offset address object containing the address we
+ /// are searching for.
+ ///
+ /// \param[out] line_entry
+ /// A copy of the line entry that was found if \b true is
+ /// returned, otherwise \a entry is left unmodified.
+ ///
+ /// \param[out] index_ptr
+ /// A pointer to a 32 bit integer that will get the actual line
+ /// entry index if it is not nullptr.
+ ///
+ /// \return
+ /// Returns \b true if \a so_addr is contained in a line entry
+ /// in this line table, \b false otherwise.
+ bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry,
+ uint32_t *index_ptr = nullptr);
+
+ /// Find a line entry index that has a matching file index and source line
+ /// number.
+ ///
+ /// Finds the next line entry that has a matching \a file_idx and source
+ /// line number \a line starting at the \a start_idx entries into the line
+ /// entry collection.
+ ///
+ /// \param[in] start_idx
+ /// The number of entries to skip when starting the search.
+ ///
+ /// \param[out] file_idx
+ /// The file index to search for that should be found prior
+ /// to calling this function using the following functions:
+ /// CompileUnit::GetSupportFiles()
+ /// FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
+ ///
+ /// \param[in] line
+ /// The source line to match.
+ ///
+ /// \param[in] exact
+ /// If true, match only if you find a line entry exactly matching \a line.
+ /// If false, return the closest line entry greater than \a line.
+ ///
+ /// \param[out] line_entry
+ /// A reference to a line entry object that will get a copy of
+ /// the line entry if \b true is returned, otherwise \a
+ /// line_entry is left untouched.
+ ///
+ /// \return
+ /// Returns \b true if a matching line entry is found in this
+ /// line table, \b false otherwise.
+ ///
+ /// \see CompileUnit::GetSupportFiles()
+ /// \see FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
+ uint32_t FindLineEntryIndexByFileIndex(uint32_t start_idx, uint32_t file_idx,
+ uint32_t line, bool exact,
+ LineEntry *line_entry_ptr);
+
+ uint32_t FindLineEntryIndexByFileIndex(
+ uint32_t start_idx, const std::vector<uint32_t> &file_indexes,
+ uint32_t line, bool exact, LineEntry *line_entry_ptr);
+
+ size_t FineLineEntriesForFileIndex(uint32_t file_idx, bool append,
+ SymbolContextList &sc_list);
+
+ /// Get the line entry from the line table at index \a idx.
+ ///
+ /// \param[in] idx
+ /// An index into the line table entry collection.
+ ///
+ /// \return
+ /// A valid line entry if \a idx is a valid index, or an invalid
+ /// line entry if \a idx is not valid.
+ ///
+ /// \see LineTable::GetSize()
+ /// \see LineEntry::IsValid() const
+ bool GetLineEntryAtIndex(uint32_t idx, LineEntry &line_entry);
+
+ /// Gets the size of the line table in number of line table entries.
+ ///
+ /// \return
+ /// The number of line table entries in this line table.
+ uint32_t GetSize() const;
+
+ typedef lldb_private::RangeArray<lldb::addr_t, lldb::addr_t, 32>
+ FileAddressRanges;
+
+ /// Gets all contiguous file address ranges for the entire line table.
+ ///
+ /// \param[out] file_ranges
+ /// A collection of file address ranges that will be filled in
+ /// by this function.
+ ///
+ /// \param[out] append
+ /// If \b true, then append to \a file_ranges, otherwise clear
+ /// \a file_ranges prior to adding any ranges.
+ ///
+ /// \return
+ /// The number of address ranges added to \a file_ranges
+ size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges,
+ bool append);
+
+ /// Given a file range link map, relink the current line table and return a
+ /// fixed up line table.
+ ///
+ /// \param[out] file_range_map
+ /// A collection of file ranges that maps to new file ranges
+ /// that will be used when linking the line table.
+ ///
+ /// \return
+ /// A new line table if at least one line table entry was able
+ /// to be mapped.
+ typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t>
+ FileRangeMap;
+
+ LineTable *LinkLineTable(const FileRangeMap &file_range_map);
+
+protected:
+ struct Entry {
+ Entry()
+ : file_addr(LLDB_INVALID_ADDRESS), line(0),
+ is_start_of_statement(false), is_start_of_basic_block(false),
+ is_prologue_end(false), is_epilogue_begin(false),
+ is_terminal_entry(false), column(0), file_idx(0) {}
+
+ Entry(lldb::addr_t _file_addr, uint32_t _line, uint16_t _column,
+ uint16_t _file_idx, bool _is_start_of_statement,
+ bool _is_start_of_basic_block, bool _is_prologue_end,
+ bool _is_epilogue_begin, bool _is_terminal_entry)
+ : file_addr(_file_addr), line(_line),
+ is_start_of_statement(_is_start_of_statement),
+ is_start_of_basic_block(_is_start_of_basic_block),
+ is_prologue_end(_is_prologue_end),
+ is_epilogue_begin(_is_epilogue_begin),
+ is_terminal_entry(_is_terminal_entry), column(_column),
+ file_idx(_file_idx) {}
+
+ int bsearch_compare(const void *key, const void *arrmem);
+
+ void Clear() {
+ file_addr = LLDB_INVALID_ADDRESS;
+ line = 0;
+ column = 0;
+ file_idx = 0;
+ is_start_of_statement = false;
+ is_start_of_basic_block = false;
+ is_prologue_end = false;
+ is_epilogue_begin = false;
+ is_terminal_entry = false;
+ }
+
+ static int Compare(const Entry &lhs, const Entry &rhs) {
+// Compare the sections before calling
+#define SCALAR_COMPARE(a, b) \
+ if (a < b) \
+ return -1; \
+ if (a > b) \
+ return +1
+ SCALAR_COMPARE(lhs.file_addr, rhs.file_addr);
+ SCALAR_COMPARE(lhs.line, rhs.line);
+ SCALAR_COMPARE(lhs.column, rhs.column);
+ SCALAR_COMPARE(lhs.is_start_of_statement, rhs.is_start_of_statement);
+ SCALAR_COMPARE(lhs.is_start_of_basic_block, rhs.is_start_of_basic_block);
+ // rhs and lhs reversed on purpose below.
+ SCALAR_COMPARE(rhs.is_prologue_end, lhs.is_prologue_end);
+ SCALAR_COMPARE(lhs.is_epilogue_begin, rhs.is_epilogue_begin);
+ // rhs and lhs reversed on purpose below.
+ SCALAR_COMPARE(rhs.is_terminal_entry, lhs.is_terminal_entry);
+ SCALAR_COMPARE(lhs.file_idx, rhs.file_idx);
+#undef SCALAR_COMPARE
+ return 0;
+ }
+
+ class LessThanBinaryPredicate {
+ public:
+ LessThanBinaryPredicate(LineTable *line_table);
+ bool operator()(const LineTable::Entry &, const LineTable::Entry &) const;
+
+ protected:
+ LineTable *m_line_table;
+ };
+
+ static bool EntryAddressLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.file_addr < rhs.file_addr;
+ }
+
+ // Member variables.
+ /// The file address for this line entry.
+ lldb::addr_t file_addr;
+ /// The source line number, or zero if there is no line number
+ /// information.
+ uint32_t line : 27;
+ /// Indicates this entry is the beginning of a statement.
+ uint32_t is_start_of_statement : 1;
+ /// Indicates this entry is the beginning of a basic block.
+ uint32_t is_start_of_basic_block : 1;
+ /// Indicates this entry is one (of possibly many) where execution
+ /// should be suspended for an entry breakpoint of a function.
+ uint32_t is_prologue_end : 1;
+ /// Indicates this entry is one (of possibly many) where execution
+ /// should be suspended for an exit breakpoint of a function.
+ uint32_t is_epilogue_begin : 1;
+ /// Indicates this entry is that of the first byte after the end
+ /// of a sequence of target machine instructions.
+ uint32_t is_terminal_entry : 1;
+ /// The column number of the source line, or zero if there is no
+ /// column information.
+ uint16_t column;
+ /// The file index into CompileUnit's file table, or zero if there
+ /// is no file information.
+ uint16_t file_idx;
+ };
+
+ struct EntrySearchInfo {
+ LineTable *line_table;
+ lldb_private::Section *a_section;
+ Entry *a_entry;
+ };
+
+ // Types
+ typedef std::vector<lldb_private::Section *>
+ section_collection; ///< The collection type for the sections.
+ typedef std::vector<Entry>
+ entry_collection; ///< The collection type for the line entries.
+ // Member variables.
+ CompileUnit
+ *m_comp_unit; ///< The compile unit that this line table belongs to.
+ entry_collection
+ m_entries; ///< The collection of line entries in this line table.
+
+ // Helper class
+ class LineSequenceImpl : public LineSequence {
+ public:
+ LineSequenceImpl() = default;
+
+ ~LineSequenceImpl() override = default;
+
+ void Clear() override;
+
+ entry_collection
+ m_entries; ///< The collection of line entries in this sequence.
+ };
+
+ bool ConvertEntryAtIndexToLineEntry(uint32_t idx, LineEntry &line_entry);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(LineTable);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_LineTable_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h b/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h
new file mode 100644
index 0000000..0ff834d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h
@@ -0,0 +1,58 @@
+//===-- LocateSymbolFile.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Symbols_h_
+#define liblldb_Symbols_h_
+
+#include <stdint.h>
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Utility/FileSpec.h"
+
+namespace lldb_private {
+
+class ArchSpec;
+class ModuleSpec;
+class UUID;
+
+class Symbols {
+public:
+ // Locate the executable file given a module specification.
+ //
+ // Locating the file should happen only on the local computer or using the
+ // current computers global settings.
+ static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
+
+ // Locate the symbol file given a module specification.
+ //
+ // Locating the file should happen only on the local computer or using the
+ // current computers global settings.
+ static FileSpec
+ LocateExecutableSymbolFile(const ModuleSpec &module_spec,
+ const FileSpecList &default_search_paths);
+
+ static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec,
+ const lldb_private::UUID *uuid,
+ const ArchSpec *arch);
+
+ // Locate the object and symbol file given a module specification.
+ //
+ // Locating the file can try to download the file from a corporate build
+ // repository, or using any other means necessary to locate both the
+ // unstripped object file and the debug symbols. The force_lookup argument
+ // controls whether the external program is called unconditionally to find
+ // the symbol file, or if the user's settings are checked to see if they've
+ // enabled the external program before calling.
+ //
+ static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
+ bool force_lookup = true);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Symbols_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h b/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h
new file mode 100644
index 0000000..9310fdc
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h
@@ -0,0 +1,175 @@
+//===-- ObjectContainer.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ObjectContainer_h_
+#define liblldb_ObjectContainer_h_
+
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class ObjectContainer ObjectContainer.h "lldb/Symbol/ObjectContainer.h"
+/// A plug-in interface definition class for object containers.
+///
+/// Object containers contain object files from one or more architectures, and
+/// also can contain one or more named objects.
+///
+/// Typical object containers are static libraries (.a files) that contain
+/// multiple named object files, and universal files that contain multiple
+/// architectures.
+class ObjectContainer : public PluginInterface, public ModuleChild {
+public:
+ /// Construct with a parent module, offset, and header data.
+ ///
+ /// Object files belong to modules and a valid module must be supplied upon
+ /// construction. The at an offset within a file for objects that contain
+ /// more than one architecture or object.
+ ObjectContainer(const lldb::ModuleSP &module_sp, const FileSpec *file,
+ lldb::offset_t file_offset, lldb::offset_t length,
+ lldb::DataBufferSP &data_sp, lldb::offset_t data_offset)
+ : ModuleChild(module_sp),
+ m_file(), // This file can be different than the module's file spec
+ m_offset(file_offset), m_length(length), m_data() {
+ if (file)
+ m_file = *file;
+ if (data_sp)
+ m_data.SetData(data_sp, data_offset, length);
+ }
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// from by the plug-in instance.
+ ~ObjectContainer() override = default;
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the current contents of this object to the
+ /// supplied stream \a s. The dumping should include the section list if it
+ /// has been parsed, and the symbol table if it has been parsed.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ virtual void Dump(Stream *s) const = 0;
+
+ /// Gets the architecture given an index.
+ ///
+ /// Copies the architecture specification for index \a idx.
+ ///
+ /// \param[in] idx
+ /// The architecture index to extract.
+ ///
+ /// \param[out] arch
+ /// A architecture object that will be filled in if \a idx is a
+ /// architecture valid index.
+ ///
+ /// \return
+ /// Returns \b true if \a idx is valid and \a arch has been
+ /// filled in, \b false otherwise.
+ ///
+ /// \see ObjectContainer::GetNumArchitectures() const
+ virtual bool GetArchitectureAtIndex(uint32_t idx, ArchSpec &arch) const {
+ return false;
+ }
+
+ /// Returns the offset into a file at which this object resides.
+ ///
+ /// Some files contain many object files, and this function allows access to
+ /// an object's offset within the file.
+ ///
+ /// \return
+ /// The offset in bytes into the file. Defaults to zero for
+ /// simple object files that a represented by an entire file.
+ virtual lldb::addr_t GetOffset() const { return m_offset; }
+
+ virtual lldb::addr_t GetByteSize() const { return m_length; }
+
+ /// Get the number of objects within this object file (archives).
+ ///
+ /// \return
+ /// Zero for object files that are not archives, or the number
+ /// of objects contained in the archive.
+ virtual size_t GetNumObjects() const { return 0; }
+
+ /// Get the number of architectures in this object file.
+ ///
+ /// The default implementation returns 1 as for object files that contain a
+ /// single architecture. ObjectContainer instances that contain more than
+ /// one architecture should override this function and return an appropriate
+ /// value.
+ ///
+ /// \return
+ /// The number of architectures contained in this object file.
+ virtual size_t GetNumArchitectures() const { return 0; }
+
+ /// Attempts to parse the object header.
+ ///
+ /// This function is used as a test to see if a given plug-in instance can
+ /// parse the header data already contained in ObjectContainer::m_data. If
+ /// an object file parser does not recognize that magic bytes in a header,
+ /// false should be returned and the next plug-in can attempt to parse an
+ /// object file.
+ ///
+ /// \return
+ /// Returns \b true if the header was parsed successfully, \b
+ /// false otherwise.
+ virtual bool ParseHeader() = 0;
+
+ /// Selects an architecture in an object file.
+ ///
+ /// Object files that contain a single architecture should verify that the
+ /// specified \a arch matches the architecture in in object file and return
+ /// \b true or \b false accordingly.
+ ///
+ /// Object files that contain more than one architecture should attempt to
+ /// select that architecture, and if successful, clear out any previous
+ /// state from any previously selected architecture and prepare to return
+ /// information for the new architecture.
+ ///
+ /// \return
+ /// Returns a pointer to the object file of the requested \a
+ /// arch and optional \a name. Returns nullptr of no such object
+ /// file exists in the container.
+ virtual lldb::ObjectFileSP GetObjectFile(const FileSpec *file) = 0;
+
+ virtual bool ObjectAtIndexIsContainer(uint32_t object_idx) { return false; }
+
+ virtual ObjectFile *GetObjectFileAtIndex(uint32_t object_idx) {
+ return nullptr;
+ }
+
+ virtual ObjectContainer *GetObjectContainerAtIndex(uint32_t object_idx) {
+ return nullptr;
+ }
+
+ virtual const char *GetObjectNameAtIndex(uint32_t object_idx) const {
+ return nullptr;
+ }
+
+protected:
+ // Member variables.
+ FileSpec m_file; ///< The file that represents this container objects (which
+ ///can be different from the module's file).
+ lldb::addr_t
+ m_offset; ///< The offset in bytes into the file, or the address in memory
+ lldb::addr_t m_length; ///< The size in bytes if known (can be zero).
+ DataExtractor
+ m_data; ///< The data for this object file so things can be parsed lazily.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ObjectContainer);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ObjectContainer_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ObjectFile.h b/linux-x64/clang/include/lldb/Symbol/ObjectFile.h
new file mode 100644
index 0000000..84683e3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/ObjectFile.h
@@ -0,0 +1,713 @@
+//===-- ObjectFile.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ObjectFile_h_
+#define liblldb_ObjectFile_h_
+
+#include "lldb/Core/FileSpecList.h"
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Core/PluginInterface.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"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class ObjectFileJITDelegate {
+public:
+ ObjectFileJITDelegate() {}
+
+ virtual ~ObjectFileJITDelegate() {}
+
+ virtual lldb::ByteOrder GetByteOrder() const = 0;
+
+ virtual uint32_t GetAddressByteSize() const = 0;
+
+ virtual void PopulateSymtab(lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab) = 0;
+
+ virtual void PopulateSectionList(lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList §ion_list) = 0;
+
+ virtual ArchSpec GetArchitecture() = 0;
+};
+
+/// \class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h"
+/// A plug-in interface definition class for object file parsers.
+///
+/// Object files belong to Module objects and know how to extract information
+/// from executable, shared library, and object (.o) files used by operating
+/// system runtime. The symbol table and section list for an object file.
+///
+/// Object files can be represented by the entire file, or by part of a file.
+/// An example of a partial file ObjectFile is one that contains information
+/// for one of multiple architectures in the same file.
+///
+/// Once an architecture is selected the object file information can be
+/// extracted from this abstract class.
+class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
+ public PluginInterface,
+ public ModuleChild {
+ friend class lldb_private::Module;
+
+public:
+ enum Type {
+ eTypeInvalid = 0,
+ eTypeCoreFile, /// A core file that has a checkpoint of a program's
+ /// execution state
+ eTypeExecutable, /// A normal executable
+ eTypeDebugInfo, /// An object file that contains only debug information
+ eTypeDynamicLinker, /// The platform's dynamic linker executable
+ eTypeObjectFile, /// An intermediate object file
+ eTypeSharedLibrary, /// A shared library that can be used during execution
+ eTypeStubLibrary, /// A library that can be linked against but not used for
+ /// execution
+ eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
+ eTypeUnknown
+ };
+
+ enum Strata {
+ eStrataInvalid = 0,
+ eStrataUnknown,
+ eStrataUser,
+ eStrataKernel,
+ eStrataRawImage,
+ eStrataJIT
+ };
+
+ struct LoadableData {
+ lldb::addr_t Dest;
+ llvm::ArrayRef<uint8_t> Contents;
+ };
+
+ /// Construct with a parent module, offset, and header data.
+ ///
+ /// Object files belong to modules and a valid module must be supplied upon
+ /// construction. The at an offset within a file for objects that contain
+ /// more than one architecture or object.
+ ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr,
+ lldb::offset_t file_offset, lldb::offset_t length,
+ const lldb::DataBufferSP &data_sp, lldb::offset_t data_offset);
+
+ ObjectFile(const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp,
+ lldb::addr_t header_addr, lldb::DataBufferSP &data_sp);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// from by the plug-in instance.
+ ~ObjectFile() override;
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the current contents of this object to the
+ /// supplied stream \a s. The dumping should include the section list if it
+ /// has been parsed, and the symbol table if it has been parsed.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ virtual void Dump(Stream *s) = 0;
+
+ /// Find a ObjectFile plug-in that can parse \a file_spec.
+ ///
+ /// Scans all loaded plug-in interfaces that implement versions of the
+ /// ObjectFile plug-in interface and returns the first instance that can
+ /// parse the file.
+ ///
+ /// \param[in] module
+ /// The parent module that owns this object file.
+ ///
+ /// \param[in] file_spec
+ /// A file specification that indicates which file to use as the
+ /// object file.
+ ///
+ /// \param[in] file_offset
+ /// The offset into the file at which to start parsing the
+ /// object. This is for files that contain multiple
+ /// architectures or objects.
+ ///
+ /// \param[in] file_size
+ /// The size of the current object file if it can be determined
+ /// or if it is known. This can be zero.
+ ///
+ /// \see ObjectFile::ParseHeader()
+ static lldb::ObjectFileSP
+ FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file_spec,
+ lldb::offset_t file_offset, lldb::offset_t file_size,
+ lldb::DataBufferSP &data_sp, lldb::offset_t &data_offset);
+
+ /// Find a ObjectFile plug-in that can parse a file in memory.
+ ///
+ /// Scans all loaded plug-in interfaces that implement versions of the
+ /// ObjectFile plug-in interface and returns the first instance that can
+ /// parse the file.
+ ///
+ /// \param[in] module
+ /// The parent module that owns this object file.
+ ///
+ /// \param[in] process_sp
+ /// A shared pointer to the process whose memory space contains
+ /// an object file. This will be stored as a std::weak_ptr.
+ ///
+ /// \param[in] header_addr
+ /// The address of the header for the object file in memory.
+ static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp,
+ const lldb::ProcessSP &process_sp,
+ lldb::addr_t header_addr,
+ lldb::DataBufferSP &file_data_sp);
+
+ static size_t GetModuleSpecifications(const FileSpec &file,
+ lldb::offset_t file_offset,
+ lldb::offset_t file_size,
+ ModuleSpecList &specs);
+
+ static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataBufferSP &data_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset,
+ lldb::offset_t file_size,
+ lldb_private::ModuleSpecList &specs);
+ /// Split a path into a file path with object name.
+ ///
+ /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path up into
+ /// the actual path name and into the object name so we can make a valid
+ /// object file from it.
+ ///
+ /// \param[in] path_with_object
+ /// A path that might contain an archive path with a .o file
+ /// specified in parens in the basename of the path.
+ ///
+ /// \param[out] archive_file
+ /// If \b true is returned, \a file_spec will be filled in with
+ /// the path to the archive.
+ ///
+ /// \param[out] archive_object
+ /// If \b true is returned, \a object will be filled in with
+ /// the name of the object inside the archive.
+ ///
+ /// \return
+ /// \b true if the path matches the pattern of archive + object
+ /// and \a archive_file and \a archive_object are modified,
+ /// \b false otherwise and \a archive_file and \a archive_object
+ /// are guaranteed to be remain unchanged.
+ static bool SplitArchivePathWithObject(
+ const char *path_with_object, lldb_private::FileSpec &archive_file,
+ lldb_private::ConstString &archive_object, bool must_exist);
+
+ /// Gets the address size in bytes for the current object file.
+ ///
+ /// \return
+ /// The size of an address in bytes for the currently selected
+ /// architecture (and object for archives). Returns zero if no
+ /// architecture or object has been selected.
+ virtual uint32_t GetAddressByteSize() const = 0;
+
+ /// Get the address type given a file address in an object file.
+ ///
+ /// Many binary file formats know what kinds This is primarily for ARM
+ /// binaries, though it can be applied to any executable file format that
+ /// supports different opcode types within the same binary. ARM binaries
+ /// support having both ARM and Thumb within the same executable container.
+ /// We need to be able to get \return
+ /// The size of an address in bytes for the currently selected
+ /// architecture (and object for archives). Returns zero if no
+ /// architecture or object has been selected.
+ virtual AddressClass GetAddressClass(lldb::addr_t file_addr);
+
+ /// Extract the dependent modules from an object file.
+ ///
+ /// If an object file has information about which other images it depends on
+ /// (such as shared libraries), this function will provide the list. Since
+ /// many executables or shared libraries may depend on the same files,
+ /// FileSpecList::AppendIfUnique(const FileSpec &) should be used to make
+ /// sure any files that are added are not already in the list.
+ ///
+ /// \param[out] file_list
+ /// A list of file specification objects that gets dependent
+ /// files appended to.
+ ///
+ /// \return
+ /// The number of new files that were appended to \a file_list.
+ ///
+ /// \see FileSpecList::AppendIfUnique(const FileSpec &)
+ virtual uint32_t GetDependentModules(FileSpecList &file_list) = 0;
+
+ /// Tells whether this object file is capable of being the main executable
+ /// for a process.
+ ///
+ /// \return
+ /// \b true if it is, \b false otherwise.
+ virtual bool IsExecutable() const = 0;
+
+ /// Returns the offset into a file at which this object resides.
+ ///
+ /// Some files contain many object files, and this function allows access to
+ /// an object's offset within the file.
+ ///
+ /// \return
+ /// The offset in bytes into the file. Defaults to zero for
+ /// simple object files that a represented by an entire file.
+ virtual lldb::addr_t GetFileOffset() const { return m_file_offset; }
+
+ virtual lldb::addr_t GetByteSize() const { return m_length; }
+
+ /// Get accessor to the object file specification.
+ ///
+ /// \return
+ /// The file specification object pointer if there is one, or
+ /// NULL if this object is only from memory.
+ virtual FileSpec &GetFileSpec() { return m_file; }
+
+ /// Get const accessor to the object file specification.
+ ///
+ /// \return
+ /// The const file specification object pointer if there is one,
+ /// or NULL if this object is only from memory.
+ virtual const FileSpec &GetFileSpec() const { return m_file; }
+
+ /// Get the ArchSpec for this object file.
+ ///
+ /// \return
+ /// The ArchSpec of this object file. In case of error, an invalid
+ /// ArchSpec object is returned.
+ virtual ArchSpec GetArchitecture() = 0;
+
+ /// Gets the section list for the currently selected architecture (and
+ /// object for archives).
+ ///
+ /// Section list parsing can be deferred by ObjectFile instances until this
+ /// accessor is called the first time.
+ ///
+ /// \return
+ /// The list of sections contained in this object file.
+ virtual SectionList *GetSectionList(bool update_module_section_list = true);
+
+ virtual void CreateSections(SectionList &unified_section_list) = 0;
+
+ /// Notify the ObjectFile that the file addresses in the Sections for this
+ /// module have been changed.
+ virtual void SectionFileAddressesChanged() {}
+
+ /// Gets the symbol table for the currently selected architecture (and
+ /// object for archives).
+ ///
+ /// Symbol table parsing can be deferred by ObjectFile instances until this
+ /// accessor is called the first time.
+ ///
+ /// \return
+ /// The symbol table for this object file.
+ virtual Symtab *GetSymtab() = 0;
+
+ /// Perform relocations on the section if necessary.
+ ///
+ virtual void RelocateSection(lldb_private::Section *section);
+
+ /// Appends a Symbol for the specified so_addr to the symbol table.
+ ///
+ /// If verify_unique is false, the symbol table is not searched to determine
+ /// if a Symbol found at this address has already been added to the symbol
+ /// table. When verify_unique is true, this method resolves the Symbol as
+ /// the first match in the SymbolTable and appends a Symbol only if
+ /// required/found.
+ ///
+ /// \return
+ /// The resolved symbol or nullptr. Returns nullptr if a
+ /// a Symbol could not be found for the specified so_addr.
+ virtual Symbol *ResolveSymbolForAddress(const Address &so_addr,
+ bool verify_unique) {
+ // Typically overridden to lazily add stripped symbols recoverable from the
+ // exception handling unwind information (i.e. without parsing the entire
+ // eh_frame section.
+ //
+ // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO to
+ // efficiently add stripped symbols when the symbol table is first
+ // constructed. Poorer cousins are PECoff and ELF.
+ return nullptr;
+ }
+
+ /// Detect if this object file has been stripped of local symbols.
+ /// Detect if this object file has been stripped of local symbols.
+ ///
+ /// \return
+ /// Return \b true if the object file has been stripped of local
+ /// symbols.
+ virtual bool IsStripped() = 0;
+
+ /// Frees the symbol table.
+ ///
+ /// This function should only be used when an object file is
+ ///
+ /// \param[in] flags
+ /// eSymtabFromUnifiedSectionList: Whether to clear symbol table
+ /// for unified module section list, or object file.
+ ///
+ /// \return
+ /// The symbol table for this object file.
+ virtual void ClearSymtab();
+
+ /// Gets the UUID for this object file.
+ ///
+ /// If the object file format contains a UUID, the value should be returned.
+ /// Else ObjectFile instances should return the MD5 checksum of all of the
+ /// bytes for the object file (or memory for memory based object files).
+ ///
+ /// \return
+ /// The object file's UUID. In case of an error, an empty UUID is
+ /// returned.
+ virtual UUID GetUUID() = 0;
+
+ /// Gets the symbol file spec list for this object file.
+ ///
+ /// If the object file format contains a debug symbol file link, the values
+ /// will be returned in the FileSpecList.
+ ///
+ /// \return
+ /// Returns filespeclist.
+ virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() {
+ return FileSpecList();
+ }
+
+ /// Gets the file spec list of libraries re-exported by this object file.
+ ///
+ /// If the object file format has the notion of one library re-exporting the
+ /// symbols from another, the re-exported libraries will be returned in the
+ /// FileSpecList.
+ ///
+ /// \return
+ /// Returns filespeclist.
+ virtual lldb_private::FileSpecList GetReExportedLibraries() {
+ return FileSpecList();
+ }
+
+ /// Sets the load address for an entire module, assuming a rigid slide of
+ /// sections, if possible in the implementation.
+ ///
+ /// \return
+ /// Returns true iff any section's load address changed.
+ virtual bool SetLoadAddress(Target &target, lldb::addr_t value,
+ bool value_is_offset) {
+ return false;
+ }
+
+ /// Gets whether endian swapping should occur when extracting data from this
+ /// object file.
+ ///
+ /// \return
+ /// Returns \b true if endian swapping is needed, \b false
+ /// otherwise.
+ virtual lldb::ByteOrder GetByteOrder() const = 0;
+
+ /// Attempts to parse the object header.
+ ///
+ /// This function is used as a test to see if a given plug-in instance can
+ /// parse the header data already contained in ObjectFile::m_data. If an
+ /// object file parser does not recognize that magic bytes in a header,
+ /// false should be returned and the next plug-in can attempt to parse an
+ /// object file.
+ ///
+ /// \return
+ /// Returns \b true if the header was parsed successfully, \b
+ /// false otherwise.
+ virtual bool ParseHeader() = 0;
+
+ /// Returns if the function bounds for symbols in this symbol file are
+ /// likely accurate.
+ ///
+ /// The unwinder can emulate the instructions of functions to understand
+ /// prologue/epilogue code sequences, where registers are spilled on the
+ /// stack, etc. This feature relies on having the correct start addresses
+ /// of all functions. If the ObjectFile has a way to tell that symbols have
+ /// been stripped and there's no way to reconstruct start addresses (e.g.
+ /// LC_FUNCTION_STARTS on Mach-O, or eh_frame unwind info), the ObjectFile
+ /// should indicate that assembly emulation should not be used for this
+ /// module.
+ ///
+ /// It is uncommon for this to return false. An ObjectFile needs to be sure
+ /// that symbol start addresses are unavailable before false is returned.
+ /// If it is unclear, this should return true.
+ ///
+ /// \return
+ /// Returns true if assembly emulation should be used for this
+ /// module.
+ /// Only returns false if the ObjectFile is sure that symbol
+ /// addresses are insufficient for accurate assembly emulation.
+ virtual bool AllowAssemblyEmulationUnwindPlans() { return true; }
+
+ /// Similar to Process::GetImageInfoAddress().
+ ///
+ /// Some platforms embed auxiliary structures useful to debuggers in the
+ /// address space of the inferior process. This method returns the address
+ /// of such a structure if the information can be resolved via entries in
+ /// the object file. ELF, for example, provides a means to hook into the
+ /// runtime linker so that a debugger may monitor the loading and unloading
+ /// of shared libraries.
+ ///
+ /// \return
+ /// The address of any auxiliary tables, or an invalid address if this
+ /// object file format does not support or contain such information.
+ virtual lldb_private::Address GetImageInfoAddress(Target *target) {
+ return Address();
+ }
+
+ /// Returns the address of the Entry Point in this object file - if the
+ /// object file doesn't have an entry point (because it is not an executable
+ /// file) then an invalid address is returned.
+ ///
+ /// \return
+ /// Returns the entry address for this module.
+ virtual lldb_private::Address GetEntryPointAddress() { return Address(); }
+
+ /// Returns base address of this object file.
+ ///
+ /// This also sometimes referred to as the "preferred load address" or the
+ /// "image base address". Addresses within object files are often expressed
+ /// relative to this base. If this address corresponds to a specific section
+ /// (usually the first byte of the first section) then the returned address
+ /// will have this section set. Otherwise, the address will just have the
+ /// offset member filled in, indicating that this represents a file address.
+ virtual lldb_private::Address GetBaseAddress() {
+ return Address(m_memory_addr);
+ }
+
+ 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();
+ }
+
+ /// The object file should be able to calculate its type by looking at its
+ /// file header and possibly the sections or other data in the object file.
+ /// The file type is used in the debugger to help select the correct plug-
+ /// ins for the job at hand, so this is important to get right. If any
+ /// eTypeXXX definitions do not match up with the type of file you are
+ /// loading, please feel free to add a new enumeration value.
+ ///
+ /// \return
+ /// The calculated file type for the current object file.
+ virtual Type CalculateType() = 0;
+
+ /// In cases where the type can't be calculated (elf files), this routine
+ /// allows someone to explicitly set it. As an example, SymbolVendorELF uses
+ /// this routine to set eTypeDebugInfo when loading debug link files.
+ virtual void SetType(Type type) { m_type = type; }
+
+ /// The object file should be able to calculate the strata of the object
+ /// file.
+ ///
+ /// Many object files for platforms might be for either user space debugging
+ /// or for kernel debugging. If your object file subclass can figure this
+ /// out, it will help with debugger plug-in selection when it comes time to
+ /// debug.
+ ///
+ /// \return
+ /// The calculated object file strata for the current object
+ /// file.
+ virtual Strata CalculateStrata() = 0;
+
+ /// Get the object file version numbers.
+ ///
+ /// Many object files have a set of version numbers that describe the
+ /// version of the executable or shared library. Typically there are major,
+ /// minor and build, but there may be more. This function will extract the
+ /// versions from object files if they are available.
+ ///
+ /// \return
+ /// This function returns extracted version numbers as a
+ /// llvm::VersionTuple. In case of error an empty VersionTuple is
+ /// returned.
+ virtual llvm::VersionTuple GetVersion() { return llvm::VersionTuple(); }
+
+ /// Get the minimum OS version this object file can run on.
+ ///
+ /// Some object files have information that specifies the minimum OS version
+ /// that they can be used on.
+ ///
+ /// \return
+ /// This function returns extracted version numbers as a
+ /// llvm::VersionTuple. In case of error an empty VersionTuple is
+ /// returned.
+ virtual llvm::VersionTuple GetMinimumOSVersion() {
+ return llvm::VersionTuple();
+ }
+
+ /// Get the SDK OS version this object file was built with.
+ ///
+ /// \return
+ /// This function returns extracted version numbers as a
+ /// llvm::VersionTuple. In case of error an empty VersionTuple is
+ /// returned.
+ virtual llvm::VersionTuple GetSDKVersion() { return llvm::VersionTuple(); }
+
+ /// Return true if this file is a dynamic link editor (dyld)
+ ///
+ /// Often times dyld has symbols that mirror symbols in libc and other
+ /// shared libraries (like "malloc" and "free") and the user does _not_ want
+ /// to stop in these shared libraries by default. We can ask the ObjectFile
+ /// if it is such a file and should be avoided for things like settings
+ /// breakpoints and doing function lookups for expressions.
+ virtual bool GetIsDynamicLinkEditor() { return false; }
+
+ // Member Functions
+ Type GetType() {
+ if (m_type == eTypeInvalid)
+ m_type = CalculateType();
+ return m_type;
+ }
+
+ Strata GetStrata() {
+ if (m_strata == eStrataInvalid)
+ m_strata = CalculateStrata();
+ return m_strata;
+ }
+
+ // When an object file is in memory, subclasses should try and lock the
+ // process weak pointer. If the process weak pointer produces a valid
+ // ProcessSP, then subclasses can call this function to read memory.
+ static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp,
+ lldb::addr_t addr, size_t byte_size);
+
+ // This function returns raw file contents. Do not use it if you want
+ // transparent decompression of section contents.
+ size_t GetData(lldb::offset_t offset, size_t length,
+ DataExtractor &data) const;
+
+ // This function returns raw file contents. Do not use it if you want
+ // transparent decompression of section contents.
+ size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const;
+
+ // This function will transparently decompress section data if the section if
+ // compressed.
+ virtual size_t ReadSectionData(Section *section,
+ lldb::offset_t section_offset, void *dst,
+ size_t dst_len);
+
+ // This function will transparently decompress section data if the section if
+ // compressed. Note that for compressed section the resulting data size may
+ // be larger than what Section::GetFileSize reports.
+ virtual size_t ReadSectionData(Section *section,
+ DataExtractor §ion_data);
+
+ bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
+
+ // Strip linker annotations (such as @@VERSION) from symbol names.
+ virtual llvm::StringRef
+ StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const {
+ 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 std::vector<LoadableData> GetLoadableData(Target &target);
+
+protected:
+ // Member variables.
+ FileSpec m_file;
+ Type m_type;
+ Strata m_strata;
+ lldb::addr_t m_file_offset; ///< The offset in bytes into the file, or the
+ ///address in memory
+ lldb::addr_t m_length; ///< The length of this object file if it is known (can
+ ///be zero if length is unknown or can't be
+ ///determined).
+ DataExtractor
+ m_data; ///< The data for this object file so things can be parsed lazily.
+ lldb::ProcessWP m_process_wp;
+ const lldb::addr_t m_memory_addr;
+ std::unique_ptr<lldb_private::SectionList> m_sections_up;
+ std::unique_ptr<lldb_private::Symtab> m_symtab_up;
+ uint32_t m_synthetic_symbol_idx;
+
+ /// Sets the architecture for a module. At present the architecture can
+ /// only be set if it is invalid. It is not allowed to switch from one
+ /// concrete architecture to another.
+ ///
+ /// \param[in] new_arch
+ /// The architecture this module will be set to.
+ ///
+ /// \return
+ /// Returns \b true if the architecture was changed, \b
+ /// false otherwise.
+ bool SetModulesArchitecture(const ArchSpec &new_arch);
+
+ ConstString GetNextSyntheticSymbolName();
+
+ static lldb::DataBufferSP MapFileData(const FileSpec &file, uint64_t Size,
+ uint64_t Offset);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ObjectFile);
+};
+
+} // namespace lldb_private
+
+namespace llvm {
+template <> struct format_provider<lldb_private::ObjectFile::Type> {
+ static void format(const lldb_private::ObjectFile::Type &type,
+ raw_ostream &OS, StringRef Style);
+};
+
+template <> struct format_provider<lldb_private::ObjectFile::Strata> {
+ static void format(const lldb_private::ObjectFile::Strata &strata,
+ raw_ostream &OS, StringRef Style);
+};
+} // namespace llvm
+
+#endif // liblldb_ObjectFile_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h b/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h
new file mode 100644
index 0000000..e3a8587
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h
@@ -0,0 +1,226 @@
+//===-- PostfixExpression.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements support for postfix expressions found in several symbol
+// file formats, and their conversion to DWARF.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SYMBOL_POSTFIXEXPRESSION_H
+#define LLDB_SYMBOL_POSTFIXEXPRESSION_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
+
+namespace lldb_private {
+
+class Stream;
+
+namespace postfix {
+
+/// The base class for all nodes in the parsed postfix tree.
+class Node {
+public:
+ enum Kind {
+ BinaryOp,
+ InitialValue,
+ Integer,
+ Register,
+ Symbol,
+ UnaryOp,
+ };
+
+protected:
+ Node(Kind kind) : m_kind(kind) {}
+
+public:
+ Kind GetKind() const { return m_kind; }
+
+private:
+ Kind m_kind;
+};
+
+/// A node representing a binary expression.
+class BinaryOpNode : public Node {
+public:
+ enum OpType {
+ Align, // alignDown(a, b)
+ Minus, // a - b
+ Plus, // a + b
+ };
+
+ BinaryOpNode(OpType op_type, Node &left, Node &right)
+ : Node(BinaryOp), m_op_type(op_type), m_left(&left), m_right(&right) {}
+
+ OpType GetOpType() const { return m_op_type; }
+
+ const Node *Left() const { return m_left; }
+ Node *&Left() { return m_left; }
+
+ const Node *Right() const { return m_right; }
+ Node *&Right() { return m_right; }
+
+ static bool classof(const Node *node) { return node->GetKind() == BinaryOp; }
+
+private:
+ OpType m_op_type;
+ Node *m_left;
+ Node *m_right;
+};
+
+/// A node representing the canonical frame address.
+class InitialValueNode: public Node {
+public:
+ InitialValueNode() : Node(InitialValue) {}
+
+ static bool classof(const Node *node) {
+ return node->GetKind() == InitialValue;
+ }
+};
+
+/// A node representing an integer literal.
+class IntegerNode : public Node {
+public:
+ IntegerNode(int64_t value) : Node(Integer), m_value(value) {}
+
+ int64_t GetValue() const { return m_value; }
+
+ static bool classof(const Node *node) { return node->GetKind() == Integer; }
+
+private:
+ int64_t m_value;
+};
+
+/// A node representing the value of a register with the given register number.
+/// The register kind (RegisterKind enum) used for the specifying the register
+/// number is implicit and assumed to be the same for all Register nodes in a
+/// given tree.
+class RegisterNode : public Node {
+public:
+ RegisterNode(uint32_t reg_num) : Node(Register), m_reg_num(reg_num) {}
+
+ uint32_t GetRegNum() const { return m_reg_num; }
+
+ static bool classof(const Node *node) { return node->GetKind() == Register; }
+
+private:
+ uint32_t m_reg_num;
+};
+
+/// A node representing a symbolic reference to a named entity. This may be a
+/// register, which hasn't yet been resolved to a RegisterNode.
+class SymbolNode : public Node {
+public:
+ SymbolNode(llvm::StringRef name) : Node(Symbol), m_name(name) {}
+
+ llvm::StringRef GetName() const { return m_name; }
+
+ static bool classof(const Node *node) { return node->GetKind() == Symbol; }
+
+private:
+ llvm::StringRef m_name;
+};
+
+/// A node representing a unary operation.
+class UnaryOpNode : public Node {
+public:
+ enum OpType {
+ Deref, // *a
+ };
+
+ UnaryOpNode(OpType op_type, Node &operand)
+ : Node(UnaryOp), m_op_type(op_type), m_operand(&operand) {}
+
+ OpType GetOpType() const { return m_op_type; }
+
+ const Node *Operand() const { return m_operand; }
+ Node *&Operand() { return m_operand; }
+
+ static bool classof(const Node *node) { return node->GetKind() == UnaryOp; }
+
+private:
+ OpType m_op_type;
+ Node *m_operand;
+};
+
+/// A template class implementing a visitor pattern, but with a couple of
+/// twists:
+/// - It uses type switch instead of virtual double dispatch. This allows the
+// node classes to be vtable-free and trivially destructible.
+/// - The Visit functions get an extra Node *& parameter, which refers to the
+/// child pointer of the parent of the node we are currently visiting. This
+/// allows mutating algorithms, which replace the currently visited node with
+/// a different one.
+/// - The class is templatized on the return type of the Visit functions, which
+/// means it's possible to return values from them.
+template <typename ResultT = void> class Visitor {
+protected:
+ virtual ~Visitor() = default;
+
+ virtual ResultT Visit(BinaryOpNode &binary, Node *&ref) = 0;
+ virtual ResultT Visit(InitialValueNode &val, Node *&ref) = 0;
+ virtual ResultT Visit(IntegerNode &integer, Node *&) = 0;
+ virtual ResultT Visit(RegisterNode ®, Node *&) = 0;
+ virtual ResultT Visit(SymbolNode &symbol, Node *&ref) = 0;
+ virtual ResultT Visit(UnaryOpNode &unary, Node *&ref) = 0;
+
+ /// Invoke the correct Visit function based on the dynamic type of the given
+ /// node.
+ ResultT Dispatch(Node *&node) {
+ switch (node->GetKind()) {
+ case Node::BinaryOp:
+ return Visit(llvm::cast<BinaryOpNode>(*node), node);
+ case Node::InitialValue:
+ return Visit(llvm::cast<InitialValueNode>(*node), node);
+ case Node::Integer:
+ return Visit(llvm::cast<IntegerNode>(*node), node);
+ case Node::Register:
+ return Visit(llvm::cast<RegisterNode>(*node), node);
+ case Node::Symbol:
+ return Visit(llvm::cast<SymbolNode>(*node), node);
+ case Node::UnaryOp:
+ return Visit(llvm::cast<UnaryOpNode>(*node), node);
+ }
+ llvm_unreachable("Fully covered switch!");
+ }
+};
+
+/// A utility function for "resolving" SymbolNodes. It traverses a tree and
+/// calls the callback function for all SymbolNodes it encountered. The
+/// replacement function should return the node it wished to replace the current
+/// SymbolNode with (this can also be the original node), or nullptr in case of
+/// an error. The nodes returned by the callback are inspected and replaced
+/// recursively, *except* for the case when the function returns the exact same
+/// node as the input one. It returns true if all SymbolNodes were replaced
+/// successfully.
+bool ResolveSymbols(Node *&node,
+ llvm::function_ref<Node *(SymbolNode &symbol)> replacer);
+
+template <typename T, typename... Args>
+inline T *MakeNode(llvm::BumpPtrAllocator &alloc, Args &&... args) {
+ static_assert(std::is_trivially_destructible<T>::value,
+ "This object will not be destroyed!");
+ return new (alloc.Allocate<T>()) T(std::forward<Args>(args)...);
+}
+
+/// Parse the given postfix expression. The parsed nodes are placed into the
+/// provided allocator.
+Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
+
+/// Serialize the given expression tree as DWARF. The result is written into the
+/// given stream. The AST should not contain any SymbolNodes. If the expression
+/// contains InitialValueNodes, the generated expression will assume that their
+/// value will be provided as the top value of the initial evaluation stack (as
+/// is the case with the CFA value in register eh_unwind rules).
+void ToDWARF(Node &node, Stream &stream);
+
+} // namespace postfix
+} // namespace lldb_private
+
+#endif // LLDB_SYMBOL_POSTFIXEXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Symbol/SourceModule.h b/linux-x64/clang/include/lldb/Symbol/SourceModule.h
new file mode 100644
index 0000000..b12ff01
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/SourceModule.h
@@ -0,0 +1,27 @@
+//===-- SourceModule.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SourceModule_h_
+#define liblldb_SourceModule_h_
+
+#include "lldb/Utility/ConstString.h"
+#include <vector>
+
+namespace lldb_private {
+
+/// Information needed to import a source-language module.
+struct SourceModule {
+ /// Something like "Module.Submodule".
+ std::vector<ConstString> path;
+ ConstString search_path;
+ ConstString sysroot;
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Symbol/Symbol.h b/linux-x64/clang/include/lldb/Symbol/Symbol.h
new file mode 100644
index 0000000..1cbc2f5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Symbol.h
@@ -0,0 +1,269 @@
+//===-- Symbol.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Symbol_h_
+#define liblldb_Symbol_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Core/Mangled.h"
+#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class Symbol : public SymbolContextScope {
+public:
+ // ObjectFile readers can classify their symbol table entries and searches
+ // can be made on specific types where the symbol values will have
+ // drastically different meanings and sorting requirements.
+ Symbol();
+
+ Symbol(uint32_t symID, const char *name, bool name_is_mangled,
+ lldb::SymbolType type, bool external, bool is_debug,
+ bool is_trampoline, bool is_artificial,
+ const lldb::SectionSP §ion_sp, lldb::addr_t value,
+ lldb::addr_t size, bool size_is_valid,
+ bool contains_linker_annotations, uint32_t flags);
+
+ Symbol(uint32_t symID, const Mangled &mangled, lldb::SymbolType type,
+ bool external, bool is_debug, bool is_trampoline, bool is_artificial,
+ const AddressRange &range, bool size_is_valid,
+ bool contains_linker_annotations, uint32_t flags);
+
+ Symbol(const Symbol &rhs);
+
+ const Symbol &operator=(const Symbol &rhs);
+
+ void Clear();
+
+ bool Compare(ConstString name, lldb::SymbolType type) const;
+
+ void Dump(Stream *s, Target *target, uint32_t index) const;
+
+ bool ValueIsAddress() const;
+
+ // The GetAddressRef() accessor functions should only be called if you
+ // previously call ValueIsAddress() otherwise you might get an reference to
+ // an Address object that contains an constant integer value in
+ // m_addr_range.m_base_addr.m_offset which could be incorrectly used to
+ // represent an absolute address since it has no section.
+ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); }
+
+ const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); }
+
+ // Makes sure the symbol's value is an address and returns the file address.
+ // Returns LLDB_INVALID_ADDRESS if the symbol's value isn't an address.
+ lldb::addr_t GetFileAddress() const;
+
+ // Makes sure the symbol's value is an address and gets the load address
+ // using \a target if it is. Returns LLDB_INVALID_ADDRESS if the symbol's
+ // value isn't an address or if the section isn't loaded in \a target.
+ lldb::addr_t GetLoadAddress(Target *target) const;
+
+ // Access the address value. Do NOT hand out the AddressRange as an object as
+ // the byte size of the address range may not be filled in and it should be
+ // accessed via GetByteSize().
+ Address GetAddress() const {
+ // Make sure the our value is an address before we hand a copy out. We use
+ // the Address inside m_addr_range to contain the value for symbols that
+ // are not address based symbols so we are using it for more than just
+ // addresses. For example undefined symbols on MacOSX have a nlist.n_value
+ // of 0 (zero) and this will get placed into
+ // m_addr_range.m_base_addr.m_offset and it will have no section. So in the
+ // GetAddress() accessor, we need to hand out an invalid address if the
+ // symbol's value isn't an address.
+ if (ValueIsAddress())
+ return m_addr_range.GetBaseAddress();
+ else
+ return Address();
+ }
+
+ // When a symbol's value isn't an address, we need to access the raw value.
+ // This function will ensure this symbol's value isn't an address and return
+ // the integer value if this checks out, otherwise it will return
+ // "fail_value" if the symbol is an address value.
+ uint64_t GetIntegerValue(uint64_t fail_value = 0) const {
+ if (ValueIsAddress()) {
+ // This symbol's value is an address. Use Symbol::GetAddress() to get the
+ // address.
+ return fail_value;
+ } else {
+ // The value is stored in the base address' offset
+ return m_addr_range.GetBaseAddress().GetOffset();
+ }
+ }
+
+ lldb::addr_t ResolveCallableAddress(Target &target) const;
+
+ ConstString GetName() const;
+
+ ConstString GetNameNoArguments() const;
+
+ ConstString GetDisplayName() const;
+
+ uint32_t GetID() const { return m_uid; }
+
+ lldb::LanguageType GetLanguage() const {
+ // TODO: See if there is a way to determine the language for a symbol
+ // somehow, for now just return our best guess
+ return m_mangled.GuessLanguage();
+ }
+
+ void SetID(uint32_t uid) { m_uid = uid; }
+
+ Mangled &GetMangled() { return m_mangled; }
+
+ const Mangled &GetMangled() const { return m_mangled; }
+
+ ConstString GetReExportedSymbolName() const;
+
+ FileSpec GetReExportedSymbolSharedLibrary() const;
+
+ void SetReExportedSymbolName(ConstString name);
+
+ bool SetReExportedSymbolSharedLibrary(const FileSpec &fspec);
+
+ Symbol *ResolveReExportedSymbol(Target &target) const;
+
+ uint32_t GetSiblingIndex() const;
+
+ lldb::SymbolType GetType() const { return (lldb::SymbolType)m_type; }
+
+ void SetType(lldb::SymbolType type) { m_type = (lldb::SymbolType)type; }
+
+ const char *GetTypeAsString() const;
+
+ uint32_t GetFlags() const { return m_flags; }
+
+ void SetFlags(uint32_t flags) { m_flags = flags; }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
+
+ bool IsSynthetic() const { return m_is_synthetic; }
+
+ void SetIsSynthetic(bool b) { m_is_synthetic = b; }
+
+ bool GetSizeIsSynthesized() const { return m_size_is_synthesized; }
+
+ void SetSizeIsSynthesized(bool b) { m_size_is_synthesized = b; }
+
+ bool IsDebug() const { return m_is_debug; }
+
+ void SetDebug(bool b) { m_is_debug = b; }
+
+ bool IsExternal() const { return m_is_external; }
+
+ void SetExternal(bool b) { m_is_external = b; }
+
+ bool IsTrampoline() const;
+
+ bool IsIndirect() const;
+
+ bool IsWeak() const { return m_is_weak; }
+
+ void SetIsWeak (bool b) { m_is_weak = b; }
+
+ bool GetByteSizeIsValid() const { return m_size_is_valid; }
+
+ lldb::addr_t GetByteSize() const;
+
+ void SetByteSize(lldb::addr_t size) {
+ m_size_is_valid = size > 0;
+ m_addr_range.SetByteSize(size);
+ }
+
+ bool GetSizeIsSibling() const { return m_size_is_sibling; }
+
+ void SetSizeIsSibling(bool b) { m_size_is_sibling = b; }
+
+ // If m_type is "Code" or "Function" then this will return the prologue size
+ // in bytes, else it will return zero.
+ uint32_t GetPrologueByteSize();
+
+ bool GetDemangledNameIsSynthesized() const {
+ return m_demangled_is_synthesized;
+ }
+
+ void SetDemangledNameIsSynthesized(bool b) { m_demangled_is_synthesized = b; }
+
+ bool ContainsLinkerAnnotations() const {
+ return m_contains_linker_annotations;
+ }
+ void SetContainsLinkerAnnotations(bool b) {
+ m_contains_linker_annotations = b;
+ }
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// \see SymbolContextScope
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ Symbol *CalculateSymbolContextSymbol() override;
+
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// \see SymbolContextScope
+ void DumpSymbolContext(Stream *s) override;
+
+ lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx,
+ const char *flavor,
+ bool prefer_file_cache);
+
+ bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
+ bool prefer_file_cache, Stream &strm);
+
+ bool ContainsFileAddress(lldb::addr_t file_addr) const;
+
+protected:
+ // This is the internal guts of ResolveReExportedSymbol, it assumes
+ // reexport_name is not null, and that module_spec is valid. We track the
+ // modules we've already seen to make sure we don't get caught in a cycle.
+
+ Symbol *ResolveReExportedSymbolInModuleSpec(
+ Target &target, ConstString &reexport_name,
+ lldb_private::ModuleSpec &module_spec,
+ lldb_private::ModuleList &seen_modules) const;
+
+ uint32_t m_uid; // User ID (usually the original symbol table index)
+ uint16_t m_type_data; // data specific to m_type
+ uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has
+ // already been calculated
+ m_is_synthetic : 1, // non-zero if this symbol is not actually in the
+ // symbol table, but synthesized from other info in
+ // the object file.
+ m_is_debug : 1, // non-zero if this symbol is debug information in a
+ // symbol
+ m_is_external : 1, // non-zero if this symbol is globally visible
+ m_size_is_sibling : 1, // m_size contains the index of this symbol's
+ // sibling
+ m_size_is_synthesized : 1, // non-zero if this symbol's size was
+ // calculated using a delta between this
+ // symbol and the next
+ m_size_is_valid : 1,
+ m_demangled_is_synthesized : 1, // The demangled name was created should
+ // not be used for expressions or other
+ // lookups
+ m_contains_linker_annotations : 1, // The symbol name contains linker
+ // annotations, which are optional when
+ // doing name lookups
+ m_is_weak : 1,
+ m_type : 6; // Values from the lldb::SymbolType enum.
+ Mangled m_mangled; // uniqued symbol name/mangled name pair
+ AddressRange m_addr_range; // Contains the value, or the section offset
+ // address when the value is an address in a
+ // section, and the size (if any)
+ uint32_t m_flags; // A copy of the flags from the original symbol table, the
+ // ObjectFile plug-in can interpret these
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Symbol_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolContext.h b/linux-x64/clang/include/lldb/Symbol/SymbolContext.h
new file mode 100644
index 0000000..55a3454
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolContext.h
@@ -0,0 +1,501 @@
+//===-- SymbolContext.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SymbolContext_h_
+#define liblldb_SymbolContext_h_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/Address.h"
+#include "lldb/Core/Mangled.h"
+#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class SymbolContextScope;
+
+/// \class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" Defines
+/// a symbol context baton that can be handed other debug core functions.
+///
+/// Many debugger functions require a context when doing lookups. This class
+/// provides a common structure that can be used as the result of a query that
+/// can contain a single result. Examples of such queries include
+/// \li Looking up a load address.
+class SymbolContext {
+public:
+ /// Default constructor.
+ ///
+ /// Initialize all pointer members to nullptr and all struct members to
+ /// their default state.
+ SymbolContext();
+
+ /// Construct with an object that knows how to reconstruct its symbol
+ /// context.
+ ///
+ /// \param[in] sc_scope
+ /// A symbol context scope object that knows how to reconstruct
+ /// it's context.
+ explicit SymbolContext(SymbolContextScope *sc_scope);
+
+ /// Construct with module, and optional compile unit, function, block, line
+ /// table, line entry and symbol.
+ ///
+ /// Initialize all pointer to the specified values.
+ ///
+ /// \param[in] module
+ /// A Module pointer to the module for this context.
+ ///
+ /// \param[in] comp_unit
+ /// A CompileUnit pointer to the compile unit for this context.
+ ///
+ /// \param[in] function
+ /// A Function pointer to the function for this context.
+ ///
+ /// \param[in] block
+ /// A Block pointer to the deepest block for this context.
+ ///
+ /// \param[in] line_entry
+ /// A LineEntry pointer to the line entry for this context.
+ ///
+ /// \param[in] symbol
+ /// A Symbol pointer to the symbol for this context.
+ explicit SymbolContext(const lldb::TargetSP &target_sp,
+ const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr, Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
+
+ // This version sets the target to a NULL TargetSP if you don't know it.
+ explicit SymbolContext(const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr, Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
+
+ ~SymbolContext();
+
+ /// Assignment operator.
+ ///
+ /// Copies the address value from another SymbolContext object \a rhs into
+ /// \a this object.
+ ///
+ /// \param[in] rhs
+ /// A const SymbolContext object reference to copy.
+ ///
+ /// \return
+ /// A const SymbolContext object reference to \a this.
+ const SymbolContext &operator=(const SymbolContext &rhs);
+
+ /// Clear the object's state.
+ ///
+ /// Resets all pointer members to nullptr, and clears any class objects to
+ /// their default state.
+ void Clear(bool clear_target);
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the supplied stream
+ /// \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, Target *target) const;
+
+ /// Dump the stop context in this object to a Stream.
+ ///
+ /// Dump the best description of this object to the stream. The information
+ /// displayed depends on the amount and quality of the information in this
+ /// context. If a module, function, file and line number are available, they
+ /// will be dumped. If only a module and function or symbol name with offset
+ /// is available, that will be output. Else just the address at which the
+ /// target was stopped will be displayed.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// \param[in] so_addr
+ /// The resolved section offset address.
+ ///
+ /// \param[in] show_fullpaths
+ /// When printing file paths (with the Module), whether the
+ /// base name of the Module should be printed or the full path.
+ ///
+ /// \param[in] show_module
+ /// Whether the module name should be printed followed by a
+ /// grave accent "`" character.
+ ///
+ /// \param[in] show_inlined_frames
+ /// If a given pc is in inlined function(s), whether the inlined
+ /// functions should be printed on separate lines in addition to
+ /// the concrete function containing the pc.
+ ///
+ /// \param[in] show_function_arguments
+ /// If false, this method will try to elide the function argument
+ /// types when printing the function name. This may be ambiguous
+ /// for languages that have function overloading - but it may
+ /// make the "function name" too long to include all the argument
+ /// types.
+ ///
+ /// \param[in] show_function_name
+ /// Normally this should be true - the function/symbol name should
+ /// be printed. In disassembly formatting, where we want a format
+ /// like "<*+36>", this should be false and "*" will be printed
+ /// instead.
+ bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
+ const Address &so_addr, bool show_fullpaths,
+ bool show_module, bool show_inlined_frames,
+ bool show_function_arguments,
+ bool show_function_name) const;
+
+ /// Get the address range contained within a symbol context.
+ ///
+ /// Address range priority is as follows:
+ /// - line_entry address range if line_entry is valid and
+ /// eSymbolContextLineEntry is set in \a scope
+ /// - block address range if block is not nullptr and eSymbolContextBlock
+ /// is set in \a scope
+ /// - function address range if function is not nullptr and
+ /// eSymbolContextFunction is set in \a scope
+ /// - symbol address range if symbol is not nullptr and
+ /// eSymbolContextSymbol is set in \a scope
+ ///
+ /// \param[in] scope
+ /// A mask of symbol context bits telling this function which
+ /// address ranges it can use when trying to extract one from
+ /// the valid (non-nullptr) symbol context classes.
+ ///
+ /// \param[in] range_idx
+ /// The address range index to grab. Since many functions and
+ /// blocks are not always contiguous, they may have more than
+ /// one address range.
+ ///
+ /// \param[in] use_inline_block_range
+ /// If \a scope has the eSymbolContextBlock bit set, and there
+ /// is a valid block in the symbol context, return the block
+ /// address range for the containing inline function block, not
+ /// the deepest most block. This allows us to extract information
+ /// for the address range of the inlined function block, not
+ /// the deepest lexical block.
+ ///
+ /// \param[out] range
+ /// An address range object that will be filled in if \b true
+ /// is returned.
+ ///
+ /// \return
+ /// \b True if this symbol context contains items that describe
+ /// an address range, \b false otherwise.
+ bool GetAddressRange(uint32_t scope, uint32_t range_idx,
+ bool use_inline_block_range, AddressRange &range) const;
+
+ bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range,
+ 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(ConstString name, Status &error);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
+
+ uint32_t GetResolvedMask() const;
+
+ lldb::LanguageType GetLanguage() const;
+
+ /// Find a block that defines the function represented by this symbol
+ /// context.
+ ///
+ /// If this symbol context points to a block that is an inlined function, or
+ /// is contained within an inlined function, the block that defines the
+ /// inlined function is returned.
+ ///
+ /// If this symbol context has no block in it, or the block is not itself an
+ /// inlined function block or contained within one, we return the top level
+ /// function block.
+ ///
+ /// This is a handy function to call when you want to get the block whose
+ /// variable list will include the arguments for the function that is
+ /// represented by this symbol context (whether the function is an inline
+ /// function or not).
+ ///
+ /// \return
+ /// The block object pointer that defines the function that is
+ /// represented by this symbol context object, nullptr otherwise.
+ Block *GetFunctionBlock();
+
+ /// If this symbol context represents a function that is a method, return
+ /// true and provide information about the method.
+ ///
+ /// \param[out] language
+ /// If \b true is returned, the language for the method.
+ ///
+ /// \param[out] is_instance_method
+ /// If \b true is returned, \b true if this is a instance method,
+ /// \b false if this is a static/class function.
+ ///
+ /// \param[out] language_object_name
+ /// If \b true is returned, the name of the artificial variable
+ /// for the language ("this" for C++, "self" for ObjC).
+ ///
+ /// \return
+ /// \b True if this symbol context represents a function that
+ /// is a method of a class, \b false otherwise.
+ bool GetFunctionMethodInfo(lldb::LanguageType &language,
+ bool &is_instance_method,
+ ConstString &language_object_name);
+
+ /// Sorts the types in TypeMap according to SymbolContext to TypeList
+ ///
+ void SortTypeList(TypeMap &type_map, TypeList &type_list) const;
+
+ /// Find a name of the innermost function for the symbol context.
+ ///
+ /// For instance, if the symbol context contains an inlined block, it will
+ /// return the inlined function name.
+ ///
+ /// \param[in] prefer_mangled
+ /// if \btrue, then the mangled name will be returned if there
+ /// is one. Otherwise the unmangled name will be returned if it
+ /// is available.
+ ///
+ /// \return
+ /// The name of the function represented by this symbol context.
+ ConstString GetFunctionName(
+ Mangled::NamePreference preference = Mangled::ePreferDemangled) const;
+
+ /// Get the line entry that corresponds to the function.
+ ///
+ /// If the symbol context contains an inlined block, the line entry for the
+ /// start address of the inlined function will be returned, otherwise the
+ /// line entry for the start address of the function will be returned. This
+ /// can be used after doing a Module::FindFunctions(...) or
+ /// ModuleList::FindFunctions(...) call in order to get the correct line
+ /// table information for the symbol context. it will return the inlined
+ /// function name.
+ ///
+ /// \param[in] prefer_mangled
+ /// if \btrue, then the mangled name will be returned if there
+ /// is one. Otherwise the unmangled name will be returned if it
+ /// is available.
+ ///
+ /// \return
+ /// The name of the function represented by this symbol context.
+ LineEntry GetFunctionStartLineEntry() const;
+
+ /// Find the block containing the inlined block that contains this block.
+ ///
+ /// For instance, if the symbol context contains an inlined block, it will
+ /// return the inlined function name.
+ ///
+ /// \param[in] curr_frame_pc
+ /// The address within the block of this object.
+ ///
+ /// \param[out] next_frame_sc
+ /// A new symbol context that does what the title says it does.
+ ///
+ /// \param[out] next_frame_addr
+ /// This is what you should report as the PC in \a next_frame_sc.
+ ///
+ /// \return
+ /// \b true if this SymbolContext specifies a block contained in an
+ /// inlined block. If this returns \b true, \a next_frame_sc and
+ /// \a next_frame_addr will be filled in correctly.
+ bool GetParentOfInlinedScope(const Address &curr_frame_pc,
+ SymbolContext &next_frame_sc,
+ Address &inlined_frame_addr) const;
+
+ // Member variables
+ lldb::TargetSP target_sp; ///< The Target for a given query
+ lldb::ModuleSP module_sp; ///< The Module for a given query
+ CompileUnit *comp_unit; ///< The CompileUnit for a given query
+ Function *function; ///< The Function for a given query
+ Block *block; ///< The Block for a given query
+ LineEntry line_entry; ///< The LineEntry for a given query
+ Symbol *symbol; ///< The Symbol for a given query
+ Variable *variable; ///< The global variable matching the given query
+};
+
+class SymbolContextSpecifier {
+public:
+ enum SpecificationType {
+ eNothingSpecified = 0,
+ eModuleSpecified = 1 << 0,
+ eFileSpecified = 1 << 1,
+ eLineStartSpecified = 1 << 2,
+ eLineEndSpecified = 1 << 3,
+ eFunctionSpecified = 1 << 4,
+ eClassOrNamespaceSpecified = 1 << 5,
+ eAddressRangeSpecified = 1 << 6
+ };
+
+ // This one produces a specifier that matches everything...
+ SymbolContextSpecifier(const lldb::TargetSP &target_sp);
+
+ ~SymbolContextSpecifier();
+
+ bool AddSpecification(const char *spec_string, SpecificationType type);
+
+ bool AddLineSpecification(uint32_t line_no, SpecificationType type);
+
+ void Clear();
+
+ bool SymbolContextMatches(SymbolContext &sc);
+
+ bool AddressMatches(lldb::addr_t addr);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+private:
+ lldb::TargetSP m_target_sp;
+ std::string m_module_spec;
+ lldb::ModuleSP m_module_sp;
+ std::unique_ptr<FileSpec> m_file_spec_up;
+ size_t m_start_line;
+ size_t m_end_line;
+ std::string m_function_spec;
+ std::string m_class_name;
+ std::unique_ptr<AddressRange> m_address_range_up;
+ uint32_t m_type; // Or'ed bits from SpecificationType
+};
+
+/// \class SymbolContextList SymbolContext.h "lldb/Symbol/SymbolContext.h"
+/// Defines a list of symbol context objects.
+///
+/// This class provides a common structure that can be used to contain the
+/// result of a query that can contain a multiple results. Examples of such
+/// queries include:
+/// \li Looking up a function by name.
+/// \li Finding all addresses for a specified file and line number.
+class SymbolContextList {
+public:
+ /// Default constructor.
+ ///
+ /// Initialize with an empty list.
+ SymbolContextList();
+
+ /// Destructor.
+ ~SymbolContextList();
+
+ /// Append a new symbol context to the list.
+ ///
+ /// \param[in] sc
+ /// A symbol context to append to the list.
+ void Append(const SymbolContext &sc);
+
+ void Append(const SymbolContextList &sc_list);
+
+ bool AppendIfUnique(const SymbolContext &sc, bool merge_symbol_into_function);
+
+ uint32_t AppendIfUnique(const SymbolContextList &sc_list,
+ bool merge_symbol_into_function);
+
+ /// Clear the object's state.
+ ///
+ /// Clears the symbol context list.
+ void Clear();
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of each symbol context in the list to
+ /// the supplied stream \a s.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, Target *target) const;
+
+ /// Get accessor for a symbol context at index \a idx.
+ ///
+ /// Dump a description of the contents of each symbol context in the list to
+ /// the supplied stream \a s.
+ ///
+ /// \param[in] idx
+ /// The zero based index into the symbol context list.
+ ///
+ /// \param[out] sc
+ /// A reference to the symbol context to fill in.
+ ///
+ /// \return
+ /// Returns \b true if \a idx was a valid index into this
+ /// symbol context list and \a sc was filled in, \b false
+ /// otherwise.
+ bool GetContextAtIndex(size_t idx, SymbolContext &sc) const;
+
+ /// Direct reference accessor for a symbol context at index \a idx.
+ ///
+ /// The index \a idx must be a valid index, no error checking will be done
+ /// to ensure that it is valid.
+ ///
+ /// \param[in] idx
+ /// The zero based index into the symbol context list.
+ ///
+ /// \return
+ /// A const reference to the symbol context to fill in.
+ SymbolContext &operator[](size_t idx) { return m_symbol_contexts[idx]; }
+
+ const SymbolContext &operator[](size_t idx) const {
+ return m_symbol_contexts[idx];
+ }
+
+ bool RemoveContextAtIndex(size_t idx);
+
+ /// Get accessor for a symbol context list size.
+ ///
+ /// \return
+ /// Returns the number of symbol context objects in the list.
+ uint32_t GetSize() const;
+
+ uint32_t NumLineEntriesWithLine(uint32_t line) const;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
+
+protected:
+ typedef std::vector<SymbolContext>
+ collection; ///< The collection type for the list.
+
+ // Member variables.
+ collection m_symbol_contexts; ///< The list of symbol contexts.
+
+public:
+ typedef AdaptedIterable<collection, SymbolContext, vector_adapter>
+ SymbolContextIterable;
+ SymbolContextIterable SymbolContexts() {
+ return SymbolContextIterable(m_symbol_contexts);
+ }
+};
+
+bool operator==(const SymbolContext &lhs, const SymbolContext &rhs);
+bool operator!=(const SymbolContext &lhs, const SymbolContext &rhs);
+
+bool operator==(const SymbolContextList &lhs, const SymbolContextList &rhs);
+bool operator!=(const SymbolContextList &lhs, const SymbolContextList &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_SymbolContext_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h b/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h
new file mode 100644
index 0000000..a626302
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h
@@ -0,0 +1,103 @@
+//===-- SymbolContextScope.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SymbolContextScope_h_
+#define liblldb_SymbolContextScope_h_
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class SymbolContextScope SymbolContextScope.h
+/// "lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is
+/// part of a symbol context
+/// and can reconstruct its symbol context.
+///
+/// Many objects that are part of a symbol context that have pointers back to
+/// parent objects that own them. Any members of a symbol context that, once
+/// they are built, will not go away, can inherit from this pure virtual class
+/// and can then reconstruct their symbol context without having to keep a
+/// complete SymbolContext object in the object.
+///
+/// Examples of these objects include:
+/// \li Module
+/// \li CompileUnit
+/// \li Function
+/// \li Block
+/// \li Symbol
+///
+/// Other objects can store a "SymbolContextScope *" using any pointers to one
+/// of the above objects. This allows clients to hold onto a pointer that
+/// uniquely will identify a symbol context. Those clients can then always
+/// reconstruct the symbol context using the pointer, or use it to uniquely
+/// identify a symbol context for an object.
+///
+/// Example objects include that currently use "SymbolContextScope *" objects
+/// include:
+/// \li Variable objects that can reconstruct where they are scoped
+/// by making sure the SymbolContextScope * comes from the scope
+/// in which the variable was declared. If a variable is a global,
+/// the appropriate CompileUnit * will be used when creating the
+/// variable. A static function variables, can the Block scope
+/// in which the variable is defined. Function arguments can use
+/// the Function object as their scope. The SymbolFile parsers
+/// will set these correctly as the variables are parsed.
+/// \li Type objects that know exactly in which scope they
+/// originated much like the variables above.
+/// \li StackID objects that are able to know that if the CFA
+/// (stack pointer at the beginning of a function) and the
+/// start PC for the function/symbol and the SymbolContextScope
+/// pointer (a unique pointer that identifies a symbol context
+/// location) match within the same thread, that the stack
+/// frame is the same as the previous stack frame.
+///
+/// Objects that adhere to this protocol can reconstruct enough of a symbol
+/// context to allow functions that take a symbol context to be called. Lists
+/// can also be created using a SymbolContextScope* and and object pairs that
+/// allow large collections of objects to be passed around with minimal
+/// overhead.
+class SymbolContextScope {
+public:
+ virtual ~SymbolContextScope() = default;
+
+ /// Reconstruct the object's symbol context into \a sc.
+ ///
+ /// The object should fill in as much of the SymbolContext as it can so
+ /// function calls that require a symbol context can be made for the given
+ /// object.
+ ///
+ /// \param[out] sc
+ /// A symbol context object pointer that gets filled in.
+ virtual void CalculateSymbolContext(SymbolContext *sc) = 0;
+
+ virtual lldb::ModuleSP CalculateSymbolContextModule() {
+ return lldb::ModuleSP();
+ }
+
+ virtual CompileUnit *CalculateSymbolContextCompileUnit() { return nullptr; }
+
+ virtual Function *CalculateSymbolContextFunction() { return nullptr; }
+
+ virtual Block *CalculateSymbolContextBlock() { return nullptr; }
+
+ virtual Symbol *CalculateSymbolContextSymbol() { return nullptr; }
+
+ /// Dump the object's symbol context to the stream \a s.
+ ///
+ /// The object should dump its symbol context to the stream \a s. This
+ /// function is widely used in the DumpDebug and verbose output for lldb
+ /// objects.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object's symbol context.
+ virtual void DumpSymbolContext(Stream *s) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SymbolContextScope_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolFile.h b/linux-x64/clang/include/lldb/Symbol/SymbolFile.h
new file mode 100644
index 0000000..dbb723e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolFile.h
@@ -0,0 +1,253 @@
+//===-- SymbolFile.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SymbolFile_h_
+#define liblldb_SymbolFile_h_
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/SourceModule.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/DenseSet.h"
+
+#include <mutex>
+
+#if defined(LLDB_CONFIGURATION_DEBUG)
+#define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock())
+#else
+#define ASSERT_MODULE_LOCK(expr) ((void)0)
+#endif
+
+namespace lldb_private {
+
+class SymbolFile : public PluginInterface {
+public:
+ // Symbol file ability bits.
+ //
+ // Each symbol file can claim to support one or more symbol file abilities.
+ // These get returned from SymbolFile::GetAbilities(). These help us to
+ // determine which plug-in will be best to load the debug information found
+ // in files.
+ enum Abilities {
+ CompileUnits = (1u << 0),
+ LineTables = (1u << 1),
+ Functions = (1u << 2),
+ Blocks = (1u << 3),
+ GlobalVariables = (1u << 4),
+ LocalVariables = (1u << 5),
+ VariableTypes = (1u << 6),
+ kAllAbilities = ((1u << 7) - 1u)
+ };
+
+ static SymbolFile *FindPlugin(ObjectFile *obj_file);
+
+ // Constructors and Destructors
+ SymbolFile(ObjectFile *obj_file)
+ : m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
+
+ ~SymbolFile() override {}
+
+ /// Get a mask of what this symbol file supports for the object file
+ /// that it was constructed with.
+ ///
+ /// Each symbol file gets to respond with a mask of abilities that
+ /// it supports for each object file. This happens when we are
+ /// trying to figure out which symbol file plug-in will get used
+ /// for a given object file. The plug-in that responds with the
+ /// best mix of "SymbolFile::Abilities" bits set, will get chosen to
+ /// be the symbol file parser. This allows each plug-in to check for
+ /// sections that contain data a symbol file plug-in would need. For
+ /// example the DWARF plug-in requires DWARF sections in a file that
+ /// contain debug information. If the DWARF plug-in doesn't find
+ /// these sections, it won't respond with many ability bits set, and
+ /// we will probably fall back to the symbol table SymbolFile plug-in
+ /// which uses any information in the symbol table. Also, plug-ins
+ /// might check for some specific symbols in a symbol table in the
+ /// case where the symbol table contains debug information (STABS
+ /// and COFF). Not a lot of work should happen in these functions
+ /// as the plug-in might not get selected due to another plug-in
+ /// having more abilities. Any initialization work should be saved
+ /// for "void SymbolFile::InitializeObject()" which will get called
+ /// on the SymbolFile object with the best set of abilities.
+ ///
+ /// \return
+ /// A uint32_t mask containing bits from the SymbolFile::Abilities
+ /// enumeration. Any bits that are set represent an ability that
+ /// this symbol plug-in can parse from the object file.
+ uint32_t GetAbilities() {
+ if (!m_calculated_abilities) {
+ m_abilities = CalculateAbilities();
+ m_calculated_abilities = true;
+ }
+
+ return m_abilities;
+ }
+
+ virtual uint32_t CalculateAbilities() = 0;
+
+ /// Symbols file subclasses should override this to return the Module that
+ /// owns the TypeSystem that this symbol file modifies type information in.
+ virtual std::recursive_mutex &GetModuleMutex() const;
+
+ /// Initialize the SymbolFile object.
+ ///
+ /// The SymbolFile object with the best set of abilities (detected
+ /// in "uint32_t SymbolFile::GetAbilities()) will have this function
+ /// called if it is chosen to parse an object file. More complete
+ /// initialization can happen in this function which will get called
+ /// prior to any other functions in the SymbolFile protocol.
+ virtual void InitializeObject() {}
+
+ // Compile Unit function calls
+ // Approach 1 - iterator
+ virtual uint32_t GetNumCompileUnits() = 0;
+ virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
+
+ virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
+ virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
+ virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
+ virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
+ virtual bool ParseSupportFiles(CompileUnit &comp_unit,
+ FileSpecList &support_files) = 0;
+ virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
+ virtual bool ParseIsOptimized(CompileUnit &comp_unit) { return false; }
+
+ virtual bool
+ ParseImportedModules(const SymbolContext &sc,
+ std::vector<SourceModule> &imported_modules) = 0;
+ virtual size_t ParseBlocksRecursive(Function &func) = 0;
+ virtual size_t ParseVariablesForContext(const SymbolContext &sc) = 0;
+ virtual Type *ResolveTypeUID(lldb::user_id_t type_uid) = 0;
+
+
+ /// The characteristics of an array type.
+ struct ArrayInfo {
+ int64_t first_index = 0;
+ llvm::SmallVector<uint64_t, 1> element_orders;
+ uint32_t byte_stride = 0;
+ uint32_t bit_stride = 0;
+ };
+ /// If \c type_uid points to an array type, return its characteristics.
+ /// To support variable-length array types, this function takes an
+ /// optional \p ExtecutionContext. If \c exe_ctx is non-null, the
+ /// dynamic characteristics for that context are returned.
+ virtual llvm::Optional<ArrayInfo>
+ GetDynamicArrayInfoForUID(lldb::user_id_t type_uid,
+ const lldb_private::ExecutionContext *exe_ctx) = 0;
+
+ virtual bool CompleteType(CompilerType &compiler_type) = 0;
+ virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx) {}
+ virtual CompilerDecl GetDeclForUID(lldb::user_id_t uid) {
+ return CompilerDecl();
+ }
+ virtual CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) {
+ return CompilerDeclContext();
+ }
+ virtual CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) {
+ return CompilerDeclContext();
+ }
+ virtual uint32_t ResolveSymbolContext(const Address &so_addr,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContext &sc) = 0;
+ virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
+ uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContextList &sc_list);
+
+ virtual void DumpClangAST(Stream &s) {}
+ virtual uint32_t
+ FindGlobalVariables(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ uint32_t max_matches, VariableList &variables);
+ virtual uint32_t FindGlobalVariables(const RegularExpression ®ex,
+ uint32_t max_matches,
+ VariableList &variables);
+ virtual uint32_t FindFunctions(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+ virtual uint32_t FindFunctions(const RegularExpression ®ex,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+ virtual uint32_t
+ FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
+ bool append, uint32_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+ virtual size_t FindTypes(const std::vector<CompilerContext> &context,
+ bool append, TypeMap &types);
+
+ virtual void
+ GetMangledNamesForFunction(const std::string &scope_qualified_name,
+ std::vector<ConstString> &mangled_names);
+ // virtual uint32_t FindTypes (const SymbolContext& sc, const
+ // RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
+ // types) = 0;
+ virtual TypeList *GetTypeList();
+ virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) = 0;
+
+ virtual void PreloadSymbols();
+
+ virtual lldb_private::TypeSystem *
+ GetTypeSystemForLanguage(lldb::LanguageType language);
+
+ virtual CompilerDeclContext
+ FindNamespace(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx) {
+ return CompilerDeclContext();
+ }
+
+ ObjectFile *GetObjectFile() { return m_obj_file; }
+ const ObjectFile *GetObjectFile() const { return m_obj_file; }
+
+ virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
+ return {};
+ }
+
+ virtual void AddSymbols(Symtab &symtab) {}
+
+ /// Notify the SymbolFile that the file addresses in the Sections
+ /// for this module have been changed.
+ virtual void SectionFileAddressesChanged() {}
+
+ struct RegisterInfoResolver {
+ virtual ~RegisterInfoResolver(); // anchor
+
+ virtual const RegisterInfo *ResolveName(llvm::StringRef name) const = 0;
+ virtual const RegisterInfo *ResolveNumber(lldb::RegisterKind kind,
+ uint32_t number) const = 0;
+ };
+ virtual lldb::UnwindPlanSP
+ GetUnwindPlan(const Address &address, const RegisterInfoResolver &resolver) {
+ return nullptr;
+ }
+
+ virtual void Dump(Stream &s) {}
+
+protected:
+ void AssertModuleLock();
+
+ ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
+ uint32_t m_abilities;
+ bool m_calculated_abilities;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SymbolFile);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SymbolFile_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h b/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h
new file mode 100644
index 0000000..c4015ff
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h
@@ -0,0 +1,168 @@
+//===-- SymbolVendor.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SymbolVendor_h_
+#define liblldb_SymbolVendor_h_
+
+#include <vector>
+
+#include "lldb/Core/ModuleChild.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Symbol/SourceModule.h"
+#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/TypeMap.h"
+#include "lldb/lldb-private.h"
+#include "llvm/ADT/DenseSet.h"
+
+namespace lldb_private {
+
+// The symbol vendor class is designed to abstract the process of searching for
+// debug information for a given module. Platforms can subclass this class and
+// provide extra ways to find debug information. Examples would be a subclass
+// that would allow for locating a stand alone debug file, parsing debug maps,
+// or runtime data in the object files. A symbol vendor can use multiple
+// sources (SymbolFile objects) to provide the information and only parse as
+// deep as needed in order to provide the information that is requested.
+class SymbolVendor : public ModuleChild, public PluginInterface {
+public:
+ static SymbolVendor *FindPlugin(const lldb::ModuleSP &module_sp,
+ Stream *feedback_strm);
+
+ // Constructors and Destructors
+ SymbolVendor(const lldb::ModuleSP &module_sp);
+
+ ~SymbolVendor() override;
+
+ void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
+
+ virtual void Dump(Stream *s);
+
+ virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit);
+
+ virtual size_t ParseFunctions(CompileUnit &comp_unit);
+
+ virtual bool ParseLineTable(CompileUnit &comp_unit);
+
+ virtual bool ParseDebugMacros(CompileUnit &comp_unit);
+
+ virtual bool ParseSupportFiles(CompileUnit &comp_unit,
+ FileSpecList &support_files);
+
+ virtual bool ParseIsOptimized(CompileUnit &comp_unit);
+
+ virtual size_t ParseTypes(CompileUnit &comp_unit);
+
+ virtual bool
+ ParseImportedModules(const SymbolContext &sc,
+ std::vector<SourceModule> &imported_modules);
+
+ virtual size_t ParseBlocksRecursive(Function &func);
+
+ virtual size_t ParseVariablesForContext(const SymbolContext &sc);
+
+ virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
+
+ virtual uint32_t ResolveSymbolContext(const Address &so_addr,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContext &sc);
+
+ virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
+ uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContextList &sc_list);
+
+ virtual size_t FindGlobalVariables(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ size_t max_matches,
+ VariableList &variables);
+
+ virtual size_t FindGlobalVariables(const RegularExpression ®ex,
+ size_t max_matches,
+ VariableList &variables);
+
+ virtual size_t FindFunctions(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+
+ virtual size_t FindFunctions(const RegularExpression ®ex,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+
+ virtual size_t
+ FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
+ bool append, size_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+
+ virtual size_t FindTypes(const std::vector<CompilerContext> &context,
+ bool append, TypeMap &types);
+
+ virtual CompilerDeclContext
+ FindNamespace(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx);
+
+ virtual size_t GetNumCompileUnits();
+
+ virtual bool SetCompileUnitAtIndex(size_t cu_idx,
+ const lldb::CompUnitSP &cu_sp);
+
+ virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
+
+ TypeList &GetTypeList() { return m_type_list; }
+
+ const TypeList &GetTypeList() const { return m_type_list; }
+
+ virtual size_t GetTypes(SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask, TypeList &type_list);
+
+ SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
+
+ FileSpec GetMainFileSpec() const;
+
+ // Get module unified section list symbol table.
+ virtual Symtab *GetSymtab();
+
+ // Clear module unified section list symbol table.
+ virtual void ClearSymtab();
+
+ /// Notify the SymbolVendor that the file addresses in the Sections
+ /// for this module have been changed.
+ virtual void SectionFileAddressesChanged();
+
+ // PluginInterface protocol
+ ConstString GetPluginName() override;
+
+ uint32_t GetPluginVersion() override;
+
+protected:
+ // Classes that inherit from SymbolVendor can see and modify these
+ typedef std::vector<lldb::CompUnitSP> CompileUnits;
+ typedef CompileUnits::iterator CompileUnitIter;
+ typedef CompileUnits::const_iterator CompileUnitConstIter;
+
+ TypeList m_type_list; // Uniqued types for all parsers owned by this module
+ CompileUnits m_compile_units; // The current compile units
+ lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
+ // case it isn't the same as the module
+ // object file (debug symbols in a separate
+ // file)
+ std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
+ // can add more of these if needed.
+ Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of
+ // the symbol file each time when it is needed
+
+private:
+ // For SymbolVendor only
+ DISALLOW_COPY_AND_ASSIGN(SymbolVendor);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SymbolVendor_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/Symtab.h b/linux-x64/clang/include/lldb/Symbol/Symtab.h
new file mode 100644
index 0000000..868edcd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Symtab.h
@@ -0,0 +1,206 @@
+//===-- Symtab.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Symtab_h_
+#define liblldb_Symtab_h_
+
+#include "lldb/Core/UniqueCStringMap.h"
+#include "lldb/Symbol/Symbol.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/lldb-private.h"
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+
+class Symtab {
+public:
+ typedef std::vector<uint32_t> IndexCollection;
+ typedef UniqueCStringMap<uint32_t> NameToIndexMap;
+
+ enum Debug {
+ eDebugNo, // Not a debug symbol
+ eDebugYes, // A debug symbol
+ eDebugAny
+ };
+
+ enum Visibility { eVisibilityAny, eVisibilityExtern, eVisibilityPrivate };
+
+ Symtab(ObjectFile *objfile);
+ ~Symtab();
+
+ void PreloadSymbols();
+ void Reserve(size_t count);
+ Symbol *Resize(size_t count);
+ uint32_t AddSymbol(const Symbol &symbol);
+ size_t GetNumSymbols() const;
+ void SectionFileAddressesChanged();
+ void Dump(Stream *s, Target *target, SortOrder sort_type);
+ void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes) const;
+ uint32_t GetIndexForSymbol(const Symbol *symbol) const;
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+ Symbol *FindSymbolByID(lldb::user_id_t uid) const;
+ Symbol *SymbolAtIndex(size_t idx);
+ const Symbol *SymbolAtIndex(size_t idx) const;
+ Symbol *FindSymbolWithType(lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility, uint32_t &start_idx);
+ /// Get the parent symbol for the given symbol.
+ ///
+ /// Many symbols in symbol tables are scoped by other symbols that
+ /// contain one or more symbol. This function will look for such a
+ /// containing symbol and return it if there is one.
+ const Symbol *GetParent(Symbol *symbol) const;
+ uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &indexes,
+ uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithTypeAndFlagsValue(
+ lldb::SymbolType symbol_type, uint32_t flags_value,
+ std::vector<uint32_t> &indexes, uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches,
+ uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithName(ConstString symbol_name,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithName(ConstString symbol_name,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithNameAndType(ConstString symbol_name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithNameAndType(ConstString symbol_name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches);
+ uint32_t
+ AppendSymbolIndexesMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &indexes);
+ uint32_t AppendSymbolIndexesMatchingRegExAndType(
+ const RegularExpression ®ex, lldb::SymbolType symbol_type,
+ Debug symbol_debug_type, Visibility symbol_visibility,
+ std::vector<uint32_t> &indexes);
+ size_t FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &symbol_indexes);
+ size_t FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ size_t FindAllSymbolsMatchingRexExAndType(
+ const RegularExpression ®ex, lldb::SymbolType symbol_type,
+ Debug symbol_debug_type, Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ Symbol *FindFirstSymbolWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility);
+ Symbol *FindSymbolAtFileAddress(lldb::addr_t file_addr);
+ Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
+ void ForEachSymbolContainingFileAddress(
+ lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
+ size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
+ void CalculateSymbolSizes();
+
+ void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
+ bool remove_duplicates) const;
+
+ static void DumpSymbolHeader(Stream *s);
+
+ void Finalize() {
+ // Shrink to fit the symbols so we don't waste memory
+ if (m_symbols.capacity() > m_symbols.size()) {
+ collection new_symbols(m_symbols.begin(), m_symbols.end());
+ m_symbols.swap(new_symbols);
+ }
+ }
+
+ void AppendSymbolNamesToMap(const IndexCollection &indexes,
+ bool add_demangled, bool add_mangled,
+ NameToIndexMap &name_to_index_map) const;
+
+ ObjectFile *GetObjectFile() { return m_objfile; }
+
+protected:
+ typedef std::vector<Symbol> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+ typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+ FileRangeToIndexMap;
+ void InitNameIndexes();
+ void InitAddressIndexes();
+
+ ObjectFile *m_objfile;
+ collection m_symbols;
+ FileRangeToIndexMap m_file_addr_to_index;
+ UniqueCStringMap<uint32_t> m_name_to_index;
+ UniqueCStringMap<uint32_t> m_basename_to_index;
+ UniqueCStringMap<uint32_t> m_method_to_index;
+ UniqueCStringMap<uint32_t> m_selector_to_index;
+ mutable std::recursive_mutex
+ m_mutex; // Provide thread safety for this symbol table
+ bool m_file_addr_to_index_computed : 1, m_name_indexes_computed : 1;
+
+private:
+ bool CheckSymbolAtIndex(size_t idx, Debug symbol_debug_type,
+ Visibility symbol_visibility) const {
+ switch (symbol_debug_type) {
+ case eDebugNo:
+ if (m_symbols[idx].IsDebug())
+ return false;
+ break;
+
+ case eDebugYes:
+ if (!m_symbols[idx].IsDebug())
+ return false;
+ break;
+
+ case eDebugAny:
+ break;
+ }
+
+ switch (symbol_visibility) {
+ case eVisibilityAny:
+ return true;
+
+ case eVisibilityExtern:
+ return m_symbols[idx].IsExternal();
+
+ case eVisibilityPrivate:
+ return !m_symbols[idx].IsExternal();
+ }
+ return false;
+ }
+
+ void SymbolIndicesToSymbolContextList(std::vector<uint32_t> &symbol_indexes,
+ SymbolContextList &sc_list);
+
+ void RegisterMangledNameEntry(
+ uint32_t value, std::set<const char *> &class_contexts,
+ std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog,
+ RichManglingContext &rmc);
+
+ void RegisterBacklogEntry(const NameToIndexMap::Entry &entry,
+ const char *decl_context,
+ const std::set<const char *> &class_contexts);
+
+ DISALLOW_COPY_AND_ASSIGN(Symtab);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Symtab_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h b/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h
new file mode 100644
index 0000000..043a913
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h
@@ -0,0 +1,43 @@
+//===-- TaggedASTType.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TaggedASTType_h_
+#define liblldb_TaggedASTType_h_
+
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private {
+
+// For cases in which there are multiple classes of types that are not
+// interchangeable, to allow static type checking.
+template <unsigned int C> class TaggedASTType : public CompilerType {
+public:
+ TaggedASTType(const CompilerType &compiler_type)
+ : CompilerType(compiler_type) {}
+
+ TaggedASTType(lldb::opaque_compiler_type_t type, TypeSystem *type_system)
+ : CompilerType(type_system, type) {}
+
+ TaggedASTType(const TaggedASTType<C> &tw) : CompilerType(tw) {}
+
+ TaggedASTType() : CompilerType() {}
+
+ virtual ~TaggedASTType() {}
+
+ TaggedASTType<C> &operator=(const TaggedASTType<C> &tw) {
+ CompilerType::operator=(tw);
+ return *this;
+ }
+};
+
+// Commonly-used tagged types, so code using them is interoperable
+typedef TaggedASTType<0> TypeFromParser;
+typedef TaggedASTType<1> TypeFromUser;
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Symbol/Type.h b/linux-x64/clang/include/lldb/Symbol/Type.h
new file mode 100644
index 0000000..efc9bf0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Type.h
@@ -0,0 +1,522 @@
+//===-- Type.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Type_h_
+#define liblldb_Type_h_
+
+#include "lldb/Core/ClangForward.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"
+
+#include <set>
+
+namespace lldb_private {
+// CompilerContext allows an array of these items to be passed to perform
+// detailed lookups in SymbolVendor and SymbolFile functions.
+struct CompilerContext {
+ CompilerContext(CompilerContextKind t, ConstString n)
+ : type(t), name(n) {}
+
+ bool operator==(const CompilerContext &rhs) const {
+ return type == rhs.type && name == rhs.name;
+ }
+
+ void Dump() const;
+
+ CompilerContextKind type;
+ ConstString name;
+};
+
+class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
+ public UserID {
+public:
+ SymbolFileType(SymbolFile &symbol_file, lldb::user_id_t uid)
+ : UserID(uid), m_symbol_file(symbol_file) {}
+
+ SymbolFileType(SymbolFile &symbol_file, const lldb::TypeSP &type_sp);
+
+ ~SymbolFileType() {}
+
+ Type *operator->() { return GetType(); }
+
+ Type *GetType();
+
+protected:
+ SymbolFile &m_symbol_file;
+ lldb::TypeSP m_type_sp;
+};
+
+class Type : public std::enable_shared_from_this<Type>, public UserID {
+public:
+ enum EncodingDataType {
+ eEncodingInvalid,
+ eEncodingIsUID, ///< This type is the type whose UID is m_encoding_uid
+ eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
+ /// with the const qualifier added
+ eEncodingIsRestrictUID, ///< This type is the type whose UID is
+ /// m_encoding_uid with the restrict qualifier added
+ eEncodingIsVolatileUID, ///< This type is the type whose UID is
+ /// m_encoding_uid with the volatile qualifier added
+ eEncodingIsTypedefUID, ///< This type is pointer to a type whose UID is
+ /// m_encoding_uid
+ eEncodingIsPointerUID, ///< This type is pointer to a type whose UID is
+ /// m_encoding_uid
+ eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type
+ /// whose UID is m_encoding_uid
+ eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type
+ /// whose UID is m_encoding_uid
+ eEncodingIsSyntheticUID
+ };
+
+ // We must force the underlying type of the enum to be unsigned here. Not
+ // all compilers behave the same with regards to the default underlying type
+ // of an enum, but because this enum is used in an enum bitfield and integer
+ // comparisons are done with the value we need to guarantee that it's always
+ // unsigned so that, for example, eResolveStateFull doesn't compare less than
+ // eResolveStateUnresolved when used in a 2-bit bitfield.
+ typedef enum ResolveStateTag : unsigned {
+ eResolveStateUnresolved = 0,
+ eResolveStateForward = 1,
+ eResolveStateLayout = 2,
+ eResolveStateFull = 3
+ } ResolveState;
+
+ Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
+ llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
+ lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type,
+ const Declaration &decl, const CompilerType &compiler_qual_type,
+ ResolveState compiler_type_resolve_state);
+
+ // This makes an invalid type. Used for functions that return a Type when
+ // they get an error.
+ Type();
+
+ void Dump(Stream *s, bool show_context);
+
+ void DumpTypeName(Stream *s);
+
+ // Since Type instances only keep a "SymbolFile *" internally, other classes
+ // like TypeImpl need make sure the module is still around before playing
+ // with
+ // Type instances. They can store a weak pointer to the Module;
+ lldb::ModuleSP GetModule();
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name);
+
+ SymbolFile *GetSymbolFile() { return m_symbol_file; }
+ const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
+
+ TypeList *GetTypeList();
+
+ ConstString GetName();
+
+ llvm::Optional<uint64_t> GetByteSize();
+
+ uint32_t GetNumChildren(bool omit_empty_base_classes);
+
+ bool IsAggregateType();
+
+ bool IsValidType() { return m_encoding_uid_type != eEncodingInvalid; }
+
+ bool IsTypedef() { return m_encoding_uid_type == eEncodingIsTypedefUID; }
+
+ lldb::TypeSP GetTypedefType();
+
+ ConstString GetName() const { return m_name; }
+
+ ConstString GetQualifiedName();
+
+ void DumpValue(ExecutionContext *exe_ctx, Stream *s,
+ const DataExtractor &data, uint32_t data_offset,
+ bool show_type, bool show_summary, bool verbose,
+ lldb::Format format = lldb::eFormatDefault);
+
+ bool DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s,
+ lldb::addr_t address, AddressType address_type,
+ bool show_types, bool show_summary, bool verbose);
+
+ bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address,
+ AddressType address_type, DataExtractor &data);
+
+ bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address,
+ AddressType address_type, DataExtractor &data);
+
+ bool GetIsDeclaration() const;
+
+ void SetIsDeclaration(bool b);
+
+ bool GetIsExternal() const;
+
+ void SetIsExternal(bool b);
+
+ lldb::Format GetFormat();
+
+ lldb::Encoding GetEncoding(uint64_t &count);
+
+ SymbolContextScope *GetSymbolContextScope() { return m_context; }
+ const SymbolContextScope *GetSymbolContextScope() const { return m_context; }
+ void SetSymbolContextScope(SymbolContextScope *context) {
+ m_context = context;
+ }
+
+ const lldb_private::Declaration &GetDeclaration() const;
+
+ // Get the clang type, and resolve definitions for any
+ // class/struct/union/enum types completely.
+ CompilerType GetFullCompilerType();
+
+ // Get the clang type, and resolve definitions enough so that the type could
+ // have layout performed. This allows ptrs and refs to
+ // class/struct/union/enum types remain forward declarations.
+ CompilerType GetLayoutCompilerType();
+
+ // Get the clang type and leave class/struct/union/enum types as forward
+ // declarations if they haven't already been fully defined.
+ CompilerType GetForwardCompilerType();
+
+ static int Compare(const Type &a, const Type &b);
+
+ // From a fully qualified typename, split the type into the type basename and
+ // the remaining type scope (namespaces/classes).
+ static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+ llvm::StringRef &scope,
+ llvm::StringRef &basename,
+ lldb::TypeClass &type_class);
+ void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; }
+
+ uint32_t GetEncodingMask();
+
+ bool IsCompleteObjCClass() { return m_flags.is_complete_objc_class; }
+
+ void SetIsCompleteObjCClass(bool is_complete_objc_class) {
+ m_flags.is_complete_objc_class = is_complete_objc_class;
+ }
+
+protected:
+ ConstString m_name;
+ SymbolFile *m_symbol_file;
+ SymbolContextScope
+ *m_context; // The symbol context in which this type is defined
+ Type *m_encoding_type;
+ lldb::user_id_t m_encoding_uid;
+ EncodingDataType m_encoding_uid_type;
+ uint64_t m_byte_size : 63;
+ uint64_t m_byte_size_has_value : 1;
+ Declaration m_decl;
+ CompilerType m_compiler_type;
+
+ struct Flags {
+#ifdef __GNUC__
+ // using unsigned type here to work around a very noisy gcc warning
+ unsigned compiler_type_resolve_state : 2;
+#else
+ ResolveState compiler_type_resolve_state : 2;
+#endif
+ bool is_complete_objc_class : 1;
+ } m_flags;
+
+ Type *GetEncodingType();
+
+ bool ResolveClangType(ResolveState compiler_type_resolve_state);
+};
+
+// the two classes here are used by the public API as a backend to the SBType
+// and SBTypeList classes
+
+class TypeImpl {
+public:
+ TypeImpl() = default;
+
+ ~TypeImpl() {}
+
+ TypeImpl(const lldb::TypeSP &type_sp);
+
+ TypeImpl(const CompilerType &compiler_type);
+
+ TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic);
+
+ TypeImpl(const CompilerType &compiler_type, const CompilerType &dynamic);
+
+ void SetType(const lldb::TypeSP &type_sp);
+
+ void SetType(const CompilerType &compiler_type);
+
+ void SetType(const lldb::TypeSP &type_sp, const CompilerType &dynamic);
+
+ void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+
+ bool operator==(const TypeImpl &rhs) const;
+
+ bool operator!=(const TypeImpl &rhs) const;
+
+ bool IsValid() const;
+
+ explicit operator bool() const;
+
+ void Clear();
+
+ ConstString GetName() const;
+
+ ConstString GetDisplayTypeName() const;
+
+ TypeImpl GetPointerType() const;
+
+ TypeImpl GetPointeeType() const;
+
+ TypeImpl GetReferenceType() const;
+
+ TypeImpl GetTypedefedType() const;
+
+ TypeImpl GetDereferencedType() const;
+
+ TypeImpl GetUnqualifiedType() const;
+
+ TypeImpl GetCanonicalType() const;
+
+ CompilerType GetCompilerType(bool prefer_dynamic);
+
+ TypeSystem *GetTypeSystem(bool prefer_dynamic);
+
+ bool GetDescription(lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level);
+
+private:
+ bool CheckModule(lldb::ModuleSP &module_sp) const;
+
+ lldb::ModuleWP m_module_wp;
+ CompilerType m_static_type;
+ CompilerType m_dynamic_type;
+};
+
+class TypeListImpl {
+public:
+ TypeListImpl() : m_content() {}
+
+ void Append(const lldb::TypeImplSP &type) { m_content.push_back(type); }
+
+ class AppendVisitor {
+ public:
+ AppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
+
+ void operator()(const lldb::TypeImplSP &type) { m_type_list.Append(type); }
+
+ private:
+ TypeListImpl &m_type_list;
+ };
+
+ void Append(const lldb_private::TypeList &type_list);
+
+ lldb::TypeImplSP GetTypeAtIndex(size_t idx) {
+ lldb::TypeImplSP type_sp;
+ if (idx < GetSize())
+ type_sp = m_content[idx];
+ return type_sp;
+ }
+
+ size_t GetSize() { return m_content.size(); }
+
+private:
+ std::vector<lldb::TypeImplSP> m_content;
+};
+
+class TypeMemberImpl {
+public:
+ TypeMemberImpl()
+ : m_type_impl_sp(), m_bit_offset(0), m_name(), m_bitfield_bit_size(0),
+ m_is_bitfield(false)
+
+ {}
+
+ TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset,
+ ConstString name, uint32_t bitfield_bit_size = 0,
+ bool is_bitfield = false)
+ : m_type_impl_sp(type_impl_sp), m_bit_offset(bit_offset), m_name(name),
+ m_bitfield_bit_size(bitfield_bit_size), m_is_bitfield(is_bitfield) {}
+
+ TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset)
+ : m_type_impl_sp(type_impl_sp), m_bit_offset(bit_offset), m_name(),
+ m_bitfield_bit_size(0), m_is_bitfield(false) {
+ if (m_type_impl_sp)
+ m_name = m_type_impl_sp->GetName();
+ }
+
+ const lldb::TypeImplSP &GetTypeImpl() { return m_type_impl_sp; }
+
+ ConstString GetName() const { return m_name; }
+
+ uint64_t GetBitOffset() const { return m_bit_offset; }
+
+ uint32_t GetBitfieldBitSize() const { return m_bitfield_bit_size; }
+
+ void SetBitfieldBitSize(uint32_t bitfield_bit_size) {
+ m_bitfield_bit_size = bitfield_bit_size;
+ }
+
+ bool GetIsBitfield() const { return m_is_bitfield; }
+
+ void SetIsBitfield(bool is_bitfield) { m_is_bitfield = is_bitfield; }
+
+protected:
+ lldb::TypeImplSP m_type_impl_sp;
+ uint64_t m_bit_offset;
+ ConstString m_name;
+ uint32_t m_bitfield_bit_size; // Bit size for bitfield members only
+ bool m_is_bitfield;
+};
+
+///
+/// Sometimes you can find the name of the type corresponding to an object, but
+/// we don't have debug
+/// information for it. If that is the case, you can return one of these
+/// objects, and then if it
+/// has a full type, you can use that, but if not at least you can print the
+/// name for informational
+/// purposes.
+///
+
+class TypeAndOrName {
+public:
+ TypeAndOrName() = default;
+ TypeAndOrName(lldb::TypeSP &type_sp);
+ TypeAndOrName(const CompilerType &compiler_type);
+ TypeAndOrName(const char *type_str);
+ TypeAndOrName(ConstString &type_const_string);
+
+ bool operator==(const TypeAndOrName &other) const;
+
+ bool operator!=(const TypeAndOrName &other) const;
+
+ ConstString GetName() const;
+
+ CompilerType GetCompilerType() const { return m_compiler_type; }
+
+ void SetName(ConstString type_name);
+
+ void SetName(const char *type_name_cstr);
+
+ void SetTypeSP(lldb::TypeSP type_sp);
+
+ void SetCompilerType(CompilerType compiler_type);
+
+ bool IsEmpty() const;
+
+ bool HasName() const;
+
+ bool HasCompilerType() const;
+
+ bool HasType() const { return HasCompilerType(); }
+
+ void Clear();
+
+ explicit operator bool() { return !IsEmpty(); }
+
+private:
+ CompilerType m_compiler_type;
+ ConstString m_type_name;
+};
+
+class TypeMemberFunctionImpl {
+public:
+ TypeMemberFunctionImpl()
+ : m_type(), m_decl(), m_name(), m_kind(lldb::eMemberFunctionKindUnknown) {
+ }
+
+ TypeMemberFunctionImpl(const CompilerType &type, const CompilerDecl &decl,
+ const std::string &name,
+ const lldb::MemberFunctionKind &kind)
+ : m_type(type), m_decl(decl), m_name(name), m_kind(kind) {}
+
+ bool IsValid();
+
+ ConstString GetName() const;
+
+ ConstString GetMangledName() const;
+
+ CompilerType GetType() const;
+
+ CompilerType GetReturnType() const;
+
+ size_t GetNumArguments() const;
+
+ CompilerType GetArgumentAtIndex(size_t idx) const;
+
+ lldb::MemberFunctionKind GetKind() const;
+
+ bool GetDescription(Stream &stream);
+
+protected:
+ std::string GetPrintableTypeName();
+
+private:
+ CompilerType m_type;
+ CompilerDecl m_decl;
+ ConstString m_name;
+ lldb::MemberFunctionKind m_kind;
+};
+
+class TypeEnumMemberImpl {
+public:
+ TypeEnumMemberImpl()
+ : m_integer_type_sp(), m_name("<invalid>"), m_value(), m_valid(false) {}
+
+ TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
+ ConstString name, const llvm::APSInt &value);
+
+ TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs) = default;
+
+ TypeEnumMemberImpl &operator=(const TypeEnumMemberImpl &rhs);
+
+ bool IsValid() { return m_valid; }
+
+ ConstString GetName() const { return m_name; }
+
+ const lldb::TypeImplSP &GetIntegerType() const { return m_integer_type_sp; }
+
+ uint64_t GetValueAsUnsigned() const { return m_value.getZExtValue(); }
+
+ int64_t GetValueAsSigned() const { return m_value.getSExtValue(); }
+
+protected:
+ lldb::TypeImplSP m_integer_type_sp;
+ ConstString m_name;
+ llvm::APSInt m_value;
+ bool m_valid;
+};
+
+class TypeEnumMemberListImpl {
+public:
+ TypeEnumMemberListImpl() : m_content() {}
+
+ void Append(const lldb::TypeEnumMemberImplSP &type) {
+ m_content.push_back(type);
+ }
+
+ void Append(const lldb_private::TypeEnumMemberListImpl &type_list);
+
+ lldb::TypeEnumMemberImplSP GetTypeEnumMemberAtIndex(size_t idx) {
+ lldb::TypeEnumMemberImplSP enum_member;
+ if (idx < GetSize())
+ enum_member = m_content[idx];
+ return enum_member;
+ }
+
+ size_t GetSize() { return m_content.size(); }
+
+private:
+ std::vector<lldb::TypeEnumMemberImplSP> m_content;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Type_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeList.h b/linux-x64/clang/include/lldb/Symbol/TypeList.h
new file mode 100644
index 0000000..982f673
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/TypeList.h
@@ -0,0 +1,72 @@
+//===-- TypeList.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TypeList_h_
+#define liblldb_TypeList_h_
+
+#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+#include <functional>
+#include <vector>
+
+namespace lldb_private {
+
+class TypeList {
+public:
+ // Constructors and Destructors
+ TypeList();
+
+ virtual ~TypeList();
+
+ void Clear();
+
+ void Dump(Stream *s, bool show_context);
+
+ // lldb::TypeSP
+ // FindType(lldb::user_id_t uid);
+
+ TypeList FindTypes(ConstString name);
+
+ void Insert(const lldb::TypeSP &type);
+
+ uint32_t GetSize() const;
+
+ lldb::TypeSP GetTypeAtIndex(uint32_t idx);
+
+ typedef std::vector<lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter>
+ TypeIterable;
+
+ TypeIterable Types() { return TypeIterable(m_types); }
+
+ void ForEach(
+ std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
+
+ void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
+
+ void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
+
+ void RemoveMismatchedTypes(const std::string &type_scope,
+ const std::string &type_basename,
+ lldb::TypeClass type_class, bool exact_match);
+
+ void RemoveMismatchedTypes(lldb::TypeClass type_class);
+
+private:
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ collection m_types;
+
+ DISALLOW_COPY_AND_ASSIGN(TypeList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_TypeList_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeMap.h b/linux-x64/clang/include/lldb/Symbol/TypeMap.h
new file mode 100644
index 0000000..e7d2b25
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/TypeMap.h
@@ -0,0 +1,74 @@
+//===-- TypeMap.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TypeMap_h_
+#define liblldb_TypeMap_h_
+
+#include "lldb/Symbol/Type.h"
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+#include <functional>
+#include <map>
+
+namespace lldb_private {
+
+class TypeMap {
+public:
+ // Constructors and Destructors
+ TypeMap();
+
+ virtual ~TypeMap();
+
+ void Clear();
+
+ void Dump(Stream *s, bool show_context);
+
+ TypeMap FindTypes(ConstString name);
+
+ void Insert(const lldb::TypeSP &type);
+
+ bool Empty() const;
+
+ bool InsertUnique(const lldb::TypeSP &type);
+
+ uint32_t GetSize() const;
+
+ lldb::TypeSP GetTypeAtIndex(uint32_t idx);
+
+ typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
+
+ TypeIterable Types() { return TypeIterable(m_types); }
+
+ void ForEach(
+ std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
+
+ void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
+
+ bool Remove(const lldb::TypeSP &type_sp);
+
+ void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
+
+ void RemoveMismatchedTypes(const std::string &type_scope,
+ const std::string &type_basename,
+ lldb::TypeClass type_class, bool exact_match);
+
+ void RemoveMismatchedTypes(lldb::TypeClass type_class);
+
+private:
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ collection m_types;
+
+ DISALLOW_COPY_AND_ASSIGN(TypeMap);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_TypeMap_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeSystem.h b/linux-x64/clang/include/lldb/Symbol/TypeSystem.h
new file mode 100644
index 0000000..4bef2a4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/TypeSystem.h
@@ -0,0 +1,515 @@
+//===-- TypeSystem.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TypeSystem_h_
+#define liblldb_TypeSystem_h_
+
+#include <functional>
+#include <map>
+#include <mutex>
+#include <string>
+
+#include "llvm/ADT/APSInt.h"
+#include "llvm/Support/Casting.h"
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-private.h"
+
+class DWARFDIE;
+class DWARFASTParser;
+class PDBASTParser;
+
+namespace lldb_private {
+
+// Interface for representing the Type Systems in different languages.
+class TypeSystem : public PluginInterface {
+public:
+ // Intrusive type system that allows us to use llvm casting.
+ //
+ // To add a new type system:
+ //
+ // 1 - Add a new enumeration for llvm casting below for your TypeSystem
+ // subclass, here we will use eKindFoo
+ //
+ // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs
+ // to implement a static classof() function that returns your
+ // enumeration:
+ //
+ // class Foo : public lldb_private::TypeSystem
+ // {
+ // static bool classof(const TypeSystem *ts)
+ // {
+ // return ts->getKind() == TypeSystem::eKindFoo;
+ // }
+ // };
+ //
+ // 3 - Contruct your TypeSystem subclass with the enumeration from below
+ //
+ // Foo() :
+ // TypeSystem(TypeSystem::eKindFoo),
+ // ...
+ // {
+ // }
+ //
+ // Then you can use the llvm casting on any "TypeSystem *" to get an instance
+ // of your subclass.
+ enum LLVMCastKind {
+ eKindClang,
+ eKindSwift,
+ eKindOCaml,
+ kNumKinds
+ };
+
+ // Constructors and Destructors
+ TypeSystem(LLVMCastKind kind);
+
+ ~TypeSystem() override;
+
+ LLVMCastKind getKind() const { return m_kind; }
+
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module);
+
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Target *target);
+
+ // Free up any resources associated with this TypeSystem. Done before
+ // removing all the TypeSystems from the TypeSystemMap.
+ virtual void Finalize() {}
+
+ virtual DWARFASTParser *GetDWARFParser() { return nullptr; }
+ virtual PDBASTParser *GetPDBParser() { return nullptr; }
+
+ virtual SymbolFile *GetSymbolFile() const { return m_sym_file; }
+
+ // Returns true if the symbol file changed during the set accessor.
+ virtual void SetSymbolFile(SymbolFile *sym_file) { m_sym_file = sym_file; }
+
+ // CompilerDecl functions
+ virtual ConstString DeclGetName(void *opaque_decl) = 0;
+
+ virtual ConstString DeclGetMangledName(void *opaque_decl);
+
+ virtual CompilerDeclContext DeclGetDeclContext(void *opaque_decl);
+
+ virtual CompilerType DeclGetFunctionReturnType(void *opaque_decl);
+
+ virtual size_t DeclGetFunctionNumArguments(void *opaque_decl);
+
+ virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
+ size_t arg_idx);
+
+ // CompilerDeclContext functions
+
+ virtual std::vector<CompilerDecl>
+ DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
+ const bool ignore_imported_decls);
+
+ virtual bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) = 0;
+
+ virtual ConstString DeclContextGetName(void *opaque_decl_ctx) = 0;
+
+ virtual ConstString
+ DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) = 0;
+
+ virtual bool DeclContextIsClassMethod(
+ void *opaque_decl_ctx, lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr, ConstString *language_object_name_ptr) = 0;
+
+ virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
+ void *other_opaque_decl_ctx) = 0;
+
+ // Tests
+
+ virtual bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) = 0;
+
+ virtual bool IsAggregateType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsAnonymousType(lldb::opaque_compiler_type_t type);
+
+ virtual bool IsCharType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsCompleteType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsDefined(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type,
+ uint32_t &count, bool &is_complex) = 0;
+
+ virtual bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr) = 0;
+
+ virtual size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) = 0;
+
+ virtual bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) = 0;
+
+ virtual bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) = 0;
+
+ virtual bool IsEnumerationType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) {
+ is_signed = false;
+ return false;
+ }
+
+ virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass NULL
+ bool check_cplusplus, bool check_objc) = 0;
+
+ virtual bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) = 0;
+
+ virtual bool IsScalarType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsVoidType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool CanPassInRegisters(const CompilerType &type) = 0;
+
+ // TypeSystems can support more than one language
+ virtual bool SupportsLanguage(lldb::LanguageType language) = 0;
+
+ // Type Completion
+
+ virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0;
+
+ // AST related queries
+
+ virtual uint32_t GetPointerByteSize() = 0;
+
+ // Accessors
+
+ virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ GetTypeInfo(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type) = 0;
+
+ virtual lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) = 0;
+
+ // Creating related types
+
+ virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride) = 0;
+
+ virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
+ uint64_t size);
+
+ virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) = 0;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype Returns a value >= 0 if there is a prototype.
+ virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) = 0;
+
+ virtual CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) = 0;
+
+ virtual CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType GetPointerType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetLValueReferenceType(lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType
+ GetRValueReferenceType(lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type);
+
+ virtual CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
+ const char *name,
+ const CompilerDeclContext &decl_ctx);
+
+ // Exploring the type
+
+ virtual llvm::Optional<uint64_t>
+ GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) = 0;
+
+ virtual lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) = 0;
+
+ virtual lldb::Format GetFormat(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes,
+ const ExecutionContext *exe_ctx) = 0;
+
+ virtual CompilerType GetBuiltinTypeByName(ConstString name);
+
+ virtual lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual void ForEachEnumerator(
+ lldb::opaque_compiler_type_t type,
+ std::function<bool(const CompilerType &integer_type,
+ ConstString name,
+ const llvm::APSInt &value)> const &callback) {}
+
+ virtual uint32_t GetNumFields(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx, std::string &name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) = 0;
+
+ virtual uint32_t
+ GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t
+ GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ uint32_t *bit_offset_ptr) = 0;
+
+ virtual CompilerType
+ GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ uint32_t *bit_offset_ptr) = 0;
+
+ virtual CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) = 0;
+
+ // Lookup a child given a name. This function will match base class names and
+ // member member names in "clang_type" only, not descendants.
+ virtual uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) = 0;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ virtual size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) = 0;
+
+ virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type);
+
+ virtual lldb::TemplateArgumentKind
+ GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx);
+ virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx);
+ virtual llvm::Optional<CompilerType::IntegralTemplateArgument>
+ GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx);
+
+ // Dumping types
+
+#ifndef NDEBUG
+ /// Convenience LLVM-style dump method for use in the debugger only.
+ LLVM_DUMP_METHOD virtual void
+ dump(lldb::opaque_compiler_type_t type) const = 0;
+#endif
+
+ virtual void DumpValue(lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, bool show_types,
+ bool show_summary, bool verbose, uint32_t depth) = 0;
+
+ virtual bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) = 0;
+
+ virtual void
+ DumpTypeDescription(lldb::opaque_compiler_type_t type) = 0; // Dump to stdout
+
+ virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) = 0;
+
+ // TODO: These methods appear unused. Should they be removed?
+
+ virtual bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual void DumpSummary(lldb::opaque_compiler_type_t type,
+ ExecutionContext *exe_ctx, Stream *s,
+ const DataExtractor &data,
+ lldb::offset_t data_offset,
+ size_t data_byte_size) = 0;
+
+ // Converts "s" to a floating point value and place resulting floating point
+ // bytes in the "dst" buffer.
+ virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) = 0;
+
+ // TODO: Determine if these methods should move to ClangASTContext.
+
+ virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) = 0;
+
+ virtual unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) = 0;
+
+ virtual size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
+
+ virtual CompilerType
+ GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) = 0;
+
+ virtual bool IsBeingDefined(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsConst(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) = 0;
+
+ virtual bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsTypedefType(lldb::opaque_compiler_type_t type) = 0;
+
+ // If the current object represents a typedef type, get the underlying type
+ virtual CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) = 0;
+
+ virtual CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual CompilerType
+ GetNonReferenceType(lldb::opaque_compiler_type_t type) = 0;
+
+ virtual bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type, bool *is_rvalue) = 0;
+
+ virtual bool
+ ShouldTreatScalarValueAsAddress(lldb::opaque_compiler_type_t type) {
+ return IsPointerOrReferenceType(type, nullptr);
+ }
+
+ virtual UserExpression *
+ GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ValueObject *ctx_obj) {
+ return nullptr;
+ }
+
+ virtual FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
+ const Address &function_address,
+ const ValueList &arg_value_list,
+ const char *name) {
+ return nullptr;
+ }
+
+ virtual UtilityFunction *GetUtilityFunction(const char *text,
+ const char *name) {
+ return nullptr;
+ }
+
+ virtual PersistentExpressionState *GetPersistentExpressionState() {
+ return nullptr;
+ }
+
+ virtual CompilerType GetTypeForFormatters(void *type);
+
+ virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj);
+
+ // Type systems can have types that are placeholder types, which are meant to
+ // indicate the presence of a type, but offer no actual information about
+ // said types, and leave the burden of actually figuring type information out
+ // to dynamic type resolution. For instance a language with a generics
+ // system, can use placeholder types to indicate "type argument goes here",
+ // without promising uniqueness of the placeholder, nor attaching any
+ // actually idenfiable information to said placeholder. This API allows type
+ // systems to tell LLDB when such a type has been encountered In response,
+ // the debugger can react by not using this type as a cache entry in any
+ // type-specific way For instance, LLDB will currently not cache any
+ // formatters that are discovered on such a type as attributable to the
+ // meaningless type itself, instead preferring to use the dynamic type
+ virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
+
+protected:
+ const LLVMCastKind m_kind; // Support for llvm casting
+ SymbolFile *m_sym_file;
+};
+
+class TypeSystemMap {
+public:
+ TypeSystemMap();
+ ~TypeSystemMap();
+
+ // Clear calls Finalize on all the TypeSystems managed by this map, and then
+ // empties the map.
+ void Clear();
+
+ // Iterate through all of the type systems that are created. Return true from
+ // callback to keep iterating, false to stop iterating.
+ void ForEach(std::function<bool(TypeSystem *)> const &callback);
+
+ TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
+ Module *module, bool can_create);
+
+ TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
+ Target *target, bool can_create);
+
+protected:
+ // This function does not take the map mutex, and should only be called from
+ // functions that do take the mutex.
+ void AddToMap(lldb::LanguageType language,
+ lldb::TypeSystemSP const &type_system_sp);
+
+ typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
+ mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
+ ///multi-threaded environments.
+ collection m_map;
+ bool m_clear_in_progress;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_TypeSystem_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h b/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h
new file mode 100644
index 0000000..2b49aca
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h
@@ -0,0 +1,516 @@
+//===-- UnwindPlan.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UnwindPlan_h
+#define liblldb_UnwindPlan_h
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// The UnwindPlan object specifies how to unwind out of a function - where this
+// function saves the caller's register values before modifying them (for non-
+// volatile aka saved registers) and how to find this frame's Canonical Frame
+// Address (CFA) or Aligned Frame Address (AFA).
+
+// CFA is a DWARF's Canonical Frame Address.
+// Most commonly, registers are saved on the stack, offset some bytes from the
+// Canonical Frame Address, or CFA, which is the starting address of this
+// function's stack frame (the CFA is same as the eh_frame's CFA, whatever that
+// may be on a given architecture). The CFA address for the stack frame does
+// not change during the lifetime of the function.
+
+// AFA is an artificially introduced Aligned Frame Address.
+// It is used only for stack frames with realignment (e.g. when some of the
+// locals has an alignment requirement higher than the stack alignment right
+// after the function call). It is used to access register values saved on the
+// stack after the realignment (and so they are inaccessible through the CFA).
+// AFA usually equals the stack pointer value right after the realignment.
+
+// Internally, the UnwindPlan is structured as a vector of register locations
+// organized by code address in the function, showing which registers have been
+// saved at that point and where they are saved. It can be thought of as the
+// expanded table form of the DWARF CFI encoded information.
+
+// Other unwind information sources will be converted into UnwindPlans before
+// being added to a FuncUnwinders object. The unwind source may be an eh_frame
+// FDE, a DWARF debug_frame FDE, or assembly language based prologue analysis.
+// The UnwindPlan is the canonical form of this information that the unwinder
+// code will use when walking the stack.
+
+class UnwindPlan {
+public:
+ class Row {
+ public:
+ class RegisterLocation {
+ public:
+ enum RestoreType {
+ unspecified, // not specified, we may be able to assume this
+ // is the same register. gcc doesn't specify all
+ // initial values so we really don't know...
+ undefined, // reg is not available, e.g. volatile reg
+ same, // reg is unchanged
+ atCFAPlusOffset, // reg = deref(CFA + offset)
+ isCFAPlusOffset, // reg = CFA + offset
+ atAFAPlusOffset, // reg = deref(AFA + offset)
+ isAFAPlusOffset, // reg = AFA + offset
+ inOtherRegister, // reg = other reg
+ atDWARFExpression, // reg = deref(eval(dwarf_expr))
+ isDWARFExpression // reg = eval(dwarf_expr)
+ };
+
+ RegisterLocation() : m_type(unspecified), m_location() {}
+
+ bool operator==(const RegisterLocation &rhs) const;
+
+ bool operator!=(const RegisterLocation &rhs) const {
+ return !(*this == rhs);
+ }
+
+ void SetUnspecified() { m_type = unspecified; }
+
+ void SetUndefined() { m_type = undefined; }
+
+ void SetSame() { m_type = same; }
+
+ bool IsSame() const { return m_type == same; }
+
+ bool IsUnspecified() const { return m_type == unspecified; }
+
+ bool IsUndefined() const { return m_type == undefined; }
+
+ bool IsCFAPlusOffset() const { return m_type == isCFAPlusOffset; }
+
+ bool IsAtCFAPlusOffset() const { return m_type == atCFAPlusOffset; }
+
+ bool IsAFAPlusOffset() const { return m_type == isAFAPlusOffset; }
+
+ bool IsAtAFAPlusOffset() const { return m_type == atAFAPlusOffset; }
+
+ bool IsInOtherRegister() const { return m_type == inOtherRegister; }
+
+ bool IsAtDWARFExpression() const { return m_type == atDWARFExpression; }
+
+ bool IsDWARFExpression() const { return m_type == isDWARFExpression; }
+
+ void SetAtCFAPlusOffset(int32_t offset) {
+ m_type = atCFAPlusOffset;
+ m_location.offset = offset;
+ }
+
+ void SetIsCFAPlusOffset(int32_t offset) {
+ m_type = isCFAPlusOffset;
+ m_location.offset = offset;
+ }
+
+ void SetAtAFAPlusOffset(int32_t offset) {
+ m_type = atAFAPlusOffset;
+ m_location.offset = offset;
+ }
+
+ void SetIsAFAPlusOffset(int32_t offset) {
+ m_type = isAFAPlusOffset;
+ m_location.offset = offset;
+ }
+
+ void SetInRegister(uint32_t reg_num) {
+ m_type = inOtherRegister;
+ m_location.reg_num = reg_num;
+ }
+
+ uint32_t GetRegisterNumber() const {
+ if (m_type == inOtherRegister)
+ return m_location.reg_num;
+ return LLDB_INVALID_REGNUM;
+ }
+
+ RestoreType GetLocationType() const { return m_type; }
+
+ int32_t GetOffset() const {
+ switch(m_type)
+ {
+ case atCFAPlusOffset:
+ case isCFAPlusOffset:
+ case atAFAPlusOffset:
+ case isAFAPlusOffset:
+ return m_location.offset;
+ default:
+ return 0;
+ }
+ }
+
+ void GetDWARFExpr(const uint8_t **opcodes, uint16_t &len) const {
+ if (m_type == atDWARFExpression || m_type == isDWARFExpression) {
+ *opcodes = m_location.expr.opcodes;
+ len = m_location.expr.length;
+ } else {
+ *opcodes = nullptr;
+ len = 0;
+ }
+ }
+
+ void SetAtDWARFExpression(const uint8_t *opcodes, uint32_t len);
+
+ void SetIsDWARFExpression(const uint8_t *opcodes, uint32_t len);
+
+ const uint8_t *GetDWARFExpressionBytes() {
+ if (m_type == atDWARFExpression || m_type == isDWARFExpression)
+ return m_location.expr.opcodes;
+ return nullptr;
+ }
+
+ int GetDWARFExpressionLength() {
+ if (m_type == atDWARFExpression || m_type == isDWARFExpression)
+ return m_location.expr.length;
+ return 0;
+ }
+
+ void Dump(Stream &s, const UnwindPlan *unwind_plan,
+ const UnwindPlan::Row *row, Thread *thread, bool verbose) const;
+
+ private:
+ RestoreType m_type; // How do we locate this register?
+ union {
+ // For m_type == atCFAPlusOffset or m_type == isCFAPlusOffset
+ int32_t offset;
+ // For m_type == inOtherRegister
+ uint32_t reg_num; // The register number
+ // For m_type == atDWARFExpression or m_type == isDWARFExpression
+ struct {
+ const uint8_t *opcodes;
+ uint16_t length;
+ } expr;
+ } m_location;
+ };
+
+ class FAValue {
+ public:
+ enum ValueType {
+ unspecified, // not specified
+ isRegisterPlusOffset, // FA = register + offset
+ isRegisterDereferenced, // FA = [reg]
+ isDWARFExpression // FA = eval(dwarf_expr)
+ };
+
+ FAValue() : m_type(unspecified), m_value() {}
+
+ bool operator==(const FAValue &rhs) const;
+
+ bool operator!=(const FAValue &rhs) const { return !(*this == rhs); }
+
+ void SetUnspecified() { m_type = unspecified; }
+
+ bool IsUnspecified() const { return m_type == unspecified; }
+
+ bool IsRegisterPlusOffset() const {
+ return m_type == isRegisterPlusOffset;
+ }
+
+ void SetIsRegisterPlusOffset(uint32_t reg_num, int32_t offset) {
+ m_type = isRegisterPlusOffset;
+ m_value.reg.reg_num = reg_num;
+ m_value.reg.offset = offset;
+ }
+
+ bool IsRegisterDereferenced() const {
+ return m_type == isRegisterDereferenced;
+ }
+
+ void SetIsRegisterDereferenced(uint32_t reg_num) {
+ m_type = isRegisterDereferenced;
+ m_value.reg.reg_num = reg_num;
+ }
+
+ bool IsDWARFExpression() const { return m_type == isDWARFExpression; }
+
+ void SetIsDWARFExpression(const uint8_t *opcodes, uint32_t len) {
+ m_type = isDWARFExpression;
+ m_value.expr.opcodes = opcodes;
+ m_value.expr.length = len;
+ }
+
+ uint32_t GetRegisterNumber() const {
+ if (m_type == isRegisterDereferenced || m_type == isRegisterPlusOffset)
+ return m_value.reg.reg_num;
+ return LLDB_INVALID_REGNUM;
+ }
+
+ ValueType GetValueType() const { return m_type; }
+
+ int32_t GetOffset() const {
+ if (m_type == isRegisterPlusOffset)
+ return m_value.reg.offset;
+ return 0;
+ }
+
+ void IncOffset(int32_t delta) {
+ if (m_type == isRegisterPlusOffset)
+ m_value.reg.offset += delta;
+ }
+
+ void SetOffset(int32_t offset) {
+ if (m_type == isRegisterPlusOffset)
+ m_value.reg.offset = offset;
+ }
+
+ void GetDWARFExpr(const uint8_t **opcodes, uint16_t &len) const {
+ if (m_type == isDWARFExpression) {
+ *opcodes = m_value.expr.opcodes;
+ len = m_value.expr.length;
+ } else {
+ *opcodes = nullptr;
+ len = 0;
+ }
+ }
+
+ const uint8_t *GetDWARFExpressionBytes() {
+ if (m_type == isDWARFExpression)
+ return m_value.expr.opcodes;
+ return nullptr;
+ }
+
+ int GetDWARFExpressionLength() {
+ if (m_type == isDWARFExpression)
+ return m_value.expr.length;
+ return 0;
+ }
+
+ void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread) const;
+
+ private:
+ ValueType m_type; // How do we compute CFA value?
+ union {
+ struct {
+ // For m_type == isRegisterPlusOffset or m_type ==
+ // isRegisterDereferenced
+ uint32_t reg_num; // The register number
+ // For m_type == isRegisterPlusOffset
+ int32_t offset;
+ } reg;
+ // For m_type == isDWARFExpression
+ struct {
+ const uint8_t *opcodes;
+ uint16_t length;
+ } expr;
+ } m_value;
+ }; // class FAValue
+
+ public:
+ Row();
+
+ Row(const UnwindPlan::Row &rhs) = default;
+
+ bool operator==(const Row &rhs) const;
+
+ bool GetRegisterInfo(uint32_t reg_num,
+ RegisterLocation ®ister_location) const;
+
+ void SetRegisterInfo(uint32_t reg_num,
+ const RegisterLocation register_location);
+
+ void RemoveRegisterInfo(uint32_t reg_num);
+
+ lldb::addr_t GetOffset() const { return m_offset; }
+
+ void SetOffset(lldb::addr_t offset) { m_offset = offset; }
+
+ void SlideOffset(lldb::addr_t offset) { m_offset += offset; }
+
+ FAValue &GetCFAValue() { return m_cfa_value; }
+
+ FAValue &GetAFAValue() { return m_afa_value; }
+
+ bool SetRegisterLocationToAtCFAPlusOffset(uint32_t reg_num, int32_t offset,
+ bool can_replace);
+
+ bool SetRegisterLocationToIsCFAPlusOffset(uint32_t reg_num, int32_t offset,
+ bool can_replace);
+
+ bool SetRegisterLocationToUndefined(uint32_t reg_num, bool can_replace,
+ bool can_replace_only_if_unspecified);
+
+ bool SetRegisterLocationToUnspecified(uint32_t reg_num, bool can_replace);
+
+ bool SetRegisterLocationToRegister(uint32_t reg_num, uint32_t other_reg_num,
+ bool can_replace);
+
+ bool SetRegisterLocationToSame(uint32_t reg_num, bool must_replace);
+
+ void Clear();
+
+ void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread,
+ lldb::addr_t base_addr) const;
+
+ protected:
+ typedef std::map<uint32_t, RegisterLocation> collection;
+ lldb::addr_t m_offset; // Offset into the function for this row
+
+ FAValue m_cfa_value;
+ FAValue m_afa_value;
+ collection m_register_locations;
+ }; // class Row
+
+public:
+ typedef std::shared_ptr<Row> RowSP;
+
+ UnwindPlan(lldb::RegisterKind reg_kind)
+ : m_row_list(), m_plan_valid_address_range(), m_register_kind(reg_kind),
+ m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
+ m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
+ m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
+ m_lsda_address(), m_personality_func_addr() {}
+
+ // Performs a deep copy of the plan, including all the rows (expensive).
+ UnwindPlan(const UnwindPlan &rhs)
+ : m_plan_valid_address_range(rhs.m_plan_valid_address_range),
+ m_register_kind(rhs.m_register_kind),
+ m_return_addr_register(rhs.m_return_addr_register),
+ m_source_name(rhs.m_source_name),
+ m_plan_is_sourced_from_compiler(rhs.m_plan_is_sourced_from_compiler),
+ m_plan_is_valid_at_all_instruction_locations(
+ rhs.m_plan_is_valid_at_all_instruction_locations),
+ m_lsda_address(rhs.m_lsda_address),
+ m_personality_func_addr(rhs.m_personality_func_addr) {
+ m_row_list.reserve(rhs.m_row_list.size());
+ for (const RowSP &row_sp : rhs.m_row_list)
+ m_row_list.emplace_back(new Row(*row_sp));
+ }
+
+ ~UnwindPlan() = default;
+
+ void Dump(Stream &s, Thread *thread, lldb::addr_t base_addr) const;
+
+ void AppendRow(const RowSP &row_sp);
+
+ void InsertRow(const RowSP &row_sp, bool replace_existing = false);
+
+ // Returns a pointer to the best row for the given offset into the function's
+ // instructions. If offset is -1 it indicates that the function start is
+ // unknown - the final row in the UnwindPlan is returned. In practice, the
+ // UnwindPlan for a function with no known start address will be the
+ // architectural default UnwindPlan which will only have one row.
+ UnwindPlan::RowSP GetRowForFunctionOffset(int offset) const;
+
+ lldb::RegisterKind GetRegisterKind() const { return m_register_kind; }
+
+ void SetRegisterKind(lldb::RegisterKind kind) { m_register_kind = kind; }
+
+ void SetReturnAddressRegister(uint32_t regnum) {
+ m_return_addr_register = regnum;
+ }
+
+ uint32_t GetReturnAddressRegister(void) { return m_return_addr_register; }
+
+ uint32_t GetInitialCFARegister() const {
+ if (m_row_list.empty())
+ return LLDB_INVALID_REGNUM;
+ return m_row_list.front()->GetCFAValue().GetRegisterNumber();
+ }
+
+ // This UnwindPlan may not be valid at every address of the function span.
+ // For instance, a FastUnwindPlan will not be valid at the prologue setup
+ // instructions - only in the body of the function.
+ void SetPlanValidAddressRange(const AddressRange &range);
+
+ const AddressRange &GetAddressRange() const {
+ return m_plan_valid_address_range;
+ }
+
+ bool PlanValidAtAddress(Address addr);
+
+ bool IsValidRowIndex(uint32_t idx) const;
+
+ const UnwindPlan::RowSP GetRowAtIndex(uint32_t idx) const;
+
+ const UnwindPlan::RowSP GetLastRow() const;
+
+ lldb_private::ConstString GetSourceName() const;
+
+ void SetSourceName(const char *);
+
+ // Was this UnwindPlan emitted by a compiler?
+ lldb_private::LazyBool GetSourcedFromCompiler() const {
+ return m_plan_is_sourced_from_compiler;
+ }
+
+ // Was this UnwindPlan emitted by a compiler?
+ void SetSourcedFromCompiler(lldb_private::LazyBool from_compiler) {
+ m_plan_is_sourced_from_compiler = from_compiler;
+ }
+
+ // Is this UnwindPlan valid at all instructions? If not, then it is assumed
+ // valid at call sites, e.g. for exception handling.
+ lldb_private::LazyBool GetUnwindPlanValidAtAllInstructions() const {
+ return m_plan_is_valid_at_all_instruction_locations;
+ }
+
+ // Is this UnwindPlan valid at all instructions? If not, then it is assumed
+ // valid at call sites, e.g. for exception handling.
+ void SetUnwindPlanValidAtAllInstructions(
+ lldb_private::LazyBool valid_at_all_insn) {
+ m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn;
+ }
+
+ int GetRowCount() const;
+
+ void Clear() {
+ m_row_list.clear();
+ m_plan_valid_address_range.Clear();
+ m_register_kind = lldb::eRegisterKindDWARF;
+ m_source_name.Clear();
+ m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
+ m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
+ m_lsda_address.Clear();
+ m_personality_func_addr.Clear();
+ }
+
+ const RegisterInfo *GetRegisterInfo(Thread *thread, uint32_t reg_num) const;
+
+ Address GetLSDAAddress() const { return m_lsda_address; }
+
+ void SetLSDAAddress(Address lsda_addr) { m_lsda_address = lsda_addr; }
+
+ Address GetPersonalityFunctionPtr() const { return m_personality_func_addr; }
+
+ void SetPersonalityFunctionPtr(Address presonality_func_ptr) {
+ m_personality_func_addr = presonality_func_ptr;
+ }
+
+private:
+ typedef std::vector<RowSP> collection;
+ collection m_row_list;
+ AddressRange m_plan_valid_address_range;
+ lldb::RegisterKind m_register_kind; // The RegisterKind these register numbers
+ // are in terms of - will need to be
+ // translated to lldb native reg nums at unwind time
+ uint32_t m_return_addr_register; // The register that has the return address
+ // for the caller frame
+ // e.g. the lr on arm
+ lldb_private::ConstString
+ m_source_name; // for logging, where this UnwindPlan originated from
+ lldb_private::LazyBool m_plan_is_sourced_from_compiler;
+ lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
+
+ Address m_lsda_address; // Where the language specific data area exists in the
+ // module - used
+ // in exception handling.
+ Address m_personality_func_addr; // The address of a pointer to the
+ // personality function - used in
+ // exception handling.
+}; // class UnwindPlan
+
+} // namespace lldb_private
+
+#endif // liblldb_UnwindPlan_h
diff --git a/linux-x64/clang/include/lldb/Symbol/UnwindTable.h b/linux-x64/clang/include/lldb/Symbol/UnwindTable.h
new file mode 100644
index 0000000..b4d7f06
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/UnwindTable.h
@@ -0,0 +1,84 @@
+//===-- UnwindTable.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UnwindTable_h
+#define liblldb_UnwindTable_h
+
+#include <map>
+#include <mutex>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// A class which holds all the FuncUnwinders objects for a given ObjectFile.
+// The UnwindTable is populated with FuncUnwinders objects lazily during the
+// debug session.
+
+class UnwindTable {
+public:
+ /// Create an Unwind table using the data in the given module.
+ explicit UnwindTable(Module &module);
+
+ ~UnwindTable();
+
+ lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
+ lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
+
+ lldb_private::CompactUnwindInfo *GetCompactUnwindInfo();
+
+ ArmUnwindInfo *GetArmUnwindInfo();
+ SymbolFile *GetSymbolFile();
+
+ lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr,
+ SymbolContext &sc);
+
+ bool GetAllowAssemblyEmulationUnwindPlans();
+
+ // Normally when we create a new FuncUnwinders object we track it in this
+ // UnwindTable so it can be reused later. But for the target modules show-
+ // unwind we want to create brand new UnwindPlans for the function of
+ // interest - so ignore any existing FuncUnwinders for that function and
+ // don't add this new one to our UnwindTable. This FuncUnwinders object does
+ // have a reference to the UnwindTable but the lifetime of this uncached
+ // FuncUnwinders is expected to be short so in practice this will not be a
+ // problem.
+ lldb::FuncUnwindersSP
+ GetUncachedFuncUnwindersContainingAddress(const Address &addr,
+ SymbolContext &sc);
+
+ ArchSpec GetArchitecture();
+
+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;
+ typedef collection::const_iterator const_iterator;
+
+ Module &m_module;
+ collection m_unwinds;
+
+ bool m_initialized; // delay some initialization until ObjectFile is set up
+ 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;
+
+ DISALLOW_COPY_AND_ASSIGN(UnwindTable);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_UnwindTable_h
diff --git a/linux-x64/clang/include/lldb/Symbol/Variable.h b/linux-x64/clang/include/lldb/Symbol/Variable.h
new file mode 100644
index 0000000..12daecf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/Variable.h
@@ -0,0 +1,137 @@
+//===-- Variable.h -----------------------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Variable_h_
+#define liblldb_Variable_h_
+
+#include "lldb/Core/Mangled.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Symbol/Declaration.h"
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private.h"
+#include <memory>
+#include <vector>
+
+namespace lldb_private {
+
+class Variable : public UserID, public std::enable_shared_from_this<Variable> {
+public:
+ typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
+
+ // Constructors and Destructors
+ Variable(lldb::user_id_t uid, const char *name,
+ const char
+ *mangled, // The mangled or fully qualified name of the variable.
+ const lldb::SymbolFileTypeSP &symfile_type_sp,
+ lldb::ValueType scope, SymbolContextScope *owner_scope,
+ const RangeList &scope_range, Declaration *decl,
+ const DWARFExpression &location, bool external, bool artificial,
+ bool static_member = false);
+
+ virtual ~Variable();
+
+ void Dump(Stream *s, bool show_context) const;
+
+ bool DumpDeclaration(Stream *s, bool show_fullpaths, bool show_module);
+
+ const Declaration &GetDeclaration() const { return m_declaration; }
+
+ ConstString GetName() const;
+
+ ConstString GetUnqualifiedName() const;
+
+ SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
+
+ // Since a variable can have a basename "i" and also a mangled named
+ // "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
+ // namespace)::i", this function will allow a generic match function that can
+ // be called by commands and expression parsers to make sure we match
+ // anything we come across.
+ bool NameMatches(ConstString name) const;
+
+ bool NameMatches(const RegularExpression ®ex) const;
+
+ Type *GetType();
+
+ lldb::LanguageType GetLanguage() const;
+
+ lldb::ValueType GetScope() const { return m_scope; }
+
+ bool IsExternal() const { return m_external; }
+
+ bool IsArtificial() const { return m_artificial; }
+
+ bool IsStaticMember() const { return m_static_member; }
+
+ DWARFExpression &LocationExpression() { return m_location; }
+
+ const DWARFExpression &LocationExpression() const { return m_location; }
+
+ bool DumpLocationForAddress(Stream *s, const Address &address);
+
+ size_t MemorySize() const;
+
+ void CalculateSymbolContext(SymbolContext *sc);
+
+ bool IsInScope(StackFrame *frame);
+
+ bool LocationIsValidForFrame(StackFrame *frame);
+
+ bool LocationIsValidForAddress(const Address &address);
+
+ bool GetLocationIsConstantValueData() const { return m_loc_is_const_data; }
+
+ void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; }
+
+ typedef size_t (*GetVariableCallback)(void *baton, const char *name,
+ VariableList &var_list);
+
+ static Status GetValuesForVariableExpressionPath(
+ llvm::StringRef variable_expr_path, ExecutionContextScope *scope,
+ GetVariableCallback callback, void *baton, VariableList &variable_list,
+ ValueObjectList &valobj_list);
+
+ static size_t AutoComplete(const ExecutionContext &exe_ctx,
+ CompletionRequest &request);
+
+ CompilerDeclContext GetDeclContext();
+
+ CompilerDecl GetDecl();
+
+protected:
+ ConstString m_name; // The basename of the variable (no namespaces)
+ Mangled m_mangled; // The mangled name of the variable
+ lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable
+ // (int, struct, class, etc)
+ lldb::ValueType m_scope; // global, parameter, local
+ SymbolContextScope
+ *m_owner_scope; // The symbol file scope that this variable was defined in
+ RangeList m_scope_range; // The list of ranges inside the owner's scope where
+ // this variable is valid
+ Declaration m_declaration; // Declaration location for this item.
+ DWARFExpression m_location; // The location of this variable that can be fed
+ // to DWARFExpression::Evaluate()
+ uint8_t m_external : 1, // Visible outside the containing compile unit?
+ m_artificial : 1, // Non-zero if the variable is not explicitly declared
+ // in source
+ m_loc_is_const_data : 1, // The m_location expression contains the
+ // constant variable value data, not a DWARF
+ // location
+ m_static_member : 1; // Non-zero if variable is static member of a class
+ // or struct.
+private:
+ Variable(const Variable &rhs) = delete;
+ Variable &operator=(const Variable &rhs) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Variable_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/VariableList.h b/linux-x64/clang/include/lldb/Symbol/VariableList.h
new file mode 100644
index 0000000..54d2758
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/VariableList.h
@@ -0,0 +1,82 @@
+//===-- VariableList.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VariableList_h_
+#define liblldb_VariableList_h_
+
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/Variable.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class VariableList {
+public:
+ // Constructors and Destructors
+ // VariableList(const SymbolContext &symbol_context);
+ VariableList();
+ virtual ~VariableList();
+
+ void AddVariable(const lldb::VariableSP &var_sp);
+
+ bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
+
+ void AddVariables(VariableList *variable_list);
+
+ void Clear();
+
+ void Dump(Stream *s, bool show_context) const;
+
+ lldb::VariableSP GetVariableAtIndex(size_t idx) const;
+
+ lldb::VariableSP RemoveVariableAtIndex(size_t idx);
+
+ lldb::VariableSP FindVariable(ConstString name,
+ bool include_static_members = true);
+
+ lldb::VariableSP FindVariable(ConstString name,
+ lldb::ValueType value_type,
+ bool include_static_members = true);
+
+ uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
+
+ size_t AppendVariablesIfUnique(VariableList &var_list);
+
+ // Returns the actual number of unique variables that were added to the list.
+ // "total_matches" will get updated with the actually number of matches that
+ // were found regardless of whether they were unique or not to allow for
+ // error conditions when nothing is found, versus conditions where any
+ // variables that match "regex" were already in "var_list".
+ size_t AppendVariablesIfUnique(const RegularExpression ®ex,
+ VariableList &var_list, size_t &total_matches);
+
+ size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
+ bool if_unique = true);
+
+ uint32_t FindIndexForVariable(Variable *variable);
+
+ size_t MemorySize() const;
+
+ size_t GetSize() const;
+ bool Empty() const { return m_variables.empty(); }
+
+protected:
+ typedef std::vector<lldb::VariableSP> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ collection m_variables;
+
+private:
+ // For VariableList only
+ DISALLOW_COPY_AND_ASSIGN(VariableList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_VariableList_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h b/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h
new file mode 100644
index 0000000..f412b94
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h
@@ -0,0 +1,18 @@
+//===-- VerifyDecl.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_VariableList_h_
+#define lldb_VariableList_h_
+
+#include "lldb/Core/ClangForward.h"
+
+namespace lldb_private {
+void VerifyDecl(clang::Decl *decl);
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Target/ABI.h b/linux-x64/clang/include/lldb/Target/ABI.h
new file mode 100644
index 0000000..f254839
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ABI.h
@@ -0,0 +1,153 @@
+//===-- ABI.h ---------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABI_h_
+#define liblldb_ABI_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"
+
+// forward define the llvm::Type class
+namespace llvm {
+class Type;
+}
+
+namespace lldb_private {
+
+class ABI : public PluginInterface {
+public:
+ struct CallArgument {
+ enum eType {
+ HostPointer = 0, /* pointer to host data */
+ TargetValue, /* value is on the target or literal */
+ };
+ eType type; /* value of eType */
+ size_t size; /* size in bytes of this argument */
+
+ lldb::addr_t value; /* literal value */
+ std::unique_ptr<uint8_t[]> data_up; /* host data pointer */
+ };
+
+ ~ABI() override;
+
+ virtual size_t GetRedZoneSize() const = 0;
+
+ virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress,
+ lldb::addr_t returnAddress,
+ llvm::ArrayRef<lldb::addr_t> args) const = 0;
+
+ // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
+ // AD:
+ // . Because i don't want to change other ABI's this is not declared pure
+ // virtual.
+ // The dummy implementation will simply fail. Only HexagonABI will
+ // currently
+ // use this method.
+ // . Two PrepareTrivialCall's is not good design so perhaps this should be
+ // combined.
+ //
+ virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+ lldb::addr_t functionAddress,
+ lldb::addr_t returnAddress,
+ llvm::Type &prototype,
+ llvm::ArrayRef<CallArgument> args) const;
+
+ virtual bool GetArgumentValues(Thread &thread, ValueList &values) const = 0;
+
+ lldb::ValueObjectSP GetReturnValueObject(Thread &thread, CompilerType &type,
+ bool persistent = true) const;
+
+ // specialized to work with llvm IR types
+ lldb::ValueObjectSP GetReturnValueObject(Thread &thread, llvm::Type &type,
+ bool persistent = true) const;
+
+ // Set the Return value object in the current frame as though a function with
+ 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
+ // value. Don't put it in a persistent value object, that will be done by the
+ // ABI::GetReturnValueObject.
+ virtual lldb::ValueObjectSP
+ GetReturnValueObjectImpl(Thread &thread, CompilerType &ast_type) const = 0;
+
+ // specialized to work with llvm IR types
+ 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;
+
+ virtual bool CreateDefaultUnwindPlan(UnwindPlan &unwind_plan) = 0;
+
+ virtual bool RegisterIsVolatile(const RegisterInfo *reg_info) = 0;
+
+ virtual bool
+ GetFallbackRegisterLocation(const RegisterInfo *reg_info,
+ UnwindPlan::Row::RegisterLocation &unwind_regloc);
+
+ // Should take a look at a call frame address (CFA) which is just the stack
+ // pointer value upon entry to a function. ABIs usually impose alignment
+ // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
+ // This function should return true if "cfa" is valid call frame address for
+ // the ABI, and false otherwise. This is used by the generic stack frame
+ // unwinding code to help determine when a stack ends.
+ virtual bool CallFrameAddressIsValid(lldb::addr_t cfa) = 0;
+
+ // Validates a possible PC value and returns true if an opcode can be at
+ // "pc".
+ virtual bool CodeAddressIsValid(lldb::addr_t pc) = 0;
+
+ virtual lldb::addr_t FixCodeAddress(lldb::addr_t pc) {
+ // Some targets might use bits in a code address to indicate a mode switch.
+ // ARM uses bit zero to signify a code address is thumb, so any ARM ABI
+ // plug-ins would strip those bits.
+ return pc;
+ }
+
+ virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
+
+ bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
+
+ bool GetRegisterInfoByKind(lldb::RegisterKind reg_kind, uint32_t reg_num,
+ RegisterInfo &info);
+
+ virtual bool GetPointerReturnRegister(const char *&name) { return false; }
+
+ static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch);
+
+protected:
+ // Classes that inherit from ABI can see and modify these
+ 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);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ABI_h_
diff --git a/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h b/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h
new file mode 100644
index 0000000..2852636
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h
@@ -0,0 +1,90 @@
+//===-- CPPLanguageRuntime.h
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CPPLanguageRuntime_h_
+#define liblldb_CPPLanguageRuntime_h_
+
+#include <vector>
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class CPPLanguageRuntime : public LanguageRuntime {
+public:
+ enum class LibCppStdFunctionCallableCase {
+ Lambda = 0,
+ CallableObject,
+ FreeOrMemberFunction,
+ Invalid
+ };
+
+ struct LibCppStdFunctionCallableInfo {
+ Symbol callable_symbol;
+ Address callable_address;
+ LineEntry callable_line_entry;
+ lldb::addr_t member__f_pointer_value = 0u;
+ LibCppStdFunctionCallableCase callable_case =
+ LibCppStdFunctionCallableCase::Invalid;
+ };
+
+ LibCppStdFunctionCallableInfo
+ FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
+
+ ~CPPLanguageRuntime() override;
+
+ static char ID;
+
+ bool isA(const void *ClassID) const override {
+ return ClassID == &ID || LanguageRuntime::isA(ClassID);
+ }
+
+ static bool classof(const LanguageRuntime *runtime) {
+ return runtime->isA(&ID);
+ }
+
+ lldb::LanguageType GetLanguageType() const override {
+ return lldb::eLanguageTypeC_plus_plus;
+ }
+
+ static CPPLanguageRuntime *Get(Process &process) {
+ return llvm::cast_or_null<CPPLanguageRuntime>(
+ process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));
+ }
+
+ bool GetObjectDescription(Stream &str, ValueObject &object) override;
+
+ bool GetObjectDescription(Stream &str, Value &value,
+ ExecutionContextScope *exe_scope) override;
+
+ /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
+ ///
+ /// \param[in] thread
+ /// Curent thrad of execution.
+ ///
+ /// \param[in] stop_others
+ /// True if other threads should pause during execution.
+ ///
+ /// \return
+ /// A ThreadPlan Shared pointer
+ lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+ bool stop_others) override;
+
+ bool IsWhitelistedRuntimeValue(ConstString name) override;
+protected:
+ // Classes that inherit from CPPLanguageRuntime can see and modify these
+ CPPLanguageRuntime(Process *process);
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CPPLanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/DynamicLoader.h b/linux-x64/clang/include/lldb/Target/DynamicLoader.h
new file mode 100644
index 0000000..2bf3f32
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/DynamicLoader.h
@@ -0,0 +1,322 @@
+//===-- DynamicLoader.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DynamicLoader_h_
+#define liblldb_DynamicLoader_h_
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/UUID.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+namespace lldb_private {
+class ModuleList;
+class Process;
+class SectionList;
+class Symbol;
+class SymbolContext;
+class SymbolContextList;
+class Thread;
+}
+
+namespace lldb_private {
+
+/// \class DynamicLoader DynamicLoader.h "lldb/Target/DynamicLoader.h"
+/// A plug-in interface definition class for dynamic loaders.
+///
+/// Dynamic loader plug-ins track image (shared library) loading and
+/// unloading. The class is initialized given a live process that is halted at
+/// its entry point or just after attaching.
+///
+/// Dynamic loader plug-ins can track the process by registering callbacks
+/// using the: Process::RegisterNotificationCallbacks (const Notifications&)
+/// function.
+///
+/// Breakpoints can also be set in the process which can register functions
+/// that get called using: Process::BreakpointSetCallback (lldb::user_id_t,
+/// BreakpointHitCallback, void *). These breakpoint callbacks return a
+/// boolean value that indicates if the process should continue or halt and
+/// should return the global setting for this using:
+/// DynamicLoader::StopWhenImagesChange() const.
+class DynamicLoader : public PluginInterface {
+public:
+ /// Find a dynamic loader plugin for a given process.
+ ///
+ /// Scans the installed DynamicLoader plug-ins and tries to find an instance
+ /// that can be used to track image changes in \a process.
+ ///
+ /// \param[in] process
+ /// The process for which to try and locate a dynamic loader
+ /// plug-in instance.
+ ///
+ /// \param[in] plugin_name
+ /// An optional name of a specific dynamic loader plug-in that
+ /// should be used. If NULL, pick the best plug-in.
+ static DynamicLoader *FindPlugin(Process *process, const char *plugin_name);
+
+ /// Construct with a process.
+ DynamicLoader(Process *process);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// from by the plug-in instance.
+ ~DynamicLoader() override;
+
+ /// Called after attaching a process.
+ ///
+ /// Allow DynamicLoader plug-ins to execute some code after attaching to a
+ /// process.
+ virtual void DidAttach() = 0;
+
+ /// Called after launching a process.
+ ///
+ /// Allow DynamicLoader plug-ins to execute some code after the process has
+ /// stopped for the first time on launch.
+ virtual void DidLaunch() = 0;
+
+ /// Helper function that can be used to detect when a process has called
+ /// exec and is now a new and different process. This can be called when
+ /// necessary to try and detect the exec. The process might be able to
+ /// answer this question, but sometimes it might not be able and the dynamic
+ /// loader often knows what the program entry point is. So the process and
+ /// the dynamic loader can work together to detect this.
+ virtual bool ProcessDidExec() { return false; }
+ /// Get whether the process should stop when images change.
+ ///
+ /// When images (executables and shared libraries) get loaded or unloaded,
+ /// often debug sessions will want to try and resolve or unresolve
+ /// breakpoints that are set in these images. Any breakpoints set by
+ /// DynamicLoader plug-in instances should return this value to ensure
+ /// consistent debug session behaviour.
+ ///
+ /// \return
+ /// Returns \b true if the process should stop when images
+ /// change, \b false if the process should resume.
+ bool GetStopWhenImagesChange() const;
+
+ /// Set whether the process should stop when images change.
+ ///
+ /// When images (executables and shared libraries) get loaded or unloaded,
+ /// often debug sessions will want to try and resolve or unresolve
+ /// breakpoints that are set in these images. The default is set so that the
+ /// process stops when images change, but this can be overridden using this
+ /// function callback.
+ ///
+ /// \param[in] stop
+ /// Boolean value that indicates whether the process should stop
+ /// when images change.
+ void SetStopWhenImagesChange(bool stop);
+
+ /// Provides a plan to step through the dynamic loader trampoline for the
+ /// current state of \a thread.
+ ///
+ ///
+ /// \param[in] stop_others
+ /// Whether the plan should be set to stop other threads.
+ ///
+ /// \return
+ /// A pointer to the plan (caller owned) or NULL if we are not at such
+ /// a trampoline.
+ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+ bool stop_others) = 0;
+
+ /// Some dynamic loaders provide features where there are a group of symbols
+ /// "equivalent to" a given symbol one of which will be chosen when the
+ /// symbol is bound. If you want to set a breakpoint on one of these
+ /// symbols, you really need to set it on all the equivalent symbols.
+ ///
+ ///
+ /// \param[in] original_symbol
+ /// The symbol for which we are finding equivalences.
+ ///
+ /// \param[in] module_list
+ /// The set of modules in which to search.
+ ///
+ /// \param[out] equivalent_symbols
+ /// The equivalent symbol list - any equivalent symbols found are appended
+ /// to this list.
+ ///
+ /// \return
+ /// Number of equivalent symbols found.
+ virtual size_t FindEquivalentSymbols(Symbol *original_symbol,
+ ModuleList &module_list,
+ SymbolContextList &equivalent_symbols) {
+ return 0;
+ }
+
+ /// Ask if it is ok to try and load or unload an shared library (image).
+ ///
+ /// The dynamic loader often knows when it would be ok to try and load or
+ /// unload a shared library. This function call allows the dynamic loader
+ /// plug-ins to check any current dyld state to make sure it is an ok time
+ /// to load a shared library.
+ ///
+ /// \return
+ /// \b true if it is currently ok to try and load a shared
+ /// library into the process, \b false otherwise.
+ virtual Status CanLoadImage() = 0;
+
+ /// Ask if the eh_frame information for the given SymbolContext should be
+ /// relied on even when it's the first frame in a stack unwind.
+ ///
+ /// The CFI instructions from the eh_frame section are normally only valid
+ /// at call sites -- places where a program could throw an exception and
+ /// need to unwind out. But some Modules may be known to the system as
+ /// having reliable eh_frame information at all call sites. This would be
+ /// the case if the Module's contents are largely hand-written assembly with
+ /// hand-written eh_frame information. Normally when unwinding from a
+ /// function at the beginning of a stack unwind lldb will examine the
+ /// assembly instructions to understand how the stack frame is set up and
+ /// where saved registers are stored. But with hand-written assembly this is
+ /// not reliable enough -- we need to consult those function's hand-written
+ /// eh_frame information.
+ ///
+ /// \return
+ /// \b True if the symbol context should use eh_frame instructions
+ /// unconditionally when unwinding from this frame. Else \b false,
+ /// the normal lldb unwind behavior of only using eh_frame when the
+ /// function appears in the middle of the stack.
+ virtual bool AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) {
+ return false;
+ }
+
+ /// Retrieves the per-module TLS block for a given thread.
+ ///
+ /// \param[in] module
+ /// The module to query TLS data for.
+ ///
+ /// \param[in] thread
+ /// The specific thread to query TLS data for.
+ ///
+ /// \return
+ /// If the given thread has TLS data allocated for the
+ /// module, the address of the TLS block. Otherwise
+ /// LLDB_INVALID_ADDRESS is returned.
+ virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module,
+ const lldb::ThreadSP thread,
+ lldb::addr_t tls_file_addr) {
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ /// Locates or creates a module given by \p file and updates/loads the
+ /// resulting module at the virtual base address \p base_addr.
+ virtual lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file,
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
+
+ /// Get information about the shared cache for a process, if possible.
+ ///
+ /// On some systems (e.g. Darwin based systems), a set of libraries that are
+ /// common to most processes may be put in a single region of memory and
+ /// mapped into every process, this is called the shared cache, as a
+ /// performance optimization.
+ ///
+ /// Many targets will not have the concept of a shared cache.
+ ///
+ /// Depending on how the DynamicLoader gathers information about the shared
+ /// cache, it may be able to only return basic information - like the UUID
+ /// of the cache - or it may be able to return additional information about
+ /// the cache.
+ ///
+ /// \param[out] base_address
+ /// The base address (load address) of the shared cache.
+ /// LLDB_INVALID_ADDRESS if it cannot be determined.
+ ///
+ /// \param[out] uuid
+ /// The UUID of the shared cache, if it can be determined.
+ /// If the UUID cannot be fetched, IsValid() will be false.
+ ///
+ /// \param[out] using_shared_cache
+ /// If this process is using a shared cache.
+ /// If unknown, eLazyBoolCalculate is returned.
+ ///
+ /// \param[out] private_shared_cache
+ /// A LazyBool indicating whether this process is using a
+ /// private shared cache.
+ /// If this information cannot be fetched, eLazyBoolCalculate.
+ ///
+ /// \return
+ /// Returns false if this DynamicLoader cannot gather information
+ /// about the shared cache / has no concept of a shared cache.
+ virtual bool GetSharedCacheInformation(lldb::addr_t &base_address, UUID &uuid,
+ LazyBool &using_shared_cache,
+ LazyBool &private_shared_cache) {
+ base_address = LLDB_INVALID_ADDRESS;
+ uuid.Clear();
+ using_shared_cache = eLazyBoolCalculate;
+ private_shared_cache = eLazyBoolCalculate;
+ return false;
+ }
+
+protected:
+ // Utility methods for derived classes
+
+ /// Checks to see if the target module has changed, updates the target
+ /// accordingly and returns the target executable module.
+ lldb::ModuleSP GetTargetExecutable();
+
+ /// Updates the load address of every allocatable section in \p module.
+ ///
+ /// \param module The module to traverse.
+ ///
+ /// \param link_map_addr The virtual address of the link map for the @p
+ /// module.
+ ///
+ /// \param base_addr The virtual base address \p module is loaded at.
+ virtual void UpdateLoadedSections(lldb::ModuleSP module,
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
+
+ // Utility method so base classes can share implementation of
+ // UpdateLoadedSections
+ void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr,
+ bool base_addr_is_offset);
+
+ /// Removes the loaded sections from the target in \p module.
+ ///
+ /// \param module The module to traverse.
+ virtual void UnloadSections(const lldb::ModuleSP module);
+
+ // Utility method so base classes can share implementation of UnloadSections
+ void UnloadSectionsCommon(const lldb::ModuleSP module);
+
+ const lldb_private::SectionList *
+ GetSectionListFromModule(const lldb::ModuleSP module) const;
+
+ // Read an unsigned int of the given size from memory at the given addr.
+ // Return -1 if the read fails, otherwise return the result as an int64_t.
+ int64_t ReadUnsignedIntWithSizeInBytes(lldb::addr_t addr, int size_in_bytes);
+
+ // 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.
+ Process
+ *m_process; ///< The process that this dynamic loader plug-in is tracking.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(DynamicLoader);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DynamicLoader_h_
diff --git a/linux-x64/clang/include/lldb/Target/ExecutionContext.h b/linux-x64/clang/include/lldb/Target/ExecutionContext.h
new file mode 100644
index 0000000..0819357
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ExecutionContext.h
@@ -0,0 +1,568 @@
+//===-- ExecutionContext.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExecutionContext_h_
+#define liblldb_ExecutionContext_h_
+
+#include <mutex>
+
+#include "lldb/Target/StackID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+//===----------------------------------------------------------------------===//
+/// Execution context objects refer to objects in the execution of the program
+/// that is being debugged. The consist of one or more of the following
+/// objects: target, process, thread, and frame. Many objects in the debugger
+/// need to track different executions contexts. For example, a local function
+/// variable might have an execution context that refers to a stack frame. A
+/// global or static variable might refer to a target since a stack frame
+/// isn't required in order to evaluate a global or static variable (a process
+/// isn't necessarily needed for a global variable since we might be able to
+/// read the variable value from a data section in one of the object files in
+/// a target). There are two types of objects that hold onto execution
+/// contexts: ExecutionContextRef and ExecutionContext. Both of these objects
+/// are described below.
+///
+/// Not all objects in an ExecutionContext objects will be valid. If you want
+/// to refer strongly (ExecutionContext) or weakly (ExecutionContextRef) to a
+/// process, then only the process and target references will be valid. For
+/// threads, only the thread, process and target references will be filled in.
+/// For frames, all of the objects will be filled in.
+///
+/// These classes are designed to be used as baton objects that get passed to
+/// a wide variety of functions that require execution contexts.
+//===----------------------------------------------------------------------===//
+
+/// \class ExecutionContextRef ExecutionContext.h
+/// "lldb/Target/ExecutionContext.h"
+/// A class that holds a weak reference to an execution context.
+///
+/// ExecutionContextRef objects are designed to hold onto an execution context
+/// that might change over time. For example, if an object wants to refer to a
+/// stack frame, it should hold onto an ExecutionContextRef to a frame object.
+/// The backing object that represents the stack frame might change over time
+/// and instances of this object can track the logical object that refers to a
+/// frame even if it does change.
+///
+/// These objects also don't keep execution objects around longer than they
+/// should since they use weak pointers. For example if an object refers to a
+/// stack frame and a stack frame is no longer in a thread, then a
+/// ExecutionContextRef object that refers to that frame will not be able to
+/// get a shared pointer to those objects since they are no longer around.
+///
+/// ExecutionContextRef objects can also be used as objects in classes that
+/// want to track a "previous execution context". Since the weak references to
+/// the execution objects (target, process, thread and frame) don't keep these
+/// objects around, they are safe to keep around.
+///
+/// The general rule of thumb is all long lived objects that want to refer to
+/// execution contexts should use ExecutionContextRef objects. The
+/// ExecutionContext class is used to temporarily get shared pointers to any
+/// execution context objects that are still around so they are guaranteed to
+/// exist during a function that requires the objects. ExecutionContext
+/// objects should NOT be used for long term storage since they will keep
+/// objects alive with extra shared pointer references to these objects.
+class ExecutionContextRef {
+public:
+ /// Default Constructor.
+ ExecutionContextRef();
+
+ /// Copy Constructor.
+ ExecutionContextRef(const ExecutionContextRef &rhs);
+
+ /// Construct using an ExecutionContext object that might be nullptr.
+ ///
+ /// If \a exe_ctx_ptr is valid, then make weak references to any valid
+ /// objects in the ExecutionContext, otherwise no weak references to any
+ /// execution context objects will be made.
+ ExecutionContextRef(const ExecutionContext *exe_ctx_ptr);
+
+ /// Construct using an ExecutionContext object.
+ ///
+ /// Make weak references to any valid objects in the ExecutionContext.
+ ExecutionContextRef(const ExecutionContext &exe_ctx);
+
+ /// Construct using the target and all the selected items inside of it (the
+ /// process and its selected thread, and the thread's selected frame). If
+ /// there is no selected thread, default to the first thread If there is no
+ /// selected frame, default to the first frame.
+ ExecutionContextRef(Target *target, bool adopt_selected);
+
+ /// Construct using an execution context scope.
+ ///
+ /// If the ExecutionContextScope object is valid and refers to a frame, make
+ /// weak references too the frame, thread, process and target. If the
+ /// ExecutionContextScope object is valid and refers to a thread, make weak
+ /// references too the thread, process and target. If the
+ /// ExecutionContextScope object is valid and refers to a process, make weak
+ /// references too the process and target. If the ExecutionContextScope
+ /// object is valid and refers to a target, make weak references too the
+ /// target.
+ ExecutionContextRef(ExecutionContextScope *exe_scope);
+
+ /// Construct using an execution context scope.
+ ///
+ /// If the ExecutionContextScope object refers to a frame, make weak
+ /// references too the frame, thread, process and target. If the
+ /// ExecutionContextScope object refers to a thread, make weak references
+ /// too the thread, process and target. If the ExecutionContextScope object
+ /// refers to a process, make weak references too the process and target. If
+ /// the ExecutionContextScope object refers to a target, make weak
+ /// references too the target.
+ ExecutionContextRef(ExecutionContextScope &exe_scope);
+
+ ~ExecutionContextRef();
+
+ /// Assignment operator
+ ///
+ /// Copy all weak references in \a rhs.
+ ExecutionContextRef &operator=(const ExecutionContextRef &rhs);
+
+ /// Assignment operator from a ExecutionContext
+ ///
+ /// Make weak references to any strongly referenced objects in \a exe_ctx.
+ ExecutionContextRef &operator=(const ExecutionContext &exe_ctx);
+
+ /// Clear the object's state.
+ ///
+ /// Sets the process and thread to nullptr, and the frame index to an
+ /// invalid value.
+ void Clear();
+
+ /// Set accessor that creates a weak reference to the target referenced in
+ /// \a target_sp.
+ ///
+ /// If \a target_sp is valid this object will create a weak reference to
+ /// that object, otherwise any previous target weak reference contained in
+ /// this object will be reset.
+ ///
+ /// Only the weak reference to the target will be updated, no other weak
+ /// references will be modified. If you want this execution context to make
+ /// a weak reference to the target's process, use the
+ /// ExecutionContextRef::SetContext() functions.
+ ///
+ /// \see ExecutionContextRef::SetContext(const lldb::TargetSP &, bool)
+ void SetTargetSP(const lldb::TargetSP &target_sp);
+
+ /// Set accessor that creates a weak reference to the process referenced in
+ /// \a process_sp.
+ ///
+ /// If \a process_sp is valid this object will create a weak reference to
+ /// that object, otherwise any previous process weak reference contained in
+ /// this object will be reset.
+ ///
+ /// Only the weak reference to the process will be updated, no other weak
+ /// references will be modified. If you want this execution context to make
+ /// a weak reference to the target, use the
+ /// ExecutionContextRef::SetContext() functions.
+ ///
+ /// \see ExecutionContextRef::SetContext(const lldb::ProcessSP &)
+ void SetProcessSP(const lldb::ProcessSP &process_sp);
+
+ /// Set accessor that creates a weak reference to the thread referenced in
+ /// \a thread_sp.
+ ///
+ /// If \a thread_sp is valid this object will create a weak reference to
+ /// that object, otherwise any previous thread weak reference contained in
+ /// this object will be reset.
+ ///
+ /// Only the weak reference to the thread will be updated, no other weak
+ /// references will be modified. If you want this execution context to make
+ /// a weak reference to the thread's process and target, use the
+ /// ExecutionContextRef::SetContext() functions.
+ ///
+ /// \see ExecutionContextRef::SetContext(const lldb::ThreadSP &)
+ void SetThreadSP(const lldb::ThreadSP &thread_sp);
+
+ /// Set accessor that creates a weak reference to the frame referenced in \a
+ /// frame_sp.
+ ///
+ /// If \a frame_sp is valid this object will create a weak reference to that
+ /// object, otherwise any previous frame weak reference contained in this
+ /// object will be reset.
+ ///
+ /// Only the weak reference to the frame will be updated, no other weak
+ /// references will be modified. If you want this execution context to make
+ /// a weak reference to the frame's thread, process and target, use the
+ /// ExecutionContextRef::SetContext() functions.
+ ///
+ /// \see ExecutionContextRef::SetContext(const lldb::StackFrameSP &)
+ void SetFrameSP(const lldb::StackFrameSP &frame_sp);
+
+ void SetTargetPtr(Target *target, bool adopt_selected);
+
+ void SetProcessPtr(Process *process);
+
+ void SetThreadPtr(Thread *thread);
+
+ void SetFramePtr(StackFrame *frame);
+
+ /// Get accessor that creates a strong reference from the weak target
+ /// reference contained in this object.
+ ///
+ /// \returns
+ /// A shared pointer to a target that is not guaranteed to be valid.
+ lldb::TargetSP GetTargetSP() const;
+
+ /// Get accessor that creates a strong reference from the weak process
+ /// reference contained in this object.
+ ///
+ /// \returns
+ /// A shared pointer to a process that is not guaranteed to be valid.
+ lldb::ProcessSP GetProcessSP() const;
+
+ /// Get accessor that creates a strong reference from the weak thread
+ /// reference contained in this object.
+ ///
+ /// \returns
+ /// A shared pointer to a thread that is not guaranteed to be valid.
+ lldb::ThreadSP GetThreadSP() const;
+
+ /// Get accessor that creates a strong reference from the weak frame
+ /// reference contained in this object.
+ ///
+ /// \returns
+ /// A shared pointer to a frame that is not guaranteed to be valid.
+ lldb::StackFrameSP GetFrameSP() const;
+
+ /// Create an ExecutionContext object from this object.
+ ///
+ /// Create strong references to any execution context objects that are still
+ /// valid. Any of the returned shared pointers in the ExecutionContext
+ /// objects is not guaranteed to be valid. \returns
+ /// An execution context object that has strong references to
+ /// any valid weak references in this object.
+ ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const;
+
+ /// Returns true if this object has a weak reference to a thread. The return
+ /// value is only an indication of whether this object has a weak reference
+ /// and does not indicate whether the weak reference is valid or not.
+ bool HasThreadRef() const { return m_tid != LLDB_INVALID_THREAD_ID; }
+
+ /// Returns true if this object has a weak reference to a frame. The return
+ /// value is only an indication of whether this object has a weak reference
+ /// and does not indicate whether the weak reference is valid or not.
+ bool HasFrameRef() const { return m_stack_id.IsValid(); }
+
+ void ClearThread() {
+ m_thread_wp.reset();
+ m_tid = LLDB_INVALID_THREAD_ID;
+ }
+
+ void ClearFrame() { m_stack_id.Clear(); }
+
+protected:
+ // Member variables
+ lldb::TargetWP m_target_wp; ///< A weak reference to a target
+ lldb::ProcessWP m_process_wp; ///< A weak reference to a process
+ mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread
+ lldb::tid_t m_tid; ///< The thread ID that this object refers to in case the
+ ///backing object changes
+ StackID m_stack_id; ///< The stack ID that this object refers to in case the
+ ///backing object changes
+};
+
+/// \class ExecutionContext ExecutionContext.h
+/// "lldb/Target/ExecutionContext.h"
+/// A class that contains an execution context.
+///
+/// This baton object can be passed into any function that requires a context
+/// that specifies a target, process, thread and frame. These objects are
+/// designed to be used for short term execution context object storage while
+/// a function might be trying to evaluate something that requires a thread or
+/// frame. ExecutionContextRef objects can be used to initialize one of these
+/// objects to turn the weak execution context object references to the
+/// target, process, thread and frame into strong references (shared pointers)
+/// so that functions can guarantee that these objects won't go away in the
+/// middle of a function.
+///
+/// ExecutionContext objects should be used as short lived objects (typically
+/// on the stack) in order to lock down an execution context for local use and
+/// for passing down to other functions that also require specific contexts.
+/// They should NOT be used for long term storage, for long term storage use
+/// ExecutionContextRef objects.
+class ExecutionContext {
+public:
+ /// Default Constructor.
+ ExecutionContext();
+
+ // Copy constructor
+ ExecutionContext(const ExecutionContext &rhs);
+
+ // Adopt the target and optionally its current context.
+ ExecutionContext(Target *t, bool fill_current_process_thread_frame = true);
+
+ // Create execution contexts from shared pointers
+ ExecutionContext(const lldb::TargetSP &target_sp, bool get_process);
+ ExecutionContext(const lldb::ProcessSP &process_sp);
+ ExecutionContext(const lldb::ThreadSP &thread_sp);
+ ExecutionContext(const lldb::StackFrameSP &frame_sp);
+
+ // Create execution contexts from weak pointers
+ ExecutionContext(const lldb::TargetWP &target_wp, bool get_process);
+ ExecutionContext(const lldb::ProcessWP &process_wp);
+ ExecutionContext(const lldb::ThreadWP &thread_wp);
+ ExecutionContext(const lldb::StackFrameWP &frame_wp);
+ ExecutionContext(const ExecutionContextRef &exe_ctx_ref);
+ ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
+ bool thread_and_frame_only_if_stopped = false);
+
+ // These two variants take in a locker, and grab the target, lock the API
+ // mutex into locker, then fill in the rest of the shared pointers.
+ ExecutionContext(const ExecutionContextRef &exe_ctx_ref,
+ std::unique_lock<std::recursive_mutex> &locker);
+ ExecutionContext(const ExecutionContextRef *exe_ctx_ref,
+ std::unique_lock<std::recursive_mutex> &locker);
+ // Create execution contexts from execution context scopes
+ ExecutionContext(ExecutionContextScope *exe_scope);
+ ExecutionContext(ExecutionContextScope &exe_scope);
+
+ /// Construct with process, thread, and frame index.
+ ///
+ /// Initialize with process \a p, thread \a t, and frame index \a f.
+ ///
+ /// \param[in] process
+ /// The process for this execution context.
+ ///
+ /// \param[in] thread
+ /// The thread for this execution context.
+ ///
+ /// \param[in] frame
+ /// The frame index for this execution context.
+ ExecutionContext(Process *process, Thread *thread = nullptr,
+ StackFrame *frame = nullptr);
+
+ ~ExecutionContext();
+
+ ExecutionContext &operator=(const ExecutionContext &rhs);
+
+ bool operator==(const ExecutionContext &rhs) const;
+
+ bool operator!=(const ExecutionContext &rhs) const;
+
+ /// Clear the object's state.
+ ///
+ /// Sets the process and thread to nullptr, and the frame index to an
+ /// invalid value.
+ void Clear();
+
+ RegisterContext *GetRegisterContext() const;
+
+ ExecutionContextScope *GetBestExecutionContextScope() const;
+
+ uint32_t GetAddressByteSize() const;
+
+ lldb::ByteOrder GetByteOrder() const;
+
+ /// Returns a pointer to the target object.
+ ///
+ /// The returned pointer might be nullptr. Calling HasTargetScope(),
+ /// HasProcessScope(), HasThreadScope(), or HasFrameScope() can help to pre-
+ /// validate this pointer so that this accessor can freely be used without
+ /// having to check for nullptr each time.
+ ///
+ /// \see ExecutionContext::HasTargetScope() const @see
+ /// ExecutionContext::HasProcessScope() const @see
+ /// ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Target *GetTargetPtr() const;
+
+ /// Returns a pointer to the process object.
+ ///
+ /// The returned pointer might be nullptr. Calling HasProcessScope(),
+ /// HasThreadScope(), or HasFrameScope() can help to pre-validate this
+ /// pointer so that this accessor can freely be used without having to check
+ /// for nullptr each time.
+ ///
+ /// \see ExecutionContext::HasProcessScope() const @see
+ /// ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Process *GetProcessPtr() const;
+
+ /// Returns a pointer to the thread object.
+ ///
+ /// The returned pointer might be nullptr. Calling HasThreadScope() or
+ /// HasFrameScope() can help to pre-validate this pointer so that this
+ /// accessor can freely be used without having to check for nullptr each
+ /// time.
+ ///
+ /// \see ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Thread *GetThreadPtr() const { return m_thread_sp.get(); }
+
+ /// Returns a pointer to the frame object.
+ ///
+ /// The returned pointer might be nullptr. Calling HasFrameScope(), can help
+ /// to pre-validate this pointer so that this accessor can freely be used
+ /// without having to check for nullptr each time.
+ ///
+ /// \see ExecutionContext::HasFrameScope() const
+ StackFrame *GetFramePtr() const { return m_frame_sp.get(); }
+
+ /// Returns a reference to the target object.
+ ///
+ /// Clients should call HasTargetScope(), HasProcessScope(),
+ /// HasThreadScope(), or HasFrameScope() prior to calling this function to
+ /// ensure that this ExecutionContext object contains a valid target.
+ ///
+ /// \see ExecutionContext::HasTargetScope() const @see
+ /// ExecutionContext::HasProcessScope() const @see
+ /// ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Target &GetTargetRef() const;
+
+ /// Returns a reference to the process object.
+ ///
+ /// Clients should call HasProcessScope(), HasThreadScope(), or
+ /// HasFrameScope() prior to calling this function to ensure that this
+ /// ExecutionContext object contains a valid target.
+ ///
+ /// \see ExecutionContext::HasProcessScope() const @see
+ /// ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Process &GetProcessRef() const;
+
+ /// Returns a reference to the thread object.
+ ///
+ /// Clients should call HasThreadScope(), or HasFrameScope() prior to
+ /// calling this function to ensure that this ExecutionContext object
+ /// contains a valid target.
+ ///
+ /// \see ExecutionContext::HasThreadScope() const @see
+ /// ExecutionContext::HasFrameScope() const
+ Thread &GetThreadRef() const;
+
+ /// Returns a reference to the thread object.
+ ///
+ /// Clients should call HasFrameScope() prior to calling this function to
+ /// ensure that this ExecutionContext object contains a valid target.
+ ///
+ /// \see ExecutionContext::HasFrameScope() const
+ StackFrame &GetFrameRef() const;
+
+ /// Get accessor to get the target shared pointer.
+ ///
+ /// The returned shared pointer is not guaranteed to be valid.
+ const lldb::TargetSP &GetTargetSP() const { return m_target_sp; }
+
+ /// Get accessor to get the process shared pointer.
+ ///
+ /// The returned shared pointer is not guaranteed to be valid.
+ const lldb::ProcessSP &GetProcessSP() const { return m_process_sp; }
+
+ /// Get accessor to get the thread shared pointer.
+ ///
+ /// The returned shared pointer is not guaranteed to be valid.
+ const lldb::ThreadSP &GetThreadSP() const { return m_thread_sp; }
+
+ /// Get accessor to get the frame shared pointer.
+ ///
+ /// The returned shared pointer is not guaranteed to be valid.
+ const lldb::StackFrameSP &GetFrameSP() const { return m_frame_sp; }
+
+ /// Set accessor to set only the target shared pointer.
+ void SetTargetSP(const lldb::TargetSP &target_sp);
+
+ /// Set accessor to set only the process shared pointer.
+ void SetProcessSP(const lldb::ProcessSP &process_sp);
+
+ /// Set accessor to set only the thread shared pointer.
+ void SetThreadSP(const lldb::ThreadSP &thread_sp);
+
+ /// Set accessor to set only the frame shared pointer.
+ void SetFrameSP(const lldb::StackFrameSP &frame_sp);
+
+ /// Set accessor to set only the target shared pointer from a target
+ /// pointer.
+ void SetTargetPtr(Target *target);
+
+ /// Set accessor to set only the process shared pointer from a process
+ /// pointer.
+ void SetProcessPtr(Process *process);
+
+ /// Set accessor to set only the thread shared pointer from a thread
+ /// pointer.
+ void SetThreadPtr(Thread *thread);
+
+ /// Set accessor to set only the frame shared pointer from a frame pointer.
+ void SetFramePtr(StackFrame *frame);
+
+ // Set the execution context using a target shared pointer.
+ //
+ // If "target_sp" is valid, sets the target context to match and if
+ // "get_process" is true, sets the process shared pointer if the target
+ // currently has a process.
+ void SetContext(const lldb::TargetSP &target_sp, bool get_process);
+
+ // Set the execution context using a process shared pointer.
+ //
+ // If "process_sp" is valid, then set the process and target in this context.
+ // Thread and frame contexts will be cleared. If "process_sp" is not valid,
+ // all shared pointers are reset.
+ void SetContext(const lldb::ProcessSP &process_sp);
+
+ // Set the execution context using a thread shared pointer.
+ //
+ // If "thread_sp" is valid, then set the thread, process and target in this
+ // context. The frame context will be cleared. If "thread_sp" is not valid,
+ // all shared pointers are reset.
+ void SetContext(const lldb::ThreadSP &thread_sp);
+
+ // Set the execution context using a frame shared pointer.
+ //
+ // If "frame_sp" is valid, then set the frame, thread, process and target in
+ // this context If "frame_sp" is not valid, all shared pointers are reset.
+ void SetContext(const lldb::StackFrameSP &frame_sp);
+
+ /// Returns true the ExecutionContext object contains a valid target.
+ ///
+ /// This function can be called after initializing an ExecutionContext
+ /// object, and if it returns true, calls to GetTargetPtr() and
+ /// GetTargetRef() do not need to be checked for validity.
+ bool HasTargetScope() const;
+
+ /// Returns true the ExecutionContext object contains a valid target and
+ /// process.
+ ///
+ /// This function can be called after initializing an ExecutionContext
+ /// object, and if it returns true, calls to GetTargetPtr() and
+ /// GetTargetRef(), GetProcessPtr(), and GetProcessRef(), do not need to be
+ /// checked for validity.
+ bool HasProcessScope() const;
+
+ /// Returns true the ExecutionContext object contains a valid target,
+ /// process, and thread.
+ ///
+ /// This function can be called after initializing an ExecutionContext
+ /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(),
+ /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), and GetThreadRef() do
+ /// not need to be checked for validity.
+ bool HasThreadScope() const;
+
+ /// Returns true the ExecutionContext object contains a valid target,
+ /// process, thread and frame.
+ ///
+ /// This function can be called after initializing an ExecutionContext
+ /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(),
+ /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), GetThreadRef(),
+ /// GetFramePtr(), and GetFrameRef() do not need to be checked for validity.
+ bool HasFrameScope() const;
+
+protected:
+ // Member variables
+ lldb::TargetSP m_target_sp; ///< The target that owns the process/thread/frame
+ lldb::ProcessSP m_process_sp; ///< The process that owns the thread/frame
+ lldb::ThreadSP m_thread_sp; ///< The thread that owns the frame
+ lldb::StackFrameSP m_frame_sp; ///< The stack frame in thread.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ExecutionContext_h_
diff --git a/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h b/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h
new file mode 100644
index 0000000..0121ce6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h
@@ -0,0 +1,58 @@
+//===-- ExecutionContextScope.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExecutionContextScope_h_
+#define liblldb_ExecutionContextScope_h_
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// @class ExecutionContextScope ExecutionContextScope.h
+/// "lldb/Target/ExecutionContextScope.h" Inherit from this if your object can
+/// reconstruct its
+/// execution context.
+///
+/// Many objects that have pointers back to parent execution context objects
+/// can inherit from this pure virtual class can reconstruct their execution
+/// context without having to keep a complete ExecutionContext object in the
+/// object state. Examples of these objects include: Process, Thread,
+/// RegisterContext and StackFrame.
+///
+/// Objects can contain a valid pointer to an instance of this so they can
+/// reconstruct the execution context.
+///
+/// Objects that adhere to this protocol can reconstruct enough of a execution
+/// context to allow functions that take a execution contexts to be called.
+class ExecutionContextScope {
+public:
+ virtual ~ExecutionContextScope() {}
+
+ virtual lldb::TargetSP CalculateTarget() = 0;
+
+ virtual lldb::ProcessSP CalculateProcess() = 0;
+
+ virtual lldb::ThreadSP CalculateThread() = 0;
+
+ virtual lldb::StackFrameSP CalculateStackFrame() = 0;
+
+ /// Reconstruct the object's execution context into \a sc.
+ ///
+ /// The object should fill in as much of the ExecutionContextScope as it can
+ /// so function calls that require a execution context can be made for the
+ /// given object.
+ ///
+ /// \param[out] exe_ctx
+ /// A reference to an execution context object that gets filled
+ /// in.
+ virtual void CalculateExecutionContext(ExecutionContext &exe_ctx) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ExecutionContextScope_h_
diff --git a/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h b/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h
new file mode 100644
index 0000000..4cee76d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h
@@ -0,0 +1,95 @@
+//===-- InstrumentationRuntime.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_InstrumentationRuntime_h_
+#define liblldb_InstrumentationRuntime_h_
+
+#include <map>
+#include <vector>
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+typedef std::map<lldb::InstrumentationRuntimeType,
+ lldb::InstrumentationRuntimeSP>
+ InstrumentationRuntimeCollection;
+
+class InstrumentationRuntime
+ : public std::enable_shared_from_this<InstrumentationRuntime>,
+ public PluginInterface {
+ /// The instrumented process.
+ lldb::ProcessWP m_process_wp;
+
+ /// The module containing the instrumentation runtime.
+ lldb::ModuleSP m_runtime_module;
+
+ /// The breakpoint in the instrumentation runtime.
+ lldb::user_id_t m_breakpoint_id;
+
+ /// Indicates whether or not breakpoints have been registered in the
+ /// instrumentation runtime.
+ bool m_is_active;
+
+protected:
+ InstrumentationRuntime(const lldb::ProcessSP &process_sp)
+ : m_process_wp(), m_runtime_module(), m_breakpoint_id(0),
+ m_is_active(false) {
+ if (process_sp)
+ m_process_wp = process_sp;
+ }
+
+ lldb::ProcessSP GetProcessSP() { return m_process_wp.lock(); }
+
+ lldb::ModuleSP GetRuntimeModuleSP() { return m_runtime_module; }
+
+ void SetRuntimeModuleSP(lldb::ModuleSP module_sp) {
+ m_runtime_module = module_sp;
+ }
+
+ lldb::user_id_t GetBreakpointID() const { return m_breakpoint_id; }
+
+ void SetBreakpointID(lldb::user_id_t ID) { m_breakpoint_id = ID; }
+
+ void SetActive(bool IsActive) { m_is_active = IsActive; }
+
+ /// Return a regular expression which can be used to identify a valid version
+ /// of the runtime library.
+ virtual const RegularExpression &GetPatternForRuntimeLibrary() = 0;
+
+ /// Check whether \p module_sp corresponds to a valid runtime library.
+ virtual bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) = 0;
+
+ /// Register a breakpoint in the runtime library and perform any other
+ /// necessary initialization. The runtime library
+ /// is guaranteed to be loaded.
+ virtual void Activate() = 0;
+
+public:
+ static void ModulesDidLoad(lldb_private::ModuleList &module_list,
+ Process *process,
+ InstrumentationRuntimeCollection &runtimes);
+
+ /// Look for the instrumentation runtime in \p module_list. Register and
+ /// activate the runtime if this hasn't already
+ /// been done.
+ void ModulesDidLoad(lldb_private::ModuleList &module_list);
+
+ bool IsActive() const { return m_is_active; }
+
+ virtual lldb::ThreadCollectionSP
+ GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_InstrumentationRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h
new file mode 100644
index 0000000..6c2a8ad
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h
@@ -0,0 +1,42 @@
+//===-- InstrumentationRuntimeStopInfo.h ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_InstrumentationRuntimeStopInfo_h_
+#define liblldb_InstrumentationRuntimeStopInfo_h_
+
+#include <string>
+
+#include "lldb/Target/StopInfo.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+class InstrumentationRuntimeStopInfo : public StopInfo {
+public:
+ ~InstrumentationRuntimeStopInfo() override {}
+
+ lldb::StopReason GetStopReason() const override {
+ return lldb::eStopReasonInstrumentation;
+ }
+
+ const char *GetDescription() override;
+
+ bool DoShouldNotify(Event *event_ptr) override { return true; }
+
+ static lldb::StopInfoSP CreateStopReasonWithInstrumentationData(
+ Thread &thread, std::string description,
+ StructuredData::ObjectSP additional_data);
+
+private:
+ InstrumentationRuntimeStopInfo(Thread &thread, std::string description,
+ StructuredData::ObjectSP additional_data);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_InstrumentationRuntimeStopInfo_h_
diff --git a/linux-x64/clang/include/lldb/Target/JITLoader.h b/linux-x64/clang/include/lldb/Target/JITLoader.h
new file mode 100644
index 0000000..1bafd82
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/JITLoader.h
@@ -0,0 +1,68 @@
+//===-- JITLoader.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_JITLoader_h_
+#define liblldb_JITLoader_h_
+
+#include <vector>
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Target/JITLoaderList.h"
+
+namespace lldb_private {
+
+/// \class JITLoader JITLoader.h "lldb/Target/JITLoader.h"
+/// A plug-in interface definition class for JIT loaders.
+///
+/// Plugins of this kind listen for code generated at runtime in the target.
+/// They are very similar to dynamic loader, with the difference that they do
+/// not have information about the target's dyld and that there may be
+/// multiple JITLoader plugins per process, while there is at most one
+/// DynamicLoader.
+class JITLoader : public PluginInterface {
+public:
+ /// Find a JIT loader plugin for a given process.
+ ///
+ /// Scans the installed DynamicLoader plug-ins and tries to find all
+ /// applicable instances for the current process.
+ ///
+ /// \param[in] process
+ /// The process for which to try and locate a JIT loader
+ /// plug-in instance.
+ ///
+ static void LoadPlugins(Process *process, lldb_private::JITLoaderList &list);
+
+ /// Construct with a process.
+ JITLoader(Process *process);
+
+ ~JITLoader() override;
+
+ /// Called after attaching a process.
+ ///
+ /// Allow JITLoader plug-ins to execute some code after attaching to a
+ /// process.
+ virtual void DidAttach() = 0;
+
+ /// Called after launching a process.
+ ///
+ /// Allow JITLoader plug-ins to execute some code after the process has
+ /// stopped for the first time on launch.
+ virtual void DidLaunch() = 0;
+
+ /// Called after a new shared object has been loaded so that it can be
+ /// probed for JIT entry point hooks.
+ virtual void ModulesDidLoad(lldb_private::ModuleList &module_list) = 0;
+
+protected:
+ // Member variables.
+ Process *m_process;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_JITLoader_h_
diff --git a/linux-x64/clang/include/lldb/Target/JITLoaderList.h b/linux-x64/clang/include/lldb/Target/JITLoaderList.h
new file mode 100644
index 0000000..4cc3a9e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/JITLoaderList.h
@@ -0,0 +1,48 @@
+//===-- JITLoaderList.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_JITLoaderList_h_
+#define liblldb_JITLoaderList_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+
+/// \class JITLoaderList JITLoaderList.h "lldb/Target/JITLoaderList.h"
+///
+/// Class used by the Process to hold a list of its JITLoaders.
+class JITLoaderList {
+public:
+ JITLoaderList();
+ ~JITLoaderList();
+
+ void Append(const lldb::JITLoaderSP &jit_loader_sp);
+
+ void Remove(const lldb::JITLoaderSP &jit_loader_sp);
+
+ size_t GetSize() const;
+
+ lldb::JITLoaderSP GetLoaderAtIndex(size_t idx);
+
+ void DidLaunch();
+
+ void DidAttach();
+
+ void ModulesDidLoad(ModuleList &module_list);
+
+private:
+ std::vector<lldb::JITLoaderSP> m_jit_loaders_vec;
+ std::recursive_mutex m_jit_loaders_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_JITLoaderList_h_
diff --git a/linux-x64/clang/include/lldb/Target/Language.h b/linux-x64/clang/include/lldb/Target/Language.h
new file mode 100644
index 0000000..6ea6029
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Language.h
@@ -0,0 +1,287 @@
+//===-- Language.h ---------------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Language_h_
+#define liblldb_Language_h_
+
+#include <functional>
+#include <memory>
+#include <set>
+#include <vector>
+
+#include "lldb/Core/Highlighter.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class Language : public PluginInterface {
+public:
+ class TypeScavenger {
+ public:
+ class Result {
+ public:
+ virtual bool IsValid() = 0;
+
+ virtual bool DumpToStream(Stream &stream,
+ bool print_help_if_available) = 0;
+
+ virtual ~Result() = default;
+ };
+
+ typedef std::set<std::unique_ptr<Result>> ResultSet;
+
+ virtual ~TypeScavenger() = default;
+
+ size_t Find(ExecutionContextScope *exe_scope, const char *key,
+ ResultSet &results, bool append = true);
+
+ protected:
+ TypeScavenger() = default;
+
+ virtual bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+ ResultSet &results) = 0;
+ };
+
+ class ImageListTypeScavenger : public TypeScavenger {
+ class Result : public Language::TypeScavenger::Result {
+ public:
+ Result(CompilerType type)
+ : Language::TypeScavenger::Result(), m_compiler_type(type) {}
+
+ bool IsValid() override { return m_compiler_type.IsValid(); }
+
+ bool DumpToStream(Stream &stream, bool print_help_if_available) override {
+ if (IsValid()) {
+ m_compiler_type.DumpTypeDescription(&stream);
+ stream.EOL();
+ return true;
+ }
+ return false;
+ }
+
+ ~Result() override = default;
+
+ private:
+ CompilerType m_compiler_type;
+ };
+
+ protected:
+ ImageListTypeScavenger() = default;
+
+ ~ImageListTypeScavenger() override = default;
+
+ // is this type something we should accept? it's usually going to be a
+ // filter by language + maybe some sugar tweaking
+ // returning an empty type means rejecting this candidate entirely;
+ // any other result will be accepted as a valid match
+ virtual CompilerType AdjustForInclusion(CompilerType &candidate) = 0;
+
+ bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+ ResultSet &results) override;
+ };
+
+ template <typename... ScavengerTypes>
+ class EitherTypeScavenger : public TypeScavenger {
+ public:
+ EitherTypeScavenger() : TypeScavenger(), m_scavengers() {
+ for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
+ if (scavenger)
+ m_scavengers.push_back(scavenger);
+ }
+ }
+ protected:
+ bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+ ResultSet &results) override {
+ const bool append = false;
+ for (auto& scavenger : m_scavengers) {
+ if (scavenger && scavenger->Find(exe_scope, key, results, append))
+ return true;
+ }
+ return false;
+ }
+ private:
+ std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
+ };
+
+ template <typename... ScavengerTypes>
+ class UnionTypeScavenger : public TypeScavenger {
+ public:
+ UnionTypeScavenger() : TypeScavenger(), m_scavengers() {
+ for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
+ if (scavenger)
+ m_scavengers.push_back(scavenger);
+ }
+ }
+ protected:
+ bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+ ResultSet &results) override {
+ const bool append = true;
+ bool success = false;
+ for (auto& scavenger : m_scavengers) {
+ if (scavenger)
+ success = scavenger->Find(exe_scope, key, results, append) || success;
+ }
+ return success;
+ }
+ private:
+ std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
+ };
+
+ enum class FunctionNameRepresentation {
+ eName,
+ eNameWithArgs,
+ eNameWithNoArgs
+ };
+
+ ~Language() override;
+
+ static Language *FindPlugin(lldb::LanguageType language);
+
+ /// Returns the Language associated with the given file path or a nullptr
+ /// if there is no known language.
+ static Language *FindPlugin(llvm::StringRef file_path);
+
+ static Language *FindPlugin(lldb::LanguageType language,
+ llvm::StringRef file_path);
+
+ // return false from callback to stop iterating
+ static void ForEach(std::function<bool(Language *)> callback);
+
+ virtual lldb::LanguageType GetLanguageType() const = 0;
+
+ virtual bool IsTopLevelFunction(Function &function);
+
+ virtual bool IsSourceFile(llvm::StringRef file_path) const = 0;
+
+ virtual const Highlighter *GetHighlighter() const { return nullptr; }
+
+ virtual lldb::TypeCategoryImplSP GetFormatters();
+
+ virtual HardcodedFormatters::HardcodedFormatFinder GetHardcodedFormats();
+
+ virtual HardcodedFormatters::HardcodedSummaryFinder GetHardcodedSummaries();
+
+ virtual HardcodedFormatters::HardcodedSyntheticFinder
+ GetHardcodedSynthetics();
+
+ virtual HardcodedFormatters::HardcodedValidatorFinder
+ GetHardcodedValidators();
+
+ virtual std::vector<ConstString>
+ GetPossibleFormattersMatches(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ virtual lldb_private::formatters::StringPrinter::EscapingHelper
+ GetStringPrinterEscapingHelper(
+ lldb_private::formatters::StringPrinter::GetPrintableElementType);
+
+ virtual std::unique_ptr<TypeScavenger> GetTypeScavenger();
+
+ virtual const char *GetLanguageSpecificTypeLookupHelp();
+
+ // If a language can have more than one possible name for a method, this
+ // function can be used to enumerate them. This is useful when doing name
+ // lookups.
+ virtual std::vector<ConstString>
+ GetMethodNameVariants(ConstString method_name) const {
+ return std::vector<ConstString>();
+ };
+
+ // if an individual data formatter can apply to several types and cross a
+ // language boundary it makes sense for individual languages to want to
+ // customize the printing of values of that type by appending proper
+ // prefix/suffix information in language-specific ways
+ virtual bool GetFormatterPrefixSuffix(ValueObject &valobj,
+ ConstString type_hint,
+ std::string &prefix,
+ std::string &suffix);
+
+ // if a language has a custom format for printing variable declarations that
+ // it wants LLDB to honor it should return an appropriate closure here
+ virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper();
+
+ 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
+ virtual bool IsNilReference(ValueObject &valobj);
+
+ // for a ValueObject of some "reference type", if the language provides a
+ // technique to decide whether the reference has ever been assigned to some
+ // object, this method will return true if such detection is possible, and if
+ // the reference has never been assigned
+ virtual bool IsUninitializedReference(ValueObject &valobj);
+
+ virtual bool GetFunctionDisplayName(const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ FunctionNameRepresentation representation,
+ Stream &s);
+
+ virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on,
+ Stream &s);
+
+ static void GetDefaultExceptionResolverDescription(bool catch_on,
+ bool throw_on, Stream &s);
+
+ // These are accessors for general information about the Languages lldb knows
+ // about:
+
+ static lldb::LanguageType
+ GetLanguageTypeFromString(const char *string) = delete;
+ static lldb::LanguageType GetLanguageTypeFromString(llvm::StringRef string);
+
+ static const char *GetNameForLanguageType(lldb::LanguageType language);
+
+ static void PrintAllLanguages(Stream &s, const char *prefix,
+ const char *suffix);
+
+ // return false from callback to stop iterating
+ static void ForAllLanguages(std::function<bool(lldb::LanguageType)> callback);
+
+ static bool LanguageIsCPlusPlus(lldb::LanguageType language);
+
+ static bool LanguageIsObjC(lldb::LanguageType language);
+
+ static bool LanguageIsC(lldb::LanguageType language);
+
+ /// Equivalent to \c LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
+ static bool LanguageIsCFamily(lldb::LanguageType language);
+
+ static bool LanguageIsPascal(lldb::LanguageType language);
+
+ // return the primary language, so if LanguageIsC(l), return eLanguageTypeC,
+ // etc.
+ static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language);
+
+ static std::set<lldb::LanguageType> GetSupportedLanguages();
+
+ static void GetLanguagesSupportingTypeSystems(
+ std::set<lldb::LanguageType> &languages,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void
+ GetLanguagesSupportingREPLs(std::set<lldb::LanguageType> &languages);
+
+protected:
+ // Classes that inherit from Language can see and modify these
+
+ Language();
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Language);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Language_h_
diff --git a/linux-x64/clang/include/lldb/Target/LanguageRuntime.h b/linux-x64/clang/include/lldb/Target/LanguageRuntime.h
new file mode 100644
index 0000000..3521f46
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/LanguageRuntime.h
@@ -0,0 +1,197 @@
+//===-- LanguageRuntime.h ---------------------------------------------------*-
+// C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_LanguageRuntime_h_
+#define liblldb_LanguageRuntime_h_
+
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Breakpoint/BreakpointResolverName.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/LLVMUserExpression.h"
+#include "lldb/Symbol/DeclVendor.h"
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include "clang/Basic/TargetOptions.h"
+
+namespace lldb_private {
+
+class ExceptionSearchFilter : public SearchFilter {
+public:
+ ExceptionSearchFilter(const lldb::TargetSP &target_sp,
+ lldb::LanguageType language,
+ bool update_module_list = true);
+
+ ~ExceptionSearchFilter() override = default;
+
+ bool ModulePasses(const lldb::ModuleSP &module_sp) override;
+
+ bool ModulePasses(const FileSpec &spec) override;
+
+ void Search(Searcher &searcher) override;
+
+ void GetDescription(Stream *s) override;
+
+ static SearchFilter *
+ CreateFromStructuredData(Target &target,
+ const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData() override;
+
+protected:
+ lldb::LanguageType m_language;
+ LanguageRuntime *m_language_runtime;
+ lldb::SearchFilterSP m_filter_sp;
+
+ lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+
+ void UpdateModuleListIfNeeded();
+};
+
+class LanguageRuntime : public PluginInterface {
+public:
+ ~LanguageRuntime() override;
+
+ static LanguageRuntime *FindPlugin(Process *process,
+ lldb::LanguageType language);
+
+ static void InitializeCommands(CommandObject *parent);
+
+ virtual lldb::LanguageType GetLanguageType() const = 0;
+
+ virtual bool GetObjectDescription(Stream &str, ValueObject &object) = 0;
+
+ virtual bool GetObjectDescription(Stream &str, Value &value,
+ ExecutionContextScope *exe_scope) = 0;
+
+ // this call should return true if it could set the name and/or the type
+ virtual bool GetDynamicTypeAndAddress(ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address,
+ Value::ValueType &value_type) = 0;
+
+ // This call should return a CompilerType given a generic type name and an
+ // ExecutionContextScope in which one can actually fetch any specialization
+ // information required.
+ virtual CompilerType GetConcreteType(ExecutionContextScope *exe_scope,
+ ConstString abstract_type_name) {
+ return CompilerType();
+ }
+
+ // This should be a fast test to determine whether it is likely that this
+ // value would have a dynamic type.
+ virtual bool CouldHaveDynamicValue(ValueObject &in_value) = 0;
+
+ // The contract for GetDynamicTypeAndAddress() is to return a "bare-bones"
+ // dynamic type For instance, given a Base* pointer,
+ // GetDynamicTypeAndAddress() will return the type of Derived, not Derived*.
+ // The job of this API is to correct this misalignment between the static
+ // type and the discovered dynamic type
+ virtual TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+ ValueObject &static_value) = 0;
+
+ virtual void SetExceptionBreakpoints() {}
+
+ virtual void ClearExceptionBreakpoints() {}
+
+ virtual bool ExceptionBreakpointsAreSet() { return false; }
+
+ virtual bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) {
+ return false;
+ }
+
+ static lldb::BreakpointSP
+ CreateExceptionBreakpoint(Target &target, lldb::LanguageType language,
+ bool catch_bp, bool throw_bp,
+ bool is_internal = false);
+
+ static lldb::BreakpointPreconditionSP
+ GetExceptionPrecondition(lldb::LanguageType language, bool throw_bp);
+
+ virtual lldb::ValueObjectSP GetExceptionObjectForThread(
+ lldb::ThreadSP thread_sp) {
+ return lldb::ValueObjectSP();
+ }
+
+ virtual lldb::ThreadSP GetBacktraceThreadFromException(
+ lldb::ValueObjectSP thread_sp) {
+ return lldb::ThreadSP();
+ }
+
+ Process *GetProcess() { return m_process; }
+
+ Target &GetTargetRef() { return m_process->GetTarget(); }
+
+ virtual DeclVendor *GetDeclVendor() { return nullptr; }
+
+ virtual lldb::BreakpointResolverSP
+ CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
+
+ virtual lldb::SearchFilterSP CreateExceptionSearchFilter() {
+ return m_process->GetTarget().GetSearchFilterForModule(nullptr);
+ }
+
+ virtual bool GetTypeBitSize(const CompilerType &compiler_type,
+ uint64_t &size) {
+ return false;
+ }
+
+ virtual void SymbolsDidLoad(const ModuleList &module_list) { return; }
+
+ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+ bool stop_others) = 0;
+
+ /// Identify whether a name is a runtime value that should not be hidden by
+ /// from the user interface.
+ virtual bool IsWhitelistedRuntimeValue(ConstString name) { return false; }
+
+ virtual void ModulesDidLoad(const ModuleList &module_list) {}
+
+ // Called by the Clang expression evaluation engine to allow runtimes to
+ // alter the set of target options provided to the compiler. If the options
+ // prototype is modified, runtimes must return true, false otherwise.
+ virtual bool GetOverrideExprOptions(clang::TargetOptions &prototype) {
+ return false;
+ }
+
+ // Called by ClangExpressionParser::PrepareForExecution to query for any
+ // custom LLVM IR passes that need to be run before an expression is
+ // assembled and run.
+ virtual bool GetIRPasses(LLVMUserExpression::IRPasses &custom_passes) {
+ return false;
+ }
+
+ // Given the name of a runtime symbol (e.g. in Objective-C, an ivar offset
+ // symbol), try to determine from the runtime what the value of that symbol
+ // would be. Useful when the underlying binary is stripped.
+ virtual lldb::addr_t LookupRuntimeSymbol(ConstString name) {
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
+ static char ID;
+
+protected:
+ // Classes that inherit from LanguageRuntime can see and modify these
+
+ LanguageRuntime(Process *process);
+ Process *m_process;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(LanguageRuntime);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_LanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/Memory.h b/linux-x64/clang/include/lldb/Target/Memory.h
new file mode 100644
index 0000000..e62b8ef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Memory.h
@@ -0,0 +1,143 @@
+//===-- Memory.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Memory_h_
+#define liblldb_Memory_h_
+
+#include "lldb/Utility/RangeMap.h"
+#include "lldb/lldb-private.h"
+#include <map>
+#include <mutex>
+#include <vector>
+
+namespace lldb_private {
+// A class to track memory that was read from a live process between
+// runs.
+class MemoryCache {
+public:
+ // Constructors and Destructors
+ MemoryCache(Process &process);
+
+ ~MemoryCache();
+
+ void Clear(bool clear_invalid_ranges = false);
+
+ void Flush(lldb::addr_t addr, size_t size);
+
+ 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; }
+
+ void AddInvalidRange(lldb::addr_t base_addr, lldb::addr_t byte_size);
+
+ bool RemoveInvalidRange(lldb::addr_t base_addr, lldb::addr_t byte_size);
+
+ // Allow external sources to populate data into the L1 memory cache
+ void AddL1CacheData(lldb::addr_t addr, const void *src, size_t src_len);
+
+ void AddL1CacheData(lldb::addr_t addr,
+ const lldb::DataBufferSP &data_buffer_sp);
+
+protected:
+ typedef std::map<lldb::addr_t, lldb::DataBufferSP> BlockMap;
+ typedef RangeArray<lldb::addr_t, lldb::addr_t, 4> InvalidRanges;
+ typedef Range<lldb::addr_t, lldb::addr_t> AddrRange;
+ // Classes that inherit from MemoryCache can see and modify these
+ std::recursive_mutex m_mutex;
+ BlockMap m_L1_cache; // A first level memory cache whose chunk sizes vary that
+ // will be used only if the memory read fits entirely in
+ // a chunk
+ BlockMap m_L2_cache; // A memory cache of fixed size chinks
+ // (m_L2_cache_line_byte_size bytes in size each)
+ InvalidRanges m_invalid_ranges;
+ Process &m_process;
+ uint32_t m_L2_cache_line_byte_size;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(MemoryCache);
+};
+
+
+
+class AllocatedBlock {
+public:
+ AllocatedBlock(lldb::addr_t addr, uint32_t byte_size, uint32_t permissions,
+ uint32_t chunk_size);
+
+ ~AllocatedBlock();
+
+ lldb::addr_t ReserveBlock(uint32_t size);
+
+ bool FreeBlock(lldb::addr_t addr);
+
+ lldb::addr_t GetBaseAddress() const { return m_range.GetRangeBase(); }
+
+ 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 m_range.Contains(addr);
+ }
+
+protected:
+ uint32_t TotalChunks() const { return GetByteSize() / GetChunkSize(); }
+
+ uint32_t CalculateChunksNeededForSize(uint32_t size) const {
+ return (size + m_chunk_size - 1) / m_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;
+};
+
+// A class that can track allocated memory and give out allocated memory
+// without us having to make an allocate/deallocate call every time we need
+// some memory in a process that is being debugged.
+class AllocatedMemoryCache {
+public:
+ // Constructors and Destructors
+ AllocatedMemoryCache(Process &process);
+
+ ~AllocatedMemoryCache();
+
+ void Clear();
+
+ lldb::addr_t AllocateMemory(size_t byte_size, uint32_t permissions,
+ Status &error);
+
+ bool DeallocateMemory(lldb::addr_t ptr);
+
+protected:
+ typedef std::shared_ptr<AllocatedBlock> AllocatedBlockSP;
+
+ AllocatedBlockSP AllocatePage(uint32_t byte_size, uint32_t permissions,
+ uint32_t chunk_size, Status &error);
+
+ // Classes that inherit from MemoryCache can see and modify these
+ Process &m_process;
+ std::recursive_mutex m_mutex;
+ typedef std::multimap<uint32_t, AllocatedBlockSP> PermissionsToBlockMap;
+ PermissionsToBlockMap m_memory_map;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(AllocatedMemoryCache);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Memory_h_
diff --git a/linux-x64/clang/include/lldb/Target/MemoryHistory.h b/linux-x64/clang/include/lldb/Target/MemoryHistory.h
new file mode 100644
index 0000000..501751c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/MemoryHistory.h
@@ -0,0 +1,33 @@
+//===-- MemoryHistory.h ---------------------------------------------------*-
+//C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_MemoryHistory_h_
+#define liblldb_MemoryHistory_h_
+
+#include <vector>
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+typedef std::vector<lldb::ThreadSP> HistoryThreads;
+
+class MemoryHistory : public std::enable_shared_from_this<MemoryHistory>,
+ public PluginInterface {
+public:
+ static lldb::MemoryHistorySP FindPlugin(const lldb::ProcessSP process);
+
+ virtual HistoryThreads GetHistoryThreads(lldb::addr_t address) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_MemoryHistory_h_
diff --git a/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h b/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h
new file mode 100644
index 0000000..5cab2ef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h
@@ -0,0 +1,148 @@
+//===-- MemoryRegionInfo.h ---------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_MemoryRegionInfo_h
+#define lldb_MemoryRegionInfo_h
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/RangeMap.h"
+#include "llvm/Support/FormatProviders.h"
+
+namespace lldb_private {
+class MemoryRegionInfo {
+public:
+ typedef Range<lldb::addr_t, lldb::addr_t> RangeType;
+
+ enum OptionalBool { eDontKnow = -1, eNo = 0, eYes = 1 };
+
+ MemoryRegionInfo()
+ : m_range(), m_read(eDontKnow), m_write(eDontKnow), m_execute(eDontKnow),
+ m_mapped(eDontKnow), m_flash(eDontKnow), m_blocksize(0) {}
+
+ ~MemoryRegionInfo() {}
+
+ RangeType &GetRange() { return m_range; }
+
+ void Clear() {
+ m_range.Clear();
+ m_read = m_write = m_execute = eDontKnow;
+ }
+
+ const RangeType &GetRange() const { return m_range; }
+
+ OptionalBool GetReadable() const { return m_read; }
+
+ OptionalBool GetWritable() const { return m_write; }
+
+ OptionalBool GetExecutable() const { return m_execute; }
+
+ OptionalBool GetMapped() const { return m_mapped; }
+
+ ConstString GetName() const { return m_name; }
+
+ void SetReadable(OptionalBool val) { m_read = val; }
+
+ void SetWritable(OptionalBool val) { m_write = val; }
+
+ void SetExecutable(OptionalBool val) { m_execute = val; }
+
+ void SetMapped(OptionalBool val) { m_mapped = val; }
+
+ void SetName(const char *name) { m_name = ConstString(name); }
+
+ OptionalBool GetFlash() const { return m_flash; }
+
+ void SetFlash(OptionalBool val) { m_flash = val; }
+
+ lldb::offset_t GetBlocksize() const { return m_blocksize; }
+
+ void SetBlocksize(lldb::offset_t blocksize) { m_blocksize = blocksize; }
+
+ // Get permissions as a uint32_t that is a mask of one or more bits from the
+ // lldb::Permissions
+ uint32_t GetLLDBPermissions() const {
+ uint32_t permissions = 0;
+ if (m_read)
+ permissions |= lldb::ePermissionsReadable;
+ if (m_write)
+ permissions |= lldb::ePermissionsWritable;
+ if (m_execute)
+ permissions |= lldb::ePermissionsExecutable;
+ return permissions;
+ }
+
+ // Set permissions from a uint32_t that contains one or more bits from the
+ // lldb::Permissions
+ void SetLLDBPermissions(uint32_t permissions) {
+ m_read = (permissions & lldb::ePermissionsReadable) ? eYes : eNo;
+ m_write = (permissions & lldb::ePermissionsWritable) ? eYes : eNo;
+ m_execute = (permissions & lldb::ePermissionsExecutable) ? eYes : eNo;
+ }
+
+ bool operator==(const MemoryRegionInfo &rhs) const {
+ return m_range == rhs.m_range && m_read == rhs.m_read &&
+ m_write == rhs.m_write && m_execute == rhs.m_execute &&
+ m_mapped == rhs.m_mapped;
+ }
+
+ bool operator!=(const MemoryRegionInfo &rhs) const { return !(*this == rhs); }
+
+protected:
+ RangeType m_range;
+ OptionalBool m_read;
+ OptionalBool m_write;
+ OptionalBool m_execute;
+ OptionalBool m_mapped;
+ ConstString m_name;
+ OptionalBool m_flash;
+ lldb::offset_t m_blocksize;
+};
+
+inline bool operator<(const MemoryRegionInfo &lhs,
+ const MemoryRegionInfo &rhs) {
+ return lhs.GetRange() < rhs.GetRange();
+}
+
+inline bool operator<(const MemoryRegionInfo &lhs, lldb::addr_t rhs) {
+ return lhs.GetRange().GetRangeBase() < rhs;
+}
+
+inline bool operator<(lldb::addr_t lhs, const MemoryRegionInfo &rhs) {
+ return lhs < rhs.GetRange().GetRangeBase();
+}
+
+// Forward-declarable wrapper.
+class MemoryRegionInfos : public std::vector<lldb_private::MemoryRegionInfo> {
+public:
+ using std::vector<lldb_private::MemoryRegionInfo>::vector;
+};
+
+}
+
+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/linux-x64/clang/include/lldb/Target/ModuleCache.h b/linux-x64/clang/include/lldb/Target/ModuleCache.h
new file mode 100644
index 0000000..1196169
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ModuleCache.h
@@ -0,0 +1,74 @@
+//===-- ModuleCache.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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"
+/// 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/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h b/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h
new file mode 100644
index 0000000..1fc8744
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h
@@ -0,0 +1,427 @@
+//===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ObjCLanguageRuntime_h_
+#define liblldb_ObjCLanguageRuntime_h_
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <unordered_set>
+
+#include "llvm/Support/Casting.h"
+
+#include "lldb/Breakpoint/BreakpointPrecondition.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/ThreadSafeDenseMap.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/lldb-private.h"
+
+class CommandObjectObjC_ClassTable_Dump;
+
+namespace lldb_private {
+
+class UtilityFunction;
+
+class ObjCLanguageRuntime : public LanguageRuntime {
+public:
+ enum class ObjCRuntimeVersions {
+ eObjC_VersionUnknown = 0,
+ eAppleObjC_V1 = 1,
+ eAppleObjC_V2 = 2
+ };
+
+ typedef lldb::addr_t ObjCISA;
+
+ class ClassDescriptor;
+ typedef std::shared_ptr<ClassDescriptor> ClassDescriptorSP;
+
+ // the information that we want to support retrieving from an ObjC class this
+ // needs to be pure virtual since there are at least 2 different
+ // implementations of the runtime, and more might come
+ class ClassDescriptor {
+ public:
+ ClassDescriptor()
+ : m_is_kvo(eLazyBoolCalculate), m_is_cf(eLazyBoolCalculate),
+ m_type_wp() {}
+
+ virtual ~ClassDescriptor() = default;
+
+ virtual ConstString GetClassName() = 0;
+
+ virtual ClassDescriptorSP GetSuperclass() = 0;
+
+ virtual ClassDescriptorSP GetMetaclass() const = 0;
+
+ // virtual if any implementation has some other version-specific rules but
+ // for the known v1/v2 this is all that needs to be done
+ virtual bool IsKVO() {
+ if (m_is_kvo == eLazyBoolCalculate) {
+ const char *class_name = GetClassName().AsCString();
+ if (class_name && *class_name)
+ m_is_kvo =
+ (LazyBool)(strstr(class_name, "NSKVONotifying_") == class_name);
+ }
+ return (m_is_kvo == eLazyBoolYes);
+ }
+
+ // virtual if any implementation has some other version-specific rules but
+ // for the known v1/v2 this is all that needs to be done
+ virtual bool IsCFType() {
+ if (m_is_cf == eLazyBoolCalculate) {
+ const char *class_name = GetClassName().AsCString();
+ if (class_name && *class_name)
+ m_is_cf = (LazyBool)(strcmp(class_name, "__NSCFType") == 0 ||
+ strcmp(class_name, "NSCFType") == 0);
+ }
+ return (m_is_cf == eLazyBoolYes);
+ }
+
+ virtual bool IsValid() = 0;
+
+ virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
+ uint64_t *value_bits = nullptr,
+ uint64_t *payload = nullptr) = 0;
+
+ virtual uint64_t GetInstanceSize() = 0;
+
+ // use to implement version-specific additional constraints on pointers
+ virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const {
+ return true;
+ }
+
+ virtual ObjCISA GetISA() = 0;
+
+ // This should return true iff the interface could be completed
+ virtual bool
+ Describe(std::function<void(ObjCISA)> const &superclass_func,
+ std::function<bool(const char *, const char *)> const
+ &instance_method_func,
+ std::function<bool(const char *, const char *)> const
+ &class_method_func,
+ std::function<bool(const char *, const char *, lldb::addr_t,
+ uint64_t)> const &ivar_func) const {
+ return false;
+ }
+
+ lldb::TypeSP GetType() { return m_type_wp.lock(); }
+
+ void SetType(const lldb::TypeSP &type_sp) { m_type_wp = type_sp; }
+
+ struct iVarDescriptor {
+ ConstString m_name;
+ CompilerType m_type;
+ uint64_t m_size;
+ int32_t m_offset;
+ };
+
+ virtual size_t GetNumIVars() { return 0; }
+
+ virtual iVarDescriptor GetIVarAtIndex(size_t idx) {
+ return iVarDescriptor();
+ }
+
+ protected:
+ bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size,
+ bool allow_NULLs = false, bool allow_tagged = false,
+ bool check_version_specific = false) const;
+
+ private:
+ LazyBool m_is_kvo;
+ LazyBool m_is_cf;
+ lldb::TypeWP m_type_wp;
+ };
+
+ class EncodingToType {
+ public:
+ virtual ~EncodingToType();
+
+ virtual CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name,
+ bool for_expression);
+ virtual CompilerType RealizeType(const char *name, bool for_expression);
+
+ virtual CompilerType RealizeType(clang::ASTContext &ast_ctx,
+ const char *name, bool for_expression) = 0;
+
+ protected:
+ std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_up;
+ };
+
+ class ObjCExceptionPrecondition : public BreakpointPrecondition {
+ public:
+ ObjCExceptionPrecondition();
+
+ ~ObjCExceptionPrecondition() override = default;
+
+ bool EvaluatePrecondition(StoppointCallbackContext &context) override;
+ void GetDescription(Stream &stream, lldb::DescriptionLevel level) override;
+ Status ConfigurePrecondition(Args &args) override;
+
+ protected:
+ void AddClassName(const char *class_name);
+
+ private:
+ std::unordered_set<std::string> m_class_names;
+ };
+
+ static lldb::BreakpointPreconditionSP
+ GetBreakpointExceptionPrecondition(lldb::LanguageType language,
+ bool throw_bp);
+
+ class TaggedPointerVendor {
+ public:
+ virtual ~TaggedPointerVendor() = default;
+
+ virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr) = 0;
+
+ virtual ObjCLanguageRuntime::ClassDescriptorSP
+ GetClassDescriptor(lldb::addr_t ptr) = 0;
+
+ protected:
+ TaggedPointerVendor() = default;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
+ };
+
+ ~ObjCLanguageRuntime() override;
+
+ static char ID;
+
+ bool isA(const void *ClassID) const override {
+ return ClassID == &ID || LanguageRuntime::isA(ClassID);
+ }
+
+ static bool classof(const LanguageRuntime *runtime) {
+ return runtime->isA(&ID);
+ }
+
+ static ObjCLanguageRuntime *Get(Process &process) {
+ return llvm::cast_or_null<ObjCLanguageRuntime>(
+ process.GetLanguageRuntime(lldb::eLanguageTypeObjC));
+ }
+
+ virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; }
+
+ typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
+
+ virtual EncodingToTypeSP GetEncodingToType();
+
+ virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value);
+
+ ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value);
+
+ virtual ClassDescriptorSP
+ GetClassDescriptorFromClassName(ConstString class_name);
+
+ virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa);
+
+ ClassDescriptorSP GetNonKVOClassDescriptor(ObjCISA isa);
+
+ lldb::LanguageType GetLanguageType() const override {
+ return lldb::eLanguageTypeObjC;
+ }
+
+ virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
+
+ virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
+
+ virtual bool HasReadObjCLibrary() = 0;
+
+ lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
+
+ void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
+ lldb::addr_t impl_addr);
+
+ TypeAndOrName LookupInClassNameCache(lldb::addr_t class_addr);
+
+ void AddToClassNameCache(lldb::addr_t class_addr, const char *name,
+ lldb::TypeSP type_sp);
+
+ void AddToClassNameCache(lldb::addr_t class_addr,
+ const TypeAndOrName &class_or_type_name);
+
+ lldb::TypeSP LookupInCompleteClassCache(ConstString &name);
+
+ virtual UtilityFunction *CreateObjectChecker(const char *) = 0;
+
+ virtual ObjCRuntimeVersions GetRuntimeVersion() const {
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
+ }
+
+ bool IsValidISA(ObjCISA isa) {
+ UpdateISAToDescriptorMap();
+ return m_isa_to_descriptor.count(isa) > 0;
+ }
+
+ virtual void UpdateISAToDescriptorMapIfNeeded() = 0;
+
+ void UpdateISAToDescriptorMap() {
+ if (m_process && m_process->GetStopID() != m_isa_to_descriptor_stop_id) {
+ UpdateISAToDescriptorMapIfNeeded();
+ }
+ }
+
+ virtual ObjCISA GetISA(ConstString name);
+
+ virtual ConstString GetActualTypeName(ObjCISA isa);
+
+ virtual ObjCISA GetParentClass(ObjCISA isa);
+
+ // Finds the byte offset of the child_type ivar in parent_type. If it can't
+ // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
+
+ virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type,
+ const char *ivar_name);
+
+ bool HasNewLiteralsAndIndexing() {
+ if (m_has_new_literals_and_indexing == eLazyBoolCalculate) {
+ if (CalculateHasNewLiteralsAndIndexing())
+ m_has_new_literals_and_indexing = eLazyBoolYes;
+ else
+ m_has_new_literals_and_indexing = eLazyBoolNo;
+ }
+
+ return (m_has_new_literals_and_indexing == eLazyBoolYes);
+ }
+
+ void SymbolsDidLoad(const ModuleList &module_list) override {
+ m_negative_complete_class_cache.clear();
+ }
+
+ bool GetTypeBitSize(const CompilerType &compiler_type,
+ uint64_t &size) override;
+
+ /// Check whether the name is "self" or "_cmd" and should show up in
+ /// "frame variable".
+ bool IsWhitelistedRuntimeValue(ConstString name) override;
+
+protected:
+ // Classes that inherit from ObjCLanguageRuntime can see and modify these
+ ObjCLanguageRuntime(Process *process);
+
+ virtual bool CalculateHasNewLiteralsAndIndexing() { return false; }
+
+ bool ISAIsCached(ObjCISA isa) const {
+ return m_isa_to_descriptor.find(isa) != m_isa_to_descriptor.end();
+ }
+
+ bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp) {
+ if (isa != 0) {
+ m_isa_to_descriptor[isa] = descriptor_sp;
+ return true;
+ }
+ return false;
+ }
+
+ bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
+ const char *class_name);
+
+ bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
+ uint32_t class_name_hash) {
+ if (isa != 0) {
+ m_isa_to_descriptor[isa] = descriptor_sp;
+ m_hash_to_isa_map.insert(std::make_pair(class_name_hash, isa));
+ return true;
+ }
+ return false;
+ }
+
+private:
+ // We keep a map of <Class,Selector>->Implementation so we don't have to call
+ // the resolver function over and over.
+
+ // FIXME: We need to watch for the loading of Protocols, and flush the cache
+ // for any
+ // class that we see so changed.
+
+ struct ClassAndSel {
+ ClassAndSel() {
+ sel_addr = LLDB_INVALID_ADDRESS;
+ class_addr = LLDB_INVALID_ADDRESS;
+ }
+
+ ClassAndSel(lldb::addr_t in_sel_addr, lldb::addr_t in_class_addr)
+ : class_addr(in_class_addr), sel_addr(in_sel_addr) {}
+
+ bool operator==(const ClassAndSel &rhs) {
+ if (class_addr == rhs.class_addr && sel_addr == rhs.sel_addr)
+ return true;
+ else
+ return false;
+ }
+
+ bool operator<(const ClassAndSel &rhs) const {
+ if (class_addr < rhs.class_addr)
+ return true;
+ else if (class_addr > rhs.class_addr)
+ return false;
+ else {
+ if (sel_addr < rhs.sel_addr)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ lldb::addr_t class_addr;
+ lldb::addr_t sel_addr;
+ };
+
+ typedef std::map<ClassAndSel, lldb::addr_t> MsgImplMap;
+ typedef std::map<ObjCISA, ClassDescriptorSP> ISAToDescriptorMap;
+ typedef std::multimap<uint32_t, ObjCISA> HashToISAMap;
+ typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
+ typedef HashToISAMap::iterator HashToISAIterator;
+ typedef ThreadSafeDenseMap<void *, uint64_t> TypeSizeCache;
+
+ MsgImplMap m_impl_cache;
+ LazyBool m_has_new_literals_and_indexing;
+ ISAToDescriptorMap m_isa_to_descriptor;
+ HashToISAMap m_hash_to_isa_map;
+ TypeSizeCache m_type_size_cache;
+
+protected:
+ uint32_t m_isa_to_descriptor_stop_id;
+
+ typedef std::map<ConstString, lldb::TypeWP> CompleteClassMap;
+ CompleteClassMap m_complete_class_cache;
+
+ struct ConstStringSetHelpers {
+ size_t operator()(ConstString arg) const // for hashing
+ {
+ return (size_t)arg.GetCString();
+ }
+ bool operator()(ConstString arg1,
+ ConstString arg2) const // for equality
+ {
+ return arg1.operator==(arg2);
+ }
+ };
+ typedef std::unordered_set<ConstString, ConstStringSetHelpers,
+ ConstStringSetHelpers>
+ CompleteClassSet;
+ CompleteClassSet m_negative_complete_class_cache;
+
+ ISAToDescriptorIterator GetDescriptorIterator(ConstString name);
+
+ friend class ::CommandObjectObjC_ClassTable_Dump;
+
+ std::pair<ISAToDescriptorIterator, ISAToDescriptorIterator>
+ GetDescriptorIteratorPair(bool update_if_needed = true);
+
+ void ReadObjCLibraryIfNeeded(const ModuleList &module_list);
+
+ DISALLOW_COPY_AND_ASSIGN(ObjCLanguageRuntime);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ObjCLanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/OperatingSystem.h b/linux-x64/clang/include/lldb/Target/OperatingSystem.h
new file mode 100644
index 0000000..c75d1ca
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/OperatingSystem.h
@@ -0,0 +1,78 @@
+//===-- OperatingSystem.h ----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_OperatingSystem_h_
+#define liblldb_OperatingSystem_h_
+
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h"
+/// A plug-in interface definition class for halted OS helpers.
+///
+/// Halted OS plug-ins can be used by any process to locate and create
+/// OS objects, like threads, during the lifetime of a debug session.
+/// This is commonly used when attaching to an operating system that is
+/// halted, such as when debugging over JTAG or connecting to low level kernel
+/// debug services.
+
+class OperatingSystem : public PluginInterface {
+public:
+ /// Find a halted OS plugin for a given process.
+ ///
+ /// Scans the installed OperatingSystem plug-ins and tries to find an
+ /// instance that matches the current target triple and executable.
+ ///
+ /// \param[in] process
+ /// The process for which to try and locate a halted OS
+ /// plug-in instance.
+ ///
+ /// \param[in] plugin_name
+ /// An optional name of a specific halted OS plug-in that
+ /// should be used. If NULL, pick the best plug-in.
+ static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
+
+ // Class Methods
+ OperatingSystem(Process *process);
+
+ ~OperatingSystem() override;
+
+ // Plug-in Methods
+ virtual bool UpdateThreadList(ThreadList &old_thread_list,
+ ThreadList &real_thread_list,
+ ThreadList &new_thread_list) = 0;
+
+ virtual void ThreadWasSelected(Thread *thread) = 0;
+
+ virtual lldb::RegisterContextSP
+ CreateRegisterContextForThread(Thread *thread,
+ lldb::addr_t reg_data_addr) = 0;
+
+ virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread) = 0;
+
+ virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) {
+ return lldb::ThreadSP();
+ }
+
+ virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp);
+
+protected:
+ // Member variables.
+ Process
+ *m_process; ///< The process that this dynamic loader plug-in is tracking.
+private:
+ DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_OperatingSystem_h_
diff --git a/linux-x64/clang/include/lldb/Target/PathMappingList.h b/linux-x64/clang/include/lldb/Target/PathMappingList.h
new file mode 100644
index 0000000..d175966
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/PathMappingList.h
@@ -0,0 +1,128 @@
+//===-- PathMappingList.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PathMappingList_h_
+#define liblldb_PathMappingList_h_
+
+#include <map>
+#include <vector>
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Status.h"
+
+namespace lldb_private {
+
+class PathMappingList {
+public:
+ typedef void (*ChangedCallback)(const PathMappingList &path_list,
+ void *baton);
+
+ // Constructors and Destructors
+ PathMappingList();
+
+ PathMappingList(ChangedCallback callback, void *callback_baton);
+
+ PathMappingList(const PathMappingList &rhs);
+
+ ~PathMappingList();
+
+ const PathMappingList &operator=(const PathMappingList &rhs);
+
+ void Append(ConstString path, ConstString replacement,
+ bool notify);
+
+ void Append(const PathMappingList &rhs, bool notify);
+
+ void Clear(bool notify);
+
+ // By default, dump all pairs.
+ void Dump(Stream *s, int pair_index = -1);
+
+ bool IsEmpty() const { return m_pairs.empty(); }
+
+ size_t GetSize() const { return m_pairs.size(); }
+
+ bool GetPathsAtIndex(uint32_t idx, ConstString &path,
+ ConstString &new_path) const;
+
+ void Insert(ConstString path, ConstString replacement,
+ uint32_t insert_idx, bool notify);
+
+ bool Remove(size_t index, bool notify);
+
+ bool Remove(ConstString path, bool notify);
+
+ bool Replace(ConstString path, ConstString replacement,
+ bool notify);
+
+ bool Replace(ConstString path, ConstString replacement,
+ uint32_t index, bool notify);
+ bool RemapPath(ConstString path, ConstString &new_path) const;
+
+ /// Remaps a source file given \a path into \a new_path.
+ ///
+ /// Remaps \a path if any source remappings match. This function
+ /// does NOT stat the file system so it can be used in tight loops
+ /// where debug info is being parsed.
+ ///
+ /// \param[in] path
+ /// The original source file path to try and remap.
+ ///
+ /// \param[out] new_path
+ /// The newly remapped filespec that is may or may not exist.
+ ///
+ /// \return
+ /// /b true if \a path was successfully located and \a new_path
+ /// is filled in with a new source path, \b false otherwise.
+ bool RemapPath(llvm::StringRef path, std::string &new_path) const;
+ bool RemapPath(const char *, std::string &) const = delete;
+
+ bool ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const;
+
+ /// Finds a source file given a file spec using the path remappings.
+ ///
+ /// Tries to resolve \a orig_spec by checking the path remappings.
+ /// It makes sure the file exists by checking with the file system,
+ /// so this call can be expensive if the remappings are on a network
+ /// or are even on the local file system, so use this function
+ /// sparingly (not in a tight debug info parsing loop).
+ ///
+ /// \param[in] orig_spec
+ /// The original source file path to try and remap.
+ ///
+ /// \param[out] new_spec
+ /// The newly remapped filespec that is guaranteed to exist.
+ ///
+ /// \return
+ /// /b true if \a orig_spec was successfully located and
+ /// \a new_spec is filled in with an existing file spec,
+ /// \b false otherwise.
+ bool FindFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
+
+ uint32_t FindIndexForPath(ConstString path) const;
+
+ uint32_t GetModificationID() const { return m_mod_id; }
+
+protected:
+ typedef std::pair<ConstString, ConstString> pair;
+ typedef std::vector<pair> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ iterator FindIteratorForPath(ConstString path);
+
+ const_iterator FindIteratorForPath(ConstString path) const;
+
+ collection m_pairs;
+ ChangedCallback m_callback;
+ void *m_callback_baton;
+ uint32_t m_mod_id; // Incremented anytime anything is added or removed.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_PathMappingList_h_
diff --git a/linux-x64/clang/include/lldb/Target/Platform.h b/linux-x64/clang/include/lldb/Target/Platform.h
new file mode 100644
index 0000000..3ba58c0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Platform.h
@@ -0,0 +1,1063 @@
+//===-- Platform.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Platform_h_
+#define liblldb_Platform_h_
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Timeout.h"
+#include "lldb/Utility/UserIDResolver.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-public.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+class ProcessInstanceInfo;
+class ProcessInstanceInfoList;
+class ProcessInstanceInfoMatch;
+
+class ModuleCache;
+enum MmapFlags { eMmapFlagsPrivate = 1, eMmapFlagsAnon = 2 };
+
+class PlatformProperties : public Properties {
+public:
+ PlatformProperties();
+
+ static ConstString GetSettingName();
+
+ bool GetUseModuleCache() const;
+ bool SetUseModuleCache(bool use_module_cache);
+
+ FileSpec GetModuleCacheDirectory() const;
+ bool SetModuleCacheDirectory(const FileSpec &dir_spec);
+};
+
+typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
+typedef llvm::SmallVector<lldb::addr_t, 6> MmapArgList;
+
+/// \class Platform Platform.h "lldb/Target/Platform.h"
+/// A plug-in interface definition class for debug platform that
+/// includes many platform abilities such as:
+/// \li getting platform information such as supported architectures,
+/// supported binary file formats and more
+/// \li launching new processes
+/// \li attaching to existing processes
+/// \li download/upload files
+/// \li execute shell commands
+/// \li listing and getting info for existing processes
+/// \li attaching and possibly debugging the platform's kernel
+class Platform : public PluginInterface {
+public:
+ /// Default Constructor
+ Platform(bool is_host_platform);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// from by the plug-in instance.
+ ~Platform() override;
+
+ static void Initialize();
+
+ static void Terminate();
+
+ static const PlatformPropertiesSP &GetGlobalPlatformProperties();
+
+ /// Get the native host platform plug-in.
+ ///
+ /// There should only be one of these for each host that LLDB runs upon that
+ /// should be statically compiled in and registered using preprocessor
+ /// macros or other similar build mechanisms in a
+ /// PlatformSubclass::Initialize() function.
+ ///
+ /// This platform will be used as the default platform when launching or
+ /// attaching to processes unless another platform is specified.
+ static lldb::PlatformSP GetHostPlatform();
+
+ static lldb::PlatformSP
+ GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr);
+
+ static const char *GetHostPlatformName();
+
+ static void SetHostPlatform(const lldb::PlatformSP &platform_sp);
+
+ // Find an existing platform plug-in by name
+ static lldb::PlatformSP Find(ConstString name);
+
+ static lldb::PlatformSP Create(ConstString name, Status &error);
+
+ static lldb::PlatformSP Create(const ArchSpec &arch,
+ ArchSpec *platform_arch_ptr, Status &error);
+
+ /// Augments the triple either with information from platform or the host
+ /// system (if platform is null).
+ static ArchSpec GetAugmentedArchSpec(Platform *platform,
+ llvm::StringRef triple);
+
+ /// Find a platform plugin for a given process.
+ ///
+ /// Scans the installed Platform plug-ins and tries to find an instance that
+ /// can be used for \a process
+ ///
+ /// \param[in] process
+ /// The process for which to try and locate a platform
+ /// plug-in instance.
+ ///
+ /// \param[in] plugin_name
+ /// An optional name of a specific platform plug-in that
+ /// should be used. If nullptr, pick the best plug-in.
+ // static lldb::PlatformSP
+ // FindPlugin (Process *process, ConstString plugin_name);
+
+ /// Set the target's executable based off of the existing architecture
+ /// information in \a target given a path to an executable \a exe_file.
+ ///
+ /// Each platform knows the architectures that it supports and can select
+ /// the correct architecture slice within \a exe_file by inspecting the
+ /// architecture in \a target. If the target had an architecture specified,
+ /// then in can try and obey that request and optionally fail if the
+ /// architecture doesn't match up. If no architecture is specified, the
+ /// platform should select the default architecture from \a exe_file. Any
+ /// application bundles or executable wrappers can also be inspected for the
+ /// actual application binary within the bundle that should be used.
+ ///
+ /// \return
+ /// Returns \b true if this Platform plug-in was able to find
+ /// a suitable executable, \b false otherwise.
+ 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.
+ ///
+ /// Each platform might have tricks to find symbol files for an executable
+ /// given information in a symbol file ModuleSpec. Some platforms might also
+ /// support symbol files that are bundles and know how to extract the right
+ /// symbol file given a bundle.
+ ///
+ /// \param[in] target
+ /// The target in which we are trying to resolve the symbol file.
+ /// The target has a list of modules that we might be able to
+ /// use in order to help find the right symbol file. If the
+ /// "m_file" or "m_platform_file" entries in the \a sym_spec
+ /// are filled in, then we might be able to locate a module in
+ /// the target, extract its UUID and locate a symbol file.
+ /// If just the "m_uuid" is specified, then we might be able
+ /// to find the module in the target that matches that UUID
+ /// and pair the symbol file along with it. If just "m_symbol_file"
+ /// is specified, we can use a variety of tricks to locate the
+ /// symbols in an SDK, PDK, or other development kit location.
+ ///
+ /// \param[in] sym_spec
+ /// A module spec that describes some information about the
+ /// symbol file we are trying to resolve. The ModuleSpec might
+ /// contain the following:
+ /// m_file - A full or partial path to an executable from the
+ /// target (might be empty).
+ /// m_platform_file - Another executable hint that contains
+ /// the path to the file as known on the
+ /// local/remote platform.
+ /// m_symbol_file - A full or partial path to a symbol file
+ /// or symbol bundle that should be used when
+ /// trying to resolve the symbol file.
+ /// m_arch - The architecture we are looking for when resolving
+ /// the symbol file.
+ /// m_uuid - The UUID of the executable and symbol file. This
+ /// can often be used to match up an executable with
+ /// a symbol file, or resolve an symbol file in a
+ /// symbol file bundle.
+ ///
+ /// \param[out] sym_file
+ /// The resolved symbol file spec if the returned error
+ /// indicates success.
+ ///
+ /// \return
+ /// Returns an error that describes success or failure.
+ virtual Status ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec,
+ FileSpec &sym_file);
+
+ /// Resolves the FileSpec to a (possibly) remote path. Remote platforms must
+ /// override this to resolve to a path on the remote side.
+ virtual bool ResolveRemotePath(const FileSpec &platform_path,
+ FileSpec &resolved_platform_path);
+
+ /// Get the OS version from a connected platform.
+ ///
+ /// Some platforms might not be connected to a remote platform, but can
+ /// figure out the OS version for a process. This is common for simulator
+ /// platforms that will run native programs on the current host, but the
+ /// simulator might be simulating a different OS. The \a process parameter
+ /// might be specified to help to determine the OS version.
+ virtual llvm::VersionTuple GetOSVersion(Process *process = nullptr);
+
+ bool SetOSVersion(llvm::VersionTuple os_version);
+
+ bool GetOSBuildString(std::string &s);
+
+ bool GetOSKernelDescription(std::string &s);
+
+ // Returns the name of the platform
+ ConstString GetName();
+
+ virtual const char *GetHostname();
+
+ virtual ConstString GetFullNameForDylib(ConstString basename);
+
+ virtual const char *GetDescription() = 0;
+
+ /// Report the current status for this platform.
+ ///
+ /// The returned string usually involves returning the OS version (if
+ /// available), and any SDK directory that might be being used for local
+ /// file caching, and if connected a quick blurb about what this platform is
+ /// connected to.
+ virtual void GetStatus(Stream &strm);
+
+ // Subclasses must be able to fetch the current OS version
+ //
+ // Remote classes must be connected for this to succeed. Local subclasses
+ // don't need to override this function as it will just call the
+ // HostInfo::GetOSVersion().
+ virtual bool GetRemoteOSVersion() { return false; }
+
+ virtual bool GetRemoteOSBuildString(std::string &s) {
+ s.clear();
+ return false;
+ }
+
+ virtual bool GetRemoteOSKernelDescription(std::string &s) {
+ s.clear();
+ return false;
+ }
+
+ // Remote Platform subclasses need to override this function
+ virtual ArchSpec GetRemoteSystemArchitecture() {
+ return ArchSpec(); // Return an invalid architecture
+ }
+
+ virtual FileSpec GetRemoteWorkingDirectory() { return m_working_dir; }
+
+ virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir);
+
+ /// Retrieve the system include directories on this platform for the
+ /// given language.
+ ///
+ /// \param[in] lang
+ /// The language for which the include directories should be queried.
+ ///
+ /// \param[out] directories
+ /// The include directories for this system.
+ virtual std::vector<std::string>
+ GetSystemIncludeDirectories(lldb::LanguageType lang) {
+ return {};
+ }
+
+ virtual UserIDResolver &GetUserIDResolver() = 0;
+
+ /// Locate a file for a platform.
+ ///
+ /// The default implementation of this function will return the same file
+ /// patch in \a local_file as was in \a platform_file.
+ ///
+ /// \param[in] platform_file
+ /// The platform file path to locate and cache locally.
+ ///
+ /// \param[in] uuid_ptr
+ /// If we know the exact UUID of the file we are looking for, it
+ /// can be specified. If it is not specified, we might now know
+ /// the exact file. The UUID is usually some sort of MD5 checksum
+ /// for the file and is sometimes known by dynamic linkers/loaders.
+ /// If the UUID is known, it is best to supply it to platform
+ /// file queries to ensure we are finding the correct file, not
+ /// just a file at the correct path.
+ ///
+ /// \param[out] local_file
+ /// A locally cached version of the platform file. For platforms
+ /// that describe the current host computer, this will just be
+ /// the same file. For remote platforms, this file might come from
+ /// and SDK directory, or might need to be sync'ed over to the
+ /// current machine for efficient debugging access.
+ ///
+ /// \return
+ /// An error object.
+ virtual Status GetFileWithUUID(const FileSpec &platform_file,
+ const UUID *uuid_ptr, FileSpec &local_file);
+
+ // Locate the scripting resource given a module specification.
+ //
+ // Locating the file should happen only on the local computer or using the
+ // current computers global settings.
+ virtual FileSpecList
+ LocateExecutableScriptingResources(Target *target, Module &module,
+ Stream *feedback_stream);
+
+ 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 Status ConnectRemote(Args &args);
+
+ virtual Status DisconnectRemote();
+
+ /// Get the platform's supported architectures in the order in which they
+ /// should be searched.
+ ///
+ /// \param[in] idx
+ /// A zero based architecture index
+ ///
+ /// \param[out] arch
+ /// A copy of the architecture at index if the return value is
+ /// \b true.
+ ///
+ /// \return
+ /// \b true if \a arch was filled in and is valid, \b false
+ /// otherwise.
+ virtual bool GetSupportedArchitectureAtIndex(uint32_t idx,
+ ArchSpec &arch) = 0;
+
+ virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target,
+ BreakpointSite *bp_site);
+
+ /// Launch a new process on a platform, not necessarily for debugging, it
+ /// could be just for running the process.
+ virtual Status LaunchProcess(ProcessLaunchInfo &launch_info);
+
+ /// Perform expansion of the command-line for this launch info This can
+ /// potentially involve wildcard expansion
+ /// environment variable replacement, and whatever other
+ /// argument magic the platform defines as part of its typical
+ /// user experience
+ virtual Status ShellExpandArguments(ProcessLaunchInfo &launch_info);
+
+ /// Kill process on a platform.
+ virtual Status KillProcess(const lldb::pid_t pid);
+
+ /// Lets a platform answer if it is compatible with a given architecture and
+ /// the target triple contained within.
+ virtual bool IsCompatibleArchitecture(const ArchSpec &arch,
+ bool exact_arch_match,
+ ArchSpec *compatible_arch_ptr);
+
+ /// Not all platforms will support debugging a process by spawning somehow
+ /// halted for a debugger (specified using the "eLaunchFlagDebug" launch
+ /// flag) and then attaching. If your platform doesn't support this,
+ /// override this function and return false.
+ virtual bool CanDebugProcess() { return true; }
+
+ /// Subclasses do not need to implement this function as it uses the
+ /// Platform::LaunchProcess() followed by Platform::Attach (). Remote
+ /// platforms will want to subclass this function in order to be able to
+ /// intercept STDIO and possibly launch a separate process that will debug
+ /// the debuggee.
+ virtual lldb::ProcessSP
+ DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger,
+ Target *target, // Can be nullptr, if nullptr create a new
+ // target, else use existing one
+ Status &error);
+
+ virtual lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
+ llvm::StringRef plugin_name,
+ lldb_private::Debugger &debugger,
+ lldb_private::Target *target,
+ lldb_private::Status &error);
+
+ /// Attach to an existing process using a process ID.
+ ///
+ /// Each platform subclass needs to implement this function and attempt to
+ /// attach to the process with the process ID of \a pid. The platform
+ /// subclass should return an appropriate ProcessSP subclass that is
+ /// attached to the process, or an empty shared pointer with an appropriate
+ /// error.
+ ///
+ /// \param[in] pid
+ /// The process ID that we should attempt to attach to.
+ ///
+ /// \return
+ /// An appropriate ProcessSP containing a valid shared pointer
+ /// to the default Process subclass for the platform that is
+ /// attached to the process, or an empty shared pointer with an
+ /// appropriate error fill into the \a error object.
+ virtual lldb::ProcessSP Attach(ProcessAttachInfo &attach_info,
+ Debugger &debugger,
+ Target *target, // Can be nullptr, if nullptr
+ // create a new target, else
+ // use existing one
+ Status &error) = 0;
+
+ /// Attach to an existing process by process name.
+ ///
+ /// This function is not meant to be overridden by Process subclasses. It
+ /// will first call Process::WillAttach (const char *) and if that returns
+ /// \b true, Process::DoAttach (const char *) will be called to actually do
+ /// the attach. If DoAttach returns \b true, then Process::DidAttach() will
+ /// be called.
+ ///
+ /// \param[in] process_name
+ /// A process name to match against the current process list.
+ ///
+ /// \return
+ /// Returns \a pid if attaching was successful, or
+ /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ // virtual lldb::ProcessSP
+ // Attach (const char *process_name,
+ // bool wait_for_launch,
+ // Status &error) = 0;
+
+ // The base class Platform will take care of the host platform. Subclasses
+ // will need to fill in the remote case.
+ virtual uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &proc_infos);
+
+ virtual bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info);
+
+ // Set a breakpoint on all functions that can end up creating a thread for
+ // this platform. This is needed when running expressions and also for
+ // process control.
+ virtual lldb::BreakpointSP SetThreadCreationBreakpoint(Target &target);
+
+ // Given a target, find the local SDK directory if one exists on the current
+ // host.
+ virtual lldb_private::ConstString
+ GetSDKDirectory(lldb_private::Target &target) {
+ return lldb_private::ConstString();
+ }
+
+ const std::string &GetRemoteURL() const { return m_remote_url; }
+
+ bool IsHost() const {
+ return m_is_host; // Is this the default host platform?
+ }
+
+ bool IsRemote() const { return !m_is_host; }
+
+ virtual bool IsConnected() const {
+ // Remote subclasses should override this function
+ return IsHost();
+ }
+
+ const ArchSpec &GetSystemArchitecture();
+
+ void SetSystemArchitecture(const ArchSpec &arch) {
+ m_system_arch = arch;
+ if (IsHost())
+ m_os_version_set_while_connected = m_system_arch.IsValid();
+ }
+
+ /// If the triple contains not specify the vendor, os, and environment
+ /// parts, we "augment" these using information from the platform and return
+ /// the resulting ArchSpec object.
+ ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
+
+ // Used for column widths
+ size_t GetMaxUserIDNameLength() const { return m_max_uid_name_len; }
+
+ // Used for column widths
+ size_t GetMaxGroupIDNameLength() const { return m_max_gid_name_len; }
+
+ ConstString GetSDKRootDirectory() const { return m_sdk_sysroot; }
+
+ void SetSDKRootDirectory(ConstString dir) { m_sdk_sysroot = dir; }
+
+ ConstString GetSDKBuild() const { return m_sdk_build; }
+
+ void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; }
+
+ // Override this to return true if your platform supports Clang modules. You
+ // may also need to override AddClangModuleCompilationOptions to pass the
+ // right Clang flags for your platform.
+ virtual bool SupportsModules() { return false; }
+
+ // Appends the platform-specific options required to find the modules for the
+ // current platform.
+ virtual void
+ AddClangModuleCompilationOptions(Target *target,
+ std::vector<std::string> &options);
+
+ FileSpec GetWorkingDirectory();
+
+ bool SetWorkingDirectory(const FileSpec &working_dir);
+
+ // There may be modules that we don't want to find by default for operations
+ // like "setting breakpoint by name". The platform will return "true" from
+ // this call if the passed in module happens to be one of these.
+
+ virtual bool
+ ModuleIsExcludedForUnconstrainedSearches(Target &target,
+ const lldb::ModuleSP &module_sp) {
+ return false;
+ }
+
+ virtual Status MakeDirectory(const FileSpec &file_spec, uint32_t permissions);
+
+ virtual Status GetFilePermissions(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, Status &error) {
+ return UINT64_MAX;
+ }
+
+ 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, Status &error) {
+ error.SetErrorStringWithFormat(
+ "Platform::ReadFile() is not supported in the %s platform",
+ GetName().GetCString());
+ return -1;
+ }
+
+ virtual uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset,
+ const void *src, uint64_t src_len, Status &error) {
+ error.SetErrorStringWithFormat(
+ "Platform::WriteFile() is not supported in the %s platform",
+ GetName().GetCString());
+ return -1;
+ }
+
+ virtual Status GetFile(const FileSpec &source, const FileSpec &destination);
+
+ virtual Status PutFile(const FileSpec &source, const FileSpec &destination,
+ uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX);
+
+ virtual Status
+ CreateSymlink(const FileSpec &src, // The name of the link is in src
+ const FileSpec &dst); // The symlink points to dst
+
+ /// Install a file or directory to the remote system.
+ ///
+ /// Install is similar to Platform::PutFile(), but it differs in that if an
+ /// application/framework/shared library is installed on a remote platform
+ /// and the remote platform requires something to be done to register the
+ /// application/framework/shared library, then this extra registration can
+ /// be done.
+ ///
+ /// \param[in] src
+ /// The source file/directory to install on the remote system.
+ ///
+ /// \param[in] dst
+ /// The destination file/directory where \a src will be installed.
+ /// If \a dst has no filename specified, then its filename will
+ /// be set from \a src. It \a dst has no directory specified, it
+ /// will use the platform working directory. If \a dst has a
+ /// directory specified, but the directory path is relative, the
+ /// platform working directory will be prepended to the relative
+ /// directory.
+ ///
+ /// \return
+ /// An error object that describes anything that went wrong.
+ virtual Status Install(const FileSpec &src, const FileSpec &dst);
+
+ virtual Environment GetEnvironment();
+
+ virtual bool GetFileExists(const lldb_private::FileSpec &file_spec);
+
+ virtual Status Unlink(const FileSpec &file_spec);
+
+ 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; }
+
+ virtual void SetSupportsRSync(bool flag) { m_supports_rsync = flag; }
+
+ virtual const char *GetRSyncOpts() { return m_rsync_opts.c_str(); }
+
+ virtual void SetRSyncOpts(const char *opts) { m_rsync_opts.assign(opts); }
+
+ virtual const char *GetRSyncPrefix() { return m_rsync_prefix.c_str(); }
+
+ virtual void SetRSyncPrefix(const char *prefix) {
+ m_rsync_prefix.assign(prefix);
+ }
+
+ virtual bool GetSupportsSSH() { return m_supports_ssh; }
+
+ virtual void SetSupportsSSH(bool flag) { m_supports_ssh = flag; }
+
+ virtual const char *GetSSHOpts() { return m_ssh_opts.c_str(); }
+
+ virtual void SetSSHOpts(const char *opts) { m_ssh_opts.assign(opts); }
+
+ virtual bool GetIgnoresRemoteHostname() { return m_ignores_remote_hostname; }
+
+ virtual void SetIgnoresRemoteHostname(bool flag) {
+ m_ignores_remote_hostname = flag;
+ }
+
+ virtual lldb_private::OptionGroupOptions *
+ GetConnectionOptions(CommandInterpreter &interpreter) {
+ return nullptr;
+ }
+
+ 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
+ int *status_ptr, // Pass nullptr if you don't want the process exit status
+ int *signo_ptr, // Pass nullptr if you don't want the signal that caused
+ // the process to exit
+ std::string
+ *command_output, // Pass nullptr if you don't want the command output
+ const Timeout<std::micro> &timeout);
+
+ virtual void SetLocalCacheDirectory(const char *local);
+
+ virtual const char *GetLocalCacheDirectory();
+
+ virtual std::string GetPlatformSpecificConnectionInformation() { return ""; }
+
+ virtual bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
+ uint64_t &high);
+
+ virtual int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) {
+ return 1;
+ }
+
+ virtual const lldb::UnixSignalsSP &GetRemoteUnixSignals();
+
+ lldb::UnixSignalsSP GetUnixSignals();
+
+ /// Locate a queue name given a thread's qaddr
+ ///
+ /// On a system using libdispatch ("Grand Central Dispatch") style queues, a
+ /// thread may be associated with a GCD queue or not, and a queue may be
+ /// associated with multiple threads. The process/thread must provide a way
+ /// to find the "dispatch_qaddr" for each thread, and from that
+ /// dispatch_qaddr this Platform method will locate the queue name and
+ /// provide that.
+ ///
+ /// \param[in] process
+ /// A process is required for reading memory.
+ ///
+ /// \param[in] dispatch_qaddr
+ /// The dispatch_qaddr for this thread.
+ ///
+ /// \return
+ /// The name of the queue, if there is one. An empty string
+ /// means that this thread is not associated with a dispatch
+ /// queue.
+ virtual std::string
+ GetQueueNameForThreadQAddress(Process *process, lldb::addr_t dispatch_qaddr) {
+ return "";
+ }
+
+ /// Locate a queue ID given a thread's qaddr
+ ///
+ /// On a system using libdispatch ("Grand Central Dispatch") style queues, a
+ /// thread may be associated with a GCD queue or not, and a queue may be
+ /// associated with multiple threads. The process/thread must provide a way
+ /// to find the "dispatch_qaddr" for each thread, and from that
+ /// dispatch_qaddr this Platform method will locate the queue ID and provide
+ /// that.
+ ///
+ /// \param[in] process
+ /// A process is required for reading memory.
+ ///
+ /// \param[in] dispatch_qaddr
+ /// The dispatch_qaddr for this thread.
+ ///
+ /// \return
+ /// The queue_id for this thread, if this thread is associated
+ /// with a dispatch queue. Else LLDB_INVALID_QUEUE_ID is returned.
+ virtual lldb::queue_id_t
+ GetQueueIDForThreadQAddress(Process *process, lldb::addr_t dispatch_qaddr) {
+ return LLDB_INVALID_QUEUE_ID;
+ }
+
+ /// Provide a list of trap handler function names for this platform
+ ///
+ /// The unwinder needs to treat trap handlers specially -- the stack frame
+ /// may not be aligned correctly for a trap handler (the kernel often won't
+ /// perturb the stack pointer, or won't re-align it properly, in the process
+ /// of calling the handler) and the frame above the handler needs to be
+ /// treated by the unwinder's "frame 0" rules instead of its "middle of the
+ /// stack frame" rules.
+ ///
+ /// In a user process debugging scenario, the list of trap handlers is
+ /// typically just "_sigtramp".
+ ///
+ /// The Platform base class provides the m_trap_handlers ivar but it does
+ /// not populate it. Subclasses should add the names of the asynchronous
+ /// signal handler routines as needed. For most Unix platforms, add
+ /// _sigtramp.
+ ///
+ /// \return
+ /// A list of symbol names. The list may be empty.
+ virtual const std::vector<ConstString> &GetTrapHandlerSymbolNames();
+
+ /// Find a support executable that may not live within in the standard
+ /// locations related to LLDB.
+ ///
+ /// Executable might exist within the Platform SDK directories, or in
+ /// standard tool directories within the current IDE that is running LLDB.
+ ///
+ /// \param[in] basename
+ /// The basename of the executable to locate in the current
+ /// platform.
+ ///
+ /// \return
+ /// A FileSpec pointing to the executable on disk, or an invalid
+ /// FileSpec if the executable cannot be found.
+ virtual FileSpec LocateExecutable(const char *basename) { return FileSpec(); }
+
+ /// Allow the platform to set preferred memory cache line size. If non-zero
+ /// (and the user has not set cache line size explicitly), this value will
+ /// be used as the cache line size for memory reads.
+ virtual uint32_t GetDefaultMemoryCacheLineSize() { return 0; }
+
+ /// Load a shared library into this process.
+ ///
+ /// Try and load a shared library into the current process. This call might
+ /// fail in the dynamic loader plug-in says it isn't safe to try and load
+ /// shared libraries at the moment.
+ ///
+ /// \param[in] process
+ /// The process to load the image.
+ ///
+ /// \param[in] local_file
+ /// The file spec that points to the shared library that you want
+ /// to load if the library is located on the host. The library will
+ /// be copied over to the location specified by remote_file or into
+ /// the current working directory with the same filename if the
+ /// remote_file isn't specified.
+ ///
+ /// \param[in] remote_file
+ /// If local_file is specified then the location where the library
+ /// should be copied over from the host. If local_file isn't
+ /// specified, then the path for the shared library on the target
+ /// what you want to load.
+ ///
+ /// \param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// \return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ uint32_t LoadImage(lldb_private::Process *process,
+ const lldb_private::FileSpec &local_file,
+ const lldb_private::FileSpec &remote_file,
+ lldb_private::Status &error);
+
+ /// Load a shared library specified by base name into this process,
+ /// looking by hand along a set of paths.
+ ///
+ /// \param[in] process
+ /// The process to load the image.
+ ///
+ /// \param[in] library_name
+ /// The name of the library to look for. If library_name is an
+ /// absolute path, the basename will be extracted and searched for
+ /// along the paths. This emulates the behavior of the loader when
+ /// given an install name and a set (e.g. DYLD_LIBRARY_PATH provided) of
+ /// alternate paths.
+ ///
+ /// \param[in] path_list
+ /// The list of paths to use to search for the library. First
+ /// match wins.
+ ///
+ /// \param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// \param[out] loaded_path
+ /// If non-null, the path to the dylib that was successfully loaded
+ /// is stored in this path.
+ ///
+ /// \return
+ /// A token that represents the shared library which can be
+ /// passed to UnloadImage. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ uint32_t LoadImageUsingPaths(lldb_private::Process *process,
+ const lldb_private::FileSpec &library_name,
+ const std::vector<std::string> &paths,
+ lldb_private::Status &error,
+ lldb_private::FileSpec *loaded_path);
+
+ virtual uint32_t DoLoadImage(lldb_private::Process *process,
+ const lldb_private::FileSpec &remote_file,
+ const std::vector<std::string> *paths,
+ lldb_private::Status &error,
+ lldb_private::FileSpec *loaded_path = nullptr);
+
+ virtual Status UnloadImage(lldb_private::Process *process,
+ uint32_t image_token);
+
+ /// Connect to all processes waiting for a debugger to attach
+ ///
+ /// If the platform have a list of processes waiting for a debugger to
+ /// connect to them then connect to all of these pending processes.
+ ///
+ /// \param[in] debugger
+ /// The debugger used for the connect.
+ ///
+ /// \param[out] error
+ /// If an error occurred during the connect then this object will
+ /// contain the error message.
+ ///
+ /// \return
+ /// The number of processes we are successfully connected to.
+ virtual size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
+ lldb_private::Status &error);
+
+protected:
+ bool m_is_host;
+ // Set to true when we are able to actually set the OS version while being
+ // connected. For remote platforms, we might set the version ahead of time
+ // before we actually connect and this version might change when we actually
+ // connect to a remote platform. For the host platform this will be set to
+ // the once we call HostInfo::GetOSVersion().
+ bool m_os_version_set_while_connected;
+ bool m_system_arch_set_while_connected;
+ ConstString
+ m_sdk_sysroot; // the root location of where the SDK files are all located
+ ConstString m_sdk_build;
+ FileSpec m_working_dir; // The working directory which is used when installing
+ // modules that have no install path set
+ std::string m_remote_url;
+ std::string m_name;
+ llvm::VersionTuple m_os_version;
+ ArchSpec
+ m_system_arch; // The architecture of the kernel or the remote platform
+ typedef std::map<uint32_t, ConstString> IDToNameMap;
+ // Mutex for modifying Platform data structures that should only be used for
+ // non-reentrant code
+ std::mutex m_mutex;
+ size_t m_max_uid_name_len;
+ size_t m_max_gid_name_len;
+ bool m_supports_rsync;
+ std::string m_rsync_opts;
+ std::string m_rsync_prefix;
+ bool m_supports_ssh;
+ std::string m_ssh_opts;
+ bool m_ignores_remote_hostname;
+ std::string m_local_cache_directory;
+ std::vector<ConstString> m_trap_handlers;
+ bool m_calculated_trap_handlers;
+ const std::unique_ptr<ModuleCache> m_module_cache;
+
+ /// Ask the Platform subclass to fill in the list of trap handler names
+ ///
+ /// For most Unix user process environments, this will be a single function
+ /// name, _sigtramp. More specialized environments may have additional
+ /// handler names. The unwinder code needs to know when a trap handler is
+ /// on the stack because the unwind rules for the frame that caused the trap
+ /// are different.
+ ///
+ /// The base class Platform ivar m_trap_handlers should be updated by the
+ /// Platform subclass when this method is called. If there are no
+ /// predefined trap handlers, this method may be a no-op.
+ virtual void CalculateTrapHandlerSymbolNames() = 0;
+
+ Status GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ virtual Status DownloadModuleSlice(const FileSpec &src_file_spec,
+ const uint64_t src_offset,
+ const uint64_t src_size,
+ 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<Status(const ModuleSpec &)> ModuleResolver;
+
+ 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);
+
+ Status LoadCachedExecutable(const ModuleSpec &module_spec,
+ lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ Platform &remote_platform);
+
+ FileSpec GetModuleCacheRoot();
+
+ DISALLOW_COPY_AND_ASSIGN(Platform);
+};
+
+class PlatformList {
+public:
+ PlatformList() : m_mutex(), m_platforms(), m_selected_platform_sp() {}
+
+ ~PlatformList() = default;
+
+ void Append(const lldb::PlatformSP &platform_sp, bool set_selected) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ m_platforms.push_back(platform_sp);
+ if (set_selected)
+ m_selected_platform_sp = m_platforms.back();
+ }
+
+ size_t GetSize() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ return m_platforms.size();
+ }
+
+ lldb::PlatformSP GetAtIndex(uint32_t idx) {
+ lldb::PlatformSP platform_sp;
+ {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (idx < m_platforms.size())
+ platform_sp = m_platforms[idx];
+ }
+ return platform_sp;
+ }
+
+ /// Select the active platform.
+ ///
+ /// In order to debug remotely, other platform's can be remotely connected
+ /// to and set as the selected platform for any subsequent debugging. This
+ /// allows connection to remote targets and allows the ability to discover
+ /// process info, launch and attach to remote processes.
+ lldb::PlatformSP GetSelectedPlatform() {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (!m_selected_platform_sp && !m_platforms.empty())
+ m_selected_platform_sp = m_platforms.front();
+
+ return m_selected_platform_sp;
+ }
+
+ void SetSelectedPlatform(const lldb::PlatformSP &platform_sp) {
+ if (platform_sp) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ const size_t num_platforms = m_platforms.size();
+ for (size_t idx = 0; idx < num_platforms; ++idx) {
+ if (m_platforms[idx].get() == platform_sp.get()) {
+ m_selected_platform_sp = m_platforms[idx];
+ return;
+ }
+ }
+ m_platforms.push_back(platform_sp);
+ m_selected_platform_sp = m_platforms.back();
+ }
+ }
+
+protected:
+ typedef std::vector<lldb::PlatformSP> collection;
+ mutable std::recursive_mutex m_mutex;
+ collection m_platforms;
+ lldb::PlatformSP m_selected_platform_sp;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(PlatformList);
+};
+
+class OptionGroupPlatformRSync : public lldb_private::OptionGroup {
+public:
+ OptionGroupPlatformRSync() = default;
+
+ ~OptionGroupPlatformRSync() override = default;
+
+ lldb_private::Status
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ // Instance variables to hold the values for command options.
+
+ bool m_rsync;
+ std::string m_rsync_opts;
+ std::string m_rsync_prefix;
+ bool m_ignores_remote_hostname;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformRSync);
+};
+
+class OptionGroupPlatformSSH : public lldb_private::OptionGroup {
+public:
+ OptionGroupPlatformSSH() = default;
+
+ ~OptionGroupPlatformSSH() override = default;
+
+ lldb_private::Status
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ // Instance variables to hold the values for command options.
+
+ bool m_ssh;
+ std::string m_ssh_opts;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformSSH);
+};
+
+class OptionGroupPlatformCaching : public lldb_private::OptionGroup {
+public:
+ OptionGroupPlatformCaching() = default;
+
+ ~OptionGroupPlatformCaching() override = default;
+
+ lldb_private::Status
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ // Instance variables to hold the values for command options.
+
+ std::string m_cache_dir;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformCaching);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Platform_h_
diff --git a/linux-x64/clang/include/lldb/Target/Process.h b/linux-x64/clang/include/lldb/Target/Process.h
new file mode 100644
index 0000000..f85069e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Process.h
@@ -0,0 +1,2858 @@
+//===-- Process.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Process_h_
+#define liblldb_Process_h_
+
+#include "lldb/Host/Config.h"
+
+#include <limits.h>
+
+#include <chrono>
+#include <list>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+#include "lldb/Breakpoint/BreakpointSiteList.h"
+#include "lldb/Core/Communication.h"
+#include "lldb/Core/LoadedModuleInfoList.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/ThreadSafeValue.h"
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Host/HostThread.h"
+#include "lldb/Host/ProcessLaunchInfo.h"
+#include "lldb/Host/ProcessRunLock.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Target/Memory.h"
+#include "lldb/Target/QueueList.h"
+#include "lldb/Target/ThreadList.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Listener.h"
+#include "lldb/Utility/NameMatches.h"
+#include "lldb/Utility/ProcessInfo.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/TraceOptions.h"
+#include "lldb/Utility/UserIDResolver.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/VersionTuple.h"
+
+namespace lldb_private {
+
+template <typename B, typename S> struct Range;
+
+// ProcessProperties
+class ProcessProperties : public Properties {
+public:
+ // Pass nullptr for "process" if the ProcessProperties are to be the global
+ // copy
+ ProcessProperties(lldb_private::Process *process);
+
+ ~ProcessProperties() override;
+
+ bool GetDisableMemoryCache() const;
+ uint64_t GetMemoryCacheLineSize() const;
+ Args GetExtraStartupCommands() const;
+ void SetExtraStartupCommands(const Args &args);
+ FileSpec GetPythonOSPluginPath() const;
+ void SetPythonOSPluginPath(const FileSpec &file);
+ bool GetIgnoreBreakpointsInExpressions() const;
+ void SetIgnoreBreakpointsInExpressions(bool ignore);
+ bool GetUnwindOnErrorInExpressions() const;
+ void SetUnwindOnErrorInExpressions(bool ignore);
+ bool GetStopOnSharedLibraryEvents() const;
+ void SetStopOnSharedLibraryEvents(bool stop);
+ bool GetDetachKeepsStopped() const;
+ void SetDetachKeepsStopped(bool keep_stopped);
+ bool GetWarningsOptimization() const;
+ bool GetStopOnExec() const;
+ std::chrono::seconds GetUtilityExpressionTimeout() const;
+
+protected:
+ static void OptionValueChangedCallback(void *baton,
+ OptionValue *option_value);
+
+ Process *m_process; // Can be nullptr for global ProcessProperties
+};
+
+typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
+
+// ProcessAttachInfo
+//
+// Describes any information that is required to attach to a process.
+
+class ProcessAttachInfo : public ProcessInstanceInfo {
+public:
+ ProcessAttachInfo()
+ : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(),
+ m_plugin_name(), m_resume_count(0), m_wait_for_launch(false),
+ m_ignore_existing(true), m_continue_once_attached(false),
+ m_detach_on_error(true), m_async(false) {}
+
+ ProcessAttachInfo(const ProcessLaunchInfo &launch_info)
+ : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(),
+ m_plugin_name(), m_resume_count(0), m_wait_for_launch(false),
+ m_ignore_existing(true), m_continue_once_attached(false),
+ m_detach_on_error(true), m_async(false) {
+ ProcessInfo::operator=(launch_info);
+ SetProcessPluginName(launch_info.GetProcessPluginName());
+ SetResumeCount(launch_info.GetResumeCount());
+ SetListener(launch_info.GetListener());
+ SetHijackListener(launch_info.GetHijackListener());
+ m_detach_on_error = launch_info.GetDetachOnError();
+ }
+
+ bool GetWaitForLaunch() const { return m_wait_for_launch; }
+
+ void SetWaitForLaunch(bool b) { m_wait_for_launch = b; }
+
+ bool GetAsync() const { return m_async; }
+
+ void SetAsync(bool b) { m_async = b; }
+
+ bool GetIgnoreExisting() const { return m_ignore_existing; }
+
+ void SetIgnoreExisting(bool b) { m_ignore_existing = b; }
+
+ bool GetContinueOnceAttached() const { return m_continue_once_attached; }
+
+ void SetContinueOnceAttached(bool b) { m_continue_once_attached = b; }
+
+ uint32_t GetResumeCount() const { return m_resume_count; }
+
+ void SetResumeCount(uint32_t c) { m_resume_count = c; }
+
+ const char *GetProcessPluginName() const {
+ return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
+ }
+
+ void SetProcessPluginName(llvm::StringRef plugin) { m_plugin_name = plugin; }
+
+ void Clear() {
+ ProcessInstanceInfo::Clear();
+ m_plugin_name.clear();
+ m_resume_count = 0;
+ m_wait_for_launch = false;
+ m_ignore_existing = true;
+ m_continue_once_attached = false;
+ }
+
+ bool ProcessInfoSpecified() const {
+ if (GetExecutableFile())
+ return true;
+ if (GetProcessID() != LLDB_INVALID_PROCESS_ID)
+ return true;
+ if (GetParentProcessID() != LLDB_INVALID_PROCESS_ID)
+ return true;
+ return false;
+ }
+
+ lldb::ListenerSP GetHijackListener() const { return m_hijack_listener_sp; }
+
+ void SetHijackListener(const lldb::ListenerSP &listener_sp) {
+ m_hijack_listener_sp = listener_sp;
+ }
+
+ bool GetDetachOnError() const { return m_detach_on_error; }
+
+ void SetDetachOnError(bool enable) { m_detach_on_error = enable; }
+
+ // Get and set the actual listener that will be used for the process events
+ lldb::ListenerSP GetListener() const { return m_listener_sp; }
+
+ void SetListener(const lldb::ListenerSP &listener_sp) {
+ m_listener_sp = listener_sp;
+ }
+
+ lldb::ListenerSP GetListenerForProcess(Debugger &debugger);
+
+protected:
+ lldb::ListenerSP m_listener_sp;
+ lldb::ListenerSP m_hijack_listener_sp;
+ std::string m_plugin_name;
+ uint32_t m_resume_count; // How many times do we resume after launching
+ bool m_wait_for_launch;
+ bool m_ignore_existing;
+ bool m_continue_once_attached; // Supports the use-case scenario of
+ // immediately continuing the process once
+ // attached.
+ bool m_detach_on_error; // If we are debugging remotely, instruct the stub to
+ // detach rather than killing the target on error.
+ bool m_async; // Use an async attach where we start the attach and return
+ // immediately (used by GUI programs with --waitfor so they can
+ // call SBProcess::Stop() to cancel attach)
+};
+
+class ProcessLaunchCommandOptions : public Options {
+public:
+ ProcessLaunchCommandOptions() : Options() {
+ // Keep default values of all options in one place: OptionParsingStarting
+ // ()
+ OptionParsingStarting(nullptr);
+ }
+
+ ~ProcessLaunchCommandOptions() override = default;
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override {
+ launch_info.Clear();
+ disable_aslr = eLazyBoolCalculate;
+ }
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
+
+ // Instance variables to hold the values for command options.
+
+ ProcessLaunchInfo launch_info;
+ lldb_private::LazyBool disable_aslr;
+};
+
+// This class tracks the Modification state of the process. Things that can
+// currently modify the program are running the program (which will up the
+// StopID) and writing memory (which will up the MemoryID.)
+// FIXME: Should we also include modification of register states?
+
+class ProcessModID {
+ friend bool operator==(const ProcessModID &lhs, const ProcessModID &rhs);
+
+public:
+ ProcessModID()
+ : m_stop_id(0), m_last_natural_stop_id(0), m_resume_id(0), m_memory_id(0),
+ m_last_user_expression_resume(0), m_running_user_expression(false),
+ m_running_utility_function(0) {}
+
+ ProcessModID(const ProcessModID &rhs)
+ : m_stop_id(rhs.m_stop_id), m_memory_id(rhs.m_memory_id) {}
+
+ const ProcessModID &operator=(const ProcessModID &rhs) {
+ if (this != &rhs) {
+ m_stop_id = rhs.m_stop_id;
+ m_memory_id = rhs.m_memory_id;
+ }
+ return *this;
+ }
+
+ ~ProcessModID() = default;
+
+ void BumpStopID() {
+ m_stop_id++;
+ if (!IsLastResumeForUserExpression())
+ m_last_natural_stop_id++;
+ }
+
+ void BumpMemoryID() { m_memory_id++; }
+
+ void BumpResumeID() {
+ m_resume_id++;
+ if (m_running_user_expression > 0)
+ m_last_user_expression_resume = m_resume_id;
+ }
+
+ bool IsRunningUtilityFunction() const {
+ return m_running_utility_function > 0;
+ }
+
+ uint32_t GetStopID() const { return m_stop_id; }
+ uint32_t GetLastNaturalStopID() const { return m_last_natural_stop_id; }
+ uint32_t GetMemoryID() const { return m_memory_id; }
+ uint32_t GetResumeID() const { return m_resume_id; }
+ uint32_t GetLastUserExpressionResumeID() const {
+ return m_last_user_expression_resume;
+ }
+
+ bool MemoryIDEqual(const ProcessModID &compare) const {
+ return m_memory_id == compare.m_memory_id;
+ }
+
+ bool StopIDEqual(const ProcessModID &compare) const {
+ return m_stop_id == compare.m_stop_id;
+ }
+
+ void SetInvalid() { m_stop_id = UINT32_MAX; }
+
+ bool IsValid() const { return m_stop_id != UINT32_MAX; }
+
+ bool IsLastResumeForUserExpression() const {
+ // If we haven't yet resumed the target, then it can't be for a user
+ // expression...
+ if (m_resume_id == 0)
+ return false;
+
+ return m_resume_id == m_last_user_expression_resume;
+ }
+
+ void SetRunningUserExpression(bool on) {
+ if (on)
+ m_running_user_expression++;
+ else
+ m_running_user_expression--;
+ }
+
+ void SetRunningUtilityFunction(bool on) {
+ if (on)
+ m_running_utility_function++;
+ else {
+ assert(m_running_utility_function > 0 &&
+ "Called SetRunningUtilityFunction(false) without calling "
+ "SetRunningUtilityFunction(true) before?");
+ m_running_utility_function--;
+ }
+ }
+
+ void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) {
+ m_last_natural_stop_event = event_sp;
+ }
+
+ lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
+ if (stop_id == m_last_natural_stop_id)
+ return m_last_natural_stop_event;
+ return lldb::EventSP();
+ }
+
+private:
+ uint32_t m_stop_id;
+ uint32_t m_last_natural_stop_id;
+ uint32_t m_resume_id;
+ uint32_t m_memory_id;
+ uint32_t m_last_user_expression_resume;
+ uint32_t m_running_user_expression;
+ uint32_t m_running_utility_function;
+ lldb::EventSP m_last_natural_stop_event;
+};
+
+inline bool operator==(const ProcessModID &lhs, const ProcessModID &rhs) {
+ if (lhs.StopIDEqual(rhs) && lhs.MemoryIDEqual(rhs))
+ return true;
+ else
+ return false;
+}
+
+inline bool operator!=(const ProcessModID &lhs, const ProcessModID &rhs) {
+ return (!lhs.StopIDEqual(rhs) || !lhs.MemoryIDEqual(rhs));
+}
+
+/// \class Process Process.h "lldb/Target/Process.h"
+/// A plug-in interface definition class for debugging a process.
+class Process : public std::enable_shared_from_this<Process>,
+ public ProcessProperties,
+ public UserID,
+ public Broadcaster,
+ public ExecutionContextScope,
+ 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;
+ friend class ThreadList;
+
+public:
+ /// Broadcaster event bits definitions.
+ enum {
+ eBroadcastBitStateChanged = (1 << 0),
+ eBroadcastBitInterrupt = (1 << 1),
+ eBroadcastBitSTDOUT = (1 << 2),
+ eBroadcastBitSTDERR = (1 << 3),
+ eBroadcastBitProfileData = (1 << 4),
+ eBroadcastBitStructuredData = (1 << 5),
+ };
+
+ enum {
+ eBroadcastInternalStateControlStop = (1 << 0),
+ eBroadcastInternalStateControlPause = (1 << 1),
+ eBroadcastInternalStateControlResume = (1 << 2)
+ };
+
+ /// Process warning types.
+ enum Warnings { eWarningsOptimization = 1 };
+
+ typedef Range<lldb::addr_t, lldb::addr_t> LoadRange;
+ // We use a read/write lock to allow on or more clients to access the process
+ // state while the process is stopped (reader). We lock the write lock to
+ // control access to the process while it is running (readers, or clients
+ // that want the process stopped can block waiting for the process to stop,
+ // or just try to lock it to see if they can immediately access the stopped
+ // process. If the try read lock fails, then the process is running.
+ typedef ProcessRunLock::ProcessRunLocker StopLocker;
+
+ // These two functions fill out the Broadcaster interface:
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+/// A notification structure that can be used by clients to listen
+/// for changes in a process's lifetime.
+///
+/// \see RegisterNotificationCallbacks (const Notifications&) @see
+/// UnregisterNotificationCallbacks (const Notifications&)
+ typedef struct {
+ void *baton;
+ void (*initialize)(void *baton, Process *process);
+ void (*process_state_changed)(void *baton, Process *process,
+ lldb::StateType state);
+ } Notifications;
+
+ class ProcessEventData : public EventData {
+ friend class Process;
+
+ public:
+ ProcessEventData();
+ ProcessEventData(const lldb::ProcessSP &process, lldb::StateType state);
+
+ ~ProcessEventData() override;
+
+ static ConstString GetFlavorString();
+
+ ConstString GetFlavor() const override;
+
+ lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); }
+
+ lldb::StateType GetState() const { return m_state; }
+ bool GetRestarted() const { return m_restarted; }
+
+ size_t GetNumRestartedReasons() { return m_restarted_reasons.size(); }
+
+ const char *GetRestartedReasonAtIndex(size_t idx) {
+ return ((idx < m_restarted_reasons.size())
+ ? m_restarted_reasons[idx].c_str()
+ : nullptr);
+ }
+
+ bool GetInterrupted() const { return m_interrupted; }
+
+ void Dump(Stream *s) const override;
+
+ void DoOnRemoval(Event *event_ptr) override;
+
+ static const Process::ProcessEventData *
+ GetEventDataFromEvent(const Event *event_ptr);
+
+ static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr);
+
+ static lldb::StateType GetStateFromEvent(const Event *event_ptr);
+
+ static bool GetRestartedFromEvent(const Event *event_ptr);
+
+ static size_t GetNumRestartedReasons(const Event *event_ptr);
+
+ static const char *GetRestartedReasonAtIndex(const Event *event_ptr,
+ size_t idx);
+
+ static void AddRestartedReason(Event *event_ptr, const char *reason);
+
+ static void SetRestartedInEvent(Event *event_ptr, bool new_value);
+
+ static bool GetInterruptedFromEvent(const Event *event_ptr);
+
+ static void SetInterruptedInEvent(Event *event_ptr, bool new_value);
+
+ static bool SetUpdateStateOnRemoval(Event *event_ptr);
+
+ private:
+ void SetUpdateStateOnRemoval() { m_update_state++; }
+
+ void SetRestarted(bool new_value) { m_restarted = new_value; }
+
+ void SetInterrupted(bool new_value) { m_interrupted = new_value; }
+
+ void AddRestartedReason(const char *reason) {
+ m_restarted_reasons.push_back(reason);
+ }
+
+ lldb::ProcessWP m_process_wp;
+ lldb::StateType m_state;
+ std::vector<std::string> m_restarted_reasons;
+ bool m_restarted; // For "eStateStopped" events, this is true if the target
+ // was automatically restarted.
+ int m_update_state;
+ bool m_interrupted;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessEventData);
+ };
+
+ /// Construct with a shared pointer to a target, and the Process listener.
+ /// Uses the Host UnixSignalsSP by default.
+ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
+
+ /// Construct with a shared pointer to a target, the Process listener, and
+ /// the appropriate UnixSignalsSP for the process.
+ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
+ const lldb::UnixSignalsSP &unix_signals_sp);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// from by the plug-in instance.
+ ~Process() override;
+
+ static void SettingsInitialize();
+
+ static void SettingsTerminate();
+
+ static const ProcessPropertiesSP &GetGlobalProperties();
+
+ /// Find a Process plug-in that can debug \a module using the currently
+ /// selected architecture.
+ ///
+ /// Scans all loaded plug-in interfaces that implement versions of the
+ /// Process plug-in interface and returns the first instance that can debug
+ /// the file.
+ ///
+ /// \param[in] module_sp
+ /// The module shared pointer that this process will debug.
+ ///
+ /// \param[in] plugin_name
+ /// If nullptr, select the best plug-in for the binary. If non-nullptr
+ /// then look for a plugin whose PluginInfo's name matches
+ /// this string.
+ ///
+ /// \see Process::CanDebug ()
+ static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp,
+ llvm::StringRef plugin_name,
+ lldb::ListenerSP listener_sp,
+ const FileSpec *crash_file_path);
+
+ /// Static function that can be used with the \b host function
+ /// Host::StartMonitoringChildProcess ().
+ ///
+ /// This function can be used by lldb_private::Process subclasses when they
+ /// want to watch for a local process and have its exit status automatically
+ /// set when the host child process exits. Subclasses should call
+ /// Host::StartMonitoringChildProcess () with:
+ /// callback = Process::SetHostProcessExitStatus
+ /// pid = Process::GetID()
+ /// monitor_signals = false
+ static bool
+ SetProcessExitStatus(lldb::pid_t pid, // The process ID we want to monitor
+ bool exited,
+ int signo, // Zero for no signal
+ int status); // Exit value of process if signal is zero
+
+ lldb::ByteOrder GetByteOrder() const;
+
+ uint32_t GetAddressByteSize() const;
+
+ uint32_t GetUniqueID() const { return m_process_unique_id; }
+
+ /// Check if a plug-in instance can debug the file in \a module.
+ ///
+ /// Each plug-in is given a chance to say whether it can debug the file in
+ /// \a module. If the Process plug-in instance can debug a file on the
+ /// current system, it should return \b true.
+ ///
+ /// \return
+ /// Returns \b true if this Process plug-in instance can
+ /// debug the executable, \b false otherwise.
+ virtual bool CanDebug(lldb::TargetSP target,
+ bool plugin_specified_by_name) = 0;
+
+ /// This object is about to be destroyed, do any necessary cleanup.
+ ///
+ /// Subclasses that override this method should always call this superclass
+ /// method.
+ virtual void Finalize();
+
+ /// Return whether this object is valid (i.e. has not been finalized.)
+ ///
+ /// \return
+ /// Returns \b true if this Process has not been finalized
+ /// and \b false otherwise.
+ bool IsValid() const { return !m_finalize_called; }
+
+ /// Return a multi-word command object that can be used to expose plug-in
+ /// specific commands.
+ ///
+ /// This object will be used to resolve plug-in commands and can be
+ /// triggered by a call to:
+ ///
+ /// (lldb) process command <args>
+ ///
+ /// \return
+ /// A CommandObject which can be one of the concrete subclasses
+ /// of CommandObject like CommandObjectRaw, CommandObjectParsed,
+ /// or CommandObjectMultiword.
+ virtual CommandObject *GetPluginCommandObject() { return nullptr; }
+
+ /// Launch a new process.
+ ///
+ /// Launch a new process by spawning a new process using the target object's
+ /// executable module's file as the file to launch.
+ ///
+ /// This function is not meant to be overridden by Process subclasses. It
+ /// will first call Process::WillLaunch (Module *) and if that returns \b
+ /// true, Process::DoLaunch (Module*, char const *[],char const *[],const
+ /// char *,const char *, const char *) will be called to actually do the
+ /// launching. If DoLaunch returns \b true, then Process::DidLaunch() will
+ /// be called.
+ ///
+ /// \param[in] launch_info
+ /// Details regarding the environment, STDIN/STDOUT/STDERR
+ /// redirection, working path, etc. related to the requested launch.
+ ///
+ /// \return
+ /// An error object. Call GetID() to get the process ID if
+ /// the error object is success.
+ virtual Status Launch(ProcessLaunchInfo &launch_info);
+
+ virtual Status LoadCore();
+
+ virtual Status DoLoadCore() {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support loading core files.",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ // FUTURE WORK: GetLoadImageUtilityFunction are the first use we've
+ // had of having other plugins cache data in the Process. This is handy for
+ // long-living plugins - like the Platform - which manage interactions whose
+ // lifetime is governed by the Process lifetime. If we find we need to do
+ // this more often, we should construct a general solution to the problem.
+ // The consensus suggestion was that we have a token based registry in the
+ // Process. Some undecided questions are (1) who manages the tokens. It's
+ // probably best that you add the element and get back a token that
+ // represents it. That will avoid collisions. But there may be some utility
+ // in the registerer controlling the token? (2) whether the thing added
+ // should be simply owned by Process, and just go away when it does (3)
+ // whether the registree should be notified of the Process' demise.
+ //
+ // We are postponing designing this till we have at least a second use case.
+ /// Get the cached UtilityFunction that assists in loading binary images
+ /// into the process.
+ ///
+ /// \param[in] platform
+ /// The platform fetching the UtilityFunction.
+ /// \param[in] factory
+ /// A function that will be called only once per-process in a
+ /// thread-safe way to create the UtilityFunction if it has not
+ /// been initialized yet.
+ ///
+ /// \return
+ /// The cached utility function or null if the platform is not the
+ /// same as the target's platform.
+ UtilityFunction *GetLoadImageUtilityFunction(
+ Platform *platform,
+ llvm::function_ref<std::unique_ptr<UtilityFunction>()> factory);
+
+ /// Get the dynamic loader plug-in for this process.
+ ///
+ /// The default action is to let the DynamicLoader plug-ins check the main
+ /// executable and the DynamicLoader will select itself automatically.
+ /// Subclasses can override this if inspecting the executable is not
+ /// desired, or if Process subclasses can only use a specific DynamicLoader
+ /// plug-in.
+ virtual DynamicLoader *GetDynamicLoader();
+
+ // Returns AUXV structure found in many ELF-based environments.
+ //
+ // The default action is to return an empty data buffer.
+ //
+ // \return
+ // A data extractor containing the contents of the AUXV data.
+ virtual DataExtractor GetAuxvData();
+
+ /// Sometimes processes know how to retrieve and load shared libraries. This
+ /// is normally done by DynamicLoader plug-ins, but sometimes the connection
+ /// to the process allows retrieving this information. The dynamic loader
+ /// plug-ins can use this function if they can't determine the current
+ /// shared library load state.
+ ///
+ /// \return
+ /// The number of shared libraries that were loaded
+ virtual size_t LoadModules() { return 0; }
+
+ virtual size_t LoadModules(LoadedModuleInfoList &) { return 0; }
+
+protected:
+ virtual JITLoaderList &GetJITLoaders();
+
+public:
+ /// Get the system runtime plug-in for this process.
+ ///
+ /// \return
+ /// Returns a pointer to the SystemRuntime plugin for this Process
+ /// if one is available. Else returns nullptr.
+ virtual SystemRuntime *GetSystemRuntime();
+
+ /// Attach to an existing process using the process attach info.
+ ///
+ /// This function is not meant to be overridden by Process subclasses. It
+ /// will first call WillAttach (lldb::pid_t) or WillAttach (const char *),
+ /// and if that returns \b true, DoAttach (lldb::pid_t) or DoAttach (const
+ /// char *) will be called to actually do the attach. If DoAttach returns \b
+ /// true, then Process::DidAttach() will be called.
+ ///
+ /// \param[in] pid
+ /// The process ID that we should attempt to attach to.
+ ///
+ /// \return
+ /// Returns \a pid if attaching was successful, or
+ /// LLDB_INVALID_PROCESS_ID if attaching fails.
+ virtual Status Attach(ProcessAttachInfo &attach_info);
+
+ /// Attach to a remote system via a URL
+ ///
+ /// \param[in] strm
+ /// A stream where output intended for the user
+ /// (if the driver has a way to display that) generated during
+ /// the connection. This may be nullptr if no output is needed.A
+ ///
+ /// \param[in] remote_url
+ /// The URL format that we are connecting to.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status ConnectRemote(Stream *strm, llvm::StringRef remote_url);
+
+ bool GetShouldDetach() const { return m_should_detach; }
+
+ void SetShouldDetach(bool b) { m_should_detach = b; }
+
+ /// Get the image information address for the current process.
+ ///
+ /// Some runtimes have system functions that can help dynamic loaders locate
+ /// the dynamic loader information needed to observe shared libraries being
+ /// loaded or unloaded. This function is in the Process interface (as
+ /// opposed to the DynamicLoader interface) to ensure that remote debugging
+ /// can take advantage of this functionality.
+ ///
+ /// \return
+ /// The address of the dynamic loader information, or
+ /// LLDB_INVALID_ADDRESS if this is not supported by this
+ /// interface.
+ virtual lldb::addr_t GetImageInfoAddress();
+
+ /// Called when the process is about to broadcast a public stop.
+ ///
+ /// There are public and private stops. Private stops are when the process
+ /// is doing things like stepping and the client doesn't need to know about
+ /// starts and stop that implement a thread plan. Single stepping over a
+ /// source line in code might end up being implemented by one or more
+ /// process starts and stops. Public stops are when clients will be notified
+ /// that the process is stopped. These events typically trigger UI updates
+ /// (thread stack frames to be displayed, variables to be displayed, and
+ /// more). This function can be overriden and allows process subclasses to
+ /// do something before the eBroadcastBitStateChanged event is sent to
+ /// public clients.
+ virtual void WillPublicStop() {}
+
+/// Register for process and thread notifications.
+///
+/// Clients can register notification callbacks by filling out a
+/// Process::Notifications structure and calling this function.
+///
+/// \param[in] callbacks
+/// A structure that contains the notification baton and
+/// callback functions.
+///
+/// \see Process::Notifications
+ void RegisterNotificationCallbacks(const Process::Notifications &callbacks);
+
+/// Unregister for process and thread notifications.
+///
+/// Clients can unregister notification callbacks by passing a copy of the
+/// original baton and callbacks in \a callbacks.
+///
+/// \param[in] callbacks
+/// A structure that contains the notification baton and
+/// callback functions.
+///
+/// \return
+/// Returns \b true if the notification callbacks were
+/// successfully removed from the process, \b false otherwise.
+///
+/// \see Process::Notifications
+ bool UnregisterNotificationCallbacks(const Process::Notifications &callbacks);
+
+ //==================================================================
+ // Built in Process Control functions
+ //==================================================================
+ /// Resumes all of a process's threads as configured using the Thread run
+ /// control functions.
+ ///
+ /// Threads for a process should be updated with one of the run control
+ /// actions (resume, step, or suspend) that they should take when the
+ /// process is resumed. If no run control action is given to a thread it
+ /// will be resumed by default.
+ ///
+ /// This function is not meant to be overridden by Process subclasses. This
+ /// function will take care of disabling any breakpoints that threads may be
+ /// stopped at, single stepping, and re-enabling breakpoints, and enabling
+ /// the basic flow control that the plug-in instances need not worry about.
+ ///
+ /// N.B. This function also sets the Write side of the Run Lock, which is
+ /// unset when the corresponding stop event is pulled off the Public Event
+ /// Queue. If you need to resume the process without setting the Run Lock,
+ /// use PrivateResume (though you should only do that from inside the
+ /// Process class.
+ ///
+ /// \return
+ /// Returns an error object.
+ ///
+ /// \see Thread:Resume()
+ /// \see Thread:Step()
+ /// \see Thread:Suspend()
+ Status Resume();
+
+ Status ResumeSynchronous(Stream *stream);
+
+ /// Halts a running process.
+ ///
+ /// This function is not meant to be overridden by Process subclasses. If
+ /// the process is successfully halted, a eStateStopped process event with
+ /// GetInterrupted will be broadcast. If false, we will halt the process
+ /// with no events generated by the halt.
+ ///
+ /// \param[in] clear_thread_plans
+ /// If true, when the process stops, clear all thread plans.
+ ///
+ /// \param[in] use_run_lock
+ /// Whether to release the run lock after the stop.
+ ///
+ /// \return
+ /// Returns an error object. If the error is empty, the process is
+ /// halted.
+ /// otherwise the halt has failed.
+ Status Halt(bool clear_thread_plans = false, bool use_run_lock = true);
+
+ /// Detaches from a running or stopped process.
+ ///
+ /// This function is not meant to be overridden by Process subclasses.
+ ///
+ /// \param[in] keep_stopped
+ /// If true, don't resume the process on detach.
+ ///
+ /// \return
+ /// Returns an error object.
+ Status Detach(bool keep_stopped);
+
+ /// Kills the process and shuts down all threads that were spawned to track
+ /// and monitor the process.
+ ///
+ /// This function is not meant to be overridden by Process subclasses.
+ ///
+ /// \param[in] force_kill
+ /// Whether lldb should force a kill (instead of a detach) from
+ /// the inferior process. Normally if lldb launched a binary and
+ /// Destory is called, lldb kills it. If lldb attached to a
+ /// running process and Destory is called, lldb detaches. If
+ /// this behavior needs to be over-ridden, this is the bool that
+ /// can be used.
+ ///
+ /// \return
+ /// Returns an error object.
+ Status Destroy(bool force_kill);
+
+ /// Sends a process a UNIX signal \a signal.
+ ///
+ /// This function is not meant to be overridden by Process subclasses.
+ ///
+ /// \return
+ /// Returns an error object.
+ Status Signal(int signal);
+
+ void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp);
+
+ const lldb::UnixSignalsSP &GetUnixSignals();
+
+ //==================================================================
+ // Plug-in Process Control Overrides
+ //==================================================================
+
+ /// Called before attaching to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before attaching a process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillAttachToProcessWithID(lldb::pid_t pid) { return Status(); }
+
+ /// Called before attaching to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before attaching a process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillAttachToProcessWithName(const char *process_name,
+ bool wait_for_launch) {
+ return Status();
+ }
+
+ /// Attach to a remote system via a URL
+ ///
+ /// \param[in] strm
+ /// A stream where output intended for the user
+ /// (if the driver has a way to display that) generated during
+ /// the connection. This may be nullptr if no output is needed.A
+ ///
+ /// \param[in] remote_url
+ /// The URL format that we are connecting to.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) {
+ Status error;
+ error.SetErrorString("remote connections are not supported");
+ return error;
+ }
+
+ /// Attach to an existing process using a process ID.
+ ///
+ /// \param[in] pid
+ /// The process ID that we should attempt to attach to.
+ ///
+ /// \param[in] attach_info
+ /// Information on how to do the attach. For example, GetUserID()
+ /// will return the uid to attach as.
+ ///
+ /// \return
+ /// Returns a successful Status attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
+ /// hanming : need flag
+ 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());
+ return error;
+ }
+
+ /// Attach to an existing process using a partial process name.
+ ///
+ /// \param[in] process_name
+ /// The name of the process to attach to.
+ ///
+ /// \param[in] attach_info
+ /// Information on how to do the attach. For example, GetUserID()
+ /// will return the uid to attach as.
+ ///
+ /// \return
+ /// Returns a successful Status attaching was successful, or
+ /// an appropriate (possibly platform-specific) error code if
+ /// attaching fails.
+ virtual Status
+ DoAttachToProcessWithName(const char *process_name,
+ const ProcessAttachInfo &attach_info) {
+ Status error;
+ error.SetErrorString("attach by name is not supported");
+ return error;
+ }
+
+ /// Called after attaching a process.
+ ///
+ /// \param[in] process_arch
+ /// If you can figure out the process architecture after attach, fill it
+ /// in here.
+ ///
+ /// Allow Process plug-ins to execute some code after attaching to a
+ /// process.
+ virtual void DidAttach(ArchSpec &process_arch) { process_arch.Clear(); }
+
+ /// Called after a process re-execs itself.
+ ///
+ /// Allow Process plug-ins to execute some code after a process has exec'ed
+ /// itself. Subclasses typically should override DoDidExec() as the
+ /// lldb_private::Process class needs to remove its dynamic loader, runtime,
+ /// ABI and other plug-ins, as well as unload all shared libraries.
+ virtual void DidExec();
+
+ /// Subclasses of Process should implement this function if they need to do
+ /// anything after a process exec's itself.
+ virtual void DoDidExec() {}
+
+ /// Called before launching to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before launching a process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillLaunch(Module *module) { return Status(); }
+
+ /// Launch a new process.
+ ///
+ /// Launch a new process by spawning a new process using \a exe_module's
+ /// file as the file to launch. Launch details are provided in \a
+ /// launch_info.
+ ///
+ /// \param[in] exe_module
+ /// The module from which to extract the file specification and
+ /// launch.
+ ///
+ /// \param[in] launch_info
+ /// Details (e.g. arguments, stdio redirection, etc.) for the
+ /// requested launch.
+ ///
+ /// \return
+ /// An Status instance indicating success or failure of the
+ /// operation.
+ virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support launching processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ /// Called after launching a process.
+ ///
+ /// Allow Process plug-ins to execute some code after launching a process.
+ virtual void DidLaunch() {}
+
+ /// Called before resuming to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before resuming a process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillResume() { return Status(); }
+
+ /// Resumes all of a process's threads as configured using the Thread run
+ /// control functions.
+ ///
+ /// Threads for a process should be updated with one of the run control
+ /// actions (resume, step, or suspend) that they should take when the
+ /// process is resumed. If no run control action is given to a thread it
+ /// will be resumed by default.
+ ///
+ /// \return
+ /// Returns \b true if the process successfully resumes using
+ /// the thread run control actions, \b false otherwise.
+ ///
+ /// \see Thread:Resume()
+ /// \see Thread:Step()
+ /// \see Thread:Suspend()
+ virtual Status DoResume() {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support resuming processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ /// Called after resuming a process.
+ ///
+ /// Allow Process plug-ins to execute some code after resuming a process.
+ virtual void DidResume() {}
+
+ /// Called before halting to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before halting a process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillHalt() { return Status(); }
+
+ /// Halts a running process.
+ ///
+ /// DoHalt must produce one and only one stop StateChanged event if it
+ /// actually stops the process. If the stop happens through some natural
+ /// event (for instance a SIGSTOP), then forwarding that event will do.
+ /// Otherwise, you must generate the event manually. This function is called
+ /// from the context of the private state thread.
+ ///
+ /// \param[out] caused_stop
+ /// If true, then this Halt caused the stop, otherwise, the
+ /// process was already stopped.
+ ///
+ /// \return
+ /// Returns \b true if the process successfully halts, \b false
+ /// otherwise.
+ virtual Status DoHalt(bool &caused_stop) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support halting processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ /// Called after halting a process.
+ ///
+ /// Allow Process plug-ins to execute some code after halting a process.
+ virtual void DidHalt() {}
+
+ /// Called before detaching from a process.
+ ///
+ /// Allow Process plug-ins to execute some code before detaching from a
+ /// process.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status WillDetach() { return Status(); }
+
+ /// Detaches from a running or stopped process.
+ ///
+ /// \return
+ /// Returns \b true if the process successfully detaches, \b
+ /// false otherwise.
+ virtual Status DoDetach(bool keep_stopped) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support detaching from processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ /// Called after detaching from a process.
+ ///
+ /// Allow Process plug-ins to execute some code after detaching from a
+ /// process.
+ virtual void DidDetach() {}
+
+ virtual bool DetachRequiresHalt() { return false; }
+
+ /// Called before sending a signal to a process.
+ ///
+ /// Allow Process plug-ins to execute some code before sending a signal to a
+ /// process.
+ ///
+ /// \return
+ /// Returns no error if it is safe to proceed with a call to
+ /// Process::DoSignal(int), otherwise an error describing what
+ /// prevents the signal from being sent.
+ virtual Status WillSignal() { return Status(); }
+
+ /// Sends a process a UNIX signal \a signal.
+ ///
+ /// \return
+ /// Returns an error object.
+ virtual Status DoSignal(int signal) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support sending signals to processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ virtual Status WillDestroy() { return Status(); }
+
+ virtual Status DoDestroy() = 0;
+
+ virtual void DidDestroy() {}
+
+ virtual bool DestroyRequiresHalt() { return true; }
+
+ /// Called after sending a signal to a process.
+ ///
+ /// Allow Process plug-ins to execute some code after sending a signal to a
+ /// process.
+ virtual void DidSignal() {}
+
+ /// Currently called as part of ShouldStop.
+ /// FIXME: Should really happen when the target stops before the
+ /// event is taken from the queue...
+ ///
+ /// This callback is called as the event
+ /// is about to be queued up to allow Process plug-ins to execute some code
+ /// prior to clients being notified that a process was stopped. Common
+ /// operations include updating the thread list, invalidating any thread
+ /// state (registers, stack, etc) prior to letting the notification go out.
+ ///
+ virtual void RefreshStateAfterStop() = 0;
+
+ /// Sometimes the connection to a process can detect the host OS version
+ /// that the process is running on. The current platform should be checked
+ /// first in case the platform is connected, but clients can fall back onto
+ /// this function if the platform fails to identify the host OS version. The
+ /// platform should be checked first in case you are running a simulator
+ /// platform that might itself be running natively, but have different
+ /// heuristics for figuring out which OS is is emulating.
+ ///
+ /// \return
+ /// Returns the version tuple of the host OS. In case of failure an empty
+ /// VersionTuple is returner.
+ virtual llvm::VersionTuple GetHostOSVersion() { return llvm::VersionTuple(); }
+
+ /// Get the target object pointer for this module.
+ ///
+ /// \return
+ /// A Target object pointer to the target that owns this
+ /// module.
+ Target &GetTarget() { return *m_target_wp.lock(); }
+
+ /// Get the const target object pointer for this module.
+ ///
+ /// \return
+ /// A const Target object pointer to the target that owns this
+ /// module.
+ const Target &GetTarget() const { return *m_target_wp.lock(); }
+
+ /// Flush all data in the process.
+ ///
+ /// Flush the memory caches, all threads, and any other cached data in the
+ /// process.
+ ///
+ /// This function can be called after a world changing event like adding a
+ /// new symbol file, or after the process makes a large context switch (from
+ /// boot ROM to booted into an OS).
+ void Flush();
+
+ /// Get accessor for the current process state.
+ ///
+ /// \return
+ /// The current state of the process.
+ ///
+ /// \see lldb::StateType
+ lldb::StateType GetState();
+
+ lldb::ExpressionResults
+ RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp,
+ const EvaluateExpressionOptions &options,
+ DiagnosticManager &diagnostic_manager);
+
+ static const char *ExecutionResultAsCString(lldb::ExpressionResults result);
+
+ void GetStatus(Stream &ostrm);
+
+ size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason,
+ uint32_t start_frame, uint32_t num_frames,
+ uint32_t num_frames_with_source,
+ bool stop_format);
+
+ void SendAsyncInterrupt();
+
+ // Notify this process class that modules got loaded.
+ //
+ // If subclasses override this method, they must call this version before
+ // doing anything in the subclass version of the function.
+ virtual void ModulesDidLoad(ModuleList &module_list);
+
+ /// Retrieve the list of shared libraries that are loaded for this process
+ /// This method is used on pre-macOS 10.12, pre-iOS 10, pre-tvOS 10, pre-
+ /// watchOS 3 systems. The following two methods are for newer versions of
+ /// those OSes.
+ ///
+ /// For certain platforms, the time it takes for the DynamicLoader plugin to
+ /// read all of the shared libraries out of memory over a slow communication
+ /// channel may be too long. In that instance, the gdb-remote stub may be
+ /// able to retrieve the necessary information about the solibs out of
+ /// memory and return a concise summary sufficient for the DynamicLoader
+ /// plugin.
+ ///
+ /// \param [in] image_list_address
+ /// The address where the table of shared libraries is stored in memory,
+ /// if that is appropriate for this platform. Else this may be
+ /// passed as LLDB_INVALID_ADDRESS.
+ ///
+ /// \param [in] image_count
+ /// The number of shared libraries that are present in this process, if
+ /// that is appropriate for this platofrm Else this may be passed as
+ /// LLDB_INVALID_ADDRESS.
+ ///
+ /// \return
+ /// A StructureDataSP object which, if non-empty, will contain the
+ /// information the DynamicLoader needs to get the initial scan of
+ /// solibs resolved.
+ virtual lldb_private::StructuredData::ObjectSP
+ GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address,
+ lldb::addr_t image_count) {
+ return StructuredData::ObjectSP();
+ }
+
+ // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
+ // return the full list of loaded shared libraries without needing any input.
+ virtual lldb_private::StructuredData::ObjectSP
+ GetLoadedDynamicLibrariesInfos() {
+ return StructuredData::ObjectSP();
+ }
+
+ // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
+ // return information about binaries given their load addresses.
+ virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(
+ const std::vector<lldb::addr_t> &load_addresses) {
+ return StructuredData::ObjectSP();
+ }
+
+ // Get information about the library shared cache, if that exists
+ //
+ // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can
+ // return information about the library shared cache (a set of standard
+ // libraries that are loaded at the same location for all processes on a
+ // system) in use.
+ virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo() {
+ return StructuredData::ObjectSP();
+ }
+
+ /// Print a user-visible warning about a module being built with
+ /// optimization
+ ///
+ /// Prints a async warning message to the user one time per Module where a
+ /// function is found that was compiled with optimization, per Process.
+ ///
+ /// \param [in] sc
+ /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule
+ /// pre-computed.
+ void PrintWarningOptimization(const SymbolContext &sc);
+
+ virtual bool GetProcessInfo(ProcessInstanceInfo &info);
+
+public:
+ /// Get the exit status for a process.
+ ///
+ /// \return
+ /// The process's return code, or -1 if the current process
+ /// state is not eStateExited.
+ int GetExitStatus();
+
+ /// Get a textual description of what the process exited.
+ ///
+ /// \return
+ /// The textual description of why the process exited, or nullptr
+ /// if there is no description available.
+ const char *GetExitDescription();
+
+ virtual void DidExit() {}
+
+ /// Get the Modification ID of the process.
+ ///
+ /// \return
+ /// The modification ID of the process.
+ ProcessModID GetModID() const { return m_mod_id; }
+
+ const ProcessModID &GetModIDRef() const { return m_mod_id; }
+
+ uint32_t GetStopID() const { return m_mod_id.GetStopID(); }
+
+ uint32_t GetResumeID() const { return m_mod_id.GetResumeID(); }
+
+ uint32_t GetLastUserExpressionResumeID() const {
+ return m_mod_id.GetLastUserExpressionResumeID();
+ }
+
+ uint32_t GetLastNaturalStopID() const {
+ return m_mod_id.GetLastNaturalStopID();
+ }
+
+ lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
+ return m_mod_id.GetStopEventForStopID(stop_id);
+ }
+
+ /// Set accessor for the process exit status (return code).
+ ///
+ /// Sometimes a child exits and the exit can be detected by global functions
+ /// (signal handler for SIGCHLD for example). This accessor allows the exit
+ /// status to be set from an external source.
+ ///
+ /// Setting this will cause a eStateExited event to be posted to the process
+ /// event queue.
+ ///
+ /// \param[in] exit_status
+ /// The value for the process's return code.
+ ///
+ /// \see lldb::StateType
+ virtual bool SetExitStatus(int exit_status, const char *cstr);
+
+ /// Check if a process is still alive.
+ ///
+ /// \return
+ /// Returns \b true if the process is still valid, \b false
+ /// otherwise.
+ virtual bool IsAlive();
+
+ /// Before lldb detaches from a process, it warns the user that they are
+ /// about to lose their debug session. In some cases, this warning doesn't
+ /// need to be emitted -- for instance, with core file debugging where the
+ /// user can reconstruct the "state" by simply re-running the debugger on
+ /// the core file.
+ ///
+ /// \return
+ // true if the user should be warned about detaching from this process.
+ virtual bool WarnBeforeDetach() const { return true; }
+
+ /// Actually do the reading of memory from a process.
+ ///
+ /// Subclasses must override this function and can return fewer bytes than
+ /// requested when memory requests are too large. This class will break up
+ /// the memory requests and keep advancing the arguments along as needed.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start reading
+ /// memory from.
+ ///
+ /// \param[in] size
+ /// The number of bytes to read.
+ ///
+ /// \param[out] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// will receive the memory bytes.
+ ///
+ /// \param[out] error
+ /// An error that indicates the success or failure of this
+ /// operation. If error indicates success (error.Success()),
+ /// then the value returned can be trusted, otherwise zero
+ /// will be returned.
+ ///
+ /// \return
+ /// The number of bytes that were actually read into \a buf.
+ /// Zero is returned in the case of an error.
+ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+ Status &error) = 0;
+
+ /// Read of memory from a process.
+ ///
+ /// This function will read memory from the current process's address space
+ /// and remove any traps that may have been inserted into the memory.
+ ///
+ /// This function is not meant to be overridden by Process subclasses, the
+ /// subclasses should implement Process::DoReadMemory (lldb::addr_t, size_t,
+ /// void *).
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start reading
+ /// memory from.
+ ///
+ /// \param[out] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// will receive the memory bytes.
+ ///
+ /// \param[in] size
+ /// The number of bytes to read.
+ ///
+ /// \param[out] error
+ /// An error that indicates the success or failure of this
+ /// operation. If error indicates success (error.Success()),
+ /// then the value returned can be trusted, otherwise zero
+ /// will be returned.
+ ///
+ /// \return
+ /// The number of bytes that were actually read into \a buf. If
+ /// the returned number is greater than zero, yet less than \a
+ /// size, then this function will get called again with \a
+ /// vm_addr, \a buf, and \a size updated appropriately. Zero is
+ /// returned in the case of an error.
+ virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+ Status &error);
+
+ /// Read of memory from a process.
+ ///
+ /// This function has the same semantics of ReadMemory except that it
+ /// bypasses caching.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start reading
+ /// memory from.
+ ///
+ /// \param[out] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// will receive the memory bytes.
+ ///
+ /// \param[in] size
+ /// The number of bytes to read.
+ ///
+ /// \param[out] error
+ /// An error that indicates the success or failure of this
+ /// operation. If error indicates success (error.Success()),
+ /// then the value returned can be trusted, otherwise zero
+ /// will be returned.
+ ///
+ /// \return
+ /// The number of bytes that were actually read into \a buf. If
+ /// the returned number is greater than zero, yet less than \a
+ /// size, then this function will get called again with \a
+ /// vm_addr, \a buf, and \a size updated appropriately. Zero is
+ /// returned in the case of an error.
+ size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size,
+ Status &error);
+
+ /// Read a NULL terminated string from memory
+ ///
+ /// This function will read a cache page at a time until a NULL string
+ /// terminator is found. It will stop reading if an aligned sequence of NULL
+ /// termination \a type_width bytes is not found before reading \a
+ /// cstr_max_len bytes. The results are always guaranteed to be NULL
+ /// terminated, and that no more than (max_bytes - type_width) bytes will be
+ /// read.
+ ///
+ /// \param[in] vm_addr
+ /// The virtual load address to start the memory read.
+ ///
+ /// \param[in] str
+ /// A character buffer containing at least max_bytes.
+ ///
+ /// \param[in] max_bytes
+ /// The maximum number of bytes to read.
+ ///
+ /// \param[in] error
+ /// The error status of the read operation.
+ ///
+ /// \param[in] type_width
+ /// The size of the null terminator (1 to 4 bytes per
+ /// character). Defaults to 1.
+ ///
+ /// \return
+ /// 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,
+ Status &error, size_t type_width = 1);
+
+ /// Read a NULL terminated C string from memory
+ ///
+ /// This function will read a cache page at a time until the NULL
+ /// C string terminator is found. It will stop reading if the NULL
+ /// termination byte isn't found before reading \a cstr_max_len bytes, and
+ /// the results are always guaranteed to be NULL 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, Status &error);
+
+ size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str,
+ Status &error);
+
+ /// Reads an unsigned integer of the specified byte size from process
+ /// memory.
+ ///
+ /// \param[in] load_addr
+ /// A load address of the integer to read.
+ ///
+ /// \param[in] byte_size
+ /// The size in byte of the integer to read.
+ ///
+ /// \param[in] fail_value
+ /// The value to return if we fail to read an integer.
+ ///
+ /// \param[out] error
+ /// An error that indicates the success or failure of this
+ /// operation. If error indicates success (error.Success()),
+ /// then the value returned can be trusted, otherwise zero
+ /// will be returned.
+ ///
+ /// \return
+ /// The unsigned integer that was read from the process memory
+ /// space. If the integer was smaller than a uint64_t, any
+ /// unused upper bytes will be zero filled. If the process
+ /// byte order differs from the host byte order, the integer
+ /// value will be appropriately byte swapped into host byte
+ /// order.
+ uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr,
+ size_t byte_size, uint64_t fail_value,
+ Status &error);
+
+ int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size,
+ int64_t fail_value, Status &error);
+
+ lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error);
+
+ bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value,
+ Status &error);
+
+ /// Actually do the writing of memory to a process.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start writing
+ /// memory to.
+ ///
+ /// \param[in] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// contains the data to write.
+ ///
+ /// \param[in] size
+ /// The number of bytes to write.
+ ///
+ /// \param[out] error
+ /// An error value in case the memory write fails.
+ ///
+ /// \return
+ /// The number of bytes that were actually written.
+ virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf,
+ size_t size, Status &error) {
+ error.SetErrorStringWithFormat(
+ "error: %s does not support writing to processes",
+ GetPluginName().GetCString());
+ return 0;
+ }
+
+ /// Write all or part of a scalar value to memory.
+ ///
+ /// The value contained in \a scalar will be swapped to match the byte order
+ /// of the process that is being debugged. If \a size is less than the size
+ /// of scalar, the least significant \a size bytes from scalar will be
+ /// written. If \a size is larger than the byte size of scalar, then the
+ /// extra space will be padded with zeros and the scalar value will be
+ /// placed in the least significant bytes in memory.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start writing
+ /// memory to.
+ ///
+ /// \param[in] scalar
+ /// The scalar to write to the debugged process.
+ ///
+ /// \param[in] size
+ /// This value can be smaller or larger than the scalar value
+ /// itself. If \a size is smaller than the size of \a scalar,
+ /// the least significant bytes in \a scalar will be used. If
+ /// \a size is larger than the byte size of \a scalar, then
+ /// the extra space will be padded with zeros. If \a size is
+ /// set to UINT32_MAX, then the size of \a scalar will be used.
+ ///
+ /// \param[out] error
+ /// An error value in case the memory write fails.
+ ///
+ /// \return
+ /// The number of bytes that were actually written.
+ size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar,
+ size_t size, Status &error);
+
+ size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size,
+ bool is_signed, Scalar &scalar,
+ Status &error);
+
+ /// Write memory to a process.
+ ///
+ /// This function will write memory to the current process's address space
+ /// and maintain any traps that might be present due to software
+ /// breakpoints.
+ ///
+ /// This function is not meant to be overridden by Process subclasses, the
+ /// subclasses should implement Process::DoWriteMemory (lldb::addr_t,
+ /// size_t, void *).
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start writing
+ /// memory to.
+ ///
+ /// \param[in] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// contains the data to write.
+ ///
+ /// \param[in] size
+ /// The number of bytes to write.
+ ///
+ /// \return
+ /// The number of bytes that were actually written.
+ // TODO: change this to take an ArrayRef<uint8_t>
+ size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
+ Status &error);
+
+ /// Actually allocate memory in the process.
+ ///
+ /// This function will allocate memory in the process's address space. This
+ /// can't rely on the generic function calling mechanism, since that
+ /// requires this function.
+ ///
+ /// \param[in] size
+ /// The size of the allocation requested.
+ ///
+ /// \return
+ /// The address of the allocated buffer in the process, or
+ /// LLDB_INVALID_ADDRESS if the allocation failed.
+
+ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions,
+ Status &error) {
+ error.SetErrorStringWithFormat(
+ "error: %s does not support allocating in the debug process",
+ GetPluginName().GetCString());
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ virtual Status WriteObjectFile(std::vector<ObjectFile::LoadableData> entries);
+
+ /// The public interface to allocating memory in the process.
+ ///
+ /// This function will allocate memory in the process's address space. This
+ /// can't rely on the generic function calling mechanism, since that
+ /// requires this function.
+ ///
+ /// \param[in] size
+ /// The size of the allocation requested.
+ ///
+ /// \param[in] permissions
+ /// Or together any of the lldb::Permissions bits. The permissions on
+ /// a given memory allocation can't be changed after allocation. Note
+ /// that a block that isn't set writable can still be written on from
+ /// lldb,
+ /// just not by the process itself.
+ ///
+ /// \param[in,out] error
+ /// An error object to fill in if things go wrong.
+ /// \return
+ /// 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, Status &error);
+
+ /// The public interface to allocating memory in the process, this also
+ /// clears the allocated memory.
+ ///
+ /// This function will allocate memory in the process's address space. This
+ /// can't rely on the generic function calling mechanism, since that
+ /// requires this function.
+ ///
+ /// \param[in] size
+ /// The size of the allocation requested.
+ ///
+ /// \param[in] permissions
+ /// Or together any of the lldb::Permissions bits. The permissions on
+ /// a given memory allocation can't be changed after allocation. Note
+ /// that a block that isn't set writable can still be written on from
+ /// lldb,
+ /// just not by the process itself.
+ ///
+ /// \param[in/out] error
+ /// An error object to fill in if things go wrong.
+ /// \return
+ /// The address of the allocated buffer in the process, or
+ /// LLDB_INVALID_ADDRESS if the allocation failed.
+
+ lldb::addr_t CallocateMemory(size_t size, uint32_t permissions,
+ Status &error);
+
+ /// Resolve dynamically loaded indirect functions.
+ ///
+ /// \param[in] address
+ /// The load address of the indirect function to resolve.
+ ///
+ /// \param[out] error
+ /// An error value in case the resolve fails.
+ ///
+ /// \return
+ /// The address of the resolved function.
+ /// LLDB_INVALID_ADDRESS if the resolution failed.
+ virtual lldb::addr_t ResolveIndirectFunction(const Address *address,
+ Status &error);
+
+ /// Locate the memory region that contains load_addr.
+ ///
+ /// If load_addr is within the address space the process has mapped
+ /// range_info will be filled in with the start and end of that range as
+ /// well as the permissions for that range and range_info.GetMapped will
+ /// return true.
+ ///
+ /// If load_addr is outside any mapped region then range_info will have its
+ /// start address set to load_addr and the end of the range will indicate
+ /// the start of the next mapped range or be set to LLDB_INVALID_ADDRESS if
+ /// there are no valid mapped ranges between load_addr and the end of the
+ /// process address space.
+ ///
+ /// GetMemoryRegionInfo will only return an error if it is unimplemented for
+ /// the current process.
+ ///
+ /// \param[in] load_addr
+ /// The load address to query the range_info for.
+ ///
+ /// \param[out] range_info
+ /// An range_info value containing the details of the range.
+ ///
+ /// \return
+ /// An error value.
+ virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr,
+ MemoryRegionInfo &range_info) {
+ Status error;
+ error.SetErrorString("Process::GetMemoryRegionInfo() not supported");
+ return error;
+ }
+
+ /// Obtain all the mapped memory regions within this process.
+ ///
+ /// \param[out] region_list
+ /// A vector to contain MemoryRegionInfo objects for all mapped
+ /// ranges.
+ ///
+ /// \return
+ /// An error value.
+ virtual Status
+ GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list);
+
+ virtual Status GetWatchpointSupportInfo(uint32_t &num) {
+ Status error;
+ num = 0;
+ error.SetErrorString("Process::GetWatchpointSupportInfo() not supported");
+ return error;
+ }
+
+ virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after) {
+ Status error;
+ num = 0;
+ after = true;
+ error.SetErrorString("Process::GetWatchpointSupportInfo() not supported");
+ return error;
+ }
+
+ lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec,
+ lldb::addr_t header_addr,
+ size_t size_to_read = 512);
+
+ /// Attempt to get the attributes for a region of memory in the process.
+ ///
+ /// It may be possible for the remote debug server to inspect attributes for
+ /// a region of memory in the process, such as whether there is a valid page
+ /// of memory at a given address or whether that page is
+ /// readable/writable/executable by the process.
+ ///
+ /// \param[in] load_addr
+ /// The address of interest in the process.
+ ///
+ /// \param[out] permissions
+ /// If this call returns successfully, this bitmask will have
+ /// its Permissions bits set to indicate whether the region is
+ /// readable/writable/executable. If this call fails, the
+ /// bitmask values are undefined.
+ ///
+ /// \return
+ /// Returns true if it was able to determine the attributes of the
+ /// memory region. False if not.
+ virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr,
+ uint32_t &permissions);
+
+ /// Determines whether executing JIT-compiled code in this process is
+ /// possible.
+ ///
+ /// \return
+ /// True if execution of JIT code is possible; false otherwise.
+ bool CanJIT();
+
+ /// Sets whether executing JIT-compiled code in this process is possible.
+ ///
+ /// \param[in] can_jit
+ /// True if execution of JIT code is possible; false otherwise.
+ void SetCanJIT(bool can_jit);
+
+ /// Determines whether executing function calls using the interpreter is
+ /// possible for this process.
+ ///
+ /// \return
+ /// True if possible; false otherwise.
+ bool CanInterpretFunctionCalls() { return m_can_interpret_function_calls; }
+
+ /// Sets whether executing function calls using the interpreter is possible
+ /// for this process.
+ ///
+ /// \param[in] can_interpret_function_calls
+ /// True if possible; false otherwise.
+ void SetCanInterpretFunctionCalls(bool can_interpret_function_calls) {
+ m_can_interpret_function_calls = can_interpret_function_calls;
+ }
+
+ /// Sets whether executing code in this process is possible. This could be
+ /// either through JIT or interpreting.
+ ///
+ /// \param[in] can_run_code
+ /// True if execution of code is possible; false otherwise.
+ void SetCanRunCode(bool can_run_code);
+
+ /// Actually deallocate memory in the process.
+ ///
+ /// This function will deallocate memory in the process's address space that
+ /// was allocated with AllocateMemory.
+ ///
+ /// \param[in] ptr
+ /// A return value from AllocateMemory, pointing to the memory you
+ /// want to deallocate.
+ ///
+ /// \return
+ /// \btrue if the memory was deallocated, \bfalse otherwise.
+ virtual Status DoDeallocateMemory(lldb::addr_t ptr) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support deallocating in the debug process",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ /// The public interface to deallocating memory in the process.
+ ///
+ /// This function will deallocate memory in the process's address space that
+ /// was allocated with AllocateMemory.
+ ///
+ /// \param[in] ptr
+ /// A return value from AllocateMemory, pointing to the memory you
+ /// want to deallocate.
+ ///
+ /// \return
+ /// \btrue if the memory was deallocated, \bfalse otherwise.
+ Status DeallocateMemory(lldb::addr_t ptr);
+
+ /// Get any available STDOUT.
+ ///
+ /// Calling this method is a valid operation only if all of the following
+ /// conditions are true: 1) The process was launched, and not attached to.
+ /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
+ /// process was launched without supplying a valid file path
+ /// for STDOUT.
+ ///
+ /// Note that the implementation will probably need to start a read thread
+ /// in the background to make sure that the pipe is drained and the STDOUT
+ /// buffered appropriately, to prevent the process from deadlocking trying
+ /// to write to a full buffer.
+ ///
+ /// Events will be queued indicating that there is STDOUT available that can
+ /// be retrieved using this function.
+ ///
+ /// \param[out] buf
+ /// A buffer that will receive any STDOUT bytes that are
+ /// currently available.
+ ///
+ /// \param[in] buf_size
+ /// The size in bytes for the buffer \a buf.
+ ///
+ /// \return
+ /// The number of bytes written into \a buf. If this value is
+ /// 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, Status &error);
+
+ /// Get any available STDERR.
+ ///
+ /// Calling this method is a valid operation only if all of the following
+ /// conditions are true: 1) The process was launched, and not attached to.
+ /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
+ /// process was launched without supplying a valid file path
+ /// for STDERR.
+ ///
+ /// Note that the implementation will probably need to start a read thread
+ /// in the background to make sure that the pipe is drained and the STDERR
+ /// buffered appropriately, to prevent the process from deadlocking trying
+ /// to write to a full buffer.
+ ///
+ /// Events will be queued indicating that there is STDERR available that can
+ /// be retrieved using this function.
+ ///
+ /// \param[in] buf
+ /// A buffer that will receive any STDERR bytes that are
+ /// currently available.
+ ///
+ /// \param[out] buf_size
+ /// The size in bytes for the buffer \a buf.
+ ///
+ /// \return
+ /// The number of bytes written into \a buf. If this value is
+ /// 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, Status &error);
+
+ /// Puts data into this process's STDIN.
+ ///
+ /// Calling this method is a valid operation only if all of the following
+ /// conditions are true: 1) The process was launched, and not attached to.
+ /// 2) The process was not launched with eLaunchFlagDisableSTDIO. 3) The
+ /// process was launched without supplying a valid file path
+ /// for STDIN.
+ ///
+ /// \param[in] buf
+ /// A buffer that contains the data to write to the process's STDIN.
+ ///
+ /// \param[in] buf_size
+ /// The size in bytes for the buffer \a buf.
+ ///
+ /// \return
+ /// The number of bytes written into \a buf. If this value is
+ /// 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, Status &error) {
+ error.SetErrorString("stdin unsupported");
+ return 0;
+ }
+
+ /// Get any available profile data.
+ ///
+ /// \param[out] buf
+ /// A buffer that will receive any profile data bytes that are
+ /// currently available.
+ ///
+ /// \param[out] buf_size
+ /// The size in bytes for the buffer \a buf.
+ ///
+ /// \return
+ /// The number of bytes written into \a buf. If this value is
+ /// 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, Status &error);
+
+ // Process Breakpoints
+ size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site);
+
+ virtual Status EnableBreakpointSite(BreakpointSite *bp_site) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support enabling breakpoints",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ virtual Status DisableBreakpointSite(BreakpointSite *bp_site) {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support disabling breakpoints",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ // This is implemented completely using the lldb::Process API. Subclasses
+ // 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 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 Status DisableSoftwareBreakpoint(BreakpointSite *bp_site);
+
+ BreakpointSiteList &GetBreakpointSiteList();
+
+ const BreakpointSiteList &GetBreakpointSiteList() const;
+
+ void DisableAllBreakpointSites();
+
+ Status ClearBreakpointSiteByID(lldb::user_id_t break_id);
+
+ lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner,
+ bool use_hardware);
+
+ Status DisableBreakpointSiteByID(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.
+ void RemoveOwnerFromBreakpointSite(lldb::user_id_t owner_id,
+ lldb::user_id_t owner_loc_id,
+ lldb::BreakpointSiteSP &bp_site_sp);
+
+ // Process Watchpoints (optional)
+ virtual Status EnableWatchpoint(Watchpoint *wp, bool notify = true);
+
+ virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true);
+
+ // Thread Queries
+ virtual bool UpdateThreadList(ThreadList &old_thread_list,
+ ThreadList &new_thread_list) = 0;
+
+ void UpdateThreadListIfNeeded();
+
+ ThreadList &GetThreadList() { return m_thread_list; }
+
+ // When ExtendedBacktraces are requested, the HistoryThreads that are created
+ // need an owner -- they're saved here in the Process. The threads in this
+ // list are not iterated over - driver programs need to request the extended
+ // backtrace calls starting from a root concrete thread one by one.
+ ThreadList &GetExtendedThreadList() { return m_extended_thread_list; }
+
+ ThreadList::ThreadIterable Threads() { return m_thread_list.Threads(); }
+
+ uint32_t GetNextThreadIndexID(uint64_t thread_id);
+
+ lldb::ThreadSP CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
+
+ // Returns true if an index id has been assigned to a thread.
+ bool HasAssignedIndexIDToThread(uint64_t sb_thread_id);
+
+ // Given a thread_id, it will assign a more reasonable index id for display
+ // to the user. If the thread_id has previously been assigned, the same index
+ // id will be used.
+ uint32_t AssignIndexIDToThread(uint64_t thread_id);
+
+ // Queue Queries
+
+ void UpdateQueueListIfNeeded();
+
+ QueueList &GetQueueList() {
+ UpdateQueueListIfNeeded();
+ return m_queue_list;
+ }
+
+ QueueList::QueueIterable Queues() {
+ UpdateQueueListIfNeeded();
+ return m_queue_list.Queues();
+ }
+
+ // Event Handling
+ lldb::StateType GetNextEvent(lldb::EventSP &event_sp);
+
+ // Returns the process state when it is stopped. If specified, event_sp_ptr
+ // is set to the event which triggered the stop. If wait_always = false, and
+ // the process is already stopped, this function returns immediately. If the
+ // process is hijacked and use_run_lock is true (the default), then this
+ // function releases the run lock after the stop. Setting use_run_lock to
+ // false will avoid this behavior.
+ lldb::StateType
+ WaitForProcessToStop(const Timeout<std::micro> &timeout,
+ lldb::EventSP *event_sp_ptr = nullptr,
+ bool wait_always = true,
+ lldb::ListenerSP hijack_listener = lldb::ListenerSP(),
+ Stream *stream = nullptr, bool use_run_lock = true);
+
+ uint32_t GetIOHandlerID() const { return m_iohandler_sync.GetValue(); }
+
+ /// Waits for the process state to be running within a given msec timeout.
+ ///
+ /// The main purpose of this is to implement an interlock waiting for
+ /// HandlePrivateEvent to push an IOHandler.
+ ///
+ /// \param[in] timeout
+ /// The maximum time length to wait for the process to transition to the
+ /// eStateRunning state.
+ void SyncIOHandler(uint32_t iohandler_id, const Timeout<std::micro> &timeout);
+
+ lldb::StateType GetStateChangedEvents(
+ lldb::EventSP &event_sp, const Timeout<std::micro> &timeout,
+ lldb::ListenerSP
+ hijack_listener); // Pass an empty ListenerSP to use builtin listener
+
+ /// Centralize the code that handles and prints descriptions for process
+ /// state changes.
+ ///
+ /// \param[in] event_sp
+ /// The process state changed event
+ ///
+ /// \param[in] stream
+ /// The output stream to get the state change description
+ ///
+ /// \param[in,out] pop_process_io_handler
+ /// If this value comes in set to \b true, then pop the Process IOHandler
+ /// if needed.
+ /// Else this variable will be set to \b true or \b false to indicate if
+ /// the process
+ /// needs to have its process IOHandler popped.
+ ///
+ /// \return
+ /// \b true if the event describes a process state changed event, \b false
+ /// otherwise.
+ static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp,
+ Stream *stream,
+ bool &pop_process_io_handler);
+
+ Event *PeekAtStateChangedEvents();
+
+ class ProcessEventHijacker {
+ public:
+ ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
+ : m_process(process) {
+ m_process.HijackProcessEvents(listener_sp);
+ }
+
+ ~ProcessEventHijacker() { m_process.RestoreProcessEvents(); }
+
+ private:
+ Process &m_process;
+ };
+
+ friend class ProcessEventHijacker;
+ friend class ProcessProperties;
+ /// If you need to ensure that you and only you will hear about some public
+ /// event, then make a new listener, set to listen to process events, and
+ /// then call this with that listener. Then you will have to wait on that
+ /// listener explicitly for events (rather than using the GetNextEvent &
+ /// WaitFor* calls above. Be sure to call RestoreProcessEvents when you are
+ /// done.
+ ///
+ /// \param[in] listener
+ /// This is the new listener to whom all process events will be delivered.
+ ///
+ /// \return
+ /// Returns \b true if the new listener could be installed,
+ /// \b false otherwise.
+ bool HijackProcessEvents(lldb::ListenerSP listener_sp);
+
+ /// Restores the process event broadcasting to its normal state.
+ ///
+ void RestoreProcessEvents();
+
+ bool StateChangedIsHijackedForSynchronousResume();
+
+ bool StateChangedIsExternallyHijacked();
+
+ const lldb::ABISP &GetABI();
+
+ OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
+
+ std::vector<LanguageRuntime *>
+ GetLanguageRuntimes(bool retry_if_null = true);
+
+ LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
+ bool retry_if_null = true);
+
+ bool IsPossibleDynamicValue(ValueObject &in_value);
+
+ bool IsRunning() const;
+
+ DynamicCheckerFunctions *GetDynamicCheckers() {
+ return m_dynamic_checkers_up.get();
+ }
+
+ void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers);
+
+ /// Call this to set the lldb in the mode where it breaks on new thread
+ /// creations, and then auto-restarts. This is useful when you are trying
+ /// to run only one thread, but either that thread or the kernel is creating
+ /// new threads in the process. If you stop when the thread is created, you
+ /// can immediately suspend it, and keep executing only the one thread you
+ /// intend.
+ ///
+ /// \return
+ /// Returns \b true if we were able to start up the notification
+ /// \b false otherwise.
+ virtual bool StartNoticingNewThreads() { return true; }
+
+ /// Call this to turn off the stop & notice new threads mode.
+ ///
+ /// \return
+ /// Returns \b true if we were able to start up the notification
+ /// \b false otherwise.
+ virtual bool StopNoticingNewThreads() { return true; }
+
+ void SetRunningUserExpression(bool on);
+ void SetRunningUtilityFunction(bool on);
+
+ // lldb::ExecutionContextScope pure virtual functions
+ lldb::TargetSP CalculateTarget() override;
+
+ lldb::ProcessSP CalculateProcess() override { return shared_from_this(); }
+
+ lldb::ThreadSP CalculateThread() override { return lldb::ThreadSP(); }
+
+ lldb::StackFrameSP CalculateStackFrame() override {
+ return lldb::StackFrameSP();
+ }
+
+ void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
+
+ void SetSTDIOFileDescriptor(int file_descriptor);
+
+ // Add a permanent region of memory that should never be read or written to.
+ // This can be used to ensure that memory reads or writes to certain areas of
+ // memory never end up being sent to the DoReadMemory or DoWriteMemory
+ // functions which can improve performance.
+ void AddInvalidMemoryRegion(const LoadRange ®ion);
+
+ // Remove a permanent region of memory that should never be read or written
+ // to that was previously added with AddInvalidMemoryRegion.
+ bool RemoveInvalidMemoryRange(const LoadRange ®ion);
+
+ // If the setup code of a thread plan needs to do work that might involve
+ // calling a function in the target, it should not do that work directly in
+ // one of the thread plan functions (DidPush/WillResume) because such work
+ // needs to be handled carefully. Instead, put that work in a
+ // PreResumeAction callback, and register it with the process. It will get
+ // done before the actual "DoResume" gets called.
+
+ typedef bool(PreResumeActionCallback)(void *);
+
+ void AddPreResumeAction(PreResumeActionCallback callback, void *baton);
+
+ bool RunPreResumeActions();
+
+ void ClearPreResumeActions();
+
+ void ClearPreResumeAction(PreResumeActionCallback callback, void *baton);
+
+ ProcessRunLock &GetRunLock();
+
+ virtual Status SendEventData(const char *data) {
+ Status return_error("Sending an event is not supported for this process.");
+ return return_error;
+ }
+
+ lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr);
+
+ lldb::InstrumentationRuntimeSP
+ GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type);
+
+ /// Try to fetch the module specification for a module with the given file
+ /// name and architecture. Process sub-classes have to override this method
+ /// if they support platforms where the Platform object can't get the module
+ /// spec for all module.
+ ///
+ /// \param[in] module_file_spec
+ /// The file name of the module to get specification for.
+ ///
+ /// \param[in] arch
+ /// The architecture of the module to get specification for.
+ ///
+ /// \param[out] module_spec
+ /// The fetched module specification if the return value is
+ /// \b true, unchanged otherwise.
+ ///
+ /// \return
+ /// Returns \b true if the module spec fetched successfully,
+ /// \b false otherwise.
+ virtual bool GetModuleSpec(const FileSpec &module_file_spec,
+ const ArchSpec &arch, ModuleSpec &module_spec);
+
+ virtual void PrefetchModuleSpecs(llvm::ArrayRef<FileSpec> module_file_specs,
+ const llvm::Triple &triple) {}
+
+ /// Try to find the load address of a file.
+ /// The load address is defined as the address of the first memory region
+ /// what contains data mapped from the specified file.
+ ///
+ /// \param[in] file
+ /// The name of the file whose load address we are looking for
+ ///
+ /// \param[out] is_loaded
+ /// \b True if the file is loaded into the memory and false
+ /// otherwise.
+ ///
+ /// \param[out] load_addr
+ /// The load address of the file if it is loaded into the
+ /// processes address space, LLDB_INVALID_ADDRESS otherwise.
+ 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);
+
+ lldb::addr_t GetImagePtrFromToken(size_t token) const;
+
+ void ResetImageToken(size_t token);
+
+ /// Find the next branch instruction to set a breakpoint on
+ ///
+ /// When instruction stepping through a source line, instead of stepping
+ /// through each instruction, we can put a breakpoint on the next branch
+ /// instruction (within the range of instructions we are stepping through)
+ /// and continue the process to there, yielding significant performance
+ /// benefits over instruction stepping.
+ ///
+ /// \param[in] default_stop_addr
+ /// The address of the instruction where lldb would put a
+ /// breakpoint normally.
+ ///
+ /// \param[in] range_bounds
+ /// The range which the breakpoint must be contained within.
+ /// Typically a source line.
+ ///
+ /// \return
+ /// The address of the next branch instruction, or the end of
+ /// the range provided in range_bounds. If there are any
+ /// problems with the disassembly or getting the instructions,
+ /// the original default_stop_addr will be returned.
+ Address AdvanceAddressToNextBranchInstruction(Address default_stop_addr,
+ AddressRange range_bounds);
+
+ /// Configure asynchronous structured data feature.
+ ///
+ /// Each Process type that supports using an asynchronous StructuredData
+ /// feature should implement this to enable/disable/configure the feature.
+ /// The default implementation here will always return an error indiciating
+ /// the feature is unsupported.
+ ///
+ /// StructuredDataPlugin implementations will call this to configure a
+ /// feature that has been reported as being supported.
+ ///
+ /// \param[in] type_name
+ /// The StructuredData type name as previously discovered by
+ /// the Process-derived instance.
+ ///
+ /// \param[in] config
+ /// Configuration data for the feature being enabled. This config
+ /// data, which may be null, will be passed along to the feature
+ /// to process. The feature will dictate whether this is a dictionary,
+ /// an array or some other object. If the feature needs to be
+ /// set up properly before it can be enabled, then the config should
+ /// also take an enable/disable flag.
+ ///
+ /// \return
+ /// Returns the result of attempting to configure the feature.
+ virtual Status
+ ConfigureStructuredData(ConstString type_name,
+ const StructuredData::ObjectSP &config_sp);
+
+ /// Broadcasts the given structured data object from the given plugin.
+ ///
+ /// StructuredDataPlugin instances can use this to optionally broadcast any
+ /// of their data if they want to make it available for clients. The data
+ /// will come in on the structured data event bit
+ /// (eBroadcastBitStructuredData).
+ ///
+ /// \param[in] object_sp
+ /// The structured data object to broadcast.
+ ///
+ /// \param[in] plugin_sp
+ /// The plugin that will be reported in the event's plugin
+ /// parameter.
+ void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp,
+ const lldb::StructuredDataPluginSP &plugin_sp);
+
+ /// Returns the StructuredDataPlugin associated with a given type name, if
+ /// there is one.
+ ///
+ /// There will only be a plugin for a given StructuredDataType if the
+ /// debugged process monitor claims that the feature is supported. This is
+ /// one way to tell whether a feature is available.
+ ///
+ /// \return
+ /// The plugin if one is available for the specified feature;
+ /// otherwise, returns an empty shared pointer.
+ lldb::StructuredDataPluginSP
+ GetStructuredDataPlugin(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);
+
+ lldb::StateType GetPrivateState();
+
+ /// The "private" side of resuming a process. This doesn't alter the state
+ /// of m_run_lock, but just causes the process to resume.
+ ///
+ /// \return
+ /// An Status object describing the success or failure of the resume.
+ Status PrivateResume();
+
+ // Called internally
+ void CompleteAttach();
+
+ /// Print a user-visible warning one time per Process
+ ///
+ /// A facility for printing a warning to the user once per repeat_key.
+ ///
+ /// warning_type is from the Process::Warnings enums. repeat_key is a
+ /// pointer value that will be used to ensure that the warning message is
+ /// not printed multiple times. For instance, with a warning about a
+ /// function being optimized, you can pass the CompileUnit pointer to have
+ /// the warning issued for only the first function in a CU, or the Function
+ /// pointer to have it issued once for every function, or a Module pointer
+ /// to have it issued once per Module.
+ ///
+ /// Classes outside Process should call a specific PrintWarning method so
+ /// that the warning strings are all centralized in Process, instead of
+ /// calling PrintWarning() directly.
+ ///
+ /// \param [in] warning_type
+ /// One of the types defined in Process::Warnings.
+ ///
+ /// \param [in] repeat_key
+ /// A pointer value used to ensure that the warning is only printed once.
+ /// May be nullptr, indicating that the warning is printed unconditionally
+ /// every time.
+ ///
+ /// \param [in] fmt
+ /// printf style format string
+ void PrintWarning(uint64_t warning_type, const void *repeat_key,
+ const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+
+ // NextEventAction provides a way to register an action on the next event
+ // that is delivered to this process. There is currently only one next event
+ // action allowed in the process at one time. If a new "NextEventAction" is
+ // added while one is already present, the old action will be discarded (with
+ // HandleBeingUnshipped called after it is discarded.)
+ //
+ // If you want to resume the process as a result of a resume action, call
+ // RequestResume, don't call Resume directly.
+ class NextEventAction {
+ public:
+ enum EventActionResult {
+ eEventActionSuccess,
+ eEventActionRetry,
+ eEventActionExit
+ };
+
+ NextEventAction(Process *process) : m_process(process) {}
+
+ virtual ~NextEventAction() = default;
+
+ virtual EventActionResult PerformAction(lldb::EventSP &event_sp) = 0;
+ virtual void HandleBeingUnshipped() {}
+ virtual EventActionResult HandleBeingInterrupted() = 0;
+ virtual const char *GetExitString() = 0;
+ void RequestResume() { m_process->m_resume_requested = true; }
+
+ protected:
+ Process *m_process;
+ };
+
+ void SetNextEventAction(Process::NextEventAction *next_event_action) {
+ if (m_next_event_action_up.get())
+ m_next_event_action_up->HandleBeingUnshipped();
+
+ m_next_event_action_up.reset(next_event_action);
+ }
+
+ // This is the completer for Attaching:
+ class AttachCompletionHandler : public NextEventAction {
+ public:
+ AttachCompletionHandler(Process *process, uint32_t exec_count);
+
+ ~AttachCompletionHandler() override = default;
+
+ EventActionResult PerformAction(lldb::EventSP &event_sp) override;
+ EventActionResult HandleBeingInterrupted() override;
+ const char *GetExitString() override;
+
+ private:
+ uint32_t m_exec_count;
+ std::string m_exit_string;
+ };
+
+ bool PrivateStateThreadIsValid() const {
+ lldb::StateType state = m_private_state.GetValue();
+ return state != lldb::eStateInvalid && state != lldb::eStateDetached &&
+ state != lldb::eStateExited && m_private_state_thread.IsJoinable();
+ }
+
+ void ForceNextEventDelivery() { m_force_next_event_delivery = true; }
+
+ /// Loads any plugins associated with asynchronous structured data and maps
+ /// the relevant supported type name to the plugin.
+ ///
+ /// Processes can receive asynchronous structured data from the process
+ /// monitor. This method will load and map any structured data plugins that
+ /// support the given set of supported type names. Later, if any of these
+ /// features are enabled, the process monitor is free to generate
+ /// asynchronous structured data. The data must come in as a single \b
+ /// StructuredData::Dictionary. That dictionary must have a string field
+ /// named 'type', with a value that equals the relevant type name string
+ /// (one of the values in \b supported_type_names).
+ ///
+ /// \param[in] supported_type_names
+ /// An array of zero or more type names. Each must be unique.
+ /// For each entry in the list, a StructuredDataPlugin will be
+ /// searched for that supports the structured data type name.
+ void MapSupportedStructuredDataPlugins(
+ const StructuredData::Array &supported_type_names);
+
+ /// Route the incoming structured data dictionary to the right plugin.
+ ///
+ /// The incoming structured data must be a dictionary, and it must have a
+ /// key named 'type' that stores a string value. The string value must be
+ /// the name of the structured data feature that knows how to handle it.
+ ///
+ /// \param[in] object_sp
+ /// When non-null and pointing to a dictionary, the 'type'
+ /// key's string value is used to look up the plugin that
+ /// was registered for that structured data type. It then
+ /// calls the following method on the StructuredDataPlugin
+ /// instance:
+ ///
+ /// virtual void
+ /// HandleArrivalOfStructuredData(Process &process,
+ /// ConstString type_name,
+ /// const StructuredData::ObjectSP
+ /// &object_sp)
+ ///
+ /// \return
+ /// True if the structured data was routed to a plugin; otherwise,
+ /// false.
+ bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp);
+
+ // Type definitions
+ typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP>
+ LanguageRuntimeCollection;
+ typedef std::unordered_set<const void *> WarningsPointerSet;
+ typedef std::map<uint64_t, WarningsPointerSet> WarningsCollection;
+
+ struct PreResumeCallbackAndBaton {
+ bool (*callback)(void *);
+ void *baton;
+ PreResumeCallbackAndBaton(PreResumeActionCallback in_callback,
+ void *in_baton)
+ : callback(in_callback), baton(in_baton) {}
+ bool operator== (const PreResumeCallbackAndBaton &rhs) {
+ return callback == rhs.callback && baton == rhs.baton;
+ }
+ };
+
+ using StructuredDataPluginMap =
+ std::map<ConstString, lldb::StructuredDataPluginSP>;
+
+ // Member variables
+ std::weak_ptr<Target> m_target_wp; ///< The target that owns this process.
+ ThreadSafeValue<lldb::StateType> m_public_state;
+ ThreadSafeValue<lldb::StateType>
+ m_private_state; // The actual state of our process
+ Broadcaster m_private_state_broadcaster; // This broadcaster feeds state
+ // changed events into the private
+ // state thread's listener.
+ Broadcaster m_private_state_control_broadcaster; // This is the control
+ // broadcaster, used to
+ // pause, resume & stop the
+ // private state thread.
+ lldb::ListenerSP m_private_state_listener_sp; // This is the listener for the
+ // private state thread.
+ HostThread m_private_state_thread; ///< Thread ID for the thread that watches
+ ///internal state events
+ ProcessModID m_mod_id; ///< Tracks the state of the process over stops and
+ ///other alterations.
+ uint32_t m_process_unique_id; ///< Each lldb_private::Process class that is
+ ///created gets a unique integer ID that
+ ///increments with each new instance
+ uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index
+ ///that won't get re-used.
+ std::map<uint64_t, uint32_t> m_thread_id_to_index_id_map;
+ int m_exit_status; ///< The exit status of the process, or -1 if not set.
+ std::string m_exit_string; ///< A textual description of why a process exited.
+ std::mutex m_exit_status_mutex; ///< Mutex so m_exit_status m_exit_string can
+ ///be safely accessed from multiple threads
+ std::recursive_mutex m_thread_mutex;
+ ThreadList m_thread_list_real; ///< The threads for this process as are known
+ ///to the protocol we are debugging with
+ ThreadList m_thread_list; ///< The threads for this process as the user will
+ ///see them. This is usually the same as
+ ///< m_thread_list_real, but might be different if there is an OS plug-in
+ ///creating memory threads
+ ThreadList m_extended_thread_list; ///< Owner for extended threads that may be
+ ///generated, cleared on natural stops
+ uint32_t m_extended_thread_stop_id; ///< The natural stop id when
+ ///extended_thread_list was last updated
+ QueueList
+ m_queue_list; ///< The list of libdispatch queues at a given stop point
+ uint32_t m_queue_list_stop_id; ///< The natural stop id when queue list was
+ ///last fetched
+ std::vector<Notifications> m_notifications; ///< The list of notifications
+ ///that this process can deliver.
+ std::vector<lldb::addr_t> m_image_tokens;
+ lldb::ListenerSP m_listener_sp; ///< Shared pointer to the listener used for
+ ///public events. Can not be empty.
+ BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint
+ ///locations we intend to insert in
+ ///the target.
+ lldb::DynamicLoaderUP m_dyld_up;
+ lldb::JITLoaderListUP m_jit_loaders_up;
+ lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_up; ///< The functions used
+ /// by the expression
+ /// parser to validate
+ /// data that
+ /// expressions use.
+ lldb::OperatingSystemUP m_os_up;
+ lldb::SystemRuntimeUP m_system_runtime_up;
+ lldb::UnixSignalsSP
+ m_unix_signals_sp; /// This is the current signal set for this process.
+ lldb::ABISP m_abi_sp;
+ lldb::IOHandlerSP m_process_input_reader;
+ Communication m_stdio_communication;
+ std::recursive_mutex m_stdio_communication_mutex;
+ bool m_stdin_forward; /// Remember if stdin must be forwarded to remote debug
+ /// server
+ std::string m_stdout_data;
+ std::string m_stderr_data;
+ std::recursive_mutex m_profile_data_comm_mutex;
+ std::vector<std::string> m_profile_data;
+ Predicate<uint32_t> m_iohandler_sync;
+ MemoryCache m_memory_cache;
+ AllocatedMemoryCache m_allocated_memory_cache;
+ bool m_should_detach; /// Should we detach if the process object goes away
+ /// with an explicit call to Kill or Detach?
+ LanguageRuntimeCollection m_language_runtimes;
+ std::recursive_mutex m_language_runtimes_mutex;
+ InstrumentationRuntimeCollection m_instrumentation_runtimes;
+ std::unique_ptr<NextEventAction> m_next_event_action_up;
+ std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
+ ProcessRunLock m_public_run_lock;
+ ProcessRunLock m_private_run_lock;
+ bool m_currently_handling_do_on_removals;
+ bool m_resume_requested; // If m_currently_handling_event or
+ // m_currently_handling_do_on_removals are true,
+ // Resume will only request a resume, using this
+ // flag to check.
+ bool m_finalizing; // This is set at the beginning of Process::Finalize() to
+ // stop functions from looking up or creating things
+ // during a finalize call
+ bool m_finalize_called; // This is set at the end of Process::Finalize()
+ bool m_clear_thread_plans_on_stop;
+ bool m_force_next_event_delivery;
+ lldb::StateType m_last_broadcast_state; /// This helps with the Public event
+ /// coalescing in
+ /// ShouldBroadcastEvent.
+ std::map<lldb::addr_t, lldb::addr_t> m_resolved_indirect_addresses;
+ bool m_destroy_in_process;
+ bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel,
+ // don't support the ability to modify
+ // the stack.
+ WarningsCollection m_warnings_issued; // A set of object pointers which have
+ // already had warnings printed
+ std::mutex m_run_thread_plan_lock;
+ StructuredDataPluginMap m_structured_data_plugin_map;
+
+ enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit;
+
+ std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up;
+ std::once_flag m_dlopen_utility_func_flag_once;
+
+ size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size,
+ uint8_t *buf) const;
+
+ void SynchronouslyNotifyStateChanged(lldb::StateType state);
+
+ void SetPublicState(lldb::StateType new_state, bool restarted);
+
+ void SetPrivateState(lldb::StateType state);
+
+ bool StartPrivateStateThread(bool is_secondary_thread = false);
+
+ void StopPrivateStateThread();
+
+ void PausePrivateStateThread();
+
+ void ResumePrivateStateThread();
+
+private:
+ struct PrivateStateThreadArgs {
+ PrivateStateThreadArgs(Process *p, bool s)
+ : process(p), is_secondary_thread(s){};
+ Process *process;
+ bool is_secondary_thread;
+ };
+
+ // arg is a pointer to a new'ed PrivateStateThreadArgs structure.
+ // PrivateStateThread will free it for you.
+ static lldb::thread_result_t PrivateStateThread(void *arg);
+
+ // The starts up the private state thread that will watch for events from the
+ // debugee. Pass true for is_secondary_thread in the case where you have to
+ // temporarily spin up a secondary state thread to handle events from a hand-
+ // called function on the primary private state thread.
+
+ lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread);
+
+protected:
+ void HandlePrivateEvent(lldb::EventSP &event_sp);
+
+ Status HaltPrivate();
+
+ lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp,
+ const Timeout<std::micro> &timeout);
+
+ // This waits for both the state change broadcaster, and the control
+ // broadcaster. If control_only, it only waits for the control broadcaster.
+
+ bool GetEventsPrivate(lldb::EventSP &event_sp,
+ const Timeout<std::micro> &timeout, bool control_only);
+
+ lldb::StateType
+ GetStateChangedEventsPrivate(lldb::EventSP &event_sp,
+ const Timeout<std::micro> &timeout);
+
+ size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size,
+ Status &error);
+
+ void AppendSTDOUT(const char *s, size_t len);
+
+ void AppendSTDERR(const char *s, size_t len);
+
+ void BroadcastAsyncProfileData(const std::string &one_profile_data);
+
+ static void STDIOReadThreadBytesReceived(void *baton, const void *src,
+ size_t src_len);
+
+ bool PushProcessIOHandler();
+
+ bool PopProcessIOHandler();
+
+ bool ProcessIOHandlerIsActive();
+
+ bool ProcessIOHandlerExists() const {
+ return static_cast<bool>(m_process_input_reader);
+ }
+
+ Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
+
+ virtual Status UpdateAutomaticSignalFiltering();
+
+ void LoadOperatingSystemPlugin(bool flush);
+
+private:
+ /// This is the part of the event handling that for a process event. It
+ /// decides what to do with the event and returns true if the event needs to
+ /// be propagated to the user, and false otherwise. If the event is not
+ /// propagated, this call will most likely set the target to executing
+ /// again. There is only one place where this call should be called,
+ /// HandlePrivateEvent. Don't call it from anywhere else...
+ ///
+ /// \param[in] event_ptr
+ /// This is the event we are handling.
+ ///
+ /// \return
+ /// Returns \b true if the event should be reported to the
+ /// user, \b false otherwise.
+ bool ShouldBroadcastEvent(Event *event_ptr);
+
+ void ControlPrivateStateThread(uint32_t signal);
+
+ DISALLOW_COPY_AND_ASSIGN(Process);
+};
+
+/// RAII guard that should be aquired when an utility function is called within
+/// a given process.
+class UtilityFunctionScope {
+ Process *m_process;
+
+public:
+ UtilityFunctionScope(Process *p) : m_process(p) {
+ if (m_process)
+ m_process->SetRunningUtilityFunction(true);
+ }
+ ~UtilityFunctionScope() {
+ if (m_process)
+ m_process->SetRunningUtilityFunction(false);
+ }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Process_h_
diff --git a/linux-x64/clang/include/lldb/Target/ProcessStructReader.h b/linux-x64/clang/include/lldb/Target/ProcessStructReader.h
new file mode 100644
index 0000000..ade29c0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ProcessStructReader.h
@@ -0,0 +1,104 @@
+//===---------------------ProcessStructReader.h ------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_PROCESSSTRUCTREADER_H
+#define LLDB_TARGET_PROCESSSTRUCTREADER_H
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Status.h"
+
+#include <initializer_list>
+#include <map>
+#include <string>
+
+namespace lldb_private {
+class ProcessStructReader {
+protected:
+ struct FieldImpl {
+ CompilerType type;
+ size_t offset;
+ size_t size;
+ };
+
+ std::map<ConstString, FieldImpl> m_fields;
+ DataExtractor m_data;
+ lldb::ByteOrder m_byte_order;
+ size_t m_addr_byte_size;
+
+public:
+ ProcessStructReader(Process *process, lldb::addr_t base_addr,
+ CompilerType struct_type) {
+ if (!process)
+ return;
+ if (base_addr == 0 || base_addr == LLDB_INVALID_ADDRESS)
+ return;
+ m_byte_order = process->GetByteOrder();
+ m_addr_byte_size = process->GetAddressByteSize();
+
+ for (size_t idx = 0; idx < struct_type.GetNumFields(); idx++) {
+ std::string name;
+ uint64_t bit_offset;
+ uint32_t bitfield_bit_size;
+ bool is_bitfield;
+ CompilerType field_type = struct_type.GetFieldAtIndex(
+ idx, name, &bit_offset, &bitfield_bit_size, &is_bitfield);
+ // no support for bitfields in here (yet)
+ if (is_bitfield)
+ return;
+ auto size = field_type.GetByteSize(nullptr);
+ // no support for things larger than a uint64_t (yet)
+ if (!size || *size > 8)
+ return;
+ ConstString const_name = ConstString(name.c_str());
+ size_t byte_index = static_cast<size_t>(bit_offset / 8);
+ m_fields[const_name] =
+ FieldImpl{field_type, byte_index, static_cast<size_t>(*size)};
+ }
+ auto total_size = struct_type.GetByteSize(nullptr);
+ if (!total_size)
+ return;
+ lldb::DataBufferSP buffer_sp(new DataBufferHeap(*total_size, 0));
+ Status error;
+ process->ReadMemoryFromInferior(base_addr, buffer_sp->GetBytes(),
+ *total_size, error);
+ if (error.Fail())
+ return;
+ m_data = DataExtractor(buffer_sp, m_byte_order, m_addr_byte_size);
+ }
+
+ template <typename RetType>
+ RetType GetField(ConstString name, RetType fail_value = RetType()) {
+ auto iter = m_fields.find(name), end = m_fields.end();
+ if (iter == end)
+ return fail_value;
+ auto size = iter->second.size;
+ if (sizeof(RetType) < size)
+ return fail_value;
+ lldb::offset_t offset = iter->second.offset;
+ if (offset + size > m_data.GetByteSize())
+ return fail_value;
+ return (RetType)(m_data.GetMaxU64(&offset, size));
+ }
+
+ size_t GetOffsetOf(ConstString name, size_t fail_value = SIZE_MAX) {
+ auto iter = m_fields.find(name), end = m_fields.end();
+ if (iter == end)
+ return fail_value;
+ return iter->second.offset;
+ }
+};
+}
+
+#endif // utility_ProcessStructReader_h_
diff --git a/linux-x64/clang/include/lldb/Target/Queue.h b/linux-x64/clang/include/lldb/Target/Queue.h
new file mode 100644
index 0000000..01e8994
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Queue.h
@@ -0,0 +1,155 @@
+//===-- Queue.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Queue_h_
+#define liblldb_Queue_h_
+
+#include <string>
+#include <vector>
+
+#include "lldb/Target/QueueItem.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// Queue:
+// This class represents a libdispatch aka Grand Central Dispatch queue in the
+// process.
+//
+// A program using libdispatch will create queues, put work items
+// (functions, blocks) on the queues. The system will create / reassign
+// pthreads to execute the work items for the queues. A serial queue will be
+// associated with a single thread (or possibly no thread, if it is not doing
+// any work). A concurrent queue may be associated with multiple threads.
+
+class Queue : public std::enable_shared_from_this<Queue> {
+public:
+ Queue(lldb::ProcessSP process_sp, lldb::queue_id_t queue_id,
+ const char *queue_name);
+
+ ~Queue();
+
+ /// Get the QueueID for this Queue
+ ///
+ /// A 64-bit ID number that uniquely identifies a queue at this particular
+ /// stop_id. Currently the libdispatch serialnum is used for the QueueID;
+ /// it is a number that starts at 1 for each process and increments with
+ /// each queue. A serialnum is not reused for a different queue in the
+ /// lifetime of that process execution.
+ ///
+ /// \return
+ /// The QueueID for this Queue.
+ lldb::queue_id_t GetID();
+
+ /// Get the name of this Queue
+ ///
+ /// \return
+ /// The name of the queue, if one is available.
+ /// A NULL pointer is returned if none is available.
+ const char *GetName();
+
+ /// Get the IndexID for this Queue
+ ///
+ /// This is currently the same as GetID(). If it changes in the future,
+ /// it will be a small integer value (starting with 1) assigned to
+ /// each queue that is seen during a Process lifetime.
+ ///
+ /// Both the GetID and GetIndexID are being retained for Queues to
+ /// maintain similar API to the Thread class, and allow for the
+ /// possibility of GetID changing to a different source in the future.
+ ///
+ /// \return
+ /// The IndexID for this queue.
+ uint32_t GetIndexID();
+
+ /// Return the threads currently associated with this queue
+ ///
+ /// Zero, one, or many threads may be executing code for a queue at
+ /// a given point in time. This call returns the list of threads
+ /// that are currently executing work for this queue.
+ ///
+ /// \return
+ /// The threads currently performing work for this queue
+ std::vector<lldb::ThreadSP> GetThreads();
+
+ /// Return the items that are currently enqueued
+ ///
+ /// "Enqueued" means that the item has been added to the queue to
+ /// be done, but has not yet been done. When the item is going to
+ /// be processed it is "dequeued".
+ ///
+ /// \return
+ /// The vector of enqueued items for this queue
+ const std::vector<lldb::QueueItemSP> &GetPendingItems();
+
+ lldb::ProcessSP GetProcess() const { return m_process_wp.lock(); }
+
+ /// Get the number of work items that this queue is currently running
+ ///
+ /// \return
+ /// The number of work items currently executing. For a serial
+ /// queue, this will be 0 or 1. For a concurrent queue, this
+ /// may be any number.
+ uint32_t GetNumRunningWorkItems() const;
+
+ /// Get the number of work items enqueued on this queue
+ ///
+ /// \return
+ /// The number of work items currently enqueued, waiting to
+ /// execute.
+ uint32_t GetNumPendingWorkItems() const;
+
+ /// Get the dispatch_queue_t structure address for this Queue
+ ///
+ /// Get the address in the inferior process' memory of this Queue's
+ /// dispatch_queue_t structure.
+ ///
+ /// \return
+ /// The address of the dispatch_queue_t structure, if known.
+ /// LLDB_INVALID_ADDRESS will be returned if it is unavailable.
+ lldb::addr_t GetLibdispatchQueueAddress() const;
+
+ void SetNumRunningWorkItems(uint32_t count);
+
+ void SetNumPendingWorkItems(uint32_t count);
+
+ void SetLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t_addr);
+
+ void PushPendingQueueItem(lldb::QueueItemSP item) {
+ m_pending_items.push_back(item);
+ }
+
+ /// Return the kind (serial, concurrent) of this queue
+ ///
+ /// \return
+ // Whether this is a serial or a concurrent queue
+ lldb::QueueKind GetKind();
+
+ void SetKind(lldb::QueueKind kind);
+
+private:
+ // For Queue only
+
+ lldb::ProcessWP m_process_wp;
+ lldb::queue_id_t m_queue_id;
+ std::string m_queue_name;
+ uint32_t m_running_work_items_count;
+ uint32_t m_pending_work_items_count;
+ std::vector<lldb::QueueItemSP> m_pending_items;
+ lldb::addr_t m_dispatch_queue_t_addr; // address of libdispatch
+ // dispatch_queue_t for this Queue
+ lldb::QueueKind m_kind;
+
+ DISALLOW_COPY_AND_ASSIGN(Queue);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Queue_h_
diff --git a/linux-x64/clang/include/lldb/Target/QueueItem.h b/linux-x64/clang/include/lldb/Target/QueueItem.h
new file mode 100644
index 0000000..dfae3b8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/QueueItem.h
@@ -0,0 +1,167 @@
+//===-- QueueItem.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_QueueItem_h_
+#define liblldb_QueueItem_h_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
+
+#include "lldb/Core/Address.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+
+// QueueItem:
+// This class represents a work item enqueued on a libdispatch aka Grand
+// Central Dispatch (GCD) queue. Most often, this will be a function or block.
+// "enqueued" here means that the work item has been added to a queue but it
+// has not yet started executing. When it is "dequeued", execution of the item
+// begins.
+
+class QueueItem : public std::enable_shared_from_this<QueueItem> {
+public:
+ QueueItem(lldb::QueueSP queue_sp, lldb::ProcessSP process_sp,
+ lldb::addr_t item_ref, lldb_private::Address address);
+
+ ~QueueItem();
+
+ /// Get the kind of work item this is
+ ///
+ /// \return
+ /// The type of work item that this QueueItem object
+ /// represents. eQueueItemKindUnknown may be returned.
+ lldb::QueueItemKind GetKind();
+
+ /// Set the type of work item this is
+ ///
+ /// \param [in] item_kind
+ /// Set the kind of this work item object.
+ void SetKind(lldb::QueueItemKind item_kind);
+
+ /// Get the code address that will be executed when this work item
+ /// is executed.
+ ///
+ /// \return
+ /// The address that will be invoked when this work item is
+ /// executed. Not all types of QueueItems will have an
+ /// address associated with them; check that the returned
+ /// Address is valid, or check that the WorkItemKind is a
+ /// kind that involves an address, such as eQueueItemKindFunction
+ /// or eQueueItemKindBlock.
+ lldb_private::Address &GetAddress();
+
+ /// Set the work item address for this object
+ ///
+ /// \param [in] addr
+ /// The address that will be invoked when this work item
+ /// is executed.
+ void SetAddress(lldb_private::Address addr);
+
+ /// Check if this QueueItem object is valid
+ ///
+ /// If the weak pointer to the parent Queue cannot be revivified,
+ /// it is invalid.
+ ///
+ /// \return
+ /// True if this object is valid.
+ bool IsValid() { return m_queue_wp.lock() != nullptr; }
+
+ /// Get an extended backtrace thread for this queue item, if available
+ ///
+ /// If the backtrace/thread information was collected when this item
+ /// was enqueued, this call will provide it.
+ ///
+ /// \param [in] type
+ /// The type of extended backtrace being requested, e.g. "libdispatch"
+ /// or "pthread".
+ ///
+ /// \return
+ /// A thread shared pointer which will have a reference to an extended
+ /// thread if one was available.
+ lldb::ThreadSP GetExtendedBacktraceThread(ConstString type);
+
+ void SetItemThatEnqueuedThis(lldb::addr_t address_of_item) {
+ m_item_that_enqueued_this_ref = address_of_item;
+ }
+
+ lldb::addr_t GetItemThatEnqueuedThis();
+
+ void SetEnqueueingThreadID(lldb::tid_t tid) { m_enqueueing_thread_id = tid; }
+
+ lldb::tid_t GetEnqueueingThreadID();
+
+ void SetEnqueueingQueueID(lldb::queue_id_t qid) {
+ m_enqueueing_queue_id = qid;
+ }
+
+ lldb::queue_id_t GetEnqueueingQueueID();
+
+ void SetTargetQueueID(lldb::queue_id_t qid) { m_target_queue_id = qid; }
+
+ void SetStopID(uint32_t stop_id) { m_stop_id = stop_id; }
+
+ uint32_t GetStopID();
+
+ void SetEnqueueingBacktrace(std::vector<lldb::addr_t> backtrace) {
+ m_backtrace = backtrace;
+ }
+
+ std::vector<lldb::addr_t> &GetEnqueueingBacktrace();
+
+ void SetThreadLabel(std::string thread_name) { m_thread_label = thread_name; }
+
+ std::string GetThreadLabel();
+
+ void SetQueueLabel(std::string queue_name) { m_queue_label = queue_name; }
+
+ std::string GetQueueLabel();
+
+ void SetTargetQueueLabel(std::string queue_name) {
+ m_target_queue_label = queue_name;
+ }
+
+ lldb::ProcessSP GetProcessSP();
+
+protected:
+ void FetchEntireItem();
+
+ lldb::QueueWP m_queue_wp;
+ lldb::ProcessWP m_process_wp;
+
+ lldb::addr_t m_item_ref; // the token we can be used to fetch more information
+ // about this queue item
+ lldb_private::Address m_address;
+ bool m_have_fetched_entire_item;
+
+ lldb::QueueItemKind m_kind;
+ lldb::addr_t m_item_that_enqueued_this_ref; // a handle that we can pass into
+ // libBacktraceRecording
+ // to get the QueueItem that enqueued this item
+ lldb::tid_t m_enqueueing_thread_id; // thread that enqueued this item
+ lldb::queue_id_t
+ m_enqueueing_queue_id; // Queue that enqueued this item, if it was a queue
+ lldb::queue_id_t m_target_queue_id;
+ uint32_t m_stop_id; // indicates when this backtrace was recorded in time
+ std::vector<lldb::addr_t> m_backtrace;
+ std::string m_thread_label;
+ std::string m_queue_label;
+ std::string m_target_queue_label;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(QueueItem);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_QueueItem_h_
diff --git a/linux-x64/clang/include/lldb/Target/QueueList.h b/linux-x64/clang/include/lldb/Target/QueueList.h
new file mode 100644
index 0000000..761107e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/QueueList.h
@@ -0,0 +1,110 @@
+//===-- QueueList.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_QueueList_h_
+#define liblldb_QueueList_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// QueueList:
+// This is the container for libdispatch aka Grand Central Dispatch Queue
+// objects.
+//
+// Each Process will have a QueueList. When the process execution is paused,
+// the QueueList may be populated with Queues by the SystemRuntime.
+
+class QueueList {
+ friend class Process;
+
+public:
+ QueueList(Process *process);
+
+ ~QueueList();
+
+ /// Get the number of libdispatch queues that are available
+ ///
+ /// \return
+ /// The number of queues that are stored in the QueueList.
+ uint32_t GetSize();
+
+ /// Get the Queue at a given index number
+ ///
+ /// \param [in] idx
+ /// The index number (0-based) of the queue.
+ /// \return
+ /// The Queue at that index number.
+ lldb::QueueSP GetQueueAtIndex(uint32_t idx);
+
+ typedef std::vector<lldb::QueueSP> collection;
+ typedef LockingAdaptedIterable<collection, lldb::QueueSP, vector_adapter,
+ std::mutex>
+ QueueIterable;
+
+ /// Iterate over the list of queues
+ ///
+ /// \return
+ /// An Iterable object which can be used to loop over the queues
+ /// that exist.
+ QueueIterable Queues() { return QueueIterable(m_queues, m_mutex); }
+
+ /// Clear out the list of queues from the QueueList
+ void Clear();
+
+ /// Add a Queue to the QueueList
+ ///
+ /// \param [in] queue
+ /// Used by the SystemRuntime to populate the QueueList
+ void AddQueue(lldb::QueueSP queue);
+
+ /// Find a queue in the QueueList by QueueID
+ ///
+ /// \param [in] qid
+ /// The QueueID (same as returned by Thread::GetQueueID()) to find.
+ ///
+ /// \return
+ /// A QueueSP to the queue requested, if it is present in the QueueList.
+ /// An empty QueueSP will be returned if this queue was not found.
+ lldb::QueueSP FindQueueByID(lldb::queue_id_t qid);
+
+ /// Find a queue in the QueueList by IndexID
+ ///
+ /// \param [in] index_id
+ /// Find a queue by IndexID. This is an integer associated with each
+ /// unique queue seen during a debug session and will not be reused
+ /// for a different queue. Unlike the QueueID, a 64-bit value, this
+ /// will tend to be an integral value like 1 or 7.
+ ///
+ /// \return
+ /// A QueueSP to the queue requested, if it is present in the QueueList.
+ /// An empty QueueSP will be returned if this queue was not found.
+ lldb::QueueSP FindQueueByIndexID(uint32_t index_id);
+
+ std::mutex &GetMutex();
+
+protected:
+ // Classes that inherit from Process can see and modify these
+ Process *m_process; ///< The process that manages this queue list.
+ uint32_t
+ m_stop_id; ///< The process stop ID that this queue list is valid for.
+ collection m_queues; ///< The queues for this process.
+ std::mutex m_mutex;
+
+private:
+ QueueList() = delete;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_QueueList_h_
diff --git a/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h b/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h
new file mode 100644
index 0000000..4f9654f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h
@@ -0,0 +1,53 @@
+//===-- RegisterCheckpoint.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterCheckpoint_h_
+#define liblldb_RegisterCheckpoint_h_
+
+#include "lldb/Target/StackID.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// Inherit from UserID in case pushing/popping all register values can be done
+// using a 64 bit integer that holds a baton/cookie instead of actually having
+// to read all register values into a buffer
+class RegisterCheckpoint : public UserID {
+public:
+ enum class Reason {
+ // An expression is about to be run on the thread if the protocol that
+ // talks to the debuggee supports checkpointing the registers using a
+ // push/pop then the UserID base class in the RegisterCheckpoint can be
+ // used to store the baton/cookie that refers to the remote saved state.
+ eExpression,
+ // The register checkpoint wants the raw register bytes, so they must be
+ // read into m_data_sp, or the save/restore checkpoint should fail.
+ eDataBackup
+ };
+
+ RegisterCheckpoint(Reason reason)
+ : UserID(0), m_data_sp(), m_reason(reason) {}
+
+ ~RegisterCheckpoint() {}
+
+ lldb::DataBufferSP &GetData() { return m_data_sp; }
+
+ const lldb::DataBufferSP &GetData() const { return m_data_sp; }
+
+protected:
+ lldb::DataBufferSP m_data_sp;
+ Reason m_reason;
+
+ // Make RegisterCheckpointSP if you wish to share the data in this class.
+ DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_RegisterCheckpoint_h_
diff --git a/linux-x64/clang/include/lldb/Target/RegisterContext.h b/linux-x64/clang/include/lldb/Target/RegisterContext.h
new file mode 100644
index 0000000..d6212dd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/RegisterContext.h
@@ -0,0 +1,209 @@
+//===-- RegisterContext.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContext_h_
+#define liblldb_RegisterContext_h_
+
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class RegisterContext : public std::enable_shared_from_this<RegisterContext>,
+ public ExecutionContextScope {
+public:
+ // Constructors and Destructors
+ RegisterContext(Thread &thread, uint32_t concrete_frame_idx);
+
+ ~RegisterContext() override;
+
+ void InvalidateIfNeeded(bool force);
+
+ // Subclasses must override these functions
+ virtual void InvalidateAllRegisters() = 0;
+
+ virtual size_t GetRegisterCount() = 0;
+
+ virtual const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) = 0;
+
+ // Detect the register size dynamically.
+ uint32_t UpdateDynamicRegisterSize(const lldb_private::ArchSpec &arch,
+ RegisterInfo *reg_info);
+
+ virtual size_t GetRegisterSetCount() = 0;
+
+ virtual const RegisterSet *GetRegisterSet(size_t reg_set) = 0;
+
+ virtual bool ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_value) = 0;
+
+ virtual bool WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_value) = 0;
+
+ virtual bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) {
+ return false;
+ }
+
+ virtual bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) {
+ return false;
+ }
+
+ // These two functions are used to implement "push" and "pop" of register
+ // states. They are used primarily for expression evaluation, where we need
+ // to push a new state (storing the old one in data_sp) and then restoring
+ // the original state by passing the data_sp we got from ReadAllRegisters to
+ // WriteAllRegisterValues. ReadAllRegisters will do what is necessary to
+ // return a coherent set of register values for this thread, which may mean
+ // e.g. interrupting a thread that is sitting in a kernel trap. That is a
+ // somewhat disruptive operation, so these API's should only be used when
+ // this behavior is needed.
+
+ virtual bool
+ ReadAllRegisterValues(lldb_private::RegisterCheckpoint ®_checkpoint);
+
+ virtual bool WriteAllRegisterValues(
+ const lldb_private::RegisterCheckpoint ®_checkpoint);
+
+ bool CopyFromRegisterContext(lldb::RegisterContextSP context);
+
+ /// Convert from a given register numbering scheme to the lldb register
+ /// numbering scheme
+ ///
+ /// There may be multiple ways to enumerate the registers for a given
+ /// architecture. ABI references will specify one to be used with
+ /// DWARF, the register numberings from process plugin, there may
+ /// be a variation used for eh_frame unwind instructions (e.g. on Darwin),
+ /// and so on. Register 5 by itself is meaningless - RegisterKind
+ /// enumeration tells you what context that number should be translated as.
+ ///
+ /// Inside lldb, register numbers are in the eRegisterKindLLDB scheme;
+ /// arguments which take a register number should take one in that
+ /// scheme.
+ ///
+ /// eRegisterKindGeneric is a special numbering scheme which gives us
+ /// constant values for the pc, frame register, stack register, etc., for
+ /// use within lldb. They may not be defined for all architectures but
+ /// it allows generic code to translate these common registers into the
+ /// lldb numbering scheme.
+ ///
+ /// This method translates a given register kind + register number into
+ /// the eRegisterKindLLDB register numbering.
+ ///
+ /// \param [in] kind
+ /// The register numbering scheme (RegisterKind) that the following
+ /// register number is in.
+ ///
+ /// \param [in] num
+ /// A register number in the 'kind' register numbering scheme.
+ ///
+ /// \return
+ /// The equivalent register number in the eRegisterKindLLDB
+ /// numbering scheme, if possible, else LLDB_INVALID_REGNUM.
+ virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
+ uint32_t num) = 0;
+
+ // Subclasses can override these functions if desired
+ virtual uint32_t NumSupportedHardwareBreakpoints();
+
+ virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
+
+ virtual bool ClearHardwareBreakpoint(uint32_t hw_idx);
+
+ virtual uint32_t NumSupportedHardwareWatchpoints();
+
+ virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
+ bool read, bool write);
+
+ virtual bool ClearHardwareWatchpoint(uint32_t hw_index);
+
+ virtual bool HardwareSingleStep(bool enable);
+
+ virtual Status
+ ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t src_addr, uint32_t src_len,
+ RegisterValue ®_value);
+
+ virtual Status
+ WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t dst_addr, uint32_t dst_len,
+ const RegisterValue ®_value);
+
+ // Subclasses should not override these
+ virtual lldb::tid_t GetThreadID() const;
+
+ virtual Thread &GetThread() { return m_thread; }
+
+ const RegisterInfo *GetRegisterInfoByName(llvm::StringRef reg_name,
+ uint32_t start_idx = 0);
+
+ const RegisterInfo *GetRegisterInfo(lldb::RegisterKind reg_kind,
+ uint32_t reg_num);
+
+ uint64_t GetPC(uint64_t fail_value = LLDB_INVALID_ADDRESS);
+
+ bool SetPC(uint64_t pc);
+
+ bool SetPC(Address addr);
+
+ uint64_t GetSP(uint64_t fail_value = LLDB_INVALID_ADDRESS);
+
+ bool SetSP(uint64_t sp);
+
+ uint64_t GetFP(uint64_t fail_value = LLDB_INVALID_ADDRESS);
+
+ bool SetFP(uint64_t fp);
+
+ const char *GetRegisterName(uint32_t reg);
+
+ uint64_t GetReturnAddress(uint64_t fail_value = LLDB_INVALID_ADDRESS);
+
+ uint64_t GetFlags(uint64_t fail_value = 0);
+
+ uint64_t ReadRegisterAsUnsigned(uint32_t reg, uint64_t fail_value);
+
+ uint64_t ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
+ uint64_t fail_value);
+
+ bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval);
+
+ bool WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval);
+
+ bool ConvertBetweenRegisterKinds(lldb::RegisterKind source_rk,
+ uint32_t source_regnum,
+ lldb::RegisterKind target_rk,
+ uint32_t &target_regnum);
+
+ // lldb::ExecutionContextScope pure virtual functions
+ lldb::TargetSP CalculateTarget() override;
+
+ lldb::ProcessSP CalculateProcess() override;
+
+ lldb::ThreadSP CalculateThread() override;
+
+ lldb::StackFrameSP CalculateStackFrame() override;
+
+ void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
+
+ uint32_t GetStopID() const { return m_stop_id; }
+
+ void SetStopID(uint32_t stop_id) { m_stop_id = stop_id; }
+
+protected:
+ // Classes that inherit from RegisterContext can see and modify these
+ Thread &m_thread; // The thread that this register context belongs to.
+ uint32_t m_concrete_frame_idx; // The concrete frame index for this register
+ // context
+ uint32_t m_stop_id; // The stop ID that any data in this context is valid for
+private:
+ // For RegisterContext only
+ DISALLOW_COPY_AND_ASSIGN(RegisterContext);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_RegisterContext_h_
diff --git a/linux-x64/clang/include/lldb/Target/RegisterNumber.h b/linux-x64/clang/include/lldb/Target/RegisterNumber.h
new file mode 100644
index 0000000..0bef0c1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/RegisterNumber.h
@@ -0,0 +1,59 @@
+//===-- RegisterNumber.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_REGISTERNUMBER_H
+#define LLDB_TARGET_REGISTERNUMBER_H
+
+#include "lldb/lldb-private.h"
+#include <map>
+
+/// A class to represent register numbers, and able to convert between
+/// different register numbering schemes that may be used in a single
+/// debug session.
+
+class RegisterNumber {
+public:
+ RegisterNumber(lldb_private::Thread &thread, lldb::RegisterKind kind,
+ uint32_t num);
+
+ // This constructor plus the init() method below allow for the placeholder
+ // creation of an invalid object initially, possibly to be filled in. It
+ // would be more consistent to have three Set* methods to set the three data
+ // that the object needs.
+ RegisterNumber();
+
+ void init(lldb_private::Thread &thread, lldb::RegisterKind kind,
+ uint32_t num);
+
+ const RegisterNumber &operator=(const RegisterNumber &rhs);
+
+ bool operator==(RegisterNumber &rhs);
+
+ bool operator!=(RegisterNumber &rhs);
+
+ bool IsValid() const;
+
+ uint32_t GetAsKind(lldb::RegisterKind kind);
+
+ uint32_t GetRegisterNumber() const;
+
+ lldb::RegisterKind GetRegisterKind() const;
+
+ const char *GetName();
+
+private:
+ typedef std::map<lldb::RegisterKind, uint32_t> Collection;
+
+ lldb::RegisterContextSP m_reg_ctx_sp;
+ uint32_t m_regnum;
+ lldb::RegisterKind m_kind;
+ Collection m_kind_regnum_map;
+ const char *m_name;
+};
+
+#endif // liblldb_RegisterNumber_h
diff --git a/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h b/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h
new file mode 100644
index 0000000..524332f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h
@@ -0,0 +1,97 @@
+//===-- RemoteAwarePlatform.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_REMOTEAWAREPLATFORM_H
+#define LLDB_TARGET_REMOTEAWAREPLATFORM_H
+
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+/// A base class for platforms which automatically want to be able to forward
+/// operations to a remote platform instance (such as PlatformRemoteGDBServer).
+class RemoteAwarePlatform : public Platform {
+public:
+ using Platform::Platform;
+
+ bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
+ ModuleSpec &module_spec) override;
+
+ lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
+ uint32_t mode, Status &error) override;
+
+ bool CloseFile(lldb::user_id_t fd, Status &error) override;
+
+ uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
+ uint64_t dst_len, Status &error) override;
+
+ uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
+ uint64_t src_len, Status &error) override;
+
+ lldb::user_id_t GetFileSize(const FileSpec &file_spec) override;
+
+ Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override;
+
+ bool GetFileExists(const FileSpec &file_spec) override;
+
+ Status Unlink(const FileSpec &file_spec) override;
+
+ FileSpec GetRemoteWorkingDirectory() override;
+
+ bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override;
+
+ Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override;
+
+ Status GetFilePermissions(const FileSpec &file_spec,
+ uint32_t &file_permissions) override;
+
+ Status SetFilePermissions(const FileSpec &file_spec,
+ uint32_t file_permissions) override;
+
+ bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
+ uint64_t &high) override;
+
+ Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
+ FileSpec &local_file) override;
+
+ bool GetRemoteOSVersion() override;
+ bool GetRemoteOSBuildString(std::string &s) override;
+ bool GetRemoteOSKernelDescription(std::string &s) override;
+ ArchSpec GetRemoteSystemArchitecture() override;
+
+ Status RunShellCommand(const char *command, const FileSpec &working_dir,
+ int *status_ptr, int *signo_ptr,
+ std::string *command_output,
+ const Timeout<std::micro> &timeout) override;
+
+ const char *GetHostname() override;
+ UserIDResolver &GetUserIDResolver() override;
+ lldb_private::Environment GetEnvironment() override;
+
+ bool IsConnected() const override;
+
+ bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
+ uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &process_infos) override;
+
+ lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
+ llvm::StringRef plugin_name,
+ Debugger &debugger, Target *target,
+ Status &error) override;
+
+ Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
+
+ Status KillProcess(const lldb::pid_t pid) override;
+
+protected:
+ lldb::PlatformSP m_remote_platform_sp;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H
diff --git a/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h b/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h
new file mode 100644
index 0000000..71b5d0c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h
@@ -0,0 +1,83 @@
+//===-- SectionLoadHistory.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SectionLoadHistory_h_
+#define liblldb_SectionLoadHistory_h_
+
+#include <map>
+#include <mutex>
+
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class SectionLoadHistory {
+public:
+ enum : unsigned {
+ // Pass eStopIDNow to any function that takes a stop ID to get the current
+ // value.
+ eStopIDNow = UINT32_MAX
+ };
+ // Constructors and Destructors
+ SectionLoadHistory() : m_stop_id_to_section_load_list(), m_mutex() {}
+
+ ~SectionLoadHistory() {
+ // Call clear since this takes a lock and clears the section load list in
+ // case another thread is currently using this section load list
+ Clear();
+ }
+
+ SectionLoadList &GetCurrentSectionLoadList();
+
+ bool IsEmpty() const;
+
+ void Clear();
+
+ uint32_t GetLastStopID() const;
+
+ // Get the section load address given a process stop ID
+ lldb::addr_t GetSectionLoadAddress(uint32_t stop_id,
+ const lldb::SectionSP §ion_sp);
+
+ bool ResolveLoadAddress(uint32_t stop_id, lldb::addr_t load_addr,
+ Address &so_addr);
+
+ bool SetSectionLoadAddress(uint32_t stop_id,
+ const lldb::SectionSP §ion_sp,
+ lldb::addr_t load_addr,
+ bool warn_multiple = false);
+
+ // The old load address should be specified when unloading to ensure we get
+ // the correct instance of the section as a shared library could be loaded at
+ // more than one location.
+ bool SetSectionUnloaded(uint32_t stop_id, const lldb::SectionSP §ion_sp,
+ lldb::addr_t load_addr);
+
+ // Unload all instances of a section. This function can be used on systems
+ // that don't support multiple copies of the same shared library to be loaded
+ // at the same time.
+ size_t SetSectionUnloaded(uint32_t stop_id,
+ const lldb::SectionSP §ion_sp);
+
+ void Dump(Stream &s, Target *target);
+
+protected:
+ SectionLoadList *GetSectionLoadListForStopID(uint32_t stop_id,
+ bool read_only);
+
+ typedef std::map<uint32_t, lldb::SectionLoadListSP> StopIDToSectionLoadList;
+ StopIDToSectionLoadList m_stop_id_to_section_load_list;
+ mutable std::recursive_mutex m_mutex;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SectionLoadHistory);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SectionLoadHistory_h_
diff --git a/linux-x64/clang/include/lldb/Target/SectionLoadList.h b/linux-x64/clang/include/lldb/Target/SectionLoadList.h
new file mode 100644
index 0000000..caefa00
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/SectionLoadList.h
@@ -0,0 +1,73 @@
+//===-- SectionLoadList.h -----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SectionLoadList_h_
+#define liblldb_SectionLoadList_h_
+
+#include <map>
+#include <mutex>
+
+#include "llvm/ADT/DenseMap.h"
+#include "lldb/Core/Section.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class SectionLoadList {
+public:
+ // Constructors and Destructors
+ SectionLoadList() : m_addr_to_sect(), m_sect_to_addr(), m_mutex() {}
+
+ SectionLoadList(const SectionLoadList &rhs);
+
+ ~SectionLoadList() {
+ // Call clear since this takes a lock and clears the section load list in
+ // case another thread is currently using this section load list
+ Clear();
+ }
+
+ void operator=(const SectionLoadList &rhs);
+
+ bool IsEmpty() const;
+
+ void Clear();
+
+ lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp) 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,
+ bool warn_multiple = false);
+
+ // The old load address should be specified when unloading to ensure we get
+ // the correct instance of the section as a shared library could be loaded at
+ // more than one location.
+ bool SetSectionUnloaded(const lldb::SectionSP §ion_sp,
+ lldb::addr_t load_addr);
+
+ // Unload all instances of a section. This function can be used on systems
+ // that don't support multiple copies of the same shared library to be loaded
+ // at the same time.
+ size_t SetSectionUnloaded(const lldb::SectionSP §ion_sp);
+
+ void Dump(Stream &s, Target *target);
+
+protected:
+ typedef std::map<lldb::addr_t, lldb::SectionSP> addr_to_sect_collection;
+ typedef llvm::DenseMap<const Section *, lldb::addr_t> sect_to_addr_collection;
+ addr_to_sect_collection m_addr_to_sect;
+ sect_to_addr_collection m_sect_to_addr;
+ mutable std::recursive_mutex m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SectionLoadList_h_
diff --git a/linux-x64/clang/include/lldb/Target/StackFrame.h b/linux-x64/clang/include/lldb/Target/StackFrame.h
new file mode 100644
index 0000000..4e6e79b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StackFrame.h
@@ -0,0 +1,527 @@
+//===-- StackFrame.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StackFrame_h_
+#define liblldb_StackFrame_h_
+
+#include <memory>
+#include <mutex>
+
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Utility/Scalar.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/UserID.h"
+
+namespace lldb_private {
+
+/// \class StackFrame StackFrame.h "lldb/Target/StackFrame.h"
+///
+/// This base class provides an interface to stack frames.
+///
+/// StackFrames may have a Canonical Frame Address (CFA) or not.
+/// A frame may have a plain pc value or it may indicate a specific point in
+/// the debug session so the correct section load list is used for
+/// symbolication.
+///
+/// Local variables may be available, or not. A register context may be
+/// available, or not.
+
+class StackFrame : public ExecutionContextScope,
+ public std::enable_shared_from_this<StackFrame> {
+public:
+ enum ExpressionPathOption {
+ eExpressionPathOptionCheckPtrVsMember = (1u << 0),
+ eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
+ eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
+ eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
+ eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4),
+ eExpressionPathOptionsInspectAnonymousUnions = (1u << 5)
+ };
+
+ enum class Kind {
+ /// A regular stack frame with access to registers and local variables.
+ Regular,
+
+ /// A historical stack frame -- possibly without CFA or registers or
+ /// local variables.
+ History,
+
+ /// An artificial stack frame (e.g. a synthesized result of inferring
+ /// missing tail call frames from a backtrace) with limited support for
+ /// local variables.
+ Artificial
+ };
+
+ /// Construct a StackFrame object without supplying a RegisterContextSP.
+ ///
+ /// This is the one constructor that doesn't take a RegisterContext
+ /// parameter. This ctor may be called when creating a history StackFrame;
+ /// these are used if we've collected a stack trace of pc addresses at some
+ /// point in the past. We may only have pc values. We may have a CFA,
+ /// or more likely, we won't.
+ ///
+ /// \param [in] thread_sp
+ /// The Thread that this frame belongs to.
+ ///
+ /// \param [in] frame_idx
+ /// This StackFrame's frame index number in the Thread. If inlined stack
+ /// frames are being created, this may differ from the concrete_frame_idx
+ /// which is the frame index without any inlined stack frames.
+ ///
+ /// \param [in] concrete_frame_idx
+ /// The StackFrame's frame index number in the Thread without any inlined
+ /// stack frames being included in the index.
+ ///
+ /// \param [in] cfa
+ /// The Canonical Frame Address (this terminology from DWARF) for this
+ /// stack frame. The CFA for a stack frame does not change over the
+ /// span of the stack frame's existence. It is often the value of the
+ /// caller's stack pointer before the call instruction into this frame's
+ /// function. It is usually not the same as the frame pointer register's
+ /// value.
+ ///
+ /// \param [in] cfa_is_valid
+ /// A history stack frame may not have a CFA value collected. We want to
+ /// distinguish between "no CFA available" and a CFA of
+ /// LLDB_INVALID_ADDRESS.
+ ///
+ /// \param [in] pc
+ /// The current pc value of this stack frame.
+ ///
+ /// \param [in] frame_kind
+ ///
+ /// \param [in] sc_ptr
+ /// Optionally seed the StackFrame with the SymbolContext information that
+ /// has
+ /// already been discovered.
+ StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa,
+ bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind,
+ const SymbolContext *sc_ptr);
+
+ StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_idx,
+ const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa,
+ lldb::addr_t pc, const SymbolContext *sc_ptr);
+
+ StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_idx,
+ const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa,
+ const Address &pc, const SymbolContext *sc_ptr);
+
+ ~StackFrame() override;
+
+ lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); }
+
+ StackID &GetStackID();
+
+ /// Get an Address for the current pc value in this StackFrame.
+ ///
+ /// May not be the same as the actual PC value for inlined stack frames.
+ ///
+ /// \return
+ /// The Address object set to the current PC value.
+ const Address &GetFrameCodeAddress();
+
+ /// Change the pc value for a given thread.
+ ///
+ /// Change the current pc value for the frame on this thread.
+ ///
+ /// \param[in] pc
+ /// The load address that the pc will be set to.
+ ///
+ /// \return
+ /// true if the pc was changed. false if this failed -- possibly
+ /// because this frame is not a live StackFrame.
+ bool ChangePC(lldb::addr_t pc);
+
+ /// Provide a SymbolContext for this StackFrame's current pc value.
+ ///
+ /// The StackFrame maintains this SymbolContext and adds additional
+ /// information to it on an as-needed basis. This helps to avoid different
+ /// functions looking up symbolic information for a given pc value multiple
+ /// times.
+ ///
+ /// \params [in] resolve_scope
+ /// Flags from the SymbolContextItem enumerated type which specify what
+ /// type of symbol context is needed by this caller.
+ ///
+ /// \return
+ /// A SymbolContext reference which includes the types of information
+ /// requested by resolve_scope, if they are available.
+ const SymbolContext &GetSymbolContext(lldb::SymbolContextItem resolve_scope);
+
+ /// Return the Canonical Frame Address (DWARF term) for this frame.
+ ///
+ /// The CFA is typically the value of the stack pointer register before the
+ /// call invocation is made. It will not change during the lifetime of a
+ /// stack frame. It is often not the same thing as the frame pointer
+ /// register value.
+ ///
+ /// Live StackFrames will always have a CFA but other types of frames may
+ /// not be able to supply one.
+ ///
+ /// \param [out] value
+ /// The address of the CFA for this frame, if available.
+ ///
+ /// \param [out] error_ptr
+ /// If there is an error determining the CFA address, this may contain a
+ /// string explaining the failure.
+ ///
+ /// \return
+ /// 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, Status *error_ptr);
+
+ /// Get the DWARFExpression corresponding to the Canonical Frame Address.
+ ///
+ /// Often a register (bp), but sometimes a register + offset.
+ ///
+ /// \param [out] error_ptr
+ /// If there is an error determining the CFA address, this may contain a
+ /// string explaining the failure.
+ ///
+ /// \return
+ /// Returns the corresponding DWARF expression, or NULL.
+ DWARFExpression *GetFrameBaseExpression(Status *error_ptr);
+
+ /// Get the current lexical scope block for this StackFrame, if possible.
+ ///
+ /// If debug information is available for this stack frame, return a pointer
+ /// to the innermost lexical Block that the frame is currently executing.
+ ///
+ /// \return
+ /// A pointer to the current Block. nullptr is returned if this can
+ /// not be provided.
+ Block *GetFrameBlock();
+
+ /// Get the RegisterContext for this frame, if possible.
+ ///
+ /// Returns a shared pointer to the RegisterContext for this stack frame.
+ /// Only a live StackFrame object will be able to return a RegisterContext -
+ /// callers must be prepared for an empty shared pointer being returned.
+ ///
+ /// Even a live StackFrame RegisterContext may not be able to provide all
+ /// registers. Only the currently executing frame (frame 0) can reliably
+ /// provide every register in the register context.
+ ///
+ /// \return
+ /// The RegisterContext shared point for this frame.
+ lldb::RegisterContextSP GetRegisterContext();
+
+ const lldb::RegisterContextSP &GetRegisterContextSP() const {
+ return m_reg_context_sp;
+ }
+
+ /// Retrieve the list of variables that are in scope at this StackFrame's
+ /// pc.
+ ///
+ /// A frame that is not live may return an empty VariableList for a given
+ /// pc value even though variables would be available at this point if it
+ /// were a live stack frame.
+ ///
+ /// \param[in] get_file_globals
+ /// Whether to also retrieve compilation-unit scoped variables
+ /// that are visible to the entire compilation unit (e.g. file
+ /// static in C, globals that are homed in this CU).
+ ///
+ /// \return
+ /// A pointer to a list of variables.
+ VariableList *GetVariableList(bool get_file_globals);
+
+ /// Retrieve the list of variables that are in scope at this StackFrame's
+ /// pc.
+ ///
+ /// A frame that is not live may return an empty VariableListSP for a
+ /// given pc value even though variables would be available at this point if
+ /// it were a live stack frame.
+ ///
+ /// \param[in] get_file_globals
+ /// Whether to also retrieve compilation-unit scoped variables
+ /// that are visible to the entire compilation unit (e.g. file
+ /// static in C, globals that are homed in this CU).
+ ///
+ /// \return
+ /// A pointer to a list of variables.
+ lldb::VariableListSP
+ GetInScopeVariableList(bool get_file_globals,
+ bool must_have_valid_location = false);
+
+ /// Create a ValueObject for a variable name / pathname, possibly including
+ /// simple dereference/child selection syntax.
+ ///
+ /// \param[in] var_expr
+ /// The string specifying a variable to base the VariableObject off
+ /// of.
+ ///
+ /// \param[in] use_dynamic
+ /// Whether the correct dynamic type of an object pointer should be
+ /// determined before creating the object, or if the static type is
+ /// sufficient. One of the DynamicValueType enumerated values.
+ ///
+ /// \param[in] options
+ /// An unsigned integer of flags, values from
+ /// StackFrame::ExpressionPathOption
+ /// enum.
+ /// \param[in] var_sp
+ /// A VariableSP that will be set to the variable described in the
+ /// var_expr path.
+ ///
+ /// \param[in] error
+ /// Record any errors encountered while evaluating var_expr.
+ ///
+ /// \return
+ /// A shared pointer to the ValueObject described by var_expr.
+ lldb::ValueObjectSP GetValueForVariableExpressionPath(
+ llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
+ uint32_t options, lldb::VariableSP &var_sp, Status &error);
+
+ /// Determine whether this StackFrame has debug information available or not
+ ///
+ /// \return
+ // true if debug information is available for this frame (function,
+ // compilation unit, block, etc.)
+ bool HasDebugInformation();
+
+ /// Return the disassembly for the instructions of this StackFrame's
+ /// function as a single C string.
+ ///
+ /// \return
+ // C string with the assembly instructions for this function.
+ const char *Disassemble();
+
+ /// Print a description for this frame using the frame-format formatter
+ /// settings.
+ ///
+ /// \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, bool show_unique = false,
+ const char *frame_marker = nullptr);
+
+ /// Print a description for this frame using a default format.
+ ///
+ /// \param [in] strm
+ /// The Stream to print the description to.
+ ///
+ /// \param [in] show_frame_index
+ /// Whether to print the frame number or not.
+ ///
+ /// \param [in] show_fullpaths
+ /// Whether to print the full source paths or just the file base name.
+ void Dump(Stream *strm, bool show_frame_index, bool show_fullpaths);
+
+ /// Print a description of this stack frame and/or the source
+ /// context/assembly for this stack frame.
+ ///
+ /// \param[in] strm
+ /// The Stream to send the output to.
+ ///
+ /// \param[in] show_frame_info
+ /// If true, print the frame info by calling DumpUsingSettingsFormat().
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// Returns true if successful.
+ bool GetStatus(Stream &strm, bool show_frame_info, bool show_source,
+ bool show_unique = false, const char *frame_marker = nullptr);
+
+ /// Query whether this frame is a concrete frame on the call stack, or if it
+ /// is an inlined frame derived from the debug information and presented by
+ /// the debugger.
+ ///
+ /// \return
+ /// true if this is an inlined frame.
+ bool IsInlined();
+
+ /// Query whether this frame is part of a historical backtrace.
+ bool IsHistorical() const;
+
+ /// Query whether this frame is artificial (e.g a synthesized result of
+ /// inferring missing tail call frames from a backtrace). Artificial frames
+ /// may have limited support for inspecting variables.
+ bool IsArtificial() const;
+
+ /// Query this frame to find what frame it is in this Thread's
+ /// StackFrameList.
+ ///
+ /// \return
+ /// StackFrame index 0 indicates the currently-executing function. Inline
+ /// frames are included in this frame index count.
+ uint32_t GetFrameIndex() const;
+
+ /// Set this frame's synthetic frame index.
+ void SetFrameIndex(uint32_t index) { m_frame_index = index; }
+
+ /// Query this frame to find what frame it is in this Thread's
+ /// StackFrameList, not counting inlined frames.
+ ///
+ /// \return
+ /// StackFrame index 0 indicates the currently-executing function. Inline
+ /// frames are not included in this frame index count; their concrete
+ /// frame index will be the same as the concrete frame that they are
+ /// derived from.
+ uint32_t GetConcreteFrameIndex() const { return m_concrete_frame_index; }
+
+ /// Create a ValueObject for a given Variable in this StackFrame.
+ ///
+ /// \params [in] variable_sp
+ /// The Variable to base this ValueObject on
+ ///
+ /// \params [in] use_dynamic
+ /// Whether the correct dynamic type of the variable should be
+ /// determined before creating the ValueObject, or if the static type
+ /// is sufficient. One of the DynamicValueType enumerated values.
+ ///
+ /// \return
+ // A ValueObject for this variable.
+ lldb::ValueObjectSP
+ GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp,
+ lldb::DynamicValueType use_dynamic);
+
+ /// Add an arbitrary Variable object (e.g. one that specifics a global or
+ /// static) to a StackFrame's list of ValueObjects.
+ ///
+ /// \params [in] variable_sp
+ /// The Variable to base this ValueObject on
+ ///
+ /// \params [in] use_dynamic
+ /// Whether the correct dynamic type of the variable should be
+ /// determined before creating the ValueObject, or if the static type
+ /// is sufficient. One of the DynamicValueType enumerated values.
+ ///
+ /// \return
+ // A ValueObject for this variable.
+ lldb::ValueObjectSP TrackGlobalVariable(const lldb::VariableSP &variable_sp,
+ lldb::DynamicValueType use_dynamic);
+
+ /// Query this frame to determine what the default language should be when
+ /// parsing expressions given the execution context.
+ ///
+ /// \return
+ /// The language of the frame if known, else lldb::eLanguageTypeUnknown.
+ lldb::LanguageType GetLanguage();
+
+ // similar to GetLanguage(), but is allowed to take a potentially incorrect
+ // guess if exact information is not available
+ lldb::LanguageType GuessLanguage();
+
+ /// Attempt to econstruct the ValueObject for a given raw address touched by
+ /// the current instruction. The ExpressionPath should indicate how to get
+ /// to this value using "frame variable."
+ ///
+ /// \params [in] addr
+ /// The raw address.
+ ///
+ /// \return
+ /// The ValueObject if found. If valid, it has a valid ExpressionPath.
+ lldb::ValueObjectSP GuessValueForAddress(lldb::addr_t addr);
+
+ /// Attempt to reconstruct the ValueObject for the address contained in a
+ /// given register plus an offset. The ExpressionPath should indicate how
+ /// to get to this value using "frame variable."
+ ///
+ /// \params [in] reg
+ /// The name of the register.
+ ///
+ /// \params [in] offset
+ /// The offset from the register. Particularly important for sp...
+ ///
+ /// \return
+ /// The ValueObject if found. If valid, it has a valid ExpressionPath.
+ lldb::ValueObjectSP GuessValueForRegisterAndOffset(ConstString reg,
+ int64_t offset);
+
+ /// Attempt to reconstruct the ValueObject for a variable with a given \a name
+ /// from within the current StackFrame, within the current block. The search
+ /// for the variable starts in the deepest block corresponding to the current
+ /// PC in the stack frame and traverse through all parent blocks stopping at
+ /// inlined function boundaries.
+ ///
+ /// \params [in] name
+ /// The name of the variable.
+ ///
+ /// \return
+ /// The ValueObject if found.
+ lldb::ValueObjectSP FindVariable(ConstString name);
+
+ // lldb::ExecutionContextScope pure virtual functions
+ lldb::TargetSP CalculateTarget() override;
+
+ lldb::ProcessSP CalculateProcess() override;
+
+ lldb::ThreadSP CalculateThread() override;
+
+ lldb::StackFrameSP CalculateStackFrame() override;
+
+ void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
+
+ lldb::RecognizedStackFrameSP GetRecognizedFrame();
+
+protected:
+ friend class StackFrameList;
+
+ void SetSymbolContextScope(SymbolContextScope *symbol_scope);
+
+ void UpdateCurrentFrameFromPreviousFrame(StackFrame &prev_frame);
+
+ void UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame);
+
+ bool HasCachedData() const;
+
+private:
+ // For StackFrame only
+ lldb::ThreadWP m_thread_wp;
+ uint32_t m_frame_index;
+ uint32_t m_concrete_frame_index;
+ lldb::RegisterContextSP m_reg_context_sp;
+ StackID m_id;
+ Address m_frame_code_addr; // The frame code address (might not be the same as
+ // the actual PC for inlined frames) as a
+ // section/offset address
+ SymbolContext m_sc;
+ Flags m_flags;
+ Scalar m_frame_base;
+ Status m_frame_base_error;
+ bool m_cfa_is_valid; // Does this frame have a CFA? Different from CFA ==
+ // LLDB_INVALID_ADDRESS
+ Kind m_stack_frame_kind;
+ lldb::VariableListSP m_variable_list_sp;
+ ValueObjectList m_variable_list_value_objects; // Value objects for each
+ // variable in
+ // m_variable_list_sp
+ lldb::RecognizedStackFrameSP m_recognized_frame_sp;
+ StreamString m_disassembly;
+ std::recursive_mutex m_mutex;
+
+ DISALLOW_COPY_AND_ASSIGN(StackFrame);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StackFrame_h_
diff --git a/linux-x64/clang/include/lldb/Target/StackFrameList.h b/linux-x64/clang/include/lldb/Target/StackFrameList.h
new file mode 100644
index 0000000..5eb7919
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StackFrameList.h
@@ -0,0 +1,163 @@
+//===-- StackFrameList.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StackFrameList_h_
+#define liblldb_StackFrameList_h_
+
+#include <memory>
+#include <mutex>
+#include <vector>
+
+#include "lldb/Target/StackFrame.h"
+
+namespace lldb_private {
+
+class StackFrameList {
+public:
+ // Constructors and Destructors
+ StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp,
+ bool show_inline_frames);
+
+ ~StackFrameList();
+
+ /// Get the number of visible frames. Frames may be created if \p can_create
+ /// is true. Synthetic (inline) frames expanded from the concrete frame #0
+ /// (aka invisible frames) are not included in this count.
+ uint32_t GetNumFrames(bool can_create = true);
+
+ /// Get the frame at index \p idx. Invisible frames cannot be indexed.
+ lldb::StackFrameSP GetFrameAtIndex(uint32_t idx);
+
+ /// Get the first concrete frame with index greater than or equal to \p idx.
+ /// Unlike \ref GetFrameAtIndex, this cannot return a synthetic frame.
+ lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx);
+
+ /// Retrieve the stack frame with the given ID \p stack_id.
+ lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id);
+
+ /// Mark a stack frame as the currently selected frame and return its index.
+ uint32_t SetSelectedFrame(lldb_private::StackFrame *frame);
+
+ /// Get the currently selected frame index.
+ uint32_t GetSelectedFrameIndex() const;
+
+ /// Mark a stack frame as the currently selected frame using the frame index
+ /// \p idx. Like \ref GetFrameAtIndex, invisible frames cannot be selected.
+ bool SetSelectedFrameByIndex(uint32_t idx);
+
+ /// If the current inline depth (i.e the number of invisible frames) is valid,
+ /// subtract it from \p idx. Otherwise simply return \p idx.
+ uint32_t GetVisibleStackFrameIndex(uint32_t idx) {
+ if (m_current_inlined_depth < UINT32_MAX)
+ return idx - m_current_inlined_depth;
+ else
+ return idx;
+ }
+
+ /// Calculate and set the current inline depth. This may be used to update
+ /// the StackFrameList's set of inline frames when execution stops, e.g when
+ /// a breakpoint is hit.
+ void CalculateCurrentInlinedDepth();
+
+ /// If the currently selected frame comes from the currently selected thread,
+ /// point the default file and line of the thread's target to the location
+ /// specified by the frame.
+ void SetDefaultFileAndLineToSelectedFrame();
+
+ /// Clear the cache of frames.
+ void Clear();
+
+ void Dump(Stream *s);
+
+ /// If \p stack_frame_ptr is contained in this StackFrameList, return its
+ /// wrapping shared pointer.
+ lldb::StackFrameSP
+ GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr);
+
+ 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:
+ friend class Thread;
+
+ bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
+
+ static void Merge(std::unique_ptr<StackFrameList> &curr_up,
+ lldb::StackFrameListSP &prev_sp);
+
+ void GetFramesUpTo(uint32_t end_idx);
+
+ void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind *unwinder);
+
+ void SynthesizeTailCallFrames(StackFrame &next_frame);
+
+ bool GetAllFramesFetched() { return m_concrete_frames_fetched == UINT32_MAX; }
+
+ void SetAllFramesFetched() { m_concrete_frames_fetched = UINT32_MAX; }
+
+ bool DecrementCurrentInlinedDepth();
+
+ void ResetCurrentInlinedDepth();
+
+ uint32_t GetCurrentInlinedDepth();
+
+ void SetCurrentInlinedDepth(uint32_t new_depth);
+
+ typedef std::vector<lldb::StackFrameSP> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ /// The thread this frame list describes.
+ Thread &m_thread;
+
+ /// The old stack frame list.
+ // TODO: The old stack frame list is used to fill in missing frame info
+ // heuristically when it's otherwise unavailable (say, because the unwinder
+ // fails). We should have stronger checks to make sure that this is a valid
+ // source of information.
+ lldb::StackFrameListSP m_prev_frames_sp;
+
+ /// A mutex for this frame list.
+ // TODO: This mutex may not always be held when required. In particular, uses
+ // of the StackFrameList APIs in lldb_private::Thread look suspect. Consider
+ // passing around a lock_guard reference to enforce proper locking.
+ mutable std::recursive_mutex m_mutex;
+
+ /// A cache of frames. This may need to be updated when the program counter
+ /// changes.
+ collection m_frames;
+
+ /// The currently selected frame.
+ uint32_t m_selected_frame_idx;
+
+ /// The number of concrete frames fetched while filling the frame list. This
+ /// is only used when synthetic frames are enabled.
+ uint32_t m_concrete_frames_fetched;
+
+ /// The number of synthetic function activations (invisible frames) expanded
+ /// from the concrete frame #0 activation.
+ // TODO: Use an optional instead of UINT32_MAX to denote invalid values.
+ uint32_t m_current_inlined_depth;
+
+ /// The program counter value at the currently selected synthetic activation.
+ /// This is only valid if m_current_inlined_depth is valid.
+ // TODO: Use an optional instead of UINT32_MAX to denote invalid values.
+ lldb::addr_t m_current_inlined_pc;
+
+ /// Whether or not to show synthetic (inline) frames. Immutable.
+ const bool m_show_inlined_frames;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(StackFrameList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StackFrameList_h_
diff --git a/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h b/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h
new file mode 100644
index 0000000..2021ac5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h
@@ -0,0 +1,161 @@
+//===-- StackFrameRecognizer.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StackFrameRecognizer_h_
+#define liblldb_StackFrameRecognizer_h_
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Symbol/VariableList.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+/// \class RecognizedStackFrame
+///
+/// This class provides extra information about a stack frame that was
+/// provided by a specific stack frame recognizer. Right now, this class only
+/// holds recognized arguments (via GetRecognizedArguments).
+
+class RecognizedStackFrame
+ : public std::enable_shared_from_this<RecognizedStackFrame> {
+public:
+ virtual lldb::ValueObjectListSP GetRecognizedArguments() {
+ return m_arguments;
+ }
+ virtual lldb::ValueObjectSP GetExceptionObject() {
+ return lldb::ValueObjectSP();
+ }
+ virtual ~RecognizedStackFrame(){};
+
+protected:
+ lldb::ValueObjectListSP m_arguments;
+};
+
+/// \class StackFrameRecognizer
+///
+/// A base class for frame recognizers. Subclasses (actual frame recognizers)
+/// should implement RecognizeFrame to provide a RecognizedStackFrame for a
+/// given stack frame.
+
+class StackFrameRecognizer
+ : public std::enable_shared_from_this<StackFrameRecognizer> {
+public:
+ virtual lldb::RecognizedStackFrameSP RecognizeFrame(
+ lldb::StackFrameSP frame) {
+ return lldb::RecognizedStackFrameSP();
+ };
+ virtual std::string GetName() {
+ return "";
+ }
+
+ virtual ~StackFrameRecognizer(){};
+};
+
+/// \class ScriptedStackFrameRecognizer
+///
+/// Python implementation for frame recognizers. An instance of this class
+/// tracks a particular Python classobject, which will be asked to recognize
+/// stack frames.
+
+class ScriptedStackFrameRecognizer : public StackFrameRecognizer {
+ lldb_private::ScriptInterpreter *m_interpreter;
+ lldb_private::StructuredData::ObjectSP m_python_object_sp;
+ std::string m_python_class;
+
+public:
+ ScriptedStackFrameRecognizer(lldb_private::ScriptInterpreter *interpreter,
+ const char *pclass);
+ ~ScriptedStackFrameRecognizer() override {}
+
+ std::string GetName() override {
+ return GetPythonClassName();
+ }
+
+ const char *GetPythonClassName() { return m_python_class.c_str(); }
+
+ lldb::RecognizedStackFrameSP RecognizeFrame(
+ lldb::StackFrameSP frame) override;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptedStackFrameRecognizer);
+};
+
+/// \class StackFrameRecognizerManager
+///
+/// Static class that provides a registry of known stack frame recognizers.
+/// Has static methods to add, enumerate, remove, query and invoke recognizers.
+
+class StackFrameRecognizerManager {
+public:
+ static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
+ ConstString module,
+ ConstString symbol,
+ bool first_instruction_only = true);
+
+ static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
+ lldb::RegularExpressionSP module,
+ lldb::RegularExpressionSP symbol,
+ bool first_instruction_only = true);
+
+ static void ForEach(
+ std::function<void(uint32_t recognizer_id, std::string recognizer_name,
+ std::string module, std::string symbol,
+ bool regexp)> const &callback);
+
+ static bool RemoveRecognizerWithID(uint32_t recognizer_id);
+
+ static void RemoveAllRecognizers();
+
+ static lldb::StackFrameRecognizerSP GetRecognizerForFrame(
+ lldb::StackFrameSP frame);
+
+ static lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame);
+};
+
+/// \class ValueObjectRecognizerSynthesizedValue
+///
+/// ValueObject subclass that presents the passed ValueObject as a recognized
+/// value with the specified ValueType. Frame recognizers should return
+/// instances of this class as the returned objects in GetRecognizedArguments().
+
+class ValueObjectRecognizerSynthesizedValue : public ValueObject {
+ public:
+ static lldb::ValueObjectSP Create(ValueObject &parent, lldb::ValueType type) {
+ return (new ValueObjectRecognizerSynthesizedValue(parent, type))->GetSP();
+ }
+ ValueObjectRecognizerSynthesizedValue(ValueObject &parent,
+ lldb::ValueType type)
+ : ValueObject(parent), m_type(type) {
+ SetName(parent.GetName());
+ }
+
+ uint64_t GetByteSize() override { return m_parent->GetByteSize(); }
+ lldb::ValueType GetValueType() const override { return m_type; }
+ bool UpdateValue() override {
+ if (!m_parent->UpdateValueIfNeeded()) return false;
+ m_value = m_parent->GetValue();
+ return true;
+ }
+ size_t CalculateNumChildren(uint32_t max = UINT32_MAX) override {
+ return m_parent->GetNumChildren(max);
+ }
+ CompilerType GetCompilerTypeImpl() override {
+ return m_parent->GetCompilerType();
+ }
+ bool IsSynthetic() override { return true; }
+
+ private:
+ lldb::ValueType m_type;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StackFrameRecognizer_h_
diff --git a/linux-x64/clang/include/lldb/Target/StackID.h b/linux-x64/clang/include/lldb/Target/StackID.h
new file mode 100644
index 0000000..a649a4f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StackID.h
@@ -0,0 +1,99 @@
+//===-- StackID.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StackID_h_
+#define liblldb_StackID_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class StackID {
+public:
+ // Constructors and Destructors
+ StackID()
+ : m_pc(LLDB_INVALID_ADDRESS), m_cfa(LLDB_INVALID_ADDRESS),
+ m_symbol_scope(nullptr) {}
+
+ explicit StackID(lldb::addr_t pc, lldb::addr_t cfa,
+ SymbolContextScope *symbol_scope)
+ : m_pc(pc), m_cfa(cfa), m_symbol_scope(symbol_scope) {}
+
+ StackID(const StackID &rhs)
+ : m_pc(rhs.m_pc), m_cfa(rhs.m_cfa), m_symbol_scope(rhs.m_symbol_scope) {}
+
+ ~StackID() = default;
+
+ lldb::addr_t GetPC() const { return m_pc; }
+
+ lldb::addr_t GetCallFrameAddress() const { return m_cfa; }
+
+ SymbolContextScope *GetSymbolContextScope() const { return m_symbol_scope; }
+
+ void SetSymbolContextScope(SymbolContextScope *symbol_scope) {
+ m_symbol_scope = symbol_scope;
+ }
+
+ void Clear() {
+ m_pc = LLDB_INVALID_ADDRESS;
+ m_cfa = LLDB_INVALID_ADDRESS;
+ m_symbol_scope = nullptr;
+ }
+
+ bool IsValid() const {
+ return m_pc != LLDB_INVALID_ADDRESS || m_cfa != LLDB_INVALID_ADDRESS;
+ }
+
+ void Dump(Stream *s);
+
+ // Operators
+ const StackID &operator=(const StackID &rhs) {
+ if (this != &rhs) {
+ m_pc = rhs.m_pc;
+ m_cfa = rhs.m_cfa;
+ m_symbol_scope = rhs.m_symbol_scope;
+ }
+ return *this;
+ }
+
+protected:
+ friend class StackFrame;
+
+ void SetPC(lldb::addr_t pc) { m_pc = pc; }
+
+ void SetCFA(lldb::addr_t cfa) { m_cfa = cfa; }
+
+ lldb::addr_t
+ m_pc; // The pc value for the function/symbol for this frame. This will
+ // only get used if the symbol scope is nullptr (the code where we are
+ // stopped is not represented by any function or symbol in any shared
+ // library).
+ lldb::addr_t m_cfa; // The call frame address (stack pointer) value
+ // at the beginning of the function that uniquely
+ // identifies this frame (along with m_symbol_scope
+ // below)
+ SymbolContextScope *
+ m_symbol_scope; // If nullptr, there is no block or symbol for this frame.
+ // If not nullptr, this will either be the scope for the
+ // lexical block for the frame, or the scope for the
+ // symbol. Symbol context scopes are always be unique
+ // pointers since the are part of the Block and Symbol
+ // objects and can easily be used to tell if a stack ID
+ // is the same as another.
+};
+
+bool operator==(const StackID &lhs, const StackID &rhs);
+bool operator!=(const StackID &lhs, const StackID &rhs);
+
+// frame_id_1 < frame_id_2 means "frame_id_1 is YOUNGER than frame_id_2"
+bool operator<(const StackID &lhs, const StackID &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_StackID_h_
diff --git a/linux-x64/clang/include/lldb/Target/StopInfo.h b/linux-x64/clang/include/lldb/Target/StopInfo.h
new file mode 100644
index 0000000..59033b1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StopInfo.h
@@ -0,0 +1,188 @@
+//===-- StopInfo.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StopInfo_h_
+#define liblldb_StopInfo_h_
+
+#include <string>
+
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class StopInfo {
+ friend class Process::ProcessEventData;
+ friend class ThreadPlanBase;
+
+public:
+ // Constructors and Destructors
+ StopInfo(Thread &thread, uint64_t value);
+
+ virtual ~StopInfo() {}
+
+ bool IsValid() const;
+
+ void SetThread(const lldb::ThreadSP &thread_sp) { m_thread_wp = thread_sp; }
+
+ lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); }
+
+ // The value of the StopInfo depends on the StopReason. StopReason
+ // Meaning ----------------------------------------------
+ // eStopReasonBreakpoint BreakpointSiteID eStopReasonSignal
+ // Signal number eStopReasonWatchpoint WatchpointLocationID
+ // eStopReasonPlanComplete No significance
+
+ uint64_t GetValue() const { return m_value; }
+
+ virtual lldb::StopReason GetStopReason() const = 0;
+
+ // ShouldStopSynchronous will get called before any thread plans are
+ // consulted, and if it says we should resume the target, then we will just
+ // immediately resume. This should not run any code in or resume the target.
+
+ virtual bool ShouldStopSynchronous(Event *event_ptr) { return true; }
+
+ void OverrideShouldNotify(bool override_value) {
+ m_override_should_notify = override_value ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ // If should stop returns false, check if we should notify of this event
+ virtual bool ShouldNotify(Event *event_ptr) {
+ if (m_override_should_notify == eLazyBoolCalculate)
+ return DoShouldNotify(event_ptr);
+ else
+ return m_override_should_notify == eLazyBoolYes;
+ }
+
+ virtual void WillResume(lldb::StateType resume_state) {
+ // By default, don't do anything
+ }
+
+ virtual const char *GetDescription() { return m_description.c_str(); }
+
+ virtual void SetDescription(const char *desc_cstr) {
+ if (desc_cstr && desc_cstr[0])
+ m_description.assign(desc_cstr);
+ else
+ m_description.clear();
+ }
+
+ virtual bool IsValidForOperatingSystemThread(Thread &thread) { return true; }
+
+ // Sometimes the thread plan logic will know that it wants a given stop to
+ // stop or not, regardless of what the ordinary logic for that StopInfo would
+ // dictate. The main example of this is the ThreadPlanCallFunction, which
+ // for instance knows - based on how that particular expression was executed
+ // - whether it wants all breakpoints to auto-continue or not. Use
+ // OverrideShouldStop on the StopInfo to implement this.
+
+ void OverrideShouldStop(bool override_value) {
+ m_override_should_stop = override_value ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetOverrideShouldStop() {
+ return m_override_should_stop != eLazyBoolCalculate;
+ }
+
+ bool GetOverriddenShouldStopValue() {
+ return m_override_should_stop == eLazyBoolYes;
+ }
+
+ StructuredData::ObjectSP GetExtendedInfo() { return m_extended_info; }
+
+ static lldb::StopInfoSP
+ CreateStopReasonWithBreakpointSiteID(Thread &thread,
+ lldb::break_id_t break_id);
+
+ // This creates a StopInfo for the thread where the should_stop is already
+ // set, and won't be recalculated.
+ static lldb::StopInfoSP CreateStopReasonWithBreakpointSiteID(
+ Thread &thread, lldb::break_id_t break_id, bool should_stop);
+
+ static lldb::StopInfoSP CreateStopReasonWithWatchpointID(
+ Thread &thread, lldb::break_id_t watch_id,
+ lldb::addr_t watch_hit_addr = LLDB_INVALID_ADDRESS);
+
+ static lldb::StopInfoSP
+ CreateStopReasonWithSignal(Thread &thread, int signo,
+ const char *description = nullptr);
+
+ static lldb::StopInfoSP CreateStopReasonToTrace(Thread &thread);
+
+ static lldb::StopInfoSP
+ CreateStopReasonWithPlan(lldb::ThreadPlanSP &plan,
+ lldb::ValueObjectSP return_valobj_sp,
+ lldb::ExpressionVariableSP expression_variable_sp);
+
+ static lldb::StopInfoSP
+ CreateStopReasonWithException(Thread &thread, const char *description);
+
+ static lldb::StopInfoSP CreateStopReasonWithExec(Thread &thread);
+
+ static lldb::ValueObjectSP
+ GetReturnValueObject(lldb::StopInfoSP &stop_info_sp);
+
+ static lldb::ExpressionVariableSP
+ GetExpressionVariable(lldb::StopInfoSP &stop_info_sp);
+
+ static lldb::ValueObjectSP
+ GetCrashingDereference(lldb::StopInfoSP &stop_info_sp,
+ lldb::addr_t *crashing_address = nullptr);
+
+protected:
+ // Perform any action that is associated with this stop. This is done as the
+ // Event is removed from the event queue. ProcessEventData::DoOnRemoval does
+ // the job.
+
+ virtual void PerformAction(Event *event_ptr) {}
+
+ virtual bool DoShouldNotify(Event *event_ptr) { return false; }
+
+ // Stop the thread by default. Subclasses can override this to allow the
+ // thread to continue if desired. The ShouldStop method should not do
+ // anything that might run code. If you need to run code when deciding
+ // whether to stop at this StopInfo, that must be done in the PerformAction.
+ // The PerformAction will always get called before the ShouldStop. This is
+ // done by the ProcessEventData::DoOnRemoval, though the ThreadPlanBase needs
+ // to consult this later on.
+ virtual bool ShouldStop(Event *event_ptr) { return true; }
+
+ // Classes that inherit from StackID can see and modify these
+ lldb::ThreadWP m_thread_wp; // The thread corresponding to the stop reason.
+ uint32_t m_stop_id; // The process stop ID for which this stop info is valid
+ uint32_t m_resume_id; // This is the resume ID when we made this stop ID.
+ uint64_t m_value; // A generic value that can be used for things pertaining to
+ // this stop info
+ std::string m_description; // A textual description describing this stop.
+ LazyBool m_override_should_notify;
+ LazyBool m_override_should_stop;
+
+ StructuredData::ObjectSP
+ m_extended_info; // The extended info for this stop info
+
+ // This determines whether the target has run since this stop info. N.B.
+ // running to evaluate a user expression does not count.
+ bool HasTargetRunSinceMe();
+
+ // MakeStopInfoValid is necessary to allow saved stop infos to resurrect
+ // themselves as valid. It should only be used by
+ // Thread::RestoreThreadStateFromCheckpoint and to make sure the one-step
+ // needed for before-the-fact watchpoints does not prevent us from stopping
+ void MakeStopInfoValid();
+
+private:
+ friend class Thread;
+
+ DISALLOW_COPY_AND_ASSIGN(StopInfo);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StopInfo_h_
diff --git a/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h b/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h
new file mode 100644
index 0000000..b20bdb3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h
@@ -0,0 +1,169 @@
+//===-- StructuredDataPlugin.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef StructuredDataPlugin_h
+#define StructuredDataPlugin_h
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+class CommandObjectMultiword;
+
+/// Plugin that supports process-related structured data sent asynchronously
+/// from the debug monitor (e.g. debugserver, lldb-server, etc.)
+///
+/// This plugin type is activated by a Process-derived instance when that
+/// instance detects that a given structured data feature is available.
+///
+/// StructuredDataPlugin instances are inherently tied to a process. The
+/// main functionality they support is the ability to consume asynchronously-
+/// delivered structured data from the process monitor, and do something
+/// reasonable with it. Something reasonable can include broadcasting a
+/// StructuredData event, which other parts of the system can then do with
+/// as they please. An IDE could use this facility to retrieve CPU usage,
+/// memory usage, and other run-time aspects of the process. That data
+/// can then be displayed meaningfully to the user through the IDE.
+
+/// For command-line LLDB, the Debugger instance listens for the structured
+/// data events raised by the plugin, and give the plugin both the output
+/// and error streams such that the plugin can display something about the
+/// event, at a time when the debugger ensures it is safe to write to the
+/// output or error streams.
+
+class StructuredDataPlugin
+ : public PluginInterface,
+ public std::enable_shared_from_this<StructuredDataPlugin> {
+public:
+ ~StructuredDataPlugin() override;
+
+ lldb::ProcessSP GetProcess() const;
+
+ // Public instance API
+
+ /// Return whether this plugin supports the given StructuredData feature.
+ ///
+ /// When Process is informed of a list of process-monitor-supported
+ /// structured data features, Process will go through the list of plugins,
+ /// one at a time, and have the first plugin that supports a given feature
+ /// be the plugin instantiated to handle that feature. There is a 1-1
+ /// correspondence between a Process instance and a StructuredDataPlugin
+ /// mapped to that process. A plugin can support handling multiple
+ /// features, and if that happens, there is a single plugin instance
+ /// created covering all of the mapped features for a given process.
+ ///
+ /// \param[in] type_name
+ /// The name of the feature tag supported by a process.
+ /// e.g. "darwin-log".
+ ///
+ /// \return
+ /// true if the plugin supports the feature; otherwise, false.
+ virtual bool SupportsStructuredDataType(ConstString type_name) = 0;
+
+ /// Handle the arrival of asynchronous structured data from the process.
+ ///
+ /// When asynchronous structured data arrives from the process monitor,
+ /// it is immediately delivered to the plugin mapped for that feature
+ /// if one exists. The structured data that arrives from a process
+ /// monitor must be a dictionary, and it must have a string field named
+ /// "type" that must contain the StructuredData feature name set as the
+ /// value. This is the manner in which the data is routed to the proper
+ /// plugin instance.
+ ///
+ /// \param[in] process
+ /// The process instance that just received the structured data.
+ /// This will always be the same process for a given instance of
+ /// a plugin.
+ ///
+ /// \param[in] type_name
+ /// The name of the feature tag for the asynchronous structured data.
+ /// Note this data will also be present in the \b object_sp dictionary
+ /// under the string value with key "type".
+ ///
+ /// \param[in] object_sp
+ /// A shared pointer to the structured data that arrived. This must
+ /// be a dictionary. The only key required is the aforementioned
+ /// key named "type" that must be a string value containing the
+ /// structured data type name.
+ virtual void
+ HandleArrivalOfStructuredData(Process &process, ConstString type_name,
+ const StructuredData::ObjectSP &object_sp) = 0;
+
+ /// Get a human-readable description of the contents of the data.
+ ///
+ /// In command-line LLDB, this method will be called by the Debugger
+ /// instance for each structured data event generated, and the output
+ /// will be printed to the LLDB console. If nothing is added to the stream,
+ /// nothing will be printed; otherwise, a newline will be added to the end
+ /// when displayed.
+ ///
+ /// \param[in] object_sp
+ /// A shared pointer to the structured data to format.
+ ///
+ /// \param[in] stream
+ /// The stream where the structured data should be pretty printed.
+ ///
+ /// \return
+ /// The error if formatting the object contents failed; otherwise,
+ /// success.
+ virtual Status GetDescription(const StructuredData::ObjectSP &object_sp,
+ lldb_private::Stream &stream) = 0;
+
+ /// Returns whether the plugin's features are enabled.
+ ///
+ /// This is a convenience method for plugins that can enable or disable
+ /// their functionality. It allows retrieval of this state without
+ /// requiring a cast.
+ ///
+ /// \param[in] type_name
+ /// The name of the feature tag for the asynchronous structured data.
+ /// This is needed for plugins that support more than one feature.
+ virtual bool GetEnabled(ConstString type_name) const;
+
+ /// Allow the plugin to do work related to modules that loaded in the
+ /// the corresponding process.
+ ///
+ /// This method defaults to doing nothing. Plugins can override it
+ /// if they have any behavior they want to enable/modify based on loaded
+ /// modules.
+ ///
+ /// \param[in] process
+ /// The process that just was notified of modules having been loaded.
+ /// This will always be the same process for a given instance of
+ /// a plugin.
+ ///
+ /// \param[in] module_list
+ /// The list of modules that the process registered as having just
+ /// loaded. See \b Process::ModulesDidLoad(...).
+ virtual void ModulesDidLoad(Process &process, ModuleList &module_list);
+
+protected:
+ // Derived-class API
+ StructuredDataPlugin(const lldb::ProcessWP &process_wp);
+
+ /// Derived classes must call this before attempting to hook up commands
+ /// to the 'plugin structured-data' tree.
+ ///
+ /// This ensures the relevant command and options hook points for all
+ /// StructuredDataPlugin derived classes are available for this debugger.
+ /// If this has already happened, this call is a no-op.
+ ///
+ /// \param[in] debugger
+ /// The Debugger instance for which we're creating the required shared
+ /// components for the StructuredDataPlugin derived classes.
+ static void InitializeBasePluginForDebugger(Debugger &debugger);
+
+private:
+ lldb::ProcessWP m_process_wp;
+
+ DISALLOW_COPY_AND_ASSIGN(StructuredDataPlugin);
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Target/SystemRuntime.h b/linux-x64/clang/include/lldb/Target/SystemRuntime.h
new file mode 100644
index 0000000..b45f882
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/SystemRuntime.h
@@ -0,0 +1,308 @@
+//===-- SystemRuntime.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SystemRuntime_h_
+#define liblldb_SystemRuntime_h_
+
+#include <vector>
+
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/PluginInterface.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"
+
+namespace lldb_private {
+
+/// \class SystemRuntime SystemRuntime.h "lldb/Target/SystemRuntime.h"
+/// A plug-in interface definition class for system runtimes.
+///
+/// The system runtime plugins can collect information from the system
+/// libraries during a Process' lifetime and provide information about how
+/// objects/threads were originated.
+///
+/// For instance, a system runtime plugin use a breakpoint when threads are
+/// created to record the backtrace of where that thread was created. Later,
+/// when backtracing the created thread, it could extend the backtrace to show
+/// where it was originally created from.
+///
+/// The plugin will insert its own breakpoint when Created and start
+/// collecting information. Later when it comes time to augment a Thread, it
+/// can be asked to provide that information.
+///
+
+class SystemRuntime : public PluginInterface {
+public:
+ /// Find a system runtime plugin for a given process.
+ ///
+ /// Scans the installed SystemRuntime plugins and tries to find an instance
+ /// that can be used to track image changes in \a process.
+ ///
+ /// \param[in] process
+ /// The process for which to try and locate a system runtime
+ /// plugin instance.
+ static SystemRuntime *FindPlugin(Process *process);
+
+ /// Construct with a process.
+ SystemRuntime(lldb_private::Process *process);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be inherited
+ /// by the plug-in instance.
+ ~SystemRuntime() override;
+
+ /// Called after attaching to a process.
+ ///
+ /// Allow the SystemRuntime plugin to execute some code after attaching to a
+ /// process.
+ virtual void DidAttach();
+
+ /// Called after launching a process.
+ ///
+ /// Allow the SystemRuntime plugin to execute some code after launching a
+ /// process.
+ virtual void DidLaunch();
+
+ /// Called when modules have been loaded in the process.
+ ///
+ /// Allow the SystemRuntime plugin to enable logging features in the system
+ /// runtime libraries.
+ virtual void ModulesDidLoad(lldb_private::ModuleList &module_list);
+
+ /// Called before detaching from a process.
+ ///
+ /// This will give a SystemRuntime plugin a chance to free any resources in
+ /// the inferior process before we detach.
+ virtual void Detach();
+
+ /// Return a list of thread origin extended backtraces that may be
+ /// available.
+ ///
+ /// A System Runtime may be able to provide a backtrace of when this
+ /// thread was originally created. Furthermore, it may be able to provide
+ /// that extended backtrace for different styles of creation. On a system
+ /// with both pthreads and libdispatch, aka Grand Central Dispatch, queues,
+ /// the system runtime may be able to provide the pthread creation of the
+ /// thread and it may also be able to provide the backtrace of when this GCD
+ /// queue work block was enqueued. The caller may request these different
+ /// origins by name.
+ ///
+ /// The names will be provided in the order that they are most likely to be
+ /// requested. For instance, a most natural order may be to request the GCD
+ /// libdispatch queue origin. If there is none, then request the pthread
+ /// origin.
+ ///
+ /// \return
+ /// A vector of ConstStrings with names like "pthread" or "libdispatch".
+ /// An empty vector may be returned if no thread origin extended
+ /// backtrace capabilities are available.
+ virtual const std::vector<ConstString> &GetExtendedBacktraceTypes();
+
+ /// Return a Thread which shows the origin of this thread's creation.
+ ///
+ /// This likely returns a HistoryThread which shows how thread was
+ /// originally created (e.g. "pthread" type), or how the work that is
+ /// currently executing on it was originally enqueued (e.g. "libdispatch"
+ /// type).
+ ///
+ /// There may be a chain of thread-origins; it may be informative to the end
+ /// user to query the returned ThreadSP for its origins as well.
+ ///
+ /// \param [in] thread
+ /// The thread to examine.
+ ///
+ /// \param [in] type
+ /// The type of thread origin being requested. The types supported
+ /// are returned from SystemRuntime::GetExtendedBacktraceTypes.
+ ///
+ /// \return
+ /// A ThreadSP which will have a StackList of frames. This Thread will
+ /// not appear in the Process' list of current threads. Normal thread
+ /// operations like stepping will not be available. This is a historical
+ /// view thread and may be only useful for showing a backtrace.
+ ///
+ /// An empty ThreadSP will be returned if no thread origin is available.
+ virtual lldb::ThreadSP GetExtendedBacktraceThread(lldb::ThreadSP thread,
+ ConstString type);
+
+ /// Get the extended backtrace thread for a QueueItem
+ ///
+ /// A QueueItem represents a function/block that will be executed on
+ /// a libdispatch queue in the future, or it represents a function/block
+ /// that is currently executing on a thread.
+ ///
+ /// This method will report a thread backtrace of the function that enqueued
+ /// it originally, if possible.
+ ///
+ /// \param [in] queue_item_sp
+ /// The QueueItem that we are getting an extended backtrace for.
+ ///
+ /// \param [in] type
+ /// The type of extended backtrace to fetch. The types supported
+ /// are returned from SystemRuntime::GetExtendedBacktraceTypes.
+ ///
+ /// \return
+ /// If an extended backtrace is available, it is returned. Else
+ /// an empty ThreadSP is returned.
+ virtual lldb::ThreadSP
+ GetExtendedBacktraceForQueueItem(lldb::QueueItemSP queue_item_sp,
+ ConstString type) {
+ return lldb::ThreadSP();
+ }
+
+ /// Populate the Process' QueueList with libdispatch / GCD queues that
+ /// exist.
+ ///
+ /// When process execution is paused, the SystemRuntime may be called to
+ /// fill in the list of Queues that currently exist.
+ ///
+ /// \param [out] queue_list
+ /// This QueueList will be cleared, and any queues that currently exist
+ /// will be added. An empty QueueList will be returned if no queues
+ /// exist or if this Systemruntime does not support libdispatch queues.
+ virtual void PopulateQueueList(lldb_private::QueueList &queue_list) {}
+
+ /// Get the queue name for a thread given a thread's dispatch_qaddr.
+ ///
+ /// On systems using libdispatch queues, a thread may be associated with a
+ /// queue. There will be a call to get the thread's dispatch_qaddr. At the
+ /// dispatch_qaddr we will find the address of this thread's
+ /// dispatch_queue_t structure. Given the address of the dispatch_queue_t
+ /// structure for a thread, get the queue name and return it.
+ ///
+ /// \param [in] dispatch_qaddr
+ /// The address of the dispatch_qaddr pointer for this thread.
+ ///
+ /// \return
+ /// The string of this queue's name. An empty string is returned if the
+ /// name could not be found.
+ virtual std::string
+ GetQueueNameFromThreadQAddress(lldb::addr_t dispatch_qaddr) {
+ return "";
+ }
+
+ /// Get the QueueID for the libdispatch queue given the thread's
+ /// dispatch_qaddr.
+ ///
+ /// On systems using libdispatch queues, a thread may be associated with a
+ /// queue. There will be a call to get the thread's dispatch_qaddr. At the
+ /// dispatch_qaddr we will find the address of this thread's
+ /// dispatch_queue_t structure. Given the address of the dispatch_queue_t
+ /// structure for a thread, get the queue ID and return it.
+ ///
+ /// \param [in] dispatch_qaddr
+ /// The address of the dispatch_qaddr pointer for this thread.
+ ///
+ /// \return
+ /// The queue ID, or if it could not be retrieved, LLDB_INVALID_QUEUE_ID.
+ virtual lldb::queue_id_t
+ GetQueueIDFromThreadQAddress(lldb::addr_t dispatch_qaddr) {
+ return LLDB_INVALID_QUEUE_ID;
+ }
+
+ /// Get the libdispatch_queue_t address for the queue given the thread's
+ /// dispatch_qaddr.
+ ///
+ /// On systems using libdispatch queues, a thread may be associated with a
+ /// queue. There will be a call to get the thread's dispatch_qaddr. Given
+ /// the thread's dispatch_qaddr, find the libdispatch_queue_t address and
+ /// return it.
+ ///
+ /// \param [in] dispatch_qaddr
+ /// The address of the dispatch_qaddr pointer for this thread.
+ ///
+ /// \return
+ /// The libdispatch_queue_t address, or LLDB_INVALID_ADDRESS if
+ /// unavailable/not found.
+ virtual lldb::addr_t
+ GetLibdispatchQueueAddressFromThreadQAddress(lldb::addr_t dispatch_qaddr) {
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ /// Retrieve the Queue kind for the queue at a thread's dispatch_qaddr.
+ ///
+ /// Retrieve the Queue kind - either eQueueKindSerial or
+ /// eQueueKindConcurrent, indicating that this queue processes work items
+ /// serially or concurrently.
+ ///
+ /// \return
+ /// The Queue kind, if it could be read, else eQueueKindUnknown.
+ virtual lldb::QueueKind GetQueueKind(lldb::addr_t dispatch_qaddr) {
+ return lldb::eQueueKindUnknown;
+ }
+
+ /// Get the pending work items for a libdispatch Queue
+ ///
+ /// If this system/process is using libdispatch and the runtime can do so,
+ /// retrieve the list of pending work items for the specified Queue and add
+ /// it to the Queue.
+ ///
+ /// \param [in] queue
+ /// The queue of interest.
+ virtual void PopulatePendingItemsForQueue(lldb_private::Queue *queue) {}
+
+ /// Complete the fields in a QueueItem
+ ///
+ /// PopulatePendingItemsForQueue() may not fill in all of the QueueItem
+ /// details; when the remaining fields are needed, they will be fetched by
+ /// call this method.
+ ///
+ /// \param [in] queue_item
+ /// The QueueItem that we will be completing.
+ ///
+ /// \param [in] item_ref
+ /// The item_ref token that is needed to retrieve the rest of the
+ /// information about the QueueItem.
+ virtual void CompleteQueueItem(lldb_private::QueueItem *queue_item,
+ lldb::addr_t item_ref) {}
+
+ /// Add key-value pairs to the StructuredData dictionary object with
+ /// information debugserver may need when constructing the
+ /// jThreadExtendedInfo packet.
+ ///
+ /// \param [out] dict
+ /// Dictionary to which key-value pairs should be added; they will
+ /// be sent to the remote gdb server stub as arguments in the
+ /// jThreadExtendedInfo request.
+ virtual void AddThreadExtendedInfoPacketHints(
+ lldb_private::StructuredData::ObjectSP dict) {}
+
+ /// Determine whether it is safe to run an expression on a given thread
+ ///
+ /// If a system must not run functions on a thread in some particular state,
+ /// this method gives a way for it to flag that the expression should not be
+ /// run.
+ ///
+ /// \param [in] thread_sp
+ /// The thread we want to run the expression on.
+ ///
+ /// \return
+ /// True will be returned if there are no known problems with running an
+ /// expression on this thread. False means that the inferior function
+ /// call should not be made on this thread.
+ virtual bool SafeToCallFunctionsOnThisThread(lldb::ThreadSP thread_sp) {
+ return true;
+ }
+
+protected:
+ // Member variables.
+ Process *m_process;
+
+ std::vector<ConstString> m_types;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SystemRuntime);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SystemRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/Target.h b/linux-x64/clang/include/lldb/Target/Target.h
new file mode 100644
index 0000000..875a8b1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Target.h
@@ -0,0 +1,1359 @@
+//===-- Target.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Target_h_
+#define liblldb_Target_h_
+
+#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/Breakpoint/BreakpointList.h"
+#include "lldb/Breakpoint/BreakpointName.h"
+#include "lldb/Breakpoint/WatchpointList.h"
+#include "lldb/Core/Architecture.h"
+#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Host/ProcessLaunchInfo.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/PathMappingList.h"
+#include "lldb/Target/SectionLoadHistory.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Timeout.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+OptionEnumValues GetDynamicValueTypes();
+
+enum InlineStrategy {
+ eInlineBreakpointsNever = 0,
+ eInlineBreakpointsHeaders,
+ eInlineBreakpointsAlways
+};
+
+enum LoadScriptFromSymFile {
+ eLoadScriptFromSymFileTrue,
+ eLoadScriptFromSymFileFalse,
+ eLoadScriptFromSymFileWarn
+};
+
+enum LoadCWDlldbinitFile {
+ eLoadCWDlldbinitTrue,
+ eLoadCWDlldbinitFalse,
+ eLoadCWDlldbinitWarn
+};
+
+enum LoadDependentFiles {
+ eLoadDependentsDefault,
+ eLoadDependentsYes,
+ eLoadDependentsNo,
+};
+
+// TargetProperties
+class TargetExperimentalProperties : public Properties {
+public:
+ TargetExperimentalProperties();
+};
+
+class TargetProperties : public Properties {
+public:
+ TargetProperties(Target *target);
+
+ ~TargetProperties() override;
+
+ ArchSpec GetDefaultArchitecture() const;
+
+ void SetDefaultArchitecture(const ArchSpec &arch);
+
+ bool GetMoveToNearestCode() const;
+
+ lldb::DynamicValueType GetPreferDynamicValue() const;
+
+ bool SetPreferDynamicValue(lldb::DynamicValueType d);
+
+ bool GetPreloadSymbols() const;
+
+ void SetPreloadSymbols(bool b);
+
+ bool GetDisableASLR() const;
+
+ void SetDisableASLR(bool b);
+
+ bool GetDetachOnError() const;
+
+ void SetDetachOnError(bool b);
+
+ bool GetDisableSTDIO() const;
+
+ void SetDisableSTDIO(bool b);
+
+ const char *GetDisassemblyFlavor() const;
+
+ InlineStrategy GetInlineStrategy() const;
+
+ llvm::StringRef GetArg0() const;
+
+ void SetArg0(llvm::StringRef arg);
+
+ bool GetRunArguments(Args &args) const;
+
+ void SetRunArguments(const Args &args);
+
+ Environment GetEnvironment() const;
+ void SetEnvironment(Environment env);
+
+ bool GetSkipPrologue() const;
+
+ PathMappingList &GetSourcePathMap() const;
+
+ FileSpecList GetExecutableSearchPaths();
+
+ void AppendExecutableSearchPaths(const FileSpec&);
+
+ FileSpecList GetDebugFileSearchPaths();
+
+ FileSpecList GetClangModuleSearchPaths();
+
+ bool GetEnableAutoImportClangModules() const;
+
+ bool GetEnableImportStdModule() const;
+
+ bool GetEnableAutoApplyFixIts() const;
+
+ bool GetEnableNotifyAboutFixIts() const;
+
+ bool GetEnableSaveObjects() const;
+
+ bool GetEnableSyntheticValue() const;
+
+ uint32_t GetMaximumNumberOfChildrenToDisplay() const;
+
+ uint32_t GetMaximumSizeOfStringSummary() const;
+
+ uint32_t GetMaximumMemReadSize() const;
+
+ FileSpec GetStandardInputPath() const;
+ FileSpec GetStandardErrorPath() const;
+ FileSpec GetStandardOutputPath() const;
+
+ void SetStandardInputPath(llvm::StringRef path);
+ void SetStandardOutputPath(llvm::StringRef path);
+ void SetStandardErrorPath(llvm::StringRef path);
+
+ void SetStandardInputPath(const char *path) = delete;
+ void SetStandardOutputPath(const char *path) = delete;
+ void SetStandardErrorPath(const char *path) = delete;
+
+ bool GetBreakpointsConsultPlatformAvoidList();
+
+ lldb::LanguageType GetLanguage() const;
+
+ llvm::StringRef GetExpressionPrefixContents();
+
+ bool GetUseHexImmediates() const;
+
+ bool GetUseFastStepping() const;
+
+ bool GetDisplayExpressionsInCrashlogs() const;
+
+ LoadScriptFromSymFile GetLoadScriptFromSymbolFile() const;
+
+ LoadCWDlldbinitFile GetLoadCWDlldbinitFile() const;
+
+ Disassembler::HexImmediateStyle GetHexImmediateStyle() const;
+
+ MemoryModuleLoadLevel GetMemoryModuleLoadLevel() const;
+
+ bool GetUserSpecifiedTrapHandlerNames(Args &args) const;
+
+ void SetUserSpecifiedTrapHandlerNames(const Args &args);
+
+ bool GetNonStopModeEnabled() const;
+
+ void SetNonStopModeEnabled(bool b);
+
+ bool GetDisplayRuntimeSupportValues() const;
+
+ void SetDisplayRuntimeSupportValues(bool b);
+
+ bool GetDisplayRecognizedArguments() const;
+
+ void SetDisplayRecognizedArguments(bool b);
+
+ const ProcessLaunchInfo &GetProcessLaunchInfo();
+
+ void SetProcessLaunchInfo(const ProcessLaunchInfo &launch_info);
+
+ bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;
+
+ void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
+
+ bool GetUseModernTypeLookup() const;
+
+ void SetRequireHardwareBreakpoints(bool b);
+
+ bool GetRequireHardwareBreakpoints() const;
+
+private:
+ // Callbacks for m_launch_info.
+ static void Arg0ValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void RunArgsValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void EnvVarsValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void InheritEnvValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void InputPathValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void OutputPathValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void ErrorPathValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void DetachOnErrorValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void DisableASLRValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+ static void DisableSTDIOValueChangedCallback(void *target_property_ptr,
+ OptionValue *);
+
+ // Member variables.
+ ProcessLaunchInfo m_launch_info;
+ std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
+};
+
+class EvaluateExpressionOptions {
+public:
+// MSVC has a bug here that reports C4268: 'const' static/global data
+// initialized with compiler generated default constructor fills the object
+// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a
+// bogus warning.
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4268)
+#endif
+ static constexpr std::chrono::milliseconds default_timeout{500};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+ static constexpr ExecutionPolicy default_execution_policy =
+ eExecutionPolicyOnlyWhenNeeded;
+
+ EvaluateExpressionOptions() = default;
+
+ ExecutionPolicy GetExecutionPolicy() const { return m_execution_policy; }
+
+ void SetExecutionPolicy(ExecutionPolicy policy = eExecutionPolicyAlways) {
+ m_execution_policy = policy;
+ }
+
+ lldb::LanguageType GetLanguage() const { return m_language; }
+
+ void SetLanguage(lldb::LanguageType language) { m_language = language; }
+
+ bool DoesCoerceToId() const { return m_coerce_to_id; }
+
+ const char *GetPrefix() const {
+ return (m_prefix.empty() ? nullptr : m_prefix.c_str());
+ }
+
+ void SetPrefix(const char *prefix) {
+ if (prefix && prefix[0])
+ m_prefix = prefix;
+ else
+ m_prefix.clear();
+ }
+
+ void SetCoerceToId(bool coerce = true) { m_coerce_to_id = coerce; }
+
+ bool DoesUnwindOnError() const { return m_unwind_on_error; }
+
+ void SetUnwindOnError(bool unwind = false) { m_unwind_on_error = unwind; }
+
+ bool DoesIgnoreBreakpoints() const { return m_ignore_breakpoints; }
+
+ void SetIgnoreBreakpoints(bool ignore = false) {
+ m_ignore_breakpoints = ignore;
+ }
+
+ bool DoesKeepInMemory() const { return m_keep_in_memory; }
+
+ void SetKeepInMemory(bool keep = true) { m_keep_in_memory = keep; }
+
+ lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
+
+ void
+ SetUseDynamic(lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget) {
+ m_use_dynamic = dynamic;
+ }
+
+ const Timeout<std::micro> &GetTimeout() const { return m_timeout; }
+
+ void SetTimeout(const Timeout<std::micro> &timeout) { m_timeout = timeout; }
+
+ const Timeout<std::micro> &GetOneThreadTimeout() const {
+ return m_one_thread_timeout;
+ }
+
+ void SetOneThreadTimeout(const Timeout<std::micro> &timeout) {
+ m_one_thread_timeout = timeout;
+ }
+
+ bool GetTryAllThreads() const { return m_try_others; }
+
+ void SetTryAllThreads(bool try_others = true) { m_try_others = try_others; }
+
+ bool GetStopOthers() const { return m_stop_others; }
+
+ void SetStopOthers(bool stop_others = true) { m_stop_others = stop_others; }
+
+ bool GetDebug() const { return m_debug; }
+
+ void SetDebug(bool b) {
+ m_debug = b;
+ if (m_debug)
+ m_generate_debug_info = true;
+ }
+
+ bool GetGenerateDebugInfo() const { return m_generate_debug_info; }
+
+ void SetGenerateDebugInfo(bool b) { m_generate_debug_info = b; }
+
+ bool GetColorizeErrors() const { return m_ansi_color_errors; }
+
+ void SetColorizeErrors(bool b) { m_ansi_color_errors = b; }
+
+ bool GetTrapExceptions() const { return m_trap_exceptions; }
+
+ void SetTrapExceptions(bool b) { m_trap_exceptions = b; }
+
+ bool GetREPLEnabled() const { return m_repl; }
+
+ void SetREPLEnabled(bool b) { m_repl = b; }
+
+ void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton) {
+ m_cancel_callback_baton = baton;
+ m_cancel_callback = callback;
+ }
+
+ bool InvokeCancelCallback(lldb::ExpressionEvaluationPhase phase) const {
+ return ((m_cancel_callback != nullptr)
+ ? m_cancel_callback(phase, m_cancel_callback_baton)
+ : false);
+ }
+
+ // Allows the expression contents to be remapped to point to the specified
+ // file and line using #line directives.
+ void SetPoundLine(const char *path, uint32_t line) const {
+ if (path && path[0]) {
+ m_pound_line_file = path;
+ m_pound_line_line = line;
+ } else {
+ m_pound_line_file.clear();
+ m_pound_line_line = 0;
+ }
+ }
+
+ const char *GetPoundLineFilePath() const {
+ return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
+ }
+
+ uint32_t GetPoundLineLine() const { return m_pound_line_line; }
+
+ void SetResultIsInternal(bool b) { m_result_is_internal = b; }
+
+ bool GetResultIsInternal() const { return m_result_is_internal; }
+
+ void SetAutoApplyFixIts(bool b) { m_auto_apply_fixits = b; }
+
+ bool GetAutoApplyFixIts() const { return m_auto_apply_fixits; }
+
+ bool IsForUtilityExpr() const { return m_running_utility_expression; }
+
+ void SetIsForUtilityExpr(bool b) { m_running_utility_expression = b; }
+
+private:
+ ExecutionPolicy m_execution_policy = default_execution_policy;
+ lldb::LanguageType m_language = lldb::eLanguageTypeUnknown;
+ std::string m_prefix;
+ bool m_coerce_to_id = false;
+ bool m_unwind_on_error = true;
+ bool m_ignore_breakpoints = false;
+ bool m_keep_in_memory = false;
+ bool m_try_others = true;
+ bool m_stop_others = true;
+ bool m_debug = false;
+ bool m_trap_exceptions = true;
+ bool m_repl = false;
+ bool m_generate_debug_info = false;
+ bool m_ansi_color_errors = false;
+ bool m_result_is_internal = false;
+ bool m_auto_apply_fixits = true;
+ /// True if the executed code should be treated as utility code that is only
+ /// used by LLDB internally.
+ bool m_running_utility_expression = false;
+
+ lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
+ Timeout<std::micro> m_timeout = default_timeout;
+ Timeout<std::micro> m_one_thread_timeout = llvm::None;
+ lldb::ExpressionCancelCallback m_cancel_callback = nullptr;
+ void *m_cancel_callback_baton = nullptr;
+ // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
+ // #line %u "%s" before the expression content to remap where the source
+ // originates
+ mutable std::string m_pound_line_file;
+ mutable uint32_t m_pound_line_line;
+};
+
+// Target
+class Target : public std::enable_shared_from_this<Target>,
+ public TargetProperties,
+ public Broadcaster,
+ public ExecutionContextScope,
+ public ModuleList::Notifier {
+public:
+ friend class TargetList;
+
+ /// Broadcaster event bits definitions.
+ enum {
+ eBroadcastBitBreakpointChanged = (1 << 0),
+ eBroadcastBitModulesLoaded = (1 << 1),
+ eBroadcastBitModulesUnloaded = (1 << 2),
+ eBroadcastBitWatchpointChanged = (1 << 3),
+ eBroadcastBitSymbolsLoaded = (1 << 4)
+ };
+
+ // These two functions fill out the Broadcaster interface:
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+ // This event data class is for use by the TargetList to broadcast new target
+ // notifications.
+ class TargetEventData : public EventData {
+ public:
+ TargetEventData(const lldb::TargetSP &target_sp);
+
+ TargetEventData(const lldb::TargetSP &target_sp,
+ const ModuleList &module_list);
+
+ ~TargetEventData() override;
+
+ static ConstString GetFlavorString();
+
+ ConstString GetFlavor() const override {
+ return TargetEventData::GetFlavorString();
+ }
+
+ void Dump(Stream *s) const override;
+
+ static const TargetEventData *GetEventDataFromEvent(const Event *event_ptr);
+
+ static lldb::TargetSP GetTargetFromEvent(const Event *event_ptr);
+
+ static ModuleList GetModuleListFromEvent(const Event *event_ptr);
+
+ const lldb::TargetSP &GetTarget() const { return m_target_sp; }
+
+ const ModuleList &GetModuleList() const { return m_module_list; }
+
+ private:
+ lldb::TargetSP m_target_sp;
+ ModuleList m_module_list;
+
+ DISALLOW_COPY_AND_ASSIGN(TargetEventData);
+ };
+
+ ~Target() override;
+
+ static void SettingsInitialize();
+
+ static void SettingsTerminate();
+
+ static FileSpecList GetDefaultExecutableSearchPaths();
+
+ static FileSpecList GetDefaultDebugFileSearchPaths();
+
+ static FileSpecList GetDefaultClangModuleSearchPaths();
+
+ static ArchSpec GetDefaultArchitecture();
+
+ static void SetDefaultArchitecture(const ArchSpec &arch);
+
+ /// Find a binary on the system and return its Module,
+ /// or return an existing Module that is already in the Target.
+ ///
+ /// Given a ModuleSpec, find a binary satisifying that specification,
+ /// or identify a matching Module already present in the Target,
+ /// and return a shared pointer to it.
+ ///
+ /// \param[in] module_spec
+ /// The criteria that must be matched for the binary being loaded.
+ /// e.g. UUID, architecture, file path.
+ ///
+ /// \param[in] notify
+ /// If notify is true, and the Module is new to this Target,
+ /// Target::ModulesDidLoad will be called.
+ /// If notify is false, it is assumed that the caller is adding
+ /// multiple Modules and will call ModulesDidLoad with the
+ /// full list at the end.
+ /// ModulesDidLoad must be called when a Module/Modules have
+ /// been added to the target, one way or the other.
+ ///
+ /// \param[out] error_ptr
+ /// Optional argument, pointing to a Status object to fill in
+ /// with any results / messages while attempting to find/load
+ /// this binary. Many callers will be internal functions that
+ /// will handle / summarize the failures in a custom way and
+ /// don't use these messages.
+ ///
+ /// \return
+ /// An empty ModuleSP will be returned if no matching file
+ /// was found. If error_ptr was non-nullptr, an error message
+ /// will likely be provided.
+ lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec,
+ bool notify,
+ Status *error_ptr = nullptr);
+
+ // Settings accessors
+
+ static const lldb::TargetPropertiesSP &GetGlobalProperties();
+
+ std::recursive_mutex &GetAPIMutex() { return m_mutex; }
+
+ void DeleteCurrentProcess();
+
+ void CleanupProcess();
+
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s. The dumped content will be only what has
+ /// been loaded or parsed up to this point at which this function
+ /// is called, so this is a good way to see what has been parsed
+ /// in a target.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s, lldb::DescriptionLevel description_level);
+
+ // If listener_sp is null, the listener of the owning Debugger object will be
+ // used.
+ const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp,
+ llvm::StringRef plugin_name,
+ const FileSpec *crash_file);
+
+ const lldb::ProcessSP &GetProcessSP() const;
+
+ bool IsValid() { return m_valid; }
+
+ void Destroy();
+
+ Status Launch(ProcessLaunchInfo &launch_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.
+
+ BreakpointList &GetBreakpointList(bool internal = false);
+
+ const BreakpointList &GetBreakpointList(bool internal = false) const;
+
+ lldb::BreakpointSP GetLastCreatedBreakpoint() {
+ return m_last_created_breakpoint;
+ }
+
+ lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id);
+
+ // Use this to create a file and line breakpoint to a given module or all
+ // module it is nullptr
+ lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
+ const FileSpec &file, uint32_t line_no,
+ uint32_t column, lldb::addr_t offset,
+ LazyBool check_inlines,
+ LazyBool skip_prologue, bool internal,
+ bool request_hardware,
+ LazyBool move_to_nearest_code);
+
+ // Use this to create breakpoint that matches regex against the source lines
+ // in files given in source_file_list: If function_names is non-empty, also
+ // filter by function after the matches are made.
+ lldb::BreakpointSP CreateSourceRegexBreakpoint(
+ const FileSpecList *containingModules,
+ const FileSpecList *source_file_list,
+ const std::unordered_set<std::string> &function_names,
+ RegularExpression &source_regex, bool internal, bool request_hardware,
+ LazyBool move_to_nearest_code);
+
+ // Use this to create a breakpoint from a load address
+ lldb::BreakpointSP CreateBreakpoint(lldb::addr_t load_addr, bool internal,
+ bool request_hardware);
+
+ // Use this to create a breakpoint from a load address and a module file spec
+ lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr,
+ bool internal,
+ const FileSpec *file_spec,
+ bool request_hardware);
+
+ // Use this to create Address breakpoints:
+ lldb::BreakpointSP CreateBreakpoint(const Address &addr, bool internal,
+ bool request_hardware);
+
+ // Use this to create a function breakpoint by regexp in
+ // containingModule/containingSourceFiles, or all modules if it is nullptr
+ // When "skip_prologue is set to eLazyBoolCalculate, we use the current
+ // target setting, else we use the values passed in
+ lldb::BreakpointSP CreateFuncRegexBreakpoint(
+ const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles, RegularExpression &func_regexp,
+ lldb::LanguageType requested_language, LazyBool skip_prologue,
+ bool internal, bool request_hardware);
+
+ // Use this to create a function breakpoint by name in containingModule, or
+ // all modules if it is nullptr When "skip_prologue is set to
+ // eLazyBoolCalculate, we use the current target setting, else we use the
+ // values passed in. func_name_type_mask is or'ed values from the
+ // FunctionNameType enum.
+ lldb::BreakpointSP CreateBreakpoint(
+ const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles, const char *func_name,
+ lldb::FunctionNameType func_name_type_mask, lldb::LanguageType language,
+ lldb::addr_t offset, LazyBool skip_prologue, bool internal,
+ bool request_hardware);
+
+ lldb::BreakpointSP
+ CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp,
+ bool throw_bp, bool internal,
+ Args *additional_args = nullptr,
+ Status *additional_args_error = nullptr);
+
+ lldb::BreakpointSP
+ CreateScriptedBreakpoint(const llvm::StringRef class_name,
+ const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles,
+ bool internal,
+ bool request_hardware,
+ StructuredData::ObjectSP extra_args_sp,
+ Status *creation_error = nullptr);
+
+ // This is the same as the func_name breakpoint except that you can specify a
+ // vector of names. This is cheaper than a regular expression breakpoint in
+ // the case where you just want to set a breakpoint on a set of names you
+ // already know. func_name_type_mask is or'ed values from the
+ // FunctionNameType enum.
+ lldb::BreakpointSP CreateBreakpoint(
+ const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles, const char *func_names[],
+ size_t num_names, lldb::FunctionNameType func_name_type_mask,
+ lldb::LanguageType language, lldb::addr_t offset, LazyBool skip_prologue,
+ bool internal, bool request_hardware);
+
+ lldb::BreakpointSP
+ CreateBreakpoint(const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles,
+ const std::vector<std::string> &func_names,
+ lldb::FunctionNameType func_name_type_mask,
+ lldb::LanguageType language, lldb::addr_t m_offset,
+ LazyBool skip_prologue, bool internal,
+ bool request_hardware);
+
+ // Use this to create a general breakpoint:
+ lldb::BreakpointSP CreateBreakpoint(lldb::SearchFilterSP &filter_sp,
+ lldb::BreakpointResolverSP &resolver_sp,
+ bool internal, bool request_hardware,
+ bool resolve_indirect_symbols);
+
+ // Use this to create a watchpoint:
+ lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size,
+ const CompilerType *type, uint32_t kind,
+ Status &error);
+
+ lldb::WatchpointSP GetLastCreatedWatchpoint() {
+ return m_last_created_watchpoint;
+ }
+
+ WatchpointList &GetWatchpointList() { return m_watchpoint_list; }
+
+ // Manages breakpoint names:
+ void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
+
+ void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
+ Status &error);
+
+ void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
+ ConstString name);
+
+ BreakpointName *FindBreakpointName(ConstString name, bool can_create,
+ Status &error);
+
+ void DeleteBreakpointName(ConstString name);
+
+ void ConfigureBreakpointName(BreakpointName &bp_name,
+ const BreakpointOptions &options,
+ const BreakpointName::Permissions &permissions);
+ void ApplyNameToBreakpoints(BreakpointName &bp_name);
+
+ // This takes ownership of the name obj passed in.
+ void AddBreakpointName(BreakpointName *bp_name);
+
+ void GetBreakpointNames(std::vector<std::string> &names);
+
+ //This call removes ALL breakpoints regardless of permission.
+ void RemoveAllBreakpoints(bool internal_also = false);
+
+ // This removes all the breakpoints, but obeys the ePermDelete on them.
+ void RemoveAllowedBreakpoints();
+
+ void DisableAllBreakpoints(bool internal_also = false);
+
+ void DisableAllowedBreakpoints();
+
+ void EnableAllBreakpoints(bool internal_also = false);
+
+ void EnableAllowedBreakpoints();
+
+ bool DisableBreakpointByID(lldb::break_id_t break_id);
+
+ bool EnableBreakpointByID(lldb::break_id_t break_id);
+
+ bool RemoveBreakpointByID(lldb::break_id_t break_id);
+
+ // The flag 'end_to_end', default to true, signifies that the operation is
+ // performed end to end, for both the debugger and the debuggee.
+
+ bool RemoveAllWatchpoints(bool end_to_end = true);
+
+ bool DisableAllWatchpoints(bool end_to_end = true);
+
+ bool EnableAllWatchpoints(bool end_to_end = true);
+
+ bool ClearAllWatchpointHitCounts();
+
+ bool ClearAllWatchpointHistoricValues();
+
+ bool IgnoreAllWatchpoints(uint32_t ignore_count);
+
+ bool DisableWatchpointByID(lldb::watch_id_t watch_id);
+
+ bool EnableWatchpointByID(lldb::watch_id_t watch_id);
+
+ bool RemoveWatchpointByID(lldb::watch_id_t watch_id);
+
+ bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count);
+
+ Status SerializeBreakpointsToFile(const FileSpec &file,
+ const BreakpointIDList &bp_ids,
+ bool append);
+
+ Status CreateBreakpointsFromFile(const FileSpec &file,
+ 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
+ ///
+ /// Take \a load_addr and potentially add any address bits that are
+ /// needed to make the address callable. For ARM this can set bit
+ /// zero (if it already isn't) if \a load_addr is a thumb function.
+ /// If \a addr_class is set to AddressClass::eInvalid, then the address
+ /// adjustment will always happen. If it is set to an address class
+ /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+ /// returned.
+ lldb::addr_t GetCallableLoadAddress(
+ lldb::addr_t load_addr,
+ AddressClass addr_class = AddressClass::eInvalid) const;
+
+ /// Get \a load_addr as an opcode for this target.
+ ///
+ /// Take \a load_addr and potentially strip any address bits that are
+ /// needed to make the address point to an opcode. For ARM this can
+ /// clear bit zero (if it already isn't) if \a load_addr is a
+ /// thumb function and load_addr is in code.
+ /// If \a addr_class is set to AddressClass::eInvalid, then the address
+ /// adjustment will always happen. If it is set to an address class
+ /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
+ /// returned.
+ lldb::addr_t
+ GetOpcodeLoadAddress(lldb::addr_t load_addr,
+ AddressClass addr_class = AddressClass::eInvalid) const;
+
+ // Get load_addr as breakable load address for this target. Take a addr and
+ // check if for any reason there is a better address than this to put a
+ // breakpoint on. If there is then return that address. For MIPS, if
+ // instruction at addr is a delay slot instruction then this method will find
+ // the address of its previous instruction and return that address.
+ lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr);
+
+ void ModulesDidLoad(ModuleList &module_list);
+
+ void ModulesDidUnload(ModuleList &module_list, bool delete_locations);
+
+ void SymbolsDidLoad(ModuleList &module_list);
+
+ void ClearModules(bool delete_locations);
+
+ /// Called as the last function in Process::DidExec().
+ ///
+ /// Process::DidExec() will clear a lot of state in the process,
+ /// then try to reload a dynamic loader plugin to discover what
+ /// binaries are currently available and then this function should
+ /// be called to allow the target to do any cleanup after everything
+ /// has been figured out. It can remove breakpoints that no longer
+ /// make sense as the exec might have changed the target
+ /// architecture, and unloaded some modules that might get deleted.
+ void DidExec();
+
+ /// Gets the module for the main executable.
+ ///
+ /// Each process has a notion of a main executable that is the file
+ /// that will be executed or attached to. Executable files can have
+ /// dependent modules that are discovered from the object files, or
+ /// discovered at runtime as things are dynamically loaded.
+ ///
+ /// \return
+ /// The shared pointer to the executable module which can
+ /// contains a nullptr Module object if no executable has been
+ /// set.
+ ///
+ /// \see DynamicLoader
+ /// \see ObjectFile::GetDependentModules (FileSpecList&)
+ /// \see Process::SetExecutableModule(lldb::ModuleSP&)
+ lldb::ModuleSP GetExecutableModule();
+
+ Module *GetExecutableModulePointer();
+
+ /// Set the main executable module.
+ ///
+ /// Each process has a notion of a main executable that is the file
+ /// that will be executed or attached to. Executable files can have
+ /// dependent modules that are discovered from the object files, or
+ /// discovered at runtime as things are dynamically loaded.
+ ///
+ /// Setting the executable causes any of the current dependent
+ /// image information to be cleared and replaced with the static
+ /// dependent image information found by calling
+ /// ObjectFile::GetDependentModules (FileSpecList&) on the main
+ /// executable and any modules on which it depends. Calling
+ /// Process::GetImages() will return the newly found images that
+ /// were obtained from all of the object files.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer reference to the module that will become
+ /// the main executable for this process.
+ ///
+ /// \param[in] load_dependent_files
+ /// If \b true then ask the object files to track down any
+ /// known dependent files.
+ ///
+ /// \see ObjectFile::GetDependentModules (FileSpecList&)
+ /// \see Process::GetImages()
+ void SetExecutableModule(
+ lldb::ModuleSP &module_sp,
+ LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
+
+ bool LoadScriptingResources(std::list<Status> &errors,
+ Stream *feedback_stream = nullptr,
+ bool continue_on_error = true) {
+ return m_images.LoadScriptingResourcesInTarget(
+ this, errors, feedback_stream, continue_on_error);
+ }
+
+ /// Get accessor for the images for this process.
+ ///
+ /// Each process has a notion of a main executable that is the file
+ /// that will be executed or attached to. Executable files can have
+ /// dependent modules that are discovered from the object files, or
+ /// discovered at runtime as things are dynamically loaded. After
+ /// a main executable has been set, the images will contain a list
+ /// of all the files that the executable depends upon as far as the
+ /// object files know. These images will usually contain valid file
+ /// virtual addresses only. When the process is launched or attached
+ /// to, the DynamicLoader plug-in will discover where these images
+ /// were loaded in memory and will resolve the load virtual
+ /// addresses is each image, and also in images that are loaded by
+ /// code.
+ ///
+ /// \return
+ /// A list of Module objects in a module list.
+ const ModuleList &GetImages() const { return m_images; }
+
+ ModuleList &GetImages() { return m_images; }
+
+ /// Return whether this FileSpec corresponds to a module that should be
+ /// considered for general searches.
+ ///
+ /// This API will be consulted by the SearchFilterForUnconstrainedSearches
+ /// and any module that returns \b true will not be searched. Note the
+ /// SearchFilterForUnconstrainedSearches is the search filter that
+ /// gets used in the CreateBreakpoint calls when no modules is provided.
+ ///
+ /// The target call at present just consults the Platform's call of the
+ /// same name.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer reference to the module that checked.
+ ///
+ /// \return \b true if the module should be excluded, \b false otherwise.
+ bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
+
+ /// Return whether this module should be considered for general searches.
+ ///
+ /// This API will be consulted by the SearchFilterForUnconstrainedSearches
+ /// and any module that returns \b true will not be searched. Note the
+ /// SearchFilterForUnconstrainedSearches is the search filter that
+ /// gets used in the CreateBreakpoint calls when no modules is provided.
+ ///
+ /// The target call at present just consults the Platform's call of the
+ /// same name.
+ ///
+ /// FIXME: When we get time we should add a way for the user to set modules
+ /// that they
+ /// don't want searched, in addition to or instead of the platform ones.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer reference to the module that checked.
+ ///
+ /// \return \b true if the module should be excluded, \b false otherwise.
+ bool
+ ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp);
+
+ const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
+
+ /// Set the architecture for this target.
+ ///
+ /// If the current target has no Images read in, then this just sets the
+ /// architecture, which will be used to select the architecture of the
+ /// ExecutableModule when that is set. If the current target has an
+ /// ExecutableModule, then calling SetArchitecture with a different
+ /// architecture from the currently selected one will reset the
+ /// ExecutableModule to that slice of the file backing the ExecutableModule.
+ /// If the file backing the ExecutableModule does not contain a fork of this
+ /// architecture, then this code will return false, and the architecture
+ /// won't be changed. If the input arch_spec is the same as the already set
+ /// architecture, this is a no-op.
+ ///
+ /// \param[in] arch_spec
+ /// The new architecture.
+ ///
+ /// \param[in] set_platform
+ /// If \b true, then the platform will be adjusted if the currently
+ /// selected platform is not compatible with the archicture being set.
+ /// If \b false, then just the architecture will be set even if the
+ /// currently selected platform isn't compatible (in case it might be
+ /// manually set following this function call).
+ ///
+ /// \return
+ /// \b true if the architecture was successfully set, \bfalse otherwise.
+ bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false);
+
+ bool MergeArchitecture(const ArchSpec &arch_spec);
+
+ Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); }
+
+ Debugger &GetDebugger() { return m_debugger; }
+
+ size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
+ 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 any
+ // constant sections in our object files on disk. If you always want live
+ // program memory, read straight from the process. If you possibly want to
+ // read from const sections in object files, read from the target. This
+ // version of ReadMemory will try and read memory from the process if the
+ // process is alive. The order is:
+ // 1 - if (prefer_file_cache == true) then read from object file cache
+ // 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, Status &error,
+ lldb::addr_t *load_addr_ptr = nullptr);
+
+ size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
+ Status &error);
+
+ size_t ReadCStringFromMemory(const Address &addr, char *dst,
+ 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,
+ Status &error);
+
+ uint64_t ReadUnsignedIntegerFromMemory(const Address &addr,
+ bool prefer_file_cache,
+ size_t integer_byte_size,
+ uint64_t fail_value, Status &error);
+
+ bool ReadPointerFromMemory(const Address &addr, bool prefer_file_cache,
+ Status &error, Address &pointer_addr);
+
+ SectionLoadList &GetSectionLoadList() {
+ return m_section_load_history.GetCurrentSectionLoadList();
+ }
+
+ static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr,
+ const SymbolContext *sc_ptr);
+
+ // lldb::ExecutionContextScope pure virtual functions
+ lldb::TargetSP CalculateTarget() override;
+
+ lldb::ProcessSP CalculateProcess() override;
+
+ lldb::ThreadSP CalculateThread() override;
+
+ lldb::StackFrameSP CalculateStackFrame() override;
+
+ void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
+
+ PathMappingList &GetImageSearchPathList();
+
+ TypeSystem *GetScratchTypeSystemForLanguage(Status *error,
+ lldb::LanguageType language,
+ bool create_on_demand = true);
+
+ PersistentExpressionState *
+ GetPersistentExpressionStateForLanguage(lldb::LanguageType language);
+
+ // Creates a UserExpression for the given language, the rest of the
+ // parameters have the same meaning as for the UserExpression constructor.
+ // Returns a new-ed object which the caller owns.
+
+ UserExpression *GetUserExpressionForLanguage(
+ llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ValueObject *ctx_obj, Status &error);
+
+ // Creates a FunctionCaller for the given language, the rest of the
+ // parameters have the same meaning as for the FunctionCaller constructor.
+ // Since a FunctionCaller can't be
+ // IR Interpreted, it makes no sense to call this with an
+ // ExecutionContextScope that lacks
+ // a Process.
+ // Returns a new-ed object which the caller owns.
+
+ FunctionCaller *GetFunctionCallerForLanguage(lldb::LanguageType language,
+ const CompilerType &return_type,
+ const Address &function_address,
+ const ValueList &arg_value_list,
+ const char *name, Status &error);
+
+ // Creates a UtilityFunction for the given language, the rest of the
+ // parameters have the same meaning as for the UtilityFunction constructor.
+ // Returns a new-ed object which the caller owns.
+
+ UtilityFunction *GetUtilityFunctionForLanguage(const char *expr,
+ lldb::LanguageType language,
+ const char *name,
+ Status &error);
+
+ ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true);
+
+ lldb::ClangASTImporterSP GetClangASTImporter();
+
+ // Install any files through the platform that need be to installed prior to
+ // launching or attaching.
+ Status Install(ProcessLaunchInfo *launch_info);
+
+ bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr);
+
+ bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr,
+ uint32_t stop_id = SectionLoadHistory::eStopIDNow);
+
+ bool SetSectionLoadAddress(const lldb::SectionSP §ion,
+ lldb::addr_t load_addr,
+ bool warn_multiple = false);
+
+ size_t UnloadModuleSections(const lldb::ModuleSP &module_sp);
+
+ size_t UnloadModuleSections(const ModuleList &module_list);
+
+ bool SetSectionUnloaded(const lldb::SectionSP §ion_sp);
+
+ bool SetSectionUnloaded(const lldb::SectionSP §ion_sp,
+ lldb::addr_t load_addr);
+
+ void ClearAllLoadedSections();
+
+ // Since expressions results can persist beyond the lifetime of a process,
+ // and the const expression results are available after a process is gone, we
+ // provide a way for expressions to be evaluated from the Target itself. If
+ // an expression is going to be run, then it should have a frame filled in in
+ // the execution context.
+ lldb::ExpressionResults EvaluateExpression(
+ llvm::StringRef expression, ExecutionContextScope *exe_scope,
+ lldb::ValueObjectSP &result_valobj_sp,
+ const EvaluateExpressionOptions &options = EvaluateExpressionOptions(),
+ std::string *fixed_expression = nullptr,
+ ValueObject *ctx_obj = nullptr);
+
+ lldb::ExpressionVariableSP GetPersistentVariable(ConstString name);
+
+ /// Return the next available number for numbered persistent variables.
+ unsigned GetNextPersistentVariableIndex() {
+ return m_next_persistent_variable_index++;
+ }
+
+ lldb::addr_t GetPersistentSymbol(ConstString name);
+
+ // Target Stop Hooks
+ class StopHook : public UserID {
+ public:
+ StopHook(const StopHook &rhs);
+
+ ~StopHook();
+
+ StringList *GetCommandPointer() { return &m_commands; }
+
+ const StringList &GetCommands() { return m_commands; }
+
+ lldb::TargetSP &GetTarget() { return m_target_sp; }
+
+ void SetCommands(StringList &in_commands) { m_commands = in_commands; }
+
+ // Set the specifier. The stop hook will own the specifier, and is
+ // responsible for deleting it when we're done.
+ void SetSpecifier(SymbolContextSpecifier *specifier);
+
+ SymbolContextSpecifier *GetSpecifier() { return m_specifier_sp.get(); }
+
+ // Set the Thread Specifier. The stop hook will own the thread specifier,
+ // and is responsible for deleting it when we're done.
+ void SetThreadSpecifier(ThreadSpec *specifier);
+
+ ThreadSpec *GetThreadSpecifier() { return m_thread_spec_up.get(); }
+
+ bool IsActive() { return m_active; }
+
+ void SetIsActive(bool is_active) { m_active = is_active; }
+
+ void SetAutoContinue(bool auto_continue) {m_auto_continue = auto_continue;}
+
+ bool GetAutoContinue() const { return m_auto_continue; }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ private:
+ lldb::TargetSP m_target_sp;
+ StringList m_commands;
+ lldb::SymbolContextSpecifierSP m_specifier_sp;
+ std::unique_ptr<ThreadSpec> m_thread_spec_up;
+ bool m_active = true;
+ bool m_auto_continue = false;
+
+ // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
+ // and fill it with commands, and SetSpecifier to set the specifier shared
+ // pointer (can be null, that will match anything.)
+ StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
+ friend class Target;
+ };
+ typedef std::shared_ptr<StopHook> StopHookSP;
+
+ // Add an empty stop hook to the Target's stop hook list, and returns a
+ // shared pointer to it in new_hook. Returns the id of the new hook.
+ StopHookSP CreateStopHook();
+
+ void RunStopHooks();
+
+ size_t GetStopHookSize();
+
+ bool SetSuppresStopHooks(bool suppress) {
+ bool old_value = m_suppress_stop_hooks;
+ m_suppress_stop_hooks = suppress;
+ return old_value;
+ }
+
+ bool GetSuppressStopHooks() { return m_suppress_stop_hooks; }
+
+ bool RemoveStopHookByID(lldb::user_id_t uid);
+
+ void RemoveAllStopHooks();
+
+ StopHookSP GetStopHookByID(lldb::user_id_t uid);
+
+ bool SetStopHookActiveStateByID(lldb::user_id_t uid, bool active_state);
+
+ void SetAllStopHooksActiveState(bool active_state);
+
+ size_t GetNumStopHooks() const { return m_stop_hooks.size(); }
+
+ StopHookSP GetStopHookAtIndex(size_t index) {
+ if (index >= GetNumStopHooks())
+ return StopHookSP();
+ StopHookCollection::iterator pos = m_stop_hooks.begin();
+
+ while (index > 0) {
+ pos++;
+ index--;
+ }
+ return (*pos).second;
+ }
+
+ lldb::PlatformSP GetPlatform() { return m_platform_sp; }
+
+ void SetPlatform(const lldb::PlatformSP &platform_sp) {
+ m_platform_sp = platform_sp;
+ }
+
+ SourceManager &GetSourceManager();
+
+ ClangModulesDeclVendor *GetClangModulesDeclVendor();
+
+ // Methods.
+ lldb::SearchFilterSP
+ GetSearchFilterForModule(const FileSpec *containingModule);
+
+ lldb::SearchFilterSP
+ GetSearchFilterForModuleList(const FileSpecList *containingModuleList);
+
+ lldb::SearchFilterSP
+ GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles);
+
+ lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language,
+ const char *repl_options, bool can_create);
+
+ void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
+
+protected:
+ /// Implementing of ModuleList::Notifier.
+
+ void NotifyModuleAdded(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) override;
+
+ void NotifyModuleRemoved(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) override;
+
+ void NotifyModuleUpdated(const ModuleList &module_list,
+ const lldb::ModuleSP &old_module_sp,
+ const lldb::ModuleSP &new_module_sp) override;
+
+ void NotifyWillClearList(const ModuleList &module_list) override;
+
+ void NotifyModulesRemoved(lldb_private::ModuleList &module_list) override;
+
+ class Arch {
+ public:
+ explicit Arch(const ArchSpec &spec);
+ const Arch &operator=(const ArchSpec &spec);
+
+ const ArchSpec &GetSpec() const { return m_spec; }
+ Architecture *GetPlugin() const { return m_plugin_up.get(); }
+
+ private:
+ ArchSpec m_spec;
+ std::unique_ptr<Architecture> m_plugin_up;
+ };
+ // Member variables.
+ Debugger &m_debugger;
+ lldb::PlatformSP m_platform_sp; ///< The platform for this target.
+ std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
+ /// classes make the SB interface thread safe
+ Arch m_arch;
+ ModuleList m_images; ///< The list of images for this process (shared
+ /// libraries and anything dynamically loaded).
+ SectionLoadHistory m_section_load_history;
+ BreakpointList m_breakpoint_list;
+ BreakpointList m_internal_breakpoint_list;
+ using BreakpointNameList = std::map<ConstString, BreakpointName *>;
+ BreakpointNameList m_breakpoint_names;
+
+ lldb::BreakpointSP m_last_created_breakpoint;
+ WatchpointList m_watchpoint_list;
+ lldb::WatchpointSP m_last_created_watchpoint;
+ // We want to tightly control the process destruction process so we can
+ // correctly tear down everything that we need to, so the only class that
+ // knows about the process lifespan is this target class.
+ lldb::ProcessSP m_process_sp;
+ lldb::SearchFilterSP m_search_filter_sp;
+ PathMappingList m_image_search_paths;
+ TypeSystemMap m_scratch_type_system_map;
+
+ typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
+ REPLMap m_repl_map;
+
+ lldb::ClangASTImporterSP m_ast_importer_sp;
+ lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_up;
+
+ lldb::SourceManagerUP m_source_manager_up;
+
+ typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
+ StopHookCollection m_stop_hooks;
+ lldb::user_id_t m_stop_hook_next_id;
+ bool m_valid;
+ bool m_suppress_stop_hooks;
+ bool m_is_dummy_target;
+ unsigned m_next_persistent_variable_index = 0;
+
+ static void ImageSearchPathsChanged(const PathMappingList &path_list,
+ void *baton);
+
+ // Utilities for `statistics` command.
+private:
+ std::vector<uint32_t> m_stats_storage;
+ bool m_collecting_stats = false;
+
+public:
+ void SetCollectingStats(bool v) { m_collecting_stats = v; }
+
+ bool GetCollectingStats() { return m_collecting_stats; }
+
+ void IncrementStats(lldb_private::StatisticKind key) {
+ if (!GetCollectingStats())
+ return;
+ lldbassert(key < lldb_private::StatisticKind::StatisticMax &&
+ "invalid statistics!");
+ m_stats_storage[key] += 1;
+ }
+
+ std::vector<uint32_t> GetStatistics() { return m_stats_storage; }
+
+private:
+ /// Construct with optional file and arch.
+ ///
+ /// This member is private. Clients must use
+ /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ /// so all targets can be tracked from the central target list.
+ ///
+ /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ Target(Debugger &debugger, const ArchSpec &target_arch,
+ const lldb::PlatformSP &platform_sp, bool is_dummy_target);
+
+ // Helper function.
+ bool ProcessIsValid();
+
+ // Copy breakpoints, stop hooks and so forth from the dummy target:
+ void PrimeFromDummyTarget(Target *dummy_target);
+
+ void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
+
+ void FinalizeFileActions(ProcessLaunchInfo &info);
+
+ DISALLOW_COPY_AND_ASSIGN(Target);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Target_h_
diff --git a/linux-x64/clang/include/lldb/Target/TargetList.h b/linux-x64/clang/include/lldb/Target/TargetList.h
new file mode 100644
index 0000000..ece0705
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/TargetList.h
@@ -0,0 +1,214 @@
+//===-- TargetList.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_TargetList_h_
+#define liblldb_TargetList_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/Broadcaster.h"
+
+namespace lldb_private {
+
+class TargetList : public Broadcaster {
+private:
+ friend class Debugger;
+
+ /// Constructor
+ ///
+ /// The constructor for the target list is private. Clients can
+ /// get ahold of of the one and only target list through the
+ /// lldb_private::Debugger::GetSharedInstance().GetTargetList().
+ ///
+ /// \see static TargetList& lldb_private::Debugger::GetTargetList().
+ TargetList(Debugger &debugger);
+
+public:
+ /// Broadcaster event bits definitions.
+ enum { eBroadcastBitInterrupt = (1 << 0) };
+
+ // These two functions fill out the Broadcaster interface:
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+ ~TargetList() override;
+
+ /// Create a new Target.
+ ///
+ /// Clients must use this function to create a Target. This allows
+ /// a global list of targets to be maintained in a central location
+ /// so signal handlers and other global functions can use it to
+ /// locate an appropriate target to deliver asynchronous information
+ /// to.
+ ///
+ /// \param[in] debugger
+ /// The debugger to associate this target with
+ ///
+ /// \param[in] file_spec
+ /// The main executable file for a debug target. This value
+ /// can be nullptr and the file can be set later using:
+ /// Target::SetExecutableModule (ModuleSP&)
+ ///
+ /// \param[in] triple_cstr
+ /// A target triple string to be used for the target. This can
+ /// be nullptr if the triple is not known or when attaching to a
+ /// process.
+ ///
+ /// \param[in] get_dependent_modules
+ /// Track down the dependent modules for an executable and
+ /// load those into the module list.
+ ///
+ /// \param[in] platform_options
+ /// A pointer to the platform options to use when creating this
+ /// target. If this value is nullptr, then the currently selected
+ /// platform will be used.
+ ///
+ /// \param[out] target_sp
+ /// A shared pointer to a target that will be filled in if
+ /// this call is successful.
+ ///
+ /// \return
+ /// An error object that indicates success or failure
+ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str,
+ LoadDependentFiles get_dependent_modules,
+ const OptionGroupPlatform *platform_options,
+ lldb::TargetSP &target_sp);
+
+ /// Create a new Target.
+ ///
+ /// Same as the function above, but used when you already know the
+ /// platform you will be using
+ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
+ const ArchSpec &arch,
+ LoadDependentFiles get_dependent_modules,
+ lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp);
+
+ /// Delete a Target object from the list.
+ ///
+ /// When clients are done with the Target objects, this function
+ /// should be called to release the memory associated with a target
+ /// object.
+ ///
+ /// \param[in] target_sp
+ /// The shared pointer to a target.
+ ///
+ /// \return
+ /// Returns \b true if the target was successfully removed from
+ /// from this target list, \b false otherwise. The client will
+ /// be left with the last remaining shared pointer to the target
+ /// in \a target_sp which can then be properly released.
+ bool DeleteTarget(lldb::TargetSP &target_sp);
+
+ int GetNumTargets() const;
+
+ lldb::TargetSP GetTargetAtIndex(uint32_t index) const;
+
+ uint32_t GetIndexOfTarget(lldb::TargetSP target_sp) const;
+
+ /// Find the target that contains has an executable whose path
+ /// matches \a exe_file_spec, and whose architecture matches
+ /// \a arch_ptr if arch_ptr is not nullptr.
+ ///
+ /// \param[in] exe_file_spec
+ /// A file spec containing a basename, or a full path (directory
+ /// and basename). If \a exe_file_spec contains only a filename
+ /// (empty GetDirectory() value) then matching will be done
+ /// solely based on the filenames and directories won't be
+ /// compared. If \a exe_file_spec contains a filename and a
+ /// directory, then both must match.
+ ///
+ /// \param[in] exe_arch_ptr
+ /// If not nullptr then the architecture also needs to match, else
+ /// the architectures will be compared.
+ ///
+ /// \return
+ /// A shared pointer to a target object. The returned shared
+ /// pointer will contain nullptr if no target objects have a
+ /// executable whose full or partial path matches
+ /// with a matching process ID.
+ lldb::TargetSP FindTargetWithExecutableAndArchitecture(
+ const FileSpec &exe_file_spec,
+ const ArchSpec *exe_arch_ptr = nullptr) const;
+
+ /// Find the target that contains a process with process ID \a
+ /// pid.
+ ///
+ /// \param[in] pid
+ /// The process ID to search our target list for.
+ ///
+ /// \return
+ /// A shared pointer to a target object. The returned shared
+ /// pointer will contain nullptr if no target objects own a process
+ /// with a matching process ID.
+ lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid) const;
+
+ lldb::TargetSP FindTargetWithProcess(lldb_private::Process *process) const;
+
+ lldb::TargetSP GetTargetSP(Target *target) const;
+
+ /// Send an async interrupt to one or all processes.
+ ///
+ /// Find the target that contains the process with process ID \a
+ /// pid and send a LLDB_EVENT_ASYNC_INTERRUPT event to the process's
+ /// event queue.
+ ///
+ /// \param[in] pid
+ /// The process ID to search our target list for, if \a pid is
+ /// LLDB_INVALID_PROCESS_ID, then the interrupt will be sent to
+ /// all processes.
+ ///
+ /// \return
+ /// The number of async interrupts sent.
+ uint32_t SendAsyncInterrupt(lldb::pid_t pid = LLDB_INVALID_PROCESS_ID);
+
+ uint32_t SignalIfRunning(lldb::pid_t pid, int signo);
+
+ uint32_t SetSelectedTarget(Target *target);
+
+ lldb::TargetSP GetSelectedTarget();
+
+protected:
+ typedef std::vector<lldb::TargetSP> collection;
+ // Member variables.
+ collection m_target_list;
+ lldb::TargetSP m_dummy_target_sp;
+ mutable std::recursive_mutex m_target_list_mutex;
+ uint32_t m_selected_target_idx;
+
+private:
+ lldb::TargetSP GetDummyTarget(lldb_private::Debugger &debugger);
+
+ Status CreateDummyTarget(Debugger &debugger,
+ llvm::StringRef specified_arch_name,
+ lldb::TargetSP &target_sp);
+
+ Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str,
+ LoadDependentFiles load_dependent_files,
+ const OptionGroupPlatform *platform_options,
+ lldb::TargetSP &target_sp, bool is_dummy_target);
+
+ Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
+ const ArchSpec &arch,
+ LoadDependentFiles get_dependent_modules,
+ lldb::PlatformSP &platform_sp,
+ lldb::TargetSP &target_sp, bool is_dummy_target);
+
+ DISALLOW_COPY_AND_ASSIGN(TargetList);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_TargetList_h_
diff --git a/linux-x64/clang/include/lldb/Target/Thread.h b/linux-x64/clang/include/lldb/Target/Thread.h
new file mode 100644
index 0000000..7aeaece
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Thread.h
@@ -0,0 +1,1268 @@
+//===-- Thread.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Thread_h_
+#define liblldb_Thread_h_
+
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/RegisterCheckpoint.h"
+#include "lldb/Target/StackFrameList.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+#define LLDB_THREAD_MAX_STOP_EXC_DATA 8
+
+namespace lldb_private {
+
+class ThreadProperties : public Properties {
+public:
+ ThreadProperties(bool is_global);
+
+ ~ThreadProperties() override;
+
+ /// The regular expression returned determines symbols that this
+ /// thread won't stop in during "step-in" operations.
+ ///
+ /// \return
+ /// A pointer to a regular expression to compare against symbols,
+ /// or nullptr if all symbols are allowed.
+ ///
+ const RegularExpression *GetSymbolsToAvoidRegexp();
+
+ FileSpecList GetLibrariesToAvoid() const;
+
+ bool GetTraceEnabledState() const;
+
+ bool GetStepInAvoidsNoDebug() const;
+
+ bool GetStepOutAvoidsNoDebug() const;
+
+ uint64_t GetMaxBacktraceDepth() const;
+};
+
+typedef std::shared_ptr<ThreadProperties> ThreadPropertiesSP;
+
+class Thread : public std::enable_shared_from_this<Thread>,
+ public ThreadProperties,
+ public UserID,
+ public ExecutionContextScope,
+ public Broadcaster {
+public:
+ /// Broadcaster event bits definitions.
+ enum {
+ eBroadcastBitStackChanged = (1 << 0),
+ eBroadcastBitThreadSuspended = (1 << 1),
+ eBroadcastBitThreadResumed = (1 << 2),
+ eBroadcastBitSelectedFrameChanged = (1 << 3),
+ eBroadcastBitThreadSelected = (1 << 4)
+ };
+
+ static ConstString &GetStaticBroadcasterClass();
+
+ ConstString &GetBroadcasterClass() const override {
+ return GetStaticBroadcasterClass();
+ }
+
+ class ThreadEventData : public EventData {
+ public:
+ ThreadEventData(const lldb::ThreadSP thread_sp);
+
+ ThreadEventData(const lldb::ThreadSP thread_sp, const StackID &stack_id);
+
+ ThreadEventData();
+
+ ~ThreadEventData() override;
+
+ static ConstString GetFlavorString();
+
+ ConstString GetFlavor() const override {
+ return ThreadEventData::GetFlavorString();
+ }
+
+ void Dump(Stream *s) const override;
+
+ static const ThreadEventData *GetEventDataFromEvent(const Event *event_ptr);
+
+ static lldb::ThreadSP GetThreadFromEvent(const Event *event_ptr);
+
+ static StackID GetStackIDFromEvent(const Event *event_ptr);
+
+ static lldb::StackFrameSP GetStackFrameFromEvent(const Event *event_ptr);
+
+ lldb::ThreadSP GetThread() const { return m_thread_sp; }
+
+ StackID GetStackID() const { return m_stack_id; }
+
+ private:
+ lldb::ThreadSP m_thread_sp;
+ StackID m_stack_id;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadEventData);
+ };
+
+ struct ThreadStateCheckpoint {
+ uint32_t orig_stop_id; // Dunno if I need this yet but it is an interesting
+ // 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;
+ lldb::addr_t current_inlined_pc;
+ };
+
+ /// Constructor
+ ///
+ /// \param [in] process
+ ///
+ /// \param [in] tid
+ ///
+ /// \param [in] use_invalid_index_id
+ /// Optional parameter, defaults to false. The only subclass that
+ /// is likely to set use_invalid_index_id == true is the HistoryThread
+ /// class. In that case, the Thread we are constructing represents
+ /// a thread from earlier in the program execution. We may have the
+ /// tid of the original thread that they represent but we don't want
+ /// to reuse the IndexID of that thread, or create a new one. If a
+ /// client wants to know the original thread's IndexID, they should use
+ /// Thread::GetExtendedBacktraceOriginatingIndexID().
+ Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
+
+ ~Thread() override;
+
+ static void SettingsInitialize();
+
+ static void SettingsTerminate();
+
+ static const ThreadPropertiesSP &GetGlobalProperties();
+
+ lldb::ProcessSP GetProcess() const { return m_process_wp.lock(); }
+
+ int GetResumeSignal() const { return m_resume_signal; }
+
+ void SetResumeSignal(int signal) { m_resume_signal = signal; }
+
+ lldb::StateType GetState() const;
+
+ void SetState(lldb::StateType state);
+
+ /// Sets the USER resume state for this thread. If you set a thread to
+ /// suspended with
+ /// this API, it won't take part in any of the arbitration for ShouldResume,
+ /// and will stay
+ /// suspended even when other threads do get to run.
+ ///
+ /// N.B. This is not the state that is used internally by thread plans to
+ /// implement
+ /// staying on one thread while stepping over a breakpoint, etc. The is the
+ /// TemporaryResume state, and if you are implementing some bit of strategy in
+ /// the stepping
+ /// machinery you should be using that state and not the user resume state.
+ ///
+ /// If you are just preparing all threads to run, you should not override the
+ /// threads that are
+ /// marked as suspended by the debugger. In that case, pass override_suspend
+ /// = false. If you want
+ /// to force the thread to run (e.g. the "thread continue" command, or are
+ /// resetting the state
+ /// (e.g. in SBThread::Resume()), then pass true to override_suspend.
+ /// \return
+ /// The User resume state for this thread.
+ void SetResumeState(lldb::StateType state, bool override_suspend = false) {
+ if (m_resume_state == lldb::eStateSuspended && !override_suspend)
+ return;
+ m_resume_state = state;
+ }
+
+ /// Gets the USER resume state for this thread. This is not the same as what
+ /// this thread is going to do for any particular step, however if this thread
+ /// returns eStateSuspended, then the process control logic will never allow
+ /// this
+ /// thread to run.
+ ///
+ /// \return
+ /// The User resume state for this thread.
+ lldb::StateType GetResumeState() const { return m_resume_state; }
+
+ // This function is called on all the threads before "ShouldResume" and
+ // "WillResume" in case a thread needs to change its state before the
+ // ThreadList polls all the threads to figure out which ones actually will
+ // get to run and how.
+ void SetupForResume();
+
+ // Do not override this function, it is for thread plan logic only
+ bool ShouldResume(lldb::StateType resume_state);
+
+ // Override this to do platform specific tasks before resume.
+ virtual void WillResume(lldb::StateType resume_state) {}
+
+ // This clears generic thread state after a resume. If you subclass this, be
+ // sure to call it.
+ virtual void DidResume();
+
+ // This notifies the thread when a private stop occurs.
+ virtual void DidStop();
+
+ virtual void RefreshStateAfterStop() = 0;
+
+ void WillStop();
+
+ bool ShouldStop(Event *event_ptr);
+
+ Vote ShouldReportStop(Event *event_ptr);
+
+ Vote ShouldReportRun(Event *event_ptr);
+
+ void Flush();
+
+ // Return whether this thread matches the specification in ThreadSpec. This
+ // is a virtual method because at some point we may extend the thread spec
+ // with a platform specific dictionary of attributes, which then only the
+ // platform specific Thread implementation would know how to match. For now,
+ // this just calls through to the ThreadSpec's ThreadPassesBasicTests method.
+ virtual bool MatchesSpec(const ThreadSpec *spec);
+
+ lldb::StopInfoSP GetStopInfo();
+
+ lldb::StopReason GetStopReason();
+
+ bool StopInfoIsUpToDate() const;
+
+ // This sets the stop reason to a "blank" stop reason, so you can call
+ // functions on the thread without having the called function run with
+ // whatever stop reason you stopped with.
+ void SetStopInfoToNothing();
+
+ bool ThreadStoppedForAReason();
+
+ static const char *RunModeAsCString(lldb::RunMode mode);
+
+ static const char *StopReasonAsCString(lldb::StopReason reason);
+
+ virtual const char *GetInfo() { return nullptr; }
+
+ /// Retrieve a dictionary of information about this thread
+ ///
+ /// On Mac OS X systems there may be voucher information.
+ /// The top level dictionary returned will have an "activity" key and the
+ /// value of the activity is a dictionary. Keys in that dictionary will
+ /// be "name" and "id", among others.
+ /// There may also be "trace_messages" (an array) with each entry in that
+ /// array
+ /// being a dictionary (keys include "message" with the text of the trace
+ /// message).
+ StructuredData::ObjectSP GetExtendedInfo() {
+ if (!m_extended_info_fetched) {
+ m_extended_info = FetchThreadExtendedInfo();
+ m_extended_info_fetched = true;
+ }
+ return m_extended_info;
+ }
+
+ virtual const char *GetName() { return nullptr; }
+
+ virtual void SetName(const char *name) {}
+
+ /// Whether this thread can be associated with a libdispatch queue
+ ///
+ /// The Thread may know if it is associated with a libdispatch queue,
+ /// it may know definitively that it is NOT associated with a libdispatch
+ /// queue, or it may be unknown whether it is associated with a libdispatch
+ /// queue.
+ ///
+ /// \return
+ /// eLazyBoolNo if this thread is definitely not associated with a
+ /// libdispatch queue (e.g. on a non-Darwin system where GCD aka
+ /// libdispatch is not available).
+ ///
+ /// eLazyBoolYes this thread is associated with a libdispatch queue.
+ ///
+ /// eLazyBoolCalculate this thread may be associated with a libdispatch
+ /// queue but the thread doesn't know one way or the other.
+ virtual lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() {
+ return eLazyBoolNo;
+ }
+
+ virtual void SetAssociatedWithLibdispatchQueue(
+ lldb_private::LazyBool associated_with_libdispatch_queue) {}
+
+ /// Retrieve the Queue ID for the queue currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the QueueID.
+ ///
+ /// This is a unique identifier for the libdispatch/GCD queue in a
+ /// process. Often starting at 1 for the initial system-created
+ /// queues and incrementing, a QueueID will not be reused for a
+ /// different queue during the lifetime of a process.
+ ///
+ /// \return
+ /// A QueueID if the Thread subclass implements this, else
+ /// LLDB_INVALID_QUEUE_ID.
+ virtual lldb::queue_id_t GetQueueID() { return LLDB_INVALID_QUEUE_ID; }
+
+ virtual void SetQueueID(lldb::queue_id_t new_val) {}
+
+ /// Retrieve the Queue name for the queue currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the Queue name.
+ ///
+ /// \return
+ /// The Queue name, if the Thread subclass implements this, else
+ /// nullptr.
+ virtual const char *GetQueueName() { return nullptr; }
+
+ virtual void SetQueueName(const char *name) {}
+
+ /// Retrieve the Queue kind for the queue currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the Queue kind - either eQueueKindSerial or
+ /// eQueueKindConcurrent, indicating that this queue processes work
+ /// items serially or concurrently.
+ ///
+ /// \return
+ /// The Queue kind, if the Thread subclass implements this, else
+ /// eQueueKindUnknown.
+ virtual lldb::QueueKind GetQueueKind() { return lldb::eQueueKindUnknown; }
+
+ virtual void SetQueueKind(lldb::QueueKind kind) {}
+
+ /// Retrieve the Queue for this thread, if any.
+ ///
+ /// \return
+ /// A QueueSP for the queue that is currently associated with this
+ /// thread.
+ /// An empty shared pointer indicates that this thread is not
+ /// associated with a queue, or libdispatch queues are not
+ /// supported on this target.
+ virtual lldb::QueueSP GetQueue() { return lldb::QueueSP(); }
+
+ /// Retrieve the address of the libdispatch_queue_t struct for queue
+ /// currently using this Thread
+ ///
+ /// If this Thread is doing work on behalf of a libdispatch/GCD queue,
+ /// retrieve the address of the libdispatch_queue_t structure describing
+ /// the queue.
+ ///
+ /// This address may be reused for different queues later in the Process
+ /// lifetime and should not be used to identify a queue uniquely. Use
+ /// the GetQueueID() call for that.
+ ///
+ /// \return
+ /// The Queue's libdispatch_queue_t address if the Thread subclass
+ /// implements this, else LLDB_INVALID_ADDRESS.
+ virtual lldb::addr_t GetQueueLibdispatchQueueAddress() {
+ return LLDB_INVALID_ADDRESS;
+ }
+
+ virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) {}
+
+ /// Whether this Thread already has all the Queue information cached or not
+ ///
+ /// A Thread may be associated with a libdispatch work Queue at a given
+ /// public stop event. If so, the thread can satisify requests like
+ /// GetQueueLibdispatchQueueAddress, GetQueueKind, GetQueueName, and
+ /// GetQueueID
+ /// either from information from the remote debug stub when it is initially
+ /// created, or it can query the SystemRuntime for that information.
+ ///
+ /// This method allows the SystemRuntime to discover if a thread has this
+ /// information already, instead of calling the thread to get the information
+ /// and having the thread call the SystemRuntime again.
+ virtual bool ThreadHasQueueInformation() const { return false; }
+
+ virtual uint32_t GetStackFrameCount() {
+ return GetStackFrameList()->GetNumFrames();
+ }
+
+ virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx) {
+ return GetStackFrameList()->GetFrameAtIndex(idx);
+ }
+
+ virtual lldb::StackFrameSP
+ GetFrameWithConcreteFrameIndex(uint32_t unwind_idx);
+
+ bool DecrementCurrentInlinedDepth() {
+ return GetStackFrameList()->DecrementCurrentInlinedDepth();
+ }
+
+ uint32_t GetCurrentInlinedDepth() {
+ return GetStackFrameList()->GetCurrentInlinedDepth();
+ }
+
+ Status ReturnFromFrameWithIndex(uint32_t frame_idx,
+ lldb::ValueObjectSP return_value_sp,
+ bool broadcast = false);
+
+ Status ReturnFromFrame(lldb::StackFrameSP frame_sp,
+ lldb::ValueObjectSP return_value_sp,
+ bool broadcast = false);
+
+ 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())
+ return GetStackFrameList()->GetFrameWithStackID(stack_id);
+ return lldb::StackFrameSP();
+ }
+
+ uint32_t GetSelectedFrameIndex() {
+ return GetStackFrameList()->GetSelectedFrameIndex();
+ }
+
+ lldb::StackFrameSP GetSelectedFrame();
+
+ uint32_t SetSelectedFrame(lldb_private::StackFrame *frame,
+ bool broadcast = false);
+
+ bool SetSelectedFrameByIndex(uint32_t frame_idx, bool broadcast = false);
+
+ bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx,
+ Stream &output_stream);
+
+ void SetDefaultFileAndLineToSelectedFrame() {
+ GetStackFrameList()->SetDefaultFileAndLineToSelectedFrame();
+ }
+
+ virtual lldb::RegisterContextSP GetRegisterContext() = 0;
+
+ virtual lldb::RegisterContextSP
+ CreateRegisterContextForFrame(StackFrame *frame) = 0;
+
+ virtual void ClearStackFrames();
+
+ virtual bool SetBackingThread(const lldb::ThreadSP &thread_sp) {
+ return false;
+ }
+
+ virtual lldb::ThreadSP GetBackingThread() const { return lldb::ThreadSP(); }
+
+ virtual void ClearBackingThread() {
+ // Subclasses can use this function if a thread is actually backed by
+ // another thread. This is currently used for the OperatingSystem plug-ins
+ // where they might have a thread that is in memory, yet its registers are
+ // available through the lldb_private::Thread subclass for the current
+ // lldb_private::Process class. Since each time the process stops the
+ // backing threads for memory threads can change, we need a way to clear
+ // the backing thread for all memory threads each time we stop.
+ }
+
+ // If stop_format is true, this will be the form used when we print stop
+ // info. If false, it will be the form we use for thread list and co.
+ void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx,
+ bool stop_format);
+
+ bool GetDescription(Stream &s, lldb::DescriptionLevel level,
+ bool print_json_thread, bool print_json_stopinfo);
+
+ /// Default implementation for stepping into.
+ ///
+ /// This function is designed to be used by commands where the
+ /// process is publicly stopped.
+ ///
+ /// \param[in] source_step
+ /// If true and the frame has debug info, then do a source level
+ /// step in, else do a single instruction step in.
+ ///
+ /// \param[in] step_in_avoids_code_without_debug_info
+ /// If \a true, then avoid stepping into code that doesn't have
+ /// debug info, else step into any code regardless of whether it
+ /// has debug info.
+ ///
+ /// \param[in] step_out_avoids_code_without_debug_info
+ /// If \a true, then if you step out to code with no debug info, keep
+ /// stepping out till you get to code with debug info.
+ ///
+ /// \return
+ /// An error that describes anything that went wrong
+ virtual Status
+ StepIn(bool source_step,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ /// Default implementation for stepping over.
+ ///
+ /// This function is designed to be used by commands where the
+ /// process is publicly stopped.
+ ///
+ /// \param[in] source_step
+ /// If true and the frame has debug info, then do a source level
+ /// step over, else do a single instruction step over.
+ ///
+ /// \return
+ /// An error that describes anything that went wrong
+ virtual Status StepOver(
+ bool source_step,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ /// Default implementation for stepping out.
+ ///
+ /// This function is designed to be used by commands where the
+ /// process is publicly stopped.
+ ///
+ /// \return
+ /// An error that describes anything that went wrong
+ virtual Status StepOut();
+
+ /// Retrieves the per-thread data area.
+ /// Most OSs maintain a per-thread pointer (e.g. the FS register on
+ /// x64), which we return the value of here.
+ ///
+ /// \return
+ /// LLDB_INVALID_ADDRESS if not supported, otherwise the thread
+ /// pointer value.
+ virtual lldb::addr_t GetThreadPointer();
+
+ /// Retrieves the per-module TLS block for a thread.
+ ///
+ /// \param[in] module
+ /// The module to query TLS data for.
+ ///
+ /// \param[in] tls_file_addr
+ /// The thread local address in module
+ /// \return
+ /// If the thread has TLS data allocated for the
+ /// module, the address of the TLS block. Otherwise
+ /// LLDB_INVALID_ADDRESS is returned.
+ virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module,
+ lldb::addr_t tls_file_addr);
+
+ /// Check whether this thread is safe to run functions
+ ///
+ /// The SystemRuntime may know of certain thread states (functions in
+ /// process of execution, for instance) which can make it unsafe for
+ /// functions to be called.
+ ///
+ /// \return
+ /// True if it is safe to call functions on this thread.
+ /// False if function calls should be avoided on this thread.
+ virtual bool SafeToCallFunctions();
+
+ // Thread Plan Providers:
+ // This section provides the basic thread plans that the Process control
+ // machinery uses to run the target. ThreadPlan.h provides more details on
+ // how this mechanism works. The thread provides accessors to a set of plans
+ // that perform basic operations. The idea is that particular Platform
+ // plugins can override these methods to provide the implementation of these
+ // basic operations appropriate to their environment.
+ //
+ // NB: All the QueueThreadPlanXXX providers return Shared Pointers to
+ // Thread plans. This is useful so that you can modify the plans after
+ // creation in ways specific to that plan type. Also, it is often necessary
+ // for ThreadPlans that utilize other ThreadPlans to implement their task to
+ // keep a shared pointer to the sub-plan. But besides that, the shared
+ // pointers should only be held onto by entities who live no longer than the
+ // thread containing the ThreadPlan.
+ // FIXME: If this becomes a problem, we can make a version that just returns a
+ // pointer,
+ // which it is clearly unsafe to hold onto, and a shared pointer version, and
+ // only allow ThreadPlan and Co. to use the latter. That is made more
+ // annoying to do because there's no elegant way to friend a method to all
+ // sub-classes of a given class.
+ //
+
+ /// Queues the base plan for a thread.
+ /// The version returned by Process does some things that are useful,
+ /// like handle breakpoints and signals, so if you return a plugin specific
+ /// one you probably want to call through to the Process one for anything
+ /// your plugin doesn't explicitly handle.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueFundamentalPlan(bool abort_other_plans);
+
+ /// Queues the plan used to step one instruction from the current PC of \a
+ /// thread.
+ ///
+ /// \param[in] step_over
+ /// \b true if we step over calls to functions, false if we step in.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction(
+ bool step_over, bool abort_other_plans, bool stop_other_threads,
+ Status &status);
+
+ /// Queues the plan used to step through an address range, stepping over
+ /// function calls.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] type
+ /// Type of step to do, only eStepTypeInto and eStepTypeOver are supported
+ /// by this plan.
+ ///
+ /// \param[in] range
+ /// The address range to step through.
+ ///
+ /// \param[in] addr_context
+ /// When dealing with stepping through inlined functions the current PC is
+ /// not enough information to know
+ /// what "step" means. For instance a series of nested inline functions
+ /// might start at the same address.
+ // The \a addr_context provides the current symbol context the step
+ /// is supposed to be out of.
+ // FIXME: Currently unused.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step
+ /// out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, we will consult the default set in the thread.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(
+ bool abort_other_plans, const AddressRange &range,
+ const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
+ Status &status,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ // Helper function that takes a LineEntry to step, insted of an AddressRange.
+ // This may combine multiple LineEntries of the same source line number to
+ // step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange(
+ bool abort_other_plans, const LineEntry &line_entry,
+ const SymbolContext &addr_context, lldb::RunMode stop_other_threads,
+ Status &status,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ /// Queues the plan used to step through an address range, stepping into
+ /// functions.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] type
+ /// Type of step to do, only eStepTypeInto and eStepTypeOver are supported
+ /// by this plan.
+ ///
+ /// \param[in] range
+ /// The address range to step through.
+ ///
+ /// \param[in] addr_context
+ /// When dealing with stepping through inlined functions the current PC is
+ /// not enough information to know
+ /// what "step" means. For instance a series of nested inline functions
+ /// might start at the same address.
+ // The \a addr_context provides the current symbol context the step
+ /// is supposed to be out of.
+ // FIXME: Currently unused.
+ ///
+ /// \param[in] step_in_target
+ /// Name if function we are trying to step into. We will step out if we
+ /// don't land in that function.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \param[in] step_in_avoids_code_without_debug_info
+ /// If eLazyBoolYes we will step out if we step into code with no debug
+ /// info.
+ /// If eLazyBoolCalculate we will consult the default set in the thread.
+ ///
+ /// \param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step
+ /// out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, it will consult the default set in the thread.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(
+ bool abort_other_plans, const AddressRange &range,
+ const SymbolContext &addr_context, const char *step_in_target,
+ lldb::RunMode stop_other_threads, Status &status,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ // Helper function that takes a LineEntry to step, insted of an AddressRange.
+ // This may combine multiple LineEntries of the same source line number to
+ // step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange(
+ bool abort_other_plans, const LineEntry &line_entry,
+ const SymbolContext &addr_context, const char *step_in_target,
+ lldb::RunMode stop_other_threads, Status &status,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ /// Queue the plan used to step out of the function at the current PC of
+ /// \a thread.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] addr_context
+ /// When dealing with stepping through inlined functions the current PC is
+ /// not enough information to know
+ /// what "step" means. For instance a series of nested inline functions
+ /// might start at the same address.
+ // The \a addr_context provides the current symbol context the step
+ /// is supposed to be out of.
+ // FIXME: Currently unused.
+ ///
+ /// \param[in] first_insn
+ /// \b true if this is the first instruction of a function.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[in] stop_vote
+ /// \param[in] run_vote
+ /// See standard meanings for the stop & run votes in ThreadPlan.h.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \param[in] step_out_avoids_code_without_debug_info
+ /// If eLazyBoolYes, if the step over steps out it will continue to step
+ /// out till it comes to a frame with debug info.
+ /// If eLazyBoolCalculate, it will consult the default set in the thread.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut(
+ bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
+ bool stop_other_threads, Vote stop_vote, Vote run_vote,
+ uint32_t frame_idx, Status &status,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
+ /// Queue the plan used to step out of the function at the current PC of
+ /// a thread. This version does not consult the should stop here callback,
+ /// and should only
+ /// be used by other thread plans when they need to retain control of the step
+ /// out.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] addr_context
+ /// When dealing with stepping through inlined functions the current PC is
+ /// not enough information to know
+ /// what "step" means. For instance a series of nested inline functions
+ /// might start at the same address.
+ // The \a addr_context provides the current symbol context the step
+ /// is supposed to be out of.
+ // FIXME: Currently unused.
+ ///
+ /// \param[in] first_insn
+ /// \b true if this is the first instruction of a function.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[in] stop_vote
+ ///
+ /// \param[in] run_vote
+ /// See standard meanings for the stop & run votes in ThreadPlan.h.
+ ///
+ /// \param[in] frame_idx
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \param[in] continue_to_next_branch
+ /// Normally this will enqueue a plan that will put a breakpoint on the
+ /// return address and continue
+ /// to there. If continue_to_next_branch is true, this is an operation not
+ /// involving the user --
+ /// e.g. stepping "next" in a source line and we instruction stepped into
+ /// another function --
+ /// so instead of putting a breakpoint on the return address, advance the
+ /// breakpoint to the
+ /// end of the source line that is doing the call, or until the next flow
+ /// control instruction.
+ /// If the return value from the function call is to be retrieved /
+ /// displayed to the user, you must stop
+ /// on the return address. The return value may be stored in volatile
+ /// registers which are overwritten
+ /// before the next branch instruction.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop(
+ bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
+ bool stop_other_threads, Vote stop_vote, Vote run_vote,
+ uint32_t frame_idx, Status &status, bool continue_to_next_branch = false);
+
+ /// Gets the plan used to step through the code that steps from a function
+ /// call site at the current PC into the actual function call.
+ ///
+ /// \param[in] return_stack_id
+ /// The stack id that we will return to (by setting backstop breakpoints on
+ /// the return
+ /// address to that frame) if we fail to step through.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepThrough(StackID &return_stack_id,
+ bool abort_other_plans, bool stop_other_threads,
+ Status &status);
+
+ /// Gets the plan used to continue from the current PC.
+ /// This is a simple plan, mostly useful as a backstop when you are continuing
+ /// for some particular purpose.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \param[in] target_addr
+ /// The address to which we're running.
+ ///
+ /// \param[in] stop_other_threads
+ /// \b true if we will stop other threads while we single step this one.
+ ///
+ /// \param[out] status
+ /// A status with an error if queuing failed.
+ ///
+ /// \return
+ /// A shared pointer to the newly queued thread plan, or nullptr if the
+ /// plan could not be queued.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForRunToAddress(bool abort_other_plans, Address &target_addr,
+ bool stop_other_threads, Status &status);
+
+ virtual lldb::ThreadPlanSP QueueThreadPlanForStepUntil(
+ bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
+ bool stop_others, uint32_t frame_idx, Status &status);
+
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name,
+ bool stop_other_threads, Status &status);
+
+ // Thread Plan accessors:
+
+ /// Gets the plan which will execute next on the plan stack.
+ ///
+ /// \return
+ /// A pointer to the next executed plan.
+ ThreadPlan *GetCurrentPlan();
+
+ /// Unwinds the thread stack for the innermost expression plan currently
+ /// on the thread plan stack.
+ ///
+ /// \return
+ /// An error if the thread plan could not be unwound.
+
+ Status UnwindInnermostExpression();
+
+ /// Gets the outer-most plan that was popped off the plan stack in the
+ /// most recent stop. Useful for printing the stop reason accurately.
+ ///
+ /// \return
+ /// A pointer to the last completed plan.
+ lldb::ThreadPlanSP GetCompletedPlan();
+
+ /// Gets the outer-most return value from the completed plans
+ ///
+ /// \return
+ /// A ValueObjectSP, either empty if there is no return value,
+ /// or containing the return value.
+ lldb::ValueObjectSP GetReturnValueObject();
+
+ /// Gets the outer-most expression variable from the completed plans
+ ///
+ /// \return
+ /// A ExpressionVariableSP, either empty if there is no
+ /// plan completed an expression during the current stop
+ /// or the expression variable that was made for the completed expression.
+ lldb::ExpressionVariableSP GetExpressionVariable();
+
+ /// Checks whether the given plan is in the completed plans for this
+ /// stop.
+ ///
+ /// \param[in] plan
+ /// Pointer to the plan you're checking.
+ ///
+ /// \return
+ /// Returns true if the input plan is in the completed plan stack,
+ /// false otherwise.
+ bool IsThreadPlanDone(ThreadPlan *plan);
+
+ /// Checks whether the given plan is in the discarded plans for this
+ /// stop.
+ ///
+ /// \param[in] plan
+ /// Pointer to the plan you're checking.
+ ///
+ /// \return
+ /// Returns true if the input plan is in the discarded plan stack,
+ /// false otherwise.
+ 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
+ /// The plan to queue.
+ ///
+ /// \param[in] abort_other_plans
+ /// \b true if we discard the currently queued plans and replace them with
+ /// this one.
+ /// Otherwise this plan will go on the end of the plan stack.
+ ///
+ /// \return
+ /// A pointer to the last completed plan.
+ Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
+
+ /// Discards the plans queued on the plan stack of the current thread. This
+ /// is
+ /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
+ // But if \a force is true, all thread plans are discarded.
+ void DiscardThreadPlans(bool force);
+
+ /// Discards the plans queued on the plan stack of the current thread up to
+ /// and
+ /// including up_to_plan_sp.
+ //
+ // \param[in] up_to_plan_sp
+ // Discard all plans up to and including this one.
+ void DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp);
+
+ void DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr);
+
+ /// Discards the plans queued on the plan stack of the current thread up to
+ /// and
+ /// including the plan in that matches \a thread_index counting only
+ /// the non-Private plans.
+ ///
+ /// \param[in] up_to_plan_sp
+ /// Discard all plans up to and including this user plan given by this
+ /// index.
+ ///
+ /// \return
+ /// \b true if there was a thread plan with that user index, \b false
+ /// otherwise.
+ bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index);
+
+ /// Prints the current plan stack.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the plan stack info.
+ ///
+ void DumpThreadPlans(
+ Stream *s,
+ lldb::DescriptionLevel desc_level = lldb::eDescriptionLevelVerbose,
+ bool include_internal = true, bool ignore_boring = false) const;
+
+ virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state);
+
+ virtual bool
+ RestoreRegisterStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
+
+ virtual bool
+ RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
+
+ void EnableTracer(bool value, bool single_step);
+
+ void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp);
+
+ // Get the thread index ID. The index ID that is guaranteed to not be re-used
+ // by a process. They start at 1 and increase with each new thread. This
+ // allows easy command line access by a unique ID that is easier to type than
+ // the actual system thread ID.
+ uint32_t GetIndexID() const;
+
+ // Get the originating thread's index ID.
+ // In the case of an "extended" thread -- a thread which represents the stack
+ // that enqueued/spawned work that is currently executing -- we need to
+ // provide the IndexID of the thread that actually did this work. We don't
+ // want to just masquerade as that thread's IndexID by using it in our own
+ // IndexID because that way leads to madness - but the driver program which
+ // is iterating over extended threads may ask for the OriginatingThreadID to
+ // display that information to the user.
+ // Normal threads will return the same thing as GetIndexID();
+ virtual uint32_t GetExtendedBacktraceOriginatingIndexID() {
+ return GetIndexID();
+ }
+
+ // The API ID is often the same as the Thread::GetID(), but not in all cases.
+ // Thread::GetID() is the user visible thread ID that clients would want to
+ // see. The API thread ID is the thread ID that is used when sending data
+ // to/from the debugging protocol.
+ virtual lldb::user_id_t GetProtocolID() const { return GetID(); }
+
+ // lldb::ExecutionContextScope pure virtual functions
+ lldb::TargetSP CalculateTarget() override;
+
+ lldb::ProcessSP CalculateProcess() override;
+
+ lldb::ThreadSP CalculateThread() override;
+
+ lldb::StackFrameSP CalculateStackFrame() override;
+
+ void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
+
+ lldb::StackFrameSP
+ 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,
+ bool only_stacks = false);
+
+ size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame,
+ uint32_t num_frames, bool show_frame_info,
+ uint32_t num_frames_with_source);
+
+ // We need a way to verify that even though we have a thread in a shared
+ // pointer that the object itself is still valid. Currently this won't be the
+ // case if DestroyThread() was called. DestroyThread is called when a thread
+ // has been removed from the Process' thread list.
+ bool IsValid() const { return !m_destroy_called; }
+
+ // Sets and returns a valid stop info based on the process stop ID and the
+ // current thread plan. If the thread stop ID does not match the process'
+ // stop ID, the private stop reason is not set and an invalid StopInfoSP may
+ // be returned.
+ //
+ // NOTE: This function must be called before the current thread plan is
+ // moved to the completed plan stack (in Thread::ShouldStop()).
+ //
+ // NOTE: If subclasses override this function, ensure they do not overwrite
+ // the m_actual_stop_info if it is valid. The stop info may be a
+ // "checkpointed and restored" stop info, so if it is still around it is
+ // right even if you have not calculated this yourself, or if it disagrees
+ // with what you might have calculated.
+ virtual lldb::StopInfoSP GetPrivateStopInfo();
+
+ // Ask the thread subclass to set its stop info.
+ //
+ // Thread subclasses should call Thread::SetStopInfo(...) with the reason the
+ // thread stopped.
+ //
+ // \return
+ // True if Thread::SetStopInfo(...) was called, false otherwise.
+ virtual bool CalculateStopInfo() = 0;
+
+ // Gets the temporary resume state for a thread.
+ //
+ // This value gets set in each thread by complex debugger logic in
+ // Thread::ShouldResume() and an appropriate thread resume state will get set
+ // in each thread every time the process is resumed prior to calling
+ // Process::DoResume(). The lldb_private::Process subclass should adhere to
+ // the thread resume state request which will be one of:
+ //
+ // eStateRunning - thread will resume when process is resumed
+ // eStateStepping - thread should step 1 instruction and stop when process
+ // is resumed
+ // eStateSuspended - thread should not execute any instructions when
+ // process is resumed
+ lldb::StateType GetTemporaryResumeState() const {
+ return m_temporary_resume_state;
+ }
+
+ void SetStopInfo(const lldb::StopInfoSP &stop_info_sp);
+
+ void ResetStopInfo();
+
+ void SetShouldReportStop(Vote vote);
+
+ /// Sets the extended backtrace token for this thread
+ ///
+ /// Some Thread subclasses may maintain a token to help with providing
+ /// an extended backtrace. The SystemRuntime plugin will set/request this.
+ ///
+ /// \param [in] token
+ virtual void SetExtendedBacktraceToken(uint64_t token) {}
+
+ /// Gets the extended backtrace token for this thread
+ ///
+ /// Some Thread subclasses may maintain a token to help with providing
+ /// an extended backtrace. The SystemRuntime plugin will set/request this.
+ ///
+ /// \return
+ /// The token needed by the SystemRuntime to create an extended backtrace.
+ /// LLDB_INVALID_ADDRESS is returned if no token is available.
+ virtual uint64_t GetExtendedBacktraceToken() { return LLDB_INVALID_ADDRESS; }
+
+ lldb::ValueObjectSP GetCurrentException();
+
+ lldb::ThreadSP GetCurrentExceptionBacktrace();
+
+protected:
+ friend class ThreadPlan;
+ friend class ThreadList;
+ friend class ThreadEventData;
+ friend class StackFrameList;
+ friend class StackFrame;
+ friend class OperatingSystem;
+
+ // This is necessary to make sure thread assets get destroyed while the
+ // thread is still in good shape to call virtual thread methods. This must
+ // be called by classes that derive from Thread in their destructor.
+ virtual void DestroyThread();
+
+ void PushPlan(lldb::ThreadPlanSP &plan_sp);
+
+ void PopPlan();
+
+ void DiscardPlan();
+
+ ThreadPlan *GetPreviousPlan(ThreadPlan *plan);
+
+ typedef std::vector<lldb::ThreadPlanSP> plan_stack;
+
+ virtual lldb_private::Unwind *GetUnwinder();
+
+ // Check to see whether the thread is still at the last breakpoint hit that
+ // stopped it.
+ virtual bool IsStillAtLastBreakpointHit();
+
+ // Some threads are threads that are made up by OperatingSystem plugins that
+ // are threads that exist and are context switched out into memory. The
+ // OperatingSystem plug-in need a ways to know if a thread is "real" or made
+ // up.
+ virtual bool IsOperatingSystemPluginThread() const { return false; }
+
+ // Subclasses that have a way to get an extended info dictionary for this
+ // thread should fill
+ virtual lldb_private::StructuredData::ObjectSP FetchThreadExtendedInfo() {
+ return StructuredData::ObjectSP();
+ }
+
+ lldb::StackFrameListSP GetStackFrameList();
+
+ void SetTemporaryResumeState(lldb::StateType new_state) {
+ m_temporary_resume_state = new_state;
+ }
+
+ void FunctionOptimizationWarning(lldb_private::StackFrame *frame);
+
+ // Classes that inherit from Process can see and modify these
+ lldb::ProcessWP m_process_wp; ///< The process that owns this thread.
+ lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread
+ uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is
+ // valid. Can use this so you know that
+ // the thread's m_stop_info_sp is current and you don't have to fetch it
+ // again
+ uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time
+ // the stop info was checked against
+ // the stop info override
+ const uint32_t m_index_id; ///< A unique 1 based index assigned to each thread
+ ///for easy UI/command line access.
+ lldb::RegisterContextSP m_reg_context_sp; ///< The register context for this
+ ///thread's current register state.
+ lldb::StateType m_state; ///< The state of our process.
+ mutable std::recursive_mutex
+ m_state_mutex; ///< Multithreaded protection for m_state.
+ plan_stack m_plan_stack; ///< The stack of plans this thread is executing.
+ plan_stack m_completed_plan_stack; ///< Plans that have been completed by this
+ ///stop. They get deleted when the thread
+ ///resumes.
+ plan_stack m_discarded_plan_stack; ///< Plans that have been discarded by this
+ ///stop. They get deleted when the thread
+ ///resumes.
+ mutable std::recursive_mutex
+ m_frame_mutex; ///< Multithreaded protection for m_state.
+ lldb::StackFrameListSP m_curr_frames_sp; ///< The stack frames that get lazily
+ ///populated after a thread stops.
+ lldb::StackFrameListSP m_prev_frames_sp; ///< The previous stack frames from
+ ///the last time this thread stopped.
+ int m_resume_signal; ///< The signal that should be used when continuing this
+ ///thread.
+ lldb::StateType m_resume_state; ///< This state is used to force a thread to
+ ///be suspended from outside the ThreadPlan
+ ///logic.
+ lldb::StateType m_temporary_resume_state; ///< This state records what the
+ ///thread was told to do by the
+ ///thread plan logic for the current
+ ///resume.
+ /// It gets set in Thread::ShouldResume.
+ std::unique_ptr<lldb_private::Unwind> m_unwinder_up;
+ bool m_destroy_called; // This is used internally to make sure derived Thread
+ // classes call DestroyThread.
+ LazyBool m_override_should_notify;
+
+private:
+ bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info
+ // for this thread?
+ StructuredData::ObjectSP m_extended_info; // The extended info for this thread
+
+private:
+ bool PlanIsBasePlan(ThreadPlan *plan_ptr);
+
+ void BroadcastSelectedFrameChange(StackID &new_frame_id);
+
+ DISALLOW_COPY_AND_ASSIGN(Thread);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Thread_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadCollection.h b/linux-x64/clang/include/lldb/Target/ThreadCollection.h
new file mode 100644
index 0000000..29ea827
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadCollection.h
@@ -0,0 +1,59 @@
+//===-- ThreadCollection.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadCollection_h_
+#define liblldb_ThreadCollection_h_
+
+#include <mutex>
+#include <vector>
+
+#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class ThreadCollection {
+public:
+ typedef std::vector<lldb::ThreadSP> collection;
+ typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter,
+ std::recursive_mutex>
+ ThreadIterable;
+
+ ThreadCollection();
+
+ ThreadCollection(collection threads);
+
+ virtual ~ThreadCollection() {}
+
+ uint32_t GetSize();
+
+ void AddThread(const lldb::ThreadSP &thread_sp);
+
+ void AddThreadSortedByIndexID(const lldb::ThreadSP &thread_sp);
+
+ void InsertThread(const lldb::ThreadSP &thread_sp, uint32_t idx);
+
+ // Note that "idx" is not the same as the "thread_index". It is a zero based
+ // index to accessing the current threads, whereas "thread_index" is a unique
+ // index assigned
+ lldb::ThreadSP GetThreadAtIndex(uint32_t idx);
+
+ virtual ThreadIterable Threads() {
+ return ThreadIterable(m_threads, GetMutex());
+ }
+
+ virtual std::recursive_mutex &GetMutex() const { return m_mutex; }
+
+protected:
+ collection m_threads;
+ mutable std::recursive_mutex m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadCollection_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadList.h b/linux-x64/clang/include/lldb/Target/ThreadList.h
new file mode 100644
index 0000000..64ddf5a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadList.h
@@ -0,0 +1,159 @@
+//===-- ThreadList.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadList_h_
+#define liblldb_ThreadList_h_
+
+#include <mutex>
+#include <vector>
+
+#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 {
+
+// This is a thread list with lots of functionality for use only by the process
+// for which this is the thread list. A generic container class with iterator
+// functionality is ThreadCollection.
+class ThreadList : public ThreadCollection {
+ friend class Process;
+
+public:
+ ThreadList(Process *process);
+
+ ThreadList(const ThreadList &rhs);
+
+ ~ThreadList() override;
+
+ const ThreadList &operator=(const ThreadList &rhs);
+
+ uint32_t GetSize(bool can_update = true);
+
+ // Return the selected thread if there is one. Otherwise, return the thread
+ // selected at index 0.
+ lldb::ThreadSP GetSelectedThread();
+
+ // Manage the thread to use for running expressions. This is usually the
+ // Selected thread, but sometimes (e.g. when evaluating breakpoint conditions
+ // & stop hooks) it isn't.
+ class ExpressionExecutionThreadPusher {
+ public:
+ ExpressionExecutionThreadPusher(ThreadList &thread_list, lldb::tid_t tid)
+ : m_thread_list(&thread_list), m_tid(tid) {
+ m_thread_list->PushExpressionExecutionThread(m_tid);
+ }
+
+ ExpressionExecutionThreadPusher(lldb::ThreadSP thread_sp);
+
+ ~ExpressionExecutionThreadPusher() {
+ if (m_thread_list && m_tid != LLDB_INVALID_THREAD_ID)
+ m_thread_list->PopExpressionExecutionThread(m_tid);
+ }
+
+ private:
+ ThreadList *m_thread_list;
+ lldb::tid_t m_tid;
+ };
+
+ lldb::ThreadSP GetExpressionExecutionThread();
+
+protected:
+ void PushExpressionExecutionThread(lldb::tid_t tid);
+
+ void PopExpressionExecutionThread(lldb::tid_t tid);
+
+public:
+ bool SetSelectedThreadByID(lldb::tid_t tid, bool notify = false);
+
+ bool SetSelectedThreadByIndexID(uint32_t index_id, bool notify = false);
+
+ void Clear();
+
+ void Flush();
+
+ void Destroy();
+
+ // Note that "idx" is not the same as the "thread_index". It is a zero based
+ // index to accessing the current threads, whereas "thread_index" is a unique
+ // index assigned
+ lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update = true);
+
+ lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update = true);
+
+ lldb::ThreadSP FindThreadByProtocolID(lldb::tid_t tid,
+ bool can_update = true);
+
+ lldb::ThreadSP RemoveThreadByID(lldb::tid_t tid, bool can_update = true);
+
+ lldb::ThreadSP RemoveThreadByProtocolID(lldb::tid_t tid,
+ bool can_update = true);
+
+ lldb::ThreadSP FindThreadByIndexID(uint32_t index_id, bool can_update = true);
+
+ lldb::ThreadSP GetThreadSPForThreadPtr(Thread *thread_ptr);
+
+ lldb::ThreadSP GetBackingThread(const lldb::ThreadSP &real_thread);
+
+ bool ShouldStop(Event *event_ptr);
+
+ Vote ShouldReportStop(Event *event_ptr);
+
+ Vote ShouldReportRun(Event *event_ptr);
+
+ void RefreshStateAfterStop();
+
+ /// The thread list asks tells all the threads it is about to resume.
+ /// If a thread can "resume" without having to resume the target, it
+ /// will return false for WillResume, and then the process will not be
+ /// restarted.
+ ///
+ /// \return
+ /// \b true instructs the process to resume normally,
+ /// \b false means start & stopped events will be generated, but
+ /// the process will not actually run. The thread must then return
+ /// the correct StopInfo when asked.
+ ///
+ bool WillResume();
+
+ void DidResume();
+
+ void DidStop();
+
+ void DiscardThreadPlans();
+
+ uint32_t GetStopID() const;
+
+ void SetStopID(uint32_t stop_id);
+
+ std::recursive_mutex &GetMutex() const override;
+
+ void Update(ThreadList &rhs);
+
+protected:
+ void SetShouldReportStop(Vote vote);
+
+ void NotifySelectedThreadChanged(lldb::tid_t tid);
+
+ // Classes that inherit from Process can see and modify these
+ Process *m_process; ///< The process that manages this thread list.
+ uint32_t
+ m_stop_id; ///< The process stop ID that this thread list is valid for.
+ lldb::tid_t
+ m_selected_tid; ///< For targets that need the notion of a current thread.
+ std::vector<lldb::tid_t> m_expression_tid_stack;
+
+private:
+ ThreadList() = delete;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadList_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlan.h b/linux-x64/clang/include/lldb/Target/ThreadPlan.h
new file mode 100644
index 0000000..ff87ed2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlan.h
@@ -0,0 +1,649 @@
+//===-- ThreadPlan.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlan_h_
+#define liblldb_ThreadPlan_h_
+
+#include <mutex>
+#include <string>
+
+#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 {
+
+// ThreadPlan:
+// This is the pure virtual base class for thread plans.
+//
+// The thread plans provide the "atoms" of behavior that
+// all the logical process control, either directly from commands or through
+// more complex composite plans will rely on.
+//
+// Plan Stack:
+//
+// 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 top of the plan stack,
+// though in some cases
+// 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
+// of the running process.
+//
+//
+// Creating Plans:
+//
+// The thread plan is generally created and added to the plan stack through the
+// QueueThreadPlanFor... API
+// in lldb::Thread. Those API's will return the plan that performs the named
+// operation in a manner
+// appropriate for the current process. The plans in lldb/source/Target are
+// generic
+// implementations, but a Process plugin can override them.
+//
+// ValidatePlan is then called. If it returns false, the plan is unshipped.
+// This is a little
+// convenience which keeps us from having to error out of the constructor.
+//
+// Then the plan is added to the plan stack. When the plan is added to the
+// plan stack its DidPush
+// will get called. This is useful if a plan wants to push any additional
+// plans as it is constructed,
+// since you need to make sure you're already on the stack before you push
+// additional plans.
+//
+// Completed Plans:
+//
+// When the target process stops the plans are queried, among other things, for
+// whether their job is done.
+// If it is they are moved from the plan stack to the Completed Plan stack in
+// reverse order from their position
+// on the plan stack (since multiple plans may be done at a given stop.) This
+// is used primarily so that
+// the lldb::Thread::StopInfo for the thread can be set properly. If one plan
+// pushes another to achieve part of
+// its job, but it doesn't want that sub-plan to be the one that sets the
+// StopInfo, then call SetPrivate on the
+// sub-plan when you create it, and the Thread will pass over that plan in
+// reporting the reason for the stop.
+//
+// Discarded plans:
+//
+// Your plan may also get discarded, i.e. moved from the plan stack to the
+// "discarded plan stack". This can
+// happen, for instance, if the plan is calling a function and the function
+// call crashes and you want
+// to unwind the attempt to call. So don't assume that your plan will always
+// successfully stop. Which leads to:
+//
+// Cleaning up after your plans:
+//
+// When the plan is moved from the plan stack its WillPop method is always
+// called, no matter why. Once it is
+// moved off the plan stack it is done, and won't get a chance to run again.
+// So you should
+// undo anything that affects target state in this method. But be sure to
+// leave the plan able to correctly
+// fill the StopInfo, however.
+// N.B. Don't wait to do clean up target state till the destructor, since that
+// will usually get called when
+// the target resumes, and you want to leave the target state correct for new
+// 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:
+//
+// Resuming:
+//
+// When the target process is about to be restarted, the plan's WillResume
+// method is called,
+// giving the plan a chance to prepare for the run. If WillResume returns
+// false, then the
+// process is not restarted. Be sure to set an appropriate error value in the
+// Process if
+// you have to do this. Note, ThreadPlans actually implement DoWillResume,
+// WillResume wraps that call.
+//
+// Next the "StopOthers" method of all the threads are polled, and if one
+// thread's Current plan
+// returns "true" then only that thread gets to run. If more than one returns
+// "true" the threads that want to run solo
+// get run one by one round robin fashion. Otherwise all are let to run.
+//
+// Note, the way StopOthers is implemented, the base class implementation just
+// asks the previous plan. So if your plan
+// has no opinion about whether it should run stopping others or not, just
+// don't implement StopOthers, and the parent
+// will be asked.
+//
+// Finally, for each thread that is running, it run state is set to the return
+// of RunState from the
+// thread's Current plan.
+//
+// Responding to a stop:
+//
+// When the target process stops, the plan is called in the following stages:
+//
+// First the thread asks the Current Plan if it can handle this stop by calling
+// PlanExplainsStop.
+// 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 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
+// recoverable, then the plan that
+// understands it can just do what it needs to set up to restart, and then
+// continue.
+// Otherwise, the plan that understood the stop should call DiscardPlanStack to
+// clean up the stack below it.
+// Note, plans actually implement DoPlanExplainsStop, the result is cached in
+// PlanExplainsStop so the DoPlanExplainsStop
+// itself will only get called once per stop.
+//
+// Master plans:
+//
+// In the normal case, when we decide to stop, we will collapse the plan stack
+// up to the point of the plan that understood
+// the stop reason. However, if a plan wishes to stay on the stack after an
+// 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 false to OkayToDiscard, and it and all its dependent
+// plans will be preserved when
+// we resume execution.
+//
+// The other effect of being a master plan is that when the Master plan is done
+// , if it has set "OkayToDiscard" to false,
+// then it will be popped & execution will stop and return to the user.
+// Remember that if OkayToDiscard is false, the
+// plan will be popped and control will be given to the next plan above it on
+// the stack So setting OkayToDiscard to
+// false means the user will regain control when the MasterPlan is completed.
+//
+// Between these two controls this allows things like: a MasterPlan/DontDiscard
+// Step Over to hit a breakpoint, stop and
+// return control to the user, but then when the user continues, the step out
+// succeeds.
+// Even more tricky, when the breakpoint is hit, the user can continue to step
+// in/step over/etc, and finally when they
+// continue, they will finish up the Step Over.
+//
+// FIXME: MasterPlan & OkayToDiscard aren't really orthogonal. MasterPlan
+// designation means that this plan controls
+// it's fate and the fate of plans below it. OkayToDiscard tells whether the
+// MasterPlan wants to stay on the stack. I
+// originally thought "MasterPlan-ness" would need to be a fixed characteristic
+// of a ThreadPlan, in which case you needed
+// the extra control. But that doesn't seem to be true. So we should be able
+// to convert to only MasterPlan status to mean
+// the current "MasterPlan/DontDiscard". Then no plans would be MasterPlans by
+// default, and you would set the ones you
+// wanted to be "user level" in this way.
+//
+//
+// Actually Stopping:
+//
+// 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 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",
+// it is asked if it is done, and if yes popped, and so on till we reach a plan
+// that is not done.
+//
+// Since you often know in the ShouldStop method whether your plan is complete,
+// as a convenience you can call
+// SetPlanComplete and the ThreadPlan implementation of MischiefManaged will
+// return "true", without your having
+// to redo the calculation when your sub-classes MischiefManaged is called. If
+// you call SetPlanComplete, you can
+// later use IsPlanComplete to determine whether the plan is complete. This is
+// only a convenience for sub-classes,
+// the logic in lldb::Thread will only call MischiefManaged.
+//
+// One slightly tricky point is you have to be careful using SetPlanComplete in
+// PlanExplainsStop because you
+// are not guaranteed that PlanExplainsStop for a plan will get called before
+// ShouldStop gets called. If your sub-plan
+// explained the stop and then popped itself, only your ShouldStop will get
+// called.
+//
+// If ShouldStop for any thread returns "true", then the WillStop method of the
+// Current plan of
+// all threads will be called, the stop event is placed on the Process's public
+// broadcaster, and
+// control returns to the upper layers of the debugger.
+//
+// Reporting the stop:
+//
+// 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 can be
+// suppressed, and instead a StopInfoThreadPlan
+// 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,
+// the real stop reason will be used instead. One exapmle of this is the
+// "StepRangeStepIn" thread plan. If it stops
+// because of a crash or breakpoint hit, it wants to unship itself, because it
+// isn't so useful to have step in keep going
+// after a breakpoint hit. But it can't be the reason for the stop or no-one
+// would see that they had hit a breakpoint.
+//
+// Cleaning up the plan stack:
+//
+// One of the complications of MasterPlans is that you may get past the limits
+// of a plan without triggering it to clean
+// itself up. For instance, if you are doing a MasterPlan StepOver, and hit a
+// breakpoint in a called function, then
+// step over enough times to step out of the initial StepOver range, each of
+// the step overs will explain the stop &
+// take themselves off the stack, but control would never be returned to the
+// original StepOver. Eventually, the user
+// will continue, and when that continue stops, the old stale StepOver plan
+// that was left on the stack will get woken
+// up and notice it is done. But that can leave junk on the stack for a while.
+// To avoid that, the plans implement a
+// "IsPlanStale" method, that can check whether it is relevant anymore. On
+// stop, after the regular plan negotiation,
+// the remaining plan stack is consulted and if any plan says it is stale, it
+// and the plans below it are discarded from
+// the stack.
+//
+// Automatically Resuming:
+//
+// If ShouldStop for all threads returns "false", then the target process will
+// resume. This then cycles back to
+// Resuming above.
+//
+// Reporting eStateStopped events when the target is restarted:
+//
+// If a plan decides to auto-continue the target by returning "false" from
+// ShouldStop, then it will be asked
+// whether the Stopped event should still be reported. For instance, if you
+// hit a breakpoint that is a User set
+// breakpoint, but the breakpoint callback said to continue the target process,
+// you might still want to inform
+// the upper layers of lldb that the stop had happened.
+// The way this works is every thread gets to vote on whether to report the
+// stop. If all votes are eVoteNoOpinion,
+// then the thread list will decide what to do (at present it will pretty much
+// always suppress these stopped events.)
+// If there is an eVoteYes, then the event will be reported regardless of the
+// other votes. If there is an eVoteNo
+// and no eVoteYes's, then the event won't be reported.
+//
+// One other little detail here, sometimes a plan will push another plan onto
+// the plan stack to do some part of
+// the first plan's job, and it would be convenient to tell that plan how it
+// should respond to ShouldReportStop.
+// You can do that by setting the stop_vote in the child plan when you create
+// it.
+//
+// Suppressing the initial eStateRunning event:
+//
+// The private process running thread will take care of ensuring that only one
+// "eStateRunning" event will be
+// delivered to the public Process broadcaster per public eStateStopped event.
+// However there are some cases
+// where the public state of this process is eStateStopped, but a thread plan
+// needs to restart the target, but
+// doesn't want the running event to be publicly broadcast. The obvious
+// example of this is running functions
+// by hand as part of expression evaluation. To suppress the running event
+// return eVoteNo from ShouldReportStop,
+// to force a running event to be reported return eVoteYes, in general though
+// you should return eVoteNoOpinion
+// which will allow the ThreadList to figure out the right thing to do.
+// The run_vote argument to the constructor works like stop_vote, and is a way
+// for a plan to instruct a sub-plan
+// on how to respond to ShouldReportStop.
+//
+
+class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
+ public UserID {
+public:
+ enum ThreadScope { eAllThreads, eSomeThreads, eThisThread };
+
+ // We use these enums so that we can cast a base thread plan to it's real
+ // type without having to resort to dynamic casting.
+ enum ThreadPlanKind {
+ eKindGeneric,
+ eKindNull,
+ eKindBase,
+ eKindCallFunction,
+ eKindPython,
+ eKindStepInstruction,
+ eKindStepOut,
+ eKindStepOverBreakpoint,
+ eKindStepOverRange,
+ eKindStepInRange,
+ eKindRunToAddress,
+ eKindStepThrough,
+ eKindStepUntil,
+ eKindTestCondition
+
+ };
+
+ // Constructors and Destructors
+ ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread,
+ Vote stop_vote, Vote run_vote);
+
+ virtual ~ThreadPlan();
+
+ /// Returns the name of this thread plan.
+ ///
+ /// \return
+ /// A const char * pointer to the thread plan's name.
+ const char *GetName() const { return m_name.c_str(); }
+
+ /// Returns the Thread that is using this thread plan.
+ ///
+ /// \return
+ /// A pointer to the thread plan's owning thread.
+ Thread &GetThread() { return m_thread; }
+
+ const Thread &GetThread() const { return m_thread; }
+
+ Target &GetTarget() { return m_thread.GetProcess()->GetTarget(); }
+
+ const Target &GetTarget() const { return m_thread.GetProcess()->GetTarget(); }
+
+ /// Print a description of this thread to the stream \a s.
+ /// \a thread.
+ ///
+ /// \param[in] s
+ /// The stream to which to print the description.
+ ///
+ /// \param[in] level
+ /// The level of description desired. Note that eDescriptionLevelBrief
+ /// will be used in the stop message printed when the plan is complete.
+ virtual void GetDescription(Stream *s, lldb::DescriptionLevel level) = 0;
+
+ /// Returns whether this plan could be successfully created.
+ ///
+ /// \param[in] error
+ /// A stream to which to print some reason why the plan could not be
+ /// created.
+ /// Can be NULL.
+ ///
+ /// \return
+ /// \b true if the plan should be queued, \b false otherwise.
+ virtual bool ValidatePlan(Stream *error) = 0;
+
+ bool TracerExplainsStop() {
+ if (!m_tracer_sp)
+ return false;
+ else
+ return m_tracer_sp->TracerExplainsStop();
+ }
+
+ lldb::StateType RunState();
+
+ bool PlanExplainsStop(Event *event_ptr);
+
+ virtual bool ShouldStop(Event *event_ptr) = 0;
+
+ virtual bool ShouldAutoContinue(Event *event_ptr) { return false; }
+
+ // Whether a "stop class" event should be reported to the "outside world".
+ // In general if a thread plan is active, events should not be reported.
+
+ virtual Vote ShouldReportStop(Event *event_ptr);
+
+ virtual Vote ShouldReportRun(Event *event_ptr);
+
+ virtual void SetStopOthers(bool new_value);
+
+ virtual bool StopOthers();
+
+ // This is the wrapper for DoWillResume that does generic ThreadPlan logic,
+ // then calls DoWillResume.
+ bool WillResume(lldb::StateType resume_state, bool current_plan);
+
+ virtual bool WillStop() = 0;
+
+ bool IsMasterPlan() { return m_is_master_plan; }
+
+ bool SetIsMasterPlan(bool value) {
+ bool old_value = m_is_master_plan;
+ m_is_master_plan = value;
+ return old_value;
+ }
+
+ virtual bool OkayToDiscard();
+
+ void SetOkayToDiscard(bool value) { m_okay_to_discard = value; }
+
+ // The base class MischiefManaged does some cleanup - so you have to call it
+ // in your MischiefManaged derived class.
+ virtual bool MischiefManaged();
+
+ virtual void ThreadDestroyed() {
+ // Any cleanup that a plan might want to do in case the thread goes away in
+ // the middle of the plan being queued on a thread can be done here.
+ }
+
+ bool GetPrivate() { return m_plan_private; }
+
+ void SetPrivate(bool input) { m_plan_private = input; }
+
+ virtual void DidPush();
+
+ virtual void WillPop();
+
+ // This pushes a plan onto the plan stack of the current plan's thread.
+ void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) {
+ m_thread.PushPlan(thread_plan_sp);
+ }
+
+ ThreadPlanKind GetKind() const { return m_kind; }
+
+ bool IsPlanComplete();
+
+ void SetPlanComplete(bool success = true);
+
+ virtual bool IsPlanStale() { return false; }
+
+ bool PlanSucceeded() { return m_plan_succeeded; }
+
+ virtual bool IsBasePlan() { return false; }
+
+ lldb::ThreadPlanTracerSP &GetThreadPlanTracer() { return m_tracer_sp; }
+
+ void SetThreadPlanTracer(lldb::ThreadPlanTracerSP new_tracer_sp) {
+ m_tracer_sp = new_tracer_sp;
+ }
+
+ void DoTraceLog() {
+ if (m_tracer_sp && m_tracer_sp->TracingEnabled())
+ m_tracer_sp->Log();
+ }
+
+ // Some thread plans hide away the actual stop info which caused any
+ // particular stop. For instance the ThreadPlanCallFunction restores the
+ // original stop reason so that stopping and calling a few functions won't
+ // lose the history of the run. This call can be implemented to get you back
+ // to the real stop info.
+ virtual lldb::StopInfoSP GetRealStopInfo() { return m_thread.GetStopInfo(); }
+
+ // If the completion of the thread plan stepped out of a function, the return
+ // value of the function might have been captured by the thread plan
+ // (currently only ThreadPlanStepOut does this.) If so, the ReturnValueObject
+ // can be retrieved from here.
+
+ virtual lldb::ValueObjectSP GetReturnValueObject() {
+ return lldb::ValueObjectSP();
+ }
+
+ // If the thread plan managing the evaluation of a user expression lives
+ // longer than the command that instigated the expression (generally because
+ // the expression evaluation hit a breakpoint, and the user regained control
+ // at that point) a subsequent process control command step/continue/etc.
+ // might complete the expression evaluations. If so, the result of the
+ // expression evaluation will show up here.
+
+ virtual lldb::ExpressionVariableSP GetExpressionVariable() {
+ return lldb::ExpressionVariableSP();
+ }
+
+ // If a thread plan stores the state before it was run, then you might want
+ // to restore the state when it is done. This will do that job. This is
+ // mostly useful for artificial plans like CallFunction plans.
+
+ virtual bool RestoreThreadState() {
+ // Nothing to do in general.
+ return true;
+ }
+
+ virtual bool IsVirtualStep() { return false; }
+
+ virtual bool SetIterationCount(size_t count) {
+ if (m_takes_iteration_count) {
+ // Don't tell me to do something 0 times...
+ if (count == 0)
+ return false;
+ m_iteration_count = count;
+ }
+ return m_takes_iteration_count;
+ }
+
+ virtual size_t GetIterationCount() {
+ if (!m_takes_iteration_count)
+ return 0;
+ else
+ return m_iteration_count;
+ }
+
+protected:
+ // Classes that inherit from ThreadPlan can see and modify these
+
+ virtual bool DoWillResume(lldb::StateType resume_state, bool current_plan) {
+ return true;
+ }
+
+ virtual bool DoPlanExplainsStop(Event *event_ptr) = 0;
+
+ // This gets the previous plan to the current plan (for forwarding requests).
+ // This is mostly a formal requirement, it allows us to make the Thread's
+ // GetPreviousPlan protected, but only friend ThreadPlan to thread.
+
+ ThreadPlan *GetPreviousPlan() { return m_thread.GetPreviousPlan(this); }
+
+ // This forwards the private Thread::GetPrivateStopInfo which is generally
+ // what ThreadPlan's need to know.
+
+ lldb::StopInfoSP GetPrivateStopInfo() {
+ return m_thread.GetPrivateStopInfo();
+ }
+
+ void SetStopInfo(lldb::StopInfoSP stop_reason_sp) {
+ m_thread.SetStopInfo(stop_reason_sp);
+ }
+
+ void CachePlanExplainsStop(bool does_explain) {
+ m_cached_plan_explains_stop = does_explain ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ LazyBool GetCachedPlanExplainsStop() const {
+ return m_cached_plan_explains_stop;
+ }
+
+ virtual lldb::StateType GetPlanRunState() = 0;
+
+ bool IsUsuallyUnexplainedStopReason(lldb::StopReason);
+
+ Status m_status;
+ Thread &m_thread;
+ Vote m_stop_vote;
+ Vote m_run_vote;
+ bool m_takes_iteration_count;
+ bool m_could_not_resolve_hw_bp;
+ int32_t m_iteration_count = 1;
+
+private:
+ // For ThreadPlan only
+ static lldb::user_id_t GetNextID();
+
+ ThreadPlanKind m_kind;
+ std::string m_name;
+ std::recursive_mutex m_plan_complete_mutex;
+ LazyBool m_cached_plan_explains_stop;
+ bool m_plan_complete;
+ bool m_plan_private;
+ bool m_okay_to_discard;
+ bool m_is_master_plan;
+ bool m_plan_succeeded;
+
+ lldb::ThreadPlanTracerSP m_tracer_sp;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlan);
+};
+
+// ThreadPlanNull:
+// Threads are assumed to always have at least one plan on the plan stack. This
+// is put on the plan stack when a thread is destroyed so that if you
+// accidentally access a thread after it is destroyed you won't crash. But
+// asking questions of the ThreadPlanNull is definitely an error.
+
+class ThreadPlanNull : public ThreadPlan {
+public:
+ ThreadPlanNull(Thread &thread);
+ ~ThreadPlanNull() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ValidatePlan(Stream *error) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ bool MischiefManaged() override;
+
+ bool WillStop() override;
+
+ bool IsBasePlan() override { return true; }
+
+ bool OkayToDiscard() override { return false; }
+
+ const Status &GetStatus() { return m_status; }
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ lldb::StateType GetPlanRunState() override;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanNull);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlan_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h b/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h
new file mode 100644
index 0000000..bc92a06
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h
@@ -0,0 +1,55 @@
+//===-- ThreadPlanBase.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanFundamental_h_
+#define liblldb_ThreadPlanFundamental_h_
+
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+
+namespace lldb_private {
+
+// Base thread plans:
+// This is the generic version of the bottom most plan on the plan stack. It
+// should
+// be able to handle generic breakpoint hitting, and signals and exceptions.
+
+class ThreadPlanBase : public ThreadPlan {
+ friend class Process; // RunThreadPlan manages "stopper" base plans.
+public:
+ ~ThreadPlanBase() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+
+ bool OkayToDiscard() override { return false; }
+
+ bool IsBasePlan() override { return true; }
+
+protected:
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ ThreadPlanBase(Thread &thread);
+
+private:
+ friend lldb::ThreadPlanSP
+ Thread::QueueFundamentalPlan(bool abort_other_plans);
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanBase);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanFundamental_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h
new file mode 100644
index 0000000..685160a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h
@@ -0,0 +1,154 @@
+//===-- ThreadPlanCallFunction.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanCallFunction_h_
+#define liblldb_ThreadPlanCallFunction_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lldb_private {
+
+class ThreadPlanCallFunction : public ThreadPlan {
+ // Create a thread plan to call a function at the address passed in the
+ // "function" argument. If you plan to call GetReturnValueObject, then pass
+ // in the return type, otherwise just pass in an invalid CompilerType.
+public:
+ ThreadPlanCallFunction(Thread &thread, const Address &function,
+ const CompilerType &return_type,
+ llvm::ArrayRef<lldb::addr_t> args,
+ const EvaluateExpressionOptions &options);
+
+ ThreadPlanCallFunction(Thread &thread, const Address &function,
+ const EvaluateExpressionOptions &options);
+
+ ~ThreadPlanCallFunction() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ValidatePlan(Stream *error) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ Vote ShouldReportStop(Event *event_ptr) override;
+
+ bool StopOthers() override;
+
+ lldb::StateType GetPlanRunState() override;
+
+ void DidPush() override;
+
+ bool WillStop() override;
+
+ bool MischiefManaged() override;
+
+ // To get the return value from a function call you must create a
+ // lldb::ValueSP that contains a valid clang type in its context and call
+ // RequestReturnValue. The ValueSP will be stored and when the function is
+ // done executing, the object will check if there is a requested return
+ // value. If there is, the return value will be retrieved using the
+ // ABI::GetReturnValue() for the ABI in the process. Then after the thread
+ // plan is complete, you can call "GetReturnValue()" to retrieve the value
+ // that was extracted.
+
+ lldb::ValueObjectSP GetReturnValueObject() override {
+ return m_return_valobj_sp;
+ }
+
+ // Return the stack pointer that the function received on entry. Any stack
+ // address below this should be considered invalid after the function has
+ // been cleaned up.
+ lldb::addr_t GetFunctionStackPointer() { return m_function_sp; }
+
+ // Classes that derive from FunctionCaller, and implement their own WillPop
+ // methods should call this so that the thread state gets restored if the
+ // plan gets discarded.
+ void WillPop() override;
+
+ // If the thread plan stops mid-course, this will be the stop reason that
+ // interrupted us. Once DoTakedown is called, this will be the real stop
+ // reason at the end of the function call. If it hasn't been set for one or
+ // the other of these reasons, we'll return the PrivateStopReason. This is
+ // needed because we want the CallFunction thread plans not to show up as the
+ // stop reason. But if something bad goes wrong, it is nice to be able to
+ // tell the user what really happened.
+
+ lldb::StopInfoSP GetRealStopInfo() override {
+ if (m_real_stop_info_sp)
+ return m_real_stop_info_sp;
+ else
+ return GetPrivateStopInfo();
+ }
+
+ lldb::addr_t GetStopAddress() { return m_stop_address; }
+
+ bool RestoreThreadState() override;
+
+ void ThreadDestroyed() override { m_takedown_done = true; }
+
+ void SetStopOthers(bool new_value) override;
+
+protected:
+ void ReportRegisterState(const char *message);
+
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ virtual void SetReturnValue();
+
+ bool ConstructorSetup(Thread &thread, ABI *&abi,
+ lldb::addr_t &start_load_addr,
+ lldb::addr_t &function_load_addr);
+
+ virtual void DoTakedown(bool success);
+
+ void SetBreakpoints();
+
+ void ClearBreakpoints();
+
+ bool BreakpointsExplainStop();
+
+ bool m_valid;
+ bool m_stop_other_threads;
+ bool m_unwind_on_error;
+ bool m_ignore_breakpoints;
+ bool m_debug_execution;
+ bool m_trap_exceptions;
+ Address m_function_addr;
+ Address m_start_addr;
+ lldb::addr_t m_function_sp;
+ lldb::ThreadPlanSP m_subplan_sp;
+ LanguageRuntime *m_cxx_language_runtime;
+ LanguageRuntime *m_objc_language_runtime;
+ Thread::ThreadStateCheckpoint m_stored_thread_state;
+ lldb::StopInfoSP
+ m_real_stop_info_sp; // In general we want to hide call function
+ // thread plans, but for reporting purposes, it's
+ // nice to know the real stop reason. This gets set
+ // in DoTakedown.
+ StreamString m_constructor_errors;
+ lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer,
+ // use the ABI to extract values when
+ // complete
+ bool m_takedown_done; // We want to ensure we only do the takedown once. This
+ // ensures that.
+ bool m_should_clear_objc_exception_bp;
+ bool m_should_clear_cxx_exception_bp;
+ lldb::addr_t m_stop_address; // This is the address we stopped at. Also set
+ // in DoTakedown;
+
+private:
+ CompilerType m_return_type;
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallFunction);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanCallFunction_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
new file mode 100644
index 0000000..c21e4d3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -0,0 +1,52 @@
+//===-- ThreadPlanCallFunctionUsingABI.h --------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanCallFunctionUsingABI_h_
+#define liblldb_ThreadPlanCallFunctionUsingABI_h_
+
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanCallFunction.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/IR/DerivedTypes.h"
+
+namespace lldb_private {
+
+class ThreadPlanCallFunctionUsingABI : public ThreadPlanCallFunction {
+ // Create a thread plan to call a function at the address passed in the
+ // "function" argument, this function is executed using register manipulation
+ // instead of JIT. Class derives from ThreadPlanCallFunction and differs by
+ // calling a alternative
+ // ABI interface ABI::PrepareTrivialCall() which provides more detailed
+ // information.
+public:
+ ThreadPlanCallFunctionUsingABI(Thread &thread,
+ const Address &function_address,
+ llvm::Type &function_prototype,
+ llvm::Type &return_type,
+ llvm::ArrayRef<ABI::CallArgument> args,
+ const EvaluateExpressionOptions &options);
+
+ ~ThreadPlanCallFunctionUsingABI() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+protected:
+ void SetReturnValue() override;
+
+private:
+ llvm::Type &m_return_type;
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallFunctionUsingABI);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
new file mode 100644
index 0000000..ad3ee6e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
@@ -0,0 +1,53 @@
+//===-- ThreadPlanCallOnFunctionExit.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef ThreadPlanCallOnFunctionExit_h
+#define ThreadPlanCallOnFunctionExit_h
+
+#include "lldb/Target/ThreadPlan.h"
+
+#include <functional>
+
+namespace lldb_private {
+
+// =============================================================================
+/// This thread plan calls a function object when the current function exits.
+// =============================================================================
+
+class ThreadPlanCallOnFunctionExit : public ThreadPlan {
+public:
+ /// Definition for the callback made when the currently executing thread
+ /// finishes executing its function.
+ using Callback = std::function<void()>;
+
+ ThreadPlanCallOnFunctionExit(Thread &thread, const Callback &callback);
+
+ void DidPush() override;
+
+ // ThreadPlan API
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ValidatePlan(Stream *error) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ bool WillStop() override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ lldb::StateType GetPlanRunState() override;
+
+private:
+ Callback m_callback;
+ lldb::ThreadPlanSP m_step_out_threadplan_sp;
+};
+}
+
+#endif /* ThreadPlanCallOnFunctionExit_h */
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h
new file mode 100644
index 0000000..6372155
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -0,0 +1,64 @@
+//===-- ThreadPlanCallUserExpression.h --------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanCallUserExpression_h_
+#define liblldb_ThreadPlanCallUserExpression_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Target/ThreadPlanCallFunction.h"
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lldb_private {
+
+class ThreadPlanCallUserExpression : public ThreadPlanCallFunction {
+public:
+ ThreadPlanCallUserExpression(Thread &thread, Address &function,
+ llvm::ArrayRef<lldb::addr_t> args,
+ const EvaluateExpressionOptions &options,
+ lldb::UserExpressionSP &user_expression_sp);
+
+ ~ThreadPlanCallUserExpression() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ void DidPush() override;
+
+ void WillPop() override;
+
+ lldb::StopInfoSP GetRealStopInfo() override;
+
+ bool MischiefManaged() override;
+
+ void TransferExpressionOwnership() { m_manage_materialization = true; }
+
+ lldb::ExpressionVariableSP GetExpressionVariable() override {
+ return m_result_var_sp;
+ }
+
+protected:
+ void DoTakedown(bool success) override;
+private:
+ lldb::UserExpressionSP
+ m_user_expression_sp; // This is currently just used to ensure the
+ // User expression the initiated this ThreadPlan
+ // lives as long as the thread plan does.
+ bool m_manage_materialization = false;
+ lldb::ExpressionVariableSP
+ m_result_var_sp; // If we are left to manage the materialization,
+ // then stuff the result expression variable here.
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallUserExpression);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanCallUserExpression_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h b/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h
new file mode 100644
index 0000000..3825bf6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h
@@ -0,0 +1,66 @@
+//===-- ThreadPlanPython.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlan_Python_h_
+#define liblldb_ThreadPlan_Python_h_
+
+#include <string>
+
+#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 {
+
+// ThreadPlanPython:
+//
+
+class ThreadPlanPython : public ThreadPlan {
+public:
+ ThreadPlanPython(Thread &thread, const char *class_name);
+ ~ThreadPlanPython() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ValidatePlan(Stream *error) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ bool MischiefManaged() override;
+
+ bool WillStop() override;
+
+ bool StopOthers() override;
+
+ void DidPush() override;
+
+ bool IsPlanStale() override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ lldb::StateType GetPlanRunState() override;
+
+private:
+ std::string m_class_name;
+ StructuredData::ObjectSP m_implementation_sp;
+ bool m_did_push;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlan_Python_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h b/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h
new file mode 100644
index 0000000..d82a9fa
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -0,0 +1,67 @@
+//===-- ThreadPlanRunToAddress.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanRunToAddress_h_
+#define liblldb_ThreadPlanRunToAddress_h_
+
+#include <vector>
+
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class ThreadPlanRunToAddress : public ThreadPlan {
+public:
+ ThreadPlanRunToAddress(Thread &thread, Address &address, bool stop_others);
+
+ ThreadPlanRunToAddress(Thread &thread, lldb::addr_t address,
+ bool stop_others);
+
+ ThreadPlanRunToAddress(Thread &thread,
+ const std::vector<lldb::addr_t> &addresses,
+ bool stop_others);
+
+ ~ThreadPlanRunToAddress() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ValidatePlan(Stream *error) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ bool StopOthers() override;
+
+ void SetStopOthers(bool new_value) override;
+
+ lldb::StateType GetPlanRunState() override;
+
+ bool WillStop() override;
+
+ bool MischiefManaged() override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ void SetInitialBreakpoints();
+ bool AtOurAddress();
+
+private:
+ bool m_stop_others;
+ std::vector<lldb::addr_t>
+ m_addresses; // This is the address we are going to run to.
+ // TODO: Would it be useful to have multiple addresses?
+ std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are
+ // using to stop us at m_address.
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanRunToAddress);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanRunToAddress_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h b/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h
new file mode 100644
index 0000000..dfcbbb3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -0,0 +1,138 @@
+//===-- ThreadPlanShouldStopHere.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanShouldStopHere_h_
+#define liblldb_ThreadPlanShouldStopHere_h_
+
+#include "lldb/Target/ThreadPlan.h"
+
+namespace lldb_private {
+
+// This is an interface that ThreadPlans can adopt to allow flexible
+// modifications of the behavior when a thread plan comes to a place where it
+// would ordinarily stop. If such modification makes sense for your plan,
+// inherit from this class, and when you would be about to stop (in your
+// ShouldStop method), call InvokeShouldStopHereCallback, passing in the frame
+// comparison between where the step operation started and where you arrived.
+// If it returns true, then QueueStepOutFromHere will queue the plan to execute
+// instead of stopping.
+//
+// The classic example of the use of this is ThreadPlanStepInRange not stopping
+// in frames that have no debug information.
+//
+// This class also defines a set of flags to control general aspects of this
+// "ShouldStop" behavior.
+// A class implementing this protocol needs to define a default set of flags,
+// and can provide access to
+// changing that default flag set if it wishes.
+
+class ThreadPlanShouldStopHere {
+public:
+ struct ThreadPlanShouldStopHereCallbacks {
+ ThreadPlanShouldStopHereCallbacks() {
+ should_stop_here_callback = nullptr;
+ step_from_here_callback = nullptr;
+ }
+
+ ThreadPlanShouldStopHereCallbacks(
+ ThreadPlanShouldStopHereCallback should_stop,
+ ThreadPlanStepFromHereCallback step_from_here) {
+ should_stop_here_callback = should_stop;
+ step_from_here_callback = step_from_here;
+ }
+
+ void Clear() {
+ should_stop_here_callback = nullptr;
+ step_from_here_callback = nullptr;
+ }
+
+ ThreadPlanShouldStopHereCallback should_stop_here_callback;
+ ThreadPlanStepFromHereCallback step_from_here_callback;
+ };
+
+ enum {
+ eNone = 0,
+ eAvoidInlines = (1 << 0),
+ eStepInAvoidNoDebug = (1 << 1),
+ eStepOutAvoidNoDebug = (1 << 2)
+ };
+
+ // Constructors and Destructors
+ ThreadPlanShouldStopHere(ThreadPlan *owner);
+
+ ThreadPlanShouldStopHere(ThreadPlan *owner,
+ const ThreadPlanShouldStopHereCallbacks *callbacks,
+ void *baton = nullptr);
+ virtual ~ThreadPlanShouldStopHere();
+
+ // Set the ShouldStopHere callbacks. Pass in null to clear them and have no
+ // special behavior (though you can also call ClearShouldStopHereCallbacks
+ // for that purpose. If you pass in a valid pointer, it will adopt the non-
+ // null fields, and any null fields will be set to the default values.
+
+ void
+ SetShouldStopHereCallbacks(const ThreadPlanShouldStopHereCallbacks *callbacks,
+ void *baton) {
+ if (callbacks) {
+ m_callbacks = *callbacks;
+ if (!m_callbacks.should_stop_here_callback)
+ m_callbacks.should_stop_here_callback =
+ ThreadPlanShouldStopHere::DefaultShouldStopHereCallback;
+ if (!m_callbacks.step_from_here_callback)
+ m_callbacks.step_from_here_callback =
+ ThreadPlanShouldStopHere::DefaultStepFromHereCallback;
+ } else {
+ ClearShouldStopHereCallbacks();
+ }
+ m_baton = baton;
+ }
+
+ void ClearShouldStopHereCallbacks() { m_callbacks.Clear(); }
+
+ bool InvokeShouldStopHereCallback(lldb::FrameComparison operation,
+ Status &status);
+
+ lldb::ThreadPlanSP
+ CheckShouldStopHereAndQueueStepOut(lldb::FrameComparison operation,
+ Status &status);
+
+ lldb_private::Flags &GetFlags() { return m_flags; }
+
+ const lldb_private::Flags &GetFlags() const { return m_flags; }
+
+protected:
+ static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
+ Flags &flags,
+ lldb::FrameComparison operation,
+ Status &status, void *baton);
+
+ static lldb::ThreadPlanSP
+ DefaultStepFromHereCallback(ThreadPlan *current_plan, Flags &flags,
+ lldb::FrameComparison operation, Status &status,
+ void *baton);
+
+ virtual lldb::ThreadPlanSP
+ QueueStepOutFromHerePlan(Flags &flags, lldb::FrameComparison operation,
+ Status &status);
+
+ // Implement this, and call it in the plan's constructor to set the default
+ // flags.
+ virtual void SetFlagsToDefault() = 0;
+
+ ThreadPlanShouldStopHereCallbacks m_callbacks;
+ void *m_baton;
+ ThreadPlan *m_owner;
+ lldb_private::Flags m_flags;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanShouldStopHere);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanShouldStopHere_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h
new file mode 100644
index 0000000..a120c98
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h
@@ -0,0 +1,107 @@
+//===-- ThreadPlanStepInRange.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepInRange_h_
+#define liblldb_ThreadPlanStepInRange_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanShouldStopHere.h"
+#include "lldb/Target/ThreadPlanStepRange.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepInRange : public ThreadPlanStepRange,
+ public ThreadPlanShouldStopHere {
+public:
+ ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_others,
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+
+ ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
+ const SymbolContext &addr_context,
+ const char *step_into_function_name,
+ lldb::RunMode stop_others,
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+
+ ~ThreadPlanStepInRange() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+
+ bool ShouldStop(Event *event_ptr) override;
+
+ void SetAvoidRegexp(const char *name);
+
+ void SetStepInTarget(const char *target) {
+ m_step_into_target.SetCString(target);
+ }
+
+ static void SetDefaultFlagValue(uint32_t new_value);
+
+ bool IsVirtualStep() override;
+
+protected:
+ static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
+ Flags &flags,
+ lldb::FrameComparison operation,
+ Status &status, void *baton);
+
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ void SetFlagsToDefault() override {
+ GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
+ }
+
+ void SetCallbacks() {
+ ThreadPlanShouldStopHere::ThreadPlanShouldStopHereCallbacks callbacks(
+ ThreadPlanStepInRange::DefaultShouldStopHereCallback, nullptr);
+ SetShouldStopHereCallbacks(&callbacks, nullptr);
+ }
+
+ bool FrameMatchesAvoidCriteria();
+
+private:
+ friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
+ bool abort_other_plans, const AddressRange &range,
+ const SymbolContext &addr_context, lldb::RunMode stop_others,
+ Status &status, LazyBool avoid_code_without_debug_info);
+ friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
+ bool abort_other_plans, const AddressRange &range,
+ const SymbolContext &addr_context, const char *step_in_target,
+ lldb::RunMode stop_others, Status &status,
+ LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+
+ void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
+ LazyBool step_out_avoids_code_without_debug_info);
+ // Need an appropriate marker for the current stack so we can tell step out
+ // from step in.
+
+ static uint32_t s_default_flag_values; // These are the default flag values
+ // for the ThreadPlanStepThrough.
+ lldb::ThreadPlanSP m_sub_plan_sp; // Keep track of the last plan we were
+ // running. If it fails, we should stop.
+ std::unique_ptr<RegularExpression> m_avoid_regexp_up;
+ bool m_step_past_prologue; // FIXME: For now hard-coded to true, we could put
+ // a switch in for this if there's
+ // demand for that.
+ bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
+ // moved the inline stack depth.
+ ConstString m_step_into_target;
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInRange);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepInRange_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h
new file mode 100644
index 0000000..127de41
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -0,0 +1,57 @@
+//===-- ThreadPlanStepInstruction.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepInstruction_h_
+#define liblldb_ThreadPlanStepInstruction_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepInstruction : public ThreadPlan {
+public:
+ ThreadPlanStepInstruction(Thread &thread, bool step_over, bool stop_others,
+ Vote stop_vote, Vote run_vote);
+
+ ~ThreadPlanStepInstruction() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ bool IsPlanStale() override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ void SetUpState();
+
+private:
+ friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepSingleInstruction(
+ bool step_over, bool abort_other_plans, bool stop_other_threads,
+ Status &status);
+
+ lldb::addr_t m_instruction_addr;
+ bool m_stop_other_threads;
+ bool m_step_over;
+ // These two are used only for the step over case.
+ bool m_start_has_symbol;
+ StackID m_stack_id;
+ StackID m_parent_frame_id;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInstruction);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepInstruction_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h
new file mode 100644
index 0000000..00984db
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h
@@ -0,0 +1,92 @@
+//===-- ThreadPlanStepOut.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepOut_h_
+#define liblldb_ThreadPlanStepOut_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Target/ThreadPlanShouldStopHere.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
+public:
+ ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
+ bool first_insn, bool stop_others, Vote stop_vote,
+ Vote run_vote, uint32_t frame_idx,
+ LazyBool step_out_avoids_code_without_debug_info,
+ bool continue_to_next_branch = false,
+ bool gather_return_value = true);
+
+ ~ThreadPlanStepOut() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
+
+ lldb::ValueObjectSP GetReturnValueObject() override {
+ return m_return_valobj_sp;
+ }
+
+protected:
+ void SetFlagsToDefault() override {
+ GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
+ }
+
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool QueueInlinedStepPlan(bool queue_now);
+
+private:
+ static uint32_t s_default_flag_values; // These are the default flag values
+ // for the ThreadPlanStepThrough.
+
+ lldb::addr_t m_step_from_insn;
+ StackID m_step_out_to_id;
+ StackID m_immediate_step_from_id;
+ lldb::break_id_t m_return_bp_id;
+ lldb::addr_t m_return_addr;
+ bool m_stop_others;
+ lldb::ThreadPlanSP m_step_out_to_inline_plan_sp; // This plan implements step
+ // out to the real function
+ // containing
+ // an inlined frame so we can then step out of that.
+ lldb::ThreadPlanSP m_step_through_inline_plan_sp; // This plan then steps past
+ // the inlined frame(s).
+ lldb::ThreadPlanSP m_step_out_further_plan_sp; // This plan keeps stepping out
+ // if ShouldStopHere told us
+ // to.
+ Function *m_immediate_step_from_function;
+ std::vector<lldb::StackFrameSP> m_stepped_past_frames;
+ lldb::ValueObjectSP m_return_valobj_sp;
+ bool m_calculate_return_value;
+
+ friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
+ bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
+ bool stop_others, Vote stop_vote, Vote run_vote, uint32_t frame_idx,
+ Status &status, LazyBool step_out_avoids_code_without_debug_info);
+
+ void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
+ // Need an appropriate marker for the current stack so we can tell step out
+ // from step in.
+
+ void CalculateReturnValue();
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOut);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepOut_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
new file mode 100644
index 0000000..7df7049
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -0,0 +1,55 @@
+//===-- ThreadPlanStepOverBreakpoint.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepOverBreakpoint_h_
+#define liblldb_ThreadPlanStepOverBreakpoint_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepOverBreakpoint : public ThreadPlan {
+public:
+ ThreadPlanStepOverBreakpoint(Thread &thread);
+
+ ~ThreadPlanStepOverBreakpoint() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ void WillPop() override;
+ bool MischiefManaged() override;
+ void ThreadDestroyed() override;
+ void SetAutoContinue(bool do_it);
+ bool ShouldAutoContinue(Event *event_ptr) override;
+ bool IsPlanStale() override;
+
+ lldb::addr_t GetBreakpointLoadAddress() const { return m_breakpoint_addr; }
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+
+ void ReenableBreakpointSite();
+
+private:
+ lldb::addr_t m_breakpoint_addr;
+ lldb::user_id_t m_breakpoint_site_id;
+ bool m_auto_continue;
+ bool m_reenabled_breakpoint_site;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOverBreakpoint);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h
new file mode 100644
index 0000000..30763e3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -0,0 +1,53 @@
+//===-- ThreadPlanStepOverRange.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepOverRange_h_
+#define liblldb_ThreadPlanStepOverRange_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanStepRange.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepOverRange : public ThreadPlanStepRange,
+ ThreadPlanShouldStopHere {
+public:
+ ThreadPlanStepOverRange(Thread &thread, const AddressRange &range,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_others,
+ LazyBool step_out_avoids_no_debug);
+
+ ~ThreadPlanStepOverRange() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ShouldStop(Event *event_ptr) override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+
+ void SetFlagsToDefault() override {
+ GetFlags().Set(ThreadPlanStepOverRange::s_default_flag_values);
+ }
+
+private:
+ static uint32_t s_default_flag_values;
+
+ void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
+ bool IsEquivalentContext(const SymbolContext &context);
+
+ bool m_first_resume;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOverRange);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepOverRange_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h
new file mode 100644
index 0000000..93d54ad
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h
@@ -0,0 +1,88 @@
+//===-- ThreadPlanStepRange.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepRange_h_
+#define liblldb_ThreadPlanStepRange_h_
+
+#include "lldb/Core/AddressRange.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Target/ThreadPlanShouldStopHere.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepRange : public ThreadPlan {
+public:
+ ThreadPlanStepRange(ThreadPlanKind kind, const char *name, Thread &thread,
+ const AddressRange &range,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_others,
+ bool given_ranges_only = false);
+
+ ~ThreadPlanStepRange() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override = 0;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
+
+ void AddRange(const AddressRange &new_range);
+
+protected:
+ bool InRange();
+ lldb::FrameComparison CompareCurrentFrameToStartFrame();
+ bool InSymbol();
+ void DumpRanges(Stream *s);
+
+ Disassembler *GetDisassembler();
+
+ InstructionList *GetInstructionsForAddress(lldb::addr_t addr,
+ size_t &range_index,
+ size_t &insn_offset);
+
+ // Pushes a plan to proceed through the next section of instructions in the
+ // range - usually just a RunToAddress plan to run to the next branch.
+ // Returns true if it pushed such a plan. If there was no available 'quick
+ // run' plan, then just single step.
+ bool SetNextBranchBreakpoint();
+
+ void ClearNextBranchBreakpoint();
+
+ bool NextRangeBreakpointExplainsStop(lldb::StopInfoSP stop_info_sp);
+
+ SymbolContext m_addr_context;
+ std::vector<AddressRange> m_address_ranges;
+ lldb::RunMode m_stop_others;
+ StackID m_stack_id; // Use the stack ID so we can tell step out from step in.
+ StackID m_parent_stack_id; // Use the parent stack ID so we can identify tail
+ // calls and the like.
+ bool m_no_more_plans; // Need this one so we can tell if we stepped into a
+ // call,
+ // but can't continue, in which case we are done.
+ bool m_first_run_event; // We want to broadcast only one running event, our
+ // first.
+ lldb::BreakpointSP m_next_branch_bp_sp;
+ bool m_use_fast_step;
+ bool m_given_ranges_only;
+
+private:
+ std::vector<lldb::DisassemblerSP> m_instruction_ranges;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepRange);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepRange_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h
new file mode 100644
index 0000000..0d06212
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h
@@ -0,0 +1,61 @@
+//===-- ThreadPlanStepThrough.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepThrough_h_
+#define liblldb_ThreadPlanStepThrough_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepThrough : public ThreadPlan {
+public:
+ ~ThreadPlanStepThrough() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+
+protected:
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+
+ ThreadPlanStepThrough(Thread &thread, StackID &return_stack_id,
+ bool stop_others);
+
+ void LookForPlanToStepThroughFromCurrentPC();
+
+ bool HitOurBackstopBreakpoint();
+
+private:
+ friend lldb::ThreadPlanSP
+ Thread::QueueThreadPlanForStepThrough(StackID &return_stack_id,
+ bool abort_other_plans,
+ bool stop_others, Status &status);
+
+ void ClearBackstopBreakpoint();
+
+ lldb::ThreadPlanSP m_sub_plan_sp;
+ lldb::addr_t m_start_address;
+ lldb::break_id_t m_backstop_bkpt_id;
+ lldb::addr_t m_backstop_addr;
+ StackID m_return_stack_id;
+ bool m_stop_others;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepThrough);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepThrough_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h
new file mode 100644
index 0000000..9a5934a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h
@@ -0,0 +1,67 @@
+//===-- ThreadPlanStepUntil.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanStepUntil_h_
+#define liblldb_ThreadPlanStepUntil_h_
+
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlan.h"
+
+namespace lldb_private {
+
+class ThreadPlanStepUntil : public ThreadPlan {
+public:
+ ~ThreadPlanStepUntil() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+
+protected:
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+
+ ThreadPlanStepUntil(Thread &thread, lldb::addr_t *address_list,
+ size_t num_addresses, bool stop_others,
+ uint32_t frame_idx = 0);
+
+ void AnalyzeStop();
+
+private:
+ StackID m_stack_id;
+ lldb::addr_t m_step_from_insn;
+ lldb::break_id_t m_return_bp_id;
+ lldb::addr_t m_return_addr;
+ bool m_stepped_out;
+ bool m_should_stop;
+ bool m_ran_analyze;
+ bool m_explains_stop;
+
+ typedef std::map<lldb::addr_t, lldb::break_id_t> until_collection;
+ until_collection m_until_points;
+ bool m_stop_others;
+
+ void Clear();
+
+ friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepUntil(
+ bool abort_other_plans, lldb::addr_t *address_list, size_t num_addresses,
+ bool stop_others, uint32_t frame_idx, Status &status);
+
+ // Need an appropriate marker for the current stack so we can tell step out
+ // from step in.
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepUntil);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanStepUntil_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h b/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h
new file mode 100644
index 0000000..80b0807
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h
@@ -0,0 +1,99 @@
+//===-- ThreadPlanTracer.h --------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanTracer_h_
+#define liblldb_ThreadPlanTracer_h_
+
+#include "lldb/Symbol/TaggedASTType.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class ThreadPlanTracer {
+ friend class ThreadPlan;
+
+public:
+ enum ThreadPlanTracerStyle {
+ eLocation = 0,
+ eStateChange,
+ eCheckFrames,
+ ePython
+ };
+
+ ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp);
+ ThreadPlanTracer(Thread &thread);
+
+ virtual ~ThreadPlanTracer() = default;
+
+ virtual void TracingStarted() {}
+
+ virtual void TracingEnded() {}
+
+ bool EnableTracing(bool value) {
+ bool old_value = m_enabled;
+ m_enabled = value;
+ if (old_value == false && value == true)
+ TracingStarted();
+ else if (old_value == true && value == false)
+ TracingEnded();
+
+ return old_value;
+ }
+
+ bool TracingEnabled() { return m_enabled; }
+
+ bool EnableSingleStep(bool value) {
+ bool old_value = m_single_step;
+ m_single_step = value;
+ return old_value;
+ }
+
+ bool SingleStepEnabled() { return m_single_step; }
+
+protected:
+ Thread &m_thread;
+
+ Stream *GetLogStream();
+
+ virtual void Log();
+
+private:
+ bool TracerExplainsStop();
+
+ bool m_single_step;
+ bool m_enabled;
+ lldb::StreamSP m_stream_sp;
+};
+
+class ThreadPlanAssemblyTracer : public ThreadPlanTracer {
+public:
+ ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp);
+ ThreadPlanAssemblyTracer(Thread &thread);
+ ~ThreadPlanAssemblyTracer() override;
+
+ void TracingStarted() override;
+ void TracingEnded() override;
+ void Log() override;
+
+private:
+ Disassembler *GetDisassembler();
+
+ TypeFromUser GetIntPointerType();
+
+ lldb::DisassemblerSP m_disassembler_sp;
+ TypeFromUser m_intptr_type;
+ std::vector<RegisterValue> m_register_values;
+ lldb::DataBufferSP m_buffer_sp;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanTracer_h_
diff --git a/linux-x64/clang/include/lldb/Target/ThreadSpec.h b/linux-x64/clang/include/lldb/Target/ThreadSpec.h
new file mode 100644
index 0000000..05e7dcd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadSpec.h
@@ -0,0 +1,129 @@
+//===-- ThreadSpec.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadSpec_h_
+#define liblldb_ThreadSpec_h_
+
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-private.h"
+#include <string>
+
+namespace lldb_private {
+
+// Note: For now the thread spec has only fixed elements -
+// Thread ID
+// Thread Index
+// Thread Name
+// Thread Queue Name
+//
+// But if we need more generality, we can hang a key/value map off of this
+// structure.
+// That's why the thread matches spec test is done as a virtual method in
+// Thread::MatchesSpec,
+// since it is the native thread that would know how to interpret the keys.
+// I was going to do the Queue Name this way out of sheer orneriness, but that
+// seems a
+// sufficiently general concept, so I put it in here on its own.
+
+class ThreadSpec {
+public:
+ ThreadSpec();
+
+ static std::unique_ptr<ThreadSpec>
+ CreateFromStructuredData(const StructuredData::Dictionary &data_dict,
+ Status &error);
+
+ StructuredData::ObjectSP SerializeToStructuredData();
+
+ static const char *GetSerializationKey() { return "ThreadSpec"; }
+
+ void SetIndex(uint32_t index) { m_index = index; }
+
+ void SetTID(lldb::tid_t tid) { m_tid = tid; }
+
+ void SetName(llvm::StringRef name) { m_name = name; }
+
+ void SetQueueName(llvm::StringRef queue_name) { m_queue_name = queue_name; }
+
+ uint32_t GetIndex() const { return m_index; }
+
+ lldb::tid_t GetTID() const { return m_tid; }
+
+ const char *GetName() const;
+
+ const char *GetQueueName() const;
+
+ bool TIDMatches(lldb::tid_t thread_id) const {
+ if (m_tid == LLDB_INVALID_THREAD_ID || thread_id == LLDB_INVALID_THREAD_ID)
+ return true;
+ else
+ return thread_id == m_tid;
+ }
+
+ bool TIDMatches(Thread &thread) const;
+
+ bool IndexMatches(uint32_t index) const {
+ if (m_index == UINT32_MAX || index == UINT32_MAX)
+ return true;
+ else
+ return index == m_index;
+ }
+
+ bool IndexMatches(Thread &thread) const;
+
+ bool NameMatches(const char *name) const {
+ if (m_name.empty())
+ return true;
+ else if (name == nullptr)
+ return false;
+ else
+ return m_name == name;
+ }
+
+ bool NameMatches(Thread &thread) const;
+
+ bool QueueNameMatches(const char *queue_name) const {
+ if (m_queue_name.empty())
+ return true;
+ else if (queue_name == nullptr)
+ return false;
+ else
+ return m_queue_name == queue_name;
+ }
+
+ bool QueueNameMatches(Thread &thread) const;
+
+ bool ThreadPassesBasicTests(Thread &thread) const;
+
+ bool HasSpecification() const;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+private:
+ enum class OptionNames {
+ ThreadIndex = 0,
+ ThreadID,
+ ThreadName,
+ QueueName,
+ LastOptionName
+ };
+ static const char *g_option_names[(size_t)OptionNames::LastOptionName];
+
+ static const char *GetKey(OptionNames enum_value) {
+ return g_option_names[(size_t) enum_value];
+ }
+
+ uint32_t m_index;
+ lldb::tid_t m_tid;
+ std::string m_name;
+ std::string m_queue_name;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadSpec_h_
diff --git a/linux-x64/clang/include/lldb/Target/UnixSignals.h b/linux-x64/clang/include/lldb/Target/UnixSignals.h
new file mode 100644
index 0000000..120ffdd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/UnixSignals.h
@@ -0,0 +1,129 @@
+//===-- UnixSignals.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_UnixSignals_h_
+#define lldb_UnixSignals_h_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-private.h"
+#include "llvm/ADT/Optional.h"
+
+namespace lldb_private {
+
+class UnixSignals {
+public:
+ static lldb::UnixSignalsSP Create(const ArchSpec &arch);
+ static lldb::UnixSignalsSP CreateForHost();
+
+ // Constructors and Destructors
+ UnixSignals();
+
+ virtual ~UnixSignals();
+
+ const char *GetSignalAsCString(int32_t signo) const;
+
+ bool SignalIsValid(int32_t signo) const;
+
+ int32_t GetSignalNumberFromName(const char *name) const;
+
+ const char *GetSignalInfo(int32_t signo, bool &should_suppress,
+ bool &should_stop, bool &should_notify) const;
+
+ bool GetShouldSuppress(int32_t signo) const;
+
+ bool SetShouldSuppress(int32_t signo, bool value);
+
+ bool SetShouldSuppress(const char *signal_name, bool value);
+
+ bool GetShouldStop(int32_t signo) const;
+
+ bool SetShouldStop(int32_t signo, bool value);
+ bool SetShouldStop(const char *signal_name, bool value);
+
+ bool GetShouldNotify(int32_t signo) const;
+
+ bool SetShouldNotify(int32_t signo, bool value);
+
+ bool SetShouldNotify(const char *signal_name, bool value);
+
+ // These provide an iterator through the signals available on this system.
+ // Call GetFirstSignalNumber to get the first entry, then iterate on
+ // GetNextSignalNumber till you get back LLDB_INVALID_SIGNAL_NUMBER.
+ int32_t GetFirstSignalNumber() const;
+
+ int32_t GetNextSignalNumber(int32_t current_signal) const;
+
+ int32_t GetNumSignals() const;
+
+ int32_t GetSignalAtIndex(int32_t index) const;
+
+ ConstString GetShortName(ConstString name) const;
+
+ // We assume that the elements of this object are constant once it is
+ // constructed, since a process should never need to add or remove symbols as
+ // it runs. So don't call these functions anywhere but the constructor of
+ // your subclass of UnixSignals or in your Process Plugin's GetUnixSignals
+ // method before you return the UnixSignal object.
+
+ void AddSignal(int signo, const char *name, bool default_suppress,
+ bool default_stop, bool default_notify,
+ const char *description, const char *alias = nullptr);
+
+ 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
+
+ struct Signal {
+ ConstString m_name;
+ ConstString m_alias;
+ std::string m_description;
+ bool m_suppress : 1, m_stop : 1, m_notify : 1;
+
+ Signal(const char *name, bool default_suppress, bool default_stop,
+ bool default_notify, const char *description, const char *alias);
+
+ ~Signal() {}
+ };
+
+ virtual void Reset();
+
+ typedef std::map<int32_t, Signal> collection;
+
+ 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);
+
+ const UnixSignals &operator=(const UnixSignals &rhs) = delete;
+};
+
+} // Namespace lldb
+#endif // lldb_UnixSignals_h_
diff --git a/linux-x64/clang/include/lldb/Target/Unwind.h b/linux-x64/clang/include/lldb/Target/Unwind.h
new file mode 100644
index 0000000..a648e06
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Unwind.h
@@ -0,0 +1,83 @@
+//===-- Unwind.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Unwind_h_
+#define liblldb_Unwind_h_
+
+#include <mutex>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class Unwind {
+protected:
+ // Classes that inherit from Unwind can see and modify these
+ Unwind(Thread &thread) : m_thread(thread), m_unwind_mutex() {}
+
+public:
+ virtual ~Unwind() {}
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+ DoClear();
+ }
+
+ uint32_t GetFrameCount() {
+ std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+ return DoGetFrameCount();
+ }
+
+ uint32_t GetFramesUpTo(uint32_t end_idx) {
+ lldb::addr_t cfa;
+ lldb::addr_t pc;
+ uint32_t idx;
+
+ for (idx = 0; idx < end_idx; idx++) {
+ if (!DoGetFrameInfoAtIndex(idx, cfa, pc)) {
+ break;
+ }
+ }
+ return idx;
+ }
+
+ bool GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
+ lldb::addr_t &pc) {
+ std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+ return DoGetFrameInfoAtIndex(frame_idx, cfa, pc);
+ }
+
+ lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) {
+ std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+ return DoCreateRegisterContextForFrame(frame);
+ }
+
+ Thread &GetThread() { return m_thread; }
+
+protected:
+ // Classes that inherit from Unwind can see and modify these
+ virtual void DoClear() = 0;
+
+ virtual uint32_t DoGetFrameCount() = 0;
+
+ virtual bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
+ lldb::addr_t &pc) = 0;
+
+ virtual lldb::RegisterContextSP
+ DoCreateRegisterContextForFrame(StackFrame *frame) = 0;
+
+ Thread &m_thread;
+ std::recursive_mutex m_unwind_mutex;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Unwind);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Unwind_h_
diff --git a/linux-x64/clang/include/lldb/Target/UnwindAssembly.h b/linux-x64/clang/include/lldb/Target/UnwindAssembly.h
new file mode 100644
index 0000000..a70aef6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/UnwindAssembly.h
@@ -0,0 +1,53 @@
+//===-- UnwindAssembly.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_UnwindAssembly_h_
+#define utility_UnwindAssembly_h_
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class UnwindAssembly : public std::enable_shared_from_this<UnwindAssembly>,
+ public PluginInterface {
+public:
+ static lldb::UnwindAssemblySP FindPlugin(const ArchSpec &arch);
+
+ ~UnwindAssembly() override;
+
+ virtual bool
+ GetNonCallSiteUnwindPlanFromAssembly(AddressRange &func, Thread &thread,
+ UnwindPlan &unwind_plan) = 0;
+
+ virtual bool AugmentUnwindPlanFromCallSite(AddressRange &func, Thread &thread,
+ UnwindPlan &unwind_plan) = 0;
+
+ virtual bool GetFastUnwindPlan(AddressRange &func, Thread &thread,
+ UnwindPlan &unwind_plan) = 0;
+
+ // thread may be NULL in which case we only use the Target (e.g. if this is
+ // called pre-process-launch).
+ virtual bool
+ FirstNonPrologueInsn(AddressRange &func,
+ const lldb_private::ExecutionContext &exe_ctx,
+ Address &first_non_prologue_insn) = 0;
+
+protected:
+ UnwindAssembly(const ArchSpec &arch);
+ ArchSpec m_arch;
+
+private:
+ UnwindAssembly() = delete;
+ DISALLOW_COPY_AND_ASSIGN(UnwindAssembly);
+};
+
+} // namespace lldb_private
+
+#endif // utility_UnwindAssembly_h_
diff --git a/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h b/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h
new file mode 100644
index 0000000..1473c60
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h
@@ -0,0 +1,140 @@
+//===---------------------AnsiTerminal.h ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#define ANSI_FG_COLOR_BLACK 30
+#define ANSI_FG_COLOR_RED 31
+#define ANSI_FG_COLOR_GREEN 32
+#define ANSI_FG_COLOR_YELLOW 33
+#define ANSI_FG_COLOR_BLUE 34
+#define ANSI_FG_COLOR_PURPLE 35
+#define ANSI_FG_COLOR_CYAN 36
+#define ANSI_FG_COLOR_WHITE 37
+
+#define ANSI_BG_COLOR_BLACK 40
+#define ANSI_BG_COLOR_RED 41
+#define ANSI_BG_COLOR_GREEN 42
+#define ANSI_BG_COLOR_YELLOW 43
+#define ANSI_BG_COLOR_BLUE 44
+#define ANSI_BG_COLOR_PURPLE 45
+#define ANSI_BG_COLOR_CYAN 46
+#define ANSI_BG_COLOR_WHITE 47
+
+#define ANSI_SPECIAL_FRAMED 51
+#define ANSI_SPECIAL_ENCIRCLED 52
+
+#define ANSI_CTRL_NORMAL 0
+#define ANSI_CTRL_BOLD 1
+#define ANSI_CTRL_FAINT 2
+#define ANSI_CTRL_ITALIC 3
+#define ANSI_CTRL_UNDERLINE 4
+#define ANSI_CTRL_SLOW_BLINK 5
+#define ANSI_CTRL_FAST_BLINK 6
+#define ANSI_CTRL_IMAGE_NEGATIVE 7
+#define ANSI_CTRL_CONCEAL 8
+#define ANSI_CTRL_CROSSED_OUT 9
+
+#define ANSI_ESC_START "\033["
+#define ANSI_ESC_END "m"
+
+#define ANSI_STR(s) #s
+#define ANSI_DEF_STR(s) ANSI_STR(s)
+
+#define ANSI_ESCAPE1(s) ANSI_ESC_START ANSI_DEF_STR(s) ANSI_ESC_END
+
+#define ANSI_1_CTRL(ctrl1) "\033["##ctrl1 ANSI_ESC_END
+#define ANSI_2_CTRL(ctrl1, ctrl2) "\033["##ctrl1 ";"##ctrl2 ANSI_ESC_END
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <string>
+
+namespace lldb_utility {
+
+namespace ansi {
+
+inline std::string FormatAnsiTerminalCodes(llvm::StringRef format,
+ bool do_color = true) {
+ // Convert "${ansi.XXX}" tokens to ansi values or clear them if do_color is
+ // false.
+ static const struct {
+ const char *name;
+ const char *value;
+ } g_color_tokens[] = {
+#define _TO_STR2(_val) #_val
+#define _TO_STR(_val) _TO_STR2(_val)
+ {"fg.black}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLACK) ANSI_ESC_END},
+ {"fg.red}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_RED) ANSI_ESC_END},
+ {"fg.green}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_GREEN) ANSI_ESC_END},
+ {"fg.yellow}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_YELLOW) ANSI_ESC_END},
+ {"fg.blue}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_BLUE) ANSI_ESC_END},
+ {"fg.purple}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_PURPLE) ANSI_ESC_END},
+ {"fg.cyan}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_CYAN) ANSI_ESC_END},
+ {"fg.white}", ANSI_ESC_START _TO_STR(ANSI_FG_COLOR_WHITE) ANSI_ESC_END},
+ {"bg.black}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLACK) ANSI_ESC_END},
+ {"bg.red}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_RED) ANSI_ESC_END},
+ {"bg.green}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_GREEN) ANSI_ESC_END},
+ {"bg.yellow}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_YELLOW) ANSI_ESC_END},
+ {"bg.blue}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_BLUE) ANSI_ESC_END},
+ {"bg.purple}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_PURPLE) ANSI_ESC_END},
+ {"bg.cyan}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_CYAN) ANSI_ESC_END},
+ {"bg.white}", ANSI_ESC_START _TO_STR(ANSI_BG_COLOR_WHITE) ANSI_ESC_END},
+ {"normal}", ANSI_ESC_START _TO_STR(ANSI_CTRL_NORMAL) ANSI_ESC_END},
+ {"bold}", ANSI_ESC_START _TO_STR(ANSI_CTRL_BOLD) ANSI_ESC_END},
+ {"faint}", ANSI_ESC_START _TO_STR(ANSI_CTRL_FAINT) ANSI_ESC_END},
+ {"italic}", ANSI_ESC_START _TO_STR(ANSI_CTRL_ITALIC) ANSI_ESC_END},
+ {"underline}", ANSI_ESC_START _TO_STR(ANSI_CTRL_UNDERLINE) ANSI_ESC_END},
+ {"slow-blink}",
+ ANSI_ESC_START _TO_STR(ANSI_CTRL_SLOW_BLINK) ANSI_ESC_END},
+ {"fast-blink}",
+ ANSI_ESC_START _TO_STR(ANSI_CTRL_FAST_BLINK) ANSI_ESC_END},
+ {"negative}",
+ ANSI_ESC_START _TO_STR(ANSI_CTRL_IMAGE_NEGATIVE) ANSI_ESC_END},
+ {"conceal}", ANSI_ESC_START _TO_STR(ANSI_CTRL_CONCEAL) ANSI_ESC_END},
+ {"crossed-out}",
+ ANSI_ESC_START _TO_STR(ANSI_CTRL_CROSSED_OUT) ANSI_ESC_END},
+#undef _TO_STR
+#undef _TO_STR2
+ };
+ auto codes = llvm::makeArrayRef(g_color_tokens);
+
+ static const char tok_hdr[] = "${ansi.";
+
+ std::string fmt;
+ while (!format.empty()) {
+ llvm::StringRef left, right;
+ std::tie(left, right) = format.split(tok_hdr);
+
+ fmt.append(left);
+
+ if (left == format && right.empty()) {
+ // The header was not found. Just exit.
+ break;
+ }
+
+ bool found_code = false;
+ for (const auto &code : codes) {
+ if (!right.consume_front(code.name))
+ continue;
+
+ if (do_color)
+ fmt.append(code.value);
+ found_code = true;
+ break;
+ }
+ format = right;
+ // If we haven't found a valid replacement value, we just copy the string
+ // to the result without any modifications.
+ if (!found_code)
+ fmt.append(tok_hdr);
+ }
+ return fmt;
+}
+}
+}
diff --git a/linux-x64/clang/include/lldb/Utility/ArchSpec.h b/linux-x64/clang/include/lldb/Utility/ArchSpec.h
new file mode 100644
index 0000000..7a32556
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/ArchSpec.h
@@ -0,0 +1,542 @@
+//===-- ArchSpec.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_ARCHSPEC_H
+#define LLDB_UTILITY_ARCHSPEC_H
+
+#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+namespace lldb_private {
+
+/// \class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h" An architecture
+/// specification class.
+///
+/// A class designed to be created from a cpu type and subtype, a
+/// string representation, or an llvm::Triple. Keeping all of the conversions
+/// of strings to architecture enumeration values confined to this class
+/// allows new architecture support to be added easily.
+class ArchSpec {
+public:
+ enum MIPSSubType {
+ eMIPSSubType_unknown,
+ eMIPSSubType_mips32,
+ eMIPSSubType_mips32r2,
+ eMIPSSubType_mips32r6,
+ eMIPSSubType_mips32el,
+ eMIPSSubType_mips32r2el,
+ eMIPSSubType_mips32r6el,
+ eMIPSSubType_mips64,
+ eMIPSSubType_mips64r2,
+ eMIPSSubType_mips64r6,
+ eMIPSSubType_mips64el,
+ eMIPSSubType_mips64r2el,
+ eMIPSSubType_mips64r6el,
+ };
+
+ // Masks for the ases word of an ABI flags structure.
+ enum MIPSASE {
+ eMIPSAse_dsp = 0x00000001, // DSP ASE
+ eMIPSAse_dspr2 = 0x00000002, // DSP R2 ASE
+ eMIPSAse_eva = 0x00000004, // Enhanced VA Scheme
+ eMIPSAse_mcu = 0x00000008, // MCU (MicroController) ASE
+ eMIPSAse_mdmx = 0x00000010, // MDMX ASE
+ eMIPSAse_mips3d = 0x00000020, // MIPS-3D ASE
+ eMIPSAse_mt = 0x00000040, // MT ASE
+ eMIPSAse_smartmips = 0x00000080, // SmartMIPS ASE
+ eMIPSAse_virt = 0x00000100, // VZ ASE
+ eMIPSAse_msa = 0x00000200, // MSA ASE
+ eMIPSAse_mips16 = 0x00000400, // MIPS16 ASE
+ eMIPSAse_micromips = 0x00000800, // MICROMIPS ASE
+ eMIPSAse_xpa = 0x00001000, // XPA ASE
+ eMIPSAse_mask = 0x00001fff,
+ eMIPSABI_O32 = 0x00002000,
+ eMIPSABI_N32 = 0x00004000,
+ eMIPSABI_N64 = 0x00008000,
+ eMIPSABI_O64 = 0x00020000,
+ eMIPSABI_EABI32 = 0x00040000,
+ eMIPSABI_EABI64 = 0x00080000,
+ eMIPSABI_mask = 0x000ff000
+ };
+
+ // MIPS Floating point ABI Values
+ enum MIPS_ABI_FP {
+ eMIPS_ABI_FP_ANY = 0x00000000,
+ eMIPS_ABI_FP_DOUBLE = 0x00100000, // hard float / -mdouble-float
+ eMIPS_ABI_FP_SINGLE = 0x00200000, // hard float / -msingle-float
+ eMIPS_ABI_FP_SOFT = 0x00300000, // soft float
+ eMIPS_ABI_FP_OLD_64 = 0x00400000, // -mips32r2 -mfp64
+ eMIPS_ABI_FP_XX = 0x00500000, // -mfpxx
+ eMIPS_ABI_FP_64 = 0x00600000, // -mips32r2 -mfp64
+ eMIPS_ABI_FP_64A = 0x00700000, // -mips32r2 -mfp64 -mno-odd-spreg
+ eMIPS_ABI_FP_mask = 0x00700000
+ };
+
+ // ARM specific e_flags
+ enum ARMeflags {
+ eARM_abi_soft_float = 0x00000200,
+ eARM_abi_hard_float = 0x00000400
+ };
+
+ enum Core {
+ eCore_arm_generic,
+ eCore_arm_armv4,
+ eCore_arm_armv4t,
+ eCore_arm_armv5,
+ eCore_arm_armv5e,
+ eCore_arm_armv5t,
+ eCore_arm_armv6,
+ eCore_arm_armv6m,
+ eCore_arm_armv7,
+ eCore_arm_armv7f,
+ eCore_arm_armv7s,
+ eCore_arm_armv7k,
+ eCore_arm_armv7m,
+ eCore_arm_armv7em,
+ eCore_arm_xscale,
+
+ eCore_thumb,
+ eCore_thumbv4t,
+ eCore_thumbv5,
+ eCore_thumbv5e,
+ eCore_thumbv6,
+ eCore_thumbv6m,
+ eCore_thumbv7,
+ eCore_thumbv7s,
+ eCore_thumbv7k,
+ eCore_thumbv7f,
+ eCore_thumbv7m,
+ eCore_thumbv7em,
+ eCore_arm_arm64,
+ eCore_arm_armv8,
+ eCore_arm_aarch64,
+
+ eCore_mips32,
+ eCore_mips32r2,
+ eCore_mips32r3,
+ eCore_mips32r5,
+ eCore_mips32r6,
+ eCore_mips32el,
+ eCore_mips32r2el,
+ eCore_mips32r3el,
+ eCore_mips32r5el,
+ eCore_mips32r6el,
+ eCore_mips64,
+ eCore_mips64r2,
+ eCore_mips64r3,
+ eCore_mips64r5,
+ eCore_mips64r6,
+ eCore_mips64el,
+ eCore_mips64r2el,
+ eCore_mips64r3el,
+ eCore_mips64r5el,
+ eCore_mips64r6el,
+
+ eCore_ppc_generic,
+ eCore_ppc_ppc601,
+ eCore_ppc_ppc602,
+ eCore_ppc_ppc603,
+ eCore_ppc_ppc603e,
+ eCore_ppc_ppc603ev,
+ eCore_ppc_ppc604,
+ eCore_ppc_ppc604e,
+ eCore_ppc_ppc620,
+ eCore_ppc_ppc750,
+ eCore_ppc_ppc7400,
+ eCore_ppc_ppc7450,
+ eCore_ppc_ppc970,
+
+ eCore_ppc64le_generic,
+ eCore_ppc64_generic,
+ eCore_ppc64_ppc970_64,
+
+ eCore_s390x_generic,
+
+ eCore_sparc_generic,
+
+ eCore_sparc9_generic,
+
+ eCore_x86_32_i386,
+ eCore_x86_32_i486,
+ eCore_x86_32_i486sx,
+ eCore_x86_32_i686,
+
+ eCore_x86_64_x86_64,
+ eCore_x86_64_x86_64h, // Haswell enabled x86_64
+ eCore_hexagon_generic,
+ eCore_hexagon_hexagonv4,
+ eCore_hexagon_hexagonv5,
+
+ eCore_uknownMach32,
+ eCore_uknownMach64,
+
+ kNumCores,
+
+ kCore_invalid,
+ // The following constants are used for wildcard matching only
+ kCore_any,
+ kCore_arm_any,
+ kCore_ppc_any,
+ kCore_ppc64_any,
+ kCore_x86_32_any,
+ kCore_x86_64_any,
+ kCore_hexagon_any,
+
+ kCore_arm_first = eCore_arm_generic,
+ kCore_arm_last = eCore_arm_xscale,
+
+ kCore_thumb_first = eCore_thumb,
+ kCore_thumb_last = eCore_thumbv7em,
+
+ kCore_ppc_first = eCore_ppc_generic,
+ kCore_ppc_last = eCore_ppc_ppc970,
+
+ kCore_ppc64_first = eCore_ppc64_generic,
+ kCore_ppc64_last = eCore_ppc64_ppc970_64,
+
+ kCore_x86_32_first = eCore_x86_32_i386,
+ kCore_x86_32_last = eCore_x86_32_i686,
+
+ kCore_x86_64_first = eCore_x86_64_x86_64,
+ kCore_x86_64_last = eCore_x86_64_x86_64h,
+
+ kCore_hexagon_first = eCore_hexagon_generic,
+ kCore_hexagon_last = eCore_hexagon_hexagonv5,
+
+ kCore_mips32_first = eCore_mips32,
+ kCore_mips32_last = eCore_mips32r6,
+
+ kCore_mips32el_first = eCore_mips32el,
+ kCore_mips32el_last = eCore_mips32r6el,
+
+ kCore_mips64_first = eCore_mips64,
+ kCore_mips64_last = eCore_mips64r6,
+
+ kCore_mips64el_first = eCore_mips64el,
+ kCore_mips64el_last = eCore_mips64r6el,
+
+ kCore_mips_first = eCore_mips32,
+ kCore_mips_last = eCore_mips64r6el
+
+ };
+
+ /// Default constructor.
+ ///
+ /// Default constructor that initializes the object with invalid cpu type
+ /// and subtype values.
+ ArchSpec();
+
+ /// Constructor over triple.
+ ///
+ /// Constructs an ArchSpec with properties consistent with the given Triple.
+ explicit ArchSpec(const llvm::Triple &triple);
+ explicit ArchSpec(const char *triple_cstr);
+ explicit ArchSpec(llvm::StringRef triple_str);
+ /// Constructor over architecture name.
+ ///
+ /// Constructs an ArchSpec with properties consistent with the given object
+ /// type and architecture name.
+ explicit ArchSpec(ArchitectureType arch_type, uint32_t cpu_type,
+ uint32_t cpu_subtype);
+
+ /// Destructor.
+ ~ArchSpec();
+
+ /// Assignment operator.
+ ///
+ /// \param[in] rhs another ArchSpec object to copy.
+ ///
+ /// \return A const reference to this object.
+ const ArchSpec &operator=(const ArchSpec &rhs);
+
+ /// Returns true if the OS, vendor and environment fields of the triple are
+ /// unset. The triple is expected to be normalized
+ /// (llvm::Triple::normalize).
+ static bool ContainsOnlyArch(const llvm::Triple &normalized_triple);
+
+ static void ListSupportedArchNames(StringList &list);
+ static size_t AutoComplete(CompletionRequest &request);
+
+ /// Returns a static string representing the current architecture.
+ ///
+ /// \return A static string corresponding to the current
+ /// architecture.
+ const char *GetArchitectureName() const;
+
+ /// if MIPS architecture return true.
+ ///
+ /// \return a boolean value.
+ bool IsMIPS() const;
+
+ /// Returns a string representing current architecture as a target CPU for
+ /// tools like compiler, disassembler etc.
+ ///
+ /// \return A string representing target CPU for the current
+ /// architecture.
+ std::string GetClangTargetCPU() const;
+
+ /// Return a string representing target application ABI.
+ ///
+ /// \return A string representing target application ABI.
+ std::string GetTargetABI() const;
+
+ /// Clears the object state.
+ ///
+ /// Clears the object state back to a default invalid state.
+ void Clear();
+
+ /// Returns the size in bytes of an address of the current architecture.
+ ///
+ /// \return The byte size of an address of the current architecture.
+ uint32_t GetAddressByteSize() const;
+
+ /// Returns a machine family for the current architecture.
+ ///
+ /// \return An LLVM arch type.
+ llvm::Triple::ArchType GetMachine() const;
+
+ /// Returns the distribution id of the architecture.
+ ///
+ /// This will be something like "ubuntu", "fedora", etc. on Linux.
+ ///
+ /// \return A ConstString ref containing the distribution id,
+ /// potentially empty.
+ ConstString GetDistributionId() const;
+
+ /// Set the distribution id of the architecture.
+ ///
+ /// This will be something like "ubuntu", "fedora", etc. on Linux. This
+ /// should be the same value returned by HostInfo::GetDistributionId ().
+ void SetDistributionId(const char *distribution_id);
+
+ /// Tests if this ArchSpec is valid.
+ ///
+ /// \return True if the current architecture is valid, false
+ /// otherwise.
+ bool IsValid() const {
+ return m_core >= eCore_arm_generic && m_core < kNumCores;
+ }
+ explicit operator bool() const { return IsValid(); }
+
+ bool TripleVendorWasSpecified() const {
+ return !m_triple.getVendorName().empty();
+ }
+
+ bool TripleOSWasSpecified() const { return !m_triple.getOSName().empty(); }
+
+ bool TripleEnvironmentWasSpecified() const {
+ return m_triple.hasEnvironment();
+ }
+
+ /// Merges fields from another ArchSpec into this ArchSpec.
+ ///
+ /// This will use the supplied ArchSpec to fill in any fields of the triple
+ /// in this ArchSpec which were unspecified. This can be used to refine a
+ /// generic ArchSpec with a more specific one. For example, if this
+ /// ArchSpec's triple is something like i386-unknown-unknown-unknown, and we
+ /// have a triple which is x64-pc-windows-msvc, then merging that triple
+ /// into this one will result in the triple i386-pc-windows-msvc.
+ ///
+ void MergeFrom(const ArchSpec &other);
+
+ /// Change the architecture object type, CPU type and OS type.
+ ///
+ /// \param[in] arch_type The object type of this ArchSpec.
+ ///
+ /// \param[in] cpu The required CPU type.
+ ///
+ /// \param[in] os The optional OS type
+ /// The default value of 0 was chosen to from the ELF spec value
+ /// ELFOSABI_NONE. ELF is the only one using this parameter. If another
+ /// format uses this parameter and 0 does not work, use a value over
+ /// 255 because in the ELF header this is value is only a byte.
+ ///
+ /// \return True if the object, and CPU were successfully set.
+ ///
+ /// As a side effect, the vendor value is usually set to unknown. The
+ /// exceptions are
+ /// aarch64-apple-ios
+ /// arm-apple-ios
+ /// thumb-apple-ios
+ /// x86-apple-
+ /// x86_64-apple-
+ ///
+ /// As a side effect, the os value is usually set to unknown The exceptions
+ /// are
+ /// *-*-aix
+ /// aarch64-apple-ios
+ /// arm-apple-ios
+ /// thumb-apple-ios
+ /// powerpc-apple-darwin
+ /// *-*-freebsd
+ /// *-*-linux
+ /// *-*-netbsd
+ /// *-*-openbsd
+ /// *-*-solaris
+ bool SetArchitecture(ArchitectureType arch_type, uint32_t cpu, uint32_t sub,
+ uint32_t os = 0);
+
+ /// Returns the byte order for the architecture specification.
+ ///
+ /// \return The endian enumeration for the current endianness of
+ /// the architecture specification
+ lldb::ByteOrder GetByteOrder() const;
+
+ /// Sets this ArchSpec's byte order.
+ ///
+ /// In the common case there is no need to call this method as the byte
+ /// order can almost always be determined by the architecture. However, many
+ /// CPU's are bi-endian (ARM, Alpha, PowerPC, etc) and the default/assumed
+ /// byte order may be incorrect.
+ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
+
+ uint32_t GetMinimumOpcodeByteSize() const;
+
+ uint32_t GetMaximumOpcodeByteSize() const;
+
+ Core GetCore() const { return m_core; }
+
+ uint32_t GetMachOCPUType() const;
+
+ uint32_t GetMachOCPUSubType() const;
+
+ /// Architecture data byte width accessor
+ ///
+ /// \return the size in 8-bit (host) bytes of a minimum addressable unit
+ /// from the Architecture's data bus
+ uint32_t GetDataByteSize() const;
+
+ /// Architecture code byte width accessor
+ ///
+ /// \return the size in 8-bit (host) bytes of a minimum addressable unit
+ /// from the Architecture's code bus
+ uint32_t GetCodeByteSize() const;
+
+ /// Architecture triple accessor.
+ ///
+ /// \return A triple describing this ArchSpec.
+ llvm::Triple &GetTriple() { return m_triple; }
+
+ /// Architecture triple accessor.
+ ///
+ /// \return A triple describing this ArchSpec.
+ const llvm::Triple &GetTriple() const { return m_triple; }
+
+ void DumpTriple(Stream &s) const;
+
+ /// Architecture triple setter.
+ ///
+ /// Configures this ArchSpec according to the given triple. If the triple
+ /// has unknown components in all of the vendor, OS, and the optional
+ /// environment field (i.e. "i386-unknown-unknown") then default values are
+ /// taken from the host. Architecture and environment components are used
+ /// to further resolve the CPU type and subtype, endian characteristics,
+ /// etc.
+ ///
+ /// \return A triple describing this ArchSpec.
+ bool SetTriple(const llvm::Triple &triple);
+
+ bool SetTriple(llvm::StringRef triple_str);
+
+ /// Returns the default endianness of the architecture.
+ ///
+ /// \return The endian enumeration for the default endianness of
+ /// the architecture.
+ lldb::ByteOrder GetDefaultEndian() const;
+
+ /// Returns true if 'char' is a signed type by default in the architecture
+ /// false otherwise
+ ///
+ /// \return True if 'char' is a signed type by default on the
+ /// architecture and false otherwise.
+ bool CharIsSignedByDefault() const;
+
+ /// Compare an ArchSpec to another ArchSpec, requiring an exact cpu type
+ /// match between them. e.g. armv7s is not an exact match with armv7 - this
+ /// would return false
+ ///
+ /// \return true if the two ArchSpecs match.
+ bool IsExactMatch(const ArchSpec &rhs) const;
+
+ /// Compare an ArchSpec to another ArchSpec, requiring a compatible cpu type
+ /// match between them. e.g. armv7s is compatible with armv7 - this method
+ /// would return true
+ ///
+ /// \return true if the two ArchSpecs are compatible
+ bool IsCompatibleMatch(const ArchSpec &rhs) const;
+
+ bool IsFullySpecifiedTriple() const;
+
+ void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_different,
+ bool &vendor_different, bool &os_different,
+ bool &os_version_different,
+ bool &env_different) const;
+
+ /// Detect whether this architecture uses thumb code exclusively
+ ///
+ /// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can only execute
+ /// the Thumb instructions, never Arm. We should normally pick up
+ /// arm/thumbness from their the processor status bits (cpsr/xpsr) or hints
+ /// on each function - but when doing bare-boards low level debugging
+ /// (especially common with these embedded processors), we may not have
+ /// those things easily accessible.
+ ///
+ /// \return true if this is an arm ArchSpec which can only execute Thumb
+ /// instructions
+ bool IsAlwaysThumbInstructions() const;
+
+ uint32_t GetFlags() const { return m_flags; }
+
+ void SetFlags(uint32_t flags) { m_flags = flags; }
+
+ void SetFlags(std::string elf_abi);
+
+protected:
+ bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const;
+ void UpdateCore();
+
+ llvm::Triple m_triple;
+ Core m_core = kCore_invalid;
+ lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid;
+
+ // Additional arch flags which we cannot get from triple and core For MIPS
+ // these are application specific extensions like micromips, mips16 etc.
+ uint32_t m_flags = 0;
+
+ ConstString m_distribution_id;
+
+ // Called when m_def or m_entry are changed. Fills in all remaining members
+ // with default values.
+ void CoreUpdated(bool update_triple);
+};
+
+/// \fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs) Less than
+/// operator.
+///
+/// Tests two ArchSpec objects to see if \a lhs is less than \a rhs.
+///
+/// \param[in] lhs The Left Hand Side ArchSpec object to compare. \param[in]
+/// rhs The Left Hand Side ArchSpec object to compare.
+///
+/// \return true if \a lhs is less than \a rhs
+bool operator<(const ArchSpec &lhs, const ArchSpec &rhs);
+bool operator==(const ArchSpec &lhs, const ArchSpec &rhs);
+
+bool ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str, ArchSpec &arch);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_UTILITY_ARCHSPEC_H
diff --git a/linux-x64/clang/include/lldb/Utility/Args.h b/linux-x64/clang/include/lldb/Utility/Args.h
new file mode 100644
index 0000000..6f25849
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Args.h
@@ -0,0 +1,412 @@
+//===-- Args.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_ARGS_H
+#define LLDB_UTILITY_ARGS_H
+
+#include "lldb/Utility/Environment.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace lldb_private {
+
+/// \class Args Args.h "lldb/Utility/Args.h"
+/// A command line argument class.
+///
+/// The Args class is designed to be fed a command line. The command line is
+/// copied into an internal buffer and then split up into arguments. Arguments
+/// are space delimited if there are no quotes (single, double, or backtick
+/// quotes) surrounding the argument. Spaces can be escaped using a \
+/// character to avoid having to surround an argument that contains a space
+/// with quotes.
+class Args {
+public:
+ struct ArgEntry {
+ private:
+ friend class Args;
+ std::unique_ptr<char[]> ptr;
+
+ char *data() { return ptr.get(); }
+
+ public:
+ ArgEntry() = default;
+ ArgEntry(llvm::StringRef str, char quote);
+
+ llvm::StringRef ref;
+ char quote;
+ const char *c_str() const { return ptr.get(); }
+
+ /// Returns true if this argument was quoted in any way.
+ bool IsQuoted() const { return quote != '\0'; }
+ };
+
+ /// Construct with an option command string.
+ ///
+ /// \param[in] command
+ /// A NULL terminated command that will be copied and split up
+ /// into arguments.
+ ///
+ /// \see Args::SetCommandString(llvm::StringRef)
+ Args(llvm::StringRef command = llvm::StringRef());
+
+ Args(const Args &rhs);
+ explicit Args(const StringList &list);
+
+ Args &operator=(const Args &rhs);
+
+ /// Destructor.
+ ~Args();
+
+ explicit Args(const Environment &env) : Args() {
+ SetArguments(const_cast<const char **>(env.getEnvp().get()));
+ }
+
+ explicit operator Environment() const { return GetConstArgumentVector(); }
+
+ /// Dump all entries to the stream \a s using label \a label_name.
+ ///
+ /// If label_name is nullptr, the dump operation is skipped.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump all arguments in the argument
+ /// vector.
+ /// \param[in] label_name
+ /// The label_name to use as the label printed for each
+ /// entry of the args like so:
+ /// {label_name}[{index}]={value}
+ void Dump(Stream &s, const char *label_name = "argv") const;
+
+ /// Sets the command string contained by this object.
+ ///
+ /// The command string will be copied and split up into arguments that can
+ /// be accessed via the accessor functions.
+ ///
+ /// \param[in] command
+ /// A command StringRef that will be copied and split up
+ /// into arguments.
+ ///
+ /// \see Args::GetArgumentCount() const
+ /// \see Args::GetArgumentAtIndex (size_t) const @see
+ /// Args::GetArgumentVector () \see Args::Shift () \see Args::Unshift (const
+ /// char *)
+ void SetCommandString(llvm::StringRef command);
+
+ bool GetCommandString(std::string &command) const;
+
+ bool GetQuotedCommandString(std::string &command) const;
+
+ /// Gets the number of arguments left in this command object.
+ ///
+ /// \return
+ /// The number or arguments in this object.
+ size_t GetArgumentCount() const;
+ bool empty() const { return GetArgumentCount() == 0; }
+
+ /// Gets the NULL terminated C string argument pointer for the argument at
+ /// index \a idx.
+ ///
+ /// \return
+ /// The NULL terminated C string argument pointer if \a idx is a
+ /// valid argument index, NULL otherwise.
+ const char *GetArgumentAtIndex(size_t idx) const;
+
+ llvm::ArrayRef<ArgEntry> entries() const { return m_entries; }
+ char GetArgumentQuoteCharAtIndex(size_t idx) const;
+
+ using const_iterator = std::vector<ArgEntry>::const_iterator;
+
+ const_iterator begin() const { return m_entries.begin(); }
+ const_iterator end() const { return m_entries.end(); }
+
+ size_t size() const { return GetArgumentCount(); }
+ const ArgEntry &operator[](size_t n) const { return m_entries[n]; }
+
+ /// Gets the argument vector.
+ ///
+ /// The value returned by this function can be used by any function that
+ /// takes and vector. The return value is just like \a argv in the standard
+ /// C entry point function:
+ /// \code
+ /// int main (int argc, const char **argv);
+ /// \endcode
+ ///
+ /// \return
+ /// An array of NULL terminated C string argument pointers that
+ /// also has a terminating NULL C string pointer
+ char **GetArgumentVector();
+
+ /// Gets the argument vector.
+ ///
+ /// The value returned by this function can be used by any function that
+ /// takes and vector. The return value is just like \a argv in the standard
+ /// C entry point function:
+ /// \code
+ /// int main (int argc, const char **argv);
+ /// \endcode
+ ///
+ /// \return
+ /// An array of NULL terminate C string argument pointers that
+ /// also has a terminating NULL C string pointer
+ 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
+ /// The new argument as a NULL terminated C string.
+ ///
+ /// \param[in] quote_char
+ /// If the argument was originally quoted, put in the quote char here.
+ void AppendArgument(llvm::StringRef arg_str, char quote_char = '\0');
+
+ void AppendArguments(const Args &rhs);
+
+ void AppendArguments(const char **argv);
+
+ /// Insert the argument value at index \a idx to \a arg_cstr.
+ ///
+ /// \param[in] idx
+ /// The index of where to insert the argument.
+ ///
+ /// \param[in] arg_cstr
+ /// The new argument as a NULL terminated C string.
+ ///
+ /// \param[in] quote_char
+ /// If the argument was originally quoted, put in the quote char here.
+ ///
+ /// \return
+ /// The NULL terminated C string of the copy of \a arg_cstr.
+ void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str,
+ char quote_char = '\0');
+
+ /// Replaces the argument value at index \a idx to \a arg_cstr if \a idx is
+ /// a valid argument index.
+ ///
+ /// \param[in] idx
+ /// The index of the argument that will have its value replaced.
+ ///
+ /// \param[in] arg_cstr
+ /// The new argument as a NULL terminated C string.
+ ///
+ /// \param[in] quote_char
+ /// If the argument was originally quoted, put in the quote char here.
+ void ReplaceArgumentAtIndex(size_t idx, llvm::StringRef arg_str,
+ char quote_char = '\0');
+
+ /// Deletes the argument value at index
+ /// if \a idx is a valid argument index.
+ ///
+ /// \param[in] idx
+ /// The index of the argument that will have its value replaced.
+ ///
+ void DeleteArgumentAtIndex(size_t idx);
+
+ /// Sets the argument vector value, optionally copying all arguments into an
+ /// internal buffer.
+ ///
+ /// Sets the arguments to match those found in \a argv. All argument strings
+ /// will be copied into an internal buffers.
+ //
+ // FIXME: Handle the quote character somehow.
+ void SetArguments(size_t argc, const char **argv);
+
+ void SetArguments(const char **argv);
+
+ /// Shifts the first argument C string value of the array off the argument
+ /// array.
+ ///
+ /// The string value will be freed, so a copy of the string should be made
+ /// by calling Args::GetArgumentAtIndex (size_t) const first and copying the
+ /// returned value before calling Args::Shift().
+ ///
+ /// \see Args::GetArgumentAtIndex (size_t) const
+ void Shift();
+
+ /// Inserts a class owned copy of \a arg_cstr at the beginning of the
+ /// argument vector.
+ ///
+ /// A copy \a arg_cstr will be made.
+ ///
+ /// \param[in] arg_cstr
+ /// The argument to push on the front of the argument stack.
+ ///
+ /// \param[in] quote_char
+ /// If the argument was originally quoted, put in the quote char here.
+ void Unshift(llvm::StringRef arg_str, char quote_char = '\0');
+
+ // Clear the arguments.
+ //
+ // For re-setting or blanking out the list of arguments.
+ void Clear();
+
+ static const char *StripSpaces(std::string &s, bool leading = true,
+ bool trailing = true,
+ bool return_null_if_empty = true);
+
+ static bool UInt64ValueIsValidForByteSize(uint64_t uval64,
+ size_t total_byte_size) {
+ if (total_byte_size > 8)
+ return false;
+
+ if (total_byte_size == 8)
+ return true;
+
+ const uint64_t max = (static_cast<uint64_t>(1)
+ << static_cast<uint64_t>(total_byte_size * 8)) -
+ 1;
+ return uval64 <= max;
+ }
+
+ static bool SInt64ValueIsValidForByteSize(int64_t sval64,
+ size_t total_byte_size) {
+ if (total_byte_size > 8)
+ return false;
+
+ if (total_byte_size == 8)
+ return true;
+
+ const int64_t max = (static_cast<int64_t>(1)
+ << static_cast<uint64_t>(total_byte_size * 8 - 1)) -
+ 1;
+ const int64_t min = ~(max);
+ return min <= sval64 && sval64 <= max;
+ }
+
+ static lldb::Encoding
+ StringToEncoding(llvm::StringRef s,
+ lldb::Encoding fail_value = lldb::eEncodingInvalid);
+
+ static uint32_t StringToGenericRegister(llvm::StringRef s);
+
+ static const char *GetShellSafeArgument(const FileSpec &shell,
+ const char *unsafe_arg,
+ std::string &safe_arg);
+
+ // EncodeEscapeSequences will change the textual representation of common
+ // escape sequences like "\n" (two characters) into a single '\n'. It does
+ // this for all of the supported escaped sequences and for the \0ooo (octal)
+ // and \xXX (hex). The resulting "dst" string will contain the character
+ // versions of all supported escape sequences. The common supported escape
+ // sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\\".
+
+ static void EncodeEscapeSequences(const char *src, std::string &dst);
+
+ // ExpandEscapeSequences will change a string of possibly non-printable
+ // characters and expand them into text. So '\n' will turn into two
+ // characters like "\n" which is suitable for human reading. When a character
+ // is not printable and isn't one of the common in escape sequences listed in
+ // the help for EncodeEscapeSequences, then it will be encoded as octal.
+ // Printable characters are left alone.
+ static void ExpandEscapedCharacters(const char *src, std::string &dst);
+
+ static std::string EscapeLLDBCommandArgument(const std::string &arg,
+ char quote_char);
+
+private:
+ std::vector<ArgEntry> m_entries;
+ std::vector<char *> m_argv;
+};
+
+/// \class OptionsWithRaw Args.h "lldb/Utility/Args.h"
+/// A pair of an option list with a 'raw' string as a suffix.
+///
+/// This class works similar to Args, but handles the case where we have a
+/// trailing string that shouldn't be interpreted as a list of arguments but
+/// preserved as is. It is also only useful for handling command line options
+/// (e.g. '-foo bar -i0') that start with a dash.
+///
+/// The leading option list is optional. If the first non-space character
+/// in the string starts with a dash, and the string contains an argument
+/// that is an unquoted double dash (' -- '), then everything up to the double
+/// dash is parsed as a list of arguments. Everything after the double dash
+/// is interpreted as the raw suffix string. Note that the space behind the
+/// double dash is not part of the raw suffix.
+///
+/// All strings not matching the above format as considered to be just a raw
+/// string without any options.
+///
+/// \see Args
+class OptionsWithRaw {
+public:
+ /// Parse the given string as a list of optional arguments with a raw suffix.
+ ///
+ /// See the class description for a description of the input format.
+ ///
+ /// \param[in] argument_string
+ /// The string that should be parsed.
+ explicit OptionsWithRaw(llvm::StringRef argument_string);
+
+ /// Returns true if there are any arguments before the raw suffix.
+ bool HasArgs() const { return m_has_args; }
+
+ /// Returns the list of arguments.
+ ///
+ /// You can only call this method if HasArgs returns true.
+ Args &GetArgs() {
+ assert(m_has_args);
+ return m_args;
+ }
+
+ /// Returns the list of arguments.
+ ///
+ /// You can only call this method if HasArgs returns true.
+ const Args &GetArgs() const {
+ assert(m_has_args);
+ return m_args;
+ }
+
+ /// Returns the part of the input string that was used for parsing the
+ /// argument list. This string also includes the double dash that is used
+ /// for separating the argument list from the suffix.
+ ///
+ /// You can only call this method if HasArgs returns true.
+ llvm::StringRef GetArgStringWithDelimiter() const {
+ assert(m_has_args);
+ return m_arg_string_with_delimiter;
+ }
+
+ /// Returns the part of the input string that was used for parsing the
+ /// argument list.
+ ///
+ /// You can only call this method if HasArgs returns true.
+ llvm::StringRef GetArgString() const {
+ assert(m_has_args);
+ return m_arg_string;
+ }
+
+ /// Returns the raw suffix part of the parsed string.
+ const std::string &GetRawPart() const { return m_suffix; }
+
+private:
+ void SetFromString(llvm::StringRef arg_string);
+
+ /// Keeps track if we have parsed and stored any arguments.
+ bool m_has_args = false;
+ Args m_args;
+ llvm::StringRef m_arg_string;
+ llvm::StringRef m_arg_string_with_delimiter;
+
+ // FIXME: This should be a StringRef, but some of the calling code expect a
+ // C string here so only a real std::string is possible.
+ std::string m_suffix;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_ARGS_H
diff --git a/linux-x64/clang/include/lldb/Utility/Baton.h b/linux-x64/clang/include/lldb/Utility/Baton.h
new file mode 100644
index 0000000..4050f2a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Baton.h
@@ -0,0 +1,74 @@
+//===-- Baton.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Baton_h_
+#define lldb_Baton_h_
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include <memory>
+
+namespace lldb_private {
+class Stream;
+}
+
+namespace lldb_private {
+
+/// \class Baton Baton.h "lldb/Core/Baton.h"
+/// A class designed to wrap callback batons so they can cleanup
+/// any acquired resources
+///
+/// This class is designed to be used by any objects that have a callback
+/// function that takes a baton where the baton might need to
+/// free/delete/close itself.
+///
+/// The default behavior is to not free anything. Subclasses can free any
+/// needed resources in their destructors.
+class Baton {
+public:
+ Baton() {}
+ virtual ~Baton() {}
+
+ virtual void *data() = 0;
+
+ virtual void GetDescription(Stream *s,
+ lldb::DescriptionLevel level) const = 0;
+};
+
+class UntypedBaton : public Baton {
+public:
+ UntypedBaton(void *Data) : m_data(Data) {}
+ ~UntypedBaton() override {
+ // The default destructor for an untyped baton does NOT attempt to clean up
+ // anything in m_data.
+ }
+
+ void *data() override { return m_data; }
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+
+ void *m_data; // Leave baton public for easy access
+};
+
+template <typename T> class TypedBaton : public Baton {
+public:
+ explicit TypedBaton(std::unique_ptr<T> Item) : Item(std::move(Item)) {}
+
+ T *getItem() { return Item.get(); }
+ const T *getItem() const { return Item.get(); }
+
+ void *data() override { return Item.get(); }
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const override {}
+
+protected:
+ std::unique_ptr<T> Item;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_Baton_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Broadcaster.h b/linux-x64/clang/include/lldb/Utility/Broadcaster.h
new file mode 100644
index 0000000..fe4d1ca
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Broadcaster.h
@@ -0,0 +1,558 @@
+//===-- Broadcaster.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_BROADCASTER_H
+#define LLDB_UTILITY_BROADCASTER_H
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+
+#include "llvm/ADT/SmallVector.h"
+
+#include <cstdint>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace lldb_private {
+class Broadcaster;
+class EventData;
+class Listener;
+class Stream;
+} // namespace lldb_private
+
+namespace lldb_private {
+
+/// lldb::BroadcastEventSpec
+///
+/// This class is used to specify a kind of event to register for. The
+/// Debugger maintains a list of BroadcastEventSpec's and when it is made
+class BroadcastEventSpec {
+public:
+ BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits)
+ : m_broadcaster_class(broadcaster_class), m_event_bits(event_bits) {}
+
+ ~BroadcastEventSpec() = default;
+
+ ConstString GetBroadcasterClass() const { return m_broadcaster_class; }
+
+ uint32_t GetEventBits() const { return m_event_bits; }
+
+ /// Tell whether this BroadcastEventSpec is contained in in_spec. That is:
+ /// (a) the two spec's share the same broadcaster class (b) the event bits of
+ /// this spec are wholly contained in those of in_spec.
+ bool IsContainedIn(const BroadcastEventSpec &in_spec) const {
+ if (m_broadcaster_class != in_spec.GetBroadcasterClass())
+ return false;
+ uint32_t in_bits = in_spec.GetEventBits();
+ if (in_bits == m_event_bits)
+ return true;
+
+ if ((m_event_bits & in_bits) != 0 && (m_event_bits & ~in_bits) == 0)
+ return true;
+
+ return false;
+ }
+
+ bool operator<(const BroadcastEventSpec &rhs) const;
+ BroadcastEventSpec &operator=(const BroadcastEventSpec &rhs);
+
+private:
+ ConstString m_broadcaster_class;
+ uint32_t m_event_bits;
+};
+
+class BroadcasterManager
+ : public std::enable_shared_from_this<BroadcasterManager> {
+public:
+ friend class Listener;
+
+protected:
+ BroadcasterManager();
+
+public:
+ /// Listeners hold onto weak pointers to their broadcaster managers. So they
+ /// must be made into shared pointers, which you do with
+ /// MakeBroadcasterManager.
+ static lldb::BroadcasterManagerSP MakeBroadcasterManager();
+
+ ~BroadcasterManager() = default;
+
+ uint32_t RegisterListenerForEvents(const lldb::ListenerSP &listener_sp,
+ const BroadcastEventSpec &event_spec);
+
+ bool UnregisterListenerForEvents(const lldb::ListenerSP &listener_sp,
+ const BroadcastEventSpec &event_spec);
+
+ lldb::ListenerSP
+ GetListenerForEventSpec(const BroadcastEventSpec &event_spec) const;
+
+ void SignUpListenersForBroadcaster(Broadcaster &broadcaster);
+
+ void RemoveListener(const lldb::ListenerSP &listener_sp);
+
+ void RemoveListener(Listener *listener);
+
+ void Clear();
+
+private:
+ typedef std::pair<BroadcastEventSpec, lldb::ListenerSP> event_listener_key;
+ typedef std::map<BroadcastEventSpec, lldb::ListenerSP> collection;
+ typedef std::set<lldb::ListenerSP> listener_collection;
+ collection m_event_map;
+ listener_collection m_listeners;
+
+ mutable std::recursive_mutex m_manager_mutex;
+
+ // A couple of comparator classes for find_if:
+
+ class BroadcasterClassMatches {
+ public:
+ BroadcasterClassMatches(ConstString broadcaster_class)
+ : m_broadcaster_class(broadcaster_class) {}
+
+ ~BroadcasterClassMatches() = default;
+
+ bool operator()(const event_listener_key &input) const {
+ return (input.first.GetBroadcasterClass() == m_broadcaster_class);
+ }
+
+ private:
+ ConstString m_broadcaster_class;
+ };
+
+ class BroadcastEventSpecMatches {
+ public:
+ BroadcastEventSpecMatches(const BroadcastEventSpec &broadcaster_spec)
+ : m_broadcaster_spec(broadcaster_spec) {}
+
+ ~BroadcastEventSpecMatches() = default;
+
+ bool operator()(const event_listener_key &input) const {
+ return (input.first.IsContainedIn(m_broadcaster_spec));
+ }
+
+ private:
+ BroadcastEventSpec m_broadcaster_spec;
+ };
+
+ class ListenerMatchesAndSharedBits {
+ public:
+ explicit ListenerMatchesAndSharedBits(
+ const BroadcastEventSpec &broadcaster_spec,
+ const lldb::ListenerSP &listener_sp)
+ : m_broadcaster_spec(broadcaster_spec), m_listener_sp(listener_sp) {}
+
+ ~ListenerMatchesAndSharedBits() = default;
+
+ bool operator()(const event_listener_key &input) const {
+ return (input.first.GetBroadcasterClass() ==
+ m_broadcaster_spec.GetBroadcasterClass() &&
+ (input.first.GetEventBits() &
+ m_broadcaster_spec.GetEventBits()) != 0 &&
+ input.second == m_listener_sp);
+ }
+
+ private:
+ BroadcastEventSpec m_broadcaster_spec;
+ const lldb::ListenerSP m_listener_sp;
+ };
+
+ class ListenerMatches {
+ public:
+ explicit ListenerMatches(const lldb::ListenerSP &in_listener_sp)
+ : m_listener_sp(in_listener_sp) {}
+
+ ~ListenerMatches() = default;
+
+ bool operator()(const event_listener_key &input) const {
+ if (input.second == m_listener_sp)
+ return true;
+
+ return false;
+ }
+
+ private:
+ const lldb::ListenerSP m_listener_sp;
+ };
+
+ class ListenerMatchesPointer {
+ public:
+ ListenerMatchesPointer(const Listener *in_listener)
+ : m_listener(in_listener) {}
+
+ ~ListenerMatchesPointer() = default;
+
+ bool operator()(const event_listener_key &input) const {
+ if (input.second.get() == m_listener)
+ return true;
+
+ return false;
+ }
+
+ bool operator()(const lldb::ListenerSP &input) const {
+ if (input.get() == m_listener)
+ return true;
+
+ return false;
+ }
+
+ private:
+ const Listener *m_listener;
+ };
+};
+
+/// \class Broadcaster Broadcaster.h "lldb/Utility/Broadcaster.h" An event
+/// broadcasting class.
+///
+/// The Broadcaster class is designed to be subclassed by objects that wish to
+/// vend events in a multi-threaded environment. Broadcaster objects can each
+/// vend 32 events. Each event is represented by a bit in a 32 bit value and
+/// these bits can be set:
+/// \see Broadcaster::SetEventBits(uint32_t)
+/// or cleared:
+/// \see Broadcaster::ResetEventBits(uint32_t)
+/// When an event gets set the Broadcaster object will notify the Listener
+/// object that is listening for the event (if there is one).
+///
+/// Subclasses should provide broadcast bit definitions for any events they
+/// vend, typically using an enumeration:
+/// \code
+/// class Foo : public Broadcaster
+/// {
+/// public:
+/// // Broadcaster event bits definitions.
+/// enum
+/// {
+/// eBroadcastBitOne = (1 << 0),
+/// eBroadcastBitTwo = (1 << 1),
+/// eBroadcastBitThree = (1 << 2),
+/// ...
+/// };
+/// \endcode
+class Broadcaster {
+ friend class Listener;
+ friend class Event;
+
+public:
+ /// Construct with a broadcaster with a name.
+ ///
+ /// \param[in] name
+ /// A NULL terminated C string that contains the name of the
+ /// broadcaster object.
+ Broadcaster(lldb::BroadcasterManagerSP manager_sp, const char *name);
+
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class gets subclassed.
+ virtual ~Broadcaster();
+
+ void CheckInWithManager();
+
+ /// Broadcast an event which has no associated data.
+ ///
+ /// \param[in] event_type
+ /// The element from the enum defining this broadcaster's events
+ /// that is being broadcast.
+ ///
+ /// \param[in] event_data
+ /// User event data that will be owned by the lldb::Event that
+ /// is created internally.
+ ///
+ /// \param[in] unique
+ /// If true, then only add an event of this type if there isn't
+ /// one already in the queue.
+ ///
+ void BroadcastEvent(lldb::EventSP &event_sp) {
+ m_broadcaster_sp->BroadcastEvent(event_sp);
+ }
+
+ void BroadcastEventIfUnique(lldb::EventSP &event_sp) {
+ m_broadcaster_sp->BroadcastEventIfUnique(event_sp);
+ }
+
+ void BroadcastEvent(uint32_t event_type,
+ const lldb::EventDataSP &event_data_sp) {
+ m_broadcaster_sp->BroadcastEvent(event_type, event_data_sp);
+ }
+
+ void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr) {
+ m_broadcaster_sp->BroadcastEvent(event_type, event_data);
+ }
+
+ void BroadcastEventIfUnique(uint32_t event_type,
+ EventData *event_data = nullptr) {
+ m_broadcaster_sp->BroadcastEventIfUnique(event_type, event_data);
+ }
+
+ void Clear() { m_broadcaster_sp->Clear(); }
+
+ virtual void AddInitialEventsToListener(const lldb::ListenerSP &listener_sp,
+ uint32_t requested_events);
+
+ /// Listen for any events specified by \a event_mask.
+ ///
+ /// Only one listener can listen to each event bit in a given Broadcaster.
+ /// Once a listener has acquired an event bit, no other broadcaster will
+ /// have access to it until it is relinquished by the first listener that
+ /// gets it. The actual event bits that get acquired by \a listener may be
+ /// different from what is requested in \a event_mask, and to track this the
+ /// actual event bits that are acquired get returned.
+ ///
+ /// \param[in] listener
+ /// The Listener object that wants to monitor the events that
+ /// get broadcast by this object.
+ ///
+ /// \param[in] event_mask
+ /// A bit mask that indicates which events the listener is
+ /// asking to monitor.
+ ///
+ /// \return
+ /// The actual event bits that were acquired by \a listener.
+ uint32_t AddListener(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask) {
+ return m_broadcaster_sp->AddListener(listener_sp, event_mask);
+ }
+
+ /// Get the NULL terminated C string name of this Broadcaster object.
+ ///
+ /// \return
+ /// The NULL terminated C string name of this Broadcaster.
+ ConstString GetBroadcasterName() { return m_broadcaster_name; }
+
+ /// Get the event name(s) for one or more event bits.
+ ///
+ /// \param[in] event_mask
+ /// A bit mask that indicates which events to get names for.
+ ///
+ /// \return
+ /// The NULL terminated C string name of this Broadcaster.
+ bool GetEventNames(Stream &s, const uint32_t event_mask,
+ bool prefix_with_broadcaster_name) const {
+ return m_broadcaster_sp->GetEventNames(s, event_mask,
+ prefix_with_broadcaster_name);
+ }
+
+ /// Set the name for an event bit.
+ ///
+ /// \param[in] event_mask
+ /// A bit mask that indicates which events the listener is
+ /// asking to monitor.
+ ///
+ /// \return
+ /// The NULL terminated C string name of this Broadcaster.
+ void SetEventName(uint32_t event_mask, const char *name) {
+ m_broadcaster_sp->SetEventName(event_mask, name);
+ }
+
+ const char *GetEventName(uint32_t event_mask) const {
+ return m_broadcaster_sp->GetEventName(event_mask);
+ }
+
+ bool EventTypeHasListeners(uint32_t event_type) {
+ return m_broadcaster_sp->EventTypeHasListeners(event_type);
+ }
+
+ /// Removes a Listener from this broadcasters list and frees the event bits
+ /// specified by \a event_mask that were previously acquired by \a listener
+ /// (assuming \a listener was listening to this object) for other listener
+ /// objects to use.
+ ///
+ /// \param[in] listener
+ /// A Listener object that previously called AddListener.
+ ///
+ /// \param[in] event_mask
+ /// The event bits \a listener wishes to relinquish.
+ ///
+ /// \return
+ /// \b True if the listener was listening to this broadcaster
+ /// and was removed, \b false otherwise.
+ ///
+ /// \see uint32_t Broadcaster::AddListener (Listener*, uint32_t)
+ bool RemoveListener(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask = UINT32_MAX) {
+ return m_broadcaster_sp->RemoveListener(listener_sp, event_mask);
+ }
+
+ /// Provides a simple mechanism to temporarily redirect events from
+ /// broadcaster. When you call this function passing in a listener and
+ /// event type mask, all events from the broadcaster matching the mask will
+ /// now go to the hijacking listener. Only one hijack can occur at a time.
+ /// If we need more than this we will have to implement a Listener stack.
+ ///
+ /// \param[in] listener
+ /// A Listener object. You do not need to call StartListeningForEvents
+ /// for this broadcaster (that would fail anyway since the event bits
+ /// would most likely be taken by the listener(s) you are usurping.
+ ///
+ /// \param[in] event_mask
+ /// The event bits \a listener wishes to hijack.
+ ///
+ /// \return
+ /// \b True if the event mask could be hijacked, \b false otherwise.
+ ///
+ /// \see uint32_t Broadcaster::AddListener (Listener*, uint32_t)
+ bool HijackBroadcaster(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask = UINT32_MAX) {
+ return m_broadcaster_sp->HijackBroadcaster(listener_sp, event_mask);
+ }
+
+ bool IsHijackedForEvent(uint32_t event_mask) {
+ return m_broadcaster_sp->IsHijackedForEvent(event_mask);
+ }
+
+ /// Restore the state of the Broadcaster from a previous hijack attempt.
+ void RestoreBroadcaster() { m_broadcaster_sp->RestoreBroadcaster(); }
+
+ /// This needs to be filled in if you are going to register the broadcaster
+ /// with the broadcaster manager and do broadcaster class matching.
+ /// FIXME: Probably should make a ManagedBroadcaster subclass with all the
+ /// bits needed to work with the BroadcasterManager, so that it is clearer
+ /// how to add one.
+ virtual ConstString &GetBroadcasterClass() const;
+
+ lldb::BroadcasterManagerSP GetManager();
+
+protected:
+ /// BroadcasterImpl contains the actual Broadcaster implementation. The
+ /// Broadcaster makes a BroadcasterImpl which lives as long as it does. The
+ /// Listeners & the Events hold a weak pointer to the BroadcasterImpl, so
+ /// that they can survive if a Broadcaster they were listening to is
+ /// destroyed w/o their being able to unregister from it (which can happen if
+ /// the Broadcasters & Listeners are being destroyed on separate threads
+ /// simultaneously. The Broadcaster itself can't be shared out as a weak
+ /// pointer, because some things that are broadcasters (e.g. the Target and
+ /// the Process) are shared in their own right.
+ ///
+ /// For the most part, the Broadcaster functions dispatch to the
+ /// BroadcasterImpl, and are documented in the public Broadcaster API above.
+ class BroadcasterImpl {
+ friend class Listener;
+ friend class Broadcaster;
+
+ public:
+ BroadcasterImpl(Broadcaster &broadcaster);
+
+ ~BroadcasterImpl() = default;
+
+ void BroadcastEvent(lldb::EventSP &event_sp);
+
+ void BroadcastEventIfUnique(lldb::EventSP &event_sp);
+
+ void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr);
+
+ void BroadcastEvent(uint32_t event_type,
+ const lldb::EventDataSP &event_data_sp);
+
+ void BroadcastEventIfUnique(uint32_t event_type,
+ EventData *event_data = nullptr);
+
+ void Clear();
+
+ uint32_t AddListener(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask);
+
+ const char *GetBroadcasterName() const {
+ return m_broadcaster.GetBroadcasterName().AsCString();
+ }
+
+ Broadcaster *GetBroadcaster();
+
+ bool GetEventNames(Stream &s, const uint32_t event_mask,
+ bool prefix_with_broadcaster_name) const;
+
+ void SetEventName(uint32_t event_mask, const char *name) {
+ m_event_names[event_mask] = name;
+ }
+
+ const char *GetEventName(uint32_t event_mask) const {
+ const auto pos = m_event_names.find(event_mask);
+ if (pos != m_event_names.end())
+ return pos->second.c_str();
+ return nullptr;
+ }
+
+ bool EventTypeHasListeners(uint32_t event_type);
+
+ bool RemoveListener(lldb_private::Listener *listener,
+ uint32_t event_mask = UINT32_MAX);
+
+ bool RemoveListener(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask = UINT32_MAX);
+
+ bool HijackBroadcaster(const lldb::ListenerSP &listener_sp,
+ uint32_t event_mask = UINT32_MAX);
+
+ bool IsHijackedForEvent(uint32_t event_mask);
+
+ void RestoreBroadcaster();
+
+ protected:
+ void PrivateBroadcastEvent(lldb::EventSP &event_sp, bool unique);
+
+ const char *GetHijackingListenerName();
+
+ typedef llvm::SmallVector<std::pair<lldb::ListenerWP, uint32_t>, 4>
+ collection;
+ typedef std::map<uint32_t, std::string> event_names_map;
+
+ llvm::SmallVector<std::pair<lldb::ListenerSP, uint32_t &>, 4>
+ GetListeners();
+
+ /// The broadcaster that this implements.
+ Broadcaster &m_broadcaster;
+
+ /// Optionally define event names for readability and logging for each
+ /// event bit.
+ event_names_map m_event_names;
+
+ /// A list of Listener / event_mask pairs that are listening to this
+ /// broadcaster.
+ collection m_listeners;
+
+ /// A mutex that protects \a m_listeners.
+ std::recursive_mutex m_listeners_mutex;
+
+ /// A simple mechanism to intercept events from a broadcaster
+ std::vector<lldb::ListenerSP> m_hijacking_listeners;
+
+ /// At some point we may want to have a stack or Listener collections, but
+ /// for now this is just for private hijacking.
+ std::vector<uint32_t> m_hijacking_masks;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BroadcasterImpl);
+ };
+
+ typedef std::shared_ptr<BroadcasterImpl> BroadcasterImplSP;
+ typedef std::weak_ptr<BroadcasterImpl> BroadcasterImplWP;
+
+ BroadcasterImplSP GetBroadcasterImpl() { return m_broadcaster_sp; }
+
+ const char *GetHijackingListenerName() {
+ return m_broadcaster_sp->GetHijackingListenerName();
+ }
+
+private:
+ BroadcasterImplSP m_broadcaster_sp;
+ lldb::BroadcasterManagerSP m_manager_sp;
+
+ /// The name of this broadcaster object.
+ const ConstString m_broadcaster_name;
+
+ DISALLOW_COPY_AND_ASSIGN(Broadcaster);
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_BROADCASTER_H
diff --git a/linux-x64/clang/include/lldb/Utility/CleanUp.h b/linux-x64/clang/include/lldb/Utility/CleanUp.h
new file mode 100644
index 0000000..6cd5f33
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/CleanUp.h
@@ -0,0 +1,42 @@
+//===-- CleanUp.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CleanUp_h_
+#define liblldb_CleanUp_h_
+
+#include "lldb/lldb-public.h"
+#include <functional>
+
+namespace lldb_private {
+
+/// Run a cleanup function on scope exit unless it's explicitly disabled.
+class CleanUp {
+ std::function<void()> Clean;
+
+public:
+ /// Register a cleanup function which applies \p Func to a list of arguments.
+ /// Use caution with arguments which are references: they will be copied.
+ template <typename F, typename... Args>
+ CleanUp(F &&Func, Args &&... args)
+ : Clean(std::bind(std::forward<F>(Func), std::forward<Args>(args)...)) {}
+
+ ~CleanUp() {
+ if (Clean)
+ Clean();
+ }
+
+ /// Disable the cleanup.
+ void disable() { Clean = nullptr; }
+
+ // Prevent cleanups from being run more than once.
+ DISALLOW_COPY_AND_ASSIGN(CleanUp);
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_CleanUp_h_
diff --git a/linux-x64/clang/include/lldb/Utility/CompletionRequest.h b/linux-x64/clang/include/lldb/Utility/CompletionRequest.h
new file mode 100644
index 0000000..f5ccb01
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/CompletionRequest.h
@@ -0,0 +1,193 @@
+//===-- CompletionRequest.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_COMPLETIONREQUEST_H
+#define LLDB_UTILITY_COMPLETIONREQUEST_H
+
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/StringList.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
+
+namespace lldb_private {
+class CompletionResult {
+ /// A single completion and all associated data.
+ struct Completion {
+ Completion(llvm::StringRef completion, llvm::StringRef description)
+ : m_completion(completion.str()), m_descripton(description.str()) {}
+
+ std::string m_completion;
+ std::string m_descripton;
+
+ /// Generates a string that uniquely identifies this completion result.
+ std::string GetUniqueKey() const;
+ };
+ std::vector<Completion> m_results;
+
+ /// List of added completions so far. Used to filter out duplicates.
+ llvm::StringSet<> m_added_values;
+
+public:
+ void AddResult(llvm::StringRef completion, llvm::StringRef description);
+
+ /// Adds all collected completion matches to the given list.
+ /// The list will be cleared before the results are added. The number of
+ /// results here is guaranteed to be equal to GetNumberOfResults().
+ void GetMatches(StringList &matches) const;
+
+ /// Adds all collected completion descriptions to the given list.
+ /// The list will be cleared before the results are added. The number of
+ /// results here is guaranteed to be equal to GetNumberOfResults().
+ void GetDescriptions(StringList &descriptions) const;
+
+ std::size_t GetNumberOfResults() const { return m_results.size(); }
+};
+
+/// \class CompletionRequest CompletionRequest.h
+/// "lldb/Utility/ArgCompletionRequest.h"
+///
+/// Contains all information necessary to complete an incomplete command
+/// for the user. Will be filled with the generated completions by the different
+/// completions functions.
+///
+class CompletionRequest {
+public:
+ /// Constructs a completion request.
+ ///
+ /// \param [in] command_line
+ /// The command line the user has typed at this point.
+ ///
+ /// \param [in] raw_cursor_pos
+ /// The position of the cursor in the command line string. Index 0 means
+ /// the cursor is at the start of the line. The completion starts from
+ /// this cursor position.
+ ///
+ /// \param [in] match_start_point
+ /// \param [in] max_return_elements
+ /// If there is a match that is expensive to compute, these are here to
+ /// allow you to compute the completions in batches. Start the
+ /// completion from match_start_point, and return match_return_elements
+ /// elements.
+ ///
+ /// \param [out] result
+ /// The CompletionResult that will be filled with the results after this
+ /// request has been handled.
+ CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos,
+ int match_start_point, int max_return_elements,
+ CompletionResult &result);
+
+ llvm::StringRef GetRawLine() const { return m_command; }
+
+ unsigned GetRawCursorPos() const { return m_raw_cursor_pos; }
+
+ const Args &GetParsedLine() const { return m_parsed_line; }
+
+ Args &GetParsedLine() { return m_parsed_line; }
+
+ const Args &GetPartialParsedLine() const { return m_partial_parsed_line; }
+
+ void SetCursorIndex(int i) { m_cursor_index = i; }
+ int GetCursorIndex() const { return m_cursor_index; }
+
+ void SetCursorCharPosition(int pos) { m_cursor_char_position = pos; }
+ int GetCursorCharPosition() const { return m_cursor_char_position; }
+
+ int GetMatchStartPoint() const { return m_match_start_point; }
+
+ int GetMaxReturnElements() const { return m_max_return_elements; }
+
+ bool GetWordComplete() { return m_word_complete; }
+
+ void SetWordComplete(bool v) { m_word_complete = v; }
+
+ /// Adds a possible completion string. If the completion was already
+ /// suggested before, it will not be added to the list of results. A copy of
+ /// the suggested completion is stored, so the given string can be free'd
+ /// afterwards.
+ ///
+ /// \param match The suggested completion.
+ /// \param match An optional description of the completion string. The
+ /// description will be displayed to the user alongside the completion.
+ void AddCompletion(llvm::StringRef completion,
+ llvm::StringRef description = "") {
+ m_result.AddResult(completion, description);
+ }
+
+ /// Adds multiple possible completion strings.
+ ///
+ /// \param completions The list of completions.
+ ///
+ /// \see AddCompletion
+ void AddCompletions(const StringList &completions) {
+ for (std::size_t i = 0; i < completions.GetSize(); ++i)
+ AddCompletion(completions.GetStringAtIndex(i));
+ }
+
+ /// Adds multiple possible completion strings alongside their descriptions.
+ ///
+ /// The number of completions and descriptions must be identical.
+ ///
+ /// \param completions The list of completions.
+ /// \param completions The list of descriptions.
+ ///
+ /// \see AddCompletion
+ void AddCompletions(const StringList &completions,
+ const StringList &descriptions) {
+ lldbassert(completions.GetSize() == descriptions.GetSize());
+ for (std::size_t i = 0; i < completions.GetSize(); ++i)
+ AddCompletion(completions.GetStringAtIndex(i),
+ descriptions.GetStringAtIndex(i));
+ }
+
+ std::size_t GetNumberOfMatches() const {
+ return m_result.GetNumberOfResults();
+ }
+
+ llvm::StringRef GetCursorArgument() const {
+ return GetParsedLine().GetArgumentAtIndex(GetCursorIndex());
+ }
+
+ llvm::StringRef GetCursorArgumentPrefix() const {
+ return GetCursorArgument().substr(0, GetCursorCharPosition());
+ }
+
+private:
+ /// The raw command line we are supposed to complete.
+ llvm::StringRef m_command;
+ /// The cursor position in m_command.
+ unsigned m_raw_cursor_pos;
+ /// The command line parsed as arguments.
+ Args m_parsed_line;
+ /// The command line until the cursor position parsed as arguments.
+ Args m_partial_parsed_line;
+ /// The index of the argument in which the completion cursor is.
+ int m_cursor_index;
+ /// The cursor position in the argument indexed by m_cursor_index.
+ int m_cursor_char_position;
+ /// If there is a match that is expensive
+ /// to compute, these are here to allow you to compute the completions in
+ /// batches. Start the completion from \amatch_start_point, and return
+ /// \amatch_return_elements elements.
+ // FIXME: These two values are not implemented.
+ int m_match_start_point;
+ int m_max_return_elements;
+ /// \btrue if this is a complete option value (a space will be inserted
+ /// after the completion.) \bfalse otherwise.
+ bool m_word_complete = false;
+
+ /// The result this request is supposed to fill out.
+ /// We keep this object private to ensure that no backend can in any way
+ /// depend on already calculated completions (which would make debugging and
+ /// testing them much more complicated).
+ CompletionResult &m_result;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_COMPLETIONREQUEST_H
diff --git a/linux-x64/clang/include/lldb/Utility/Connection.h b/linux-x64/clang/include/lldb/Utility/Connection.h
new file mode 100644
index 0000000..77f3ef4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Connection.h
@@ -0,0 +1,183 @@
+//===-- Connection.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Connection_h_
+#define liblldb_Connection_h_
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <ratio>
+#include <string>
+
+#include <stddef.h>
+
+namespace lldb_private {
+class Status;
+template <typename Ratio> class Timeout;
+}
+
+namespace lldb_private {
+
+/// \class Connection Connection.h "lldb/Utility/Connection.h"
+/// A communication connection class.
+///
+/// A class that implements that actual communication functions for
+/// connecting/disconnecting, reading/writing, and waiting for bytes to become
+/// available from a two way communication connection.
+///
+/// This class is designed to only do very simple communication functions.
+/// Instances can be instantiated and given to a Communication class to
+/// perform communications where clients can listen for broadcasts, and
+/// perform other higher level communications.
+class Connection {
+public:
+ /// Default constructor
+ Connection() = default;
+
+ /// Virtual destructor since this class gets subclassed and handed to a
+ /// Communication object.
+ virtual ~Connection();
+
+ /// Connect using the connect string \a url.
+ ///
+ /// \param[in] url
+ /// A string that contains all information needed by the
+ /// subclass to connect to another client.
+ ///
+ /// \param[out] error_ptr
+ /// A pointer to an error object that should be given an
+ /// appropriate error value if this method returns false. This
+ /// value can be NULL if the error value should be ignored.
+ ///
+ /// \return
+ /// \b True if the connect succeeded, \b false otherwise. The
+ /// internal error object should be filled in with an
+ /// appropriate value based on the result of this function.
+ ///
+ /// \see Status& Communication::GetError ();
+ virtual lldb::ConnectionStatus Connect(llvm::StringRef url,
+ Status *error_ptr) = 0;
+
+ /// Disconnect the communications connection if one is currently connected.
+ ///
+ /// \param[out] error_ptr
+ /// A pointer to an error object that should be given an
+ /// appropriate error value if this method returns false. This
+ /// value can be NULL if the error value should be ignored.
+ ///
+ /// \return
+ /// \b True if the disconnect succeeded, \b false otherwise. The
+ /// internal error object should be filled in with an
+ /// appropriate value based on the result of this function.
+ ///
+ /// \see Status& Communication::GetError ();
+ virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0;
+
+ /// Check if the connection is valid.
+ ///
+ /// \return
+ /// \b True if this object is currently connected, \b false
+ /// otherwise.
+ virtual bool IsConnected() const = 0;
+
+ /// The read function that attempts to read from the connection.
+ ///
+ /// \param[in] dst
+ /// A destination buffer that must be at least \a dst_len bytes
+ /// long.
+ ///
+ /// \param[in] dst_len
+ /// The number of bytes to attempt to read, and also the max
+ /// number of bytes that can be placed into \a dst.
+ ///
+ /// \param[in] timeout
+ /// The number of microseconds to wait for the data.
+ ///
+ /// \param[out] status
+ /// On return, indicates whether the call was successful or terminated
+ /// due to some error condition.
+ ///
+ /// \param[out] error_ptr
+ /// A pointer to an error object that should be given an
+ /// appropriate error value if this method returns zero. This
+ /// value can be NULL if the error value should be ignored.
+ ///
+ /// \return
+ /// The number of bytes actually read.
+ ///
+ /// \see size_t Communication::Read (void *, size_t, uint32_t);
+ virtual size_t Read(void *dst, size_t dst_len,
+ const Timeout<std::micro> &timeout,
+ lldb::ConnectionStatus &status, Status *error_ptr) = 0;
+
+ /// The actual write function that attempts to write to the communications
+ /// protocol.
+ ///
+ /// Subclasses must override this function.
+ ///
+ /// \param[in] dst
+ /// A desination buffer that must be at least \a dst_len bytes
+ /// long.
+ ///
+ /// \param[in] dst_len
+ /// The number of bytes to attempt to write, and also the
+ /// number of bytes are currently available in \a dst.
+ ///
+ /// \param[out] error_ptr
+ /// A pointer to an error object that should be given an
+ /// appropriate error value if this method returns zero. This
+ /// value can be NULL if the error value should be ignored.
+ ///
+ /// \return
+ /// The number of bytes actually Written.
+ virtual size_t Write(const void *dst, size_t dst_len,
+ lldb::ConnectionStatus &status, Status *error_ptr) = 0;
+
+ /// Returns a URI that describes this connection object
+ ///
+ /// Subclasses may override this function.
+ ///
+ /// \return
+ /// Returns URI or an empty string if disconnecteds
+ virtual std::string GetURI() = 0;
+
+ /// Interrupts an ongoing Read() operation.
+ ///
+ /// If there is an ongoing read operation in another thread, this operation
+ /// return with status == eConnectionStatusInterrupted. Note that if there
+ /// data waiting to be read and an interrupt request is issued, the Read()
+ /// function will return the data immediately without processing the
+ /// interrupt request (which will remain queued for the next Read()
+ /// operation).
+ ///
+ /// \return
+ /// Returns true is the interrupt request was successful.
+ virtual bool InterruptRead() = 0;
+
+ /// Returns the underlying IOObject used by the Connection.
+ ///
+ /// The IOObject can be used to wait for data to become available on the
+ /// connection. If the Connection does not use IOObjects (and hence does not
+ /// support waiting) this function should return a null pointer.
+ ///
+ /// \return
+ /// The underlying IOObject used for reading.
+ virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
+
+private:
+ // For Connection only
+ DISALLOW_COPY_AND_ASSIGN(Connection);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Connection_h_
diff --git a/linux-x64/clang/include/lldb/Utility/ConstString.h b/linux-x64/clang/include/lldb/Utility/ConstString.h
new file mode 100644
index 0000000..8576c18
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/ConstString.h
@@ -0,0 +1,464 @@
+//===-- ConstString.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ConstString_h_
+#define liblldb_ConstString_h_
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FormatVariadic.h"
+
+#include <stddef.h>
+
+namespace lldb_private {
+class Stream;
+}
+namespace llvm {
+class raw_ostream;
+}
+
+namespace lldb_private {
+
+/// \class ConstString ConstString.h "lldb/Utility/ConstString.h"
+/// A uniqued constant string class.
+///
+/// Provides an efficient way to store strings as uniqued strings. After the
+/// strings are uniqued, finding strings that are equal to one another is very
+/// fast as just the pointers need to be compared. It also allows for many
+/// common strings from many different sources to be shared to keep the memory
+/// footprint low.
+///
+/// No reference counting is done on strings that are added to the string
+/// pool, once strings are added they are in the string pool for the life of
+/// the program.
+class ConstString {
+public:
+ /// Default constructor
+ ///
+ /// Initializes the string to an empty string.
+ ConstString() : m_string(nullptr) {}
+
+ /// Copy constructor
+ ///
+ /// Copies the string value in \a rhs into this object.
+ ///
+ /// \param[in] rhs
+ /// Another string object to copy.
+ ConstString(const ConstString &rhs) : m_string(rhs.m_string) {}
+
+ explicit ConstString(const llvm::StringRef &s);
+
+ /// Construct with C String value
+ ///
+ /// Constructs this object with a C string by looking to see if the
+ /// C string already exists in the global string pool. If it doesn't
+ /// exist, it is added to the string pool.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminated C string to add to the string pool.
+ explicit ConstString(const char *cstr);
+
+ /// Construct with C String value with max length
+ ///
+ /// Constructs this object with a C string with a length. If \a max_cstr_len
+ /// is greater than the actual length of the string, the string length will
+ /// be truncated. This allows substrings to be created without the need to
+ /// NULL terminate the string as it is passed into this function.
+ ///
+ /// \param[in] cstr
+ /// A pointer to the first character in the C string. The C
+ /// string can be NULL terminated in a buffer that contains
+ /// more characters than the length of the string, or the
+ /// string can be part of another string and a new substring
+ /// can be created.
+ ///
+ /// \param[in] max_cstr_len
+ /// The max length of \a cstr. If the string length of \a cstr
+ /// is less than \a max_cstr_len, then the string will be
+ /// truncated. If the string length of \a cstr is greater than
+ /// \a max_cstr_len, then only max_cstr_len bytes will be used
+ /// from \a cstr.
+ explicit ConstString(const char *cstr, size_t max_cstr_len);
+
+ /// Destructor
+ ///
+ /// Since constant string values are currently not reference counted, there
+ /// isn't much to do here.
+ ~ConstString() = default;
+
+ /// C string equality binary predicate function object for ConstString
+ /// objects.
+ struct StringIsEqual {
+ /// C equality test.
+ ///
+ /// Two C strings are equal when they are contained in ConstString objects
+ /// when their pointer values are equal to each other.
+ ///
+ /// \return
+ /// Returns \b true if the C string in \a lhs is equal to
+ /// the C string value in \a rhs, \b false otherwise.
+ bool operator()(const char *lhs, const char *rhs) const {
+ return lhs == rhs;
+ }
+ };
+
+ /// Convert to bool operator.
+ ///
+ /// This allows code to check a ConstString object to see if it contains a
+ /// valid string using code such as:
+ ///
+ /// \code
+ /// ConstString str(...);
+ /// if (str)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// /b True this object contains a valid non-empty C string, \b
+ /// false otherwise.
+ explicit operator bool() const { return !IsEmpty(); }
+
+ /// Assignment operator
+ ///
+ /// Assigns the string in this object with the value from \a rhs.
+ ///
+ /// \param[in] rhs
+ /// Another string object to copy into this object.
+ ///
+ /// \return
+ /// A const reference to this object.
+ ConstString operator=(ConstString rhs) {
+ m_string = rhs.m_string;
+ return *this;
+ }
+
+ /// Equal to operator
+ ///
+ /// Returns true if this string is equal to the string in \a rhs. This
+ /// operation is very fast as it results in a pointer comparison since all
+ /// strings are in a uniqued in a global string pool.
+ ///
+ /// \param[in] rhs
+ /// Another string object to compare this object to.
+ ///
+ /// \return
+ /// \li \b true if this object is equal to \a rhs.
+ /// \li \b false if this object is not equal to \a rhs.
+ bool operator==(ConstString rhs) const {
+ // We can do a pointer compare to compare these strings since they must
+ // come from the same pool in order to be equal.
+ return m_string == rhs.m_string;
+ }
+
+ /// Equal to operator against a non-ConstString value.
+ ///
+ /// Returns true if this string is equal to the string in \a rhs. This
+ /// overload is usually slower than comparing against a ConstString value.
+ /// However, if the rhs string not already a ConstString and it is impractical
+ /// to turn it into a non-temporary variable, then this overload is faster.
+ ///
+ /// \param[in] rhs
+ /// Another string object to compare this object to.
+ ///
+ /// \return
+ /// \li \b true if this object is equal to \a rhs.
+ /// \li \b false if this object is not equal to \a rhs.
+ bool operator==(const char *rhs) const {
+ // ConstString differentiates between empty strings and nullptr strings, but
+ // StringRef doesn't. Therefore we have to do this check manually now.
+ if (m_string == nullptr && rhs != nullptr)
+ return false;
+ if (m_string != nullptr && rhs == nullptr)
+ return false;
+
+ return GetStringRef() == rhs;
+ }
+
+ /// Not equal to operator
+ ///
+ /// Returns true if this string is not equal to the string in \a rhs. This
+ /// operation is very fast as it results in a pointer comparison since all
+ /// strings are in a uniqued in a global string pool.
+ ///
+ /// \param[in] rhs
+ /// Another string object to compare this object to.
+ ///
+ /// \return
+ /// \li \b true if this object is not equal to \a rhs.
+ /// \li \b false if this object is equal to \a rhs.
+ bool operator!=(ConstString rhs) const {
+ return m_string != rhs.m_string;
+ }
+
+ /// Not equal to operator against a non-ConstString value.
+ ///
+ /// Returns true if this string is not equal to the string in \a rhs. This
+ /// overload is usually slower than comparing against a ConstString value.
+ /// However, if the rhs string not already a ConstString and it is impractical
+ /// to turn it into a non-temporary variable, then this overload is faster.
+ ///
+ /// \param[in] rhs
+ /// Another string object to compare this object to.
+ ///
+ /// \return
+ /// \li \b true if this object is not equal to \a rhs.
+ /// \li \b false if this object is equal to \a rhs.
+ bool operator!=(const char *rhs) const { return !(*this == rhs); }
+
+ bool operator<(ConstString rhs) const;
+
+ /// Get the string value as a C string.
+ ///
+ /// Get the value of the contained string as a NULL terminated C string
+ /// value.
+ ///
+ /// If \a value_if_empty is nullptr, then nullptr will be returned.
+ ///
+ /// \return
+ /// Returns \a value_if_empty if the string is empty, otherwise
+ /// the C string value contained in this object.
+ const char *AsCString(const char *value_if_empty = nullptr) const {
+ return (IsEmpty() ? value_if_empty : m_string);
+ }
+
+ /// Get the string value as a llvm::StringRef
+ ///
+ /// \return
+ /// Returns a new llvm::StringRef object filled in with the
+ /// needed data.
+ llvm::StringRef GetStringRef() const {
+ return llvm::StringRef(m_string, GetLength());
+ }
+
+ /// Get the string value as a C string.
+ ///
+ /// Get the value of the contained string as a NULL terminated C string
+ /// value. Similar to the ConstString::AsCString() function, yet this
+ /// function will always return nullptr if the string is not valid. So this
+ /// function is a direct accessor to the string pointer value.
+ ///
+ /// \return
+ /// Returns nullptr the string is invalid, otherwise the C string
+ /// value contained in this object.
+ const char *GetCString() const { return m_string; }
+
+ /// Get the length in bytes of string value.
+ ///
+ /// The string pool stores the length of the string, so we can avoid calling
+ /// strlen() on the pointer value with this function.
+ ///
+ /// \return
+ /// Returns the number of bytes that this string occupies in
+ /// memory, not including the NULL termination byte.
+ size_t GetLength() const;
+
+ /// Clear this object's state.
+ ///
+ /// Clear any contained string and reset the value to the empty string
+ /// value.
+ void Clear() { m_string = nullptr; }
+
+ /// Equal to operator
+ ///
+ /// Returns true if this string is equal to the string in \a rhs. If case
+ /// sensitive equality is tested, this operation is very fast as it results
+ /// in a pointer comparison since all strings are in a uniqued in a global
+ /// string pool.
+ ///
+ /// \param[in] rhs
+ /// The Left Hand Side const ConstString object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const ConstString object reference.
+ ///
+ /// \param[in] case_sensitive
+ /// Case sensitivity. If true, case sensitive equality
+ /// will be tested, otherwise character case will be ignored
+ ///
+ /// \return
+ /// \li \b true if this object is equal to \a rhs.
+ /// \li \b false if this object is not equal to \a rhs.
+ static bool Equals(ConstString lhs, ConstString rhs,
+ const bool case_sensitive = true);
+
+ /// Compare two string objects.
+ ///
+ /// Compares the C string values contained in \a lhs and \a rhs and returns
+ /// an integer result.
+ ///
+ /// NOTE: only call this function when you want a true string
+ /// comparison. If you want string equality use the, use the == operator as
+ /// it is much more efficient. Also if you want string inequality, use the
+ /// != operator for the same reasons.
+ ///
+ /// \param[in] lhs
+ /// The Left Hand Side const ConstString object reference.
+ ///
+ /// \param[in] rhs
+ /// The Right Hand Side const ConstString object reference.
+ ///
+ /// \param[in] case_sensitive
+ /// Case sensitivity of compare. If true, case sensitive compare
+ /// will be performed, otherwise character case will be ignored
+ ///
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
+ static int Compare(ConstString lhs, ConstString rhs,
+ const bool case_sensitive = true);
+
+ /// Dump the object description to a stream.
+ ///
+ /// Dump the string value to the stream \a s. If the contained string is
+ /// empty, print \a value_if_empty to the stream instead. If \a
+ /// value_if_empty is nullptr, then nothing will be dumped to the stream.
+ ///
+ /// \param[in] s
+ /// The stream that will be used to dump the object description.
+ ///
+ /// \param[in] value_if_empty
+ /// The value to dump if the string is empty. If nullptr, nothing
+ /// will be output to the stream.
+ void Dump(Stream *s, const char *value_if_empty = nullptr) const;
+
+ /// Dump the object debug description to a stream.
+ ///
+ /// \param[in] s
+ /// The stream that will be used to dump the object description.
+ void DumpDebug(Stream *s) const;
+
+ /// Test for empty string.
+ ///
+ /// \return
+ /// \li \b true if the contained string is empty.
+ /// \li \b false if the contained string is not empty.
+ bool IsEmpty() const { return m_string == nullptr || m_string[0] == '\0'; }
+
+ /// Test for null string.
+ ///
+ /// \return
+ /// \li \b true if there is no string associated with this instance.
+ /// \li \b false if there is a string associated with this instance.
+ bool IsNull() const { return m_string == nullptr; }
+
+ /// Set the C string value.
+ ///
+ /// Set the string value in the object by uniquing the \a cstr string value
+ /// in our global string pool.
+ ///
+ /// If the C string already exists in the global string pool, it finds the
+ /// current entry and returns the existing value. If it doesn't exist, it is
+ /// added to the string pool.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminated C string to add to the string pool.
+ void SetCString(const char *cstr);
+
+ void SetString(const llvm::StringRef &s);
+
+ /// Set the C string value and its mangled counterpart.
+ ///
+ /// Object files and debug symbols often use mangled string to represent the
+ /// linkage name for a symbol, function or global. The string pool can
+ /// efficiently store these values and their counterparts so when we run
+ /// into another instance of a mangled name, we can avoid calling the name
+ /// demangler over and over on the same strings and then trying to unique
+ /// them.
+ ///
+ /// \param[in] demangled
+ /// The demangled string to correlate with the \a mangled name.
+ ///
+ /// \param[in] mangled
+ /// The already uniqued mangled ConstString to correlate the
+ /// soon to be uniqued version of \a demangled.
+ void SetStringWithMangledCounterpart(llvm::StringRef demangled,
+ ConstString mangled);
+
+ /// Retrieve the mangled or demangled counterpart for a mangled or demangled
+ /// ConstString.
+ ///
+ /// Object files and debug symbols often use mangled string to represent the
+ /// linkage name for a symbol, function or global. The string pool can
+ /// efficiently store these values and their counterparts so when we run
+ /// into another instance of a mangled name, we can avoid calling the name
+ /// demangler over and over on the same strings and then trying to unique
+ /// them.
+ ///
+ /// \param[in] counterpart
+ /// A reference to a ConstString object that might get filled in
+ /// with the demangled/mangled counterpart.
+ ///
+ /// \return
+ /// /b True if \a counterpart was filled in with the counterpart
+ /// /b false otherwise.
+ bool GetMangledCounterpart(ConstString &counterpart) const;
+
+ /// Set the C string value with length.
+ ///
+ /// Set the string value in the object by uniquing \a cstr_len bytes
+ /// starting at the \a cstr string value in our global string pool. If trim
+ /// is true, then \a cstr_len indicates a maximum length of the CString and
+ /// if the actual length of the string is less, then it will be trimmed.
+ ///
+ /// If the C string already exists in the global string pool, it finds the
+ /// current entry and returns the existing value. If it doesn't exist, it is
+ /// added to the string pool.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminated C string to add to the string pool.
+ ///
+ /// \param[in] cstr_len
+ /// The maximum length of the C string.
+ void SetCStringWithLength(const char *cstr, size_t cstr_len);
+
+ /// Set the C string value with the minimum length between \a fixed_cstr_len
+ /// and the actual length of the C string. This can be used for data
+ /// structures that have a fixed length to store a C string where the string
+ /// might not be NULL terminated if the string takes the entire buffer.
+ void SetTrimmedCStringWithLength(const char *cstr, size_t fixed_cstr_len);
+
+ /// Get the memory cost of this object.
+ ///
+ /// Return the size in bytes that this object takes in memory. This returns
+ /// the size in bytes of this object, which does not include any the shared
+ /// string values it may refer to.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const { return sizeof(ConstString); }
+
+ /// Get the size in bytes of the current global string pool.
+ ///
+ /// Reports the size in bytes of all shared C string values, containers and
+ /// any other values as a byte size for the entire string pool.
+ ///
+ /// \return
+ /// The number of bytes that the global string pool occupies
+ /// in memory.
+ static size_t StaticMemorySize();
+
+protected:
+ // Member variables
+ const char *m_string;
+};
+
+/// Stream the string value \a str to the stream \a s
+Stream &operator<<(Stream &s, 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/linux-x64/clang/include/lldb/Utility/DataBuffer.h b/linux-x64/clang/include/lldb/Utility/DataBuffer.h
new file mode 100644
index 0000000..5235693
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/DataBuffer.h
@@ -0,0 +1,85 @@
+//===-- DataBuffer.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DataBuffer_h_
+#define liblldb_DataBuffer_h_
+#if defined(__cplusplus)
+
+#include <stdint.h>
+#include <string.h>
+
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace lldb_private {
+
+/// \class DataBuffer DataBuffer.h "lldb/Core/DataBuffer.h"
+/// A pure virtual protocol class for abstracted data buffers.
+///
+/// DataBuffer is an abstract class that gets packaged into a shared pointer
+/// that can use to implement various ways to store data (on the heap, memory
+/// mapped, cached inferior memory). It gets used by DataExtractor so many
+/// DataExtractor objects can share the same data and sub-ranges of that
+/// shared data, and the last object that contains a reference to the shared
+/// data will free it.
+///
+/// Subclasses can implement as many different constructors or member
+/// functions that allow data to be stored in the object's buffer prior to
+/// handing the shared data to clients that use these buffers.
+///
+/// All subclasses must override all of the pure virtual functions as they are
+/// used by clients to access the data. Having a common interface allows
+/// different ways of storing data, yet using it in one common way.
+///
+/// This class currently expects all data to be available without any extra
+/// calls being made, but we can modify it to optionally get data on demand
+/// with some extra function calls to load the data before it gets accessed.
+class DataBuffer {
+public:
+ /// Destructor
+ ///
+ /// The destructor is virtual as other classes will inherit from this class
+ /// and be downcast to the DataBuffer pure virtual interface. The virtual
+ /// destructor ensures that destructing the base class will destruct the
+ /// class that inherited from it correctly.
+ virtual ~DataBuffer() {}
+
+ /// Get a pointer to the data.
+ ///
+ /// \return
+ /// A pointer to the bytes owned by this object, or NULL if the
+ /// object contains no bytes.
+ virtual uint8_t *GetBytes() = 0;
+
+ /// Get a const pointer to the data.
+ ///
+ /// \return
+ /// A const pointer to the bytes owned by this object, or NULL
+ /// if the object contains no bytes.
+ virtual const uint8_t *GetBytes() const = 0;
+
+ /// Get the number of bytes in the data buffer.
+ ///
+ /// \return
+ /// The number of bytes this object currently contains.
+ virtual lldb::offset_t GetByteSize() const = 0;
+
+ llvm::ArrayRef<uint8_t> GetData() const {
+ return llvm::ArrayRef<uint8_t>(GetBytes(), GetByteSize());
+ }
+
+ llvm::MutableArrayRef<uint8_t> GetData() {
+ return llvm::MutableArrayRef<uint8_t>(GetBytes(), GetByteSize());
+ }
+};
+
+} // namespace lldb_private
+
+#endif /// #if defined(__cplusplus)
+#endif /// lldb_DataBuffer_h_
diff --git a/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h b/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h
new file mode 100644
index 0000000..2a64694
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h
@@ -0,0 +1,112 @@
+//===-- DataBufferHeap.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DataBufferHeap_h_
+#define liblldb_DataBufferHeap_h_
+
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <cstdint>
+#include <vector>
+
+namespace lldb_private {
+
+/// \class DataBufferHeap DataBufferHeap.h "lldb/Core/DataBufferHeap.h"
+/// A subclass of DataBuffer that stores a data buffer on the heap.
+///
+/// This class keeps its data in a heap based buffer that is owned by 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
+/// DataBufferLLVM, which can intelligently determine when memory mapping is
+/// optimal.
+class DataBufferHeap : public DataBuffer {
+public:
+ /// Default constructor
+ ///
+ /// Initializes the heap based buffer with no bytes.
+ DataBufferHeap();
+
+ /// Construct with size \a n and fill with \a ch.
+ ///
+ /// Initialize this class with \a n bytes and fills the buffer with \a ch.
+ ///
+ /// \param[in] n
+ /// The number of bytes that heap based buffer should contain.
+ ///
+ /// \param[in] ch
+ /// The character to use when filling the buffer initially.
+ DataBufferHeap(lldb::offset_t n, uint8_t ch);
+
+ /// Construct by making a copy of \a src_len bytes from \a src.
+ ///
+ /// \param[in] src
+ /// A pointer to the data to copy.
+ ///
+ /// \param[in] src_len
+ /// The number of bytes in \a src to copy.
+ DataBufferHeap(const void *src, lldb::offset_t src_len);
+
+ /// Destructor.
+ ///
+ /// Virtual destructor since this class inherits from a pure virtual base
+ /// class #DataBuffer.
+ ~DataBufferHeap() override;
+
+ /// \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;
+
+ /// Set the number of bytes in the data buffer.
+ ///
+ /// Sets the number of bytes that this object should be able to contain.
+ /// This can be used prior to copying data into the buffer. Note that this
+ /// zero-initializes up to \p byte_size bytes.
+ ///
+ /// \param[in] byte_size
+ /// The new size in bytes that this data buffer should attempt
+ /// to resize itself to.
+ ///
+ /// \return
+ /// The size in bytes after that this heap buffer was
+ /// successfully resized to.
+ lldb::offset_t SetByteSize(lldb::offset_t byte_size);
+
+ /// Makes a copy of the \a src_len bytes in \a src.
+ ///
+ /// Copies the data in \a src into an internal buffer.
+ ///
+ /// \param[in] src
+ /// A pointer to the data to copy.
+ ///
+ /// \param[in] src_len
+ /// The number of bytes in \a src to copy.
+ void CopyData(const void *src, lldb::offset_t src_len);
+ void CopyData(llvm::StringRef src) { CopyData(src.data(), src.size()); }
+
+ void AppendData(const void *src, uint64_t src_len);
+
+ void Clear();
+
+private:
+ // This object uses a std::vector<uint8_t> to store its data. This takes care
+ // of free the data when the object is deleted.
+ typedef std::vector<uint8_t> buffer_t; ///< Buffer type
+ buffer_t m_data; ///< The heap based buffer where data is stored
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DataBufferHeap_h_
diff --git a/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h b/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h
new file mode 100644
index 0000000..d4c1107
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h
@@ -0,0 +1,46 @@
+//===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_DATABUFFERLLVM_H
+#define LLDB_CORE_DATABUFFERLLVM_H
+
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/lldb-types.h"
+
+#include <memory>
+#include <stdint.h>
+
+namespace llvm {
+class WritableMemoryBuffer;
+class Twine;
+}
+
+namespace lldb_private {
+
+class FileSystem;
+class DataBufferLLVM : public DataBuffer {
+public:
+ ~DataBufferLLVM() override;
+
+ uint8_t *GetBytes() override;
+ const uint8_t *GetBytes() const override;
+ lldb::offset_t GetByteSize() const override;
+
+ char *GetChars() { return reinterpret_cast<char *>(GetBytes()); }
+
+private:
+ friend FileSystem;
+ /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid
+ /// pointer.
+ explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
+
+ std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
+};
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Utility/DataEncoder.h b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
new file mode 100644
index 0000000..19b7cef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
@@ -0,0 +1,343 @@
+//===-- DataEncoder.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_DataEncoder_h_
+#define liblldb_DataEncoder_h_
+
+#if defined(__cplusplus)
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+
+/// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data
+/// encoding class.
+///
+/// DataEncoder is a class that can encode binary data (swapping if needed) to
+/// a data buffer. The data buffer can be caller owned, or can be shared data
+/// that can be shared between multiple DataEncoder or DataEncoder instances.
+///
+/// \see DataBuffer
+class DataEncoder {
+public:
+ /// Default constructor.
+ ///
+ /// Initialize all members to a default empty state.
+ DataEncoder();
+
+ /// Construct with a buffer that is owned by the caller.
+ ///
+ /// This constructor allows us to use data that is owned by the caller. The
+ /// data must stay around as long as this object is valid.
+ ///
+ /// \param[in] data
+ /// A pointer to caller owned data.
+ ///
+ /// \param[in] data_length
+ /// The length in bytes of \a data.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \param[in] addr_size
+ /// A new address byte size value.
+ DataEncoder(void *data, uint32_t data_length, lldb::ByteOrder byte_order,
+ uint8_t addr_size);
+
+ /// Construct with shared data.
+ ///
+ /// Copies the data shared pointer which adds a reference to the contained
+ /// in \a data_sp. The shared data reference is reference counted to ensure
+ /// the data lives as long as anyone still has a valid shared pointer to the
+ /// data in \a data_sp.
+ ///
+ /// \param[in] data_sp
+ /// A shared pointer to data.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \param[in] addr_size
+ /// A new address byte size value.
+ DataEncoder(const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order,
+ uint8_t addr_size);
+
+ /// Destructor
+ ///
+ /// If this object contains a valid shared data reference, the reference
+ /// count on the data will be decremented, and if zero, the data will be
+ /// freed.
+ ~DataEncoder();
+
+ /// Clears the object state.
+ ///
+ /// Clears the object contents back to a default invalid state, and release
+ /// any references to shared data that this object may contain.
+ void Clear();
+
+ /// Get the current address size.
+ ///
+ /// Return the size in bytes of any address values this object will extract.
+ ///
+ /// \return
+ /// The size in bytes of address values that will be extracted.
+ uint8_t GetAddressByteSize() const { return m_addr_size; }
+
+ /// Get the number of bytes contained in this object.
+ ///
+ /// \return
+ /// The total number of bytes of data this object refers to.
+ size_t GetByteSize() const { return m_end - m_start; }
+
+ /// Get the data end pointer.
+ ///
+ /// \return
+ /// Returns a pointer to the next byte contained in this
+ /// object's data, or NULL of there is no data in this object.
+ uint8_t *GetDataEnd() { return m_end; }
+
+ const uint8_t *GetDataEnd() const { return m_end; }
+
+ /// Get the shared data offset.
+ ///
+ /// Get the offset of the first byte of data in the shared data (if any).
+ ///
+ /// \return
+ /// If this object contains shared data, this function returns
+ /// the offset in bytes into that shared data, zero otherwise.
+ size_t GetSharedDataOffset() const;
+
+ /// Get the current byte order value.
+ ///
+ /// \return
+ /// The current byte order value from this object's internal
+ /// state.
+ lldb::ByteOrder GetByteOrder() const { return m_byte_order; }
+
+ /// Get the data start pointer.
+ ///
+ /// \return
+ /// Returns a pointer to the first byte contained in this
+ /// object's data, or NULL of there is no data in this object.
+ uint8_t *GetDataStart() { return m_start; }
+
+ const uint8_t *GetDataStart() const { return m_start; }
+
+ /// Encode unsigned integer values into the data at \a offset.
+ ///
+ /// \param[in] offset
+ /// The offset within the contained data at which to put the
+ /// data.
+ ///
+ /// \param[in] value
+ /// The value to encode into the data.
+ ///
+ /// \return
+ /// The next offset in the bytes of this data if the data
+ /// was successfully encoded, UINT32_MAX if the encoding failed.
+ uint32_t PutU8(uint32_t offset, uint8_t value);
+
+ uint32_t PutU16(uint32_t offset, uint16_t value);
+
+ uint32_t PutU32(uint32_t offset, uint32_t value);
+
+ uint32_t PutU64(uint32_t offset, uint64_t value);
+
+ /// Encode an unsigned integer of size \a byte_size to \a offset.
+ ///
+ /// Encode a single integer value at \a offset and return the offset that
+ /// follows the newly encoded integer when the data is successfully encoded
+ /// into the existing data. There must be enough room in the data, else
+ /// UINT32_MAX will be returned to indicate that encoding failed.
+ ///
+ /// \param[in] offset
+ /// The offset within the contained data at which to put the
+ /// encoded integer.
+ ///
+ /// \param[in] byte_size
+ /// The size in byte of the integer to encode.
+ ///
+ /// \param[in] value
+ /// The integer value to write. The least significant bytes of
+ /// the integer value will be written if the size is less than
+ /// 8 bytes.
+ ///
+ /// \return
+ /// The next offset in the bytes of this data if the integer
+ /// was successfully encoded, UINT32_MAX if the encoding failed.
+ uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value);
+
+ /// Encode an arbitrary number of bytes.
+ ///
+ /// \param[in] offset
+ /// The offset in bytes into the contained data at which to
+ /// start encoding.
+ ///
+ /// \param[in] src
+ /// The buffer that contains the bytes to encode.
+ ///
+ /// \param[in] src_len
+ /// The number of bytes to encode.
+ ///
+ /// \return
+ /// The next valid offset within data if the put operation
+ /// was successful, else UINT32_MAX to indicate the put failed.
+ uint32_t PutData(uint32_t offset, const void *src, uint32_t src_len);
+
+ /// Encode an address in the existing buffer at \a offset bytes into the
+ /// buffer.
+ ///
+ /// Encode a single address (honoring the m_addr_size member) to the data
+ /// and return the next offset where subsequent data would go. pointed to by
+ /// \a offset_ptr. The size of the extracted address comes from the \a
+ /// m_addr_size member variable and should be set correctly prior to
+ /// extracting any address values.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The next valid offset within data if the put operation
+ /// was successful, else UINT32_MAX to indicate the put failed.
+ uint32_t PutAddress(uint32_t offset, lldb::addr_t addr);
+
+ /// Put a C string to \a offset.
+ ///
+ /// Encodes a C string into the existing data including the terminating
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// A pointer to the C string value in the data. If the offset
+ /// pointed to by \a offset_ptr is out of bounds, or if the
+ /// offset plus the length of the C string is out of bounds,
+ /// NULL will be returned.
+ uint32_t PutCString(uint32_t offset_ptr, const char *cstr);
+
+ lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; }
+
+ /// Set the address byte size.
+ ///
+ /// Set the size in bytes that will be used when extracting any address and
+ /// pointer values from data contained in this object.
+ ///
+ /// \param[in] addr_size
+ /// The size in bytes to use when extracting addresses.
+ void SetAddressByteSize(uint8_t addr_size) { m_addr_size = addr_size; }
+
+ /// Set data with a buffer that is caller owned.
+ ///
+ /// Use data that is owned by the caller when extracting values. The data
+ /// must stay around as long as this object, or any object that copies a
+ /// subset of this object's data, is valid. If \a bytes is NULL, or \a
+ /// length is zero, this object will contain no data.
+ ///
+ /// \param[in] bytes
+ /// A pointer to caller owned data.
+ ///
+ /// \param[in] length
+ /// The length in bytes of \a bytes.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \return
+ /// The number of bytes that this object now contains.
+ uint32_t SetData(void *bytes, uint32_t length, lldb::ByteOrder byte_order);
+
+ /// Adopt a subset of shared data in \a data_sp.
+ ///
+ /// Copies the data shared pointer which adds a reference to the contained
+ /// in \a data_sp. The shared data reference is reference counted to ensure
+ /// the data lives as long as anyone still has a valid shared pointer to the
+ /// data in \a data_sp. The byte order and address byte size settings remain
+ /// the same. If \a offset is not a valid offset in \a data_sp, then no
+ /// reference to the shared data will be added. If there are not \a length
+ /// bytes available in \a data starting at \a offset, the length will be
+ /// truncated to contains as many bytes as possible.
+ ///
+ /// \param[in] data_sp
+ /// A shared pointer to data.
+ ///
+ /// \param[in] offset
+ /// The offset into \a data_sp at which the subset starts.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the subset of \a data_sp.
+ ///
+ /// \return
+ /// The number of bytes that this object now contains.
+ uint32_t SetData(const lldb::DataBufferSP &data_sp, uint32_t offset = 0,
+ uint32_t length = UINT32_MAX);
+
+ /// Set the byte_order value.
+ ///
+ /// Sets the byte order of the data to extract. Extracted values will be
+ /// swapped if necessary when decoding.
+ ///
+ /// \param[in] byte_order
+ /// The byte order value to use when extracting data.
+ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
+
+ /// Test the validity of \a offset.
+ ///
+ /// \return
+ /// \b true if \a offset is a valid offset into the data in this
+ /// object, \b false otherwise.
+ bool ValidOffset(uint32_t offset) const { return offset < GetByteSize(); }
+
+ /// Test the availability of \a length bytes of data from \a offset.
+ ///
+ /// \return
+ /// \b true if \a offset is a valid offset and there are \a
+ /// length bytes available at that offset, \b false otherwise.
+ bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
+ return length <= BytesLeft(offset);
+ }
+
+ uint32_t BytesLeft(uint32_t offset) const {
+ const uint32_t size = GetByteSize();
+ if (size > offset)
+ return size - offset;
+ return 0;
+ }
+
+protected:
+ // Member variables
+ uint8_t *m_start; ///< A pointer to the first byte of data.
+ uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
+ 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
+ mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can
+ /// be shared among multiple instances
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(DataEncoder);
+};
+
+} // namespace lldb_private
+
+#endif // #if defined (__cplusplus)
+#endif // #ifndef liblldb_DataEncoder_h_
diff --git a/linux-x64/clang/include/lldb/Utility/DataExtractor.h b/linux-x64/clang/include/lldb/Utility/DataExtractor.h
new file mode 100644
index 0000000..74174b3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/DataExtractor.h
@@ -0,0 +1,1016 @@
+//===-- DataExtractor.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_DATAEXTRACTOR_H
+#define LLDB_UTILITY_DATAEXTRACTOR_H
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/ArrayRef.h"
+
+#include <cassert>
+#include <stdint.h>
+#include <string.h>
+
+namespace lldb_private {
+class Log;
+class Stream;
+}
+namespace llvm {
+template <typename T> class SmallVectorImpl;
+}
+
+
+namespace lldb_private {
+
+/// \class DataExtractor DataExtractor.h "lldb/Core/DataExtractor.h" An data
+/// extractor class.
+///
+/// DataExtractor is a class that can extract data (swapping if needed) from a
+/// data buffer. The data buffer can be caller owned, or can be shared data
+/// that can be shared between multiple DataExtractor instances. Multiple
+/// DataExtractor objects can share the same data, yet extract values in
+/// different address sizes and byte order modes. Each object can have a
+/// unique position in the shared data and extract data from different
+/// offsets.
+///
+/// \see DataBuffer
+class DataExtractor {
+public:
+ /// \typedef DataExtractor::Type
+ /// Type enumerations used in the dump routines.
+ enum Type {
+ TypeUInt8, ///< Format output as unsigned 8 bit integers
+ TypeChar, ///< Format output as characters
+ TypeUInt16, ///< Format output as unsigned 16 bit integers
+ TypeUInt32, ///< Format output as unsigned 32 bit integers
+ TypeUInt64, ///< Format output as unsigned 64 bit integers
+ TypePointer, ///< Format output as pointers
+ TypeULEB128, ///< Format output as ULEB128 numbers
+ TypeSLEB128 ///< Format output as SLEB128 numbers
+ };
+
+ /// Default constructor.
+ ///
+ /// Initialize all members to a default empty state.
+ DataExtractor();
+
+ /// Construct with a buffer that is owned by the caller.
+ ///
+ /// This constructor allows us to use data that is owned by the caller. The
+ /// data must stay around as long as this object is valid.
+ ///
+ /// \param[in] data
+ /// A pointer to caller owned data.
+ ///
+ /// \param[in] data_length
+ /// The length in bytes of \a data.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \param[in] addr_size
+ /// A new address byte size value.
+ ///
+ /// \param[in] target_byte_size
+ /// A size of a target byte in 8-bit host bytes
+ DataExtractor(const void *data, lldb::offset_t data_length,
+ lldb::ByteOrder byte_order, uint32_t addr_size,
+ uint32_t target_byte_size = 1);
+
+ /// Construct with shared data.
+ ///
+ /// Copies the data shared pointer which adds a reference to the contained
+ /// in \a data_sp. The shared data reference is reference counted to ensure
+ /// the data lives as long as anyone still has a valid shared pointer to the
+ /// data in \a data_sp.
+ ///
+ /// \param[in] data_sp
+ /// A shared pointer to data.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \param[in] addr_size
+ /// A new address byte size value.
+ ///
+ /// \param[in] target_byte_size
+ /// A size of a target byte in 8-bit host bytes
+ DataExtractor(const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order,
+ uint32_t addr_size, uint32_t target_byte_size = 1);
+
+ /// Construct with a subset of \a data.
+ ///
+ /// Initialize this object with a subset of the data bytes in \a data. If \a
+ /// data contains shared data, then a reference to the shared data will be
+ /// added to ensure the shared data stays around as long as any objects have
+ /// references to the shared data. The byte order value and the address size
+ /// settings are copied from \a data. If \a offset is not a valid offset in
+ /// \a data, then no reference to the shared data will be added. If there
+ /// are not \a length bytes available in \a data starting at \a offset, the
+ /// length will be truncated to contain as many bytes as possible.
+ ///
+ /// \param[in] data
+ /// Another DataExtractor object that contains data.
+ ///
+ /// \param[in] offset
+ /// The offset into \a data at which the subset starts.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the subset of data.
+ ///
+ /// \param[in] target_byte_size
+ /// A size of a target byte in 8-bit host bytes
+ DataExtractor(const DataExtractor &data, lldb::offset_t offset,
+ lldb::offset_t length, uint32_t target_byte_size = 1);
+
+ DataExtractor(const DataExtractor &rhs);
+
+ /// Assignment operator.
+ ///
+ /// Copies all data, byte order and address size settings from \a rhs into
+ /// this object. If \a rhs contains shared data, a reference to that shared
+ /// data will be added.
+ ///
+ /// \param[in] rhs
+ /// Another DataExtractor object to copy.
+ ///
+ /// \return
+ /// A const reference to this object.
+ const DataExtractor &operator=(const DataExtractor &rhs);
+
+ /// Destructor
+ ///
+ /// If this object contains a valid shared data reference, the reference
+ /// count on the data will be decremented, and if zero, the data will be
+ /// freed.
+ virtual ~DataExtractor();
+
+ uint32_t getTargetByteSize() const { return m_target_byte_size; }
+
+ /// Clears the object state.
+ ///
+ /// Clears the object contents back to a default invalid state, and release
+ /// any references to shared data that this object may contain.
+ void Clear();
+
+ /// Dumps the binary data as \a type objects to stream \a s (or to Log() if
+ /// \a s is nullptr) starting \a offset bytes into the data and stopping
+ /// after dumping \a length bytes. The offset into the data is displayed at
+ /// the beginning of each line and can be offset by base address \a
+ /// base_addr. \a num_per_line objects will be displayed on each line.
+ ///
+ /// \param[in] s
+ /// The stream to dump the output to. If nullptr the output will
+ /// be dumped to Log().
+ ///
+ /// \param[in] offset
+ /// The offset into the data at which to start dumping.
+ ///
+ /// \param[in] length
+ /// The number of bytes to dump.
+ ///
+ /// \param[in] base_addr
+ /// The base address that gets added to the offset displayed on
+ /// each line.
+ ///
+ /// \param[in] num_per_line
+ /// The number of \a type objects to display on each line.
+ ///
+ /// \param[in] type
+ /// The type of objects to use when dumping data from this
+ /// object. See DataExtractor::Type.
+ ///
+ /// \param[in] type_format
+ /// The optional format to use for the \a type objects. If this
+ /// is nullptr, the default format for the \a type will be used.
+ ///
+ /// \return
+ /// The offset at which dumping ended.
+ lldb::offset_t PutToLog(Log *log, lldb::offset_t offset,
+ lldb::offset_t length, uint64_t base_addr,
+ uint32_t num_per_line, Type type,
+ const char *type_format = nullptr) const;
+
+ /// Extract an arbitrary number of bytes in the specified byte order.
+ ///
+ /// Attemps to extract \a length bytes starting at \a offset bytes into this
+ /// data in the requested byte order (\a dst_byte_order) and place the
+ /// results in \a dst. \a dst must be at least \a length bytes long.
+ ///
+ /// \param[in] offset
+ /// The offset in bytes into the contained data at which to
+ /// start extracting.
+ ///
+ /// \param[in] length
+ /// The number of bytes to extract.
+ ///
+ /// \param[in] dst_byte_order
+ /// A byte order of the data that we want when the value in
+ /// copied to \a dst.
+ ///
+ /// \param[out] dst
+ /// The buffer that will receive the extracted value if there
+ /// are enough bytes available in the current data.
+ ///
+ /// \return
+ /// The number of bytes that were extracted which will be \a
+ /// length when the value is successfully extracted, or zero
+ /// if there aren't enough bytes at the specified offset.
+ size_t ExtractBytes(lldb::offset_t offset, lldb::offset_t length,
+ lldb::ByteOrder dst_byte_order, void *dst) const;
+
+ /// Extract an address from \a *offset_ptr.
+ ///
+ /// Extract a single address from the data and update the offset pointed to
+ /// by \a offset_ptr. The size of the extracted address comes from the \a
+ /// m_addr_size member variable and should be set correctly prior to
+ /// extracting any address values.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted address value.
+ uint64_t GetAddress(lldb::offset_t *offset_ptr) const;
+
+ uint64_t GetAddress_unchecked(lldb::offset_t *offset_ptr) const;
+
+ /// Get the current address size.
+ ///
+ /// Return the size in bytes of any address values this object will extract.
+ ///
+ /// \return
+ /// The size in bytes of address values that will be extracted.
+ uint32_t GetAddressByteSize() const { return m_addr_size; }
+
+ /// Get the number of bytes contained in this object.
+ ///
+ /// \return
+ /// The total number of bytes of data this object refers to.
+ uint64_t GetByteSize() const { return m_end - m_start; }
+
+ /// Extract a C string from \a *offset_ptr.
+ ///
+ /// Returns a pointer to a C String from the data at the offset pointed to
+ /// by \a offset_ptr. A variable length NULL terminated C string will be
+ /// extracted and the \a offset_ptr will be updated with the offset of the
+ /// byte that follows the NULL terminator byte.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// A pointer to the C string value in the data. If the offset
+ /// pointed to by \a offset_ptr is out of bounds, or if the
+ /// offset plus the length of the C string is out of bounds,
+ /// nullptr will be returned.
+ const char *GetCStr(lldb::offset_t *offset_ptr) const;
+
+ /// Extract a C string from \a *offset_ptr with field size \a len.
+ ///
+ /// Returns a pointer to a C String from the data at the offset pointed to
+ /// by \a offset_ptr, with a field length of \a len.
+ /// A NULL terminated C string will be extracted and the \a offset_ptr
+ /// will be updated with the offset of the byte that follows the fixed
+ /// length field.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// A pointer to the C string value in the data. If the offset
+ /// pointed to by \a offset_ptr is out of bounds, or if the
+ /// offset plus the length of the field is out of bounds, or if
+ /// the field does not contain a NULL terminator byte, nullptr will
+ /// be returned.
+ const char *GetCStr(lldb::offset_t *offset_ptr, lldb::offset_t len) const;
+
+ /// Extract \a length bytes from \a *offset_ptr.
+ ///
+ /// Returns a pointer to a bytes in this object's data at the offset pointed
+ /// to by \a offset_ptr. If \a length is zero or too large, then the offset
+ /// pointed to by \a offset_ptr will not be updated and nullptr will be
+ /// returned.
+ ///
+ /// \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] length
+ /// The optional length of a string to extract. If the value is
+ /// zero, a NULL terminated C string will be extracted.
+ ///
+ /// \return
+ /// A pointer to the bytes in this object's data if the offset
+ /// and length are valid, or nullptr otherwise.
+ const void *GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const {
+ const uint8_t *ptr = PeekData(*offset_ptr, length);
+ if (ptr)
+ *offset_ptr += length;
+ return ptr;
+ }
+
+ /// Copy \a length bytes from \a *offset, without swapping bytes.
+ ///
+ /// \param[in] offset
+ /// The offset into this data from which to start copying
+ ///
+ /// \param[in] length
+ /// The length of the data to copy from this object
+ ///
+ /// \param[out] dst
+ /// The buffer to place the output data.
+ ///
+ /// \return
+ /// Returns the number of bytes that were copied, or zero if
+ /// anything goes wrong.
+ lldb::offset_t CopyData(lldb::offset_t offset, lldb::offset_t length,
+ void *dst) const;
+
+ /// Copy \a dst_len bytes from \a *offset_ptr and ensure the copied data is
+ /// treated as a value that can be swapped to match the specified byte
+ /// order.
+ ///
+ /// For values that are larger than the supported integer sizes, this
+ /// function can be used to extract data in a specified byte order. It can
+ /// also be used to copy a smaller integer value from to a larger value. The
+ /// extra bytes left over will be padded correctly according to the byte
+ /// order of this object and the \a dst_byte_order. This can be very handy
+ /// when say copying a partial data value into a register.
+ ///
+ /// \param[in] src_offset
+ /// The offset into this data from which to start copying an
+ /// endian entity
+ ///
+ /// \param[in] src_len
+ /// The length of the endian data to copy from this object
+ /// into the \a dst object
+ ///
+ /// \param[out] dst
+ /// The buffer where to place the endian data. The data might
+ /// need to be byte swapped (and appropriately padded with
+ /// zeroes if \a src_len != \a dst_len) if \a dst_byte_order
+ /// does not match the byte order in this object.
+ ///
+ /// \param[in] dst_len
+ /// The length number of bytes that the endian value will
+ /// occupy is \a dst.
+ ///
+ /// \param[in] byte_order
+ /// The byte order that the endian value should be in the \a dst
+ /// buffer.
+ ///
+ /// \return
+ /// Returns the number of bytes that were copied, or zero if
+ /// anything goes wrong.
+ lldb::offset_t CopyByteOrderedData(lldb::offset_t src_offset,
+ lldb::offset_t src_len, void *dst,
+ lldb::offset_t dst_len,
+ lldb::ByteOrder dst_byte_order) const;
+
+ /// Get the data end pointer.
+ ///
+ /// \return
+ /// Returns a pointer to the next byte contained in this
+ /// object's data, or nullptr of there is no data in this object.
+ const uint8_t *GetDataEnd() const { return m_end; }
+
+ /// Get the shared data offset.
+ ///
+ /// Get the offset of the first byte of data in the shared data (if any).
+ ///
+ /// \return
+ /// If this object contains shared data, this function returns
+ /// the offset in bytes into that shared data, zero otherwise.
+ size_t GetSharedDataOffset() const;
+
+ /// Get the data start pointer.
+ ///
+ /// \return
+ /// Returns a pointer to the first byte contained in this
+ /// object's data, or nullptr of there is no data in this object.
+ const uint8_t *GetDataStart() const { return m_start; }
+
+ /// Extract a float from \a *offset_ptr.
+ ///
+ /// Extract a single float value.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The floating value that was extracted, or zero on failure.
+ float GetFloat(lldb::offset_t *offset_ptr) const;
+
+ double GetDouble(lldb::offset_t *offset_ptr) const;
+
+ long double GetLongDouble(lldb::offset_t *offset_ptr) const;
+
+ /// Extract an integer of size \a byte_size from \a *offset_ptr.
+ ///
+ /// Extract a single integer value and update the offset pointed to by \a
+ /// offset_ptr. The size of the extracted integer is specified by the \a
+ /// byte_size argument. \a byte_size must have a value >= 1 and <= 4 since
+ /// the return value is only 32 bits wide.
+ ///
+ /// \param[in,out] offset_ptr
+ /// A pointer to an offset within the data that will be advanced
+ /// 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] byte_size
+ /// The size in byte of the integer to extract.
+ ///
+ /// \return
+ /// The integer value that was extracted, or zero on failure.
+ uint32_t GetMaxU32(lldb::offset_t *offset_ptr, size_t byte_size) const;
+
+ /// Extract an unsigned integer of size \a byte_size from \a *offset_ptr.
+ ///
+ /// Extract a single unsigned integer value and update the offset pointed to
+ /// by \a offset_ptr. The size of the extracted integer is specified by the
+ /// \a byte_size argument. \a byte_size must have a value greater than or
+ /// equal to one and less than or equal to eight since the return value is
+ /// 64 bits wide.
+ ///
+ /// \param[in,out] offset_ptr
+ /// A pointer to an offset within the data that will be advanced
+ /// 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] byte_size
+ /// The size in byte of the integer to extract.
+ ///
+ /// \return
+ /// The unsigned integer value that was extracted, or zero on
+ /// failure.
+ uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const;
+
+ uint64_t GetMaxU64_unchecked(lldb::offset_t *offset_ptr,
+ size_t byte_size) const;
+
+ /// Extract an signed integer of size \a byte_size from \a *offset_ptr.
+ ///
+ /// Extract a single signed integer value (sign extending if required) and
+ /// update the offset pointed to by \a offset_ptr. The size of the extracted
+ /// integer is specified by the \a byte_size argument. \a byte_size must
+ /// have a value greater than or equal to one and less than or equal to
+ /// eight since the return value is 64 bits wide.
+ ///
+ /// \param[in,out] offset_ptr
+ /// A pointer to an offset within the data that will be advanced
+ /// 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] byte_size
+ /// The size in byte of the integer to extract.
+ ///
+ /// \return
+ /// The sign extended signed integer value that was extracted,
+ /// or zero on failure.
+ int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t byte_size) const;
+
+ /// Extract an unsigned integer of size \a byte_size from \a *offset_ptr,
+ /// then extract the bitfield from this value if \a bitfield_bit_size is
+ /// non-zero.
+ ///
+ /// Extract a single unsigned integer value and update the offset pointed to
+ /// by \a offset_ptr. The size of the extracted integer is specified by the
+ /// \a byte_size argument. \a byte_size must have a value greater than or
+ /// equal to one and less than or equal to 8 since the return value is 64
+ /// bits wide.
+ ///
+ /// \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] byte_size
+ /// The size in byte of the integer to extract.
+ ///
+ /// \param[in] bitfield_bit_size
+ /// The size in bits of the bitfield value to extract, or zero
+ /// to just extract the entire integer value.
+ ///
+ /// \param[in] bitfield_bit_offset
+ /// The bit offset of the bitfield value in the extracted
+ /// integer. For little-endian data, this is the offset of
+ /// the LSB of the bitfield from the LSB of the integer.
+ /// For big-endian data, this is the offset of the MSB of the
+ /// bitfield from the MSB of the integer.
+ ///
+ /// \return
+ /// The unsigned bitfield integer value that was extracted, or
+ /// zero on failure.
+ uint64_t GetMaxU64Bitfield(lldb::offset_t *offset_ptr, size_t size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset) const;
+
+ /// Extract an signed integer of size \a byte_size from \a *offset_ptr, then
+ /// extract and signe extend the bitfield from this value if \a
+ /// bitfield_bit_size is non-zero.
+ ///
+ /// Extract a single signed integer value (sign extending if required) and
+ /// update the offset pointed to by \a offset_ptr. The size of the extracted
+ /// integer is specified by the \a byte_size argument. \a byte_size must
+ /// have a value greater than or equal to one and less than or equal to
+ /// eight since the return value is 64 bits wide.
+ ///
+ /// \param[in,out] offset_ptr
+ /// A pointer to an offset within the data that will be advanced
+ /// 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] byte_size
+ /// The size in bytes of the integer to extract.
+ ///
+ /// \param[in] bitfield_bit_size
+ /// The size in bits of the bitfield value to extract, or zero
+ /// to just extract the entire integer value.
+ ///
+ /// \param[in] bitfield_bit_offset
+ /// The bit offset of the bitfield value in the extracted
+ /// integer. For little-endian data, this is the offset of
+ /// the LSB of the bitfield from the LSB of the integer.
+ /// For big-endian data, this is the offset of the MSB of the
+ /// bitfield from the MSB of the integer.
+ ///
+ /// \return
+ /// The signed bitfield integer value that was extracted, or
+ /// zero on failure.
+ int64_t GetMaxS64Bitfield(lldb::offset_t *offset_ptr, size_t size,
+ uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset) const;
+
+ /// Extract an pointer from \a *offset_ptr.
+ ///
+ /// Extract a single pointer from the data and update the offset pointed to
+ /// by \a offset_ptr. The size of the extracted pointer comes from the \a
+ /// m_addr_size member variable and should be set correctly prior to
+ /// extracting any pointer values.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted pointer value as a 64 integer.
+ uint64_t GetPointer(lldb::offset_t *offset_ptr) const;
+
+ /// Get the current byte order value.
+ ///
+ /// \return
+ /// The current byte order value from this object's internal
+ /// state.
+ lldb::ByteOrder GetByteOrder() const { return m_byte_order; }
+
+ /// Extract a uint8_t value from \a *offset_ptr.
+ ///
+ /// Extract a single uint8_t from the binary data at the offset pointed to
+ /// by \a offset_ptr, and advance the offset on success.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted uint8_t value.
+ uint8_t GetU8(lldb::offset_t *offset_ptr) const;
+
+ uint8_t GetU8_unchecked(lldb::offset_t *offset_ptr) const {
+ uint8_t val = m_start[*offset_ptr];
+ *offset_ptr += 1;
+ return val;
+ }
+
+ uint16_t GetU16_unchecked(lldb::offset_t *offset_ptr) const;
+
+ uint32_t GetU32_unchecked(lldb::offset_t *offset_ptr) const;
+
+ uint64_t GetU64_unchecked(lldb::offset_t *offset_ptr) const;
+ /// Extract \a count uint8_t values from \a *offset_ptr.
+ ///
+ /// Extract \a count uint8_t values from the binary data at the offset
+ /// pointed to by \a offset_ptr, and advance the offset on success. The
+ /// extracted values are copied into \a dst.
+ ///
+ /// \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[out] dst
+ /// A buffer to copy \a count uint8_t values into. \a dst must
+ /// be large enough to hold all requested data.
+ ///
+ /// \param[in] count
+ /// The number of uint8_t values to extract.
+ ///
+ /// \return
+ /// \a dst if all values were properly extracted and copied,
+ /// nullptr otherwise.
+ void *GetU8(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
+
+ /// Extract a uint16_t value from \a *offset_ptr.
+ ///
+ /// Extract a single uint16_t from the binary data at the offset pointed to
+ /// by \a offset_ptr, and update the offset on success.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted uint16_t value.
+ uint16_t GetU16(lldb::offset_t *offset_ptr) const;
+
+ /// Extract \a count uint16_t values from \a *offset_ptr.
+ ///
+ /// Extract \a count uint16_t values from the binary data at the offset
+ /// pointed to by \a offset_ptr, and advance the offset on success. The
+ /// extracted values are copied into \a dst.
+ ///
+ /// \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[out] dst
+ /// A buffer to copy \a count uint16_t values into. \a dst must
+ /// be large enough to hold all requested data.
+ ///
+ /// \param[in] count
+ /// The number of uint16_t values to extract.
+ ///
+ /// \return
+ /// \a dst if all values were properly extracted and copied,
+ /// nullptr otherwise.
+ void *GetU16(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
+
+ /// Extract a uint32_t value from \a *offset_ptr.
+ ///
+ /// Extract a single uint32_t from the binary data at the offset pointed to
+ /// by \a offset_ptr, and update the offset on success.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted uint32_t value.
+ uint32_t GetU32(lldb::offset_t *offset_ptr) const;
+
+ /// Extract \a count uint32_t values from \a *offset_ptr.
+ ///
+ /// Extract \a count uint32_t values from the binary data at the offset
+ /// pointed to by \a offset_ptr, and advance the offset on success. The
+ /// extracted values are copied into \a dst.
+ ///
+ /// \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[out] dst
+ /// A buffer to copy \a count uint32_t values into. \a dst must
+ /// be large enough to hold all requested data.
+ ///
+ /// \param[in] count
+ /// The number of uint32_t values to extract.
+ ///
+ /// \return
+ /// \a dst if all values were properly extracted and copied,
+ /// nullptr otherwise.
+ void *GetU32(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
+
+ /// Extract a uint64_t value from \a *offset_ptr.
+ ///
+ /// Extract a single uint64_t from the binary data at the offset pointed to
+ /// by \a offset_ptr, and update the offset on success.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted uint64_t value.
+ uint64_t GetU64(lldb::offset_t *offset_ptr) const;
+
+ /// Extract \a count uint64_t values from \a *offset_ptr.
+ ///
+ /// Extract \a count uint64_t values from the binary data at the offset
+ /// pointed to by \a offset_ptr, and advance the offset on success. The
+ /// extracted values are copied into \a dst.
+ ///
+ /// \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[out] dst
+ /// A buffer to copy \a count uint64_t values into. \a dst must
+ /// be large enough to hold all requested data.
+ ///
+ /// \param[in] count
+ /// The number of uint64_t values to extract.
+ ///
+ /// \return
+ /// \a dst if all values were properly extracted and copied,
+ /// nullptr otherwise.
+ void *GetU64(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
+
+ /// Extract a signed LEB128 value from \a *offset_ptr.
+ ///
+ /// Extracts an signed LEB128 number from this object's data starting at the
+ /// offset pointed to by \a offset_ptr. The offset pointed to by \a
+ /// offset_ptr will be updated with the offset of the byte following the
+ /// last extracted byte.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted signed integer value.
+ int64_t GetSLEB128(lldb::offset_t *offset_ptr) const;
+
+ /// Extract a unsigned LEB128 value from \a *offset_ptr.
+ ///
+ /// Extracts an unsigned LEB128 number from this object's data starting at
+ /// the offset pointed to by \a offset_ptr. The offset pointed to by \a
+ /// offset_ptr will be updated with the offset of the byte following the
+ /// last extracted byte.
+ ///
+ /// \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.
+ ///
+ /// \return
+ /// The extracted unsigned integer value.
+ uint64_t GetULEB128(lldb::offset_t *offset_ptr) const;
+
+ lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; }
+
+ /// Peek at a C string at \a offset.
+ ///
+ /// Peeks at a string in the contained data. No verification is done to make
+ /// sure the entire string lies within the bounds of this object's data,
+ /// only \a offset is verified to be a valid offset.
+ ///
+ /// \param[in] offset
+ /// An offset into the data.
+ ///
+ /// \return
+ /// A non-nullptr C string pointer if \a offset is a valid offset,
+ /// nullptr otherwise.
+ const char *PeekCStr(lldb::offset_t offset) const;
+
+ /// Peek at a bytes at \a offset.
+ ///
+ /// Returns a pointer to \a length bytes at \a offset as long as there are
+ /// \a length bytes available starting at \a offset.
+ ///
+ /// \return
+ /// A non-nullptr data pointer if \a offset is a valid offset and
+ /// there are \a length bytes available at that offset, nullptr
+ /// otherwise.
+ const uint8_t *PeekData(lldb::offset_t offset, lldb::offset_t length) const {
+ if (ValidOffsetForDataOfSize(offset, length))
+ return m_start + offset;
+ return nullptr;
+ }
+
+ /// Set the address byte size.
+ ///
+ /// Set the size in bytes that will be used when extracting any address and
+ /// pointer values from data contained in this object.
+ ///
+ /// \param[in] addr_size
+ /// The size in bytes to use when extracting addresses.
+ void SetAddressByteSize(uint32_t addr_size) {
+#ifdef LLDB_CONFIGURATION_DEBUG
+ assert(addr_size == 4 || addr_size == 8);
+#endif
+ m_addr_size = addr_size;
+ }
+
+ /// Set data with a buffer that is caller owned.
+ ///
+ /// Use data that is owned by the caller when extracting values. The data
+ /// must stay around as long as this object, or any object that copies a
+ /// subset of this object's data, is valid. If \a bytes is nullptr, or \a
+ /// length is zero, this object will contain no data.
+ ///
+ /// \param[in] bytes
+ /// A pointer to caller owned data.
+ ///
+ /// \param[in] length
+ /// The length in bytes of \a bytes.
+ ///
+ /// \param[in] byte_order
+ /// A byte order of the data that we are extracting from.
+ ///
+ /// \return
+ /// The number of bytes that this object now contains.
+ lldb::offset_t SetData(const void *bytes, lldb::offset_t length,
+ lldb::ByteOrder byte_order);
+
+ /// Adopt a subset of \a data.
+ ///
+ /// Set this object's data to be a subset of the data bytes in \a data. If
+ /// \a data contains shared data, then a reference to the shared data will
+ /// be added to ensure the shared data stays around as long as any objects
+ /// have references to the shared data. The byte order and the address size
+ /// settings are copied from \a data. If \a offset is not a valid offset in
+ /// \a data, then no reference to the shared data will be added. If there
+ /// are not \a length bytes available in \a data starting at \a offset, the
+ /// length will be truncated to contains as many bytes as possible.
+ ///
+ /// \param[in] data
+ /// Another DataExtractor object that contains data.
+ ///
+ /// \param[in] offset
+ /// The offset into \a data at which the subset starts.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the subset of \a data.
+ ///
+ /// \return
+ /// The number of bytes that this object now contains.
+ lldb::offset_t SetData(const DataExtractor &data, lldb::offset_t offset,
+ lldb::offset_t length);
+
+ /// Adopt a subset of shared data in \a data_sp.
+ ///
+ /// Copies the data shared pointer which adds a reference to the contained
+ /// in \a data_sp. The shared data reference is reference counted to ensure
+ /// the data lives as long as anyone still has a valid shared pointer to the
+ /// data in \a data_sp. The byte order and address byte size settings remain
+ /// the same. If \a offset is not a valid offset in \a data_sp, then no
+ /// reference to the shared data will be added. If there are not \a length
+ /// bytes available in \a data starting at \a offset, the length will be
+ /// truncated to contains as many bytes as possible.
+ ///
+ /// \param[in] data_sp
+ /// A shared pointer to data.
+ ///
+ /// \param[in] offset
+ /// The offset into \a data_sp at which the subset starts.
+ ///
+ /// \param[in] length
+ /// The length in bytes of the subset of \a data_sp.
+ ///
+ /// \return
+ /// The number of bytes that this object now contains.
+ lldb::offset_t SetData(const lldb::DataBufferSP &data_sp,
+ lldb::offset_t offset = 0,
+ lldb::offset_t length = LLDB_INVALID_OFFSET);
+
+ /// Set the byte_order value.
+ ///
+ /// Sets the byte order of the data to extract. Extracted values will be
+ /// swapped if necessary when decoding.
+ ///
+ /// \param[in] byte_order
+ /// The byte order value to use when extracting data.
+ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
+
+ /// Skip an LEB128 number at \a *offset_ptr.
+ ///
+ /// Skips a LEB128 number (signed or unsigned) from this object's data
+ /// starting at the offset pointed to by \a offset_ptr. The offset pointed
+ /// to by \a offset_ptr will be updated with the offset of the byte
+ /// following the last extracted byte.
+ ///
+ /// \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.
+ ///
+ /// \return
+ // The number of bytes consumed during the extraction.
+ uint32_t Skip_LEB128(lldb::offset_t *offset_ptr) const;
+
+ /// Test the validity of \a offset.
+ ///
+ /// \return
+ /// \b true if \a offset is a valid offset into the data in this
+ /// object, \b false otherwise.
+ bool ValidOffset(lldb::offset_t offset) const {
+ return offset < GetByteSize();
+ }
+
+ /// Test the availability of \a length bytes of data from \a offset.
+ ///
+ /// \return
+ /// \b true if \a offset is a valid offset and there are \a
+ /// length bytes available at that offset, \b false otherwise.
+ bool ValidOffsetForDataOfSize(lldb::offset_t offset,
+ lldb::offset_t length) const {
+ return length <= BytesLeft(offset);
+ }
+
+ size_t Copy(DataExtractor &dest_data) const;
+
+ bool Append(DataExtractor &rhs);
+
+ bool Append(void *bytes, lldb::offset_t length);
+
+ lldb::offset_t BytesLeft(lldb::offset_t offset) const {
+ const lldb::offset_t size = GetByteSize();
+ if (size > offset)
+ return size - offset;
+ return 0;
+ }
+
+ void Checksum(llvm::SmallVectorImpl<uint8_t> &dest, uint64_t max_data = 0);
+
+ llvm::ArrayRef<uint8_t> GetData() const {
+ return {GetDataStart(), size_t(GetByteSize())};
+ }
+
+protected:
+ // Member variables
+ const uint8_t *m_start; ///< A pointer to the first byte of data.
+ const uint8_t
+ *m_end; ///< A pointer to the byte that is past the end of the data.
+ 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
+ mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can
+ /// be shared among multiple instances
+ const uint32_t m_target_byte_size;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_DataExtractor_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Endian.h b/linux-x64/clang/include/lldb/Utility/Endian.h
new file mode 100644
index 0000000..cead5f8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Endian.h
@@ -0,0 +1,33 @@
+//===-- Endian.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_ENDIAN_H
+#define LLDB_UTILITY_ENDIAN_H
+
+#include "lldb/lldb-enumerations.h"
+
+#include <stdint.h>
+
+namespace lldb_private {
+
+namespace endian {
+
+static union EndianTest {
+ uint32_t num;
+ uint8_t bytes[sizeof(uint32_t)];
+} const endianTest = {0x01020304};
+
+inline lldb::ByteOrder InlHostByteOrder() {
+ return static_cast<lldb::ByteOrder>(endianTest.bytes[0]);
+}
+
+// ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
+}
+}
+
+#endif // liblldb_host_endian_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Environment.h b/linux-x64/clang/include/lldb/Utility/Environment.h
new file mode 100644
index 0000000..398b3ba
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Environment.h
@@ -0,0 +1,95 @@
+//===-- Environment.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_ENVIRONMENT_H
+#define LLDB_UTILITY_ENVIRONMENT_H
+
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/FormatProviders.h"
+
+namespace lldb_private {
+
+class Environment : private llvm::StringMap<std::string> {
+ using Base = llvm::StringMap<std::string>;
+
+public:
+ class Envp {
+ public:
+ Envp(Envp &&RHS) = default;
+ Envp &operator=(Envp &&RHS) = default;
+
+ char *const *get() const { return Data; }
+ operator char *const *() const { return get(); }
+
+ private:
+ explicit Envp(const Environment &Env);
+ char *make_entry(llvm::StringRef Key, llvm::StringRef Value);
+ Envp(const Envp &) = delete;
+ Envp &operator=(const Envp &) = delete;
+ friend class Environment;
+
+ llvm::BumpPtrAllocator Allocator;
+ char **Data;
+ };
+
+ using Base::const_iterator;
+ using Base::iterator;
+ using Base::value_type;
+
+ using Base::begin;
+ using Base::clear;
+ using Base::count;
+ using Base::empty;
+ using Base::end;
+ using Base::erase;
+ using Base::find;
+ using Base::insert;
+ using Base::lookup;
+ using Base::size;
+ using Base::try_emplace;
+ using Base::operator[];
+
+ Environment() : Base() {}
+ Environment(const Environment &RHS) : Base(RHS) {}
+ Environment(Environment &&RHS) : Base(std::move(RHS)) {}
+ Environment(char *const *Env)
+ : Environment(const_cast<const char *const *>(Env)) {}
+ Environment(const char *const *Env);
+
+ Environment &operator=(Environment RHS) {
+ Base::operator=(std::move(RHS));
+ return *this;
+ }
+
+ std::pair<iterator, bool> insert(llvm::StringRef KeyEqValue) {
+ return insert(KeyEqValue.split('='));
+ }
+
+ void insert(const_iterator first, const_iterator last);
+
+ Envp getEnvp() const { return Envp(*this); }
+
+ static std::string compose(const value_type &KeyValue) {
+ return (KeyValue.first() + "=" + KeyValue.second).str();
+ }
+};
+
+} // namespace lldb_private
+
+namespace llvm {
+template <> struct format_provider<lldb_private::Environment> {
+ static void format(const lldb_private::Environment &Env, raw_ostream &Stream,
+ StringRef Style) {
+ for (const auto &KV : Env)
+ Stream << "env[" << KV.first() << "] = " << KV.second << "\n";
+ }
+};
+} // namespace llvm
+
+#endif // #ifndef LLDB_UTILITY_ENVIRONMENT_H
diff --git a/linux-x64/clang/include/lldb/Utility/Event.h b/linux-x64/clang/include/lldb/Utility/Event.h
new file mode 100644
index 0000000..dd5d080
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Event.h
@@ -0,0 +1,251 @@
+//===-- Event.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_EVENT_H
+#define LLDB_UTILITY_EVENT_H
+
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Predicate.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+
+#include "llvm/ADT/StringRef.h"
+
+#include <chrono>
+#include <memory>
+#include <string>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Event;
+class Stream;
+}
+
+namespace lldb_private {
+
+// lldb::EventData
+class EventData {
+ friend class Event;
+
+public:
+ EventData();
+
+ virtual ~EventData();
+
+ virtual ConstString GetFlavor() const = 0;
+
+ virtual void Dump(Stream *s) const;
+
+private:
+ virtual void DoOnRemoval(Event *event_ptr) {}
+
+ DISALLOW_COPY_AND_ASSIGN(EventData);
+};
+
+// lldb::EventDataBytes
+class EventDataBytes : public EventData {
+public:
+ // Constructors
+ EventDataBytes();
+
+ EventDataBytes(const char *cstr);
+
+ EventDataBytes(llvm::StringRef str);
+
+ EventDataBytes(const void *src, size_t src_len);
+
+ ~EventDataBytes() override;
+
+ // Member functions
+ ConstString GetFlavor() const override;
+
+ void Dump(Stream *s) const override;
+
+ const void *GetBytes() const;
+
+ size_t GetByteSize() const;
+
+ void SetBytes(const void *src, size_t src_len);
+
+ void SwapBytes(std::string &new_bytes);
+
+ void SetBytesFromCString(const char *cstr);
+
+ // Static functions
+ static const EventDataBytes *GetEventDataFromEvent(const Event *event_ptr);
+
+ static const void *GetBytesFromEvent(const Event *event_ptr);
+
+ static size_t GetByteSizeFromEvent(const Event *event_ptr);
+
+ static ConstString GetFlavorString();
+
+private:
+ std::string m_bytes;
+
+ DISALLOW_COPY_AND_ASSIGN(EventDataBytes);
+};
+
+class EventDataReceipt : public EventData {
+public:
+ EventDataReceipt() : EventData(), m_predicate(false) {}
+
+ ~EventDataReceipt() override {}
+
+ static ConstString GetFlavorString() {
+ static ConstString g_flavor("Process::ProcessEventData");
+ return g_flavor;
+ }
+
+ ConstString GetFlavor() const override { return GetFlavorString(); }
+
+ bool WaitForEventReceived(const Timeout<std::micro> &timeout = llvm::None) {
+ return m_predicate.WaitForValueEqualTo(true, timeout);
+ }
+
+private:
+ Predicate<bool> m_predicate;
+
+ void DoOnRemoval(Event *event_ptr) override {
+ m_predicate.SetValue(true, eBroadcastAlways);
+ }
+};
+
+/// This class handles one or more StructuredData::Dictionary entries
+/// that are raised for structured data events.
+
+class EventDataStructuredData : public EventData {
+public:
+ // Constructors
+ EventDataStructuredData();
+
+ EventDataStructuredData(const lldb::ProcessSP &process_sp,
+ const StructuredData::ObjectSP &object_sp,
+ const lldb::StructuredDataPluginSP &plugin_sp);
+
+ ~EventDataStructuredData() override;
+
+ // Member functions
+ ConstString GetFlavor() const override;
+
+ void Dump(Stream *s) const override;
+
+ const lldb::ProcessSP &GetProcess() const;
+
+ const StructuredData::ObjectSP &GetObject() const;
+
+ const lldb::StructuredDataPluginSP &GetStructuredDataPlugin() const;
+
+ void SetProcess(const lldb::ProcessSP &process_sp);
+
+ void SetObject(const StructuredData::ObjectSP &object_sp);
+
+ void SetStructuredDataPlugin(const lldb::StructuredDataPluginSP &plugin_sp);
+
+ // Static functions
+ static const EventDataStructuredData *
+ GetEventDataFromEvent(const Event *event_ptr);
+
+ static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr);
+
+ static StructuredData::ObjectSP GetObjectFromEvent(const Event *event_ptr);
+
+ static lldb::StructuredDataPluginSP
+ GetPluginFromEvent(const Event *event_ptr);
+
+ static ConstString GetFlavorString();
+
+private:
+ lldb::ProcessSP m_process_sp;
+ StructuredData::ObjectSP m_object_sp;
+ lldb::StructuredDataPluginSP m_plugin_sp;
+
+ DISALLOW_COPY_AND_ASSIGN(EventDataStructuredData);
+};
+
+// lldb::Event
+class Event {
+ friend class Listener;
+ friend class EventData;
+ friend class Broadcaster::BroadcasterImpl;
+
+public:
+ Event(Broadcaster *broadcaster, uint32_t event_type,
+ EventData *data = nullptr);
+
+ Event(Broadcaster *broadcaster, uint32_t event_type,
+ const lldb::EventDataSP &event_data_sp);
+
+ Event(uint32_t event_type, EventData *data = nullptr);
+
+ Event(uint32_t event_type, const lldb::EventDataSP &event_data_sp);
+
+ ~Event();
+
+ void Dump(Stream *s) const;
+
+ EventData *GetData() { return m_data_sp.get(); }
+
+ const EventData *GetData() const { return m_data_sp.get(); }
+
+ void SetData(EventData *new_data) { m_data_sp.reset(new_data); }
+
+ uint32_t GetType() const { return m_type; }
+
+ void SetType(uint32_t new_type) { m_type = new_type; }
+
+ Broadcaster *GetBroadcaster() const {
+ Broadcaster::BroadcasterImplSP broadcaster_impl_sp =
+ m_broadcaster_wp.lock();
+ if (broadcaster_impl_sp)
+ return broadcaster_impl_sp->GetBroadcaster();
+ else
+ return nullptr;
+ }
+
+ bool BroadcasterIs(Broadcaster *broadcaster) {
+ Broadcaster::BroadcasterImplSP broadcaster_impl_sp =
+ m_broadcaster_wp.lock();
+ if (broadcaster_impl_sp)
+ return broadcaster_impl_sp->GetBroadcaster() == broadcaster;
+ else
+ return false;
+ }
+
+ void Clear() { m_data_sp.reset(); }
+
+private:
+ // This is only called by Listener when it pops an event off the queue for
+ // the listener. It calls the Event Data's DoOnRemoval() method, which is
+ // virtual and can be overridden by the specific data classes.
+
+ void DoOnRemoval();
+
+ // Called by Broadcaster::BroadcastEvent prior to letting all the listeners
+ // know about it update the contained broadcaster so that events can be
+ // popped off one queue and re-broadcast to others.
+ void SetBroadcaster(Broadcaster *broadcaster) {
+ m_broadcaster_wp = broadcaster->GetBroadcasterImpl();
+ }
+
+ Broadcaster::BroadcasterImplWP
+ m_broadcaster_wp; // The broadcaster that sent this event
+ uint32_t m_type; // The bit describing this event
+ lldb::EventDataSP m_data_sp; // User specific data for this event
+
+ DISALLOW_COPY_AND_ASSIGN(Event);
+ Event() = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_EVENT_H
diff --git a/linux-x64/clang/include/lldb/Utility/FileCollector.h b/linux-x64/clang/include/lldb/Utility/FileCollector.h
new file mode 100644
index 0000000..a892067
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/FileCollector.h
@@ -0,0 +1,77 @@
+//===-- FileCollector.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_FILE_COLLECTOR_H
+#define LLDB_UTILITY_FILE_COLLECTOR_H
+
+#include "lldb/Utility/FileSpec.h"
+
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/VirtualFileSystem.h"
+
+#include <mutex>
+
+namespace lldb_private {
+
+/// Collects files into a directory and generates a mapping that can be used by
+/// the VFS.
+class FileCollector {
+public:
+ FileCollector(const FileSpec &root, const FileSpec &overlay);
+
+ void AddFile(const llvm::Twine &file);
+ void AddFile(const FileSpec &file) { return AddFile(file.GetPath()); }
+
+ /// Write the yaml mapping (for the VFS) to the given file.
+ std::error_code WriteMapping(const FileSpec &mapping_file);
+
+ /// Copy the files into the root directory.
+ ///
+ /// When stop_on_error is true (the default) we abort as soon as one file
+ /// cannot be copied. This is relatively common, for example when a file was
+ /// removed after it was added to the mapping.
+ std::error_code CopyFiles(bool stop_on_error = true);
+
+protected:
+ void AddFileImpl(llvm::StringRef src_path);
+
+ bool MarkAsSeen(llvm::StringRef path) { return m_seen.insert(path).second; }
+
+ bool GetRealPath(llvm::StringRef src_path,
+ llvm::SmallVectorImpl<char> &result);
+
+ void AddFileToMapping(llvm::StringRef virtual_path,
+ llvm::StringRef real_path) {
+ m_vfs_writer.addFileMapping(virtual_path, real_path);
+ }
+
+ /// Synchronizes adding files.
+ std::mutex m_mutex;
+
+ /// The root directory where files are copied.
+ FileSpec m_root;
+
+ /// The root directory where the VFS overlay lives.
+ FileSpec m_overlay_root;
+
+ /// Tracks already seen files so they can be skipped.
+ llvm::StringSet<> m_seen;
+
+ /// The yaml mapping writer.
+ llvm::vfs::YAMLVFSWriter m_vfs_writer;
+
+ /// Caches real_path calls when resolving symlinks.
+ llvm::StringMap<std::string> m_symlink_map;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_FILE_COLLECTOR_H
diff --git a/linux-x64/clang/include/lldb/Utility/FileSpec.h b/linux-x64/clang/include/lldb/Utility/FileSpec.h
new file mode 100644
index 0000000..f0bc5c8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/FileSpec.h
@@ -0,0 +1,457 @@
+//===-- FileSpec.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_FileSpec_h_
+#define liblldb_FileSpec_h_
+
+#include <functional>
+#include <string>
+
+#include "lldb/Utility/ConstString.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Path.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class Stream;
+}
+namespace llvm {
+class Triple;
+}
+namespace llvm {
+class raw_ostream;
+}
+namespace llvm {
+template <typename T> class SmallVectorImpl;
+}
+
+namespace lldb_private {
+
+/// \class FileSpec FileSpec.h "lldb/Host/FileSpec.h"
+/// A file utility class.
+///
+/// A file specification class that divides paths up into a directory
+/// and basename. These string values of the paths are put into uniqued string
+/// pools for fast comparisons and efficient memory usage.
+///
+/// Another reason the paths are split into the directory and basename is to
+/// allow efficient debugger searching. Often in a debugger the user types in
+/// the basename of the file, for example setting a breakpoint by file and
+/// line, or specifying a module (shared library) to limit the scope in which
+/// to execute a command. The user rarely types in a full path. When the paths
+/// are already split up, it makes it easy for us to compare only the
+/// basenames of a lot of file specifications without having to split up the
+/// file path each time to get to the basename.
+class FileSpec {
+public:
+ using Style = llvm::sys::path::Style;
+
+ FileSpec();
+
+ /// Constructor with path.
+ ///
+ /// Takes a path to a file which can be just a filename, or a full path. If
+ /// \a path is not nullptr or empty, this function will call
+ /// FileSpec::SetFile (const char *path).
+ ///
+ /// \param[in] path
+ /// The full or partial path to a file.
+ ///
+ /// \param[in] style
+ /// The style of the path
+ ///
+ /// \see FileSpec::SetFile (const char *path)
+ explicit FileSpec(llvm::StringRef path, Style style = Style::native);
+
+ explicit FileSpec(llvm::StringRef path, const llvm::Triple &Triple);
+
+ /// Copy constructor
+ ///
+ /// Makes a copy of the uniqued directory and filename strings from \a rhs
+ /// if it is not nullptr.
+ ///
+ /// \param[in] rhs
+ /// A const FileSpec object pointer to copy if non-nullptr.
+ FileSpec(const FileSpec *rhs);
+
+ /// Destructor.
+ ~FileSpec();
+
+ bool DirectoryEquals(const FileSpec &other) const;
+
+ bool FileEquals(const FileSpec &other) const;
+
+ /// Assignment operator.
+ ///
+ /// Makes a copy of the uniqued directory and filename strings from \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const FileSpec object reference to assign to this object.
+ ///
+ /// \return
+ /// A const reference to this object.
+ const FileSpec &operator=(const FileSpec &rhs);
+
+ /// Equal to operator
+ ///
+ /// Tests if this object is equal to \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// \return
+ /// \b true if this object is equal to \a rhs, \b false
+ /// otherwise.
+ bool operator==(const FileSpec &rhs) const;
+
+ /// Not equal to operator
+ ///
+ /// Tests if this object is not equal to \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// \return
+ /// \b true if this object is equal to \a rhs, \b false
+ /// otherwise.
+ bool operator!=(const FileSpec &rhs) const;
+
+ /// Less than to operator
+ ///
+ /// Tests if this object is less than \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const FileSpec object reference to compare this object
+ /// to.
+ ///
+ /// \return
+ /// \b true if this object is less than \a rhs, \b false
+ /// otherwise.
+ bool operator<(const FileSpec &rhs) const;
+
+ /// Convert to pointer operator.
+ ///
+ /// This allows code to check a FileSpec object to see if it contains
+ /// anything valid using code such as:
+ ///
+ /// \code
+ /// FileSpec file_spec(...);
+ /// if (file_spec)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// A pointer to this object if either the directory or filename
+ /// is valid, nullptr otherwise.
+ explicit operator bool() const;
+
+ /// Logical NOT operator.
+ ///
+ /// This allows code to check a FileSpec object to see if it is invalid
+ /// using code such as:
+ ///
+ /// \code
+ /// FileSpec file_spec(...);
+ /// if (!file_spec)
+ /// { ...
+ /// \endcode
+ ///
+ /// \return
+ /// Returns \b true if the object has an empty directory and
+ /// filename, \b false otherwise.
+ bool operator!() const;
+
+ /// Clears the object state.
+ ///
+ /// Clear this object by releasing both the directory and filename string
+ /// values and reverting them to empty strings.
+ void Clear();
+
+ /// Compare two FileSpec objects.
+ ///
+ /// If \a full is true, then both the directory and the filename must match.
+ /// If \a full is false, then the directory names for \a lhs and \a rhs are
+ /// only compared if they are both not empty. This allows a FileSpec object
+ /// to only contain a filename and it can match FileSpec objects that have
+ /// matching filenames with different paths.
+ ///
+ /// \param[in] lhs
+ /// A const reference to the Left Hand Side object to compare.
+ ///
+ /// \param[in] rhs
+ /// A const reference to the Right Hand Side object to compare.
+ ///
+ /// \param[in] full
+ /// If true, then both the directory and filenames will have to
+ /// match for a compare to return zero (equal to). If false
+ /// and either directory from \a lhs or \a rhs is empty, then
+ /// only the filename will be compared, else a full comparison
+ /// is done.
+ ///
+ /// \return
+ /// \li -1 if \a lhs is less than \a rhs
+ /// \li 0 if \a lhs is equal to \a rhs
+ /// \li 1 if \a lhs is greater than \a rhs
+ static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full);
+
+ static bool Equal(const FileSpec &a, const FileSpec &b, bool full);
+
+ /// Attempt to guess path style for a given path string. It returns a style,
+ /// if it was able to make a reasonable guess, or None if it wasn't. The guess
+ /// will be correct if the input path was a valid absolute path on the system
+ /// which produced it. On other paths the result of this function is
+ /// unreliable (e.g. "c:\foo.txt" is a valid relative posix path).
+ static llvm::Optional<Style> GuessPathStyle(llvm::StringRef absolute_path);
+
+ /// Case sensitivity of path.
+ ///
+ /// \return
+ /// \b true if the file path is case sensitive (POSIX), false
+ /// if case insensitive (Windows).
+ bool IsCaseSensitive() const { return m_style != Style::windows; }
+
+ /// Dump this object to a Stream.
+ ///
+ /// Dump the object to the supplied stream \a s. If the object contains a
+ /// valid directory name, it will be displayed followed by a directory
+ /// delimiter, and the filename.
+ ///
+ /// \param[in] s
+ /// The stream to which to dump the object description.
+ void Dump(Stream *s) const;
+
+ Style GetPathStyle() const;
+
+ /// Directory string get accessor.
+ ///
+ /// \return
+ /// A reference to the directory string object.
+ ConstString &GetDirectory();
+
+ /// Directory string const get accessor.
+ ///
+ /// \return
+ /// A const reference to the directory string object.
+ ConstString GetDirectory() const;
+
+ /// Filename string get accessor.
+ ///
+ /// \return
+ /// A reference to the filename string object.
+ ConstString &GetFilename();
+
+ /// Filename string const get accessor.
+ ///
+ /// \return
+ /// A const reference to the filename string object.
+ ConstString GetFilename() const;
+
+ /// Returns true if the filespec represents an implementation source file
+ /// (files with a ".c", ".cpp", ".m", ".mm" (many more) extension).
+ ///
+ /// \return
+ /// \b true if the filespec represents an implementation source
+ /// file, \b false otherwise.
+ bool IsSourceImplementationFile() const;
+
+ /// Returns true if the filespec represents a relative path.
+ ///
+ /// \return
+ /// \b true if the filespec represents a relative path,
+ /// \b false otherwise.
+ bool IsRelative() const;
+
+ /// Returns true if the filespec represents an absolute path.
+ ///
+ /// \return
+ /// \b true if the filespec represents an absolute path,
+ /// \b false otherwise.
+ bool IsAbsolute() const;
+
+ /// Make the FileSpec absolute by treating it relative to \a dir. Absolute
+ /// FileSpecs are never changed by this function.
+ void MakeAbsolute(const FileSpec &dir);
+
+ /// Temporary helper for FileSystem change.
+ void SetPath(llvm::StringRef p) { SetFile(p); }
+
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into a fixed buffer. This is needed as
+ /// the directory and path are stored in separate string values.
+ ///
+ /// \param[out] path
+ /// The buffer in which to place the extracted full path.
+ ///
+ /// \param[in] max_path_length
+ /// The maximum length of \a path.
+ ///
+ /// \return
+ /// Returns the number of characters that would be needed to
+ /// properly copy the full path into \a path. If the returned
+ /// number is less than \a max_path_length, then the path is
+ /// properly copied and terminated. If the return value is
+ /// >= \a max_path_length, then the path was truncated (but is
+ /// still NULL terminated).
+ size_t GetPath(char *path, size_t max_path_length,
+ bool denormalize = true) const;
+
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into a std::string, which is returned.
+ ///
+ /// \return
+ /// Returns a std::string with the directory and filename
+ /// concatenated.
+ std::string GetPath(bool denormalize = true) const;
+
+ const char *GetCString(bool denormalize = true) const;
+
+ /// Extract the full path to the file.
+ ///
+ /// Extract the directory and path into an llvm::SmallVectorImpl<>
+ ///
+ /// \return
+ /// Returns a std::string with the directory and filename
+ /// concatenated.
+ void GetPath(llvm::SmallVectorImpl<char> &path,
+ bool denormalize = true) const;
+
+ /// Extract the extension of the file.
+ ///
+ /// Returns a ConstString that represents the extension of the filename for
+ /// this FileSpec object. If this object does not represent a file, or the
+ /// filename has no extension, ConstString(nullptr) is returned. The dot
+ /// ('.') character is not returned as part of the extension
+ ///
+ /// \return
+ /// Returns the extension of the file as a ConstString object.
+ ConstString GetFileNameExtension() const;
+
+ /// Return the filename without the extension part
+ ///
+ /// Returns a ConstString that represents the filename of this object
+ /// without the extension part (e.g. for a file named "foo.bar", "foo" is
+ /// returned)
+ ///
+ /// \return
+ /// Returns the filename without extension
+ /// as a ConstString object.
+ ConstString GetFileNameStrippingExtension() const;
+
+ /// Get the memory cost of this object.
+ ///
+ /// Return the size in bytes that this object takes in memory. This returns
+ /// the size in bytes of this object, not any shared string values it may
+ /// refer to.
+ ///
+ /// \return
+ /// The number of bytes that this object occupies in memory.
+ ///
+ /// \see ConstString::StaticMemorySize ()
+ size_t MemorySize() const;
+
+ /// Change the file specified with a new path.
+ ///
+ /// Update the contents of this object with a new path. The path will be
+ /// split up into a directory and filename and stored as uniqued string
+ /// values for quick comparison and efficient memory usage.
+ ///
+ /// \param[in] path
+ /// A full, partial, or relative path to a file.
+ ///
+ /// \param[in] resolve_path
+ /// If \b true, then we will try to resolve links the path using
+ /// the static FileSpec::Resolve.
+ void SetFile(llvm::StringRef path, Style style);
+
+ void SetFile(llvm::StringRef path, const llvm::Triple &Triple);
+
+ bool IsResolved() const { return m_is_resolved; }
+
+ /// Set if the file path has been resolved or not.
+ ///
+ /// If you know a file path is already resolved and avoided passing a \b
+ /// true parameter for any functions that take a "bool resolve_path"
+ /// parameter, you can set the value manually using this call to make sure
+ /// we don't try and resolve it later, or try and resolve a path that has
+ /// already been resolved.
+ ///
+ /// \param[in] is_resolved
+ /// A boolean value that will replace the current value that
+ /// indicates if the paths in this object have been resolved.
+ void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
+
+ FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const;
+ FileSpec CopyByRemovingLastPathComponent() const;
+
+ void PrependPathComponent(llvm::StringRef component);
+ void PrependPathComponent(const FileSpec &new_path);
+
+ void AppendPathComponent(llvm::StringRef component);
+ void AppendPathComponent(const FileSpec &new_path);
+
+ /// Removes the last path component by replacing the current path with its
+ /// parent. When the current path has no parent, this is a no-op.
+ ///
+ /// \return
+ /// A boolean value indicating whether the path was updated.
+ bool RemoveLastPathComponent();
+
+ ConstString GetLastPathComponent() const;
+
+protected:
+ // Convenience method for setting the file without changing the style.
+ void SetFile(llvm::StringRef path);
+
+ // Member variables
+ ConstString m_directory; ///< The uniqued directory path
+ ConstString m_filename; ///< The uniqued filename path
+ mutable bool m_is_resolved = false; ///< True if this path has been resolved.
+ Style m_style; ///< The syntax that this path uses (e.g. Windows / Posix)
+};
+
+/// Dump a FileSpec object to a stream
+Stream &operator<<(Stream &s, const FileSpec &f);
+
+} // namespace lldb_private
+
+namespace llvm {
+
+/// Implementation of format_provider<T> for FileSpec.
+///
+/// The options string of a FileSpec has the grammar:
+///
+/// file_spec_options :: (empty) | F | D
+///
+/// =======================================================
+/// | style | Meaning | Example |
+/// -------------------------------------------------------
+/// | | | Input | Output |
+/// =======================================================
+/// | F | Only print filename | /foo/bar | bar |
+/// | D | Only print directory | /foo/bar | /foo/ |
+/// | (empty) | Print file and dir | | |
+/// =======================================================
+///
+/// Any other value is considered an invalid format string.
+///
+template <> struct format_provider<lldb_private::FileSpec> {
+ static void format(const lldb_private::FileSpec &F, llvm::raw_ostream &Stream,
+ StringRef Style);
+};
+} // namespace llvm
+
+#endif // liblldb_FileSpec_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Flags.h b/linux-x64/clang/include/lldb/Utility/Flags.h
new file mode 100644
index 0000000..48b14e7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Flags.h
@@ -0,0 +1,156 @@
+//===-- Flags.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_FLAGS_H
+#define LLDB_UTILITY_FLAGS_H
+
+#include <cstddef>
+#include <cstdint>
+
+namespace lldb_private {
+
+/// \class Flags Flags.h "lldb/Utility/Flags.h"
+/// A class to manage flags.
+///
+/// The Flags class managed flag bits and allows testing and modification of
+/// individual or multiple flag bits.
+class Flags {
+public:
+ /// The value type for flags is a 32 bit unsigned integer type.
+ typedef uint32_t ValueType;
+
+ /// Construct with initial flag bit values.
+ ///
+ /// Constructs this object with \a mask as the initial value for all of the
+ /// flags.
+ ///
+ /// \param[in] mask
+ /// The initial value for all flags.
+ Flags(ValueType flags = 0) : m_flags(flags) {}
+
+ /// Copy constructor.
+ ///
+ /// Construct and copy the flags from \a rhs.
+ ///
+ /// \param[in] rhs
+ /// A const Flags object reference to copy.
+ Flags(const Flags &rhs) : m_flags(rhs.m_flags) {}
+
+ /// Destructor.
+ ~Flags() {}
+
+ /// Get accessor for all flags.
+ ///
+ /// \return
+ /// Returns all of the flags as a Flags::ValueType.
+ ValueType Get() const { return m_flags; }
+
+ /// Return the number of flags that can be represented in this object.
+ ///
+ /// \return
+ /// The maximum number bits in this flag object.
+ size_t GetBitSize() const { return sizeof(ValueType) * 8; }
+
+ /// Set accessor for all flags.
+ ///
+ /// \param[in] flags
+ /// The bits with which to replace all of the current flags.
+ void Reset(ValueType flags) { m_flags = flags; }
+
+ /// Clear one or more flags.
+ ///
+ /// \param[in] mask
+ /// A bitfield containing one or more flags.
+ ///
+ /// \return
+ /// The new flags after clearing all bits from \a mask.
+ ValueType Clear(ValueType mask = ~static_cast<ValueType>(0)) {
+ m_flags &= ~mask;
+ return m_flags;
+ }
+
+ /// Set one or more flags by logical OR'ing \a mask with the current flags.
+ ///
+ /// \param[in] mask
+ /// A bitfield containing one or more flags.
+ ///
+ /// \return
+ /// The new flags after setting all bits from \a mask.
+ ValueType Set(ValueType mask) {
+ m_flags |= mask;
+ return m_flags;
+ }
+
+ /// Test if all bits in \a mask are 1 in the current flags
+ ///
+ /// \return
+ /// \b true if all flags in \a mask are 1, \b false
+ /// otherwise.
+ bool AllSet(ValueType mask) const { return (m_flags & mask) == mask; }
+
+ /// Test one or more flags.
+ ///
+ /// \return
+ /// \b true if any flags in \a mask are 1, \b false
+ /// otherwise.
+ bool AnySet(ValueType mask) const { return (m_flags & mask) != 0; }
+
+ /// Test a single flag bit.
+ ///
+ /// \return
+ /// \b true if \a bit is set, \b false otherwise.
+ bool Test(ValueType bit) const { return (m_flags & bit) != 0; }
+
+ /// Test if all bits in \a mask are clear.
+ ///
+ /// \return
+ /// \b true if \b all flags in \a mask are clear, \b false
+ /// otherwise.
+ bool AllClear(ValueType mask) const { return (m_flags & mask) == 0; }
+
+ bool AnyClear(ValueType mask) const { return (m_flags & mask) != mask; }
+
+ /// Test a single flag bit to see if it is clear (zero).
+ ///
+ /// \return
+ /// \b true if \a bit is 0, \b false otherwise.
+ bool IsClear(ValueType bit) const { return (m_flags & bit) == 0; }
+
+ /// Get the number of zero bits in \a m_flags.
+ ///
+ /// \return
+ /// The number of bits that are set to 0 in the current flags.
+ size_t ClearCount() const {
+ size_t count = 0;
+ for (ValueType shift = 0; shift < sizeof(ValueType) * 8; ++shift) {
+ if ((m_flags & (1u << shift)) == 0)
+ ++count;
+ }
+ return count;
+ }
+
+ /// Get the number of one bits in \a m_flags.
+ ///
+ /// \return
+ /// The number of bits that are set to 1 in the current flags.
+ size_t SetCount() const {
+ size_t count = 0;
+ for (ValueType mask = m_flags; mask; mask >>= 1) {
+ if (mask & 1u)
+ ++count;
+ }
+ return count;
+ }
+
+protected:
+ ValueType m_flags; ///< The flags.
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Flags_h_
diff --git a/linux-x64/clang/include/lldb/Utility/IOObject.h b/linux-x64/clang/include/lldb/Utility/IOObject.h
new file mode 100644
index 0000000..1640200
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/IOObject.h
@@ -0,0 +1,55 @@
+//===-- IOObject.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_Common_IOObject_h_
+#define liblldb_Host_Common_IOObject_h_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class IOObject {
+public:
+ enum FDType {
+ eFDTypeFile, // Other FD requiring read/write
+ eFDTypeSocket, // Socket requiring send/recv
+ };
+
+ // TODO: On Windows this should be a HANDLE, and wait should use
+ // WaitForMultipleObjects
+ typedef int WaitableHandle;
+ static const WaitableHandle kInvalidHandleValue;
+
+ IOObject(FDType type, bool should_close)
+ : m_fd_type(type), m_should_close_fd(should_close) {}
+ virtual ~IOObject();
+
+ 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 Status Close() = 0;
+
+ FDType GetFdType() const { return m_fd_type; }
+
+ virtual WaitableHandle GetWaitableHandle() = 0;
+
+protected:
+ FDType m_fd_type;
+ bool m_should_close_fd; // True if this class should close the file descriptor
+ // when it goes away.
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(IOObject);
+};
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Utility/Iterable.h b/linux-x64/clang/include/lldb/Utility/Iterable.h
new file mode 100644
index 0000000..d9c61aa
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Iterable.h
@@ -0,0 +1,197 @@
+//===-- Iterable.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Iterable_h_
+#define liblldb_Iterable_h_
+
+#include <utility>
+
+
+namespace lldb_private {
+
+template <typename I, typename E> E map_adapter(I &iter) {
+ return iter->second;
+}
+
+template <typename I, typename E> E vector_adapter(I &iter) { return *iter; }
+
+template <typename I, typename E> E list_adapter(I &iter) { return *iter; }
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+class AdaptedConstIterator {
+public:
+ typedef typename C::const_iterator BackingIterator;
+
+ // Wrapping constructor
+ AdaptedConstIterator(BackingIterator backing_iterator)
+ : m_iter(backing_iterator) {}
+
+ // Default-constructible
+ AdaptedConstIterator() : m_iter() {}
+
+ // Copy-constructible
+ AdaptedConstIterator(const AdaptedConstIterator &rhs) : m_iter(rhs.m_iter) {}
+
+ // Copy-assignable
+ AdaptedConstIterator &operator=(const AdaptedConstIterator &rhs) {
+ m_iter = rhs.m_iter;
+ return *this;
+ }
+
+ // Destructible
+ ~AdaptedConstIterator() = default;
+
+ // Comparable
+ bool operator==(const AdaptedConstIterator &rhs) {
+ return m_iter == rhs.m_iter;
+ }
+
+ bool operator!=(const AdaptedConstIterator &rhs) {
+ return m_iter != rhs.m_iter;
+ }
+
+ // Rvalue dereferenceable
+ E operator*() { return (*A)(m_iter); }
+
+ E operator->() { return (*A)(m_iter); }
+
+ // Offset dereferenceable
+ E operator[](typename BackingIterator::difference_type offset) {
+ return AdaptedConstIterator(m_iter + offset);
+ }
+
+ // Incrementable
+ AdaptedConstIterator &operator++() {
+ m_iter++;
+ return *this;
+ }
+
+ // Decrementable
+ AdaptedConstIterator &operator--() {
+ m_iter--;
+ return *this;
+ }
+
+ // Compound assignment
+ AdaptedConstIterator &
+ operator+=(typename BackingIterator::difference_type offset) {
+ m_iter += offset;
+ return *this;
+ }
+
+ AdaptedConstIterator &
+ operator-=(typename BackingIterator::difference_type offset) {
+ m_iter -= offset;
+ return *this;
+ }
+
+ // Arithmetic
+ AdaptedConstIterator
+ operator+(typename BackingIterator::difference_type offset) {
+ return AdaptedConstIterator(m_iter + offset);
+ }
+
+ AdaptedConstIterator
+ operator-(typename BackingIterator::difference_type offset) {
+ return AdaptedConstIterator(m_iter - offset);
+ }
+
+ // Comparable
+ bool operator<(AdaptedConstIterator &rhs) { return m_iter < rhs.m_iter; }
+
+ bool operator<=(AdaptedConstIterator &rhs) { return m_iter <= rhs.m_iter; }
+
+ bool operator>(AdaptedConstIterator &rhs) { return m_iter > rhs.m_iter; }
+
+ bool operator>=(AdaptedConstIterator &rhs) { return m_iter >= rhs.m_iter; }
+
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend AdaptedConstIterator<C1, E1, A1>
+ operator+(typename C1::const_iterator::difference_type,
+ AdaptedConstIterator<C1, E1, A1> &);
+
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend typename C1::const_iterator::difference_type
+ operator-(AdaptedConstIterator<C1, E1, A1> &,
+ AdaptedConstIterator<C1, E1, A1> &);
+
+ template <typename C1, typename E1, E1 (*A1)(typename C1::const_iterator &)>
+ friend void swap(AdaptedConstIterator<C1, E1, A1> &,
+ AdaptedConstIterator<C1, E1, A1> &);
+
+private:
+ BackingIterator m_iter;
+};
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+AdaptedConstIterator<C, E, A> operator+(
+ typename AdaptedConstIterator<C, E, A>::BackingIterator::difference_type
+ offset,
+ AdaptedConstIterator<C, E, A> &rhs) {
+ return rhs.operator+(offset);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+typename AdaptedConstIterator<C, E, A>::BackingIterator::difference_type
+operator-(AdaptedConstIterator<C, E, A> &lhs,
+ AdaptedConstIterator<C, E, A> &rhs) {
+ return (lhs.m_iter - rhs.m_iter);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+void swap(AdaptedConstIterator<C, E, A> &lhs,
+ AdaptedConstIterator<C, E, A> &rhs) {
+ std::swap(lhs.m_iter, rhs.m_iter);
+}
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &)>
+class AdaptedIterable {
+private:
+ const C &m_container;
+
+public:
+ AdaptedIterable(const C &container) : m_container(container) {}
+
+ AdaptedConstIterator<C, E, A> begin() {
+ return AdaptedConstIterator<C, E, A>(m_container.begin());
+ }
+
+ AdaptedConstIterator<C, E, A> end() {
+ return AdaptedConstIterator<C, E, A>(m_container.end());
+ }
+};
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &),
+ typename MutexType>
+class LockingAdaptedIterable : public AdaptedIterable<C, E, A> {
+public:
+ LockingAdaptedIterable(C &container, MutexType &mutex)
+ : AdaptedIterable<C, E, A>(container), m_mutex(&mutex) {
+ m_mutex->lock();
+ }
+
+ LockingAdaptedIterable(LockingAdaptedIterable &&rhs)
+ : AdaptedIterable<C, E, A>(rhs), m_mutex(rhs.m_mutex) {
+ rhs.m_mutex = nullptr;
+ }
+
+ ~LockingAdaptedIterable() {
+ if (m_mutex)
+ m_mutex->unlock();
+ }
+
+private:
+ MutexType *m_mutex = nullptr;
+
+ LockingAdaptedIterable(const LockingAdaptedIterable &) = delete;
+ LockingAdaptedIterable &operator=(const LockingAdaptedIterable &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Iterable_h_
diff --git a/linux-x64/clang/include/lldb/Utility/JSON.h b/linux-x64/clang/include/lldb/Utility/JSON.h
new file mode 100644
index 0000000..172f77a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/JSON.h
@@ -0,0 +1,283 @@
+//===---------------------JSON.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_JSON_h_
+#define utility_JSON_h_
+
+#include "lldb/Utility/StringExtractor.h"
+
+#include <map>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <vector>
+
+#include <stdint.h>
+
+namespace lldb_private {
+class Stream;
+
+class JSONValue {
+public:
+ virtual void Write(Stream &s) = 0;
+
+ typedef std::shared_ptr<JSONValue> SP;
+
+ enum class Kind { String, Number, True, False, Null, Object, Array };
+
+ JSONValue(Kind k) : m_kind(k) {}
+
+ Kind GetKind() const { return m_kind; }
+
+ virtual ~JSONValue() = default;
+
+private:
+ const Kind m_kind;
+};
+
+class JSONString : public JSONValue {
+public:
+ JSONString();
+ JSONString(const char *s);
+ JSONString(const std::string &s);
+
+ JSONString(const JSONString &s) = delete;
+ JSONString &operator=(const JSONString &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONString> SP;
+
+ std::string GetData() { return m_data; }
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::String;
+ }
+
+ ~JSONString() override = default;
+
+private:
+ static std::string json_string_quote_metachars(const std::string &);
+
+ std::string m_data;
+};
+
+class JSONNumber : public JSONValue {
+public:
+ typedef std::shared_ptr<JSONNumber> SP;
+
+ // We cretae a constructor for all integer and floating point type with using
+ // templates and
+ // SFINAE to avoid having ambiguous overloads because of the implicit type
+ // promotion. If we
+ // would have constructors only with int64_t, uint64_t and double types then
+ // constructing a JSONNumber from an int32_t (or any other similar type)
+ // would fail to compile.
+
+ template <typename T, typename std::enable_if<
+ std::is_integral<T>::value &&
+ std::is_unsigned<T>::value>::type * = nullptr>
+ explicit JSONNumber(T u)
+ : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Unsigned) {
+ m_data.m_unsigned = u;
+ }
+
+ template <typename T,
+ typename std::enable_if<std::is_integral<T>::value &&
+ std::is_signed<T>::value>::type * = nullptr>
+ explicit JSONNumber(T s)
+ : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Signed) {
+ m_data.m_signed = s;
+ }
+
+ template <typename T, typename std::enable_if<
+ std::is_floating_point<T>::value>::type * = nullptr>
+ explicit JSONNumber(T d)
+ : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Double) {
+ m_data.m_double = d;
+ }
+
+ ~JSONNumber() override = default;
+
+ JSONNumber(const JSONNumber &s) = delete;
+ JSONNumber &operator=(const JSONNumber &s) = delete;
+
+ void Write(Stream &s) override;
+
+ uint64_t GetAsUnsigned() const;
+
+ int64_t GetAsSigned() const;
+
+ double GetAsDouble() const;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::Number;
+ }
+
+private:
+ enum class DataType : uint8_t { Unsigned, Signed, Double } m_data_type;
+
+ union {
+ uint64_t m_unsigned;
+ int64_t m_signed;
+ double m_double;
+ } m_data;
+};
+
+class JSONTrue : public JSONValue {
+public:
+ JSONTrue();
+
+ JSONTrue(const JSONTrue &s) = delete;
+ JSONTrue &operator=(const JSONTrue &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONTrue> SP;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::True;
+ }
+
+ ~JSONTrue() override = default;
+};
+
+class JSONFalse : public JSONValue {
+public:
+ JSONFalse();
+
+ JSONFalse(const JSONFalse &s) = delete;
+ JSONFalse &operator=(const JSONFalse &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONFalse> SP;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::False;
+ }
+
+ ~JSONFalse() override = default;
+};
+
+class JSONNull : public JSONValue {
+public:
+ JSONNull();
+
+ JSONNull(const JSONNull &s) = delete;
+ JSONNull &operator=(const JSONNull &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONNull> SP;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::Null;
+ }
+
+ ~JSONNull() override = default;
+};
+
+class JSONObject : public JSONValue {
+public:
+ JSONObject();
+
+ JSONObject(const JSONObject &s) = delete;
+ JSONObject &operator=(const JSONObject &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONObject> SP;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::Object;
+ }
+
+ bool SetObject(const std::string &key, JSONValue::SP value);
+
+ JSONValue::SP GetObject(const std::string &key);
+
+ ~JSONObject() override = default;
+
+private:
+ typedef std::map<std::string, JSONValue::SP> Map;
+ typedef Map::iterator Iterator;
+ Map m_elements;
+};
+
+class JSONArray : public JSONValue {
+public:
+ JSONArray();
+
+ JSONArray(const JSONArray &s) = delete;
+ JSONArray &operator=(const JSONArray &s) = delete;
+
+ void Write(Stream &s) override;
+
+ typedef std::shared_ptr<JSONArray> SP;
+
+ static bool classof(const JSONValue *V) {
+ return V->GetKind() == JSONValue::Kind::Array;
+ }
+
+private:
+ typedef std::vector<JSONValue::SP> Vector;
+ typedef Vector::iterator Iterator;
+ typedef Vector::size_type Index;
+ typedef Vector::size_type Size;
+
+public:
+ bool SetObject(Index i, JSONValue::SP value);
+
+ bool AppendObject(JSONValue::SP value);
+
+ JSONValue::SP GetObject(Index i);
+
+ Size GetNumElements();
+
+ ~JSONArray() override = default;
+
+ Vector m_elements;
+};
+
+class JSONParser : public StringExtractor {
+public:
+ enum Token {
+ Invalid,
+ Status,
+ ObjectStart,
+ ObjectEnd,
+ ArrayStart,
+ ArrayEnd,
+ Comma,
+ Colon,
+ String,
+ Integer,
+ Float,
+ True,
+ False,
+ Null,
+ EndOfFile
+ };
+
+ JSONParser(llvm::StringRef data);
+
+ int GetEscapedChar(bool &was_escaped);
+
+ Token GetToken(std::string &value);
+
+ JSONValue::SP ParseJSONValue();
+
+protected:
+ JSONValue::SP ParseJSONObject();
+
+ JSONValue::SP ParseJSONArray();
+};
+} // namespace lldb_private
+
+#endif // utility_JSON_h_
diff --git a/linux-x64/clang/include/lldb/Utility/LLDBAssert.h b/linux-x64/clang/include/lldb/Utility/LLDBAssert.h
new file mode 100644
index 0000000..7008dd8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/LLDBAssert.h
@@ -0,0 +1,25 @@
+//===----------------- LLDBAssert.h ------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_LLDBAssert_h_
+#define utility_LLDBAssert_h_
+
+#ifdef LLDB_CONFIGURATION_DEBUG
+#define lldbassert(x) assert(x)
+#else
+#define lldbassert(x) \
+ lldb_private::lldb_assert(static_cast<bool>(x), #x, __FUNCTION__, __FILE__, \
+ __LINE__)
+#endif
+
+namespace lldb_private {
+void lldb_assert(bool expression, const char *expr_text, const char *func,
+ const char *file, unsigned int line);
+}
+
+#endif // utility_LLDBAssert_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Listener.h b/linux-x64/clang/include/lldb/Utility/Listener.h
new file mode 100644
index 0000000..17fc478
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Listener.h
@@ -0,0 +1,153 @@
+//===-- Listener.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_LISTENER_H
+#define LLDB_UTILITY_LISTENER_H
+
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Timeout.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-forward.h"
+
+#include <condition_variable>
+#include <list>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <ratio>
+#include <string>
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+class ConstString;
+class Event;
+}
+
+namespace lldb_private {
+
+class Listener : public std::enable_shared_from_this<Listener> {
+public:
+ typedef bool (*HandleBroadcastCallback)(lldb::EventSP &event_sp, void *baton);
+
+ friend class Broadcaster;
+ friend class BroadcasterManager;
+
+ // Constructors and Destructors
+ //
+ // Listeners have to be constructed into shared pointers - at least if you
+ // want them to listen to Broadcasters,
+protected:
+ Listener(const char *name);
+
+public:
+ static lldb::ListenerSP MakeListener(const char *name);
+
+ ~Listener();
+
+ void AddEvent(lldb::EventSP &event);
+
+ void Clear();
+
+ const char *GetName() { return m_name.c_str(); }
+
+ uint32_t
+ StartListeningForEventSpec(const lldb::BroadcasterManagerSP &manager_sp,
+ const BroadcastEventSpec &event_spec);
+
+ bool StopListeningForEventSpec(const lldb::BroadcasterManagerSP &manager_sp,
+ const BroadcastEventSpec &event_spec);
+
+ uint32_t StartListeningForEvents(Broadcaster *broadcaster,
+ uint32_t event_mask);
+
+ uint32_t StartListeningForEvents(Broadcaster *broadcaster,
+ uint32_t event_mask,
+ HandleBroadcastCallback callback,
+ void *callback_user_data);
+
+ bool StopListeningForEvents(Broadcaster *broadcaster, uint32_t event_mask);
+
+ Event *PeekAtNextEvent();
+
+ Event *PeekAtNextEventForBroadcaster(Broadcaster *broadcaster);
+
+ Event *PeekAtNextEventForBroadcasterWithType(Broadcaster *broadcaster,
+ uint32_t event_type_mask);
+
+ // Returns true if an event was received, false if we timed out.
+ bool GetEvent(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout);
+
+ bool GetEventForBroadcaster(Broadcaster *broadcaster, lldb::EventSP &event_sp,
+ const Timeout<std::micro> &timeout);
+
+ bool GetEventForBroadcasterWithType(Broadcaster *broadcaster,
+ uint32_t event_type_mask,
+ lldb::EventSP &event_sp,
+ const Timeout<std::micro> &timeout);
+
+ size_t HandleBroadcastEvent(lldb::EventSP &event_sp);
+
+private:
+ // Classes that inherit from Listener can see and modify these
+ struct BroadcasterInfo {
+ BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = nullptr,
+ void *ud = nullptr)
+ : event_mask(mask), callback(cb), callback_user_data(ud) {}
+
+ uint32_t event_mask;
+ HandleBroadcastCallback callback;
+ void *callback_user_data;
+ };
+
+ typedef std::multimap<Broadcaster::BroadcasterImplWP, BroadcasterInfo,
+ std::owner_less<Broadcaster::BroadcasterImplWP>>
+ broadcaster_collection;
+ typedef std::list<lldb::EventSP> event_collection;
+ typedef std::vector<lldb::BroadcasterManagerWP>
+ broadcaster_manager_collection;
+
+ bool
+ FindNextEventInternal(std::unique_lock<std::mutex> &lock,
+ Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources, uint32_t event_type_mask,
+ lldb::EventSP &event_sp, bool remove);
+
+ bool GetEventInternal(const Timeout<std::micro> &timeout,
+ Broadcaster *broadcaster, // nullptr for any broadcaster
+ const ConstString *sources, // nullptr for any event
+ uint32_t num_sources, uint32_t event_type_mask,
+ lldb::EventSP &event_sp);
+
+ std::string m_name;
+ broadcaster_collection m_broadcasters;
+ std::recursive_mutex m_broadcasters_mutex; // Protects m_broadcasters
+ event_collection m_events;
+ std::mutex m_events_mutex; // Protects m_broadcasters and m_events
+ std::condition_variable m_events_condition;
+ broadcaster_manager_collection m_broadcaster_managers;
+
+ void BroadcasterWillDestruct(Broadcaster *);
+
+ void BroadcasterManagerWillDestruct(lldb::BroadcasterManagerSP manager_sp);
+
+ // broadcaster_collection::iterator
+ // FindBroadcasterWithMask (Broadcaster *broadcaster,
+ // uint32_t event_mask,
+ // bool exact);
+
+ // For Listener only
+ DISALLOW_COPY_AND_ASSIGN(Listener);
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_LISTENER_H
diff --git a/linux-x64/clang/include/lldb/Utility/Log.h b/linux-x64/clang/include/lldb/Utility/Log.h
new file mode 100644
index 0000000..949de69
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Log.h
@@ -0,0 +1,236 @@
+//===-- Log.h ---------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/RWMutex.h"
+
+#include <atomic>
+#include <cstdarg>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <type_traits>
+
+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 void Initialize();
+
+ // 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)...));
+ }
+
+ template <typename... Args>
+ void FormatError(llvm::Error error, llvm::StringRef file,
+ llvm::StringRef function, const char *format,
+ Args &&... args) {
+ Format(file, function,
+ llvm::formatv(format, llvm::toString(std::move(error)),
+ 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);
+
+ static void DisableLoggingChild();
+
+ 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__, __func__, __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__, __func__, __VA_ARGS__); \
+ } while (0)
+
+// Write message to log, if error is set. In the log message refer to the error
+// with {0}. Error is cleared regardless of whether logging is enabled.
+#define LLDB_LOG_ERROR(log, error, ...) \
+ do { \
+ ::lldb_private::Log *log_private = (log); \
+ ::llvm::Error error_private = (error); \
+ if (log_private && error_private) { \
+ log_private->FormatError(::std::move(error_private), __FILE__, __func__, \
+ __VA_ARGS__); \
+ } else \
+ ::llvm::consumeError(::std::move(error_private)); \
+ } while (0)
+
+#endif // LLDB_UTILITY_LOG_H
diff --git a/linux-x64/clang/include/lldb/Utility/Logging.h b/linux-x64/clang/include/lldb/Utility/Logging.h
new file mode 100644
index 0000000..41086fe
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Logging.h
@@ -0,0 +1,67 @@
+//===-- Logging.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_LOGGING_H
+#define LLDB_UTILITY_LOGGING_H
+
+#include <cstdint>
+
+// Log Bits specific to logging in lldb
+#define LIBLLDB_LOG_PROCESS (1u << 1)
+#define LIBLLDB_LOG_THREAD (1u << 2)
+#define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 3)
+#define LIBLLDB_LOG_EVENTS (1u << 4)
+#define LIBLLDB_LOG_BREAKPOINTS (1u << 5)
+#define LIBLLDB_LOG_WATCHPOINTS (1u << 6)
+#define LIBLLDB_LOG_STEP (1u << 7)
+#define LIBLLDB_LOG_EXPRESSIONS (1u << 8)
+#define LIBLLDB_LOG_TEMPORARY (1u << 9)
+#define LIBLLDB_LOG_STATE (1u << 10)
+#define LIBLLDB_LOG_OBJECT (1u << 11)
+#define LIBLLDB_LOG_COMMUNICATION (1u << 12)
+#define LIBLLDB_LOG_CONNECTION (1u << 13)
+#define LIBLLDB_LOG_HOST (1u << 14)
+#define LIBLLDB_LOG_UNWIND (1u << 15)
+#define LIBLLDB_LOG_API (1u << 16)
+#define LIBLLDB_LOG_SCRIPT (1u << 17)
+#define LIBLLDB_LOG_COMMANDS (1U << 18)
+#define LIBLLDB_LOG_TYPES (1u << 19)
+#define LIBLLDB_LOG_SYMBOLS (1u << 20)
+#define LIBLLDB_LOG_MODULES (1u << 21)
+#define LIBLLDB_LOG_TARGET (1u << 22)
+#define LIBLLDB_LOG_MMAP (1u << 23)
+#define LIBLLDB_LOG_OS (1u << 24)
+#define LIBLLDB_LOG_PLATFORM (1u << 25)
+#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26)
+#define LIBLLDB_LOG_JIT_LOADER (1u << 27)
+#define LIBLLDB_LOG_LANGUAGE (1u << 28)
+#define LIBLLDB_LOG_DATAFORMATTERS (1u << 29)
+#define LIBLLDB_LOG_DEMANGLE (1u << 30)
+#define LIBLLDB_LOG_AST (1u << 31)
+#define LIBLLDB_LOG_ALL (UINT32_MAX)
+#define LIBLLDB_LOG_DEFAULT \
+ (LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD | LIBLLDB_LOG_DYNAMIC_LOADER | \
+ LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_WATCHPOINTS | LIBLLDB_LOG_STEP | \
+ LIBLLDB_LOG_STATE | LIBLLDB_LOG_SYMBOLS | LIBLLDB_LOG_TARGET | \
+ LIBLLDB_LOG_COMMANDS)
+
+namespace lldb_private {
+
+class Log;
+
+void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...);
+
+Log *GetLogIfAllCategoriesSet(uint32_t mask);
+
+Log *GetLogIfAnyCategoriesSet(uint32_t mask);
+
+void InitializeLldbChannel();
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_LOGGING_H
diff --git a/linux-x64/clang/include/lldb/Utility/NameMatches.h b/linux-x64/clang/include/lldb/Utility/NameMatches.h
new file mode 100644
index 0000000..38900df
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/NameMatches.h
@@ -0,0 +1,28 @@
+//===-- NameMatches.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLDB_UTILITY_NAMEMATCHES_H
+#define LLDB_UTILITY_NAMEMATCHES_H
+
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+enum class NameMatch {
+ Ignore,
+ Equals,
+ Contains,
+ StartsWith,
+ EndsWith,
+ RegularExpression
+};
+
+bool NameMatches(llvm::StringRef name, NameMatch match_type,
+ llvm::StringRef match);
+}
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Utility/Predicate.h b/linux-x64/clang/include/lldb/Utility/Predicate.h
new file mode 100644
index 0000000..f1539b5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Predicate.h
@@ -0,0 +1,231 @@
+//===-- Predicate.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Predicate_h_
+#define liblldb_Predicate_h_
+
+#include <stdint.h>
+#include <time.h>
+
+#include <condition_variable>
+#include <mutex>
+
+#include "lldb/Utility/Timeout.h"
+#include "lldb/lldb-defines.h"
+
+//#define DB_PTHREAD_LOG_EVENTS
+
+/// Enumerations for broadcasting.
+namespace lldb_private {
+
+enum PredicateBroadcastType {
+ eBroadcastNever, ///< No broadcast will be sent when the value is modified.
+ eBroadcastAlways, ///< Always send a broadcast when the value is modified.
+ eBroadcastOnChange ///< Only broadcast if the value changes when the value is
+ /// modified.
+};
+
+/// \class Predicate Predicate.h "lldb/Utility/Predicate.h"
+/// A C++ wrapper class for providing threaded access to a value of
+/// type T.
+///
+/// A templatized class that provides multi-threaded access to a value
+/// of type T. Threads can efficiently wait for bits within T to be set
+/// or reset, or wait for T to be set to be equal/not equal to a
+/// specified values.
+template <class T> class Predicate {
+public:
+ /// Default constructor.
+ ///
+ /// Initializes the mutex, condition and value with their default
+ /// constructors.
+ Predicate() : m_value(), m_mutex(), m_condition() {}
+
+ /// Construct with initial T value \a initial_value.
+ ///
+ /// Initializes the mutex and condition with their default
+ /// constructors, and initializes the value with \a initial_value.
+ ///
+ /// \param[in] initial_value
+ /// The initial value for our T object.
+ Predicate(T initial_value)
+ : m_value(initial_value), m_mutex(), m_condition() {}
+
+ /// Destructor.
+ ///
+ /// Destroy the condition, mutex, and T objects.
+ ~Predicate() = default;
+
+ /// Value get accessor.
+ ///
+ /// Copies the current \a m_value in a thread safe manor and returns
+ /// the copied value.
+ ///
+ /// \return
+ /// A copy of the current value.
+ T GetValue() const {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ T value = m_value;
+ return value;
+ }
+
+ /// Value set accessor.
+ ///
+ /// Set the contained \a m_value to \a new_value in a thread safe
+ /// way and broadcast if needed.
+ ///
+ /// \param[in] value
+ /// The new value to set.
+ ///
+ /// \param[in] broadcast_type
+ /// A value indicating when and if to broadcast. See the
+ /// PredicateBroadcastType enumeration for details.
+ ///
+ /// \see Predicate::Broadcast()
+ void SetValue(T value, PredicateBroadcastType broadcast_type) {
+ std::lock_guard<std::mutex> guard(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+ printf("%s (value = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, value,
+ broadcast_type);
+#endif
+ const T old_value = m_value;
+ m_value = value;
+
+ Broadcast(old_value, broadcast_type);
+ }
+
+ /// Wait for Cond(m_value) to be true.
+ ///
+ /// Waits in a thread safe way for Cond(m_value) to be true. If Cond(m_value)
+ /// is already true, this function will return without waiting.
+ ///
+ /// It is possible for the value to be changed between the time the value is
+ /// set and the time the waiting thread wakes up. If the value no longer
+ /// satisfies the condition when the waiting thread wakes up, it will go back
+ /// into a wait state. It may be necessary for the calling code to use
+ /// additional thread synchronization methods to detect transitory states.
+ ///
+ /// \param[in] Cond
+ /// The condition we want \a m_value satisfy.
+ ///
+ /// \param[in] timeout
+ /// How long to wait for the condition to hold.
+ ///
+ /// \return
+ /// \li m_value if Cond(m_value) is true.
+ /// \li None otherwise (timeout occurred).
+ template <typename C>
+ llvm::Optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
+ std::unique_lock<std::mutex> lock(m_mutex);
+ auto RealCond = [&] { return Cond(m_value); };
+ if (!timeout) {
+ m_condition.wait(lock, RealCond);
+ return m_value;
+ }
+ if (m_condition.wait_for(lock, *timeout, RealCond))
+ return m_value;
+ return llvm::None;
+ }
+ /// Wait for \a m_value to be equal to \a value.
+ ///
+ /// Waits in a thread safe way for \a m_value to be equal to \a
+ /// value. If \a m_value is already equal to \a value, this
+ /// function will return without waiting.
+ ///
+ /// It is possible for the value to be changed between the time
+ /// the value is set and the time the waiting thread wakes up.
+ /// If the value no longer matches the requested value when the
+ /// waiting thread wakes up, it will go back into a wait state. It
+ /// may be necessary for the calling code to use additional thread
+ /// synchronization methods to detect transitory states.
+ ///
+ /// \param[in] value
+ /// The value we want \a m_value to be equal to.
+ ///
+ /// \param[in] timeout
+ /// How long to wait for the condition to hold.
+ ///
+ /// \return
+ /// \li \b true if the \a m_value is equal to \a value
+ /// \li \b false otherwise (timeout occurred)
+ bool WaitForValueEqualTo(T value,
+ const Timeout<std::micro> &timeout = llvm::None) {
+ return WaitFor([&value](T current) { return value == current; }, timeout) !=
+ llvm::None;
+ }
+
+ /// Wait for \a m_value to not be equal to \a value.
+ ///
+ /// Waits in a thread safe way for \a m_value to not be equal to \a
+ /// value. If \a m_value is already not equal to \a value, this
+ /// function will return without waiting.
+ ///
+ /// It is possible for the value to be changed between the time
+ /// the value is set and the time the waiting thread wakes up.
+ /// If the value is equal to the test value when the waiting thread
+ /// wakes up, it will go back into a wait state. It may be
+ /// necessary for the calling code to use additional thread
+ /// synchronization methods to detect transitory states.
+ ///
+ /// \param[in] value
+ /// The value we want \a m_value to not be equal to.
+ ///
+ /// \param[in] timeout
+ /// How long to wait for the condition to hold.
+ ///
+ /// \return
+ /// \li m_value if m_value != value
+ /// \li None otherwise (timeout occurred).
+ llvm::Optional<T>
+ WaitForValueNotEqualTo(T value,
+ const Timeout<std::micro> &timeout = llvm::None) {
+ return WaitFor([&value](T current) { return value != current; }, timeout);
+ }
+
+protected:
+ // pthread condition and mutex variable to control access and allow blocking
+ // between the main thread and the spotlight index thread.
+ T m_value; ///< The templatized value T that we are protecting access to
+ mutable std::mutex m_mutex; ///< The mutex to use when accessing the data
+ std::condition_variable m_condition; ///< The pthread condition variable to
+ /// use for signaling that data available
+ /// or changed.
+
+private:
+ /// Broadcast if needed.
+ ///
+ /// Check to see if we need to broadcast to our condition variable
+ /// depending on the \a old_value and on the \a broadcast_type.
+ ///
+ /// If \a broadcast_type is eBroadcastNever, no broadcast will be
+ /// sent.
+ ///
+ /// If \a broadcast_type is eBroadcastAlways, the condition variable
+ /// will always be broadcast.
+ ///
+ /// If \a broadcast_type is eBroadcastOnChange, the condition
+ /// variable be broadcast if the owned value changes.
+ void Broadcast(T old_value, PredicateBroadcastType broadcast_type) {
+ bool broadcast =
+ (broadcast_type == eBroadcastAlways) ||
+ ((broadcast_type == eBroadcastOnChange) && old_value != m_value);
+#ifdef DB_PTHREAD_LOG_EVENTS
+ printf("%s (old_value = 0x%8.8x, broadcast_type = %i) m_value = 0x%8.8x, "
+ "broadcast = %u\n",
+ __FUNCTION__, old_value, broadcast_type, m_value, broadcast);
+#endif
+ if (broadcast)
+ m_condition.notify_all();
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(Predicate);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Predicate_h_
diff --git a/linux-x64/clang/include/lldb/Utility/ProcessInfo.h b/linux-x64/clang/include/lldb/Utility/ProcessInfo.h
new file mode 100644
index 0000000..a25c06c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/ProcessInfo.h
@@ -0,0 +1,245 @@
+//===-- ProcessInfo.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_PROCESSINFO_H
+#define LLDB_UTILITY_PROCESSINFO_H
+
+// LLDB headers
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/Environment.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/NameMatches.h"
+
+#include <vector>
+
+namespace lldb_private {
+
+class UserIDResolver;
+
+// ProcessInfo
+//
+// A base class for information for a process. This can be used to fill
+// out information for a process prior to launching it, or it can be used for
+// an instance of a process and can be filled in with the existing values for
+// that process.
+class ProcessInfo {
+public:
+ ProcessInfo();
+
+ ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid);
+
+ void Clear();
+
+ const char *GetName() const;
+
+ size_t GetNameLength() const;
+
+ FileSpec &GetExecutableFile() { return m_executable; }
+
+ void SetExecutableFile(const FileSpec &exe_file,
+ bool add_exe_file_as_first_arg);
+
+ const FileSpec &GetExecutableFile() const { return m_executable; }
+
+ uint32_t GetUserID() const { return m_uid; }
+
+ uint32_t GetGroupID() const { return m_gid; }
+
+ bool UserIDIsValid() const { return m_uid != UINT32_MAX; }
+
+ bool GroupIDIsValid() const { return m_gid != UINT32_MAX; }
+
+ void SetUserID(uint32_t uid) { m_uid = uid; }
+
+ void SetGroupID(uint32_t gid) { m_gid = gid; }
+
+ ArchSpec &GetArchitecture() { return m_arch; }
+
+ const ArchSpec &GetArchitecture() const { return m_arch; }
+
+ void SetArchitecture(const ArchSpec &arch) { m_arch = arch; }
+
+ lldb::pid_t GetProcessID() const { return m_pid; }
+
+ void SetProcessID(lldb::pid_t pid) { m_pid = pid; }
+
+ bool ProcessIDIsValid() const { return m_pid != LLDB_INVALID_PROCESS_ID; }
+
+ void Dump(Stream &s, Platform *platform) const;
+
+ Args &GetArguments() { return m_arguments; }
+
+ const Args &GetArguments() const { return m_arguments; }
+
+ llvm::StringRef GetArg0() const;
+
+ void SetArg0(llvm::StringRef arg);
+
+ void SetArguments(const Args &args, bool first_arg_is_executable);
+
+ void SetArguments(char const **argv, bool first_arg_is_executable);
+
+ Environment &GetEnvironment() { return m_environment; }
+ const Environment &GetEnvironment() const { return m_environment; }
+
+protected:
+ FileSpec m_executable;
+ std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
+ // Not all process plug-ins support specifying an argv[0] that differs from
+ // the resolved platform executable (which is in m_executable)
+ Args m_arguments; // All program arguments except argv[0]
+ Environment m_environment;
+ uint32_t m_uid;
+ uint32_t m_gid;
+ ArchSpec m_arch;
+ lldb::pid_t m_pid;
+};
+
+// ProcessInstanceInfo
+//
+// Describes an existing process and any discoverable information that pertains
+// to that process.
+class ProcessInstanceInfo : public ProcessInfo {
+public:
+ ProcessInstanceInfo()
+ : ProcessInfo(), m_euid(UINT32_MAX), m_egid(UINT32_MAX),
+ m_parent_pid(LLDB_INVALID_PROCESS_ID) {}
+
+ ProcessInstanceInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid)
+ : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX),
+ m_parent_pid(LLDB_INVALID_PROCESS_ID) {}
+
+ void Clear() {
+ ProcessInfo::Clear();
+ m_euid = UINT32_MAX;
+ m_egid = UINT32_MAX;
+ m_parent_pid = LLDB_INVALID_PROCESS_ID;
+ }
+
+ uint32_t GetEffectiveUserID() const { return m_euid; }
+
+ uint32_t GetEffectiveGroupID() const { return m_egid; }
+
+ bool EffectiveUserIDIsValid() const { return m_euid != UINT32_MAX; }
+
+ bool EffectiveGroupIDIsValid() const { return m_egid != UINT32_MAX; }
+
+ void SetEffectiveUserID(uint32_t uid) { m_euid = uid; }
+
+ void SetEffectiveGroupID(uint32_t gid) { m_egid = gid; }
+
+ lldb::pid_t GetParentProcessID() const { return m_parent_pid; }
+
+ void SetParentProcessID(lldb::pid_t pid) { m_parent_pid = pid; }
+
+ bool ParentProcessIDIsValid() const {
+ return m_parent_pid != LLDB_INVALID_PROCESS_ID;
+ }
+
+ void Dump(Stream &s, UserIDResolver &resolver) const;
+
+ static void DumpTableHeader(Stream &s, bool show_args, bool verbose);
+
+ void DumpAsTableRow(Stream &s, UserIDResolver &resolver, bool show_args,
+ bool verbose) const;
+
+protected:
+ uint32_t m_euid;
+ uint32_t m_egid;
+ lldb::pid_t m_parent_pid;
+};
+
+class ProcessInstanceInfoList {
+public:
+ ProcessInstanceInfoList() = default;
+
+ void Clear() { m_infos.clear(); }
+
+ size_t GetSize() { return m_infos.size(); }
+
+ void Append(const ProcessInstanceInfo &info) { m_infos.push_back(info); }
+
+ const char *GetProcessNameAtIndex(size_t idx) {
+ return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr);
+ }
+
+ size_t GetProcessNameLengthAtIndex(size_t idx) {
+ return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0);
+ }
+
+ lldb::pid_t GetProcessIDAtIndex(size_t idx) {
+ return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0);
+ }
+
+ bool GetInfoAtIndex(size_t idx, ProcessInstanceInfo &info) {
+ if (idx < m_infos.size()) {
+ info = m_infos[idx];
+ return true;
+ }
+ return false;
+ }
+
+ // You must ensure "idx" is valid before calling this function
+ const ProcessInstanceInfo &GetProcessInfoAtIndex(size_t idx) const {
+ assert(idx < m_infos.size());
+ return m_infos[idx];
+ }
+
+protected:
+ std::vector<ProcessInstanceInfo> m_infos;
+};
+
+// ProcessInstanceInfoMatch
+//
+// A class to help matching one ProcessInstanceInfo to another.
+
+class ProcessInstanceInfoMatch {
+public:
+ ProcessInstanceInfoMatch()
+ : m_match_info(), m_name_match_type(NameMatch::Ignore),
+ m_match_all_users(false) {}
+
+ ProcessInstanceInfoMatch(const char *process_name,
+ 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,
+ FileSpec::Style::native);
+ }
+
+ ProcessInstanceInfo &GetProcessInfo() { return m_match_info; }
+
+ const ProcessInstanceInfo &GetProcessInfo() const { return m_match_info; }
+
+ bool GetMatchAllUsers() const { return m_match_all_users; }
+
+ void SetMatchAllUsers(bool b) { m_match_all_users = b; }
+
+ NameMatch GetNameMatchType() const { return m_name_match_type; }
+
+ void SetNameMatchType(NameMatch name_match_type) {
+ m_name_match_type = name_match_type;
+ }
+
+ bool NameMatches(const char *process_name) const;
+
+ bool Matches(const ProcessInstanceInfo &proc_info) const;
+
+ bool MatchAllProcesses() const;
+ void Clear();
+
+protected:
+ ProcessInstanceInfo m_match_info;
+ NameMatch m_name_match_type;
+ bool m_match_all_users;
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_UTILITY_PROCESSINFO_H
diff --git a/linux-x64/clang/include/lldb/Utility/RangeMap.h b/linux-x64/clang/include/lldb/Utility/RangeMap.h
new file mode 100644
index 0000000..36401f5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/RangeMap.h
@@ -0,0 +1,938 @@
+//===-- RangeMap.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_RANGEMAP_H
+#define LLDB_UTILITY_RANGEMAP_H
+
+#include <algorithm>
+#include <vector>
+
+#include "llvm/ADT/SmallVector.h"
+
+#include "lldb/lldb-private.h"
+
+// Uncomment to make sure all Range objects are sorted when needed
+//#define ASSERT_RANGEMAP_ARE_SORTED
+
+namespace lldb_private {
+
+// Templatized classes for dealing with generic ranges and also collections of
+// ranges, or collections of ranges that have associated data.
+
+// A simple range class where you get to define the type of the range
+// base "B", and the type used for the range byte size "S".
+template <typename B, typename S> struct Range {
+ typedef B BaseType;
+ typedef S SizeType;
+
+ BaseType base;
+ SizeType size;
+
+ Range() : base(0), size(0) {}
+
+ Range(BaseType b, SizeType s) : base(b), size(s) {}
+
+ void Clear(BaseType b = 0) {
+ base = b;
+ size = 0;
+ }
+
+ // Set the start value for the range, and keep the same size
+ BaseType GetRangeBase() const { return base; }
+
+ void SetRangeBase(BaseType b) { base = b; }
+
+ 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) {
+ if (end > base)
+ size = end - base;
+ else
+ size = 0;
+ }
+
+ SizeType GetByteSize() const { return size; }
+
+ void SetByteSize(SizeType s) { size = s; }
+
+ bool IsValid() const { return size > 0; }
+
+ bool Contains(BaseType r) const {
+ return (GetRangeBase() <= r) && (r < GetRangeEnd());
+ }
+
+ bool ContainsEndInclusive(BaseType r) const {
+ return (GetRangeBase() <= r) && (r <= GetRangeEnd());
+ }
+
+ bool Contains(const Range &range) const {
+ return Contains(range.GetRangeBase()) &&
+ ContainsEndInclusive(range.GetRangeEnd());
+ }
+
+ // Returns true if the two ranges adjoing or intersect
+ bool DoesAdjoinOrIntersect(const Range &rhs) const {
+ const BaseType lhs_base = this->GetRangeBase();
+ const BaseType rhs_base = rhs.GetRangeBase();
+ const BaseType lhs_end = this->GetRangeEnd();
+ const BaseType rhs_end = rhs.GetRangeEnd();
+ bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
+ return result;
+ }
+
+ // Returns true if the two ranges intersect
+ bool DoesIntersect(const Range &rhs) const {
+ const BaseType lhs_base = this->GetRangeBase();
+ const BaseType rhs_base = rhs.GetRangeBase();
+ const BaseType lhs_end = this->GetRangeEnd();
+ const BaseType rhs_end = rhs.GetRangeEnd();
+ bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
+ return result;
+ }
+
+ bool operator<(const Range &rhs) const {
+ if (base == rhs.base)
+ return size < rhs.size;
+ return base < rhs.base;
+ }
+
+ bool operator==(const Range &rhs) const {
+ return base == rhs.base && size == rhs.size;
+ }
+
+ bool operator!=(const Range &rhs) const {
+ return base != rhs.base || size != rhs.size;
+ }
+};
+
+// A range array class where you get to define the type of the ranges
+// that the collection contains.
+
+template <typename B, typename S, unsigned N> class RangeArray {
+public:
+ typedef B BaseType;
+ typedef S SizeType;
+ typedef Range<B, S> Entry;
+ typedef llvm::SmallVector<Entry, N> Collection;
+
+ RangeArray() = default;
+
+ ~RangeArray() = default;
+
+ void Append(const Entry &entry) { m_entries.push_back(entry); }
+
+ void Append(B base, S size) { m_entries.emplace_back(base, size); }
+
+ bool RemoveEntrtAtIndex(uint32_t idx) {
+ if (idx < m_entries.size()) {
+ m_entries.erase(m_entries.begin() + idx);
+ return true;
+ }
+ return false;
+ }
+
+ void Sort() {
+ if (m_entries.size() > 1)
+ std::stable_sort(m_entries.begin(), m_entries.end());
+ }
+
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ bool IsSorted() const {
+ typename Collection::const_iterator pos, end, prev;
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
+ prev = pos++) {
+ if (prev != end && *pos < *prev)
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ void CombineConsecutiveRanges() {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ // Can't combine if ranges if we have zero or one range
+ if (m_entries.size() > 1) {
+ // The list should be sorted prior to calling this function
+ typename Collection::iterator pos;
+ typename Collection::iterator end;
+ typename Collection::iterator prev;
+ bool can_combine = false;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
+ pos != end; prev = pos++) {
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
+ can_combine = true;
+ break;
+ }
+ }
+
+ // We we can combine at least one entry, then we make a new collection
+ // and populate it accordingly, and then swap it into place.
+ if (can_combine) {
+ Collection minimal_ranges;
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
+ pos != end; prev = pos++) {
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+ minimal_ranges.back().SetRangeEnd(
+ std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
+ else
+ minimal_ranges.push_back(*pos);
+ }
+ // Use the swap technique in case our new vector is much smaller. We
+ // must swap when using the STL because std::vector objects never
+ // release or reduce the memory once it has been allocated/reserved.
+ m_entries.swap(minimal_ranges);
+ }
+ }
+ }
+
+ BaseType GetMinRangeBase(BaseType fail_value) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (m_entries.empty())
+ return fail_value;
+ // m_entries must be sorted, so if we aren't empty, we grab the first
+ // range's base
+ return m_entries.front().GetRangeBase();
+ }
+
+ BaseType GetMaxRangeEnd(BaseType fail_value) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (m_entries.empty())
+ return fail_value;
+ // m_entries must be sorted, so if we aren't empty, we grab the last
+ // range's end
+ return m_entries.back().GetRangeEnd();
+ }
+
+ void Slide(BaseType slide) {
+ typename Collection::iterator pos, end;
+ for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
+ pos->Slide(slide);
+ }
+
+ void Clear() { m_entries.clear(); }
+
+ bool IsEmpty() const { return m_entries.empty(); }
+
+ size_t GetSize() const { return m_entries.size(); }
+
+ const Entry *GetEntryAtIndex(size_t i) const {
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+ }
+
+ // Clients must ensure that "i" is a valid index prior to calling this
+ // function
+ const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
+
+ Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
+
+ const Entry *Back() const {
+ return (m_entries.empty() ? nullptr : &m_entries.back());
+ }
+
+ static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.GetRangeBase() < rhs.GetRangeBase();
+ }
+
+ uint32_t FindEntryIndexThatContains(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ Entry entry(addr, 1);
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, entry, BaseLessThan);
+
+ if (pos != end && pos->Contains(addr)) {
+ return std::distance(begin, pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(addr))
+ return std::distance(begin, pos);
+ }
+ }
+ return UINT32_MAX;
+ }
+
+ const Entry *FindEntryThatContains(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ Entry entry(addr, 1);
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, entry, BaseLessThan);
+
+ if (pos != end && pos->Contains(addr)) {
+ return &(*pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(addr)) {
+ return &(*pos);
+ }
+ }
+ }
+ return nullptr;
+ }
+
+ const Entry *FindEntryThatContains(const Entry &range) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, range, BaseLessThan);
+
+ if (pos != end && pos->Contains(range)) {
+ return &(*pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(range)) {
+ return &(*pos);
+ }
+ }
+ }
+ return nullptr;
+ }
+
+protected:
+ Collection m_entries;
+};
+
+template <typename B, typename S> class RangeVector {
+public:
+ typedef B BaseType;
+ typedef S SizeType;
+ typedef Range<B, S> Entry;
+ typedef std::vector<Entry> Collection;
+
+ RangeVector() = default;
+
+ ~RangeVector() = default;
+
+ void Append(const Entry &entry) { m_entries.push_back(entry); }
+
+ void Append(B base, S size) { m_entries.emplace_back(base, size); }
+
+ // 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;
+ }
+ return false;
+ }
+
+ void Sort() {
+ if (m_entries.size() > 1)
+ std::stable_sort(m_entries.begin(), m_entries.end());
+ }
+
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ bool IsSorted() const {
+ typename Collection::const_iterator pos, end, prev;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
+ prev = pos++) {
+ if (prev != end && *pos < *prev)
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ void CombineConsecutiveRanges() {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ // Can't combine if ranges if we have zero or one range
+ if (m_entries.size() > 1) {
+ // The list should be sorted prior to calling this function
+ typename Collection::iterator pos;
+ typename Collection::iterator end;
+ typename Collection::iterator prev;
+ bool can_combine = false;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
+ pos != end; prev = pos++) {
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
+ can_combine = true;
+ break;
+ }
+ }
+
+ // We we can combine at least one entry, then we make a new collection
+ // and populate it accordingly, and then swap it into place.
+ if (can_combine) {
+ Collection minimal_ranges;
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
+ pos != end; prev = pos++) {
+ if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
+ minimal_ranges.back().SetRangeEnd(
+ std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
+ else
+ minimal_ranges.push_back(*pos);
+ }
+ // Use the swap technique in case our new vector is much smaller. We
+ // must swap when using the STL because std::vector objects never
+ // release or reduce the memory once it has been allocated/reserved.
+ m_entries.swap(minimal_ranges);
+ }
+ }
+ }
+
+ BaseType GetMinRangeBase(BaseType fail_value) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (m_entries.empty())
+ return fail_value;
+ // m_entries must be sorted, so if we aren't empty, we grab the first
+ // range's base
+ return m_entries.front().GetRangeBase();
+ }
+
+ BaseType GetMaxRangeEnd(BaseType fail_value) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (m_entries.empty())
+ return fail_value;
+ // m_entries must be sorted, so if we aren't empty, we grab the last
+ // range's end
+ return m_entries.back().GetRangeEnd();
+ }
+
+ void Slide(BaseType slide) {
+ typename Collection::iterator pos, end;
+ for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
+ pos->Slide(slide);
+ }
+
+ void Clear() { m_entries.clear(); }
+
+ void Reserve(typename Collection::size_type size) { m_entries.reserve(size); }
+
+ bool IsEmpty() const { return m_entries.empty(); }
+
+ size_t GetSize() const { return m_entries.size(); }
+
+ const Entry *GetEntryAtIndex(size_t i) const {
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+ }
+
+ // Clients must ensure that "i" is a valid index prior to calling this
+ // function
+ 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()); }
+
+ const Entry *Back() const {
+ return (m_entries.empty() ? nullptr : &m_entries.back());
+ }
+
+ static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.GetRangeBase() < rhs.GetRangeBase();
+ }
+
+ uint32_t FindEntryIndexThatContains(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ Entry entry(addr, 1);
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, entry, BaseLessThan);
+
+ if (pos != end && pos->Contains(addr)) {
+ return std::distance(begin, pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(addr))
+ return std::distance(begin, pos);
+ }
+ }
+ return UINT32_MAX;
+ }
+
+ const Entry *FindEntryThatContains(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ Entry entry(addr, 1);
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, entry, BaseLessThan);
+
+ if (pos != end && pos->Contains(addr)) {
+ return &(*pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(addr)) {
+ return &(*pos);
+ }
+ }
+ }
+ return nullptr;
+ }
+
+ const Entry *FindEntryThatContains(const Entry &range) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, range, BaseLessThan);
+
+ if (pos != end && pos->Contains(range)) {
+ return &(*pos);
+ } else if (pos != begin) {
+ --pos;
+ if (pos->Contains(range)) {
+ return &(*pos);
+ }
+ }
+ }
+ return nullptr;
+ }
+
+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;
+};
+
+// A simple range with data class where you get to define the type of
+// the range base "B", the type used for the range byte size "S", and the type
+// for the associated data "T".
+template <typename B, typename S, typename T>
+struct RangeData : public Range<B, S> {
+ typedef T DataType;
+
+ DataType data;
+
+ RangeData() : Range<B, S>(), data() {}
+
+ RangeData(B base, S size) : Range<B, S>(base, size), data() {}
+
+ RangeData(B base, S size, DataType d) : Range<B, S>(base, size), data(d) {}
+
+ bool operator<(const RangeData &rhs) const {
+ if (this->base == rhs.base) {
+ if (this->size == rhs.size)
+ return this->data < rhs.data;
+ else
+ return this->size < rhs.size;
+ }
+ return this->base < rhs.base;
+ }
+
+ bool operator==(const RangeData &rhs) const {
+ return this->GetRangeBase() == rhs.GetRangeBase() &&
+ this->GetByteSize() == rhs.GetByteSize() && this->data == rhs.data;
+ }
+
+ bool operator!=(const RangeData &rhs) const {
+ return this->GetRangeBase() != rhs.GetRangeBase() ||
+ this->GetByteSize() != rhs.GetByteSize() || this->data != rhs.data;
+ }
+};
+
+template <typename B, typename S, typename T, unsigned N = 0>
+class RangeDataVector {
+public:
+ typedef lldb_private::Range<B, S> Range;
+ typedef RangeData<B, S, T> Entry;
+ typedef llvm::SmallVector<Entry, N> Collection;
+
+ RangeDataVector() = default;
+
+ ~RangeDataVector() = default;
+
+ void Append(const Entry &entry) { m_entries.push_back(entry); }
+
+ void Sort() {
+ if (m_entries.size() > 1)
+ std::stable_sort(m_entries.begin(), m_entries.end());
+ }
+
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ bool IsSorted() const {
+ typename Collection::const_iterator pos, end, prev;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
+ prev = pos++) {
+ if (prev != end && *pos < *prev)
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ void CombineConsecutiveEntriesWithEqualData() {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ typename Collection::iterator pos;
+ typename Collection::iterator end;
+ typename Collection::iterator prev;
+ bool can_combine = false;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
+ prev = pos++) {
+ if (prev != end && prev->data == pos->data) {
+ can_combine = true;
+ break;
+ }
+ }
+
+ // We we can combine at least one entry, then we make a new collection and
+ // populate it accordingly, and then swap it into place.
+ if (can_combine) {
+ Collection minimal_ranges;
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
+ pos != end; prev = pos++) {
+ if (prev != end && prev->data == pos->data)
+ minimal_ranges.back().SetRangeEnd(pos->GetRangeEnd());
+ else
+ minimal_ranges.push_back(*pos);
+ }
+ // Use the swap technique in case our new vector is much smaller. We must
+ // swap when using the STL because std::vector objects never release or
+ // reduce the memory once it has been allocated/reserved.
+ m_entries.swap(minimal_ranges);
+ }
+ }
+
+ void Clear() { m_entries.clear(); }
+
+ bool IsEmpty() const { return m_entries.empty(); }
+
+ size_t GetSize() const { return m_entries.size(); }
+
+ const Entry *GetEntryAtIndex(size_t i) const {
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+ }
+
+ Entry *GetMutableEntryAtIndex(size_t i) {
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+ }
+
+ // 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]; }
+
+ static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.GetRangeBase() < rhs.GetRangeBase();
+ }
+
+ uint32_t FindEntryIndexThatContains(B addr) const {
+ const Entry *entry = FindEntryThatContains(addr);
+ if (entry)
+ return std::distance(m_entries.begin(), entry);
+ return UINT32_MAX;
+ }
+
+ uint32_t FindEntryIndexesThatContain(B addr,
+ std::vector<uint32_t> &indexes) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+
+ if (!m_entries.empty()) {
+ for (const auto &entry : m_entries) {
+ if (entry.Contains(addr))
+ indexes.push_back(entry.data);
+ }
+ }
+ return indexes.size();
+ }
+
+ Entry *FindEntryThatContains(B addr) {
+ return const_cast<Entry *>(
+ static_cast<const RangeDataVector *>(this)->FindEntryThatContains(
+ addr));
+ }
+
+ const Entry *FindEntryThatContains(B addr) const {
+ return FindEntryThatContains(Entry(addr, 1));
+ }
+
+ const Entry *FindEntryThatContains(const Entry &range) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(begin, end, range, BaseLessThan);
+
+ while (pos != begin && pos[-1].Contains(range))
+ --pos;
+
+ if (pos != end && pos->Contains(range))
+ return &(*pos);
+ }
+ return nullptr;
+ }
+
+ const Entry *FindEntryStartsAt(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ auto begin = m_entries.begin(), end = m_entries.end();
+ auto pos = std::lower_bound(begin, end, Entry(addr, 1), BaseLessThan);
+ if (pos != end && pos->base == addr)
+ return &(*pos);
+ }
+ return nullptr;
+ }
+
+ // This method will return the entry that contains the given address, or the
+ // entry following that address. If you give it an address of 0 and the
+ // first entry starts at address 0x100, you will get the entry at 0x100.
+ //
+ // For most uses, FindEntryThatContains is the correct one to use, this is a
+ // less commonly needed behavior. It was added for core file memory regions,
+ // where we want to present a gap in the memory regions as a distinct region,
+ // so we need to know the start address of the next memory section that
+ // exists.
+ const Entry *FindEntryThatContainsOrFollows(B addr) const {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ typename Collection::const_iterator begin = m_entries.begin();
+ typename Collection::const_iterator end = m_entries.end();
+ typename Collection::const_iterator pos =
+ std::lower_bound(m_entries.begin(), end, addr,
+ [](const Entry &lhs, B rhs_base) -> bool {
+ return lhs.GetRangeEnd() <= rhs_base;
+ });
+
+ while (pos != begin && pos[-1].Contains(addr))
+ --pos;
+
+ if (pos != end)
+ return &(*pos);
+ }
+ return nullptr;
+ }
+
+ Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
+
+ const Entry *Back() const {
+ return (m_entries.empty() ? nullptr : &m_entries.back());
+ }
+
+protected:
+ Collection m_entries;
+};
+
+// A simple range with data class where you get to define the type of
+// the range base "B", the type used for the range byte size "S", and the type
+// for the associated data "T".
+template <typename B, typename T> struct AddressData {
+ typedef B BaseType;
+ typedef T DataType;
+
+ BaseType addr;
+ DataType data;
+
+ AddressData() : addr(), data() {}
+
+ AddressData(B a, DataType d) : addr(a), data(d) {}
+
+ bool operator<(const AddressData &rhs) const {
+ if (this->addr == rhs.addr)
+ return this->data < rhs.data;
+ return this->addr < rhs.addr;
+ }
+
+ bool operator==(const AddressData &rhs) const {
+ return this->addr == rhs.addr && this->data == rhs.data;
+ }
+
+ bool operator!=(const AddressData &rhs) const {
+ return this->addr != rhs.addr || this->data == rhs.data;
+ }
+};
+
+template <typename B, typename T, unsigned N> class AddressDataArray {
+public:
+ typedef AddressData<B, T> Entry;
+ typedef llvm::SmallVector<Entry, N> Collection;
+
+ AddressDataArray() = default;
+
+ ~AddressDataArray() = default;
+
+ void Append(const Entry &entry) { m_entries.push_back(entry); }
+
+ void Sort() {
+ if (m_entries.size() > 1)
+ std::stable_sort(m_entries.begin(), m_entries.end());
+ }
+
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ bool IsSorted() const {
+ typename Collection::const_iterator pos, end, prev;
+ // First we determine if we can combine any of the Entry objects so we
+ // don't end up allocating and making a new collection for no reason
+ for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
+ prev = pos++) {
+ if (prev != end && *pos < *prev)
+ return false;
+ }
+ return true;
+ }
+#endif
+
+ void Clear() { m_entries.clear(); }
+
+ bool IsEmpty() const { return m_entries.empty(); }
+
+ size_t GetSize() const { return m_entries.size(); }
+
+ const Entry *GetEntryAtIndex(size_t i) const {
+ return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+ }
+
+ // Clients must ensure that "i" is a valid index prior to calling this
+ // function
+ const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
+
+ static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.addr < rhs.addr;
+ }
+
+ Entry *FindEntry(B addr, bool exact_match_only) {
+#ifdef ASSERT_RANGEMAP_ARE_SORTED
+ assert(IsSorted());
+#endif
+ if (!m_entries.empty()) {
+ Entry entry;
+ entry.addr = addr;
+ typename Collection::iterator begin = m_entries.begin();
+ typename Collection::iterator end = m_entries.end();
+ typename Collection::iterator pos =
+ std::lower_bound(begin, end, entry, BaseLessThan);
+
+ while (pos != begin && pos[-1].addr == addr)
+ --pos;
+
+ if (pos != end) {
+ if (pos->addr == addr || !exact_match_only)
+ return &(*pos);
+ }
+ }
+ return nullptr;
+ }
+
+ const Entry *FindNextEntry(const Entry *entry) {
+ if (entry >= &*m_entries.begin() && entry + 1 < &*m_entries.end())
+ return entry + 1;
+ return nullptr;
+ }
+
+ Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
+
+ const Entry *Back() const {
+ return (m_entries.empty() ? nullptr : &m_entries.back());
+ }
+
+protected:
+ Collection m_entries;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_RANGEMAP_H
diff --git a/linux-x64/clang/include/lldb/Utility/RegisterValue.h b/linux-x64/clang/include/lldb/Utility/RegisterValue.h
new file mode 100644
index 0000000..eeb3ce5
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/RegisterValue.h
@@ -0,0 +1,271 @@
+//===-- RegisterValue.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_REGISTERVALUE_H
+#define LLDB_UTILITY_REGISTERVALUE_H
+
+#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/Scalar.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/StringRef.h"
+#include <cstdint>
+#include <cstring>
+
+namespace lldb_private {
+class DataExtractor;
+class Stream;
+struct RegisterInfo;
+
+class RegisterValue {
+public:
+ enum { kMaxRegisterByteSize = 64u };
+
+ enum Type {
+ eTypeInvalid,
+ eTypeUInt8,
+ eTypeUInt16,
+ eTypeUInt32,
+ eTypeUInt64,
+ eTypeUInt128,
+ eTypeFloat,
+ eTypeDouble,
+ eTypeLongDouble,
+ eTypeBytes
+ };
+
+ RegisterValue()
+ : m_type(eTypeInvalid), m_scalar(static_cast<unsigned long>(0)) {}
+
+ explicit RegisterValue(uint8_t inst) : m_type(eTypeUInt8) { m_scalar = inst; }
+
+ explicit RegisterValue(uint16_t inst) : m_type(eTypeUInt16) {
+ m_scalar = inst;
+ }
+
+ explicit RegisterValue(uint32_t inst) : m_type(eTypeUInt32) {
+ m_scalar = inst;
+ }
+
+ explicit RegisterValue(uint64_t inst) : m_type(eTypeUInt64) {
+ m_scalar = inst;
+ }
+
+ explicit RegisterValue(llvm::APInt inst) : m_type(eTypeUInt128) {
+ m_scalar = llvm::APInt(inst);
+ }
+
+ explicit RegisterValue(float value) : m_type(eTypeFloat) { m_scalar = value; }
+
+ explicit RegisterValue(double value) : m_type(eTypeDouble) {
+ m_scalar = value;
+ }
+
+ explicit RegisterValue(long double value) : m_type(eTypeLongDouble) {
+ m_scalar = value;
+ }
+
+ explicit RegisterValue(uint8_t *bytes, size_t length,
+ lldb::ByteOrder byte_order) {
+ SetBytes(bytes, length, byte_order);
+ }
+
+ RegisterValue::Type GetType() const { return m_type; }
+
+ bool CopyValue(const RegisterValue &rhs);
+
+ void SetType(RegisterValue::Type type) { m_type = type; }
+
+ RegisterValue::Type SetType(const RegisterInfo *reg_info);
+
+ bool GetData(DataExtractor &data) const;
+
+ // Copy the register value from this object into a buffer in "dst" and obey
+ // the "dst_byte_order" when copying the data. Also watch out in case
+ // "dst_len" is longer or shorter than the register value described by
+ // "reg_info" and only copy the least significant bytes of the register
+ // value, or pad the destination with zeroes if the register byte size is
+ // shorter that "dst_len" (all while correctly abiding the "dst_byte_order").
+ // Returns the number of bytes copied into "dst".
+ uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst,
+ uint32_t dst_len, lldb::ByteOrder dst_byte_order,
+ Status &error) const;
+
+ uint32_t SetFromMemoryData(const RegisterInfo *reg_info, const void *src,
+ uint32_t src_len, lldb::ByteOrder src_byte_order,
+ Status &error);
+
+ bool GetScalarValue(Scalar &scalar) const;
+
+ uint8_t GetAsUInt8(uint8_t fail_value = UINT8_MAX,
+ bool *success_ptr = nullptr) const {
+ if (m_type == eTypeUInt8) {
+ if (success_ptr)
+ *success_ptr = true;
+ return m_scalar.UChar(fail_value);
+ }
+ if (success_ptr)
+ *success_ptr = true;
+ return fail_value;
+ }
+
+ uint16_t GetAsUInt16(uint16_t fail_value = UINT16_MAX,
+ bool *success_ptr = nullptr) const;
+
+ uint32_t GetAsUInt32(uint32_t fail_value = UINT32_MAX,
+ bool *success_ptr = nullptr) const;
+
+ uint64_t GetAsUInt64(uint64_t fail_value = UINT64_MAX,
+ bool *success_ptr = nullptr) const;
+
+ llvm::APInt GetAsUInt128(const llvm::APInt &fail_value,
+ bool *success_ptr = nullptr) const;
+
+ float GetAsFloat(float fail_value = 0.0f, bool *success_ptr = nullptr) const;
+
+ double GetAsDouble(double fail_value = 0.0,
+ bool *success_ptr = nullptr) const;
+
+ long double GetAsLongDouble(long double fail_value = 0.0,
+ bool *success_ptr = nullptr) const;
+
+ void SetValueToInvalid() { m_type = eTypeInvalid; }
+
+ bool ClearBit(uint32_t bit);
+
+ bool SetBit(uint32_t bit);
+
+ bool operator==(const RegisterValue &rhs) const;
+
+ bool operator!=(const RegisterValue &rhs) const;
+
+ void operator=(uint8_t uint) {
+ m_type = eTypeUInt8;
+ m_scalar = uint;
+ }
+
+ void operator=(uint16_t uint) {
+ m_type = eTypeUInt16;
+ m_scalar = uint;
+ }
+
+ void operator=(uint32_t uint) {
+ m_type = eTypeUInt32;
+ m_scalar = uint;
+ }
+
+ void operator=(uint64_t uint) {
+ m_type = eTypeUInt64;
+ m_scalar = uint;
+ }
+
+ void operator=(llvm::APInt uint) {
+ m_type = eTypeUInt128;
+ m_scalar = llvm::APInt(uint);
+ }
+
+ void operator=(float f) {
+ m_type = eTypeFloat;
+ m_scalar = f;
+ }
+
+ void operator=(double f) {
+ m_type = eTypeDouble;
+ m_scalar = f;
+ }
+
+ void operator=(long double f) {
+ m_type = eTypeLongDouble;
+ m_scalar = f;
+ }
+
+ void SetUInt8(uint8_t uint) {
+ m_type = eTypeUInt8;
+ m_scalar = uint;
+ }
+
+ void SetUInt16(uint16_t uint) {
+ m_type = eTypeUInt16;
+ m_scalar = uint;
+ }
+
+ void SetUInt32(uint32_t uint, Type t = eTypeUInt32) {
+ m_type = t;
+ m_scalar = uint;
+ }
+
+ void SetUInt64(uint64_t uint, Type t = eTypeUInt64) {
+ m_type = t;
+ m_scalar = uint;
+ }
+
+ void SetUInt128(llvm::APInt uint) {
+ m_type = eTypeUInt128;
+ m_scalar = uint;
+ }
+
+ bool SetUInt(uint64_t uint, uint32_t byte_size);
+
+ void SetFloat(float f) {
+ m_type = eTypeFloat;
+ m_scalar = f;
+ }
+
+ void SetDouble(double f) {
+ m_type = eTypeDouble;
+ m_scalar = f;
+ }
+
+ void SetLongDouble(long double f) {
+ m_type = eTypeLongDouble;
+ m_scalar = f;
+ }
+
+ void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order);
+
+ bool SignExtend(uint32_t sign_bitpos);
+
+ Status SetValueFromString(const RegisterInfo *reg_info,
+ llvm::StringRef value_str);
+ Status SetValueFromString(const RegisterInfo *reg_info,
+ const char *value_str) = delete;
+
+ Status SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data,
+ lldb::offset_t offset, bool partial_data_ok);
+
+ const void *GetBytes() const;
+
+ lldb::ByteOrder GetByteOrder() const {
+ if (m_type == eTypeBytes)
+ return buffer.byte_order;
+ return endian::InlHostByteOrder();
+ }
+
+ uint32_t GetByteSize() const;
+
+ static uint32_t GetMaxByteSize() { return kMaxRegisterByteSize; }
+
+ void Clear();
+
+protected:
+ RegisterValue::Type m_type;
+ Scalar m_scalar;
+
+ struct {
+ uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any
+ // register for any supported target.
+ uint8_t length;
+ lldb::ByteOrder byte_order;
+ } buffer;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_REGISTERVALUE_H
diff --git a/linux-x64/clang/include/lldb/Utility/RegularExpression.h b/linux-x64/clang/include/lldb/Utility/RegularExpression.h
new file mode 100644
index 0000000..54f3dd8
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/RegularExpression.h
@@ -0,0 +1,199 @@
+//===-- RegularExpression.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegularExpression_h_
+#define liblldb_RegularExpression_h_
+
+#ifdef _WIN32
+#include "../lib/Support/regex_impl.h"
+
+typedef llvm_regmatch_t regmatch_t;
+typedef llvm_regex_t regex_t;
+
+inline int regcomp(llvm_regex_t *a, const char *b, int c) {
+ return llvm_regcomp(a, b, c);
+}
+
+inline size_t regerror(int a, const llvm_regex_t *b, char *c, size_t d) {
+ return llvm_regerror(a, b, c, d);
+}
+
+inline int regexec(const llvm_regex_t *a, const char *b, size_t c,
+ llvm_regmatch_t d[], int e) {
+ return llvm_regexec(a, b, c, d, e);
+}
+
+inline void regfree(llvm_regex_t *a) { llvm_regfree(a); }
+#else
+#ifdef __ANDROID__
+#include <regex>
+#endif
+#include <regex.h>
+#endif
+
+#include <string>
+#include <vector>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace llvm {
+class StringRef;
+} // namespace llvm
+
+namespace lldb_private {
+
+/// \class RegularExpression RegularExpression.h
+/// "lldb/Utility/RegularExpression.h"
+/// A C++ wrapper class for regex.
+///
+/// This regular expression class wraps the posix regex functions \c
+/// regcomp(), \c regerror(), \c regexec(), and \c regfree() from the header
+/// file in \c /usr/include/regex\.h.
+class RegularExpression {
+public:
+ class Match {
+ public:
+ Match(uint32_t max_matches) : m_matches() {
+ if (max_matches > 0)
+ m_matches.resize(max_matches + 1);
+ }
+
+ void Clear() {
+ const size_t num_matches = m_matches.size();
+ regmatch_t invalid_match = {-1, -1};
+ for (size_t i = 0; i < num_matches; ++i)
+ m_matches[i] = invalid_match;
+ }
+
+ size_t GetSize() const { return m_matches.size(); }
+
+ regmatch_t *GetData() {
+ return (m_matches.empty() ? nullptr : m_matches.data());
+ }
+
+ bool GetMatchAtIndex(llvm::StringRef s, uint32_t idx,
+ std::string &match_str) const;
+
+ bool GetMatchAtIndex(llvm::StringRef s, uint32_t idx,
+ llvm::StringRef &match_str) const;
+
+ bool GetMatchSpanningIndices(llvm::StringRef s, uint32_t idx1,
+ uint32_t idx2,
+ llvm::StringRef &match_str) const;
+
+ protected:
+ std::vector<regmatch_t>
+ m_matches; ///< Where parenthesized subexpressions results are stored
+ };
+
+ /// Default constructor.
+ ///
+ /// The default constructor that initializes the object state such that it
+ /// contains no compiled regular expression.
+ RegularExpression();
+
+ explicit RegularExpression(llvm::StringRef string);
+
+ /// Destructor.
+ ///
+ /// Any previously compiled regular expression contained in this object will
+ /// be freed.
+ ~RegularExpression();
+
+ RegularExpression(const RegularExpression &rhs);
+
+ const RegularExpression &operator=(const RegularExpression &rhs);
+
+ /// Compile a regular expression.
+ ///
+ /// Compile a regular expression using the supplied regular expression text.
+ /// The compiled regular expression lives in this object so that it can be
+ /// readily used for regular expression matches. Execute() can be called
+ /// after the regular expression is compiled. Any previously compiled
+ /// regular expression contained in this object will be freed.
+ ///
+ /// \param[in] re
+ /// A NULL terminated C string that represents the regular
+ /// expression to compile.
+ ///
+ /// \return
+ /// \b true if the regular expression compiles successfully,
+ /// \b false otherwise.
+ bool Compile(llvm::StringRef string);
+ bool Compile(const char *) = delete;
+
+ /// Executes a regular expression.
+ ///
+ /// Execute a regular expression match using the compiled regular expression
+ /// that is already in this object against the match string \a s. If any
+ /// parens are used for regular expression matches \a match_count should
+ /// indicate the number of regmatch_t values that are present in \a
+ /// match_ptr.
+ ///
+ /// \param[in] string
+ /// The string to match against the compile regular expression.
+ ///
+ /// \param[in] match
+ /// A pointer to a RegularExpression::Match structure that was
+ /// properly initialized with the desired number of maximum
+ /// matches, or nullptr if no parenthesized matching is needed.
+ ///
+ /// \return
+ /// \b true if \a string matches the compiled regular
+ /// expression, \b false otherwise.
+ bool Execute(llvm::StringRef string, Match *match = nullptr) const;
+ bool Execute(const char *, Match * = nullptr) = delete;
+
+ size_t GetErrorAsCString(char *err_str, size_t err_str_max_len) const;
+
+ /// Free the compiled regular expression.
+ ///
+ /// If this object contains a valid compiled regular expression, this
+ /// function will free any resources it was consuming.
+ void Free();
+
+ /// Access the regular expression text.
+ ///
+ /// Returns the text that was used to compile the current regular
+ /// expression.
+ ///
+ /// \return
+ /// The NULL terminated C string that was used to compile the
+ /// current regular expression
+ llvm::StringRef GetText() const;
+
+ /// Test if valid.
+ ///
+ /// Test if this object contains a valid regular expression.
+ ///
+ /// \return
+ /// \b true if the regular expression compiled and is ready
+ /// for execution, \b false otherwise.
+ bool IsValid() const;
+
+ void Clear() {
+ Free();
+ m_re.clear();
+ m_comp_err = 1;
+ }
+
+ int GetErrorCode() const { return m_comp_err; }
+
+ bool operator<(const RegularExpression &rhs) const;
+
+private:
+ // Member variables
+ std::string m_re; ///< A copy of the original regular expression text
+ int m_comp_err; ///< Status code for the regular expression compilation
+ regex_t m_preg; ///< The compiled regular expression
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_RegularExpression_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Reproducer.h b/linux-x64/clang/include/lldb/Utility/Reproducer.h
new file mode 100644
index 0000000..670041d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Reproducer.h
@@ -0,0 +1,303 @@
+//===-- Reproducer.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_REPRODUCER_H
+#define LLDB_UTILITY_REPRODUCER_H
+
+#include "lldb/Utility/FileCollector.h"
+#include "lldb/Utility/FileSpec.h"
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/YAMLTraits.h"
+
+#include <mutex>
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+namespace repro {
+
+class Reproducer;
+
+enum class ReproducerMode {
+ Capture,
+ Replay,
+ Off,
+};
+
+/// The provider defines an interface for generating files needed for
+/// reproducing.
+///
+/// Different components will implement different providers.
+class ProviderBase {
+public:
+ virtual ~ProviderBase() = default;
+
+ const FileSpec &GetRoot() const { return m_root; }
+
+ /// The Keep method is called when it is decided that we need to keep the
+ /// data in order to provide a reproducer.
+ virtual void Keep(){};
+
+ /// The Discard method is called when it is decided that we do not need to
+ /// keep any information and will not generate a reproducer.
+ virtual void Discard(){};
+
+ // Returns the class ID for this type.
+ static const void *ClassID() { return &ID; }
+
+ // Returns the class ID for the dynamic type of this Provider instance.
+ virtual const void *DynamicClassID() const = 0;
+
+ virtual llvm::StringRef GetName() const = 0;
+ virtual llvm::StringRef GetFile() const = 0;
+
+protected:
+ ProviderBase(const FileSpec &root) : m_root(root) {}
+
+private:
+ /// Every provider knows where to dump its potential files.
+ FileSpec m_root;
+
+ virtual void anchor();
+ static char ID;
+};
+
+template <typename ThisProviderT> class Provider : public ProviderBase {
+public:
+ static const void *ClassID() { return &ThisProviderT::ID; }
+
+ const void *DynamicClassID() const override { return &ThisProviderT::ID; }
+
+ llvm::StringRef GetName() const override { return ThisProviderT::Info::name; }
+ llvm::StringRef GetFile() const override { return ThisProviderT::Info::file; }
+
+protected:
+ using ProviderBase::ProviderBase; // Inherit constructor.
+};
+
+class FileProvider : public Provider<FileProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ FileProvider(const FileSpec &directory)
+ : Provider(directory),
+ m_collector(directory.CopyByAppendingPathComponent("root"), directory) {
+ }
+
+ FileCollector &GetFileCollector() { return m_collector; }
+
+ void Keep() override {
+ auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file);
+ // Temporary files that are removed during execution can cause copy errors.
+ if (auto ec = m_collector.CopyFiles(/*stop_on_error=*/false))
+ return;
+ m_collector.WriteMapping(mapping);
+ }
+
+ static char ID;
+
+private:
+ FileCollector m_collector;
+};
+
+/// Provider for the LLDB version number.
+///
+/// When the reproducer is kept, it writes the lldb version to a file named
+/// version.txt in the reproducer root.
+class VersionProvider : public Provider<VersionProvider> {
+public:
+ VersionProvider(const FileSpec &directory) : Provider(directory) {}
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ void SetVersion(std::string version) {
+ assert(m_version.empty());
+ m_version = std::move(version);
+ }
+ void Keep() override;
+ std::string m_version;
+ static char ID;
+};
+
+class DataRecorder {
+public:
+ DataRecorder(const FileSpec &filename, std::error_code &ec)
+ : m_filename(filename.GetFilename().GetStringRef()),
+ m_os(filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) {}
+
+ static llvm::Expected<std::unique_ptr<DataRecorder>>
+ Create(const FileSpec &filename);
+
+ template <typename T> void Record(const T &t, bool newline = false) {
+ if (!m_record)
+ return;
+ m_os << t;
+ if (newline)
+ m_os << '\n';
+ m_os.flush();
+ }
+
+ const FileSpec &GetFilename() { return m_filename; }
+
+ void Stop() {
+ assert(m_record);
+ m_record = false;
+ }
+
+private:
+ FileSpec m_filename;
+ llvm::raw_fd_ostream m_os;
+ bool m_record;
+};
+
+class CommandProvider : public Provider<CommandProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ CommandProvider(const FileSpec &directory) : Provider(directory) {}
+
+ DataRecorder *GetNewDataRecorder();
+
+ void Keep() override;
+ void Discard() override;
+
+ static char ID;
+
+private:
+ std::vector<std::unique_ptr<DataRecorder>> m_data_recorders;
+};
+
+/// The generator is responsible for the logic needed to generate a
+/// reproducer. For doing so it relies on providers, who serialize data that
+/// is necessary for reproducing a failure.
+class Generator final {
+public:
+ Generator(const FileSpec &root);
+ ~Generator();
+
+ /// Method to indicate we want to keep the reproducer. If reproducer
+ /// generation is disabled, this does nothing.
+ void Keep();
+
+ /// Method to indicate we do not want to keep the reproducer. This is
+ /// unaffected by whether or not generation reproduction is enabled, as we
+ /// might need to clean up files already written to disk.
+ void Discard();
+
+ /// Create and register a new provider.
+ template <typename T> T *Create() {
+ std::unique_ptr<ProviderBase> provider = llvm::make_unique<T>(m_root);
+ return static_cast<T *>(Register(std::move(provider)));
+ }
+
+ /// Get an existing provider.
+ template <typename T> T *Get() {
+ auto it = m_providers.find(T::ClassID());
+ if (it == m_providers.end())
+ return nullptr;
+ return static_cast<T *>(it->second.get());
+ }
+
+ /// Get a provider if it exists, otherwise create it.
+ template <typename T> T &GetOrCreate() {
+ auto *provider = Get<T>();
+ if (provider)
+ return *provider;
+ return *Create<T>();
+ }
+
+ const FileSpec &GetRoot() const;
+
+private:
+ friend Reproducer;
+
+ ProviderBase *Register(std::unique_ptr<ProviderBase> provider);
+
+ /// Builds and index with provider info.
+ void AddProvidersToIndex();
+
+ /// Map of provider IDs to provider instances.
+ llvm::DenseMap<const void *, std::unique_ptr<ProviderBase>> m_providers;
+ std::mutex m_providers_mutex;
+
+ /// The reproducer root directory.
+ FileSpec m_root;
+
+ /// Flag to ensure that we never call both keep and discard.
+ bool m_done;
+};
+
+class Loader final {
+public:
+ Loader(const FileSpec &root);
+
+ template <typename T> FileSpec GetFile() {
+ if (!HasFile(T::file))
+ return {};
+
+ return GetRoot().CopyByAppendingPathComponent(T::file);
+ }
+
+ llvm::Error LoadIndex();
+
+ const FileSpec &GetRoot() const { return m_root; }
+
+private:
+ bool HasFile(llvm::StringRef file);
+
+ FileSpec m_root;
+ std::vector<std::string> m_files;
+ bool m_loaded;
+};
+
+/// The reproducer enables clients to obtain access to the Generator and
+/// Loader.
+class Reproducer {
+public:
+ static Reproducer &Instance();
+ static llvm::Error Initialize(ReproducerMode mode,
+ llvm::Optional<FileSpec> root);
+ static bool Initialized();
+ static void Terminate();
+
+ Reproducer() = default;
+
+ Generator *GetGenerator();
+ Loader *GetLoader();
+
+ const Generator *GetGenerator() const;
+ const Loader *GetLoader() const;
+
+ FileSpec GetReproducerPath() const;
+
+protected:
+ llvm::Error SetCapture(llvm::Optional<FileSpec> root);
+ llvm::Error SetReplay(llvm::Optional<FileSpec> root);
+
+private:
+ static llvm::Optional<Reproducer> &InstanceImpl();
+
+ llvm::Optional<Generator> m_generator;
+ llvm::Optional<Loader> m_loader;
+
+ mutable std::mutex m_mutex;
+};
+
+} // namespace repro
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_REPRODUCER_H
diff --git a/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h b/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h
new file mode 100644
index 0000000..f90ce4b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h
@@ -0,0 +1,717 @@
+//===-- ReproducerInstrumentation.h -----------------------------*- C++ -*-===//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
+#define LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Logging.h"
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/ErrorHandling.h"
+
+#include <iostream>
+#include <map>
+#include <type_traits>
+
+template <typename T,
+ typename std::enable_if<std::is_fundamental<T>::value, int>::type = 0>
+inline void stringify_append(llvm::raw_string_ostream &ss, const T &t) {
+ ss << t;
+}
+
+template <typename T, typename std::enable_if<!std::is_fundamental<T>::value,
+ int>::type = 0>
+inline void stringify_append(llvm::raw_string_ostream &ss, const T &t) {
+ ss << &t;
+}
+
+template <typename T>
+inline void stringify_append(llvm::raw_string_ostream &ss, const T *t) {
+ ss << reinterpret_cast<const void *>(t);
+}
+
+template <>
+inline void stringify_append<char>(llvm::raw_string_ostream &ss,
+ const char *t) {
+ ss << t;
+}
+
+template <typename Head>
+inline void stringify_helper(llvm::raw_string_ostream &ss, const Head &head) {
+ stringify_append(ss, head);
+}
+
+template <typename Head, typename... Tail>
+inline void stringify_helper(llvm::raw_string_ostream &ss, const Head &head,
+ const Tail &... tail) {
+ stringify_append(ss, head);
+ ss << ", ";
+ stringify_helper(ss, tail...);
+}
+
+template <typename... Ts> inline std::string stringify_args(const Ts &... ts) {
+ std::string buffer;
+ llvm::raw_string_ostream ss(buffer);
+ stringify_helper(ss, ts...);
+ return ss.str();
+}
+
+// Define LLDB_REPRO_INSTR_TRACE to trace to stderr instead of LLDB's log
+// infrastructure. This is useful when you need to see traces before the logger
+// is initialized or enabled.
+// #define LLDB_REPRO_INSTR_TRACE
+
+#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature) \
+ R.Register<Class * Signature>(&construct<Class Signature>::doit, "", #Class, \
+ #Class, #Signature)
+#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature) \
+ R.Register( \
+ &invoke<Result(Class::*) Signature>::method<(&Class::Method)>::doit, \
+ #Result, #Class, #Method, #Signature)
+#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature) \
+ R.Register(&invoke<Result(Class::*) Signature const>::method_const<( \
+ &Class::Method)>::doit, \
+ #Result, #Class, #Method, #Signature)
+#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature) \
+ R.Register<Result Signature>( \
+ static_cast<Result(*) Signature>(&Class::Method), #Result, #Class, \
+ #Method, #Signature)
+
+#define LLDB_RECORD_CONSTRUCTOR(Class, Signature, ...) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::construct<Class Signature>::doit, \
+ __VA_ARGS__); \
+ sb_recorder.RecordResult(this); \
+ }
+
+#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::construct<Class()>::doit); \
+ sb_recorder.RecordResult(this); \
+ }
+
+#define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record( \
+ data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::invoke<Result(Class::*) Signature>::method<( \
+ &Class::Method)>::doit, \
+ this, __VA_ARGS__); \
+ }
+
+#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record( \
+ data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::invoke<Result( \
+ Class::*) Signature const>::method_const<(&Class::Method)>::doit, \
+ this, __VA_ARGS__); \
+ }
+
+#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::invoke<Result ( \
+ Class::*)()>::method<(&Class::Method)>::doit, \
+ this); \
+ }
+
+#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record( \
+ data.GetSerializer(), data.GetRegistry(), \
+ &lldb_private::repro::invoke<Result ( \
+ Class::*)() const>::method_const<(&Class::Method)>::doit, \
+ this); \
+ }
+
+#define LLDB_RECORD_STATIC_METHOD(Result, Class, Method, Signature, ...) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
+ static_cast<Result(*) Signature>(&Class::Method), \
+ __VA_ARGS__); \
+ }
+
+#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
+ if (lldb_private::repro::InstrumentationData data = \
+ LLDB_GET_INSTRUMENTATION_DATA()) { \
+ sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
+ static_cast<Result (*)()>(&Class::Method)); \
+ }
+
+#define LLDB_RECORD_RESULT(Result) sb_recorder.RecordResult(Result);
+
+/// The LLDB_RECORD_DUMMY macro is special because it doesn't actually record
+/// anything. It's used to track API boundaries when we cannot record for
+/// technical reasons.
+#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...) \
+ lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__));
+
+namespace lldb_private {
+namespace repro {
+
+/// Mapping between serialized indices and their corresponding objects.
+///
+/// This class is used during replay to map indices back to in-memory objects.
+///
+/// When objects are constructed, they are added to this mapping using
+/// AddObjectForIndex.
+///
+/// When an object is passed to a function, its index is deserialized and
+/// AddObjectForIndex returns the corresponding object. If there is no object
+/// for the given index, a nullptr is returend. The latter is valid when custom
+/// replay code is in place and the actual object is ignored.
+class IndexToObject {
+public:
+ /// Returns an object as a pointer for the given index or nullptr if not
+ /// present in the map.
+ template <typename T> T *GetObjectForIndex(unsigned idx) {
+ assert(idx != 0 && "Cannot get object for sentinel");
+ void *object = GetObjectForIndexImpl(idx);
+ return static_cast<T *>(object);
+ }
+
+ /// Adds a pointer to an object to the mapping for the given index.
+ template <typename T> void AddObjectForIndex(unsigned idx, T *object) {
+ AddObjectForIndexImpl(
+ idx, static_cast<void *>(
+ const_cast<typename std::remove_const<T>::type *>(object)));
+ }
+
+ /// Adds a reference to an object to the mapping for the given index.
+ template <typename T> void AddObjectForIndex(unsigned idx, T &object) {
+ AddObjectForIndexImpl(
+ idx, static_cast<void *>(
+ const_cast<typename std::remove_const<T>::type *>(&object)));
+ }
+
+private:
+ /// Helper method that does the actual lookup. The void* result is later cast
+ /// by the caller.
+ void *GetObjectForIndexImpl(unsigned idx);
+
+ /// Helper method that does the actual insertion.
+ void AddObjectForIndexImpl(unsigned idx, void *object);
+
+ /// Keeps a mapping between indices and their corresponding object.
+ llvm::DenseMap<unsigned, void *> m_mapping;
+};
+
+/// We need to differentiate between pointers to fundamental and
+/// non-fundamental types. See the corresponding Deserializer::Read method
+/// for the reason why.
+struct PointerTag {};
+struct ReferenceTag {};
+struct ValueTag {};
+struct FundamentalPointerTag {};
+struct FundamentalReferenceTag {};
+
+/// Return the deserialization tag for the given type T.
+template <class T> struct serializer_tag { typedef ValueTag type; };
+template <class T> struct serializer_tag<T *> {
+ typedef
+ typename std::conditional<std::is_fundamental<T>::value,
+ FundamentalPointerTag, PointerTag>::type type;
+};
+template <class T> struct serializer_tag<T &> {
+ typedef typename std::conditional<std::is_fundamental<T>::value,
+ FundamentalReferenceTag, ReferenceTag>::type
+ type;
+};
+
+/// Deserializes data from a buffer. It is used to deserialize function indices
+/// to replay, their arguments and return values.
+///
+/// Fundamental types and strings are read by value. Objects are read by their
+/// index, which get translated by the IndexToObject mapping maintained in
+/// this class.
+///
+/// Additional bookkeeping with regards to the IndexToObject is required to
+/// deserialize objects. When a constructor is run or an object is returned by
+/// value, we need to capture the object and add it to the index together with
+/// its index. This is the job of HandleReplayResult(Void).
+class Deserializer {
+public:
+ Deserializer(llvm::StringRef buffer) : m_buffer(buffer) {}
+
+ /// Returns true when the buffer has unread data.
+ bool HasData(unsigned size) { return size <= m_buffer.size(); }
+
+ /// Deserialize and interpret value as T.
+ template <typename T> T Deserialize() {
+#ifdef LLDB_REPRO_INSTR_TRACE
+ llvm::errs() << "Deserializing with " << LLVM_PRETTY_FUNCTION << "\n";
+#endif
+ return Read<T>(typename serializer_tag<T>::type());
+ }
+
+ /// Store the returned value in the index-to-object mapping.
+ template <typename T> void HandleReplayResult(const T &t) {
+ unsigned result = Deserialize<unsigned>();
+ if (std::is_fundamental<T>::value)
+ return;
+ // We need to make a copy as the original object might go out of scope.
+ m_index_to_object.AddObjectForIndex(result, new T(t));
+ }
+
+ /// Store the returned value in the index-to-object mapping.
+ template <typename T> void HandleReplayResult(T *t) {
+ unsigned result = Deserialize<unsigned>();
+ if (std::is_fundamental<T>::value)
+ return;
+ m_index_to_object.AddObjectForIndex(result, t);
+ }
+
+ /// All returned types are recorded, even when the function returns a void.
+ /// The latter requires special handling.
+ void HandleReplayResultVoid() {
+ unsigned result = Deserialize<unsigned>();
+ assert(result == 0);
+ (void)result;
+ }
+
+private:
+ template <typename T> T Read(ValueTag) {
+ assert(HasData(sizeof(T)));
+ T t;
+ std::memcpy(reinterpret_cast<char *>(&t), m_buffer.data(), sizeof(T));
+ m_buffer = m_buffer.drop_front(sizeof(T));
+ return t;
+ }
+
+ template <typename T> T Read(PointerTag) {
+ typedef typename std::remove_pointer<T>::type UnderlyingT;
+ return m_index_to_object.template GetObjectForIndex<UnderlyingT>(
+ Deserialize<unsigned>());
+ }
+
+ template <typename T> T Read(ReferenceTag) {
+ typedef typename std::remove_reference<T>::type UnderlyingT;
+ // If this is a reference to a fundamental type we just read its value.
+ return *m_index_to_object.template GetObjectForIndex<UnderlyingT>(
+ Deserialize<unsigned>());
+ }
+
+ /// This method is used to parse references to fundamental types. Because
+ /// they're not recorded in the object table we have serialized their value.
+ /// We read its value, allocate a copy on the heap, and return a pointer to
+ /// the copy.
+ template <typename T> T Read(FundamentalPointerTag) {
+ typedef typename std::remove_pointer<T>::type UnderlyingT;
+ return new UnderlyingT(Deserialize<UnderlyingT>());
+ }
+
+ /// This method is used to parse references to fundamental types. Because
+ /// they're not recorded in the object table we have serialized their value.
+ /// We read its value, allocate a copy on the heap, and return a reference to
+ /// the copy.
+ template <typename T> T Read(FundamentalReferenceTag) {
+ // If this is a reference to a fundamental type we just read its value.
+ typedef typename std::remove_reference<T>::type UnderlyingT;
+ return *(new UnderlyingT(Deserialize<UnderlyingT>()));
+ }
+
+ /// Mapping of indices to objects.
+ IndexToObject m_index_to_object;
+
+ /// Buffer containing the serialized data.
+ llvm::StringRef m_buffer;
+};
+
+/// Partial specialization for C-style strings. We read the string value
+/// instead of treating it as pointer.
+template <> const char *Deserializer::Deserialize<const char *>();
+template <> char *Deserializer::Deserialize<char *>();
+
+/// Helpers to auto-synthesize function replay code. It deserializes the replay
+/// function's arguments one by one and finally calls the corresponding
+/// function.
+template <typename... Remaining> struct DeserializationHelper;
+
+template <typename Head, typename... Tail>
+struct DeserializationHelper<Head, Tail...> {
+ template <typename Result, typename... Deserialized> struct deserialized {
+ static Result doit(Deserializer &deserializer,
+ Result (*f)(Deserialized..., Head, Tail...),
+ Deserialized... d) {
+ return DeserializationHelper<Tail...>::
+ template deserialized<Result, Deserialized..., Head>::doit(
+ deserializer, f, d..., deserializer.Deserialize<Head>());
+ }
+ };
+};
+
+template <> struct DeserializationHelper<> {
+ template <typename Result, typename... Deserialized> struct deserialized {
+ static Result doit(Deserializer &deserializer, Result (*f)(Deserialized...),
+ Deserialized... d) {
+ return f(d...);
+ }
+ };
+};
+
+/// The replayer interface.
+struct Replayer {
+ virtual ~Replayer() {}
+ virtual void operator()(Deserializer &deserializer) const = 0;
+};
+
+/// The default replayer deserializes the arguments and calls the function.
+template <typename Signature> struct DefaultReplayer;
+template <typename Result, typename... Args>
+struct DefaultReplayer<Result(Args...)> : public Replayer {
+ DefaultReplayer(Result (*f)(Args...)) : Replayer(), f(f) {}
+
+ void operator()(Deserializer &deserializer) const override {
+ deserializer.HandleReplayResult(
+ DeserializationHelper<Args...>::template deserialized<Result>::doit(
+ deserializer, f));
+ }
+
+ Result (*f)(Args...);
+};
+
+/// Partial specialization for function returning a void type. It ignores the
+/// (absent) return value.
+template <typename... Args>
+struct DefaultReplayer<void(Args...)> : public Replayer {
+ DefaultReplayer(void (*f)(Args...)) : Replayer(), f(f) {}
+
+ void operator()(Deserializer &deserializer) const override {
+ DeserializationHelper<Args...>::template deserialized<void>::doit(
+ deserializer, f);
+ deserializer.HandleReplayResultVoid();
+ }
+
+ void (*f)(Args...);
+};
+
+/// The registry contains a unique mapping between functions and their ID. The
+/// IDs can be serialized and deserialized to replay a function. Functions need
+/// to be registered with the registry for this to work.
+class Registry {
+private:
+ struct SignatureStr {
+ SignatureStr(llvm::StringRef result = {}, llvm::StringRef scope = {},
+ llvm::StringRef name = {}, llvm::StringRef args = {})
+ : result(result), scope(scope), name(name), args(args) {}
+
+ std::string ToString() const;
+
+ llvm::StringRef result;
+ llvm::StringRef scope;
+ llvm::StringRef name;
+ llvm::StringRef args;
+ };
+
+public:
+ Registry() = default;
+ virtual ~Registry() = default;
+
+ /// Register a default replayer for a function.
+ template <typename Signature>
+ void Register(Signature *f, llvm::StringRef result = {},
+ llvm::StringRef scope = {}, llvm::StringRef name = {},
+ llvm::StringRef args = {}) {
+ DoRegister(uintptr_t(f), llvm::make_unique<DefaultReplayer<Signature>>(f),
+ SignatureStr(result, scope, name, args));
+ }
+
+ /// Register a replayer that invokes a custom function with the same
+ /// signature as the replayed function.
+ template <typename Signature>
+ void Register(Signature *f, Signature *g, llvm::StringRef result = {},
+ llvm::StringRef scope = {}, llvm::StringRef name = {},
+ llvm::StringRef args = {}) {
+ DoRegister(uintptr_t(f), llvm::make_unique<DefaultReplayer<Signature>>(g),
+ SignatureStr(result, scope, name, args));
+ }
+
+ /// Replay functions from a file.
+ bool Replay(const FileSpec &file);
+
+ /// Replay functions from a buffer.
+ bool Replay(llvm::StringRef buffer);
+
+ /// Returns the ID for a given function address.
+ unsigned GetID(uintptr_t addr);
+
+protected:
+ /// Register the given replayer for a function (and the ID mapping).
+ void DoRegister(uintptr_t RunID, std::unique_ptr<Replayer> replayer,
+ SignatureStr signature);
+
+private:
+ std::string GetSignature(unsigned id);
+ Replayer *GetReplayer(unsigned id);
+
+ /// Mapping of function addresses to replayers and their ID.
+ std::map<uintptr_t, std::pair<std::unique_ptr<Replayer>, unsigned>>
+ m_replayers;
+
+ /// Mapping of IDs to replayer instances.
+ std::map<unsigned, std::pair<Replayer *, SignatureStr>> m_ids;
+};
+
+/// To be used as the "Runtime ID" of a constructor. It also invokes the
+/// constructor when called.
+template <typename Signature> struct construct;
+template <typename Class, typename... Args> struct construct<Class(Args...)> {
+ static Class *doit(Args... args) { return new Class(args...); }
+};
+
+/// To be used as the "Runtime ID" of a member function. It also invokes the
+/// member function when called.
+template <typename Signature> struct invoke;
+template <typename Result, typename Class, typename... Args>
+struct invoke<Result (Class::*)(Args...)> {
+ template <Result (Class::*m)(Args...)> struct method {
+ static Result doit(Class *c, Args... args) { return (c->*m)(args...); }
+ };
+};
+
+template <typename Result, typename Class, typename... Args>
+struct invoke<Result (Class::*)(Args...) const> {
+ template <Result (Class::*m)(Args...) const> struct method_const {
+ static Result doit(Class *c, Args... args) { return (c->*m)(args...); }
+ };
+};
+
+template <typename Class, typename... Args>
+struct invoke<void (Class::*)(Args...)> {
+ template <void (Class::*m)(Args...)> struct method {
+ static void doit(Class *c, Args... args) { (c->*m)(args...); }
+ };
+};
+
+/// Maps an object to an index for serialization. Indices are unique and
+/// incremented for every new object.
+///
+/// Indices start at 1 in order to differentiate with an invalid index (0) in
+/// the serialized buffer.
+class ObjectToIndex {
+public:
+ template <typename T> unsigned GetIndexForObject(T *t) {
+ return GetIndexForObjectImpl(static_cast<const void *>(t));
+ }
+
+private:
+ unsigned GetIndexForObjectImpl(const void *object);
+
+ llvm::DenseMap<const void *, unsigned> m_mapping;
+};
+
+/// Serializes functions, their arguments and their return type to a stream.
+class Serializer {
+public:
+ Serializer(llvm::raw_ostream &stream = llvm::outs()) : m_stream(stream) {}
+
+ /// Recursively serialize all the given arguments.
+ template <typename Head, typename... Tail>
+ void SerializeAll(const Head &head, const Tail &... tail) {
+ Serialize(head);
+ SerializeAll(tail...);
+ }
+
+ void SerializeAll() {
+ m_stream.flush();
+ }
+
+private:
+ /// Serialize pointers. We need to differentiate between pointers to
+ /// fundamental types (in which case we serialize its value) and pointer to
+ /// objects (in which case we serialize their index).
+ template <typename T> void Serialize(T *t) {
+ if (std::is_fundamental<T>::value) {
+ Serialize(*t);
+ } else {
+ unsigned idx = m_tracker.GetIndexForObject(t);
+ Serialize(idx);
+ }
+ }
+
+ /// Serialize references. We need to differentiate between references to
+ /// fundamental types (in which case we serialize its value) and references
+ /// to objects (in which case we serialize their index).
+ template <typename T> void Serialize(T &t) {
+ if (std::is_fundamental<T>::value) {
+ m_stream.write(reinterpret_cast<const char *>(&t), sizeof(T));
+ } else {
+ unsigned idx = m_tracker.GetIndexForObject(&t);
+ Serialize(idx);
+ }
+ }
+
+ void Serialize(void *v) {
+ // FIXME: Support void*
+ llvm_unreachable("void* is currently unsupported.");
+ }
+
+ void Serialize(const char *t) {
+ m_stream << t;
+ m_stream.write(0x0);
+ }
+
+ /// Serialization stream.
+ llvm::raw_ostream &m_stream;
+
+ /// Mapping of objects to indices.
+ ObjectToIndex m_tracker;
+};
+
+class InstrumentationData {
+public:
+ InstrumentationData() : m_serializer(nullptr), m_registry(nullptr){};
+ InstrumentationData(Serializer &serializer, Registry ®istry)
+ : m_serializer(&serializer), m_registry(®istry){};
+
+ Serializer &GetSerializer() { return *m_serializer; }
+ Registry &GetRegistry() { return *m_registry; }
+
+ operator bool() { return m_serializer != nullptr && m_registry != nullptr; }
+
+private:
+ Serializer *m_serializer;
+ Registry *m_registry;
+};
+
+/// RAII object that records function invocations and their return value.
+///
+/// API calls are only captured when the API boundary is crossed. Once we're in
+/// the API layer, and another API function is called, it doesn't need to be
+/// recorded.
+///
+/// When a call is recored, its result is always recorded as well, even if the
+/// function returns a void. For functions that return by value, RecordResult
+/// should be used. Otherwise a sentinel value (0) will be serialized.
+///
+/// Because of the functional overlap between logging and recording API calls,
+/// this class is also used for logging.
+class Recorder {
+public:
+ Recorder(llvm::StringRef pretty_func = {}, std::string &&pretty_args = {});
+ ~Recorder();
+
+ /// Records a single function call.
+ template <typename Result, typename... FArgs, typename... RArgs>
+ void Record(Serializer &serializer, Registry ®istry, Result (*f)(FArgs...),
+ const RArgs &... args) {
+ m_serializer = &serializer;
+ if (!ShouldCapture())
+ return;
+
+ unsigned id = registry.GetID(uintptr_t(f));
+
+#ifdef LLDB_REPRO_INSTR_TRACE
+ Log(id);
+#endif
+
+ serializer.SerializeAll(id);
+ serializer.SerializeAll(args...);
+
+ if (std::is_class<typename std::remove_pointer<
+ typename std::remove_reference<Result>::type>::type>::value) {
+ m_result_recorded = false;
+ } else {
+ serializer.SerializeAll(0);
+ m_result_recorded = true;
+ }
+ }
+
+ /// Records a single function call.
+ template <typename... Args>
+ void Record(Serializer &serializer, Registry ®istry, void (*f)(Args...),
+ const Args &... args) {
+ m_serializer = &serializer;
+ if (!ShouldCapture())
+ return;
+
+ unsigned id = registry.GetID(uintptr_t(f));
+
+#ifdef LLDB_REPRO_INSTR_TRACE
+ Log(id);
+#endif
+
+ serializer.SerializeAll(id);
+ serializer.SerializeAll(args...);
+
+ // Record result.
+ serializer.SerializeAll(0);
+ m_result_recorded = true;
+ }
+
+ /// Record the result of a function call.
+ template <typename Result> Result RecordResult(Result &&r) {
+ UpdateBoundary();
+ if (m_serializer && ShouldCapture()) {
+ assert(!m_result_recorded);
+ m_serializer->SerializeAll(r);
+ m_result_recorded = true;
+ }
+ return std::forward<Result>(r);
+ }
+
+private:
+ void UpdateBoundary() {
+ if (m_local_boundary)
+ g_global_boundary = false;
+ }
+
+ bool ShouldCapture() { return m_local_boundary; }
+
+#ifdef LLDB_REPRO_INSTR_TRACE
+ void Log(unsigned id) {
+ llvm::errs() << "Recording " << id << ": " << m_pretty_func << " ("
+ << m_pretty_args << ")\n";
+ }
+#endif
+
+ Serializer *m_serializer;
+
+ /// Pretty function for logging.
+ llvm::StringRef m_pretty_func;
+ std::string m_pretty_args;
+
+ /// Whether this function call was the one crossing the API boundary.
+ bool m_local_boundary;
+
+ /// Whether the return value was recorded explicitly.
+ bool m_result_recorded;
+
+ /// Whether we're currently across the API boundary.
+ static bool g_global_boundary;
+};
+
+} // namespace repro
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
diff --git a/linux-x64/clang/include/lldb/Utility/Scalar.h b/linux-x64/clang/include/lldb/Utility/Scalar.h
new file mode 100644
index 0000000..62ee9f6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Scalar.h
@@ -0,0 +1,353 @@
+//===-- Scalar.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_SCALAR_H
+#define LLDB_UTILITY_SCALAR_H
+
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/Utility/LLDBAssert.h"
+#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/APInt.h"
+#include <cstddef>
+#include <cstdint>
+
+namespace lldb_private {
+class DataExtractor;
+class Stream;
+} // namespace lldb_private
+
+#define NUM_OF_WORDS_INT128 2
+#define BITWIDTH_INT128 128
+#define NUM_OF_WORDS_INT256 4
+#define BITWIDTH_INT256 256
+#define NUM_OF_WORDS_INT512 8
+#define BITWIDTH_INT512 512
+
+namespace lldb_private {
+
+// A class designed to hold onto values and their corresponding types.
+// Operators are defined and Scalar objects will correctly promote their types
+// and values before performing these operations. Type promotion currently
+// follows the ANSI C type promotion rules.
+class Scalar {
+public:
+ enum Type {
+ e_void = 0,
+ e_sint,
+ e_uint,
+ e_slong,
+ e_ulong,
+ e_slonglong,
+ e_ulonglong,
+ e_sint128,
+ e_uint128,
+ e_sint256,
+ e_uint256,
+ e_sint512,
+ e_uint512,
+ e_float,
+ e_double,
+ e_long_double
+ };
+
+ // Constructors and Destructors
+ Scalar();
+ Scalar(int v) : m_type(e_sint), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(int) * 8, v, true);
+ }
+ Scalar(unsigned int v) : m_type(e_uint), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(int) * 8, v);
+ }
+ Scalar(long v) : m_type(e_slong), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(long) * 8, v, true);
+ }
+ Scalar(unsigned long v) : m_type(e_ulong), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(long) * 8, v);
+ }
+ Scalar(long long v) : m_type(e_slonglong), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(long long) * 8, v, true);
+ }
+ Scalar(unsigned long long v)
+ : m_type(e_ulonglong), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(sizeof(long long) * 8, v);
+ }
+ Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); }
+ Scalar(double v) : m_type(e_double), m_float(v) {
+ m_float = llvm::APFloat(v);
+ }
+ Scalar(long double v, bool ieee_quad)
+ : m_type(e_long_double), m_float(static_cast<float>(0)),
+ m_ieee_quad(ieee_quad) {
+ if (ieee_quad)
+ m_float =
+ llvm::APFloat(llvm::APFloat::IEEEquad(),
+ llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
+ (reinterpret_cast<type128 *>(&v))->x));
+ else
+ m_float =
+ llvm::APFloat(llvm::APFloat::x87DoubleExtended(),
+ llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
+ (reinterpret_cast<type128 *>(&v))->x));
+ }
+ Scalar(llvm::APInt v) : m_type(), m_float(static_cast<float>(0)) {
+ m_integer = llvm::APInt(v);
+ switch (m_integer.getBitWidth()) {
+ case 8:
+ case 16:
+ case 32:
+ m_type = e_sint;
+ return;
+ case 64:
+ m_type = e_slonglong;
+ return;
+ case 128:
+ m_type = e_sint128;
+ return;
+ case 256:
+ m_type = e_sint256;
+ return;
+ case 512:
+ m_type = e_sint512;
+ return;
+ }
+ lldbassert(false && "unsupported bitwidth");
+ }
+ // Scalar(const RegisterValue& reg_value);
+ virtual ~Scalar();
+
+ bool SignExtend(uint32_t bit_pos);
+
+ bool ExtractBitfield(uint32_t bit_size, uint32_t bit_offset);
+
+ bool SetBit(uint32_t bit);
+
+ bool ClearBit(uint32_t bit);
+
+ const void *GetBytes() const;
+
+ size_t GetByteSize() const;
+
+ bool GetData(DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const;
+
+ size_t GetAsMemoryData(void *dst, size_t dst_len,
+ lldb::ByteOrder dst_byte_order, Status &error) const;
+
+ bool IsZero() const;
+
+ void Clear() {
+ m_type = e_void;
+ m_integer.clearAllBits();
+ }
+
+ const char *GetTypeAsCString() const;
+
+ void GetValue(Stream *s, bool show_type) const;
+
+ bool IsValid() const {
+ return (m_type >= e_sint) && (m_type <= e_long_double);
+ }
+
+ bool Promote(Scalar::Type type);
+
+ bool MakeSigned();
+
+ bool MakeUnsigned();
+
+ static const char *GetValueTypeAsCString(Scalar::Type value_type);
+
+ static Scalar::Type
+ GetValueTypeForSignedIntegerWithByteSize(size_t byte_size);
+
+ static Scalar::Type
+ GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size);
+
+ static Scalar::Type GetValueTypeForFloatWithByteSize(size_t byte_size);
+
+ // All operators can benefits from the implicit conversions that will happen
+ // automagically by the compiler, so no temporary objects will need to be
+ // created. As a result, we currently don't need a variety of overloaded set
+ // value accessors.
+ Scalar &operator=(const int i);
+ Scalar &operator=(unsigned int v);
+ Scalar &operator=(long v);
+ Scalar &operator=(unsigned long v);
+ Scalar &operator=(long long v);
+ Scalar &operator=(unsigned long long v);
+ Scalar &operator=(float v);
+ Scalar &operator=(double v);
+ Scalar &operator=(long double v);
+ Scalar &operator=(llvm::APInt v);
+ Scalar &operator=(const Scalar &rhs); // Assignment operator
+ Scalar &operator+=(const Scalar &rhs);
+ Scalar &operator<<=(const Scalar &rhs); // Shift left
+ Scalar &operator>>=(const Scalar &rhs); // Shift right (arithmetic)
+ Scalar &operator&=(const Scalar &rhs);
+
+ // Shifts the current value to the right without maintaining the current sign
+ // of the value (if it is signed).
+ bool ShiftRightLogical(const Scalar &rhs); // Returns true on success
+
+ // Takes the absolute value of the current value if it is signed, else the
+ // value remains unchanged. Returns false if the contained value has a void
+ // type.
+ bool AbsoluteValue(); // Returns true on success
+ // Negates the current value (even for unsigned values). Returns false if the
+ // contained value has a void type.
+ bool UnaryNegate(); // Returns true on success
+ // Inverts all bits in the current value as long as it isn't void or a
+ // float/double/long double type. Returns false if the contained value has a
+ // void/float/double/long double type, else the value is inverted and true is
+ // returned.
+ bool OnesComplement(); // Returns true on success
+
+ // Access the type of the current value.
+ Scalar::Type GetType() const { return m_type; }
+
+ // Returns a casted value of the current contained data without modifying the
+ // current value. FAIL_VALUE will be returned if the type of the value is
+ // void or invalid.
+ int SInt(int fail_value = 0) const;
+
+ unsigned char UChar(unsigned char fail_value = 0) const;
+
+ signed char SChar(char fail_value = 0) const;
+
+ unsigned short UShort(unsigned short fail_value = 0) const;
+
+ short SShort(short fail_value = 0) const;
+
+ unsigned int UInt(unsigned int fail_value = 0) const;
+
+ long SLong(long fail_value = 0) const;
+
+ unsigned long ULong(unsigned long fail_value = 0) const;
+
+ long long SLongLong(long long fail_value = 0) const;
+
+ unsigned long long ULongLong(unsigned long long fail_value = 0) const;
+
+ llvm::APInt SInt128(llvm::APInt &fail_value) const;
+
+ llvm::APInt UInt128(const llvm::APInt &fail_value) const;
+
+ float Float(float fail_value = 0.0f) const;
+
+ double Double(double fail_value = 0.0) const;
+
+ long double LongDouble(long double fail_value = 0.0) const;
+
+ Status SetValueFromCString(const char *s, lldb::Encoding encoding,
+ size_t byte_size);
+
+ Status SetValueFromData(DataExtractor &data, lldb::Encoding encoding,
+ size_t byte_size);
+
+ static bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) {
+ if (total_byte_size > 8)
+ return false;
+
+ if (total_byte_size == 8)
+ return true;
+
+ const uint64_t max = (static_cast<uint64_t>(1)
+ << static_cast<uint64_t>(total_byte_size * 8)) -
+ 1;
+ return uval64 <= max;
+ }
+
+ static bool SIntValueIsValidForSize(int64_t sval64, size_t total_byte_size) {
+ if (total_byte_size > 8)
+ return false;
+
+ if (total_byte_size == 8)
+ return true;
+
+ const int64_t max = (static_cast<int64_t>(1)
+ << static_cast<uint64_t>(total_byte_size * 8 - 1)) -
+ 1;
+ const int64_t min = ~(max);
+ return min <= sval64 && sval64 <= max;
+ }
+
+protected:
+ typedef char schar_t;
+ typedef unsigned char uchar_t;
+ typedef short sshort_t;
+ typedef unsigned short ushort_t;
+ typedef int sint_t;
+ typedef unsigned int uint_t;
+ typedef long slong_t;
+ typedef unsigned long ulong_t;
+ typedef long long slonglong_t;
+ typedef unsigned long long ulonglong_t;
+ typedef float float_t;
+ typedef double double_t;
+ typedef long double long_double_t;
+
+ // Classes that inherit from Scalar can see and modify these
+ Scalar::Type m_type;
+ llvm::APInt m_integer;
+ llvm::APFloat m_float;
+ bool m_ieee_quad = false;
+
+private:
+ friend const Scalar operator+(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator-(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator/(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator*(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator&(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator|(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator%(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator^(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator<<(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator>>(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator==(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator!=(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator<(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator<=(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator>(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator>=(const Scalar &lhs, const Scalar &rhs);
+};
+
+// Split out the operators into a format where the compiler will be able to
+// implicitly convert numbers into Scalar objects.
+//
+// This allows code like:
+// Scalar two(2);
+// Scalar four = two * 2;
+// Scalar eight = 2 * four; // This would cause an error if the
+// // operator* was implemented as a
+// // member function.
+// SEE:
+// Item 19 of "Effective C++ Second Edition" by Scott Meyers
+// Differentiate among members functions, non-member functions, and
+// friend functions
+const Scalar operator+(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator-(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator/(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator*(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator&(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator|(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator%(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator^(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator<<(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator>>(const Scalar &lhs, const Scalar &rhs);
+bool operator==(const Scalar &lhs, const Scalar &rhs);
+bool operator!=(const Scalar &lhs, const Scalar &rhs);
+bool operator<(const Scalar &lhs, const Scalar &rhs);
+bool operator<=(const Scalar &lhs, const Scalar &rhs);
+bool operator>(const Scalar &lhs, const Scalar &rhs);
+bool operator>=(const Scalar &lhs, const Scalar &rhs);
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Scalar &scalar);
+
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_SCALAR_H
diff --git a/linux-x64/clang/include/lldb/Utility/SelectHelper.h b/linux-x64/clang/include/lldb/Utility/SelectHelper.h
new file mode 100644
index 0000000..ec37f19
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/SelectHelper.h
@@ -0,0 +1,71 @@
+//===-- SelectHelper.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_SelectHelper_h_
+#define liblldb_SelectHelper_h_
+
+#include "lldb/Utility/Status.h"
+#include "lldb/lldb-types.h"
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
+
+#include <chrono>
+
+class SelectHelper {
+public:
+ // Defaults to infinite wait for select unless you call SetTimeout()
+ SelectHelper();
+
+ // Call SetTimeout() before calling SelectHelper::Select() to set the timeout
+ // based on the current time + the timeout. This allows multiple calls to
+ // SelectHelper::Select() without having to worry about the absolute timeout
+ // as this class manages to set the relative timeout correctly.
+ void SetTimeout(const std::chrono::microseconds &timeout);
+
+ // Call the FDSet*() functions before calling SelectHelper::Select() to set
+ // the file descriptors that we will watch for when calling select. This will
+ // cause FD_SET() to be called prior to calling select using the "fd"
+ // provided.
+ void FDSetRead(lldb::socket_t fd);
+ void FDSetWrite(lldb::socket_t fd);
+ void FDSetError(lldb::socket_t fd);
+
+ // Call the FDIsSet*() functions after calling SelectHelper::Select() to
+ // check which file descriptors are ready for read/write/error. This will
+ // contain the result of FD_ISSET after calling select for a given file
+ // descriptor.
+ bool FDIsSetRead(lldb::socket_t fd) const;
+ bool FDIsSetWrite(lldb::socket_t fd) const;
+ bool FDIsSetError(lldb::socket_t fd) const;
+
+ // 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::Status Select();
+
+protected:
+ struct FDInfo {
+ FDInfo()
+ : read_set(false), write_set(false), error_set(false),
+ read_is_set(false), write_is_set(false), error_is_set(false) {}
+
+ void PrepareForSelect() {
+ read_is_set = false;
+ write_is_set = false;
+ error_is_set = false;
+ }
+
+ bool read_set : 1, write_set : 1, error_set : 1, read_is_set : 1,
+ write_is_set : 1, error_is_set : 1;
+ };
+ llvm::DenseMap<lldb::socket_t, FDInfo> m_fd_map;
+ llvm::Optional<std::chrono::steady_clock::time_point> m_end_time;
+};
+
+#endif // liblldb_SelectHelper_h_
diff --git a/linux-x64/clang/include/lldb/Utility/SharedCluster.h b/linux-x64/clang/include/lldb/Utility/SharedCluster.h
new file mode 100644
index 0000000..71bbb33
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/SharedCluster.h
@@ -0,0 +1,95 @@
+//===------------------SharedCluster.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_SharedCluster_h_
+#define utility_SharedCluster_h_
+
+#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/SharingPtr.h"
+
+#include "llvm/ADT/SmallPtrSet.h"
+
+#include <mutex>
+
+namespace lldb_private {
+
+namespace imp {
+template <typename T>
+class shared_ptr_refcount : public lldb_private::imp::shared_count {
+public:
+ template <class Y>
+ shared_ptr_refcount(Y *in) : shared_count(0), manager(in) {}
+
+ shared_ptr_refcount() : shared_count(0) {}
+
+ ~shared_ptr_refcount() override {}
+
+ void on_zero_shared() override { manager->DecrementRefCount(); }
+
+private:
+ T *manager;
+};
+
+} // namespace imp
+
+template <class T> class ClusterManager {
+public:
+ ClusterManager() : m_objects(), m_external_ref(0), m_mutex() {}
+
+ ~ClusterManager() {
+ for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(),
+ end = m_objects.end();
+ pos != end; ++pos) {
+ T *object = *pos;
+ delete object;
+ }
+
+ // Decrement refcount should have been called on this ClusterManager, and
+ // it should have locked the mutex, now we will unlock it before we destroy
+ // it...
+ m_mutex.unlock();
+ }
+
+ void ManageObject(T *new_object) {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ m_objects.insert(new_object);
+ }
+
+ typename lldb_private::SharingPtr<T> GetSharedPointer(T *desired_object) {
+ {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ m_external_ref++;
+ if (0 == m_objects.count(desired_object)) {
+ lldbassert(false && "object not found in shared cluster when expected");
+ desired_object = nullptr;
+ }
+ }
+ return typename lldb_private::SharingPtr<T>(
+ desired_object, new imp::shared_ptr_refcount<ClusterManager>(this));
+ }
+
+private:
+ void DecrementRefCount() {
+ m_mutex.lock();
+ m_external_ref--;
+ if (m_external_ref == 0)
+ delete this;
+ else
+ m_mutex.unlock();
+ }
+
+ friend class imp::shared_ptr_refcount<ClusterManager>;
+
+ llvm::SmallPtrSet<T *, 16> m_objects;
+ int m_external_ref;
+ std::mutex m_mutex;
+};
+
+} // namespace lldb_private
+
+#endif // utility_SharedCluster_h_
diff --git a/linux-x64/clang/include/lldb/Utility/SharingPtr.h b/linux-x64/clang/include/lldb/Utility/SharingPtr.h
new file mode 100644
index 0000000..e4ab3d2
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/SharingPtr.h
@@ -0,0 +1,609 @@
+//===---------------------SharingPtr.h --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_SharingPtr_h_
+#define utility_SharingPtr_h_
+
+#include <memory>
+
+// Microsoft Visual C++ currently does not enable std::atomic to work in CLR
+// mode - as such we need to "hack around it" for MSVC++ builds only using
+// Windows specific intrinsics instead of the C++11 atomic support
+#ifdef _MSC_VER
+#include <intrin.h>
+#else
+#include <atomic>
+#endif
+
+#include <stddef.h>
+
+
+//#define ENABLE_SP_LOGGING 1 // DON'T CHECK THIS LINE IN UNLESS COMMENTED OUT
+#if defined(ENABLE_SP_LOGGING)
+
+extern "C" void track_sp(void *sp_this, void *ptr, long count);
+
+#endif
+
+namespace lldb_private {
+
+namespace imp {
+
+class shared_count {
+ shared_count(const shared_count &) = delete;
+ shared_count &operator=(const shared_count &) = delete;
+
+public:
+ explicit shared_count(long refs = 0) : shared_owners_(refs) {}
+
+ void add_shared();
+ void release_shared();
+ long use_count() const { return shared_owners_ + 1; }
+
+protected:
+#ifdef _MSC_VER
+ long shared_owners_;
+#else
+ std::atomic<long> shared_owners_;
+#endif
+ virtual ~shared_count();
+
+private:
+ virtual void on_zero_shared() = 0;
+};
+
+template <class T> class shared_ptr_pointer : public shared_count {
+ T data_;
+
+public:
+ shared_ptr_pointer(T p) : data_(p) {}
+
+private:
+ void on_zero_shared() override;
+
+ shared_ptr_pointer(const shared_ptr_pointer &) = delete;
+ shared_ptr_pointer &operator=(const shared_ptr_pointer &) = delete;
+};
+
+template <class T> void shared_ptr_pointer<T>::on_zero_shared() {
+ delete data_;
+}
+
+template <class T> class shared_ptr_emplace : public shared_count {
+ T data_;
+
+public:
+ shared_ptr_emplace() : data_() {}
+
+ template <class A0> shared_ptr_emplace(A0 &a0) : data_(a0) {}
+
+ template <class A0, class A1>
+ shared_ptr_emplace(A0 &a0, A1 &a1) : data_(a0, a1) {}
+
+ template <class A0, class A1, class A2>
+ shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2) : data_(a0, a1, a2) {}
+
+ template <class A0, class A1, class A2, class A3>
+ shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2, A3 &a3) : data_(a0, a1, a2, a3) {}
+
+ template <class A0, class A1, class A2, class A3, class A4>
+ shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2, A3 &a3, A4 &a4)
+ : data_(a0, a1, a2, a3, a4) {}
+
+private:
+ void on_zero_shared() override;
+
+public:
+ T *get() { return &data_; }
+};
+
+template <class T> void shared_ptr_emplace<T>::on_zero_shared() {}
+
+} // namespace imp
+
+template <class T> class SharingPtr {
+public:
+ typedef T element_type;
+
+private:
+ element_type *ptr_;
+ imp::shared_count *cntrl_;
+
+ struct nat {
+ int for_bool_;
+ };
+
+public:
+ SharingPtr();
+ SharingPtr(std::nullptr_t);
+ template <class Y> explicit SharingPtr(Y *p);
+ template <class Y> explicit SharingPtr(Y *p, imp::shared_count *ctrl_block);
+ template <class Y> SharingPtr(const SharingPtr<Y> &r, element_type *p);
+ SharingPtr(const SharingPtr &r);
+ template <class Y> SharingPtr(const SharingPtr<Y> &r);
+
+ ~SharingPtr();
+
+ SharingPtr &operator=(const SharingPtr &r);
+ template <class Y> SharingPtr &operator=(const SharingPtr<Y> &r);
+
+ void swap(SharingPtr &r);
+ void reset();
+ template <class Y> void reset(Y *p);
+ void reset(std::nullptr_t);
+
+ element_type *get() const { return ptr_; }
+ element_type &operator*() const { return *ptr_; }
+ element_type *operator->() const { return ptr_; }
+ long use_count() const { return cntrl_ ? cntrl_->use_count() : 0; }
+ bool unique() const { return use_count() == 1; }
+ bool empty() const { return cntrl_ == nullptr; }
+ operator nat *() const { return (nat *)get(); }
+
+ static SharingPtr<T> make_shared();
+
+ template <class A0> static SharingPtr<T> make_shared(A0 &);
+
+ template <class A0, class A1> static SharingPtr<T> make_shared(A0 &, A1 &);
+
+ template <class A0, class A1, class A2>
+ static SharingPtr<T> make_shared(A0 &, A1 &, A2 &);
+
+ template <class A0, class A1, class A2, class A3>
+ static SharingPtr<T> make_shared(A0 &, A1 &, A2 &, A3 &);
+
+ template <class A0, class A1, class A2, class A3, class A4>
+ static SharingPtr<T> make_shared(A0 &, A1 &, A2 &, A3 &, A4 &);
+
+private:
+ template <class U> friend class SharingPtr;
+};
+
+template <class T>
+inline SharingPtr<T>::SharingPtr() : ptr_(nullptr), cntrl_(nullptr) {}
+
+template <class T>
+inline SharingPtr<T>::SharingPtr(std::nullptr_t)
+ : ptr_(nullptr), cntrl_(nullptr) {}
+
+template <class T>
+template <class Y>
+SharingPtr<T>::SharingPtr(Y *p) : ptr_(p), cntrl_(nullptr) {
+ std::unique_ptr<Y> hold(p);
+ typedef imp::shared_ptr_pointer<Y *> _CntrlBlk;
+ cntrl_ = new _CntrlBlk(p);
+ hold.release();
+}
+
+template <class T>
+template <class Y>
+SharingPtr<T>::SharingPtr(Y *p, imp::shared_count *cntrl_block)
+ : ptr_(p), cntrl_(cntrl_block) {}
+
+template <class T>
+template <class Y>
+inline SharingPtr<T>::SharingPtr(const SharingPtr<Y> &r, element_type *p)
+ : ptr_(p), cntrl_(r.cntrl_) {
+ if (cntrl_)
+ cntrl_->add_shared();
+}
+
+template <class T>
+inline SharingPtr<T>::SharingPtr(const SharingPtr &r)
+ : ptr_(r.ptr_), cntrl_(r.cntrl_) {
+ if (cntrl_)
+ cntrl_->add_shared();
+}
+
+template <class T>
+template <class Y>
+inline SharingPtr<T>::SharingPtr(const SharingPtr<Y> &r)
+ : ptr_(r.ptr_), cntrl_(r.cntrl_) {
+ if (cntrl_)
+ cntrl_->add_shared();
+}
+
+template <class T> SharingPtr<T>::~SharingPtr() {
+ if (cntrl_)
+ cntrl_->release_shared();
+}
+
+template <class T>
+inline SharingPtr<T> &SharingPtr<T>::operator=(const SharingPtr &r) {
+ SharingPtr(r).swap(*this);
+ return *this;
+}
+
+template <class T>
+template <class Y>
+inline SharingPtr<T> &SharingPtr<T>::operator=(const SharingPtr<Y> &r) {
+ SharingPtr(r).swap(*this);
+ return *this;
+}
+
+template <class T> inline void SharingPtr<T>::swap(SharingPtr &r) {
+ std::swap(ptr_, r.ptr_);
+ std::swap(cntrl_, r.cntrl_);
+}
+
+template <class T> inline void SharingPtr<T>::reset() {
+ SharingPtr().swap(*this);
+}
+
+template <class T> inline void SharingPtr<T>::reset(std::nullptr_t p) {
+ reset();
+}
+
+template <class T> template <class Y> inline void SharingPtr<T>::reset(Y *p) {
+ SharingPtr(p).swap(*this);
+}
+
+template <class T> SharingPtr<T> SharingPtr<T>::make_shared() {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk();
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T>
+template <class A0>
+SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0) {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk(a0);
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T>
+template <class A0, class A1>
+SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1) {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk(a0, a1);
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T>
+template <class A0, class A1, class A2>
+SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2) {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk(a0, a1, a2);
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T>
+template <class A0, class A1, class A2, class A3>
+SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3) {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk(a0, a1, a2, a3);
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T>
+template <class A0, class A1, class A2, class A3, class A4>
+SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3,
+ A4 &a4) {
+ typedef imp::shared_ptr_emplace<T> CntrlBlk;
+ SharingPtr<T> r;
+ r.cntrl_ = new CntrlBlk(a0, a1, a2, a3, a4);
+ r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
+ return r;
+}
+
+template <class T> inline SharingPtr<T> make_shared() {
+ return SharingPtr<T>::make_shared();
+}
+
+template <class T, class A0> inline SharingPtr<T> make_shared(A0 &a0) {
+ return SharingPtr<T>::make_shared(a0);
+}
+
+template <class T, class A0, class A1>
+inline SharingPtr<T> make_shared(A0 &a0, A1 &a1) {
+ return SharingPtr<T>::make_shared(a0, a1);
+}
+
+template <class T, class A0, class A1, class A2>
+inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2) {
+ return SharingPtr<T>::make_shared(a0, a1, a2);
+}
+
+template <class T, class A0, class A1, class A2, class A3>
+inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3) {
+ return SharingPtr<T>::make_shared(a0, a1, a2, a3);
+}
+
+template <class T, class A0, class A1, class A2, class A3, class A4>
+inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3, A4 &a4) {
+ return SharingPtr<T>::make_shared(a0, a1, a2, a3, a4);
+}
+
+template <class T, class U>
+inline bool operator==(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
+ return __x.get() == __y.get();
+}
+
+template <class T, class U>
+inline bool operator!=(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
+ return !(__x == __y);
+}
+
+template <class T, class U>
+inline bool operator<(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
+ return __x.get() < __y.get();
+}
+
+template <class T> inline void swap(SharingPtr<T> &__x, SharingPtr<T> &__y) {
+ __x.swap(__y);
+}
+
+template <class T, class U>
+inline SharingPtr<T> static_pointer_cast(const SharingPtr<U> &r) {
+ return SharingPtr<T>(r, static_cast<T *>(r.get()));
+}
+
+template <class T, class U>
+SharingPtr<T> const_pointer_cast(const SharingPtr<U> &r) {
+ return SharingPtr<T>(r, const_cast<T *>(r.get()));
+}
+
+template <class T> class LoggingSharingPtr : public SharingPtr<T> {
+ typedef SharingPtr<T> base;
+
+public:
+ typedef void (*Callback)(void *, const LoggingSharingPtr &, bool action);
+ // action: false means increment just happened
+ // true means decrement is about to happen
+
+ LoggingSharingPtr() : cb_(0), baton_(nullptr) {}
+
+ LoggingSharingPtr(Callback cb, void *baton) : cb_(cb), baton_(baton) {
+ if (cb_)
+ cb_(baton_, *this, false);
+ }
+
+ template <class Y>
+ LoggingSharingPtr(Y *p) : base(p), cb_(0), baton_(nullptr) {}
+
+ template <class Y>
+ LoggingSharingPtr(Y *p, Callback cb, void *baton)
+ : base(p), cb_(cb), baton_(baton) {
+ if (cb_)
+ cb_(baton_, *this, false);
+ }
+
+ ~LoggingSharingPtr() {
+ if (cb_)
+ cb_(baton_, *this, true);
+ }
+
+ LoggingSharingPtr(const LoggingSharingPtr &p)
+ : base(p), cb_(p.cb_), baton_(p.baton_) {
+ if (cb_)
+ cb_(baton_, *this, false);
+ }
+
+ LoggingSharingPtr &operator=(const LoggingSharingPtr &p) {
+ if (cb_)
+ cb_(baton_, *this, true);
+ base::operator=(p);
+ cb_ = p.cb_;
+ baton_ = p.baton_;
+ if (cb_)
+ cb_(baton_, *this, false);
+ return *this;
+ }
+
+ void reset() {
+ if (cb_)
+ cb_(baton_, *this, true);
+ base::reset();
+ }
+
+ template <class Y> void reset(Y *p) {
+ if (cb_)
+ cb_(baton_, *this, true);
+ base::reset(p);
+ if (cb_)
+ cb_(baton_, *this, false);
+ }
+
+ void SetCallback(Callback cb, void *baton) {
+ cb_ = cb;
+ baton_ = baton;
+ }
+
+ void ClearCallback() {
+ cb_ = 0;
+ baton_ = 0;
+ }
+
+private:
+ Callback cb_;
+ void *baton_;
+};
+
+template <class T> class IntrusiveSharingPtr;
+
+template <class T> class ReferenceCountedBase {
+public:
+ explicit ReferenceCountedBase() : shared_owners_(-1) {}
+
+ void add_shared();
+
+ void release_shared();
+
+ long use_count() const { return shared_owners_ + 1; }
+
+protected:
+ long shared_owners_;
+
+ friend class IntrusiveSharingPtr<T>;
+
+private:
+ ReferenceCountedBase(const ReferenceCountedBase &) = delete;
+ ReferenceCountedBase &operator=(const ReferenceCountedBase &) = delete;
+};
+
+template <class T> void lldb_private::ReferenceCountedBase<T>::add_shared() {
+#ifdef _MSC_VER
+ _InterlockedIncrement(&shared_owners_);
+#else
+ ++shared_owners_;
+#endif
+}
+
+template <class T>
+void lldb_private::ReferenceCountedBase<T>::release_shared() {
+#ifdef _MSC_VER
+ if (_InterlockedDecrement(&shared_owners_) == -1)
+#else
+ if (--shared_owners_ == -1)
+#endif
+ delete static_cast<T *>(this);
+}
+
+template <class T>
+class ReferenceCountedBaseVirtual : public imp::shared_count {
+public:
+ explicit ReferenceCountedBaseVirtual() : imp::shared_count(-1) {}
+
+ ~ReferenceCountedBaseVirtual() override = default;
+
+ void on_zero_shared() override;
+};
+
+template <class T> void ReferenceCountedBaseVirtual<T>::on_zero_shared() {}
+
+template <typename T> class IntrusiveSharingPtr {
+public:
+ typedef T element_type;
+
+ explicit IntrusiveSharingPtr() : ptr_(0) {}
+
+ explicit IntrusiveSharingPtr(T *ptr) : ptr_(ptr) { add_shared(); }
+
+ IntrusiveSharingPtr(const IntrusiveSharingPtr &rhs) : ptr_(rhs.ptr_) {
+ add_shared();
+ }
+
+ template <class X>
+ IntrusiveSharingPtr(const IntrusiveSharingPtr<X> &rhs) : ptr_(rhs.get()) {
+ add_shared();
+ }
+
+ IntrusiveSharingPtr &operator=(const IntrusiveSharingPtr &rhs) {
+ reset(rhs.get());
+ return *this;
+ }
+
+ template <class X>
+ IntrusiveSharingPtr &operator=(const IntrusiveSharingPtr<X> &rhs) {
+ reset(rhs.get());
+ return *this;
+ }
+
+ IntrusiveSharingPtr &operator=(T *ptr) {
+ reset(ptr);
+ return *this;
+ }
+
+ ~IntrusiveSharingPtr() {
+ release_shared();
+ ptr_ = nullptr;
+ }
+
+ T &operator*() const { return *ptr_; }
+
+ T *operator->() const { return ptr_; }
+
+ T *get() const { return ptr_; }
+
+ explicit operator bool() const { return ptr_ != 0; }
+
+ void swap(IntrusiveSharingPtr &rhs) {
+ std::swap(ptr_, rhs.ptr_);
+#if defined(ENABLE_SP_LOGGING)
+ track_sp(this, ptr_, use_count());
+ track_sp(&rhs, rhs.ptr_, rhs.use_count());
+#endif
+ }
+
+ void reset(T *ptr = nullptr) { IntrusiveSharingPtr(ptr).swap(*this); }
+
+ long use_count() const {
+ if (ptr_)
+ return ptr_->use_count();
+ return 0;
+ }
+
+ bool unique() const { return use_count() == 1; }
+
+private:
+ element_type *ptr_;
+
+ void add_shared() {
+ if (ptr_) {
+ ptr_->add_shared();
+#if defined(ENABLE_SP_LOGGING)
+ track_sp(this, ptr_, ptr_->use_count());
+#endif
+ }
+ }
+ void release_shared() {
+ if (ptr_) {
+#if defined(ENABLE_SP_LOGGING)
+ track_sp(this, nullptr, ptr_->use_count() - 1);
+#endif
+ ptr_->release_shared();
+ }
+ }
+};
+
+template <class T, class U>
+inline bool operator==(const IntrusiveSharingPtr<T> &lhs,
+ const IntrusiveSharingPtr<U> &rhs) {
+ return lhs.get() == rhs.get();
+}
+
+template <class T, class U>
+inline bool operator!=(const IntrusiveSharingPtr<T> &lhs,
+ const IntrusiveSharingPtr<U> &rhs) {
+ return lhs.get() != rhs.get();
+}
+
+template <class T, class U>
+inline bool operator==(const IntrusiveSharingPtr<T> &lhs, U *rhs) {
+ return lhs.get() == rhs;
+}
+
+template <class T, class U>
+inline bool operator!=(const IntrusiveSharingPtr<T> &lhs, U *rhs) {
+ return lhs.get() != rhs;
+}
+
+template <class T, class U>
+inline bool operator==(T *lhs, const IntrusiveSharingPtr<U> &rhs) {
+ return lhs == rhs.get();
+}
+
+template <class T, class U>
+inline bool operator!=(T *lhs, const IntrusiveSharingPtr<U> &rhs) {
+ return lhs != rhs.get();
+}
+
+} // namespace lldb_private
+
+#endif // utility_SharingPtr_h_
diff --git a/linux-x64/clang/include/lldb/Utility/State.h b/linux-x64/clang/include/lldb/Utility/State.h
new file mode 100644
index 0000000..9ff755f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/State.h
@@ -0,0 +1,76 @@
+//===-- State.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_STATE_H
+#define LLDB_UTILITY_STATE_H
+
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdint>
+
+namespace lldb_private {
+
+/// Converts a StateType to a C string.
+///
+/// \param[in] state
+/// The StateType object to convert.
+///
+/// \return
+/// A NULL terminated C string that describes \a state. The
+/// returned string comes from constant string buffers and does
+/// not need to be freed.
+const char *StateAsCString(lldb::StateType state);
+
+/// Check if a state represents a state where the process or thread
+/// is running.
+///
+/// \param[in] state
+/// The StateType enumeration value
+///
+/// \return
+/// \b true if the state represents a process or thread state
+/// where the process or thread is running, \b false otherwise.
+bool StateIsRunningState(lldb::StateType state);
+
+/// Check if a state represents a state where the process or thread
+/// is stopped. Stopped can mean stopped when the process is still
+/// around, or stopped when the process has exited or doesn't exist
+/// yet. The \a must_exist argument tells us which of these cases is
+/// desired.
+///
+/// \param[in] state
+/// The StateType enumeration value
+///
+/// \param[in] must_exist
+/// A boolean that indicates the thread must also be alive
+/// so states like unloaded or exited won't return true.
+///
+/// \return
+/// \b true if the state represents a process or thread state
+/// where the process or thread is stopped. If \a must_exist is
+/// \b true, then the process can't be exited or unloaded,
+/// otherwise exited and unloaded or other states where the
+/// process no longer exists are considered to be stopped.
+bool StateIsStoppedState(lldb::StateType state, bool must_exist);
+
+const char *GetPermissionsAsCString(uint32_t permissions);
+
+} // namespace lldb_private
+
+namespace llvm {
+template <> struct format_provider<lldb::StateType> {
+ static void format(const lldb::StateType &state, raw_ostream &Stream,
+ StringRef Style) {
+ Stream << lldb_private::StateAsCString(state);
+ }
+};
+} // namespace llvm
+
+#endif // LLDB_UTILITY_STATE_H
diff --git a/linux-x64/clang/include/lldb/Utility/Status.h b/linux-x64/clang/include/lldb/Utility/Status.h
new file mode 100644
index 0000000..ae730b9
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Status.h
@@ -0,0 +1,224 @@
+//===-- Status.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_STATUS_H
+#define LLDB_UTILITY_STATUS_H
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/FormatVariadic.h"
+#include <cstdarg>
+#include <stdint.h>
+#include <string>
+#include <system_error>
+#include <type_traits>
+
+namespace llvm {
+class raw_ostream;
+}
+
+namespace lldb_private {
+
+/// \class Status Status.h "lldb/Utility/Status.h" 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
+/// 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 types can be enabled. In the future we
+/// may wish to switch to a registration mechanism where new error types can
+/// be registered at runtime instead of a hard coded scheme.
+///
+/// All errors in this class also know how to generate a string representation
+/// of themselves for printing results and error codes. The string value will
+/// be fetched on demand and its string value will be cached until the error
+/// is cleared of the value of the error changes.
+class Status {
+public:
+ /// Every error value that this object can contain needs to be able to fit
+ /// into ValueType.
+ typedef uint32_t ValueType;
+
+ /// Default constructor.
+ ///
+ /// Initialize the error object with a generic success value.
+ ///
+ /// \param[in] err
+ /// An error code.
+ ///
+ /// \param[in] type
+ /// The type for \a err.
+ Status();
+
+ explicit Status(ValueType err,
+ lldb::ErrorType type = lldb::eErrorTypeGeneric);
+
+ /* implicit */ Status(std::error_code EC);
+
+ explicit Status(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ /// Assignment operator.
+ ///
+ /// \param[in] err
+ /// An error code.
+ ///
+ /// \return
+ /// A const reference to this object.
+ const Status &operator=(const Status &rhs);
+
+ ~Status();
+
+ // 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.
+ //
+ /// Gets the error value as a NULL terminated C string. The error string
+ /// will be fetched and cached on demand. The error string will be retrieved
+ /// from a callback that is appropriate for the type of the error and will
+ /// be cached until the error value is changed or cleared.
+ ///
+ /// \return
+ /// The error as a NULL terminated C string value if the error
+ /// is valid and is able to be converted to a string value,
+ /// NULL otherwise.
+ const char *AsCString(const char *default_error_str = "unknown error") const;
+
+ /// Clear the object state.
+ ///
+ /// Reverts the state of this object to contain a generic success value and
+ /// frees any cached error string value.
+ void Clear();
+
+ /// Test for error condition.
+ ///
+ /// \return
+ /// \b true if this object contains an error, \b false
+ /// otherwise.
+ bool Fail() const;
+
+ /// Access the error value.
+ ///
+ /// \return
+ /// The error value.
+ ValueType GetError() const;
+
+ /// Access the error type.
+ ///
+ /// \return
+ /// The error type enumeration value.
+ lldb::ErrorType GetType() const;
+
+ /// Set accessor from a kern_return_t.
+ ///
+ /// Set accesssor for the error value to \a err and the error type to \c
+ /// MachKernel.
+ ///
+ /// \param[in] err
+ /// A mach error code.
+ void SetMachError(uint32_t err);
+
+ void SetExpressionError(lldb::ExpressionResults, const char *mssg);
+
+ int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,
+ ...) __attribute__((format(printf, 3, 4)));
+
+ /// Set accesssor with an error value and type.
+ ///
+ /// Set accesssor for the error value to \a err and the error type to \a
+ /// type.
+ ///
+ /// \param[in] err
+ /// A mach error code.
+ ///
+ /// \param[in] type
+ /// The type for \a err.
+ void SetError(ValueType err, lldb::ErrorType type);
+
+ /// Set the current error to errno.
+ ///
+ /// Update the error value to be \c errno and update the type to be \c
+ /// Status::POSIX.
+ void SetErrorToErrno();
+
+ /// 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 Status::Generic.
+ void SetErrorToGenericError();
+
+ /// Set the current error string to \a err_str.
+ ///
+ /// Set accessor for the error string value for a generic errors, or to
+ /// supply additional details above and beyond the standard error strings
+ /// that the standard type callbacks typically provide. This allows custom
+ /// strings to be supplied as an error explanation. The error string value
+ /// will remain until the error value is cleared or a new error value/type
+ /// is assigned.
+ ///
+ /// \param err_str
+ /// The new custom error string to copy and cache.
+ void SetErrorString(llvm::StringRef err_str);
+
+ /// Set the current error string to a formatted error string.
+ ///
+ /// \param format
+ /// A printf style format string
+ int SetErrorStringWithFormat(const char *format, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ int SetErrorStringWithVarArg(const char *format, va_list args);
+
+ template <typename... Args>
+ void SetErrorStringWithFormatv(const char *format, Args &&... args) {
+ SetErrorString(llvm::formatv(format, std::forward<Args>(args)...).str());
+ }
+
+ /// Test for success condition.
+ ///
+ /// Returns true if the error code in this object is considered a successful
+ /// return value.
+ ///
+ /// \return
+ /// \b true if this object contains an value that describes
+ /// success (non-erro), \b false otherwise.
+ bool Success() const;
+
+ /// Test for a failure due to a generic interrupt.
+ ///
+ /// Returns true if the error code in this object was caused by an
+ /// interrupt. At present only supports Posix EINTR.
+ ///
+ /// \return
+ /// \b true if this object contains an value that describes
+ /// failure due to interrupt, \b false otherwise.
+ bool WasInterrupted() const;
+
+protected:
+ /// Member variables
+ 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.
+};
+
+} // namespace lldb_private
+
+namespace llvm {
+template <> struct format_provider<lldb_private::Status> {
+ static void format(const lldb_private::Status &error, llvm::raw_ostream &OS,
+ llvm::StringRef Options);
+};
+}
+
+#endif // #ifndef LLDB_UTILITY_STATUS_H
diff --git a/linux-x64/clang/include/lldb/Utility/Stream.h b/linux-x64/clang/include/lldb/Utility/Stream.h
new file mode 100644
index 0000000..b24d4e4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Stream.h
@@ -0,0 +1,528 @@
+//===-- Stream.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Stream_h_
+#define liblldb_Stream_h_
+
+#include "lldb/Utility/Flags.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <type_traits>
+
+namespace lldb_private {
+
+/// \class Stream Stream.h "lldb/Utility/Stream.h"
+/// A stream class that can stream formatted output to a file.
+class Stream {
+public:
+ /// \a m_flags bit values.
+ enum {
+ eBinary = (1 << 0) ///< Get and put data as binary instead of as the default
+ /// string mode.
+ };
+
+ /// Utility class for counting the bytes that were written to a stream in a
+ /// certain time span.
+ /// \example
+ /// ByteDelta delta(*this);
+ /// WriteDataToStream("foo");
+ /// return *delta;
+ /// \endcode
+ class ByteDelta {
+ Stream *m_stream;
+ /// Bytes we have written so far when ByteDelta was created.
+ size_t m_start;
+
+ public:
+ ByteDelta(Stream &s) : m_stream(&s), m_start(s.GetWrittenBytes()) {}
+ /// Returns the number of bytes written to the given Stream since this
+ /// ByteDelta object was created.
+ size_t operator*() const { return m_stream->GetWrittenBytes() - m_start; }
+ };
+
+ /// Construct with flags and address size and byte order.
+ ///
+ /// Construct with dump flags \a flags and the default address size. \a
+ /// flags can be any of the above enumeration logical OR'ed together.
+ Stream(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
+
+ /// Construct a default Stream, not binary, host byte order and host addr
+ /// size.
+ ///
+ Stream();
+
+ // FIXME: Streams should not be copyable.
+ Stream(const Stream &other) : m_forwarder(*this) { (*this) = other; }
+
+ Stream &operator=(const Stream &rhs) {
+ m_flags = rhs.m_flags;
+ m_addr_size = rhs.m_addr_size;
+ m_byte_order = rhs.m_byte_order;
+ m_indent_level = rhs.m_indent_level;
+ return *this;
+ }
+
+ /// Destructor
+ virtual ~Stream();
+
+ // Subclasses must override these methods
+
+ /// Flush the stream.
+ ///
+ /// Subclasses should flush the stream to make any output appear if the
+ /// stream has any buffering.
+ virtual void Flush() = 0;
+
+ /// Output character bytes to the stream.
+ ///
+ /// Appends \a src_len characters from the buffer \a src to the stream.
+ ///
+ /// \param[in] src
+ /// A buffer containing at least \a src_len bytes of data.
+ ///
+ /// \param[in] src_len
+ /// A number of bytes to append to the stream.
+ ///
+ /// \return
+ /// The number of bytes that were appended to the stream.
+ size_t Write(const void *src, size_t src_len) {
+ size_t appended_byte_count = WriteImpl(src, src_len);
+ m_bytes_written += appended_byte_count;
+ return appended_byte_count;
+ }
+
+ size_t GetWrittenBytes() const { return m_bytes_written; }
+
+ // Member functions
+ size_t PutChar(char ch);
+
+ /// Set the byte_order value.
+ ///
+ /// Sets the byte order of the data to extract. Extracted values will be
+ /// swapped if necessary when decoding.
+ ///
+ /// \param[in] byte_order
+ /// The byte order value to use when extracting data.
+ ///
+ /// \return
+ /// The old byte order value.
+ lldb::ByteOrder SetByteOrder(lldb::ByteOrder byte_order);
+
+ /// Format a C string from a printf style format and variable arguments and
+ /// encode and append the resulting C string as hex bytes.
+ ///
+ /// \param[in] format
+ /// A printf style format string.
+ ///
+ /// \param[in] ...
+ /// Any additional arguments needed for the printf format string.
+ ///
+ /// \return
+ /// The number of bytes that were appended to the stream.
+ size_t PrintfAsRawHex8(const char *format, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
+
+ /// Append an uint8_t value in the hexadecimal format to the stream.
+ ///
+ /// \param[in] uvalue
+ /// The value to append.
+ ///
+ /// \return
+ /// The number of bytes that were appended to the stream.
+ size_t PutHex8(uint8_t uvalue);
+
+ size_t PutNHex8(size_t n, uint8_t uvalue);
+
+ size_t PutHex16(uint16_t uvalue,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutHex32(uint32_t uvalue,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutHex64(uint64_t uvalue,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutMaxHex64(uint64_t uvalue, size_t byte_size,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+ size_t PutFloat(float f,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutDouble(double d,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutLongDouble(long double ld,
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutPointer(void *ptr);
+
+ // Append \a src_len bytes from \a src to the stream as hex characters (two
+ // ascii characters per byte of input data)
+ size_t
+ PutBytesAsRawHex8(const void *src, size_t src_len,
+ lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid,
+ lldb::ByteOrder dst_byte_order = lldb::eByteOrderInvalid);
+
+ // Append \a src_len bytes from \a s to the stream as binary data.
+ size_t PutRawBytes(const void *s, size_t src_len,
+ lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid,
+ lldb::ByteOrder dst_byte_order = lldb::eByteOrderInvalid);
+
+ size_t PutStringAsRawHex8(llvm::StringRef s);
+
+ /// Output a NULL terminated C string \a cstr to the stream \a s.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminated C string.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(const char *cstr);
+
+ Stream &operator<<(llvm::StringRef str);
+
+ /// Output a pointer value \a p to the stream \a s.
+ ///
+ /// \param[in] p
+ /// A void pointer.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(const void *p);
+
+ /// Output a character \a ch to the stream \a s.
+ ///
+ /// \param[in] ch
+ /// A printable character value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(char ch);
+
+ /// Output a uint8_t \a uval to the stream \a s.
+ ///
+ /// \param[in] uval
+ /// A uint8_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(uint8_t uval);
+
+ /// Output a uint16_t \a uval to the stream \a s.
+ ///
+ /// \param[in] uval
+ /// A uint16_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(uint16_t uval);
+
+ /// Output a uint32_t \a uval to the stream \a s.
+ ///
+ /// \param[in] uval
+ /// A uint32_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(uint32_t uval);
+
+ /// Output a uint64_t \a uval to the stream \a s.
+ ///
+ /// \param[in] uval
+ /// A uint64_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(uint64_t uval);
+
+ /// Output a int8_t \a sval to the stream \a s.
+ ///
+ /// \param[in] sval
+ /// A int8_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(int8_t sval);
+
+ /// Output a int16_t \a sval to the stream \a s.
+ ///
+ /// \param[in] sval
+ /// A int16_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(int16_t sval);
+
+ /// Output a int32_t \a sval to the stream \a s.
+ ///
+ /// \param[in] sval
+ /// A int32_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(int32_t sval);
+
+ /// Output a int64_t \a sval to the stream \a s.
+ ///
+ /// \param[in] sval
+ /// A int64_t value.
+ ///
+ /// \return
+ /// A reference to this class so multiple things can be streamed
+ /// in one statement.
+ Stream &operator<<(int64_t sval);
+
+ /// Output an address value to this stream.
+ ///
+ /// Put an address \a addr out to the stream with optional \a prefix and \a
+ /// suffix strings.
+ ///
+ /// \param[in] addr
+ /// An address value.
+ ///
+ /// \param[in] addr_size
+ /// Size in bytes of the address, used for formatting.
+ ///
+ /// \param[in] prefix
+ /// A prefix C string. If nullptr, no prefix will be output.
+ ///
+ /// \param[in] suffix
+ /// A suffix C string. If nullptr, no suffix will be output.
+ void Address(uint64_t addr, uint32_t addr_size, const char *prefix = nullptr,
+ const char *suffix = nullptr);
+
+ /// Output an address range to this stream.
+ ///
+ /// Put an address range \a lo_addr - \a hi_addr out to the stream with
+ /// optional \a prefix and \a suffix strings.
+ ///
+ /// \param[in] lo_addr
+ /// The start address of the address range.
+ ///
+ /// \param[in] hi_addr
+ /// The end address of the address range.
+ ///
+ /// \param[in] addr_size
+ /// Size in bytes of the address, used for formatting.
+ ///
+ /// \param[in] prefix
+ /// A prefix C string. If nullptr, no prefix will be output.
+ ///
+ /// \param[in] suffix
+ /// A suffix C string. If nullptr, no suffix will be output.
+ void AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size,
+ const char *prefix = nullptr, const char *suffix = nullptr);
+
+ /// Output a C string to the stream.
+ ///
+ /// Print a C string \a cstr to the stream.
+ ///
+ /// \param[in] cstr
+ /// The string to be output to the stream.
+ size_t PutCString(llvm::StringRef cstr);
+
+ /// Output and End of Line character to the stream.
+ size_t EOL();
+
+ /// Get the address size in bytes.
+ ///
+ /// \return
+ /// The size of an address in bytes that is used when outputting
+ /// address and pointer values to the stream.
+ uint32_t GetAddressByteSize() const;
+
+ /// The flags accessor.
+ ///
+ /// \return
+ /// A reference to the Flags member variable.
+ Flags &GetFlags();
+
+ /// The flags const accessor.
+ ///
+ /// \return
+ /// A const reference to the Flags member variable.
+ const Flags &GetFlags() const;
+
+ //// The byte order accessor.
+ ////
+ //// \return
+ //// The byte order.
+ lldb::ByteOrder GetByteOrder() const;
+
+ /// Get the current indentation level.
+ ///
+ /// \return
+ /// The current indentation level as an integer.
+ int GetIndentLevel() const;
+
+ /// Indent the current line in the stream.
+ ///
+ /// Indent the current line using the current indentation level and print an
+ /// optional string following the indentation spaces.
+ ///
+ /// \param[in] s
+ /// A C string to print following the indentation. If nullptr, just
+ /// output the indentation characters.
+ size_t Indent(const char *s = nullptr);
+ size_t Indent(llvm::StringRef s);
+
+ /// Decrement the current indentation level.
+ void IndentLess(int amount = 2);
+
+ /// Increment the current indentation level.
+ void IndentMore(int amount = 2);
+
+ /// Output an offset value.
+ ///
+ /// Put an offset \a uval out to the stream using the printf format in \a
+ /// format.
+ ///
+ /// \param[in] offset
+ /// The offset value.
+ ///
+ /// \param[in] format
+ /// The printf style format to use when outputting the offset.
+ void Offset(uint32_t offset, const char *format = "0x%8.8x: ");
+
+ /// Output printf formatted output to the stream.
+ ///
+ /// Print some formatted output to the stream.
+ ///
+ /// \param[in] format
+ /// A printf style format string.
+ ///
+ /// \param[in] ...
+ /// Variable arguments that are needed for the printf style
+ /// format string \a format.
+ size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+ size_t PrintfVarArg(const char *format, va_list args);
+
+ template <typename... Args> void Format(const char *format, Args &&... args) {
+ PutCString(llvm::formatv(format, std::forward<Args>(args)...).str());
+ }
+
+ /// Output a quoted C string value to the stream.
+ ///
+ /// Print a double quoted NULL terminated C string to the stream using the
+ /// printf format in \a format.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminated C string value.
+ ///
+ /// \param[in] format
+ /// The optional C string format that can be overridden.
+ void QuotedCString(const char *cstr, const char *format = "\"%s\"");
+
+ /// Set the address size in bytes.
+ ///
+ /// \param[in] addr_size
+ /// The new size in bytes of an address to use when outputting
+ /// address and pointer values.
+ void SetAddressByteSize(uint32_t addr_size);
+
+ /// Set the current indentation level.
+ ///
+ /// \param[in] level
+ /// The new indentation level.
+ void SetIndentLevel(int level);
+
+ /// Output a SLEB128 number to the stream.
+ ///
+ /// Put an SLEB128 \a uval out to the stream using the printf format in \a
+ /// format.
+ ///
+ /// \param[in] uval
+ /// A uint64_t value that was extracted as a SLEB128 value.
+ size_t PutSLEB128(int64_t uval);
+
+ /// Output a ULEB128 number to the stream.
+ ///
+ /// Put an ULEB128 \a uval out to the stream using the printf format in \a
+ /// format.
+ ///
+ /// \param[in] uval
+ /// A uint64_t value that was extracted as a ULEB128 value.
+ size_t PutULEB128(uint64_t uval);
+
+ /// Returns a raw_ostream that forwards the data to this Stream object.
+ llvm::raw_ostream &AsRawOstream() {
+ return m_forwarder;
+ }
+
+protected:
+ // Member variables
+ Flags m_flags; ///< Dump flags.
+ uint32_t m_addr_size; ///< Size of an address in bytes.
+ lldb::ByteOrder
+ m_byte_order; ///< Byte order to use when encoding scalar types.
+ int m_indent_level; ///< Indention level.
+ std::size_t m_bytes_written = 0; ///< Number of bytes written so far.
+
+ void _PutHex8(uint8_t uvalue, bool add_prefix);
+
+ /// Output character bytes to the stream.
+ ///
+ /// Appends \a src_len characters from the buffer \a src to the stream.
+ ///
+ /// \param[in] src
+ /// A buffer containing at least \a src_len bytes of data.
+ ///
+ /// \param[in] src_len
+ /// A number of bytes to append to the stream.
+ ///
+ /// \return
+ /// The number of bytes that were appended to the stream.
+ virtual size_t WriteImpl(const void *src, size_t src_len) = 0;
+
+ /// \class RawOstreamForward Stream.h "lldb/Utility/Stream.h"
+ /// This is a wrapper class that exposes a raw_ostream interface that just
+ /// forwards to an LLDB stream, allowing to reuse LLVM algorithms that take
+ /// a raw_ostream within the LLDB code base.
+ class RawOstreamForward : public llvm::raw_ostream {
+ // Note: This stream must *not* maintain its own buffer, but instead
+ // directly write everything to the internal Stream class. Without this,
+ // we would run into the problem that the Stream written byte count would
+ // differ from the actually written bytes by the size of the internal
+ // raw_ostream buffer.
+
+ Stream &m_target;
+ void write_impl(const char *Ptr, size_t Size) override {
+ m_target.Write(Ptr, Size);
+ }
+
+ uint64_t current_pos() const override {
+ return m_target.GetWrittenBytes();
+ }
+
+ public:
+ RawOstreamForward(Stream &target)
+ : llvm::raw_ostream(/*unbuffered*/ true), m_target(target) {}
+ };
+ RawOstreamForward m_forwarder;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Stream_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StreamCallback.h b/linux-x64/clang/include/lldb/Utility/StreamCallback.h
new file mode 100644
index 0000000..6dbee67
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StreamCallback.h
@@ -0,0 +1,35 @@
+//===-- StreamCallback.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamCallback_h_
+#define liblldb_StreamCallback_h_
+
+#include "lldb/lldb-types.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+
+class StreamCallback : public llvm::raw_ostream {
+public:
+ StreamCallback(lldb::LogOutputCallback callback, void *baton);
+ ~StreamCallback() override = default;
+
+private:
+ lldb::LogOutputCallback m_callback;
+ void *m_baton;
+
+ void write_impl(const char *Ptr, size_t Size) override;
+ uint64_t current_pos() const override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamCallback_h
diff --git a/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h b/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h
new file mode 100644
index 0000000..dd0ea31
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h
@@ -0,0 +1,45 @@
+//===-- StreamGDBRemote.h ----------------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamGDBRemote_h_
+#define liblldb_StreamGDBRemote_h_
+
+#include "lldb/Utility/StreamString.h"
+#include "lldb/lldb-enumerations.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+
+class StreamGDBRemote : public StreamString {
+public:
+ StreamGDBRemote();
+
+ StreamGDBRemote(uint32_t flags, uint32_t addr_size,
+ lldb::ByteOrder byte_order);
+
+ ~StreamGDBRemote() override;
+
+ /// Output a block of data to the stream performing GDB-remote escaping.
+ ///
+ /// \param[in] s
+ /// A block of data.
+ ///
+ /// \param[in] src_len
+ /// The amount of data to write.
+ ///
+ /// \return
+ /// Number of bytes written.
+ // TODO: Convert this function to take ArrayRef<uint8_t>
+ int PutEscapedBytes(const void *s, size_t src_len);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamGDBRemote_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StreamString.h b/linux-x64/clang/include/lldb/Utility/StreamString.h
new file mode 100644
index 0000000..581e102
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StreamString.h
@@ -0,0 +1,54 @@
+//===-- StreamString.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamString_h_
+#define liblldb_StreamString_h_
+
+#include "lldb/Utility/Stream.h"
+#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <string>
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace lldb_private {
+
+class StreamString : public Stream {
+public:
+ StreamString();
+
+ StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
+
+ ~StreamString() override;
+
+ void Flush() override;
+
+ void Clear();
+
+ bool Empty() const;
+
+ size_t GetSize() const;
+
+ size_t GetSizeOfLastLine() const;
+
+ llvm::StringRef GetString() const;
+
+ const char *GetData() const { return m_packet.c_str(); }
+
+ void FillLastLineToColumn(uint32_t column, char fill_char);
+
+protected:
+ std::string m_packet;
+ size_t WriteImpl(const void *s, size_t length) override;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamString_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StreamTee.h b/linux-x64/clang/include/lldb/Utility/StreamTee.h
new file mode 100644
index 0000000..92e94d4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StreamTee.h
@@ -0,0 +1,140 @@
+//===-- StreamTee.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StreamTee_h_
+#define liblldb_StreamTee_h_
+
+#include <limits.h>
+
+#include <mutex>
+
+#include "lldb/Utility/Stream.h"
+
+namespace lldb_private {
+
+class StreamTee : public Stream {
+public:
+ StreamTee() : Stream(), m_streams_mutex(), m_streams() {}
+
+ StreamTee(lldb::StreamSP &stream_sp)
+ : Stream(), m_streams_mutex(), m_streams() {
+ // No need to lock mutex during construction
+ if (stream_sp)
+ m_streams.push_back(stream_sp);
+ }
+
+ StreamTee(lldb::StreamSP &stream_sp, lldb::StreamSP &stream_2_sp)
+ : Stream(), m_streams_mutex(), m_streams() {
+ // No need to lock mutex during construction
+ if (stream_sp)
+ m_streams.push_back(stream_sp);
+ if (stream_2_sp)
+ m_streams.push_back(stream_2_sp);
+ }
+
+ StreamTee(const StreamTee &rhs)
+ : Stream(rhs), m_streams_mutex(), m_streams() {
+ // Don't copy until we lock down "rhs"
+ std::lock_guard<std::recursive_mutex> guard(rhs.m_streams_mutex);
+ m_streams = rhs.m_streams;
+ }
+
+ ~StreamTee() override {}
+
+ StreamTee &operator=(const StreamTee &rhs) {
+ if (this != &rhs) {
+ Stream::operator=(rhs);
+ std::lock(m_streams_mutex, rhs.m_streams_mutex);
+ std::lock_guard<std::recursive_mutex> lhs_locker(m_streams_mutex,
+ std::adopt_lock);
+ std::lock_guard<std::recursive_mutex> rhs_locker(rhs.m_streams_mutex,
+ std::adopt_lock);
+ m_streams = rhs.m_streams;
+ }
+ return *this;
+ }
+
+ void Flush() override {
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ collection::iterator pos, end;
+ for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos) {
+ // Allow for our collection to contain NULL streams. This allows the
+ // StreamTee to be used with hard coded indexes for clients that might
+ // want N total streams with only a few that are set to valid values.
+ Stream *strm = pos->get();
+ if (strm)
+ strm->Flush();
+ }
+ }
+
+ size_t AppendStream(const lldb::StreamSP &stream_sp) {
+ size_t new_idx = m_streams.size();
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ m_streams.push_back(stream_sp);
+ return new_idx;
+ }
+
+ size_t GetNumStreams() const {
+ size_t result = 0;
+ {
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ result = m_streams.size();
+ }
+ return result;
+ }
+
+ lldb::StreamSP GetStreamAtIndex(uint32_t idx) {
+ lldb::StreamSP stream_sp;
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ if (idx < m_streams.size())
+ stream_sp = m_streams[idx];
+ return stream_sp;
+ }
+
+ void SetStreamAtIndex(uint32_t idx, const lldb::StreamSP &stream_sp) {
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ // Resize our stream vector as necessary to fit as many streams as needed.
+ // This also allows this class to be used with hard coded indexes that can
+ // be used contain many streams, not all of which are valid.
+ if (idx >= m_streams.size())
+ m_streams.resize(idx + 1);
+ m_streams[idx] = stream_sp;
+ }
+
+protected:
+ typedef std::vector<lldb::StreamSP> collection;
+ mutable std::recursive_mutex m_streams_mutex;
+ collection m_streams;
+
+ size_t WriteImpl(const void *s, size_t length) override {
+ std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+ if (m_streams.empty())
+ return 0;
+
+ size_t min_bytes_written = SIZE_MAX;
+ collection::iterator pos, end;
+ for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos) {
+ // Allow for our collection to contain NULL streams. This allows the
+ // StreamTee to be used with hard coded indexes for clients that might
+ // want N total streams with only a few that are set to valid values.
+ Stream *strm = pos->get();
+ if (strm) {
+ const size_t bytes_written = strm->Write(s, length);
+ if (min_bytes_written > bytes_written)
+ min_bytes_written = bytes_written;
+ }
+ }
+ if (min_bytes_written == SIZE_MAX)
+ return 0;
+ return min_bytes_written;
+ }
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StreamTee_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StringExtractor.h b/linux-x64/clang/include/lldb/Utility/StringExtractor.h
new file mode 100644
index 0000000..f20ec92
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StringExtractor.h
@@ -0,0 +1,124 @@
+//===-- StringExtractor.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_StringExtractor_h_
+#define utility_StringExtractor_h_
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
+
+class StringExtractor {
+public:
+ enum { BigEndian = 0, LittleEndian = 1 };
+ // Constructors and Destructors
+ StringExtractor();
+ StringExtractor(llvm::StringRef packet_str);
+ StringExtractor(const char *packet_cstr);
+ virtual ~StringExtractor();
+
+ void Reset(llvm::StringRef str) {
+ m_packet = str;
+ m_index = 0;
+ }
+
+ // Returns true if the file position is still valid for the data contained in
+ // this string extractor object.
+ bool IsGood() const { return m_index != UINT64_MAX; }
+
+ uint64_t GetFilePos() const { return m_index; }
+
+ void SetFilePos(uint32_t idx) { m_index = idx; }
+
+ void Clear() {
+ m_packet.clear();
+ m_index = 0;
+ }
+
+ void SkipSpaces();
+
+ std::string &GetStringRef() { return m_packet; }
+
+ const std::string &GetStringRef() const { return m_packet; }
+
+ bool Empty() { return m_packet.empty(); }
+
+ size_t GetBytesLeft() {
+ if (m_index < m_packet.size())
+ return m_packet.size() - m_index;
+ return 0;
+ }
+
+ char GetChar(char fail_value = '\0');
+
+ char PeekChar(char fail_value = '\0') {
+ const char *cstr = Peek();
+ if (cstr)
+ return cstr[0];
+ return fail_value;
+ }
+
+ int DecodeHexU8();
+
+ uint8_t GetHexU8(uint8_t fail_value = 0, bool set_eof_on_fail = true);
+
+ bool GetHexU8Ex(uint8_t &ch, bool set_eof_on_fail = true);
+
+ bool GetNameColonValue(llvm::StringRef &name, llvm::StringRef &value);
+
+ int32_t GetS32(int32_t fail_value, int base = 0);
+
+ uint32_t GetU32(uint32_t fail_value, int base = 0);
+
+ int64_t GetS64(int64_t fail_value, int base = 0);
+
+ uint64_t GetU64(uint64_t fail_value, int base = 0);
+
+ uint32_t GetHexMaxU32(bool little_endian, uint32_t fail_value);
+
+ uint64_t GetHexMaxU64(bool little_endian, uint64_t fail_value);
+
+ size_t GetHexBytes(llvm::MutableArrayRef<uint8_t> dest,
+ uint8_t fail_fill_value);
+
+ size_t GetHexBytesAvail(llvm::MutableArrayRef<uint8_t> dest);
+
+ uint64_t GetHexWithFixedSize(uint32_t byte_size, bool little_endian,
+ uint64_t fail_value);
+
+ size_t GetHexByteString(std::string &str);
+
+ size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length);
+
+ 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;
+ return nullptr;
+ }
+
+protected:
+ bool fail() {
+ m_index = UINT64_MAX;
+ return false;
+ }
+ // For StringExtractor only
+ std::string m_packet; // The string in which to extract data.
+ uint64_t m_index; // When extracting data from a packet, this index
+ // will march along as things get extracted. If set to
+ // UINT64_MAX the end of the packet data was reached
+ // when decoding information
+};
+
+#endif // utility_StringExtractor_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h b/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h
new file mode 100644
index 0000000..cbf6e0c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h
@@ -0,0 +1,203 @@
+//===-- StringExtractorGDBRemote.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
+#define LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
+
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StringExtractor.h"
+#include "llvm/ADT/StringRef.h"
+
+#include <string>
+
+#include <stddef.h>
+#include <stdint.h>
+
+class StringExtractorGDBRemote : public StringExtractor {
+public:
+ typedef bool (*ResponseValidatorCallback)(
+ void *baton, const StringExtractorGDBRemote &response);
+
+ StringExtractorGDBRemote() : StringExtractor(), m_validator(nullptr) {}
+
+ StringExtractorGDBRemote(llvm::StringRef str)
+ : StringExtractor(str), m_validator(nullptr) {}
+
+ StringExtractorGDBRemote(const char *cstr)
+ : StringExtractor(cstr), m_validator(nullptr) {}
+
+ StringExtractorGDBRemote(const StringExtractorGDBRemote &rhs)
+ : StringExtractor(rhs), m_validator(rhs.m_validator) {}
+
+ ~StringExtractorGDBRemote() override {}
+
+ bool ValidateResponse() const;
+
+ void CopyResponseValidator(const StringExtractorGDBRemote &rhs);
+
+ void SetResponseValidator(ResponseValidatorCallback callback, void *baton);
+
+ void SetResponseValidatorToOKErrorNotSupported();
+
+ void SetResponseValidatorToASCIIHexBytes();
+
+ void SetResponseValidatorToJSON();
+
+ enum ServerPacketType {
+ eServerPacketType_nack = 0,
+ eServerPacketType_ack,
+ eServerPacketType_invalid,
+ eServerPacketType_unimplemented,
+ eServerPacketType_interrupt, // CTRL+c packet or "\x03"
+ eServerPacketType_A, // Program arguments packet
+ eServerPacketType_qfProcessInfo,
+ eServerPacketType_qsProcessInfo,
+ eServerPacketType_qC,
+ eServerPacketType_qEcho,
+ eServerPacketType_qGroupName,
+ eServerPacketType_qHostInfo,
+ eServerPacketType_qLaunchGDBServer,
+ eServerPacketType_qQueryGDBServer,
+ eServerPacketType_qKillSpawnedProcess,
+ eServerPacketType_qLaunchSuccess,
+ eServerPacketType_qModuleInfo,
+ eServerPacketType_qProcessInfoPID,
+ eServerPacketType_qSpeedTest,
+ eServerPacketType_qUserName,
+ eServerPacketType_qGetWorkingDir,
+ eServerPacketType_qFileLoadAddress,
+ eServerPacketType_QEnvironment,
+ eServerPacketType_QEnableErrorStrings,
+ eServerPacketType_QLaunchArch,
+ eServerPacketType_QSetDisableASLR,
+ eServerPacketType_QSetDetachOnError,
+ eServerPacketType_QSetSTDIN,
+ eServerPacketType_QSetSTDOUT,
+ eServerPacketType_QSetSTDERR,
+ eServerPacketType_QSetWorkingDir,
+ eServerPacketType_QStartNoAckMode,
+ eServerPacketType_qPlatform_shell,
+ eServerPacketType_qPlatform_mkdir,
+ eServerPacketType_qPlatform_chmod,
+ eServerPacketType_vFile_open,
+ eServerPacketType_vFile_close,
+ eServerPacketType_vFile_pread,
+ eServerPacketType_vFile_pwrite,
+ eServerPacketType_vFile_size,
+ eServerPacketType_vFile_mode,
+ eServerPacketType_vFile_exists,
+ eServerPacketType_vFile_md5,
+ eServerPacketType_vFile_stat,
+ eServerPacketType_vFile_symlink,
+ eServerPacketType_vFile_unlink,
+ // debug server packages
+ eServerPacketType_QEnvironmentHexEncoded,
+ eServerPacketType_QListThreadsInStopReply,
+ eServerPacketType_QPassSignals,
+ eServerPacketType_QRestoreRegisterState,
+ eServerPacketType_QSaveRegisterState,
+ eServerPacketType_QSetLogging,
+ eServerPacketType_QSetMaxPacketSize,
+ eServerPacketType_QSetMaxPayloadSize,
+ eServerPacketType_QSetEnableAsyncProfiling,
+ eServerPacketType_QSyncThreadState,
+ eServerPacketType_QThreadSuffixSupported,
+
+ eServerPacketType_jThreadsInfo,
+ eServerPacketType_qsThreadInfo,
+ eServerPacketType_qfThreadInfo,
+ eServerPacketType_qGetPid,
+ eServerPacketType_qGetProfileData,
+ eServerPacketType_qGDBServerVersion,
+ eServerPacketType_qMemoryRegionInfo,
+ eServerPacketType_qMemoryRegionInfoSupported,
+ eServerPacketType_qProcessInfo,
+ eServerPacketType_qRcmd,
+ eServerPacketType_qRegisterInfo,
+ eServerPacketType_qShlibInfoAddr,
+ eServerPacketType_qStepPacketSupported,
+ eServerPacketType_qSupported,
+ eServerPacketType_qSyncThreadStateSupported,
+ eServerPacketType_qThreadExtraInfo,
+ eServerPacketType_qThreadStopInfo,
+ eServerPacketType_qVAttachOrWaitSupported,
+ eServerPacketType_qWatchpointSupportInfo,
+ eServerPacketType_qWatchpointSupportInfoSupported,
+ eServerPacketType_qXfer,
+
+ eServerPacketType_jSignalsInfo,
+ eServerPacketType_jModulesInfo,
+
+ eServerPacketType_vAttach,
+ eServerPacketType_vAttachWait,
+ eServerPacketType_vAttachOrWait,
+ eServerPacketType_vAttachName,
+ eServerPacketType_vCont,
+ eServerPacketType_vCont_actions, // vCont?
+
+ eServerPacketType_stop_reason, // '?'
+
+ eServerPacketType_c,
+ eServerPacketType_C,
+ eServerPacketType_D,
+ eServerPacketType_g,
+ eServerPacketType_G,
+ eServerPacketType_H,
+ eServerPacketType_I, // stdin notification
+ eServerPacketType_k,
+ eServerPacketType_m,
+ eServerPacketType_M,
+ eServerPacketType_p,
+ eServerPacketType_P,
+ eServerPacketType_s,
+ eServerPacketType_S,
+ eServerPacketType_T,
+ eServerPacketType_x,
+ eServerPacketType_X,
+ eServerPacketType_Z,
+ eServerPacketType_z,
+
+ eServerPacketType__M,
+ eServerPacketType__m,
+ eServerPacketType_notify, // '%' notification
+
+ eServerPacketType_jTraceStart,
+ eServerPacketType_jTraceBufferRead,
+ eServerPacketType_jTraceMetaRead,
+ eServerPacketType_jTraceStop,
+ eServerPacketType_jTraceConfigRead,
+ };
+
+ ServerPacketType GetServerPacketType() const;
+
+ enum ResponseType { eUnsupported = 0, eAck, eNack, eError, eOK, eResponse };
+
+ ResponseType GetResponseType() const;
+
+ bool IsOKResponse() const;
+
+ bool IsUnsupportedResponse() const;
+
+ bool IsNormalResponse() const;
+
+ bool IsErrorResponse() const;
+
+ // Returns zero if the packet isn't a EXX packet where XX are two hex digits.
+ // Otherwise the error encoded in XX is returned.
+ uint8_t GetError();
+
+ lldb_private::Status GetStatus();
+
+ size_t GetEscapedBinaryData(std::string &str);
+
+protected:
+ ResponseValidatorCallback m_validator;
+ void *m_validator_baton;
+};
+
+#endif // LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
diff --git a/linux-x64/clang/include/lldb/Utility/StringLexer.h b/linux-x64/clang/include/lldb/Utility/StringLexer.h
new file mode 100644
index 0000000..d9806c1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StringLexer.h
@@ -0,0 +1,56 @@
+//===--------------------- StringLexer.h ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_StringLexer_h_
+#define utility_StringLexer_h_
+
+#include <initializer_list>
+#include <string>
+#include <utility>
+
+namespace lldb_utility {
+
+class StringLexer {
+public:
+ typedef std::string::size_type Position;
+ typedef std::string::size_type Size;
+
+ typedef std::string::value_type Character;
+
+ StringLexer(std::string s);
+
+ // These APIs are not bounds-checked. Use HasAtLeast() if you're not sure.
+ Character Peek();
+
+ bool NextIf(Character c);
+
+ std::pair<bool, Character> NextIf(std::initializer_list<Character> cs);
+
+ bool AdvanceIf(const std::string &token);
+
+ Character Next();
+
+ bool HasAtLeast(Size s);
+
+ std::string GetUnlexed();
+
+ // This will assert if there are less than s characters preceding the cursor.
+ void PutBack(Size s);
+
+ StringLexer &operator=(const StringLexer &rhs);
+
+private:
+ std::string m_data;
+ Position m_position;
+
+ void Consume();
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef utility_StringLexer_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StringList.h b/linux-x64/clang/include/lldb/Utility/StringList.h
new file mode 100644
index 0000000..68c1f87
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StringList.h
@@ -0,0 +1,133 @@
+//===-- StringList.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StringList_h_
+#define liblldb_StringList_h_
+
+#include "llvm/ADT/StringRef.h"
+
+#include <stddef.h>
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+class Log;
+class Stream;
+}
+
+namespace lldb_private {
+
+class StringList {
+public:
+ StringList();
+
+ explicit StringList(const char *str);
+
+ StringList(const char **strv, int strc);
+
+ virtual ~StringList();
+
+ void AppendString(const std::string &s);
+
+ void AppendString(std::string &&s);
+
+ void AppendString(const char *str);
+
+ void AppendString(const char *str, size_t str_len);
+
+ void AppendString(llvm::StringRef str);
+
+ void AppendList(const char **strv, int strc);
+
+ void AppendList(StringList strings);
+
+ size_t GetSize() const;
+
+ void SetSize(size_t n) { m_strings.resize(n); }
+
+ size_t GetMaxStringLength() const;
+
+ std::string &operator[](size_t idx) {
+ // No bounds checking, verify "idx" is good prior to calling this function
+ return m_strings[idx];
+ }
+
+ const std::string &operator[](size_t idx) const {
+ // No bounds checking, verify "idx" is good prior to calling this function
+ return m_strings[idx];
+ }
+
+ void PopBack() { m_strings.pop_back(); }
+ const char *GetStringAtIndex(size_t idx) const;
+
+ void Join(const char *separator, Stream &strm);
+
+ void Clear();
+
+ void LongestCommonPrefix(std::string &common_prefix);
+
+ void InsertStringAtIndex(size_t idx, const std::string &str);
+
+ void InsertStringAtIndex(size_t idx, std::string &&str);
+
+ void InsertStringAtIndex(size_t id, const char *str);
+
+ void DeleteStringAtIndex(size_t id);
+
+ void RemoveBlankLines();
+
+ size_t SplitIntoLines(const std::string &lines);
+
+ size_t SplitIntoLines(const char *lines, size_t len);
+
+ std::string CopyList(const char *item_preamble = nullptr,
+ const char *items_sep = "\n") const;
+
+ StringList &operator<<(const char *str);
+
+ StringList &operator<<(const std::string &s);
+
+ StringList &operator<<(StringList strings);
+
+ // Copy assignment for a vector of strings
+ StringList &operator=(const std::vector<std::string> &rhs);
+
+ // This string list contains a list of valid auto completion strings, and the
+ // "s" is passed in. "matches" is filled in with zero or more string values
+ // that start with "s", and the first string to exactly match one of the
+ // string values in this collection, will have "exact_matches_idx" filled in
+ // to match the index, or "exact_matches_idx" will have SIZE_MAX
+ size_t AutoComplete(llvm::StringRef s, StringList &matches,
+ size_t &exact_matches_idx) const;
+
+ // Dump the StringList to the given lldb_private::Log, `log`, one item per
+ // line. If given, `name` will be used to identify the start and end of the
+ // list in the output.
+ virtual void LogDump(Log *log, const char *name = nullptr);
+
+ // Static helper to convert an iterable of strings to a StringList, and then
+ // dump it with the semantics of the `LogDump` method.
+ template <typename T>
+ static void LogDump(Log *log, T s_iterable, const char *name = nullptr) {
+ if (!log)
+ return;
+ // Make a copy of the iterable as a StringList
+ StringList l{};
+ for (const auto &s : s_iterable)
+ l << s;
+
+ l.LogDump(log, name);
+ }
+
+private:
+ std::vector<std::string> m_strings;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StringList_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StructuredData.h b/linux-x64/clang/include/lldb/Utility/StructuredData.h
new file mode 100644
index 0000000..75eb2f7
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/StructuredData.h
@@ -0,0 +1,551 @@
+//===-- StructuredData.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StructuredData_h_
+#define liblldb_StructuredData_h_
+
+#include "llvm/ADT/StringRef.h"
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-enumerations.h"
+
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <map>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <vector>
+
+namespace lldb_private {
+class Status;
+class Stream;
+}
+
+namespace lldb_private {
+
+/// \class StructuredData StructuredData.h "lldb/Utility/StructuredData.h"
+/// A class which can hold structured data
+///
+/// The StructuredData class is designed to hold the data from a JSON or plist
+/// style file -- a serialized data structure with dictionaries (maps,
+/// hashes), arrays, and concrete values like integers, floating point
+/// numbers, strings, booleans.
+///
+/// StructuredData does not presuppose any knowledge of the schema for the
+/// data it is holding; it can parse JSON data, for instance, and other parts
+/// of lldb can iterate through the parsed data set to find keys and values
+/// that may be present.
+
+class StructuredData {
+public:
+ class Object;
+ class Array;
+ class Integer;
+ class Float;
+ class Boolean;
+ class String;
+ class Dictionary;
+ class Generic;
+
+ typedef std::shared_ptr<Object> ObjectSP;
+ typedef std::shared_ptr<Array> ArraySP;
+ typedef std::shared_ptr<Integer> IntegerSP;
+ typedef std::shared_ptr<Float> FloatSP;
+ typedef std::shared_ptr<Boolean> BooleanSP;
+ typedef std::shared_ptr<String> StringSP;
+ typedef std::shared_ptr<Dictionary> DictionarySP;
+ typedef std::shared_ptr<Generic> GenericSP;
+
+ class Object : public std::enable_shared_from_this<Object> {
+ public:
+ Object(lldb::StructuredDataType t = lldb::eStructuredDataTypeInvalid)
+ : m_type(t) {}
+
+ virtual ~Object() = default;
+
+ virtual bool IsValid() const { return true; }
+
+ virtual void Clear() { m_type = lldb::eStructuredDataTypeInvalid; }
+
+ lldb::StructuredDataType GetType() const { return m_type; }
+
+ void SetType(lldb::StructuredDataType t) { m_type = t; }
+
+ Array *GetAsArray() {
+ return ((m_type == lldb::eStructuredDataTypeArray)
+ ? static_cast<Array *>(this)
+ : nullptr);
+ }
+
+ Dictionary *GetAsDictionary() {
+ return ((m_type == lldb::eStructuredDataTypeDictionary)
+ ? static_cast<Dictionary *>(this)
+ : nullptr);
+ }
+
+ Integer *GetAsInteger() {
+ return ((m_type == lldb::eStructuredDataTypeInteger)
+ ? static_cast<Integer *>(this)
+ : nullptr);
+ }
+
+ uint64_t GetIntegerValue(uint64_t fail_value = 0) {
+ Integer *integer = GetAsInteger();
+ return ((integer != nullptr) ? integer->GetValue() : fail_value);
+ }
+
+ Float *GetAsFloat() {
+ return ((m_type == lldb::eStructuredDataTypeFloat)
+ ? static_cast<Float *>(this)
+ : nullptr);
+ }
+
+ double GetFloatValue(double fail_value = 0.0) {
+ Float *f = GetAsFloat();
+ return ((f != nullptr) ? f->GetValue() : fail_value);
+ }
+
+ Boolean *GetAsBoolean() {
+ return ((m_type == lldb::eStructuredDataTypeBoolean)
+ ? static_cast<Boolean *>(this)
+ : nullptr);
+ }
+
+ bool GetBooleanValue(bool fail_value = false) {
+ Boolean *b = GetAsBoolean();
+ return ((b != nullptr) ? b->GetValue() : fail_value);
+ }
+
+ String *GetAsString() {
+ return ((m_type == lldb::eStructuredDataTypeString)
+ ? static_cast<String *>(this)
+ : nullptr);
+ }
+
+ llvm::StringRef GetStringValue(const char *fail_value = nullptr) {
+ String *s = GetAsString();
+ if (s)
+ return s->GetValue();
+
+ return fail_value;
+ }
+
+ Generic *GetAsGeneric() {
+ return ((m_type == lldb::eStructuredDataTypeGeneric)
+ ? static_cast<Generic *>(this)
+ : nullptr);
+ }
+
+ ObjectSP GetObjectForDotSeparatedPath(llvm::StringRef path);
+
+ void DumpToStdout(bool pretty_print = true) const;
+
+ virtual void Dump(Stream &s, bool pretty_print = true) const = 0;
+
+ private:
+ lldb::StructuredDataType m_type;
+ };
+
+ class Array : public Object {
+ public:
+ Array() : Object(lldb::eStructuredDataTypeArray) {}
+
+ ~Array() override = default;
+
+ bool
+ ForEach(std::function<bool(Object *object)> const &foreach_callback) const {
+ for (const auto &object_sp : m_items) {
+ if (!foreach_callback(object_sp.get()))
+ return false;
+ }
+ return true;
+ }
+
+ size_t GetSize() const { return m_items.size(); }
+
+ ObjectSP operator[](size_t idx) {
+ if (idx < m_items.size())
+ return m_items[idx];
+ return ObjectSP();
+ }
+
+ ObjectSP GetItemAtIndex(size_t idx) const {
+ assert(idx < GetSize());
+ if (idx < m_items.size())
+ return m_items[idx];
+ return ObjectSP();
+ }
+
+ template <class IntType>
+ bool GetItemAtIndexAsInteger(size_t idx, IntType &result) const {
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get()) {
+ if (auto int_value = value_sp->GetAsInteger()) {
+ result = static_cast<IntType>(int_value->GetValue());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ template <class IntType>
+ bool GetItemAtIndexAsInteger(size_t idx, IntType &result,
+ IntType default_val) const {
+ bool success = GetItemAtIndexAsInteger(idx, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ 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()) {
+ result = string_value->GetValue();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result,
+ llvm::StringRef default_val) const {
+ bool success = GetItemAtIndexAsString(idx, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ bool GetItemAtIndexAsString(size_t idx, ConstString &result) const {
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get()) {
+ if (auto string_value = value_sp->GetAsString()) {
+ result = ConstString(string_value->GetValue());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetItemAtIndexAsString(size_t idx, ConstString &result,
+ const char *default_val) const {
+ bool success = GetItemAtIndexAsString(idx, result);
+ if (!success)
+ result.SetCString(default_val);
+ return success;
+ }
+
+ bool GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const {
+ result = nullptr;
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get()) {
+ result = value_sp->GetAsDictionary();
+ return (result != nullptr);
+ }
+ return false;
+ }
+
+ bool GetItemAtIndexAsArray(size_t idx, Array *&result) const {
+ result = nullptr;
+ ObjectSP value_sp = GetItemAtIndex(idx);
+ if (value_sp.get()) {
+ result = value_sp->GetAsArray();
+ return (result != nullptr);
+ }
+ return false;
+ }
+
+ void Push(ObjectSP item) { m_items.push_back(item); }
+
+ void AddItem(ObjectSP item) { m_items.push_back(item); }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ typedef std::vector<ObjectSP> collection;
+ collection m_items;
+ };
+
+ class Integer : public Object {
+ public:
+ Integer(uint64_t i = 0)
+ : Object(lldb::eStructuredDataTypeInteger), m_value(i) {}
+
+ ~Integer() override = default;
+
+ void SetValue(uint64_t value) { m_value = value; }
+
+ uint64_t GetValue() { return m_value; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ uint64_t m_value;
+ };
+
+ class Float : public Object {
+ public:
+ Float(double d = 0.0)
+ : Object(lldb::eStructuredDataTypeFloat), m_value(d) {}
+
+ ~Float() override = default;
+
+ void SetValue(double value) { m_value = value; }
+
+ double GetValue() { return m_value; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ double m_value;
+ };
+
+ class Boolean : public Object {
+ public:
+ Boolean(bool b = false)
+ : Object(lldb::eStructuredDataTypeBoolean), m_value(b) {}
+
+ ~Boolean() override = default;
+
+ void SetValue(bool value) { m_value = value; }
+
+ bool GetValue() { return m_value; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ bool m_value;
+ };
+
+ class String : public Object {
+ public:
+ String() : Object(lldb::eStructuredDataTypeString) {}
+ explicit String(llvm::StringRef S)
+ : Object(lldb::eStructuredDataTypeString), m_value(S) {}
+
+ void SetValue(llvm::StringRef S) { m_value = S; }
+
+ llvm::StringRef GetValue() { return m_value; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ std::string m_value;
+ };
+
+ class Dictionary : public Object {
+ public:
+ Dictionary() : Object(lldb::eStructuredDataTypeDictionary), m_dict() {}
+
+ ~Dictionary() override = default;
+
+ size_t GetSize() const { return m_dict.size(); }
+
+ void ForEach(std::function<bool(ConstString key, Object *object)> const
+ &callback) const {
+ for (const auto &pair : m_dict) {
+ if (!callback(pair.first, pair.second.get()))
+ break;
+ }
+ }
+
+ ObjectSP GetKeys() const {
+ auto object_sp = std::make_shared<Array>();
+ collection::const_iterator iter;
+ for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) {
+ auto key_object_sp = std::make_shared<String>();
+ key_object_sp->SetValue(iter->first.AsCString());
+ object_sp->Push(key_object_sp);
+ }
+ return object_sp;
+ }
+
+ ObjectSP GetValueForKey(llvm::StringRef key) const {
+ ObjectSP value_sp;
+ if (!key.empty()) {
+ ConstString key_cs(key);
+ collection::const_iterator iter = m_dict.find(key_cs);
+ if (iter != m_dict.end())
+ value_sp = iter->second;
+ }
+ return value_sp;
+ }
+
+ bool GetValueForKeyAsBoolean(llvm::StringRef key, bool &result) const {
+ bool success = false;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get()) {
+ Boolean *result_ptr = value_sp->GetAsBoolean();
+ if (result_ptr) {
+ result = result_ptr->GetValue();
+ success = true;
+ }
+ }
+ return success;
+ }
+ template <class IntType>
+ bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const {
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp) {
+ if (auto int_value = value_sp->GetAsInteger()) {
+ result = static_cast<IntType>(int_value->GetValue());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ template <class IntType>
+ bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result,
+ IntType default_val) const {
+ bool success = GetValueForKeyAsInteger<IntType>(key, result);
+ if (!success)
+ result = default_val;
+ return success;
+ }
+
+ bool GetValueForKeyAsString(llvm::StringRef key,
+ llvm::StringRef &result) const {
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get()) {
+ if (auto string_value = value_sp->GetAsString()) {
+ result = string_value->GetValue();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ 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 = llvm::StringRef();
+ }
+ return success;
+ }
+
+ bool GetValueForKeyAsString(llvm::StringRef key,
+ ConstString &result) const {
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get()) {
+ if (auto string_value = value_sp->GetAsString()) {
+ result = ConstString(string_value->GetValue());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetValueForKeyAsString(llvm::StringRef key, ConstString &result,
+ const char *default_val) const {
+ bool success = GetValueForKeyAsString(key, result);
+ if (!success)
+ result.SetCString(default_val);
+ return success;
+ }
+
+ bool GetValueForKeyAsDictionary(llvm::StringRef key,
+ Dictionary *&result) const {
+ result = nullptr;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get()) {
+ result = value_sp->GetAsDictionary();
+ return (result != nullptr);
+ }
+ return false;
+ }
+
+ bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const {
+ result = nullptr;
+ ObjectSP value_sp = GetValueForKey(key);
+ if (value_sp.get()) {
+ result = value_sp->GetAsArray();
+ return (result != nullptr);
+ }
+ return false;
+ }
+
+ bool HasKey(llvm::StringRef key) const {
+ ConstString key_cs(key);
+ collection::const_iterator search = m_dict.find(key_cs);
+ return search != m_dict.end();
+ }
+
+ void AddItem(llvm::StringRef key, ObjectSP value_sp) {
+ ConstString key_cs(key);
+ m_dict[key_cs] = value_sp;
+ }
+
+ void AddIntegerItem(llvm::StringRef key, uint64_t value) {
+ AddItem(key, std::make_shared<Integer>(value));
+ }
+
+ void AddFloatItem(llvm::StringRef key, double value) {
+ AddItem(key, std::make_shared<Float>(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, std::make_shared<Boolean>(value));
+ }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ protected:
+ typedef std::map<ConstString, ObjectSP> collection;
+ collection m_dict;
+ };
+
+ class Null : public Object {
+ public:
+ Null() : Object(lldb::eStructuredDataTypeNull) {}
+
+ ~Null() override = default;
+
+ bool IsValid() const override { return false; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+ };
+
+ class Generic : public Object {
+ public:
+ explicit Generic(void *object = nullptr)
+ : Object(lldb::eStructuredDataTypeGeneric), m_object(object) {}
+
+ void SetValue(void *value) { m_object = value; }
+
+ void *GetValue() const { return m_object; }
+
+ bool IsValid() const override { return m_object != nullptr; }
+
+ void Dump(Stream &s, bool pretty_print = true) const override;
+
+ private:
+ void *m_object;
+ };
+
+ static ObjectSP ParseJSON(std::string json_text);
+
+ static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_StructuredData_h_
diff --git a/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h b/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h
new file mode 100644
index 0000000..196fdfc
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h
@@ -0,0 +1,64 @@
+//===--------------------- TildeExpressionResolver.h ------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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();
+
+ /// 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;
+
+ /// 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;
+
+ /// 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/linux-x64/clang/include/lldb/Utility/Timeout.h b/linux-x64/clang/include/lldb/Utility/Timeout.h
new file mode 100644
index 0000000..202b747
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Timeout.h
@@ -0,0 +1,70 @@
+//===-- Timeout.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Timeout_h_
+#define liblldb_Timeout_h_
+
+#include "llvm/ADT/Optional.h"
+#include "llvm/Support/Chrono.h"
+#include "llvm/Support/FormatProviders.h"
+
+namespace lldb_private {
+
+// A general purpose class for representing timeouts for various APIs. It's
+// basically an llvm::Optional<std::chrono::duration<int64_t, Ratio>>, but we
+// customize it a bit to enable the standard chrono implicit conversions (e.g.
+// from Timeout<std::milli> to Timeout<std::micro>.
+//
+// The intended meaning of the values is:
+// - llvm::None - no timeout, the call should wait forever - 0 - poll, only
+// complete the call if it will not block - >0 - wait for a given number of
+// units for the result
+template <typename Ratio>
+class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
+private:
+ template <typename Ratio2> using Dur = std::chrono::duration<int64_t, Ratio2>;
+ template <typename Rep2, typename Ratio2>
+ using EnableIf = std::enable_if<
+ std::is_convertible<std::chrono::duration<Rep2, Ratio2>,
+ std::chrono::duration<int64_t, Ratio>>::value>;
+
+ using Base = llvm::Optional<Dur<Ratio>>;
+
+public:
+ Timeout(llvm::NoneType none) : Base(none) {}
+ Timeout(const Timeout &other) = default;
+
+ template <typename Ratio2,
+ typename = typename EnableIf<int64_t, Ratio2>::type>
+ Timeout(const Timeout<Ratio2> &other)
+ : Base(other ? Base(Dur<Ratio>(*other)) : llvm::None) {}
+
+ template <typename Rep2, typename Ratio2,
+ typename = typename EnableIf<Rep2, Ratio2>::type>
+ Timeout(const std::chrono::duration<Rep2, Ratio2> &other)
+ : Base(Dur<Ratio>(other)) {}
+};
+
+} // 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/linux-x64/clang/include/lldb/Utility/Timer.h b/linux-x64/clang/include/lldb/Utility/Timer.h
new file mode 100644
index 0000000..ad9421a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/Timer.h
@@ -0,0 +1,74 @@
+//===-- Timer.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Timer_h_
+#define liblldb_Timer_h_
+
+#include "lldb/lldb-defines.h"
+#include "llvm/Support/Chrono.h"
+#include <atomic>
+#include <stdint.h>
+
+namespace lldb_private {
+class Stream;
+
+/// \class Timer Timer.h "lldb/Utility/Timer.h"
+/// A timer class that simplifies common timing metrics.
+
+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<uint64_t> m_nanos_total;
+ std::atomic<uint64_t> m_count;
+ std::atomic<Category *> m_next;
+
+ DISALLOW_COPY_AND_ASSIGN(Category);
+ };
+
+ /// Default constructor.
+ Timer(Category &category, const char *format, ...)
+ __attribute__((format(printf, 3, 4)));
+
+ /// Destructor
+ ~Timer();
+
+ void Dump();
+
+ static void SetDisplayDepth(uint32_t depth);
+
+ static void SetQuiet(bool value);
+
+ static void DumpCategoryTimes(Stream *s);
+
+ static void ResetCategoryTimes();
+
+protected:
+ using TimePoint = std::chrono::steady_clock::time_point;
+ void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; }
+
+ Category &m_category;
+ TimePoint m_total_start;
+ TimePoint::duration m_child_duration{0};
+
+ static std::atomic<bool> g_quiet;
+ static std::atomic<unsigned> g_display_depth;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(Timer);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Timer_h_
diff --git a/linux-x64/clang/include/lldb/Utility/TraceOptions.h b/linux-x64/clang/include/lldb/Utility/TraceOptions.h
new file mode 100644
index 0000000..d5e21cc
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/TraceOptions.h
@@ -0,0 +1,60 @@
+//===-- TraceOptions.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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/linux-x64/clang/include/lldb/Utility/UUID.h b/linux-x64/clang/include/lldb/Utility/UUID.h
new file mode 100644
index 0000000..dbeb9db
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/UUID.h
@@ -0,0 +1,124 @@
+//===-- UUID.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_UUID_H
+#define LLDB_UTILITY_UUID_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
+#include "llvm/ADT/ArrayRef.h"
+
+namespace llvm {
+ class StringRef;
+}
+
+namespace lldb_private {
+
+ class Stream;
+
+class UUID {
+public:
+ UUID() = default;
+
+ /// Creates a UUID from the data pointed to by the bytes argument. No special
+ /// significance is attached to any of the values.
+ static UUID fromData(const void *bytes, uint32_t num_bytes) {
+ if (bytes)
+ return fromData({reinterpret_cast<const uint8_t *>(bytes), num_bytes});
+ return UUID();
+ }
+
+ /// Creates a uuid from the data pointed to by the bytes argument. No special
+ /// significance is attached to any of the values.
+ static UUID fromData(llvm::ArrayRef<uint8_t> bytes) { return UUID(bytes); }
+
+ /// Creates a UUID from the data pointed to by the bytes argument. Data
+ /// consisting purely of zero bytes is treated as an invalid UUID.
+ static UUID fromOptionalData(const void *bytes, uint32_t num_bytes) {
+ if (bytes)
+ return fromOptionalData(
+ {reinterpret_cast<const uint8_t *>(bytes), num_bytes});
+ return UUID();
+ }
+
+ /// Creates a UUID from the data pointed to by the bytes argument. Data
+ /// consisting purely of zero bytes is treated as an invalid UUID.
+ static UUID fromOptionalData(llvm::ArrayRef<uint8_t> bytes) {
+ if (llvm::all_of(bytes, [](uint8_t b) { return b == 0; }))
+ return UUID();
+ return UUID(bytes);
+ }
+
+ void Clear() { m_bytes.clear(); }
+
+ void Dump(Stream *s) const;
+
+ llvm::ArrayRef<uint8_t> GetBytes() const { return m_bytes; }
+
+ explicit operator bool() const { return IsValid(); }
+ bool IsValid() const { return !m_bytes.empty(); }
+
+ std::string GetAsString(llvm::StringRef separator = "-") const;
+
+ size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16);
+
+ // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set the
+ // UUID to invalid.
+ size_t SetFromOptionalStringRef(llvm::StringRef str,
+ uint32_t num_uuid_bytes = 16);
+
+ // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
+ // This is used for auto completion where a partial UUID might have been
+ // typed in. It
+ /// Decode as many UUID bytes (up to 16) as possible from the C
+ /// string \a cstr.
+ ///
+ /// \param[in] cstr
+ /// A NULL terminate C string that points at a UUID string value
+ /// (no leading spaces). The string must contain only hex
+ /// characters and optionally can contain the '-' sepearators.
+ ///
+ /// \param[in] uuid_bytes
+ /// A buffer of bytes that will contain a full or patially
+ /// decoded UUID.
+ ///
+ /// \return
+ /// The original string, with all decoded bytes removed.
+ static llvm::StringRef
+ DecodeUUIDBytesFromString(llvm::StringRef str,
+ llvm::SmallVectorImpl<uint8_t> &uuid_bytes,
+ uint32_t num_uuid_bytes = 16);
+
+private:
+ UUID(llvm::ArrayRef<uint8_t> bytes) : m_bytes(bytes.begin(), bytes.end()) {}
+
+ // GNU ld generates 20-byte build-ids. Size chosen to avoid heap allocations
+ // for this case.
+ llvm::SmallVector<uint8_t, 20> m_bytes;
+
+ friend bool operator==(const UUID &LHS, const UUID &RHS) {
+ return LHS.m_bytes == RHS.m_bytes;
+ }
+ friend bool operator!=(const UUID &LHS, const UUID &RHS) {
+ return !(LHS == RHS);
+ }
+ friend bool operator<(const UUID &LHS, const UUID &RHS) {
+ return LHS.m_bytes < RHS.m_bytes;
+ }
+ friend bool operator<=(const UUID &LHS, const UUID &RHS) {
+ return !(RHS < LHS);
+ }
+ friend bool operator>(const UUID &LHS, const UUID &RHS) { return RHS < LHS; }
+ friend bool operator>=(const UUID &LHS, const UUID &RHS) {
+ return !(LHS < RHS);
+ }
+};
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_UUID_H
diff --git a/linux-x64/clang/include/lldb/Utility/UriParser.h b/linux-x64/clang/include/lldb/Utility/UriParser.h
new file mode 100644
index 0000000..4a3f012
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/UriParser.h
@@ -0,0 +1,31 @@
+//===-- UriParser.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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/linux-x64/clang/include/lldb/Utility/UserID.h b/linux-x64/clang/include/lldb/Utility/UserID.h
new file mode 100644
index 0000000..2dc5cdb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/UserID.h
@@ -0,0 +1,93 @@
+//===-- UserID.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_UserID_h_
+#define liblldb_UserID_h_
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+class Stream;
+
+/// \class UserID UserID.h "lldb/Core/UserID.h"
+/// A mix in class that contains a generic user ID.
+///
+/// UserID is designed as a mix in class that can contain an integer based
+/// unique identifier for a variety of objects in lldb.
+///
+/// The value for this identifier is chosen by each parser plug-in. A value
+/// should be chosen that makes sense for each kind of object and should allow
+/// quick access to further and more in depth parsing.
+///
+/// Symbol table entries can use this to store the original symbol table
+/// index, functions can use it to store the symbol table index or the
+/// DWARF offset.
+struct UserID {
+ /// Construct with optional user ID.
+ UserID(lldb::user_id_t uid = LLDB_INVALID_UID) : m_uid(uid) {}
+
+ /// Destructor.
+ ~UserID() {}
+
+ /// Clears the object state.
+ ///
+ /// Clears the object contents back to a default invalid state.
+ void Clear() { m_uid = LLDB_INVALID_UID; }
+
+ /// Get accessor for the user ID.
+ ///
+ /// \return
+ /// The user ID.
+ lldb::user_id_t GetID() const { return m_uid; }
+
+ /// Set accessor for the user ID.
+ ///
+ /// \param[in] uid
+ /// The new user ID.
+ void SetID(lldb::user_id_t uid) { m_uid = uid; }
+
+ /// Unary predicate function object that can search for a matching user ID.
+ ///
+ /// Function object that can be used on any class that inherits from UserID:
+ /// \code
+ /// iterator pos;
+ /// pos = std::find_if (coll.begin(), coll.end(), UserID::IDMatches(blockID));
+ /// \endcode
+ class IDMatches {
+ public:
+ /// Construct with the user ID to look for.
+ IDMatches(lldb::user_id_t uid) : m_uid(uid) {}
+
+ /// Unary predicate function object callback.
+ bool operator()(const UserID &rhs) const { return m_uid == rhs.GetID(); }
+
+ private:
+ // Member variables.
+ const lldb::user_id_t m_uid; ///< The user ID we are looking for
+ };
+
+protected:
+ // Member variables.
+ lldb::user_id_t m_uid; ///< The user ID that uniquely identifies an object.
+};
+
+inline bool operator==(const UserID &lhs, const UserID &rhs) {
+ return lhs.GetID() == rhs.GetID();
+}
+
+inline bool operator!=(const UserID &lhs, const UserID &rhs) {
+ return lhs.GetID() != rhs.GetID();
+}
+
+/// Stream the UserID object to a Stream.
+Stream &operator<<(Stream &strm, const UserID &uid);
+
+} // namespace lldb_private
+
+#endif // liblldb_UserID_h_
diff --git a/linux-x64/clang/include/lldb/Utility/UserIDResolver.h b/linux-x64/clang/include/lldb/Utility/UserIDResolver.h
new file mode 100644
index 0000000..bca82a1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/UserIDResolver.h
@@ -0,0 +1,56 @@
+//===-- UserIDResolver.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_USERIDRESOLVER_H
+#define LLDB_UTILITY_USERIDRESOLVER_H
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include <mutex>
+
+namespace lldb_private {
+
+/// An abstract interface for things that know how to map numeric user/group IDs
+/// into names. It caches the resolved names to avoid repeating expensive
+/// queries. The cache is internally protected by a mutex, so concurrent queries
+/// are safe.
+class UserIDResolver {
+public:
+ typedef uint32_t id_t;
+ virtual ~UserIDResolver(); // anchor
+
+ llvm::Optional<llvm::StringRef> GetUserName(id_t uid) {
+ return Get(uid, m_uid_cache, &UserIDResolver::DoGetUserName);
+ }
+ llvm::Optional<llvm::StringRef> GetGroupName(id_t gid) {
+ return Get(gid, m_gid_cache, &UserIDResolver::DoGetGroupName);
+ }
+
+ /// Returns a resolver which returns a failure value for each query. Useful as
+ /// a fallback value for the case when we know all lookups will fail.
+ static UserIDResolver &GetNoopResolver();
+
+protected:
+ virtual llvm::Optional<std::string> DoGetUserName(id_t uid) = 0;
+ virtual llvm::Optional<std::string> DoGetGroupName(id_t gid) = 0;
+
+private:
+ using Map = llvm::DenseMap<id_t, llvm::Optional<std::string>>;
+
+ llvm::Optional<llvm::StringRef>
+ Get(id_t id, Map &cache,
+ llvm::Optional<std::string> (UserIDResolver::*do_get)(id_t));
+
+ std::mutex m_mutex;
+ Map m_uid_cache;
+ Map m_gid_cache;
+};
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_USERIDRESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Utility/VASPrintf.h b/linux-x64/clang/include/lldb/Utility/VASPrintf.h
new file mode 100644
index 0000000..582645f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/VASPrintf.h
@@ -0,0 +1,20 @@
+//===-- VASPrintf.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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/linux-x64/clang/include/lldb/Utility/VMRange.h b/linux-x64/clang/include/lldb/Utility/VMRange.h
new file mode 100644
index 0000000..9c2f9d0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/VMRange.h
@@ -0,0 +1,107 @@
+//===-- VMRange.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VMRange_h_
+#define liblldb_VMRange_h_
+
+#include "lldb/lldb-types.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <vector>
+
+namespace lldb_private {
+class Stream;
+}
+
+namespace lldb_private {
+
+// A vm address range. These can represent offsets ranges or actual
+// addresses.
+class VMRange {
+public:
+ typedef std::vector<VMRange> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ VMRange() : m_base_addr(0), m_byte_size(0) {}
+
+ VMRange(lldb::addr_t start_addr, lldb::addr_t end_addr)
+ : m_base_addr(start_addr),
+ m_byte_size(end_addr > start_addr ? end_addr - start_addr : 0) {}
+
+ ~VMRange() {}
+
+ void Clear() {
+ m_base_addr = 0;
+ m_byte_size = 0;
+ }
+
+ // Set the start and end values
+ void Reset(lldb::addr_t start_addr, lldb::addr_t end_addr) {
+ SetBaseAddress(start_addr);
+ SetEndAddress(end_addr);
+ }
+
+ // Set the start value for the range, and keep the same size
+ void SetBaseAddress(lldb::addr_t base_addr) { m_base_addr = base_addr; }
+
+ void SetEndAddress(lldb::addr_t end_addr) {
+ const lldb::addr_t base_addr = GetBaseAddress();
+ if (end_addr > base_addr)
+ m_byte_size = end_addr - base_addr;
+ else
+ m_byte_size = 0;
+ }
+
+ lldb::addr_t GetByteSize() const { return m_byte_size; }
+
+ void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
+
+ lldb::addr_t GetBaseAddress() const { return m_base_addr; }
+
+ lldb::addr_t GetEndAddress() const { return GetBaseAddress() + m_byte_size; }
+
+ bool IsValid() const { return m_byte_size > 0; }
+
+ bool Contains(lldb::addr_t addr) const {
+ return (GetBaseAddress() <= addr) && (addr < GetEndAddress());
+ }
+
+ bool Contains(const VMRange &range) const {
+ if (Contains(range.GetBaseAddress())) {
+ lldb::addr_t range_end = range.GetEndAddress();
+ return (GetBaseAddress() <= range_end) && (range_end <= GetEndAddress());
+ }
+ return false;
+ }
+
+ void Dump(Stream *s, lldb::addr_t base_addr = 0,
+ uint32_t addr_width = 8) const;
+
+ static bool ContainsValue(const VMRange::collection &coll,
+ lldb::addr_t value);
+
+ static bool ContainsRange(const VMRange::collection &coll,
+ const VMRange &range);
+
+protected:
+ lldb::addr_t m_base_addr;
+ lldb::addr_t m_byte_size;
+};
+
+bool operator==(const VMRange &lhs, const VMRange &rhs);
+bool operator!=(const VMRange &lhs, const VMRange &rhs);
+bool operator<(const VMRange &lhs, const VMRange &rhs);
+bool operator<=(const VMRange &lhs, const VMRange &rhs);
+bool operator>(const VMRange &lhs, const VMRange &rhs);
+bool operator>=(const VMRange &lhs, const VMRange &rhs);
+
+} // namespace lldb_private
+
+#endif // liblldb_VMRange_h_
diff --git a/linux-x64/clang/include/lldb/lldb-defines.h b/linux-x64/clang/include/lldb/lldb-defines.h
new file mode 100644
index 0000000..b879644
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-defines.h
@@ -0,0 +1,147 @@
+//===-- lldb-defines.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_defines_h_
+#define LLDB_lldb_defines_h_
+
+#include "lldb/lldb-types.h"
+
+#if defined(_WIN32)
+#if defined(EXPORT_LIBLLDB)
+#define LLDB_API __declspec(dllexport)
+#elif defined(IMPORT_LIBLLDB)
+#define LLDB_API __declspec(dllimport)
+#else
+#define LLDB_API
+#endif
+#else // defined (_WIN32)
+#define LLDB_API
+#endif
+
+#if !defined(INT32_MAX)
+#define INT32_MAX 2147483647
+#endif
+
+#if !defined(UINT32_MAX)
+#define UINT32_MAX 4294967295U
+#endif
+
+#if !defined(UINT64_MAX)
+#define UINT64_MAX 18446744073709551615ULL
+#endif
+
+// LLDB version
+//
+// A build script phase can modify this version number if needed.
+//#define LLDB_VERSION
+//#define LLDB_REVISION
+//#define LLDB_VERSION_STRING
+
+// LLDB defines
+#define LLDB_GENERIC_ERROR UINT32_MAX
+
+// Breakpoints
+#define LLDB_INVALID_BREAK_ID 0
+#define LLDB_DEFAULT_BREAK_SIZE 0
+#define LLDB_BREAK_ID_IS_VALID(bid) ((bid) != (LLDB_INVALID_BREAK_ID))
+#define LLDB_BREAK_ID_IS_INTERNAL(bid) ((bid) < 0)
+
+// Watchpoints
+#define LLDB_INVALID_WATCH_ID 0
+#define LLDB_WATCH_ID_IS_VALID(uid) ((uid) != (LLDB_INVALID_WATCH_ID))
+#define LLDB_WATCH_TYPE_READ (1u << 0)
+#define LLDB_WATCH_TYPE_WRITE (1u << 1)
+#define LLDB_WATCH_TYPE_IS_VALID(type) \
+ ((type | LLDB_WATCH_TYPE_READ) || (type | LLDB_WATCH_TYPE_WRITE))
+
+// Generic Register Numbers
+#define LLDB_REGNUM_GENERIC_PC 0 // Program Counter
+#define LLDB_REGNUM_GENERIC_SP 1 // Stack Pointer
+#define LLDB_REGNUM_GENERIC_FP 2 // Frame Pointer
+#define LLDB_REGNUM_GENERIC_RA 3 // Return Address
+#define LLDB_REGNUM_GENERIC_FLAGS 4 // Processor flags register
+#define LLDB_REGNUM_GENERIC_ARG1 \
+ 5 // The register that would contain pointer size or less argument 1 (if any)
+#define LLDB_REGNUM_GENERIC_ARG2 \
+ 6 // The register that would contain pointer size or less argument 2 (if any)
+#define LLDB_REGNUM_GENERIC_ARG3 \
+ 7 // The register that would contain pointer size or less argument 3 (if any)
+#define LLDB_REGNUM_GENERIC_ARG4 \
+ 8 // The register that would contain pointer size or less argument 4 (if any)
+#define LLDB_REGNUM_GENERIC_ARG5 \
+ 9 // The register that would contain pointer size or less argument 5 (if any)
+#define LLDB_REGNUM_GENERIC_ARG6 \
+ 10 // The register that would contain pointer size or less argument 6 (if any)
+#define LLDB_REGNUM_GENERIC_ARG7 \
+ 11 // The register that would contain pointer size or less argument 7 (if any)
+#define LLDB_REGNUM_GENERIC_ARG8 \
+ 12 // The register that would contain pointer size or less argument 8 (if any)
+/// Invalid value definitions
+#define LLDB_INVALID_ADDRESS UINT64_MAX
+#define LLDB_INVALID_INDEX32 UINT32_MAX
+#define LLDB_INVALID_IVAR_OFFSET UINT32_MAX
+#define LLDB_INVALID_IMAGE_TOKEN UINT32_MAX
+#define LLDB_INVALID_MODULE_VERSION UINT32_MAX
+#define LLDB_INVALID_REGNUM UINT32_MAX
+#define LLDB_INVALID_UID UINT64_MAX
+#define LLDB_INVALID_PROCESS_ID 0
+#define LLDB_INVALID_THREAD_ID 0
+#define LLDB_INVALID_FRAME_ID UINT32_MAX
+#define LLDB_INVALID_SIGNAL_NUMBER INT32_MAX
+#define LLDB_INVALID_OFFSET UINT64_MAX // Must match max of lldb::offset_t
+#define LLDB_INVALID_LINE_NUMBER UINT32_MAX
+#define LLDB_INVALID_QUEUE_ID 0
+
+/// CPU Type definitions
+#define LLDB_ARCH_DEFAULT "systemArch"
+#define LLDB_ARCH_DEFAULT_32BIT "systemArch32"
+#define LLDB_ARCH_DEFAULT_64BIT "systemArch64"
+#define LLDB_INVALID_CPUTYPE (0xFFFFFFFEu)
+
+/// Option Set definitions
+// FIXME: I'm sure there's some #define magic that can create all 32 sets on the
+// fly. That would have the added benefit of making this unreadable.
+#define LLDB_MAX_NUM_OPTION_SETS 32
+#define LLDB_OPT_SET_ALL 0xFFFFFFFFU
+#define LLDB_OPT_SET_1 (1U << 0)
+#define LLDB_OPT_SET_2 (1U << 1)
+#define LLDB_OPT_SET_3 (1U << 2)
+#define LLDB_OPT_SET_4 (1U << 3)
+#define LLDB_OPT_SET_5 (1U << 4)
+#define LLDB_OPT_SET_6 (1U << 5)
+#define LLDB_OPT_SET_7 (1U << 6)
+#define LLDB_OPT_SET_8 (1U << 7)
+#define LLDB_OPT_SET_9 (1U << 8)
+#define LLDB_OPT_SET_10 (1U << 9)
+#define LLDB_OPT_SET_11 (1U << 10)
+#define LLDB_OPT_SET_FROM_TO(A, B) \
+ (((1U << (B)) - 1) ^ (((1U << (A)) - 1) >> 1))
+
+#if defined(_WIN32) && !defined(MAX_PATH)
+#define MAX_PATH 260
+#endif
+
+// ignore GCC function attributes
+#if defined(_MSC_VER) && !defined(__clang__)
+#define __attribute__(X)
+#endif
+
+#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
+
+#if defined(__cplusplus)
+
+/// \def DISALLOW_COPY_AND_ASSIGN(TypeName)
+/// Macro definition for easily disallowing copy constructor and
+/// assignment operators in C++ classes.
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName &) = delete; \
+ const TypeName &operator=(const TypeName &) = delete
+
+#endif // #if defined(__cplusplus)
+
+#endif // LLDB_lldb_defines_h_
diff --git a/linux-x64/clang/include/lldb/lldb-enumerations.h b/linux-x64/clang/include/lldb/lldb-enumerations.h
new file mode 100644
index 0000000..f9830c0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-enumerations.h
@@ -0,0 +1,1061 @@
+//===-- lldb-enumerations.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_enumerations_h_
+#define LLDB_lldb_enumerations_h_
+
+#include <type_traits>
+
+#ifndef SWIG
+// Macro to enable bitmask operations on an enum. Without this, Enum | Enum
+// gets promoted to an int, so you have to say Enum a = Enum(eFoo | eBar). If
+// you mark Enum with LLDB_MARK_AS_BITMASK_ENUM(Enum), however, you can simply
+// write Enum a = eFoo | eBar.
+// Unfortunately, swig<3.0 doesn't recognise the constexpr keyword, so remove
+// this entire block, as it is not necessary for swig processing.
+#define LLDB_MARK_AS_BITMASK_ENUM(Enum) \
+ constexpr Enum operator|(Enum a, Enum b) { \
+ return static_cast<Enum>( \
+ static_cast<std::underlying_type<Enum>::type>(a) | \
+ static_cast<std::underlying_type<Enum>::type>(b)); \
+ } \
+ constexpr Enum operator&(Enum a, Enum b) { \
+ return static_cast<Enum>( \
+ static_cast<std::underlying_type<Enum>::type>(a) & \
+ static_cast<std::underlying_type<Enum>::type>(b)); \
+ } \
+ constexpr Enum operator~(Enum a) { \
+ return static_cast<Enum>( \
+ ~static_cast<std::underlying_type<Enum>::type>(a)); \
+ } \
+ inline Enum &operator|=(Enum &a, Enum b) { \
+ a = a | b; \
+ return a; \
+ } \
+ inline Enum &operator&=(Enum &a, Enum b) { \
+ a = a & b; \
+ return a; \
+ }
+#else
+#define LLDB_MARK_AS_BITMASK_ENUM(Enum)
+#endif
+
+#ifndef SWIG
+// With MSVC, the default type of an enum is always signed, even if one of the
+// enumerator values is too large to fit into a signed integer but would
+// otherwise fit into an unsigned integer. As a result of this, all of LLDB's
+// flag-style enumerations that specify something like eValueFoo = 1u << 31
+// result in negative values. This usually just results in a benign warning,
+// but in a few places we actually do comparisons on the enum values, which
+// would cause a real bug. Furthermore, there's no way to silence only this
+// warning, as it's part of -Wmicrosoft which also catches a whole slew of
+// other useful issues.
+//
+// To make matters worse, early versions of SWIG don't recognize the syntax of
+// specifying the underlying type of an enum (and Python doesn't care anyway)
+// so we need a way to specify the underlying type when the enum is being used
+// from C++ code, but just use a regular enum when swig is pre-processing.
+#define FLAGS_ENUM(Name) enum Name : unsigned
+#define FLAGS_ANONYMOUS_ENUM() enum : unsigned
+#else
+#define FLAGS_ENUM(Name) enum Name
+#define FLAGS_ANONYMOUS_ENUM() enum
+#endif
+
+namespace lldb {
+
+// Process and Thread States
+enum StateType {
+ eStateInvalid = 0,
+ eStateUnloaded, ///< Process is object is valid, but not currently loaded
+ eStateConnected, ///< Process is connected to remote debug services, but not
+ ///launched or attached to anything yet
+ eStateAttaching, ///< Process is currently trying to attach
+ eStateLaunching, ///< Process is in the process of launching
+ // The state changes eStateAttaching and eStateLaunching are both sent while the
+ // private state thread is either not yet started or paused. For that reason, they
+ // should only be signaled as public state changes, and not private state changes.
+ eStateStopped, ///< Process or thread is stopped and can be examined.
+ eStateRunning, ///< Process or thread is running and can't be examined.
+ eStateStepping, ///< Process or thread is in the process of stepping and can
+ ///not be examined.
+ eStateCrashed, ///< Process or thread has crashed and can be examined.
+ eStateDetached, ///< Process has been detached and can't be examined.
+ eStateExited, ///< Process has exited and can't be examined.
+ eStateSuspended, ///< Process or thread is in a suspended state as far
+ ///< as the debugger is concerned while other processes
+ ///< or threads get the chance to run.
+ kLastStateType = eStateSuspended
+};
+
+// Launch Flags
+FLAGS_ENUM(LaunchFlags){
+ eLaunchFlagNone = 0u,
+ eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling
+ ///process into a new process
+ eLaunchFlagDebug = (1u << 1), ///< Stop as soon as the process launches to
+ ///allow the process to be debugged
+ eLaunchFlagStopAtEntry = (1u << 2), ///< Stop at the program entry point
+ ///instead of auto-continuing when
+ ///launching or attaching at entry point
+ eLaunchFlagDisableASLR =
+ (1u << 3), ///< Disable Address Space Layout Randomization
+ eLaunchFlagDisableSTDIO =
+ (1u << 4), ///< Disable stdio for inferior process (e.g. for a GUI app)
+ eLaunchFlagLaunchInTTY =
+ (1u << 5), ///< Launch the process in a new TTY if supported by the host
+ eLaunchFlagLaunchInShell =
+ (1u << 6), ///< Launch the process inside a shell to get shell expansion
+ eLaunchFlagLaunchInSeparateProcessGroup =
+ (1u << 7), ///< Launch the process in a separate process group
+ eLaunchFlagDontSetExitStatus = (1u << 8), ///< If you are going to hand the
+ ///process off (e.g. to
+ ///debugserver)
+ ///< set this flag so lldb & the handee don't race to set its exit status.
+ eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub
+ ///should detach rather than killing
+ ///the debugee
+ ///< if it loses connection with lldb.
+ eLaunchFlagShellExpandArguments =
+ (1u << 10), ///< Perform shell-style argument expansion
+ eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit
+};
+
+// Thread Run Modes
+enum RunMode { eOnlyThisThread, eAllThreads, eOnlyDuringStepping };
+
+// Byte ordering definitions
+enum ByteOrder {
+ eByteOrderInvalid = 0,
+ eByteOrderBig = 1,
+ eByteOrderPDP = 2,
+ eByteOrderLittle = 4
+};
+
+// Register encoding definitions
+enum Encoding {
+ eEncodingInvalid = 0,
+ eEncodingUint, // unsigned integer
+ eEncodingSint, // signed integer
+ eEncodingIEEE754, // float
+ eEncodingVector // vector registers
+};
+
+// Display format definitions
+enum Format {
+ eFormatDefault = 0,
+ eFormatInvalid = 0,
+ eFormatBoolean,
+ eFormatBinary,
+ eFormatBytes,
+ eFormatBytesWithASCII,
+ eFormatChar,
+ eFormatCharPrintable, // Only printable characters, space if not printable
+ eFormatComplex, // Floating point complex type
+ eFormatComplexFloat = eFormatComplex,
+ eFormatCString, // NULL terminated C strings
+ eFormatDecimal,
+ eFormatEnum,
+ eFormatHex,
+ eFormatHexUppercase,
+ eFormatFloat,
+ eFormatOctal,
+ eFormatOSType, // OS character codes encoded into an integer 'PICT' 'text'
+ // etc...
+ eFormatUnicode16,
+ eFormatUnicode32,
+ eFormatUnsigned,
+ eFormatPointer,
+ eFormatVectorOfChar,
+ eFormatVectorOfSInt8,
+ eFormatVectorOfUInt8,
+ eFormatVectorOfSInt16,
+ eFormatVectorOfUInt16,
+ eFormatVectorOfSInt32,
+ eFormatVectorOfUInt32,
+ eFormatVectorOfSInt64,
+ eFormatVectorOfUInt64,
+ eFormatVectorOfFloat16,
+ eFormatVectorOfFloat32,
+ eFormatVectorOfFloat64,
+ eFormatVectorOfUInt128,
+ eFormatComplexInteger, // Integer complex type
+ eFormatCharArray, // Print characters with no single quotes, used for
+ // character arrays that can contain non printable
+ // characters
+ eFormatAddressInfo, // Describe what an address points to (func + offset with
+ // file/line, symbol + offset, data, etc)
+ eFormatHexFloat, // ISO C99 hex float string
+ eFormatInstruction, // Disassemble an opcode
+ eFormatVoid, // Do not print this
+ kNumFormats
+};
+
+// Description levels for "void GetDescription(Stream *, DescriptionLevel)"
+// calls
+enum DescriptionLevel {
+ eDescriptionLevelBrief = 0,
+ eDescriptionLevelFull,
+ eDescriptionLevelVerbose,
+ eDescriptionLevelInitial,
+ kNumDescriptionLevels
+};
+
+// Script interpreter types
+enum ScriptLanguage {
+ eScriptLanguageNone,
+ eScriptLanguagePython,
+ eScriptLanguageDefault = eScriptLanguagePython,
+ eScriptLanguageUnknown
+};
+
+// Register numbering types
+// See RegisterContext::ConvertRegisterKindToRegisterNumber to convert any of
+// these to the lldb internal register numbering scheme (eRegisterKindLLDB).
+enum RegisterKind {
+ eRegisterKindEHFrame = 0, // the register numbers seen in eh_frame
+ eRegisterKindDWARF, // the register numbers seen DWARF
+ eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any
+ // particular target
+ eRegisterKindProcessPlugin, // num used by the process plugin - e.g. by the
+ // remote gdb-protocol stub program
+ eRegisterKindLLDB, // lldb's internal register numbers
+ kNumRegisterKinds
+};
+
+// Thread stop reasons
+enum StopReason {
+ eStopReasonInvalid = 0,
+ eStopReasonNone,
+ eStopReasonTrace,
+ eStopReasonBreakpoint,
+ eStopReasonWatchpoint,
+ eStopReasonSignal,
+ eStopReasonException,
+ eStopReasonExec, // Program was re-exec'ed
+ eStopReasonPlanComplete,
+ eStopReasonThreadExiting,
+ eStopReasonInstrumentation
+};
+
+// Command Return Status Types
+enum ReturnStatus {
+ eReturnStatusInvalid,
+ eReturnStatusSuccessFinishNoResult,
+ eReturnStatusSuccessFinishResult,
+ eReturnStatusSuccessContinuingNoResult,
+ eReturnStatusSuccessContinuingResult,
+ eReturnStatusStarted,
+ eReturnStatusFailed,
+ eReturnStatusQuit
+};
+
+// The results of expression evaluation:
+enum ExpressionResults {
+ eExpressionCompleted = 0,
+ eExpressionSetupError,
+ eExpressionParseError,
+ eExpressionDiscarded,
+ eExpressionInterrupted,
+ eExpressionHitBreakpoint,
+ eExpressionTimedOut,
+ eExpressionResultUnavailable,
+ eExpressionStoppedForDebug
+};
+
+enum SearchDepth {
+ eSearchDepthInvalid = 0,
+ eSearchDepthTarget,
+ eSearchDepthModule,
+ eSearchDepthCompUnit,
+ eSearchDepthFunction,
+ eSearchDepthBlock,
+ eSearchDepthAddress,
+ kLastSearchDepthKind = eSearchDepthAddress
+};
+
+// Connection Status Types
+enum ConnectionStatus {
+ eConnectionStatusSuccess, // Success
+ eConnectionStatusEndOfFile, // End-of-file encountered
+ eConnectionStatusError, // Check GetError() for details
+ eConnectionStatusTimedOut, // Request timed out
+ eConnectionStatusNoConnection, // No connection
+ eConnectionStatusLostConnection, // Lost connection while connected to a valid
+ // connection
+ eConnectionStatusInterrupted // Interrupted read
+};
+
+enum ErrorType {
+ eErrorTypeInvalid,
+ eErrorTypeGeneric, ///< Generic errors that can be any value.
+ eErrorTypeMachKernel, ///< Mach kernel error codes.
+ eErrorTypePOSIX, ///< POSIX error codes.
+ eErrorTypeExpression, ///< These are from the ExpressionResults enum.
+ eErrorTypeWin32 ///< Standard Win32 error codes.
+};
+
+enum ValueType {
+ eValueTypeInvalid = 0,
+ eValueTypeVariableGlobal = 1, // globals variable
+ eValueTypeVariableStatic = 2, // static variable
+ eValueTypeVariableArgument = 3, // function argument variables
+ eValueTypeVariableLocal = 4, // function local variables
+ eValueTypeRegister = 5, // stack frame register value
+ eValueTypeRegisterSet = 6, // A collection of stack frame register values
+ eValueTypeConstResult = 7, // constant result variables
+ eValueTypeVariableThreadLocal = 8 // thread local storage variable
+};
+
+// Token size/granularities for Input Readers
+
+enum InputReaderGranularity {
+ eInputReaderGranularityInvalid = 0,
+ eInputReaderGranularityByte,
+ eInputReaderGranularityWord,
+ eInputReaderGranularityLine,
+ eInputReaderGranularityAll
+};
+
+/// These mask bits allow a common interface for queries that can
+/// limit the amount of information that gets parsed to only the
+/// information that is requested. These bits also can indicate what
+/// actually did get resolved during query function calls.
+///
+/// Each definition corresponds to a one of the member variables
+/// in this class, and requests that that item be resolved, or
+/// indicates that the member did get resolved.
+FLAGS_ENUM(SymbolContextItem){
+ eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from
+ /// a query, or was located in query
+ /// results
+ eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from
+ /// a query, or was located in query
+ /// results
+ eSymbolContextCompUnit = (1u << 2), ///< Set when \a comp_unit is requested
+ /// from a query, or was located in
+ /// query results
+ eSymbolContextFunction = (1u << 3), ///< Set when \a function is requested
+ /// from a query, or was located in
+ /// query results
+ eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is
+ /// requested from a query, or was located
+ /// in query results
+ eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is
+ /// requested from a query, or was
+ /// located in query results
+ eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from
+ /// a query, or was located in query
+ /// results
+ eSymbolContextEverything = ((eSymbolContextSymbol << 1) -
+ 1u), ///< Indicates to try and lookup everything
+ /// up during a routine symbol context
+ /// query.
+ eSymbolContextVariable = (1u << 7), ///< Set when \a global or static
+ /// variable is requested from a query,
+ /// or was located in query results.
+ ///< eSymbolContextVariable is potentially expensive to lookup so it isn't
+ /// included in
+ ///< eSymbolContextEverything which stops it from being used during frame PC
+ /// lookups and
+ ///< many other potential address to symbol context lookups.
+};
+LLDB_MARK_AS_BITMASK_ENUM(SymbolContextItem)
+
+FLAGS_ENUM(Permissions){ePermissionsWritable = (1u << 0),
+ ePermissionsReadable = (1u << 1),
+ ePermissionsExecutable = (1u << 2)};
+LLDB_MARK_AS_BITMASK_ENUM(Permissions)
+
+enum InputReaderAction {
+ eInputReaderActivate, // reader is newly pushed onto the reader stack
+ eInputReaderAsynchronousOutputWritten, // an async output event occurred; the
+ // reader may want to do something
+ eInputReaderReactivate, // reader is on top of the stack again after another
+ // reader was popped off
+ eInputReaderDeactivate, // another reader was pushed on the stack
+ eInputReaderGotToken, // reader got one of its tokens (granularity)
+ eInputReaderInterrupt, // reader received an interrupt signal (probably from a
+ // control-c)
+ eInputReaderEndOfFile, // reader received an EOF char (probably from a
+ // control-d)
+ eInputReaderDone // reader was just popped off the stack and is done
+};
+
+FLAGS_ENUM(BreakpointEventType){
+ eBreakpointEventTypeInvalidType = (1u << 0),
+ eBreakpointEventTypeAdded = (1u << 1),
+ eBreakpointEventTypeRemoved = (1u << 2),
+ eBreakpointEventTypeLocationsAdded = (1u << 3), // Locations added doesn't
+ // get sent when the
+ // breakpoint is created
+ eBreakpointEventTypeLocationsRemoved = (1u << 4),
+ eBreakpointEventTypeLocationsResolved = (1u << 5),
+ eBreakpointEventTypeEnabled = (1u << 6),
+ eBreakpointEventTypeDisabled = (1u << 7),
+ eBreakpointEventTypeCommandChanged = (1u << 8),
+ eBreakpointEventTypeConditionChanged = (1u << 9),
+ eBreakpointEventTypeIgnoreChanged = (1u << 10),
+ eBreakpointEventTypeThreadChanged = (1u << 11),
+ eBreakpointEventTypeAutoContinueChanged = (1u << 12)};
+
+FLAGS_ENUM(WatchpointEventType){
+ eWatchpointEventTypeInvalidType = (1u << 0),
+ eWatchpointEventTypeAdded = (1u << 1),
+ eWatchpointEventTypeRemoved = (1u << 2),
+ eWatchpointEventTypeEnabled = (1u << 6),
+ eWatchpointEventTypeDisabled = (1u << 7),
+ eWatchpointEventTypeCommandChanged = (1u << 8),
+ eWatchpointEventTypeConditionChanged = (1u << 9),
+ eWatchpointEventTypeIgnoreChanged = (1u << 10),
+ eWatchpointEventTypeThreadChanged = (1u << 11),
+ eWatchpointEventTypeTypeChanged = (1u << 12)};
+
+/// Programming language type.
+///
+/// These enumerations use the same language enumerations as the DWARF
+/// specification for ease of use and consistency.
+/// The enum -> string code is in Language.cpp, don't change this
+/// table without updating that code as well.
+enum LanguageType {
+ eLanguageTypeUnknown = 0x0000, ///< Unknown or invalid language value.
+ eLanguageTypeC89 = 0x0001, ///< ISO C:1989.
+ eLanguageTypeC = 0x0002, ///< Non-standardized C, such as K&R.
+ eLanguageTypeAda83 = 0x0003, ///< ISO Ada:1983.
+ eLanguageTypeC_plus_plus = 0x0004, ///< ISO C++:1998.
+ eLanguageTypeCobol74 = 0x0005, ///< ISO Cobol:1974.
+ eLanguageTypeCobol85 = 0x0006, ///< ISO Cobol:1985.
+ eLanguageTypeFortran77 = 0x0007, ///< ISO Fortran 77.
+ eLanguageTypeFortran90 = 0x0008, ///< ISO Fortran 90.
+ eLanguageTypePascal83 = 0x0009, ///< ISO Pascal:1983.
+ eLanguageTypeModula2 = 0x000a, ///< ISO Modula-2:1996.
+ eLanguageTypeJava = 0x000b, ///< Java.
+ eLanguageTypeC99 = 0x000c, ///< ISO C:1999.
+ eLanguageTypeAda95 = 0x000d, ///< ISO Ada:1995.
+ eLanguageTypeFortran95 = 0x000e, ///< ISO Fortran 95.
+ eLanguageTypePLI = 0x000f, ///< ANSI PL/I:1976.
+ eLanguageTypeObjC = 0x0010, ///< Objective-C.
+ eLanguageTypeObjC_plus_plus = 0x0011, ///< Objective-C++.
+ eLanguageTypeUPC = 0x0012, ///< Unified Parallel C.
+ eLanguageTypeD = 0x0013, ///< D.
+ eLanguageTypePython = 0x0014, ///< Python.
+ // NOTE: The below are DWARF5 constants, subject to change upon
+ // completion of the DWARF5 specification
+ eLanguageTypeOpenCL = 0x0015, ///< OpenCL.
+ eLanguageTypeGo = 0x0016, ///< Go.
+ eLanguageTypeModula3 = 0x0017, ///< Modula 3.
+ eLanguageTypeHaskell = 0x0018, ///< Haskell.
+ eLanguageTypeC_plus_plus_03 = 0x0019, ///< ISO C++:2003.
+ eLanguageTypeC_plus_plus_11 = 0x001a, ///< ISO C++:2011.
+ eLanguageTypeOCaml = 0x001b, ///< OCaml.
+ eLanguageTypeRust = 0x001c, ///< Rust.
+ eLanguageTypeC11 = 0x001d, ///< ISO C:2011.
+ eLanguageTypeSwift = 0x001e, ///< Swift.
+ eLanguageTypeJulia = 0x001f, ///< Julia.
+ eLanguageTypeDylan = 0x0020, ///< Dylan.
+ eLanguageTypeC_plus_plus_14 = 0x0021, ///< ISO C++:2014.
+ eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
+ eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
+ // Vendor Extensions
+ // Note: Language::GetNameForLanguageType
+ // assumes these can be used as indexes into array language_names, and
+ // Language::SetLanguageFromCString and Language::AsCString assume these can
+ // be used as indexes into array g_languages.
+ eLanguageTypeMipsAssembler = 0x0024, ///< Mips_Assembler.
+ eLanguageTypeExtRenderScript = 0x0025, ///< RenderScript.
+ eNumLanguageTypes
+};
+
+enum InstrumentationRuntimeType {
+ eInstrumentationRuntimeTypeAddressSanitizer = 0x0000,
+ eInstrumentationRuntimeTypeThreadSanitizer = 0x0001,
+ eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer = 0x0002,
+ eInstrumentationRuntimeTypeMainThreadChecker = 0x0003,
+ eInstrumentationRuntimeTypeSwiftRuntimeReporting = 0x0004,
+ eNumInstrumentationRuntimeTypes
+};
+
+enum DynamicValueType {
+ eNoDynamicValues = 0,
+ eDynamicCanRunTarget = 1,
+ eDynamicDontRunTarget = 2
+};
+
+enum StopShowColumn {
+ eStopShowColumnAnsiOrCaret = 0,
+ eStopShowColumnAnsi = 1,
+ eStopShowColumnCaret = 2,
+ eStopShowColumnNone = 3
+};
+
+enum AccessType {
+ eAccessNone,
+ eAccessPublic,
+ eAccessPrivate,
+ eAccessProtected,
+ eAccessPackage
+};
+
+enum CommandArgumentType {
+ eArgTypeAddress = 0,
+ eArgTypeAddressOrExpression,
+ eArgTypeAliasName,
+ eArgTypeAliasOptions,
+ eArgTypeArchitecture,
+ eArgTypeBoolean,
+ eArgTypeBreakpointID,
+ eArgTypeBreakpointIDRange,
+ eArgTypeBreakpointName,
+ eArgTypeByteSize,
+ eArgTypeClassName,
+ eArgTypeCommandName,
+ eArgTypeCount,
+ eArgTypeDescriptionVerbosity,
+ eArgTypeDirectoryName,
+ eArgTypeDisassemblyFlavor,
+ eArgTypeEndAddress,
+ eArgTypeExpression,
+ eArgTypeExpressionPath,
+ eArgTypeExprFormat,
+ eArgTypeFilename,
+ eArgTypeFormat,
+ eArgTypeFrameIndex,
+ eArgTypeFullName,
+ eArgTypeFunctionName,
+ eArgTypeFunctionOrSymbol,
+ eArgTypeGDBFormat,
+ eArgTypeHelpText,
+ eArgTypeIndex,
+ eArgTypeLanguage,
+ eArgTypeLineNum,
+ eArgTypeLogCategory,
+ eArgTypeLogChannel,
+ eArgTypeMethod,
+ eArgTypeName,
+ eArgTypeNewPathPrefix,
+ eArgTypeNumLines,
+ eArgTypeNumberPerLine,
+ eArgTypeOffset,
+ eArgTypeOldPathPrefix,
+ eArgTypeOneLiner,
+ eArgTypePath,
+ eArgTypePermissionsNumber,
+ eArgTypePermissionsString,
+ eArgTypePid,
+ eArgTypePlugin,
+ eArgTypeProcessName,
+ eArgTypePythonClass,
+ eArgTypePythonFunction,
+ eArgTypePythonScript,
+ eArgTypeQueueName,
+ eArgTypeRegisterName,
+ eArgTypeRegularExpression,
+ eArgTypeRunArgs,
+ eArgTypeRunMode,
+ eArgTypeScriptedCommandSynchronicity,
+ eArgTypeScriptLang,
+ eArgTypeSearchWord,
+ eArgTypeSelector,
+ eArgTypeSettingIndex,
+ eArgTypeSettingKey,
+ eArgTypeSettingPrefix,
+ eArgTypeSettingVariableName,
+ eArgTypeShlibName,
+ eArgTypeSourceFile,
+ eArgTypeSortOrder,
+ eArgTypeStartAddress,
+ eArgTypeSummaryString,
+ eArgTypeSymbol,
+ eArgTypeThreadID,
+ eArgTypeThreadIndex,
+ eArgTypeThreadName,
+ eArgTypeTypeName,
+ eArgTypeUnsignedInteger,
+ eArgTypeUnixSignal,
+ eArgTypeVarName,
+ eArgTypeValue,
+ eArgTypeWidth,
+ eArgTypeNone,
+ eArgTypePlatform,
+ eArgTypeWatchpointID,
+ eArgTypeWatchpointIDRange,
+ eArgTypeWatchType,
+ eArgRawInput,
+ eArgTypeCommand,
+ eArgTypeLastArg // Always keep this entry as the last entry in this
+ // enumeration!!
+};
+
+// Symbol types
+// Symbol holds the SymbolType in a 6-bit field (m_type), so if you get over 63
+// entries you will have to resize that field.
+enum SymbolType {
+ eSymbolTypeAny = 0,
+ eSymbolTypeInvalid = 0,
+ eSymbolTypeAbsolute,
+ eSymbolTypeCode,
+ eSymbolTypeResolver,
+ eSymbolTypeData,
+ eSymbolTypeTrampoline,
+ eSymbolTypeRuntime,
+ eSymbolTypeException,
+ eSymbolTypeSourceFile,
+ eSymbolTypeHeaderFile,
+ eSymbolTypeObjectFile,
+ eSymbolTypeCommonBlock,
+ eSymbolTypeBlock,
+ eSymbolTypeLocal,
+ eSymbolTypeParam,
+ eSymbolTypeVariable,
+ eSymbolTypeVariableType,
+ eSymbolTypeLineEntry,
+ eSymbolTypeLineHeader,
+ eSymbolTypeScopeBegin,
+ eSymbolTypeScopeEnd,
+ eSymbolTypeAdditional, // When symbols take more than one entry, the extra
+ // entries get this type
+ eSymbolTypeCompiler,
+ eSymbolTypeInstrumentation,
+ eSymbolTypeUndefined,
+ eSymbolTypeObjCClass,
+ eSymbolTypeObjCMetaClass,
+ eSymbolTypeObjCIVar,
+ eSymbolTypeReExported
+};
+
+enum SectionType {
+ eSectionTypeInvalid,
+ eSectionTypeCode,
+ eSectionTypeContainer, // The section contains child sections
+ eSectionTypeData,
+ eSectionTypeDataCString, // Inlined C string data
+ eSectionTypeDataCStringPointers, // Pointers to C string data
+ eSectionTypeDataSymbolAddress, // Address of a symbol in the symbol table
+ eSectionTypeData4,
+ eSectionTypeData8,
+ eSectionTypeData16,
+ eSectionTypeDataPointers,
+ eSectionTypeDebug,
+ eSectionTypeZeroFill,
+ eSectionTypeDataObjCMessageRefs, // Pointer to function pointer + selector
+ eSectionTypeDataObjCCFStrings, // Objective-C const CFString/NSString objects
+ eSectionTypeDWARFDebugAbbrev,
+ eSectionTypeDWARFDebugAddr,
+ eSectionTypeDWARFDebugAranges,
+ eSectionTypeDWARFDebugCuIndex,
+ eSectionTypeDWARFDebugFrame,
+ eSectionTypeDWARFDebugInfo,
+ eSectionTypeDWARFDebugLine,
+ eSectionTypeDWARFDebugLoc,
+ eSectionTypeDWARFDebugMacInfo,
+ eSectionTypeDWARFDebugMacro,
+ eSectionTypeDWARFDebugPubNames,
+ eSectionTypeDWARFDebugPubTypes,
+ eSectionTypeDWARFDebugRanges,
+ eSectionTypeDWARFDebugStr,
+ eSectionTypeDWARFDebugStrOffsets,
+ eSectionTypeDWARFAppleNames,
+ eSectionTypeDWARFAppleTypes,
+ eSectionTypeDWARFAppleNamespaces,
+ eSectionTypeDWARFAppleObjC,
+ eSectionTypeELFSymbolTable, // Elf SHT_SYMTAB section
+ eSectionTypeELFDynamicSymbols, // Elf SHT_DYNSYM section
+ eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section
+ eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section
+ eSectionTypeEHFrame,
+ eSectionTypeARMexidx,
+ eSectionTypeARMextab,
+ eSectionTypeCompactUnwind, // compact unwind section in Mach-O,
+ // __TEXT,__unwind_info
+ eSectionTypeGoSymtab,
+ eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
+ // address
+ eSectionTypeDWARFGNUDebugAltLink,
+ eSectionTypeDWARFDebugTypes, // DWARF .debug_types section
+ eSectionTypeDWARFDebugNames, // DWARF v5 .debug_names
+ eSectionTypeOther,
+ eSectionTypeDWARFDebugLineStr, // DWARF v5 .debug_line_str
+ eSectionTypeDWARFDebugRngLists, // DWARF v5 .debug_rnglists
+ eSectionTypeDWARFDebugLocLists, // DWARF v5 .debug_loclists
+ eSectionTypeDWARFDebugAbbrevDwo,
+ eSectionTypeDWARFDebugInfoDwo,
+ eSectionTypeDWARFDebugStrDwo,
+ eSectionTypeDWARFDebugStrOffsetsDwo,
+ eSectionTypeDWARFDebugTypesDwo,
+};
+
+FLAGS_ENUM(EmulateInstructionOptions){
+ eEmulateInstructionOptionNone = (0u),
+ eEmulateInstructionOptionAutoAdvancePC = (1u << 0),
+ eEmulateInstructionOptionIgnoreConditions = (1u << 1)};
+
+FLAGS_ENUM(FunctionNameType){
+ eFunctionNameTypeNone = 0u,
+ eFunctionNameTypeAuto =
+ (1u << 1), // Automatically figure out which FunctionNameType
+ // bits to set based on the function name.
+ eFunctionNameTypeFull = (1u << 2), // The function name.
+ // For C this is the same as just the name of the function For C++ this is
+ // the mangled or demangled version of the mangled name. For ObjC this is
+ // the full function signature with the + or - and the square brackets and
+ // the class and selector
+ eFunctionNameTypeBase = (1u << 3), // The function name only, no namespaces
+ // or arguments and no class
+ // methods or selectors will be searched.
+ eFunctionNameTypeMethod = (1u << 4), // Find function by method name (C++)
+ // with no namespace or arguments
+ eFunctionNameTypeSelector =
+ (1u << 5), // Find function by selector name (ObjC) names
+ eFunctionNameTypeAny =
+ eFunctionNameTypeAuto // DEPRECATED: use eFunctionNameTypeAuto
+};
+LLDB_MARK_AS_BITMASK_ENUM(FunctionNameType)
+
+// Basic types enumeration for the public API SBType::GetBasicType()
+enum BasicType {
+ eBasicTypeInvalid = 0,
+ eBasicTypeVoid = 1,
+ eBasicTypeChar,
+ eBasicTypeSignedChar,
+ eBasicTypeUnsignedChar,
+ eBasicTypeWChar,
+ eBasicTypeSignedWChar,
+ eBasicTypeUnsignedWChar,
+ eBasicTypeChar16,
+ eBasicTypeChar32,
+ eBasicTypeShort,
+ eBasicTypeUnsignedShort,
+ eBasicTypeInt,
+ eBasicTypeUnsignedInt,
+ eBasicTypeLong,
+ eBasicTypeUnsignedLong,
+ eBasicTypeLongLong,
+ eBasicTypeUnsignedLongLong,
+ eBasicTypeInt128,
+ eBasicTypeUnsignedInt128,
+ eBasicTypeBool,
+ eBasicTypeHalf,
+ eBasicTypeFloat,
+ eBasicTypeDouble,
+ eBasicTypeLongDouble,
+ eBasicTypeFloatComplex,
+ eBasicTypeDoubleComplex,
+ eBasicTypeLongDoubleComplex,
+ eBasicTypeObjCID,
+ eBasicTypeObjCClass,
+ eBasicTypeObjCSel,
+ eBasicTypeNullPtr,
+ 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),
+ eTypeClassClass = (1u << 3), eTypeClassComplexFloat = (1u << 4),
+ eTypeClassComplexInteger = (1u << 5), eTypeClassEnumeration = (1u << 6),
+ eTypeClassFunction = (1u << 7), eTypeClassMemberPointer = (1u << 8),
+ eTypeClassObjCObject = (1u << 9), eTypeClassObjCInterface = (1u << 10),
+ eTypeClassObjCObjectPointer = (1u << 11), eTypeClassPointer = (1u << 12),
+ eTypeClassReference = (1u << 13), eTypeClassStruct = (1u << 14),
+ eTypeClassTypedef = (1u << 15), eTypeClassUnion = (1u << 16),
+ eTypeClassVector = (1u << 17),
+ // Define the last type class as the MSBit of a 32 bit value
+ eTypeClassOther = (1u << 31),
+ // Define a mask that can be used for any type when finding types
+ eTypeClassAny = (0xffffffffu)};
+LLDB_MARK_AS_BITMASK_ENUM(TypeClass)
+
+enum TemplateArgumentKind {
+ eTemplateArgumentKindNull = 0,
+ eTemplateArgumentKindType,
+ eTemplateArgumentKindDeclaration,
+ eTemplateArgumentKindIntegral,
+ eTemplateArgumentKindTemplate,
+ eTemplateArgumentKindTemplateExpansion,
+ eTemplateArgumentKindExpression,
+ eTemplateArgumentKindPack,
+ eTemplateArgumentKindNullPtr,
+};
+
+// Options that can be set for a formatter to alter its behavior Not all of
+// these are applicable to all formatter types
+FLAGS_ENUM(TypeOptions){eTypeOptionNone = (0u),
+ eTypeOptionCascade = (1u << 0),
+ eTypeOptionSkipPointers = (1u << 1),
+ eTypeOptionSkipReferences = (1u << 2),
+ eTypeOptionHideChildren = (1u << 3),
+ eTypeOptionHideValue = (1u << 4),
+ eTypeOptionShowOneLiner = (1u << 5),
+ eTypeOptionHideNames = (1u << 6),
+ eTypeOptionNonCacheable = (1u << 7),
+ eTypeOptionHideEmptyAggregates = (1u << 8),
+ eTypeOptionFrontEndWantsDereference = (1u << 9)
+};
+
+// This is the return value for frame comparisons. If you are comparing frame
+// A to frame B the following cases arise: 1) When frame A pushes frame B (or a
+// frame that ends up pushing B) A is Older than B. 2) When frame A pushed
+// frame B (or if frame A is on the stack but B is not) A is Younger than B 3)
+// When frame A and frame B have the same StackID, they are Equal. 4) When
+// frame A and frame B have the same immediate parent frame, but are not equal,
+// the comparison yields
+// SameParent.
+// 5) If the two frames are on different threads or processes the comparison is
+// Invalid 6) If for some reason we can't figure out what went on, we return
+// Unknown.
+enum FrameComparison {
+ eFrameCompareInvalid,
+ eFrameCompareUnknown,
+ eFrameCompareEqual,
+ eFrameCompareSameParent,
+ eFrameCompareYounger,
+ eFrameCompareOlder
+};
+
+// File Permissions
+//
+// Designed to mimic the unix file permission bits so they can be used with
+// functions that set 'mode_t' to certain values for permissions.
+FLAGS_ENUM(FilePermissions){
+ eFilePermissionsUserRead = (1u << 8), eFilePermissionsUserWrite = (1u << 7),
+ eFilePermissionsUserExecute = (1u << 6),
+ eFilePermissionsGroupRead = (1u << 5),
+ eFilePermissionsGroupWrite = (1u << 4),
+ eFilePermissionsGroupExecute = (1u << 3),
+ eFilePermissionsWorldRead = (1u << 2),
+ eFilePermissionsWorldWrite = (1u << 1),
+ eFilePermissionsWorldExecute = (1u << 0),
+
+ eFilePermissionsUserRW = (eFilePermissionsUserRead |
+ eFilePermissionsUserWrite | 0),
+ eFileFilePermissionsUserRX = (eFilePermissionsUserRead | 0 |
+ eFilePermissionsUserExecute),
+ eFilePermissionsUserRWX = (eFilePermissionsUserRead |
+ eFilePermissionsUserWrite |
+ eFilePermissionsUserExecute),
+
+ eFilePermissionsGroupRW = (eFilePermissionsGroupRead |
+ eFilePermissionsGroupWrite | 0),
+ eFilePermissionsGroupRX = (eFilePermissionsGroupRead | 0 |
+ eFilePermissionsGroupExecute),
+ eFilePermissionsGroupRWX = (eFilePermissionsGroupRead |
+ eFilePermissionsGroupWrite |
+ eFilePermissionsGroupExecute),
+
+ eFilePermissionsWorldRW = (eFilePermissionsWorldRead |
+ eFilePermissionsWorldWrite | 0),
+ eFilePermissionsWorldRX = (eFilePermissionsWorldRead | 0 |
+ eFilePermissionsWorldExecute),
+ eFilePermissionsWorldRWX = (eFilePermissionsWorldRead |
+ eFilePermissionsWorldWrite |
+ eFilePermissionsWorldExecute),
+
+ eFilePermissionsEveryoneR = (eFilePermissionsUserRead |
+ eFilePermissionsGroupRead |
+ eFilePermissionsWorldRead),
+ eFilePermissionsEveryoneW = (eFilePermissionsUserWrite |
+ eFilePermissionsGroupWrite |
+ eFilePermissionsWorldWrite),
+ eFilePermissionsEveryoneX = (eFilePermissionsUserExecute |
+ eFilePermissionsGroupExecute |
+ eFilePermissionsWorldExecute),
+
+ eFilePermissionsEveryoneRW = (eFilePermissionsEveryoneR |
+ eFilePermissionsEveryoneW | 0),
+ eFilePermissionsEveryoneRX = (eFilePermissionsEveryoneR | 0 |
+ eFilePermissionsEveryoneX),
+ eFilePermissionsEveryoneRWX = (eFilePermissionsEveryoneR |
+ eFilePermissionsEveryoneW |
+ eFilePermissionsEveryoneX),
+ eFilePermissionsFileDefault = eFilePermissionsUserRW,
+ eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX,
+};
+
+// Queue work item types
+//
+// The different types of work that can be enqueued on a libdispatch aka Grand
+// Central Dispatch (GCD) queue.
+enum QueueItemKind {
+ eQueueItemKindUnknown = 0,
+ eQueueItemKindFunction,
+ eQueueItemKindBlock
+};
+
+// Queue type
+// libdispatch aka Grand Central Dispatch (GCD) queues can be either serial
+// (executing on one thread) or concurrent (executing on multiple threads).
+enum QueueKind {
+ eQueueKindUnknown = 0,
+ eQueueKindSerial,
+ eQueueKindConcurrent
+};
+
+// Expression Evaluation Stages
+// These are the cancellable stages of expression evaluation, passed to the
+// expression evaluation callback, so that you can interrupt expression
+// evaluation at the various points in its lifecycle.
+enum ExpressionEvaluationPhase {
+ eExpressionEvaluationParse = 0,
+ eExpressionEvaluationIRGen,
+ eExpressionEvaluationExecution,
+ eExpressionEvaluationComplete
+};
+
+// Watchpoint Kind
+// Indicates what types of events cause the watchpoint to fire. Used by Native
+// *Protocol-related classes.
+FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0),
+ eWatchpointKindRead = (1u << 1)};
+
+enum GdbSignal {
+ eGdbSignalBadAccess = 0x91,
+ eGdbSignalBadInstruction = 0x92,
+ eGdbSignalArithmetic = 0x93,
+ eGdbSignalEmulation = 0x94,
+ eGdbSignalSoftware = 0x95,
+ eGdbSignalBreakpoint = 0x96
+};
+
+// Used with SBHost::GetPath (lldb::PathType) to find files that are related to
+// LLDB on the current host machine. Most files are relative to LLDB or are in
+// known locations.
+enum PathType {
+ ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB
+ // mach-o file in LLDB.framework (MacOSX) exists
+ ePathTypeSupportExecutableDir, // Find LLDB support executable directory
+ // (debugserver, etc)
+ ePathTypeHeaderDir, // Find LLDB header file directory
+ ePathTypePythonDir, // Find Python modules (PYTHONPATH) directory
+ ePathTypeLLDBSystemPlugins, // System plug-ins directory
+ ePathTypeLLDBUserPlugins, // User plug-ins directory
+ ePathTypeLLDBTempSystemDir, // The LLDB temp directory for this system that
+ // will be cleaned up on exit
+ ePathTypeGlobalLLDBTempSystemDir, // The LLDB temp directory for this system,
+ // NOT cleaned up on a process exit.
+ ePathTypeClangDir // Find path to Clang builtin headers
+};
+
+// Kind of member function
+// Used by the type system
+enum MemberFunctionKind {
+ eMemberFunctionKindUnknown = 0, // Not sure what the type of this is
+ eMemberFunctionKindConstructor, // A function used to create instances
+ eMemberFunctionKindDestructor, // A function used to tear down existing
+ // instances
+ eMemberFunctionKindInstanceMethod, // A function that applies to a specific
+ // instance
+ eMemberFunctionKindStaticMethod // A function that applies to a type rather
+ // than any instance
+};
+
+// String matching algorithm used by SBTarget
+enum MatchType { eMatchTypeNormal, eMatchTypeRegex, eMatchTypeStartsWith };
+
+// Bitmask that describes details about a type
+FLAGS_ENUM(TypeFlags){
+ eTypeHasChildren = (1u << 0), eTypeHasValue = (1u << 1),
+ eTypeIsArray = (1u << 2), eTypeIsBlock = (1u << 3),
+ eTypeIsBuiltIn = (1u << 4), eTypeIsClass = (1u << 5),
+ eTypeIsCPlusPlus = (1u << 6), eTypeIsEnumeration = (1u << 7),
+ eTypeIsFuncPrototype = (1u << 8), eTypeIsMember = (1u << 9),
+ eTypeIsObjC = (1u << 10), eTypeIsPointer = (1u << 11),
+ eTypeIsReference = (1u << 12), eTypeIsStructUnion = (1u << 13),
+ eTypeIsTemplate = (1u << 14), eTypeIsTypedef = (1u << 15),
+ eTypeIsVector = (1u << 16), eTypeIsScalar = (1u << 17),
+ eTypeIsInteger = (1u << 18), eTypeIsFloat = (1u << 19),
+ eTypeIsComplex = (1u << 20), eTypeIsSigned = (1u << 21),
+ eTypeInstanceIsPointer = (1u << 22)};
+
+FLAGS_ENUM(CommandFlags){
+ // eCommandRequiresTarget
+ //
+ // Ensures a valid target is contained in m_exe_ctx prior to executing the
+ // command. If a target doesn't exist or is invalid, the command will fail
+ // and CommandObject::GetInvalidTargetDescription() will be returned as the
+ // error. CommandObject subclasses can override the virtual function for
+ // GetInvalidTargetDescription() to provide custom strings when needed.
+ eCommandRequiresTarget = (1u << 0),
+ // eCommandRequiresProcess
+ //
+ // Ensures a valid process is contained in m_exe_ctx prior to executing the
+ // command. If a process doesn't exist or is invalid, the command will fail
+ // and CommandObject::GetInvalidProcessDescription() will be returned as
+ // the error. CommandObject subclasses can override the virtual function
+ // for GetInvalidProcessDescription() to provide custom strings when
+ // needed.
+ eCommandRequiresProcess = (1u << 1),
+ // eCommandRequiresThread
+ //
+ // Ensures a valid thread is contained in m_exe_ctx prior to executing the
+ // command. If a thread doesn't exist or is invalid, the command will fail
+ // and CommandObject::GetInvalidThreadDescription() will be returned as the
+ // error. CommandObject subclasses can override the virtual function for
+ // GetInvalidThreadDescription() to provide custom strings when needed.
+ eCommandRequiresThread = (1u << 2),
+ // eCommandRequiresFrame
+ //
+ // Ensures a valid frame is contained in m_exe_ctx prior to executing the
+ // command. If a frame doesn't exist or is invalid, the command will fail
+ // and CommandObject::GetInvalidFrameDescription() will be returned as the
+ // error. CommandObject subclasses can override the virtual function for
+ // GetInvalidFrameDescription() to provide custom strings when needed.
+ eCommandRequiresFrame = (1u << 3),
+ // eCommandRequiresRegContext
+ //
+ // Ensures a valid register context (from the selected frame if there is a
+ // frame in m_exe_ctx, or from the selected thread from m_exe_ctx) is
+ // available from m_exe_ctx prior to executing the command. If a target
+ // doesn't exist or is invalid, the command will fail and
+ // CommandObject::GetInvalidRegContextDescription() will be returned as the
+ // error. CommandObject subclasses can override the virtual function for
+ // GetInvalidRegContextDescription() to provide custom strings when needed.
+ eCommandRequiresRegContext = (1u << 4),
+ // eCommandTryTargetAPILock
+ //
+ // Attempts to acquire the target lock if a target is selected in the
+ // command interpreter. If the command object fails to acquire the API
+ // lock, the command will fail with an appropriate error message.
+ eCommandTryTargetAPILock = (1u << 5),
+ // eCommandProcessMustBeLaunched
+ //
+ // Verifies that there is a launched process in m_exe_ctx, if there isn't,
+ // the command will fail with an appropriate error message.
+ eCommandProcessMustBeLaunched = (1u << 6),
+ // eCommandProcessMustBePaused
+ //
+ // Verifies that there is a paused process in m_exe_ctx, if there isn't,
+ // the command will fail with an appropriate error message.
+ eCommandProcessMustBePaused = (1u << 7)};
+
+// Whether a summary should cap how much data it returns to users or not
+enum TypeSummaryCapping {
+ eTypeSummaryCapped = true,
+ eTypeSummaryUncapped = false
+};
+} // namespace lldb
+
+#endif // LLDB_lldb_enumerations_h_
diff --git a/linux-x64/clang/include/lldb/lldb-forward.h b/linux-x64/clang/include/lldb/lldb-forward.h
new file mode 100644
index 0000000..0cdaf1c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-forward.h
@@ -0,0 +1,489 @@
+//===-- lldb-forward.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_forward_h_
+#define LLDB_lldb_forward_h_
+
+#if defined(__cplusplus)
+
+#include "lldb/Utility/SharingPtr.h"
+
+// lldb forward declarations
+namespace lldb_private {
+
+class ABI;
+class Address;
+class AddressRange;
+class AddressResolver;
+class ArchSpec;
+class ArmUnwindInfo;
+class Args;
+class ASTResultSynthesizer;
+class ASTStructExtractor;
+class Baton;
+class Block;
+class Breakpoint;
+class BreakpointID;
+class BreakpointIDList;
+class BreakpointList;
+class BreakpointLocation;
+class BreakpointLocationCollection;
+class BreakpointLocationList;
+class BreakpointName;
+class BreakpointOptionGroup;
+class BreakpointOptions;
+class BreakpointPrecondition;
+class BreakpointResolver;
+class BreakpointSite;
+class BreakpointSiteList;
+class BroadcastEventSpec;
+class Broadcaster;
+class BroadcasterManager;
+class ClangASTContext;
+class ClangASTImporter;
+class ClangASTMetadata;
+class ClangASTSource;
+class ClangExpressionDeclMap;
+class ClangExpressionParser;
+class ClangExpressionVariable;
+class ClangModulesDeclVendor;
+class ClangPersistentVariables;
+class CommandInterpreter;
+class CommandInterpreterRunOptions;
+class CommandObject;
+class CommandObjectMultiword;
+class CommandReturnObject;
+class Communication;
+class CompactUnwindInfo;
+struct CompilerContext;
+class CompilerDecl;
+class CompilerDeclContext;
+class CompilerType;
+class CompileUnit;
+class Connection;
+class ConnectionFileDescriptor;
+class ConstString;
+class CXXSyntheticChildren;
+class DWARFCallFrameInfo;
+class DWARFDataExtractor;
+class DWARFExpression;
+class DataBuffer;
+class DataEncoder;
+class DataExtractor;
+class Debugger;
+class Declaration;
+class DiagnosticManager;
+class Disassembler;
+class DumpValueObjectOptions;
+class DynamicCheckerFunctions;
+class DynamicLoader;
+class Editline;
+class EmulateInstruction;
+class Status;
+class EvaluateExpressionOptions;
+class Event;
+class EventData;
+class EventDataStructuredData;
+class ExecutionContext;
+class ExecutionContextRef;
+class ExecutionContextScope;
+class Expression;
+class ExpressionVariable;
+class ExpressionVariableList;
+class ExpressionTypeSystemHelper;
+class File;
+class FileSpec;
+class FileSpecList;
+class Flags;
+class TypeCategoryImpl;
+class FormatManager;
+class FormattersMatchCandidate;
+class FuncUnwinders;
+class Function;
+class FunctionInfo;
+class InlineFunctionInfo;
+class Instruction;
+class InstructionList;
+class InstrumentationRuntime;
+class IOHandler;
+class IOObject;
+class IRExecutionUnit;
+class JITLoader;
+class JITLoaderList;
+class Language;
+class LanguageCategory;
+class LanguageRuntime;
+class LineTable;
+class Listener;
+class Log;
+class Mangled;
+class Materializer;
+class MemoryHistory;
+class MemoryRegionInfo;
+class MemoryRegionInfos;
+class Module;
+class ModuleList;
+class ModuleSpec;
+class ModuleSpecList;
+struct NameSearchContext;
+class ObjectContainer;
+class OptionGroup;
+class OptionGroupOptions;
+class OptionGroupPlatform;
+class ObjectFile;
+class ObjectFileJITDelegate;
+class OperatingSystem;
+class Options;
+class OptionValue;
+class OptionValueArch;
+class OptionValueArgs;
+class OptionValueArray;
+class OptionValueBoolean;
+class OptionValueChar;
+class OptionValueDictionary;
+class OptionValueEnumeration;
+class OptionValueFileSpec;
+class OptionValueFileSpecList;
+class OptionValueFormat;
+class OptionValueLanguage;
+class OptionValueFormatEntity;
+class OptionValuePathMappings;
+class OptionValueProperties;
+class OptionValueRegex;
+class OptionValueSInt64;
+class OptionValueString;
+class OptionValueUInt64;
+class OptionValueUUID;
+class PathMappingList;
+class FunctionCaller;
+class PersistentExpressionState;
+class Platform;
+class Process;
+class ProcessAttachInfo;
+class ProcessModID;
+class ProcessInfo;
+class ProcessInstanceInfo;
+class ProcessInstanceInfoList;
+class ProcessInstanceInfoMatch;
+class ProcessLaunchInfo;
+class Property;
+struct PropertyDefinition;
+class RecognizedStackFrame;
+class RegisterCheckpoint;
+class RegisterContext;
+class RegisterValue;
+class RegularExpression;
+class REPL;
+class RichManglingContext;
+class Scalar;
+class ScriptInterpreter;
+class ScriptInterpreterLocker;
+struct ScriptSummaryFormat;
+class SearchFilter;
+class Section;
+class SectionList;
+class SectionLoadHistory;
+class SectionLoadList;
+class Settings;
+class SourceManager;
+class SourceManagerImpl;
+class StackFrame;
+class StackFrameList;
+class StackFrameRecognizer;
+class StackFrameRecognizerManager;
+class StackID;
+class StopInfo;
+class Stoppoint;
+class StoppointCallbackContext;
+class StoppointLocation;
+class Stream;
+template <unsigned N> class StreamBuffer;
+class StreamFile;
+class StreamString;
+class StringList;
+struct StringSummaryFormat;
+class StructuredDataImpl;
+class StructuredDataPlugin;
+class SystemRuntime;
+class TypeSummaryImpl;
+class TypeSummaryOptions;
+class Symbol;
+class SymbolContext;
+class SymbolContextList;
+class SymbolContextScope;
+class SymbolContextSpecifier;
+class SymbolFile;
+class SymbolFileType;
+class SymbolVendor;
+class Symtab;
+class SyntheticChildren;
+class SyntheticChildrenFrontEnd;
+class TypeFilterImpl;
+class TypeSystem;
+class ScriptedSyntheticChildren;
+class Queue;
+class QueueItem;
+class QueueImpl;
+class Target;
+class TargetList;
+class TargetProperties;
+class Thread;
+class ThreadCollection;
+class ThreadList;
+class ThreadPlan;
+class ThreadPlanBase;
+class ThreadPlanRunToAddress;
+class ThreadPlanStepInstruction;
+class ThreadPlanStepOut;
+class ThreadPlanStepOverBreakpoint;
+class ThreadPlanStepRange;
+class ThreadPlanStepThrough;
+class ThreadPlanTracer;
+class ThreadSpec;
+class TraceOptions;
+class Type;
+class TypeAndOrName;
+class TypeCategoryMap;
+class TypeImpl;
+class TypeList;
+class TypeMap;
+class TypeListImpl;
+class TypeMemberImpl;
+class TypeMemberFunctionImpl;
+class TypeEnumMemberImpl;
+class TypeEnumMemberListImpl;
+class TypeFormatImpl;
+class TypeNameSpecifierImpl;
+class TypeValidatorImpl;
+class UUID;
+class UnixSignals;
+class Unwind;
+class UnwindAssembly;
+class UnwindPlan;
+class UnwindTable;
+class UserExpression;
+class UtilityFunction;
+class VMRange;
+class Value;
+class ValueList;
+class ValueObject;
+class ValueObjectChild;
+class ValueObjectConstResult;
+class ValueObjectConstResultChild;
+class ValueObjectConstResultImpl;
+class ValueObjectList;
+class ValueObjectPrinter;
+class Variable;
+class VariableList;
+class Watchpoint;
+class WatchpointList;
+class WatchpointOptions;
+struct LineEntry;
+
+} // namespace lldb_private
+
+// lldb forward declarations
+namespace lldb {
+
+typedef std::shared_ptr<lldb_private::ABI> ABISP;
+typedef std::shared_ptr<lldb_private::Baton> BatonSP;
+typedef std::shared_ptr<lldb_private::Block> BlockSP;
+typedef std::shared_ptr<lldb_private::Breakpoint> BreakpointSP;
+typedef std::weak_ptr<lldb_private::Breakpoint> BreakpointWP;
+typedef std::shared_ptr<lldb_private::BreakpointSite> BreakpointSiteSP;
+typedef std::weak_ptr<lldb_private::BreakpointSite> BreakpointSiteWP;
+typedef std::shared_ptr<lldb_private::BreakpointLocation> BreakpointLocationSP;
+typedef std::weak_ptr<lldb_private::BreakpointLocation> BreakpointLocationWP;
+typedef std::shared_ptr<lldb_private::BreakpointPrecondition> BreakpointPreconditionSP;
+typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
+typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
+typedef std::shared_ptr<lldb_private::BroadcasterManager> BroadcasterManagerSP;
+typedef std::weak_ptr<lldb_private::BroadcasterManager> BroadcasterManagerWP;
+typedef std::unique_ptr<lldb_private::ClangASTContext> ClangASTContextUP;
+typedef std::shared_ptr<lldb_private::ClangASTImporter> ClangASTImporterSP;
+typedef std::unique_ptr<lldb_private::ClangModulesDeclVendor>
+ ClangModulesDeclVendorUP;
+typedef std::unique_ptr<lldb_private::ClangPersistentVariables>
+ ClangPersistentVariablesUP;
+typedef std::shared_ptr<lldb_private::UserExpression> UserExpressionSP;
+typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
+typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
+typedef std::shared_ptr<lldb_private::Connection> ConnectionSP;
+typedef std::shared_ptr<lldb_private::CompileUnit> CompUnitSP;
+typedef std::shared_ptr<lldb_private::DataBuffer> DataBufferSP;
+typedef std::shared_ptr<lldb_private::DataExtractor> DataExtractorSP;
+typedef std::shared_ptr<lldb_private::Debugger> DebuggerSP;
+typedef std::weak_ptr<lldb_private::Debugger> DebuggerWP;
+typedef std::shared_ptr<lldb_private::Disassembler> DisassemblerSP;
+typedef std::unique_ptr<lldb_private::DynamicCheckerFunctions>
+ DynamicCheckerFunctionsUP;
+typedef std::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
+typedef std::unique_ptr<lldb_private::DynamicLoader> DynamicLoaderUP;
+typedef std::shared_ptr<lldb_private::Event> EventSP;
+typedef std::shared_ptr<lldb_private::EventData> EventDataSP;
+typedef std::shared_ptr<lldb_private::EventDataStructuredData>
+ EventDataStructuredDataSP;
+typedef std::shared_ptr<lldb_private::ExecutionContextRef>
+ ExecutionContextRefSP;
+typedef std::shared_ptr<lldb_private::ExpressionVariable> ExpressionVariableSP;
+typedef std::shared_ptr<lldb_private::File> FileSP;
+typedef std::shared_ptr<lldb_private::Function> FunctionSP;
+typedef std::shared_ptr<lldb_private::FunctionCaller> FunctionCallerSP;
+typedef std::shared_ptr<lldb_private::FuncUnwinders> FuncUnwindersSP;
+typedef std::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
+typedef std::shared_ptr<lldb_private::Instruction> InstructionSP;
+typedef std::shared_ptr<lldb_private::InstrumentationRuntime>
+ InstrumentationRuntimeSP;
+typedef std::shared_ptr<lldb_private::IOHandler> IOHandlerSP;
+typedef std::shared_ptr<lldb_private::IOObject> IOObjectSP;
+typedef std::shared_ptr<lldb_private::IRExecutionUnit> IRExecutionUnitSP;
+typedef std::shared_ptr<lldb_private::JITLoader> JITLoaderSP;
+typedef std::unique_ptr<lldb_private::JITLoaderList> JITLoaderListUP;
+typedef std::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
+typedef std::shared_ptr<lldb_private::SystemRuntime> SystemRuntimeSP;
+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::MemoryHistory> MemoryHistorySP;
+typedef std::unique_ptr<lldb_private::MemoryRegionInfo> MemoryRegionInfoUP;
+typedef std::shared_ptr<lldb_private::Module> ModuleSP;
+typedef std::weak_ptr<lldb_private::Module> ModuleWP;
+typedef std::shared_ptr<lldb_private::ObjectFile> ObjectFileSP;
+typedef std::weak_ptr<lldb_private::ObjectFile> ObjectFileWP;
+typedef std::shared_ptr<lldb_private::ObjectFileJITDelegate>
+ ObjectFileJITDelegateSP;
+typedef std::weak_ptr<lldb_private::ObjectFileJITDelegate>
+ ObjectFileJITDelegateWP;
+typedef std::unique_ptr<lldb_private::OperatingSystem> OperatingSystemUP;
+typedef std::shared_ptr<lldb_private::OptionValue> OptionValueSP;
+typedef std::weak_ptr<lldb_private::OptionValue> OptionValueWP;
+typedef std::shared_ptr<lldb_private::OptionValueArch> OptionValueArchSP;
+typedef std::shared_ptr<lldb_private::OptionValueArgs> OptionValueArgsSP;
+typedef std::shared_ptr<lldb_private::OptionValueArray> OptionValueArraySP;
+typedef std::shared_ptr<lldb_private::OptionValueBoolean> OptionValueBooleanSP;
+typedef std::shared_ptr<lldb_private::OptionValueDictionary>
+ OptionValueDictionarySP;
+typedef std::shared_ptr<lldb_private::OptionValueFileSpec>
+ OptionValueFileSpecSP;
+typedef std::shared_ptr<lldb_private::OptionValueFileSpecList>
+ OptionValueFileSpecListSP;
+typedef std::shared_ptr<lldb_private::OptionValueFormat> OptionValueFormatSP;
+typedef std::shared_ptr<lldb_private::OptionValuePathMappings>
+ OptionValuePathMappingsSP;
+typedef std::shared_ptr<lldb_private::OptionValueProperties>
+ OptionValuePropertiesSP;
+typedef std::shared_ptr<lldb_private::OptionValueRegex> OptionValueRegexSP;
+typedef std::shared_ptr<lldb_private::OptionValueSInt64> OptionValueSInt64SP;
+typedef std::shared_ptr<lldb_private::OptionValueString> OptionValueStringSP;
+typedef std::shared_ptr<lldb_private::OptionValueUInt64> OptionValueUInt64SP;
+typedef std::shared_ptr<lldb_private::OptionValueUUID> OptionValueUUIDSP;
+typedef std::shared_ptr<lldb_private::Platform> PlatformSP;
+typedef std::shared_ptr<lldb_private::Process> ProcessSP;
+typedef std::shared_ptr<lldb_private::ProcessAttachInfo> ProcessAttachInfoSP;
+typedef std::shared_ptr<lldb_private::ProcessLaunchInfo> ProcessLaunchInfoSP;
+typedef std::weak_ptr<lldb_private::Process> ProcessWP;
+typedef std::shared_ptr<lldb_private::Property> PropertySP;
+typedef std::shared_ptr<lldb_private::RegisterCheckpoint> RegisterCheckpointSP;
+typedef std::shared_ptr<lldb_private::RegisterContext> RegisterContextSP;
+typedef std::shared_ptr<lldb_private::RegularExpression> RegularExpressionSP;
+typedef std::shared_ptr<lldb_private::Queue> QueueSP;
+typedef std::weak_ptr<lldb_private::Queue> QueueWP;
+typedef std::shared_ptr<lldb_private::QueueItem> QueueItemSP;
+typedef std::shared_ptr<lldb_private::REPL> REPLSP;
+typedef std::shared_ptr<lldb_private::RecognizedStackFrame>
+ RecognizedStackFrameSP;
+typedef std::shared_ptr<lldb_private::ScriptSummaryFormat>
+ ScriptSummaryFormatSP;
+typedef std::shared_ptr<lldb_private::ScriptInterpreter> ScriptInterpreterSP;
+typedef std::unique_ptr<lldb_private::ScriptInterpreter> ScriptInterpreterUP;
+typedef std::shared_ptr<lldb_private::Section> SectionSP;
+typedef std::unique_ptr<lldb_private::SectionList> SectionListUP;
+typedef std::weak_ptr<lldb_private::Section> SectionWP;
+typedef std::shared_ptr<lldb_private::SectionLoadList> SectionLoadListSP;
+typedef std::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
+typedef std::shared_ptr<lldb_private::Settings> SettingsSP;
+typedef std::unique_ptr<lldb_private::SourceManager> SourceManagerUP;
+typedef std::shared_ptr<lldb_private::StackFrame> StackFrameSP;
+typedef std::unique_ptr<lldb_private::StackFrame> StackFrameUP;
+typedef std::weak_ptr<lldb_private::StackFrame> StackFrameWP;
+typedef std::shared_ptr<lldb_private::StackFrameList> StackFrameListSP;
+typedef std::shared_ptr<lldb_private::StackFrameRecognizer>
+ StackFrameRecognizerSP;
+typedef std::shared_ptr<lldb_private::StopInfo> StopInfoSP;
+typedef std::shared_ptr<lldb_private::StoppointLocation> StoppointLocationSP;
+typedef std::shared_ptr<lldb_private::Stream> StreamSP;
+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>
+ StructuredDataPluginWP;
+typedef std::shared_ptr<lldb_private::SymbolFile> SymbolFileSP;
+typedef std::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP;
+typedef std::weak_ptr<lldb_private::SymbolFileType> SymbolFileTypeWP;
+typedef std::shared_ptr<lldb_private::SymbolContextSpecifier>
+ SymbolContextSpecifierSP;
+typedef std::unique_ptr<lldb_private::SymbolVendor> SymbolVendorUP;
+typedef std::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
+typedef std::shared_ptr<lldb_private::SyntheticChildrenFrontEnd>
+ SyntheticChildrenFrontEndSP;
+typedef std::shared_ptr<lldb_private::Target> TargetSP;
+typedef std::weak_ptr<lldb_private::Target> TargetWP;
+typedef std::shared_ptr<lldb_private::TargetProperties> TargetPropertiesSP;
+typedef std::shared_ptr<lldb_private::Thread> ThreadSP;
+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;
+typedef std::shared_ptr<lldb_private::TypeImpl> TypeImplSP;
+typedef std::shared_ptr<lldb_private::TypeMemberFunctionImpl>
+ TypeMemberFunctionImplSP;
+typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;
+typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;
+typedef std::shared_ptr<lldb_private::TypeSystem> TypeSystemSP;
+typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
+typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl>
+ TypeNameSpecifierImplSP;
+typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
+typedef std::shared_ptr<lldb_private::TypeSummaryOptions> TypeSummaryOptionsSP;
+typedef std::shared_ptr<lldb_private::TypeValidatorImpl> TypeValidatorImplSP;
+typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren>
+ ScriptedSyntheticChildrenSP;
+typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP;
+typedef std::weak_ptr<lldb_private::UnixSignals> UnixSignalsWP;
+typedef std::shared_ptr<lldb_private::UnwindAssembly> UnwindAssemblySP;
+typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
+typedef std::shared_ptr<lldb_private::UtilityFunction> UtilityFunctionSP;
+typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
+typedef std::shared_ptr<lldb_private::Value> ValueSP;
+typedef std::shared_ptr<lldb_private::ValueList> ValueListSP;
+typedef std::shared_ptr<lldb_private::Variable> VariableSP;
+typedef std::shared_ptr<lldb_private::VariableList> VariableListSP;
+typedef std::shared_ptr<lldb_private::ValueObjectList> ValueObjectListSP;
+typedef std::shared_ptr<lldb_private::Watchpoint> WatchpointSP;
+
+} // namespace lldb
+
+// llvm forward declarations
+namespace llvm {
+
+struct ItaniumPartialDemangler;
+class StringRef;
+
+} // namespace llvm
+
+#endif // #if defined(__cplusplus)
+#endif // LLDB_lldb_forward_h_
diff --git a/linux-x64/clang/include/lldb/lldb-private-defines.h b/linux-x64/clang/include/lldb/lldb-private-defines.h
new file mode 100644
index 0000000..737d9ef
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private-defines.h
@@ -0,0 +1,36 @@
+//===-- lldb-private-defines.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_lldb_private_defines_h_
+#define liblldb_lldb_private_defines_h_
+
+#if defined(__cplusplus)
+
+// Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then
+// Compiler.h later tries to redefine it.
+#include "llvm/Support/Compiler.h"
+
+#ifndef LLVM_FALLTHROUGH
+
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) 0
+#endif
+
+/// \macro LLVM_FALLTHROUGH
+/// Marks an empty statement preceding a deliberate switch fallthrough.
+#if __has_cpp_attribute(clang::fallthrough)
+#define LLVM_FALLTHROUGH [[clang::fallthrough]]
+#else
+#define LLVM_FALLTHROUGH
+#endif
+
+#endif // ifndef LLVM_FALLTHROUGH
+
+#endif // #if defined(__cplusplus)
+
+#endif // liblldb_lldb_private_defines_h_
diff --git a/linux-x64/clang/include/lldb/lldb-private-enumerations.h b/linux-x64/clang/include/lldb/lldb-private-enumerations.h
new file mode 100644
index 0000000..3d8b360
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private-enumerations.h
@@ -0,0 +1,264 @@
+//===-- lldb-private-enumerations.h -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#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 {
+
+// Thread Step Types
+enum StepType {
+ eStepTypeNone,
+ eStepTypeTrace, ///< Single step one instruction.
+ eStepTypeTraceOver, ///< Single step one instruction, stepping over.
+ eStepTypeInto, ///< Single step into a specified context.
+ eStepTypeOver, ///< Single step over a specified context.
+ eStepTypeOut, ///< Single step out a specified context.
+ eStepTypeScripted ///< A step type implemented by the script interpreter.
+};
+
+// Address Types
+enum AddressType {
+ eAddressTypeInvalid = 0,
+ eAddressTypeFile, ///< Address is an address as found in an object or symbol
+ /// file
+ eAddressTypeLoad, ///< Address is an address as in the current target inferior
+ /// process
+ eAddressTypeHost ///< Address is an address in the process that is running
+ /// this code
+};
+
+// Address Class
+//
+// A way of classifying an address used for disassembling and setting
+// breakpoints. Many object files can track exactly what parts of their object
+// files are code, data and other information. This is of course above and
+// beyond just looking at the section types. For example, code might contain PC
+// relative data and the object file might be able to tell us that an address
+// in code is data.
+enum class AddressClass {
+ eInvalid,
+ eUnknown,
+ eCode,
+ eCodeAlternateISA,
+ eData,
+ eDebug,
+ eRuntime
+};
+
+// Votes - Need a tri-state, yes, no, no opinion...
+enum Vote { eVoteNo = -1, eVoteNoOpinion = 0, eVoteYes = 1 };
+
+enum ArchitectureType {
+ eArchTypeInvalid,
+ eArchTypeMachO,
+ eArchTypeELF,
+ eArchTypeCOFF,
+ kNumArchTypes
+};
+
+/// Settable state variable types.
+///
+
+// typedef enum SettableVariableType
+//{
+// eSetVarTypeInt,
+// eSetVarTypeBoolean,
+// eSetVarTypeString,
+// eSetVarTypeArray,
+// eSetVarTypeDictionary,
+// eSetVarTypeEnum,
+// eSetVarTypeNone
+//} SettableVariableType;
+
+enum VarSetOperationType {
+ eVarSetOperationReplace,
+ eVarSetOperationInsertBefore,
+ eVarSetOperationInsertAfter,
+ eVarSetOperationRemove,
+ eVarSetOperationAppend,
+ eVarSetOperationClear,
+ eVarSetOperationAssign,
+ eVarSetOperationInvalid
+};
+
+enum ArgumentRepetitionType {
+ eArgRepeatPlain, // Exactly one occurrence
+ eArgRepeatOptional, // At most one occurrence, but it's optional
+ eArgRepeatPlus, // One or more occurrences
+ eArgRepeatStar, // Zero or more occurrences
+ eArgRepeatRange, // Repetition of same argument, from 1 to n
+ eArgRepeatPairPlain, // A pair of arguments that must always go together
+ // ([arg-type arg-value]), occurs exactly once
+ eArgRepeatPairOptional, // A pair that occurs at most once (optional)
+ eArgRepeatPairPlus, // One or more occurrences of a pair
+ eArgRepeatPairStar, // Zero or more occurrences of a pair
+ eArgRepeatPairRange, // A pair that repeats from 1 to n
+ eArgRepeatPairRangeOptional // A pair that repeats from 1 to n, but is
+ // optional
+};
+
+enum SortOrder { eSortOrderNone, eSortOrderByAddress, eSortOrderByName };
+
+// LazyBool is for boolean values that need to be calculated lazily. Values
+// start off set to eLazyBoolCalculate, and then they can be calculated once
+// and set to eLazyBoolNo or eLazyBoolYes.
+enum LazyBool { eLazyBoolCalculate = -1, eLazyBoolNo = 0, eLazyBoolYes = 1 };
+
+/// Instruction types
+enum InstructionType {
+ eInstructionTypeAny, // Support for any instructions at all (at least one)
+ eInstructionTypePrologueEpilogue, // All prologue and epilogue instructions
+ // that push and pop register values and
+ // modify sp/fp
+ eInstructionTypePCModifying, // Any instruction that modifies the program
+ // counter/instruction pointer
+ eInstructionTypeAll // All instructions of any kind
+
+};
+
+/// Format category entry types
+enum FormatCategoryItem {
+ eFormatCategoryItemSummary = 0x0001,
+ eFormatCategoryItemRegexSummary = 0x0002,
+ eFormatCategoryItemFilter = 0x0004,
+ eFormatCategoryItemRegexFilter = 0x0008,
+ eFormatCategoryItemSynth = 0x0010,
+ eFormatCategoryItemRegexSynth = 0x0020,
+ eFormatCategoryItemValue = 0x0040,
+ eFormatCategoryItemRegexValue = 0x0080,
+ eFormatCategoryItemValidator = 0x0100,
+ eFormatCategoryItemRegexValidator = 0x0200
+};
+
+/// Expression execution policies
+enum ExecutionPolicy {
+ eExecutionPolicyOnlyWhenNeeded,
+ eExecutionPolicyNever,
+ eExecutionPolicyAlways,
+ eExecutionPolicyTopLevel // used for top-level code
+};
+
+// Ways that the FormatManager picks a particular format for a type
+enum FormatterChoiceCriterion {
+ eFormatterChoiceCriterionDirectChoice = 0x00000000,
+ eFormatterChoiceCriterionStrippedPointerReference = 0x00000001,
+ eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
+ eFormatterChoiceCriterionRegularExpressionSummary = 0x00000004,
+ eFormatterChoiceCriterionRegularExpressionFilter = 0x00000004,
+ eFormatterChoiceCriterionLanguagePlugin = 0x00000008,
+ eFormatterChoiceCriterionStrippedBitField = 0x00000010,
+ eFormatterChoiceCriterionWentToStaticValue = 0x00000020
+};
+
+// Synchronicity behavior of scripted commands
+enum ScriptedCommandSynchronicity {
+ eScriptedCommandSynchronicitySynchronous,
+ eScriptedCommandSynchronicityAsynchronous,
+ eScriptedCommandSynchronicityCurrentValue // use whatever the current
+ // synchronicity is
+};
+
+// Verbosity mode of "po" output
+enum LanguageRuntimeDescriptionDisplayVerbosity {
+ eLanguageRuntimeDescriptionDisplayVerbosityCompact, // only print the
+ // description string, if
+ // any
+ eLanguageRuntimeDescriptionDisplayVerbosityFull, // print the full-blown
+ // output
+};
+
+// Loading modules from memory
+enum MemoryModuleLoadLevel {
+ eMemoryModuleLoadLevelMinimal, // Load sections only
+ eMemoryModuleLoadLevelPartial, // Load function bounds but no symbols
+ eMemoryModuleLoadLevelComplete, // Load sections and all symbols
+};
+
+// Result enums for when reading multiple lines from IOHandlers
+enum class LineStatus {
+ Success, // The line that was just edited if good and should be added to the
+ // lines
+ 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
+};
+
+// Boolean result of running a Type Validator
+enum class TypeValidatorResult : bool { Success = true, Failure = false };
+
+// Enumerations that can be used to specify scopes types when looking up types.
+enum class CompilerContextKind {
+ Invalid = 0,
+ TranslationUnit,
+ Module,
+ Namespace,
+ Class,
+ Structure,
+ Union,
+ Function,
+ Variable,
+ Enumeration,
+ Typedef
+};
+
+// Enumerations that can be used to specify the kind of metric we're looking at
+// when collecting stats.
+enum StatisticKind {
+ ExpressionSuccessful = 0,
+ ExpressionFailure = 1,
+ FrameVarSuccess = 2,
+ FrameVarFailure = 3,
+ StatisticMax = 4
+};
+
+
+inline std::string GetStatDescription(lldb_private::StatisticKind K) {
+ switch (K) {
+ case StatisticKind::ExpressionSuccessful:
+ return "Number of expr evaluation successes";
+ case StatisticKind::ExpressionFailure:
+ return "Number of expr evaluation failures";
+ case StatisticKind::FrameVarSuccess:
+ return "Number of frame var successes";
+ case StatisticKind::FrameVarFailure:
+ return "Number of frame var failures";
+ case StatisticKind::StatisticMax:
+ return "";
+ }
+ llvm_unreachable("Statistic not registered!");
+}
+
+} // 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/linux-x64/clang/include/lldb/lldb-private-forward.h b/linux-x64/clang/include/lldb/lldb-private-forward.h
new file mode 100644
index 0000000..3300707
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private-forward.h
@@ -0,0 +1,21 @@
+//===-- lldb-private-forward.h ----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_private_forward_h_
+#define LLDB_lldb_private_forward_h_
+
+namespace lldb_private {
+// forward decls.
+class NativeProcessProtocol;
+class NativeRegisterContext;
+class NativeThreadProtocol;
+class ResumeActionList;
+class UnixSignals;
+}
+
+#endif // #ifndef LLDB_lldb_private_forward_h_
diff --git a/linux-x64/clang/include/lldb/lldb-private-interfaces.h b/linux-x64/clang/include/lldb/lldb-private-interfaces.h
new file mode 100644
index 0000000..3a9f78a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private-interfaces.h
@@ -0,0 +1,117 @@
+//===-- lldb-private-interfaces.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_lldb_private_interfaces_h_
+#define liblldb_lldb_private_interfaces_h_
+
+#if defined(__cplusplus)
+
+#include "lldb/lldb-enumerations.h"
+#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)(lldb::ProcessSP process_sp, const ArchSpec &arch);
+typedef Disassembler *(*DisassemblerCreateInstance)(const ArchSpec &arch,
+ const char *flavor);
+typedef DynamicLoader *(*DynamicLoaderCreateInstance)(Process *process,
+ bool force);
+typedef lldb::JITLoaderSP (*JITLoaderCreateInstance)(Process *process,
+ bool force);
+typedef ObjectContainer *(*ObjectContainerCreateInstance)(
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset,
+ lldb::offset_t length);
+typedef size_t (*ObjectFileGetModuleSpecifications)(
+ const FileSpec &file, lldb::DataBufferSP &data_sp,
+ lldb::offset_t data_offset, lldb::offset_t file_offset,
+ lldb::offset_t length, ModuleSpecList &module_specs);
+typedef ObjectFile *(*ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp,
+ lldb::DataBufferSP &data_sp,
+ lldb::offset_t data_offset,
+ const FileSpec *file,
+ lldb::offset_t file_offset,
+ lldb::offset_t length);
+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, Status &error);
+typedef EmulateInstruction *(*EmulateInstructionCreateInstance)(
+ const ArchSpec &arch, InstructionType inst_type);
+typedef OperatingSystem *(*OperatingSystemCreateInstance)(Process *process,
+ bool force);
+typedef Language *(*LanguageCreateInstance)(lldb::LanguageType language);
+typedef LanguageRuntime *(*LanguageRuntimeCreateInstance)(
+ Process *process, lldb::LanguageType language);
+typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject)(
+ CommandInterpreter &interpreter);
+typedef lldb::BreakpointPreconditionSP (
+ *LanguageRuntimeGetExceptionPrecondition)(lldb::LanguageType language,
+ bool throw_bp);
+typedef lldb::StructuredDataPluginSP (*StructuredDataPluginCreateInstance)(
+ Process &process);
+typedef Status (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info,
+ Target *target);
+typedef SystemRuntime *(*SystemRuntimeCreateInstance)(Process *process);
+typedef lldb::PlatformSP (*PlatformCreateInstance)(bool force,
+ const ArchSpec *arch);
+typedef lldb::ProcessSP (*ProcessCreateInstance)(
+ lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
+ const FileSpec *crash_file_path);
+typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
+ Debugger &debugger);
+typedef SymbolFile *(*SymbolFileCreateInstance)(ObjectFile *obj_file);
+typedef SymbolVendor *(*SymbolVendorCreateInstance)(
+ const lldb::ModuleSP &module_sp,
+ lldb_private::Stream
+ *feedback_strm); // Module can be NULL for default system symbol vendor
+typedef bool (*BreakpointHitCallback)(void *baton,
+ StoppointCallbackContext *context,
+ lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id);
+typedef bool (*WatchpointHitCallback)(void *baton,
+ StoppointCallbackContext *context,
+ lldb::user_id_t watch_id);
+typedef void (*OptionValueChangedCallback)(void *baton,
+ OptionValue *option_value);
+typedef bool (*ThreadPlanShouldStopHereCallback)(
+ ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
+ Status &status, void *baton);
+typedef lldb::ThreadPlanSP (*ThreadPlanStepFromHereCallback)(
+ ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
+ Status &status, void *baton);
+typedef UnwindAssembly *(*UnwindAssemblyCreateInstance)(const ArchSpec &arch);
+typedef lldb::MemoryHistorySP (*MemoryHistoryCreateInstance)(
+ const lldb::ProcessSP &process_sp);
+typedef lldb::InstrumentationRuntimeType (*InstrumentationRuntimeGetType)();
+typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance)(
+ const lldb::ProcessSP &process_sp);
+typedef lldb::TypeSystemSP (*TypeSystemCreateInstance)(
+ lldb::LanguageType language, Module *module, Target *target);
+typedef lldb::REPLSP (*REPLCreateInstance)(Status &error,
+ lldb::LanguageType language,
+ Debugger *debugger, Target *target,
+ const char *repl_options);
+typedef void (*TypeSystemEnumerateSupportedLanguages)(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+typedef void (*REPLEnumerateSupportedLanguages)(
+ std::set<lldb::LanguageType> &languages);
+typedef int (*ComparisonFunction)(const void *, const void *);
+typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+
+#endif // liblldb_lldb_private_interfaces_h_
diff --git a/linux-x64/clang/include/lldb/lldb-private-types.h b/linux-x64/clang/include/lldb/lldb-private-types.h
new file mode 100644
index 0000000..bff4711
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private-types.h
@@ -0,0 +1,129 @@
+//===-- lldb-private-types.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_lldb_private_types_h_
+#define liblldb_lldb_private_types_h_
+
+#if defined(__cplusplus)
+
+#include "lldb/lldb-private.h"
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace llvm {
+namespace sys {
+class DynamicLibrary;
+}
+}
+
+namespace lldb_private {
+class Platform;
+class ExecutionContext;
+
+typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(
+ const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error);
+
+// Every register is described in detail including its name, alternate name
+// (optional), encoding, size in bytes and the default display format.
+struct RegisterInfo {
+ const char *name; // Name of this register, can't be NULL
+ const char *alt_name; // Alternate name of this register, can be NULL
+ uint32_t byte_size; // Size in bytes of the register
+ uint32_t byte_offset; // The byte offset in the register context data where
+ // this register's value is found.
+ // This is optional, and can be 0 if a particular RegisterContext does not
+ // need to address its registers by byte offset.
+ lldb::Encoding encoding; // Encoding of the register bits
+ lldb::Format format; // Default display format
+ uint32_t kinds[lldb::kNumRegisterKinds]; // Holds all of the various register
+ // numbers for all register kinds
+ uint32_t *value_regs; // List of registers (terminated with
+ // LLDB_INVALID_REGNUM). If this value is not null,
+ // all registers in this list will be read first, at
+ // which point the value for this register will be
+ // valid. For example, the value list for ah would be
+ // eax (x86) or rax (x64).
+ uint32_t *invalidate_regs; // List of registers (terminated with
+ // LLDB_INVALID_REGNUM). If this value is not
+ // null, all registers in this list will be
+ // invalidated when the value of this register
+ // changes. For example, the invalidate list for
+ // eax would be rax ax, ah, and al.
+ const uint8_t *dynamic_size_dwarf_expr_bytes; // A DWARF expression that when
+ // evaluated gives
+ // the byte size of this register.
+ size_t dynamic_size_dwarf_len; // The length of the DWARF expression in bytes
+ // in the dynamic_size_dwarf_expr_bytes
+ // member.
+
+ llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
+ return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
+ }
+
+ llvm::MutableArrayRef<uint8_t> mutable_data(uint8_t *context_base) const {
+ return llvm::MutableArrayRef<uint8_t>(context_base + byte_offset,
+ byte_size);
+ }
+};
+
+// Registers are grouped into register sets
+struct RegisterSet {
+ const char *name; // Name of this register set
+ const char *short_name; // A short name for this register set
+ size_t num_registers; // The number of registers in REGISTERS array below
+ const uint32_t *registers; // An array of register indices in this set. The
+ // values in this array are
+ // *indices* (not register numbers) into a particular RegisterContext's
+ // register array. For example, if eax is defined at index 4 for a
+ // particular RegisterContext, eax would be included in this RegisterSet by
+ // adding the value 4. Not by adding the value lldb_eax_i386.
+};
+
+struct OptionEnumValueElement {
+ int64_t value;
+ const char *string_value;
+ const char *usage;
+};
+
+using OptionEnumValues = llvm::ArrayRef<OptionEnumValueElement>;
+
+struct OptionValidator {
+ virtual ~OptionValidator() {}
+ virtual bool IsValid(Platform &platform,
+ const ExecutionContext &target) const = 0;
+ virtual const char *ShortConditionString() const = 0;
+ virtual const char *LongConditionString() const = 0;
+};
+
+struct OptionDefinition {
+ uint32_t usage_mask; // Used to mark options that can be used together. If (1
+ // << n & usage_mask) != 0
+ // then this option belongs to option set n.
+ bool required; // This option is required (in the current usage level)
+ const char *long_option; // Full name for this option.
+ int short_option; // Single character for this option.
+ int option_has_arg; // no_argument, required_argument or optional_argument
+ OptionValidator *validator; // If non-NULL, option is valid iff
+ // |validator->IsValid()|, otherwise always valid.
+ OptionEnumValues enum_values; // If not empty, an array of enum values.
+ uint32_t completion_type; // Cookie the option class can use to do define the
+ // argument completion.
+ lldb::CommandArgumentType argument_type; // Type of argument this option takes
+ const char *usage_text; // Full text explaining what this options does and
+ // what (if any) argument to
+ // pass it.
+};
+
+typedef struct type128 { uint64_t x[2]; } type128;
+typedef struct type256 { uint64_t x[4]; } type256;
+
+} // namespace lldb_private
+
+#endif // #if defined(__cplusplus)
+
+#endif // liblldb_lldb_private_types_h_
diff --git a/linux-x64/clang/include/lldb/lldb-private.h b/linux-x64/clang/include/lldb/lldb-private.h
new file mode 100644
index 0000000..24954ad
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-private.h
@@ -0,0 +1,28 @@
+//===-- lldb-private.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_lldb_private_h_
+#define lldb_lldb_private_h_
+
+#if defined(__cplusplus)
+
+#include "lldb/lldb-private-defines.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-private-interfaces.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+const char *GetVersion();
+
+} // namespace lldb_private
+
+#endif // defined(__cplusplus)
+
+#endif // lldb_lldb_private_h_
diff --git a/linux-x64/clang/include/lldb/lldb-public.h b/linux-x64/clang/include/lldb/lldb-public.h
new file mode 100644
index 0000000..449062f
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-public.h
@@ -0,0 +1,17 @@
+//===-- lldb-public.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_h_
+#define LLDB_lldb_h_
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#endif // LLDB_lldb_h_
diff --git a/linux-x64/clang/include/lldb/lldb-types.h b/linux-x64/clang/include/lldb/lldb-types.h
new file mode 100644
index 0000000..414a9f3
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-types.h
@@ -0,0 +1,94 @@
+//===-- lldb-types.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_types_h_
+#define LLDB_lldb_types_h_
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include <stdint.h>
+
+// All host systems must define:
+// 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
+// argument for the host system
+// lldb::thread_result_t The return type that gets returned when a thread
+// finishes.
+// lldb::thread_func_t The function prototype used to spawn a thread on the
+// host system.
+// #define LLDB_INVALID_PROCESS_ID ...
+// #define LLDB_INVALID_THREAD_ID ...
+// #define LLDB_INVALID_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.
+
+#ifdef _WIN32
+
+#include <process.h>
+
+namespace lldb {
+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 unsigned int __w64 socket_t; // Host socket type
+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
+typedef void *pipe_t; // Host pipe type is HANDLE
+} // namespace lldb
+
+#else
+
+#include <pthread.h>
+
+namespace lldb {
+// MacOSX Types
+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 socket_t; // Host socket type
+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
+typedef int pipe_t; // Host pipe type
+} // namespace lldb
+
+#endif
+
+namespace lldb {
+typedef void (*LogOutputCallback)(const char *, void *baton);
+typedef bool (*CommandOverrideCallback)(void *baton, const char **argv);
+typedef bool (*CommandOverrideCallbackWithResult)(
+ void *baton, const char **argv, lldb_private::CommandReturnObject &result);
+typedef bool (*ExpressionCancelCallback)(ExpressionEvaluationPhase phase,
+ void *baton);
+} // namespace lldb
+
+#define LLDB_INVALID_PROCESS ((lldb::process_t)-1)
+#define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL)
+#define LLDB_INVALID_PIPE ((lldb::pipe_t)-1)
+
+namespace lldb {
+typedef uint64_t addr_t;
+typedef uint64_t user_id_t;
+typedef uint64_t pid_t;
+typedef uint64_t tid_t;
+typedef uint64_t offset_t;
+typedef int32_t break_id_t;
+typedef int32_t watch_id_t;
+typedef void *opaque_compiler_type_t;
+typedef uint64_t queue_id_t;
+} // namespace lldb
+
+#endif // LLDB_lldb_types_h_
diff --git a/linux-x64/clang/include/lldb/lldb-versioning.h b/linux-x64/clang/include/lldb/lldb-versioning.h
new file mode 100644
index 0000000..702ebd1
--- /dev/null
+++ b/linux-x64/clang/include/lldb/lldb-versioning.h
@@ -0,0 +1,1542 @@
+//===-- lldb-versioning.h ----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_lldb_versioning_h_
+#define LLDB_lldb_versioning_h_
+
+// LLDB API version
+#define LLDB_API_MAJOR_VERSION 1
+#define LLDB_API_MINOR_VERSION 0
+
+/*
+ API versioning
+ ---------------------------------
+
+ The LLDB API is versioned independently of the LLDB source base
+ Our API version numbers are composed of a major and a minor number
+
+ The major number means a complete and stable revision of the API. Major numbers
+ are compatibility breakers
+ (i.e. when we change the API major number, there is no promise of compatibility
+ with the previous major version
+ and we are free to remove and/or change any APIs)
+ Minor numbers are a work-in-progress evolution of the API. APIs will not be
+ removed or changed across minor versions
+ (minors do not break compatibility). However, we can deprecate APIs in minor
+ versions or add new APIs in minor versions
+ A deprecated API is supposedly going to be removed in the next major version
+ and will generate a warning if used
+ APIs we add in minor versions will not be removed (at least until the following
+ major) but they might theoretically be deprecated
+ in a following minor version
+ Users are discouraged from using the LLDB version number to test for API
+ features and should instead use the API version checking
+ as discussed below
+
+ API version checking
+ ---------------------------------
+
+ You can (optionally) sign into an API version checking feature
+ To do so you need to define three macros:
+ LLDB_API_CHECK_VERSIONING - define to any value (or no value)
+ LLDB_API_MAJOR_VERSION_WANTED - which major version of the LLDB API you are
+ targeting
+ LLDB_API_MINOR_VERSION_WANTED - which minor version of the LLDB API you are
+ targeting
+
+ If these macros exist - LLDB will enable version checking of the public API
+
+ If LLDB_API_MAJOR_VERSION is not equal to LLDB_API_MAJOR_VERSION_WANTED we will
+ immediately halt your compilation with an error
+ This is by design, since we do not make any promise of compatibility across
+ major versions - if you really want to test your luck, disable the versioning
+ altogether
+
+ If the major version test passes, you have signed up for a specific minor
+ version of the API
+ Whenever we add or deprecate an API in a minor version, we will mark it with
+ either
+ LLDB_API_NEW_IN_DOT_x - this API is new in LLDB .x
+ LLDB_API_DEPRECATED_IN_DOT_x - this API is deprecated as of .x
+
+ If you are using an API new in DOT_x
+ if LLDB_API_MINOR_VERSION_WANTED >= x then all is well, else you will get a
+ compilation error
+ This is meant to prevent you from using APIs that are newer than whatever
+ LLDB you want to target
+
+ If you are using an API deprecated in DOT_x
+ if LLDB_API_MINOR_VERSION_WANTED >= x then you will get a compilation warning,
+ else all is well
+ This is meant to let you know that you are using an API that is deprecated and
+ might go away
+
+ Caveats
+ ---------------------------------
+
+ Version checking only works on clang on OSX - you will get an error if you try
+ to enable it on any other OS/compiler
+ If you want to enable version checking on other platforms, you will need to
+ define appropriate implementations for
+ LLDB_API_IMPL_DEPRECATED and LLDB_API_IMPL_TOONEW and any other infrastructure
+ your compiler needs for this purpose
+
+ We have no deprecation-as-error mode
+
+ There is no support for API versioning in Python
+
+ We reserve to use macros whose names begin with LLDB_API_ and you should not
+ use them in your source code as they might conflict
+ with present or future macro names we are using to implement versioning
+*/
+
+// if you want the version checking to work on other OS/compiler, define
+// appropriate IMPL_DEPRECATED/IMPL_TOONEW and define
+// LLDB_API_CHECK_VERSIONING_WORKS when you are ready to go live
+#if defined(__APPLE__) && defined(__clang__)
+#define LLDB_API_IMPL_DEPRECATED __attribute__((deprecated))
+#define LLDB_API_IMPL_TOONEW __attribute__((unavailable))
+#define LLDB_API_CHECK_VERSIONING_WORKS
+#endif
+
+#if defined(LLDB_API_CHECK_VERSIONING) && \
+ !defined(LLDB_API_CHECK_VERSIONING_WORKS)
+#error \
+ "API version checking will not work here - please disable or create and submit patches to lldb-versioning.h"
+#endif
+
+#if defined(LLDB_API_CHECK_VERSIONING_WORKS) && \
+ (!defined(LLDB_API_IMPL_DEPRECATED) || !defined(LLDB_API_IMPL_TOONEW))
+#error \
+ "LLDB_API_CHECK_VERSIONING_WORKS needs LLDB_API_IMPL_DEPRECATED and LLDB_API_IMPL_TOONEW to be defined"
+#endif
+
+#if defined(LLDB_API_CHECK_VERSIONING) && \
+ defined(LLDB_API_MAJOR_VERSION_WANTED) && \
+ defined(LLDB_API_MINOR_VERSION_WANTED)
+
+#if defined(LLDB_API_MAJOR_VERSION) && \
+ (LLDB_API_MAJOR_VERSION != LLDB_API_MAJOR_VERSION_WANTED)
+#error \
+ "Cannot link using this LLDB version - public API versions are incompatible"
+#endif
+
+#define LLDB_API_MINOR_VERSION_DOT_0 0
+#define LLDB_API_MINOR_VERSION_DOT_1 1
+#define LLDB_API_MINOR_VERSION_DOT_2 2
+#define LLDB_API_MINOR_VERSION_DOT_3 3
+#define LLDB_API_MINOR_VERSION_DOT_4 4
+#define LLDB_API_MINOR_VERSION_DOT_5 5
+#define LLDB_API_MINOR_VERSION_DOT_6 6
+#define LLDB_API_MINOR_VERSION_DOT_7 7
+#define LLDB_API_MINOR_VERSION_DOT_8 8
+#define LLDB_API_MINOR_VERSION_DOT_9 9
+#define LLDB_API_MINOR_VERSION_DOT_10 10
+#define LLDB_API_MINOR_VERSION_DOT_11 11
+#define LLDB_API_MINOR_VERSION_DOT_12 12
+#define LLDB_API_MINOR_VERSION_DOT_13 13
+#define LLDB_API_MINOR_VERSION_DOT_14 14
+#define LLDB_API_MINOR_VERSION_DOT_15 15
+#define LLDB_API_MINOR_VERSION_DOT_16 16
+#define LLDB_API_MINOR_VERSION_DOT_17 17
+#define LLDB_API_MINOR_VERSION_DOT_18 18
+#define LLDB_API_MINOR_VERSION_DOT_19 19
+#define LLDB_API_MINOR_VERSION_DOT_20 20
+#define LLDB_API_MINOR_VERSION_DOT_21 21
+#define LLDB_API_MINOR_VERSION_DOT_22 22
+#define LLDB_API_MINOR_VERSION_DOT_23 23
+#define LLDB_API_MINOR_VERSION_DOT_24 24
+#define LLDB_API_MINOR_VERSION_DOT_25 25
+#define LLDB_API_MINOR_VERSION_DOT_26 26
+#define LLDB_API_MINOR_VERSION_DOT_27 27
+#define LLDB_API_MINOR_VERSION_DOT_28 28
+#define LLDB_API_MINOR_VERSION_DOT_29 29
+#define LLDB_API_MINOR_VERSION_DOT_30 30
+#define LLDB_API_MINOR_VERSION_DOT_31 31
+#define LLDB_API_MINOR_VERSION_DOT_32 32
+#define LLDB_API_MINOR_VERSION_DOT_33 33
+#define LLDB_API_MINOR_VERSION_DOT_34 34
+#define LLDB_API_MINOR_VERSION_DOT_35 35
+#define LLDB_API_MINOR_VERSION_DOT_36 36
+#define LLDB_API_MINOR_VERSION_DOT_37 37
+#define LLDB_API_MINOR_VERSION_DOT_38 38
+#define LLDB_API_MINOR_VERSION_DOT_39 39
+#define LLDB_API_MINOR_VERSION_DOT_40 40
+#define LLDB_API_MINOR_VERSION_DOT_41 41
+#define LLDB_API_MINOR_VERSION_DOT_42 42
+#define LLDB_API_MINOR_VERSION_DOT_43 43
+#define LLDB_API_MINOR_VERSION_DOT_44 44
+#define LLDB_API_MINOR_VERSION_DOT_45 45
+#define LLDB_API_MINOR_VERSION_DOT_46 46
+#define LLDB_API_MINOR_VERSION_DOT_47 47
+#define LLDB_API_MINOR_VERSION_DOT_48 48
+#define LLDB_API_MINOR_VERSION_DOT_49 49
+#define LLDB_API_MINOR_VERSION_DOT_50 50
+#define LLDB_API_MINOR_VERSION_DOT_51 51
+#define LLDB_API_MINOR_VERSION_DOT_52 52
+#define LLDB_API_MINOR_VERSION_DOT_53 53
+#define LLDB_API_MINOR_VERSION_DOT_54 54
+#define LLDB_API_MINOR_VERSION_DOT_55 55
+#define LLDB_API_MINOR_VERSION_DOT_56 56
+#define LLDB_API_MINOR_VERSION_DOT_57 57
+#define LLDB_API_MINOR_VERSION_DOT_58 58
+#define LLDB_API_MINOR_VERSION_DOT_59 59
+#define LLDB_API_MINOR_VERSION_DOT_60 60
+#define LLDB_API_MINOR_VERSION_DOT_61 61
+#define LLDB_API_MINOR_VERSION_DOT_62 62
+#define LLDB_API_MINOR_VERSION_DOT_63 63
+#define LLDB_API_MINOR_VERSION_DOT_64 64
+#define LLDB_API_MINOR_VERSION_DOT_65 65
+#define LLDB_API_MINOR_VERSION_DOT_66 66
+#define LLDB_API_MINOR_VERSION_DOT_67 67
+#define LLDB_API_MINOR_VERSION_DOT_68 68
+#define LLDB_API_MINOR_VERSION_DOT_69 69
+#define LLDB_API_MINOR_VERSION_DOT_70 70
+#define LLDB_API_MINOR_VERSION_DOT_71 71
+#define LLDB_API_MINOR_VERSION_DOT_72 72
+#define LLDB_API_MINOR_VERSION_DOT_73 73
+#define LLDB_API_MINOR_VERSION_DOT_74 74
+#define LLDB_API_MINOR_VERSION_DOT_75 75
+#define LLDB_API_MINOR_VERSION_DOT_76 76
+#define LLDB_API_MINOR_VERSION_DOT_77 77
+#define LLDB_API_MINOR_VERSION_DOT_78 78
+#define LLDB_API_MINOR_VERSION_DOT_79 79
+#define LLDB_API_MINOR_VERSION_DOT_80 80
+#define LLDB_API_MINOR_VERSION_DOT_81 81
+#define LLDB_API_MINOR_VERSION_DOT_82 82
+#define LLDB_API_MINOR_VERSION_DOT_83 83
+#define LLDB_API_MINOR_VERSION_DOT_84 84
+#define LLDB_API_MINOR_VERSION_DOT_85 85
+#define LLDB_API_MINOR_VERSION_DOT_86 86
+#define LLDB_API_MINOR_VERSION_DOT_87 87
+#define LLDB_API_MINOR_VERSION_DOT_88 88
+#define LLDB_API_MINOR_VERSION_DOT_89 89
+#define LLDB_API_MINOR_VERSION_DOT_90 90
+#define LLDB_API_MINOR_VERSION_DOT_91 91
+#define LLDB_API_MINOR_VERSION_DOT_92 92
+#define LLDB_API_MINOR_VERSION_DOT_93 93
+#define LLDB_API_MINOR_VERSION_DOT_94 94
+#define LLDB_API_MINOR_VERSION_DOT_95 95
+#define LLDB_API_MINOR_VERSION_DOT_96 96
+#define LLDB_API_MINOR_VERSION_DOT_97 97
+#define LLDB_API_MINOR_VERSION_DOT_98 98
+#define LLDB_API_MINOR_VERSION_DOT_99 99
+
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_0
+#define LLDB_API_NEW_IN_DOT_0 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_0
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_0
+#define LLDB_API_DEPRECATED_IN_DOT_0 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_0
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_1
+#define LLDB_API_NEW_IN_DOT_1 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_1
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_1
+#define LLDB_API_DEPRECATED_IN_DOT_1 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_1
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_2
+#define LLDB_API_NEW_IN_DOT_2 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_2
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_2
+#define LLDB_API_DEPRECATED_IN_DOT_2 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_2
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_3
+#define LLDB_API_NEW_IN_DOT_3 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_3
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_3
+#define LLDB_API_DEPRECATED_IN_DOT_3 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_3
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_4
+#define LLDB_API_NEW_IN_DOT_4 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_4
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_4
+#define LLDB_API_DEPRECATED_IN_DOT_4 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_4
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_5
+#define LLDB_API_NEW_IN_DOT_5 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_5
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_5
+#define LLDB_API_DEPRECATED_IN_DOT_5 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_5
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_6
+#define LLDB_API_NEW_IN_DOT_6 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_6
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_6
+#define LLDB_API_DEPRECATED_IN_DOT_6 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_6
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_7
+#define LLDB_API_NEW_IN_DOT_7 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_7
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_7
+#define LLDB_API_DEPRECATED_IN_DOT_7 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_7
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_8
+#define LLDB_API_NEW_IN_DOT_8 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_8
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_8
+#define LLDB_API_DEPRECATED_IN_DOT_8 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_8
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_9
+#define LLDB_API_NEW_IN_DOT_9 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_9
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_9
+#define LLDB_API_DEPRECATED_IN_DOT_9 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_9
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_10
+#define LLDB_API_NEW_IN_DOT_10 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_10
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_10
+#define LLDB_API_DEPRECATED_IN_DOT_10 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_10
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_11
+#define LLDB_API_NEW_IN_DOT_11 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_11
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_11
+#define LLDB_API_DEPRECATED_IN_DOT_11 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_11
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_12
+#define LLDB_API_NEW_IN_DOT_12 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_12
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_12
+#define LLDB_API_DEPRECATED_IN_DOT_12 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_12
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_13
+#define LLDB_API_NEW_IN_DOT_13 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_13
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_13
+#define LLDB_API_DEPRECATED_IN_DOT_13 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_13
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_14
+#define LLDB_API_NEW_IN_DOT_14 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_14
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_14
+#define LLDB_API_DEPRECATED_IN_DOT_14 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_14
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_15
+#define LLDB_API_NEW_IN_DOT_15 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_15
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_15
+#define LLDB_API_DEPRECATED_IN_DOT_15 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_15
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_16
+#define LLDB_API_NEW_IN_DOT_16 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_16
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_16
+#define LLDB_API_DEPRECATED_IN_DOT_16 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_16
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_17
+#define LLDB_API_NEW_IN_DOT_17 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_17
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_17
+#define LLDB_API_DEPRECATED_IN_DOT_17 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_17
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_18
+#define LLDB_API_NEW_IN_DOT_18 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_18
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_18
+#define LLDB_API_DEPRECATED_IN_DOT_18 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_18
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_19
+#define LLDB_API_NEW_IN_DOT_19 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_19
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_19
+#define LLDB_API_DEPRECATED_IN_DOT_19 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_19
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_20
+#define LLDB_API_NEW_IN_DOT_20 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_20
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_20
+#define LLDB_API_DEPRECATED_IN_DOT_20 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_20
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_21
+#define LLDB_API_NEW_IN_DOT_21 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_21
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_21
+#define LLDB_API_DEPRECATED_IN_DOT_21 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_21
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_22
+#define LLDB_API_NEW_IN_DOT_22 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_22
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_22
+#define LLDB_API_DEPRECATED_IN_DOT_22 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_22
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_23
+#define LLDB_API_NEW_IN_DOT_23 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_23
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_23
+#define LLDB_API_DEPRECATED_IN_DOT_23 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_23
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_24
+#define LLDB_API_NEW_IN_DOT_24 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_24
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_24
+#define LLDB_API_DEPRECATED_IN_DOT_24 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_24
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_25
+#define LLDB_API_NEW_IN_DOT_25 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_25
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_25
+#define LLDB_API_DEPRECATED_IN_DOT_25 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_25
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_26
+#define LLDB_API_NEW_IN_DOT_26 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_26
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_26
+#define LLDB_API_DEPRECATED_IN_DOT_26 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_26
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_27
+#define LLDB_API_NEW_IN_DOT_27 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_27
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_27
+#define LLDB_API_DEPRECATED_IN_DOT_27 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_27
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_28
+#define LLDB_API_NEW_IN_DOT_28 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_28
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_28
+#define LLDB_API_DEPRECATED_IN_DOT_28 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_28
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_29
+#define LLDB_API_NEW_IN_DOT_29 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_29
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_29
+#define LLDB_API_DEPRECATED_IN_DOT_29 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_29
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_30
+#define LLDB_API_NEW_IN_DOT_30 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_30
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_30
+#define LLDB_API_DEPRECATED_IN_DOT_30 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_30
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_31
+#define LLDB_API_NEW_IN_DOT_31 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_31
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_31
+#define LLDB_API_DEPRECATED_IN_DOT_31 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_31
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_32
+#define LLDB_API_NEW_IN_DOT_32 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_32
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_32
+#define LLDB_API_DEPRECATED_IN_DOT_32 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_32
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_33
+#define LLDB_API_NEW_IN_DOT_33 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_33
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_33
+#define LLDB_API_DEPRECATED_IN_DOT_33 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_33
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_34
+#define LLDB_API_NEW_IN_DOT_34 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_34
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_34
+#define LLDB_API_DEPRECATED_IN_DOT_34 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_34
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_35
+#define LLDB_API_NEW_IN_DOT_35 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_35
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_35
+#define LLDB_API_DEPRECATED_IN_DOT_35 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_35
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_36
+#define LLDB_API_NEW_IN_DOT_36 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_36
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_36
+#define LLDB_API_DEPRECATED_IN_DOT_36 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_36
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_37
+#define LLDB_API_NEW_IN_DOT_37 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_37
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_37
+#define LLDB_API_DEPRECATED_IN_DOT_37 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_37
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_38
+#define LLDB_API_NEW_IN_DOT_38 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_38
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_38
+#define LLDB_API_DEPRECATED_IN_DOT_38 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_38
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_39
+#define LLDB_API_NEW_IN_DOT_39 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_39
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_39
+#define LLDB_API_DEPRECATED_IN_DOT_39 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_39
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_40
+#define LLDB_API_NEW_IN_DOT_40 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_40
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_40
+#define LLDB_API_DEPRECATED_IN_DOT_40 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_40
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_41
+#define LLDB_API_NEW_IN_DOT_41 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_41
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_41
+#define LLDB_API_DEPRECATED_IN_DOT_41 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_41
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_42
+#define LLDB_API_NEW_IN_DOT_42 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_42
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_42
+#define LLDB_API_DEPRECATED_IN_DOT_42 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_42
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_43
+#define LLDB_API_NEW_IN_DOT_43 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_43
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_43
+#define LLDB_API_DEPRECATED_IN_DOT_43 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_43
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_44
+#define LLDB_API_NEW_IN_DOT_44 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_44
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_44
+#define LLDB_API_DEPRECATED_IN_DOT_44 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_44
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_45
+#define LLDB_API_NEW_IN_DOT_45 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_45
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_45
+#define LLDB_API_DEPRECATED_IN_DOT_45 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_45
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_46
+#define LLDB_API_NEW_IN_DOT_46 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_46
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_46
+#define LLDB_API_DEPRECATED_IN_DOT_46 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_46
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_47
+#define LLDB_API_NEW_IN_DOT_47 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_47
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_47
+#define LLDB_API_DEPRECATED_IN_DOT_47 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_47
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_48
+#define LLDB_API_NEW_IN_DOT_48 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_48
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_48
+#define LLDB_API_DEPRECATED_IN_DOT_48 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_48
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_49
+#define LLDB_API_NEW_IN_DOT_49 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_49
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_49
+#define LLDB_API_DEPRECATED_IN_DOT_49 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_49
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_50
+#define LLDB_API_NEW_IN_DOT_50 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_50
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_50
+#define LLDB_API_DEPRECATED_IN_DOT_50 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_50
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_51
+#define LLDB_API_NEW_IN_DOT_51 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_51
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_51
+#define LLDB_API_DEPRECATED_IN_DOT_51 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_51
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_52
+#define LLDB_API_NEW_IN_DOT_52 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_52
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_52
+#define LLDB_API_DEPRECATED_IN_DOT_52 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_52
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_53
+#define LLDB_API_NEW_IN_DOT_53 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_53
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_53
+#define LLDB_API_DEPRECATED_IN_DOT_53 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_53
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_54
+#define LLDB_API_NEW_IN_DOT_54 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_54
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_54
+#define LLDB_API_DEPRECATED_IN_DOT_54 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_54
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_55
+#define LLDB_API_NEW_IN_DOT_55 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_55
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_55
+#define LLDB_API_DEPRECATED_IN_DOT_55 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_55
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_56
+#define LLDB_API_NEW_IN_DOT_56 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_56
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_56
+#define LLDB_API_DEPRECATED_IN_DOT_56 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_56
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_57
+#define LLDB_API_NEW_IN_DOT_57 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_57
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_57
+#define LLDB_API_DEPRECATED_IN_DOT_57 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_57
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_58
+#define LLDB_API_NEW_IN_DOT_58 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_58
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_58
+#define LLDB_API_DEPRECATED_IN_DOT_58 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_58
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_59
+#define LLDB_API_NEW_IN_DOT_59 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_59
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_59
+#define LLDB_API_DEPRECATED_IN_DOT_59 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_59
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_60
+#define LLDB_API_NEW_IN_DOT_60 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_60
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_60
+#define LLDB_API_DEPRECATED_IN_DOT_60 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_60
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_61
+#define LLDB_API_NEW_IN_DOT_61 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_61
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_61
+#define LLDB_API_DEPRECATED_IN_DOT_61 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_61
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_62
+#define LLDB_API_NEW_IN_DOT_62 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_62
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_62
+#define LLDB_API_DEPRECATED_IN_DOT_62 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_62
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_63
+#define LLDB_API_NEW_IN_DOT_63 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_63
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_63
+#define LLDB_API_DEPRECATED_IN_DOT_63 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_63
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_64
+#define LLDB_API_NEW_IN_DOT_64 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_64
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_64
+#define LLDB_API_DEPRECATED_IN_DOT_64 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_64
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_65
+#define LLDB_API_NEW_IN_DOT_65 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_65
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_65
+#define LLDB_API_DEPRECATED_IN_DOT_65 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_65
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_66
+#define LLDB_API_NEW_IN_DOT_66 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_66
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_66
+#define LLDB_API_DEPRECATED_IN_DOT_66 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_66
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_67
+#define LLDB_API_NEW_IN_DOT_67 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_67
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_67
+#define LLDB_API_DEPRECATED_IN_DOT_67 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_67
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_68
+#define LLDB_API_NEW_IN_DOT_68 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_68
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_68
+#define LLDB_API_DEPRECATED_IN_DOT_68 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_68
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_69
+#define LLDB_API_NEW_IN_DOT_69 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_69
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_69
+#define LLDB_API_DEPRECATED_IN_DOT_69 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_69
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_70
+#define LLDB_API_NEW_IN_DOT_70 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_70
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_70
+#define LLDB_API_DEPRECATED_IN_DOT_70 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_70
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_71
+#define LLDB_API_NEW_IN_DOT_71 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_71
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_71
+#define LLDB_API_DEPRECATED_IN_DOT_71 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_71
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_72
+#define LLDB_API_NEW_IN_DOT_72 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_72
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_72
+#define LLDB_API_DEPRECATED_IN_DOT_72 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_72
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_73
+#define LLDB_API_NEW_IN_DOT_73 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_73
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_73
+#define LLDB_API_DEPRECATED_IN_DOT_73 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_73
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_74
+#define LLDB_API_NEW_IN_DOT_74 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_74
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_74
+#define LLDB_API_DEPRECATED_IN_DOT_74 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_74
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_75
+#define LLDB_API_NEW_IN_DOT_75 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_75
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_75
+#define LLDB_API_DEPRECATED_IN_DOT_75 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_75
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_76
+#define LLDB_API_NEW_IN_DOT_76 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_76
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_76
+#define LLDB_API_DEPRECATED_IN_DOT_76 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_76
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_77
+#define LLDB_API_NEW_IN_DOT_77 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_77
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_77
+#define LLDB_API_DEPRECATED_IN_DOT_77 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_77
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_78
+#define LLDB_API_NEW_IN_DOT_78 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_78
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_78
+#define LLDB_API_DEPRECATED_IN_DOT_78 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_78
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_79
+#define LLDB_API_NEW_IN_DOT_79 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_79
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_79
+#define LLDB_API_DEPRECATED_IN_DOT_79 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_79
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_80
+#define LLDB_API_NEW_IN_DOT_80 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_80
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_80
+#define LLDB_API_DEPRECATED_IN_DOT_80 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_80
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_81
+#define LLDB_API_NEW_IN_DOT_81 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_81
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_81
+#define LLDB_API_DEPRECATED_IN_DOT_81 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_81
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_82
+#define LLDB_API_NEW_IN_DOT_82 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_82
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_82
+#define LLDB_API_DEPRECATED_IN_DOT_82 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_82
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_83
+#define LLDB_API_NEW_IN_DOT_83 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_83
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_83
+#define LLDB_API_DEPRECATED_IN_DOT_83 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_83
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_84
+#define LLDB_API_NEW_IN_DOT_84 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_84
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_84
+#define LLDB_API_DEPRECATED_IN_DOT_84 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_84
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_85
+#define LLDB_API_NEW_IN_DOT_85 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_85
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_85
+#define LLDB_API_DEPRECATED_IN_DOT_85 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_85
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_86
+#define LLDB_API_NEW_IN_DOT_86 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_86
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_86
+#define LLDB_API_DEPRECATED_IN_DOT_86 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_86
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_87
+#define LLDB_API_NEW_IN_DOT_87 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_87
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_87
+#define LLDB_API_DEPRECATED_IN_DOT_87 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_87
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_88
+#define LLDB_API_NEW_IN_DOT_88 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_88
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_88
+#define LLDB_API_DEPRECATED_IN_DOT_88 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_88
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_89
+#define LLDB_API_NEW_IN_DOT_89 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_89
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_89
+#define LLDB_API_DEPRECATED_IN_DOT_89 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_89
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_90
+#define LLDB_API_NEW_IN_DOT_90 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_90
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_90
+#define LLDB_API_DEPRECATED_IN_DOT_90 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_90
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_91
+#define LLDB_API_NEW_IN_DOT_91 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_91
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_91
+#define LLDB_API_DEPRECATED_IN_DOT_91 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_91
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_92
+#define LLDB_API_NEW_IN_DOT_92 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_92
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_92
+#define LLDB_API_DEPRECATED_IN_DOT_92 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_92
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_93
+#define LLDB_API_NEW_IN_DOT_93 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_93
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_93
+#define LLDB_API_DEPRECATED_IN_DOT_93 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_93
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_94
+#define LLDB_API_NEW_IN_DOT_94 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_94
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_94
+#define LLDB_API_DEPRECATED_IN_DOT_94 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_94
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_95
+#define LLDB_API_NEW_IN_DOT_95 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_95
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_95
+#define LLDB_API_DEPRECATED_IN_DOT_95 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_95
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_96
+#define LLDB_API_NEW_IN_DOT_96 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_96
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_96
+#define LLDB_API_DEPRECATED_IN_DOT_96 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_96
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_97
+#define LLDB_API_NEW_IN_DOT_97 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_97
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_97
+#define LLDB_API_DEPRECATED_IN_DOT_97 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_97
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_98
+#define LLDB_API_NEW_IN_DOT_98 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_98
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_98
+#define LLDB_API_DEPRECATED_IN_DOT_98 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_98
+#endif
+#if LLDB_API_MINOR_VERSION_WANTED < LLDB_API_MINOR_VERSION_DOT_99
+#define LLDB_API_NEW_IN_DOT_99 LLDB_API_IMPL_TOONEW
+#else
+#define LLDB_API_NEW_IN_DOT_99
+#endif
+
+#if LLDB_API_MINOR_VERSION_WANTED >= LLDB_API_MINOR_VERSION_DOT_99
+#define LLDB_API_DEPRECATED_IN_DOT_99 LLDB_API_IMPL_DEPRECATED
+#else
+#define LLDB_API_DEPRECATED_IN_DOT_99
+#endif
+
+#else // defined(LLDB_CHECK_API_VERSIONING) &&
+ // defined(LLDB_API_MAJOR_VERSION_WANTED) &&
+ // defined(LLDB_API_MINOR_VERSION_WANTED) && defined
+ // (LLDB_API_MAJOR_VERSION)
+
+#define LLDB_API_NEW_IN_DOT_0
+#define LLDB_API_DEPRECATED_IN_DOT_0
+#define LLDB_API_NEW_IN_DOT_1
+#define LLDB_API_DEPRECATED_IN_DOT_1
+#define LLDB_API_NEW_IN_DOT_2
+#define LLDB_API_DEPRECATED_IN_DOT_2
+#define LLDB_API_NEW_IN_DOT_3
+#define LLDB_API_DEPRECATED_IN_DOT_3
+#define LLDB_API_NEW_IN_DOT_4
+#define LLDB_API_DEPRECATED_IN_DOT_4
+#define LLDB_API_NEW_IN_DOT_5
+#define LLDB_API_DEPRECATED_IN_DOT_5
+#define LLDB_API_NEW_IN_DOT_6
+#define LLDB_API_DEPRECATED_IN_DOT_6
+#define LLDB_API_NEW_IN_DOT_7
+#define LLDB_API_DEPRECATED_IN_DOT_7
+#define LLDB_API_NEW_IN_DOT_8
+#define LLDB_API_DEPRECATED_IN_DOT_8
+#define LLDB_API_NEW_IN_DOT_9
+#define LLDB_API_DEPRECATED_IN_DOT_9
+#define LLDB_API_NEW_IN_DOT_10
+#define LLDB_API_DEPRECATED_IN_DOT_10
+#define LLDB_API_NEW_IN_DOT_11
+#define LLDB_API_DEPRECATED_IN_DOT_11
+#define LLDB_API_NEW_IN_DOT_12
+#define LLDB_API_DEPRECATED_IN_DOT_12
+#define LLDB_API_NEW_IN_DOT_13
+#define LLDB_API_DEPRECATED_IN_DOT_13
+#define LLDB_API_NEW_IN_DOT_14
+#define LLDB_API_DEPRECATED_IN_DOT_14
+#define LLDB_API_NEW_IN_DOT_15
+#define LLDB_API_DEPRECATED_IN_DOT_15
+#define LLDB_API_NEW_IN_DOT_16
+#define LLDB_API_DEPRECATED_IN_DOT_16
+#define LLDB_API_NEW_IN_DOT_17
+#define LLDB_API_DEPRECATED_IN_DOT_17
+#define LLDB_API_NEW_IN_DOT_18
+#define LLDB_API_DEPRECATED_IN_DOT_18
+#define LLDB_API_NEW_IN_DOT_19
+#define LLDB_API_DEPRECATED_IN_DOT_19
+#define LLDB_API_NEW_IN_DOT_20
+#define LLDB_API_DEPRECATED_IN_DOT_20
+#define LLDB_API_NEW_IN_DOT_21
+#define LLDB_API_DEPRECATED_IN_DOT_21
+#define LLDB_API_NEW_IN_DOT_22
+#define LLDB_API_DEPRECATED_IN_DOT_22
+#define LLDB_API_NEW_IN_DOT_23
+#define LLDB_API_DEPRECATED_IN_DOT_23
+#define LLDB_API_NEW_IN_DOT_24
+#define LLDB_API_DEPRECATED_IN_DOT_24
+#define LLDB_API_NEW_IN_DOT_25
+#define LLDB_API_DEPRECATED_IN_DOT_25
+#define LLDB_API_NEW_IN_DOT_26
+#define LLDB_API_DEPRECATED_IN_DOT_26
+#define LLDB_API_NEW_IN_DOT_27
+#define LLDB_API_DEPRECATED_IN_DOT_27
+#define LLDB_API_NEW_IN_DOT_28
+#define LLDB_API_DEPRECATED_IN_DOT_28
+#define LLDB_API_NEW_IN_DOT_29
+#define LLDB_API_DEPRECATED_IN_DOT_29
+#define LLDB_API_NEW_IN_DOT_30
+#define LLDB_API_DEPRECATED_IN_DOT_30
+#define LLDB_API_NEW_IN_DOT_31
+#define LLDB_API_DEPRECATED_IN_DOT_31
+#define LLDB_API_NEW_IN_DOT_32
+#define LLDB_API_DEPRECATED_IN_DOT_32
+#define LLDB_API_NEW_IN_DOT_33
+#define LLDB_API_DEPRECATED_IN_DOT_33
+#define LLDB_API_NEW_IN_DOT_34
+#define LLDB_API_DEPRECATED_IN_DOT_34
+#define LLDB_API_NEW_IN_DOT_35
+#define LLDB_API_DEPRECATED_IN_DOT_35
+#define LLDB_API_NEW_IN_DOT_36
+#define LLDB_API_DEPRECATED_IN_DOT_36
+#define LLDB_API_NEW_IN_DOT_37
+#define LLDB_API_DEPRECATED_IN_DOT_37
+#define LLDB_API_NEW_IN_DOT_38
+#define LLDB_API_DEPRECATED_IN_DOT_38
+#define LLDB_API_NEW_IN_DOT_39
+#define LLDB_API_DEPRECATED_IN_DOT_39
+#define LLDB_API_NEW_IN_DOT_40
+#define LLDB_API_DEPRECATED_IN_DOT_40
+#define LLDB_API_NEW_IN_DOT_41
+#define LLDB_API_DEPRECATED_IN_DOT_41
+#define LLDB_API_NEW_IN_DOT_42
+#define LLDB_API_DEPRECATED_IN_DOT_42
+#define LLDB_API_NEW_IN_DOT_43
+#define LLDB_API_DEPRECATED_IN_DOT_43
+#define LLDB_API_NEW_IN_DOT_44
+#define LLDB_API_DEPRECATED_IN_DOT_44
+#define LLDB_API_NEW_IN_DOT_45
+#define LLDB_API_DEPRECATED_IN_DOT_45
+#define LLDB_API_NEW_IN_DOT_46
+#define LLDB_API_DEPRECATED_IN_DOT_46
+#define LLDB_API_NEW_IN_DOT_47
+#define LLDB_API_DEPRECATED_IN_DOT_47
+#define LLDB_API_NEW_IN_DOT_48
+#define LLDB_API_DEPRECATED_IN_DOT_48
+#define LLDB_API_NEW_IN_DOT_49
+#define LLDB_API_DEPRECATED_IN_DOT_49
+#define LLDB_API_NEW_IN_DOT_50
+#define LLDB_API_DEPRECATED_IN_DOT_50
+#define LLDB_API_NEW_IN_DOT_51
+#define LLDB_API_DEPRECATED_IN_DOT_51
+#define LLDB_API_NEW_IN_DOT_52
+#define LLDB_API_DEPRECATED_IN_DOT_52
+#define LLDB_API_NEW_IN_DOT_53
+#define LLDB_API_DEPRECATED_IN_DOT_53
+#define LLDB_API_NEW_IN_DOT_54
+#define LLDB_API_DEPRECATED_IN_DOT_54
+#define LLDB_API_NEW_IN_DOT_55
+#define LLDB_API_DEPRECATED_IN_DOT_55
+#define LLDB_API_NEW_IN_DOT_56
+#define LLDB_API_DEPRECATED_IN_DOT_56
+#define LLDB_API_NEW_IN_DOT_57
+#define LLDB_API_DEPRECATED_IN_DOT_57
+#define LLDB_API_NEW_IN_DOT_58
+#define LLDB_API_DEPRECATED_IN_DOT_58
+#define LLDB_API_NEW_IN_DOT_59
+#define LLDB_API_DEPRECATED_IN_DOT_59
+#define LLDB_API_NEW_IN_DOT_60
+#define LLDB_API_DEPRECATED_IN_DOT_60
+#define LLDB_API_NEW_IN_DOT_61
+#define LLDB_API_DEPRECATED_IN_DOT_61
+#define LLDB_API_NEW_IN_DOT_62
+#define LLDB_API_DEPRECATED_IN_DOT_62
+#define LLDB_API_NEW_IN_DOT_63
+#define LLDB_API_DEPRECATED_IN_DOT_63
+#define LLDB_API_NEW_IN_DOT_64
+#define LLDB_API_DEPRECATED_IN_DOT_64
+#define LLDB_API_NEW_IN_DOT_65
+#define LLDB_API_DEPRECATED_IN_DOT_65
+#define LLDB_API_NEW_IN_DOT_66
+#define LLDB_API_DEPRECATED_IN_DOT_66
+#define LLDB_API_NEW_IN_DOT_67
+#define LLDB_API_DEPRECATED_IN_DOT_67
+#define LLDB_API_NEW_IN_DOT_68
+#define LLDB_API_DEPRECATED_IN_DOT_68
+#define LLDB_API_NEW_IN_DOT_69
+#define LLDB_API_DEPRECATED_IN_DOT_69
+#define LLDB_API_NEW_IN_DOT_70
+#define LLDB_API_DEPRECATED_IN_DOT_70
+#define LLDB_API_NEW_IN_DOT_71
+#define LLDB_API_DEPRECATED_IN_DOT_71
+#define LLDB_API_NEW_IN_DOT_72
+#define LLDB_API_DEPRECATED_IN_DOT_72
+#define LLDB_API_NEW_IN_DOT_73
+#define LLDB_API_DEPRECATED_IN_DOT_73
+#define LLDB_API_NEW_IN_DOT_74
+#define LLDB_API_DEPRECATED_IN_DOT_74
+#define LLDB_API_NEW_IN_DOT_75
+#define LLDB_API_DEPRECATED_IN_DOT_75
+#define LLDB_API_NEW_IN_DOT_76
+#define LLDB_API_DEPRECATED_IN_DOT_76
+#define LLDB_API_NEW_IN_DOT_77
+#define LLDB_API_DEPRECATED_IN_DOT_77
+#define LLDB_API_NEW_IN_DOT_78
+#define LLDB_API_DEPRECATED_IN_DOT_78
+#define LLDB_API_NEW_IN_DOT_79
+#define LLDB_API_DEPRECATED_IN_DOT_79
+#define LLDB_API_NEW_IN_DOT_80
+#define LLDB_API_DEPRECATED_IN_DOT_80
+#define LLDB_API_NEW_IN_DOT_81
+#define LLDB_API_DEPRECATED_IN_DOT_81
+#define LLDB_API_NEW_IN_DOT_82
+#define LLDB_API_DEPRECATED_IN_DOT_82
+#define LLDB_API_NEW_IN_DOT_83
+#define LLDB_API_DEPRECATED_IN_DOT_83
+#define LLDB_API_NEW_IN_DOT_84
+#define LLDB_API_DEPRECATED_IN_DOT_84
+#define LLDB_API_NEW_IN_DOT_85
+#define LLDB_API_DEPRECATED_IN_DOT_85
+#define LLDB_API_NEW_IN_DOT_86
+#define LLDB_API_DEPRECATED_IN_DOT_86
+#define LLDB_API_NEW_IN_DOT_87
+#define LLDB_API_DEPRECATED_IN_DOT_87
+#define LLDB_API_NEW_IN_DOT_88
+#define LLDB_API_DEPRECATED_IN_DOT_88
+#define LLDB_API_NEW_IN_DOT_89
+#define LLDB_API_DEPRECATED_IN_DOT_89
+#define LLDB_API_NEW_IN_DOT_90
+#define LLDB_API_DEPRECATED_IN_DOT_90
+#define LLDB_API_NEW_IN_DOT_91
+#define LLDB_API_DEPRECATED_IN_DOT_91
+#define LLDB_API_NEW_IN_DOT_92
+#define LLDB_API_DEPRECATED_IN_DOT_92
+#define LLDB_API_NEW_IN_DOT_93
+#define LLDB_API_DEPRECATED_IN_DOT_93
+#define LLDB_API_NEW_IN_DOT_94
+#define LLDB_API_DEPRECATED_IN_DOT_94
+#define LLDB_API_NEW_IN_DOT_95
+#define LLDB_API_DEPRECATED_IN_DOT_95
+#define LLDB_API_NEW_IN_DOT_96
+#define LLDB_API_DEPRECATED_IN_DOT_96
+#define LLDB_API_NEW_IN_DOT_97
+#define LLDB_API_DEPRECATED_IN_DOT_97
+#define LLDB_API_NEW_IN_DOT_98
+#define LLDB_API_DEPRECATED_IN_DOT_98
+#define LLDB_API_NEW_IN_DOT_99
+#define LLDB_API_DEPRECATED_IN_DOT_99
+#endif // defined(LLDB_CHECK_API_VERSIONING) &&
+ // defined(LLDB_API_MAJOR_VERSION_WANTED) &&
+ // defined(LLDB_API_MINOR_VERSION_WANTED) && defined
+ // (LLDB_API_MAJOR_VERSION)
+
+#endif // LLDB_lldb_versioning_h_