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