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/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_