Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/lldb/Host/Config.h b/linux-x64/clang/include/lldb/Host/Config.h
index 12f73c4..45f9161 100644
--- a/linux-x64/clang/include/lldb/Host/Config.h
+++ b/linux-x64/clang/include/lldb/Host/Config.h
@@ -9,15 +9,10 @@
#ifndef LLDB_HOST_CONFIG_H
#define LLDB_HOST_CONFIG_H
-#define LLDB_CONFIG_TERMIOS_SUPPORTED
+#define LLDB_EDITLINE_USE_WCHAR 1
-#define LLDB_EDITLINE_USE_WCHAR 0
+#define LLDB_HAVE_EL_RFUNC_T 1
-#define LLDB_HAVE_EL_RFUNC_T 0
-
-/* #undef LLDB_DISABLE_POSIX */
-
-#define LLDB_LIBDIR_SUFFIX "64"
#define HAVE_SYS_TYPES_H 1
@@ -25,6 +20,8 @@
#define HAVE_PPOLL 1
+#define HAVE_PTSNAME_R 1
+
#define HAVE_SIGACTION 1
#define HAVE_PROCESS_VM_READV 1
@@ -35,4 +32,28 @@
/* #undef HAVE_LIBCOMPRESSION */
#endif
+#define LLDB_ENABLE_POSIX 1
+
+#define LLDB_ENABLE_TERMIOS 1
+
+#define LLDB_ENABLE_LZMA 1
+
+#define LLDB_ENABLE_CURSES 1
+
+#define CURSES_HAVE_NCURSES_CURSES_H 0
+
+#define LLDB_ENABLE_LIBEDIT 1
+
+#define LLDB_ENABLE_LIBXML2 1
+
+#define LLDB_ENABLE_LUA 0
+
+#define LLDB_ENABLE_PYTHON 1
+
+#define LLDB_EMBED_PYTHON_HOME 0
+
+/* #undef LLDB_PYTHON_HOME */
+
+#define LLDB_LIBDIR_SUFFIX "64"
+
#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
index 00444d0..ff6bcc4 100644
--- a/linux-x64/clang/include/lldb/Host/ConnectionFileDescriptor.h
+++ b/linux-x64/clang/include/lldb/Host/ConnectionFileDescriptor.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_ConnectionFileDescriptor_h_
-#define liblldb_Host_ConnectionFileDescriptor_h_
+#ifndef LLDB_HOST_CONNECTIONFILEDESCRIPTOR_H
+#define LLDB_HOST_CONNECTIONFILEDESCRIPTOR_H
#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
diff --git a/linux-x64/clang/include/lldb/Host/Debug.h b/linux-x64/clang/include/lldb/Host/Debug.h
index 036ce1e..402325c 100644
--- a/linux-x64/clang/include/lldb/Host/Debug.h
+++ b/linux-x64/clang/include/lldb/Host/Debug.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Debug_h_
-#define liblldb_Debug_h_
+#ifndef LLDB_HOST_DEBUG_H
+#define LLDB_HOST_DEBUG_H
#include <vector>
@@ -148,4 +148,4 @@
};
}
-#endif // liblldb_Debug_h_
+#endif // LLDB_HOST_DEBUG_H
diff --git a/linux-x64/clang/include/lldb/Host/Editline.h b/linux-x64/clang/include/lldb/Host/Editline.h
index a942ede..a37ad1b 100644
--- a/linux-x64/clang/include/lldb/Host/Editline.h
+++ b/linux-x64/clang/include/lldb/Host/Editline.h
@@ -19,19 +19,18 @@
// 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
+// broken, which is why we're working around it here.
+// c) 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
+// d) Emoji support is fairly terrible, presumably it doesn't understand
// composed characters?
-#ifndef liblldb_Editline_h_
-#define liblldb_Editline_h_
+#ifndef LLDB_HOST_EDITLINE_H
+#define LLDB_HOST_EDITLINE_H
#if defined(__cplusplus)
+#include "lldb/Host/Config.h"
+
#if LLDB_EDITLINE_USE_WCHAR
#include <codecvt>
#endif
@@ -48,11 +47,13 @@
#include <histedit.h>
#endif
+#include <csignal>
#include <mutex>
#include <string>
#include <vector>
#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Predicate.h"
@@ -97,11 +98,10 @@
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);
+typedef llvm::Optional<std::string> (*SuggestionCallbackType)(
+ llvm::StringRef line, void *baton);
+
+typedef void (*CompleteCallbackType)(CompletionRequest &request, void *baton);
/// Status used to decide when and how to start editing another line in
/// multi-line sessions
@@ -136,6 +136,15 @@
/// session
BlockEnd
};
+
+/// Operation for the history.
+enum class HistoryOperation {
+ Oldest,
+ Older,
+ Current,
+ Newer,
+ Newest
+};
}
using namespace line_editor;
@@ -163,9 +172,7 @@
/// 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.
+ /// Call when the terminal size changes
void TerminalSizeChanged();
/// Returns the prompt established by SetPrompt()
@@ -180,6 +187,9 @@
/// Cancel this edit and oblitarate all trace of it
bool Cancel();
+ /// Register a callback for autosuggestion.
+ void SetSuggestionCallback(SuggestionCallbackType callback, void *baton);
+
/// Register a callback for the tab key
void SetAutoCompleteCallback(CompleteCallbackType callback, void *baton);
@@ -261,11 +271,7 @@
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);
+ unsigned char RecallHistory(HistoryOperation op);
/// Character reading implementation for EditLine that supports our multi-line
/// editing trickery.
@@ -312,6 +318,12 @@
/// tab key is typed.
unsigned char TabCommand(int ch);
+ /// Apply autosuggestion part in gray as editline.
+ unsigned char ApplyAutosuggestCommand(int ch);
+
+ /// Command used when a character is typed.
+ unsigned char TypedCharacter(int ch);
+
/// Respond to normal character insertion by fixing line indentation
unsigned char FixIndentationCommand(int ch);
@@ -324,7 +336,8 @@
bool CompleteCharacter(char ch, EditLineGetCharType &out);
-private:
+ void ApplyTerminalSizeChange();
+
#if LLDB_EDITLINE_USE_WCHAR
std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
#endif
@@ -346,6 +359,7 @@
std::string m_set_continuation_prompt;
std::string m_current_prompt;
bool m_needs_prompt_repaint = false;
+ volatile std::sig_atomic_t m_terminal_size_has_changed = 0;
std::string m_editor_name;
FILE *m_input_file;
FILE *m_output_file;
@@ -358,10 +372,12 @@
const char *m_fix_indentation_callback_chars = nullptr;
CompleteCallbackType m_completion_callback = nullptr;
void *m_completion_callback_baton = nullptr;
-
+ SuggestionCallbackType m_suggestion_callback = nullptr;
+ void *m_suggestion_callback_baton = nullptr;
+ std::size_t m_previous_autosuggestion_size = 0;
std::mutex m_output_mutex;
};
}
#endif // #if defined(__cplusplus)
-#endif // liblldb_Editline_h_
+#endif // LLDB_HOST_EDITLINE_H
diff --git a/linux-x64/clang/include/lldb/Host/File.h b/linux-x64/clang/include/lldb/Host/File.h
index eb28c4a..d205a3f 100644
--- a/linux-x64/clang/include/lldb/Host/File.h
+++ b/linux-x64/clang/include/lldb/Host/File.h
@@ -6,13 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_File_h_
-#define liblldb_File_h_
+#ifndef LLDB_HOST_FILE_H
+#define LLDB_HOST_FILE_H
#include "lldb/Host/PosixApi.h"
#include "lldb/Utility/IOObject.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-private.h"
+#include "llvm/ADT/BitmaskEnum.h"
#include <mutex>
#include <stdarg.h>
@@ -21,11 +22,15 @@
namespace lldb_private {
+LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
+
/// \class File File.h "lldb/Host/File.h"
-/// A file class.
+/// An abstract base class for files.
///
-/// A file class that divides abstracts the LLDB core from host file
-/// functionality.
+/// Files will often be NativeFiles, which provides a wrapper
+/// around host OS file functionality. But it
+/// is also possible to subclass file to provide objects that have file
+/// or stream functionality but are not backed by any host OS file.
class File : public IOObject {
public:
static int kInvalidDescriptor;
@@ -33,7 +38,12 @@
// NB this enum is used in the lldb platform gdb-remote packet
// vFile:open: and existing values cannot be modified.
- enum OpenOptions {
+ //
+ // FIXME
+ // These values do not match the values used by GDB
+ // * https://sourceware.org/gdb/onlinedocs/gdb/Open-Flags.html#Open-Flags
+ // * rdar://problem/46788934
+ enum OpenOptions : uint32_t {
eOpenOptionRead = (1u << 0), // Open file for reading
eOpenOptionWrite = (1u << 1), // Open file for writing
eOpenOptionAppend =
@@ -45,129 +55,102 @@
(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
+ (1u << 8), // Close the file when executing a new process
+ LLVM_MARK_AS_BITMASK_ENUM(/* largest_value= */ eOpenOptionCloseOnExec)
};
- static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
+ static mode_t ConvertOpenOptionsForPOSIXOpen(OpenOptions open_options);
+ static llvm::Expected<OpenOptions> GetOptionsFromMode(llvm::StringRef mode);
+ static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
+ static llvm::Expected<const char *>
+ GetStreamOpenModeFromOptions(OpenOptions options);
File()
- : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
- m_stream(kInvalidStream), m_options(0), m_own_stream(false),
- m_is_interactive(eLazyBoolCalculate),
+ : IOObject(eFDTypeFile), m_is_interactive(eLazyBoolCalculate),
m_is_real_terminal(eLazyBoolCalculate),
- m_supports_colors(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.
+ /// Read bytes from a file from the current file position into buf.
///
/// 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.
+ /// Pass in the size of buf. Read will pass out the number
+ /// of bytes read. Zero bytes read with no error indicates
+ /// EOF.
///
/// \return
- /// An error object that indicates success or the reason for
- /// failure.
+ /// success, ENOTSUP, or another error.
Status Read(void *buf, size_t &num_bytes) override;
- /// Write bytes to a file at the current file position.
+ /// Write bytes from buf 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.
+ /// Pass in the size of buf. Write will pass out the number
+ /// of bytes written. Write will attempt write the full number
+ /// of bytes and will not return early except on error.
///
/// \return
- /// An error object that indicates success or the reason for
- /// failure.
+ /// success, ENOTSUP, or another error.
Status Write(const void *buf, size_t &num_bytes) override;
+ /// IsValid
+ ///
+ /// \return
+ /// true iff the file is valid.
+ bool IsValid() const override;
+
+ /// Flush any buffers and release any resources owned by the file.
+ /// After Close() the file will be invalid.
+ ///
+ /// \return
+ /// success or an error.
+ Status Close() override;
+
+ /// Get a handle that can be used for OS polling interfaces, such
+ /// as WaitForMultipleObjects, select, or epoll. This may return
+ /// IOObject::kInvalidHandleValue if none is available. This will
+ /// generally be the same as the file descriptor, this function
+ /// is not interchangeable with GetDescriptor(). A WaitableHandle
+ /// must only be used for polling, not actual I/O.
+ ///
+ /// \return
+ /// a valid handle or IOObject::kInvalidHandleValue
+ WaitableHandle GetWaitableHandle() override;
+
+ /// Get the file specification for this file, if possible.
+ ///
+ /// \param[out] file_spec
+ /// the file specification.
+ /// \return
+ /// ENOTSUP, success, or another error.
+ virtual Status GetFileSpec(FileSpec &file_spec) const;
+
+ /// Get underlying OS file descriptor for this file, or kInvalidDescriptor.
+ /// If the descriptor is valid, then it may be used directly for I/O
+ /// However, the File may also perform it's own buffering, so avoid using
+ /// this if it is not necessary, or use Flush() appropriately.
+ ///
+ /// \return
+ /// a valid file descriptor for this file or kInvalidDescriptor
+ virtual int GetDescriptor() const;
+
+ /// Get the underlying libc stream for this file, or NULL.
+ ///
+ /// Not all valid files will have a FILE* stream. This should only be
+ /// used if absolutely necessary, such as to interact with 3rd party
+ /// libraries that need FILE* streams.
+ ///
+ /// \return
+ /// a valid stream or NULL;
+ virtual FILE *GetStream();
+
/// Seek to an offset relative to the beginning of the file.
///
/// NOTE: This function is NOT thread safe, other threads that
@@ -186,7 +169,7 @@
///
/// \return
/// The resulting seek offset, or -1 on error.
- off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr);
+ virtual off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr);
/// Seek to an offset relative to the current file position.
///
@@ -206,7 +189,7 @@
///
/// \return
/// The resulting seek offset, or -1 on error.
- off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr);
+ virtual off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr);
/// Seek to an offset relative to the end of the file.
///
@@ -227,7 +210,7 @@
///
/// \return
/// The resulting seek offset, or -1 on error.
- off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr);
+ virtual off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr);
/// Read bytes from a file from the specified file offset.
///
@@ -250,37 +233,7 @@
/// \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);
+ virtual Status Read(void *dst, size_t &num_bytes, off_t &offset);
/// Write bytes to a file at the specified file offset.
///
@@ -305,21 +258,67 @@
/// \return
/// An error object that indicates success or the reason for
/// failure.
- Status Write(const void *src, size_t &num_bytes, off_t &offset);
+ virtual 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();
+ virtual Status Flush();
/// Sync to disk.
///
/// \return
/// An error object that indicates success or the reason for
/// failure.
- Status Sync();
+ virtual Status Sync();
+
+ /// Output printf formatted output to the stream.
+ ///
+ /// NOTE: this is not virtual, because it just calls the va_list
+ /// version of the function.
+ ///
+ /// 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)));
+
+ /// Output printf formatted output to the stream.
+ ///
+ /// Print some formatted output to the stream.
+ ///
+ /// \param[in] format
+ /// A printf style format string.
+ ///
+ /// \param[in] args
+ /// Variable arguments that are needed for the printf style
+ /// format string \a format.
+ virtual size_t PrintfVarArg(const char *format, va_list args);
+
+ /// Return the OpenOptions for this file.
+ ///
+ /// Some options like eOpenOptionDontFollowSymlinks only make
+ /// sense when a file is being opened (or not at all)
+ /// and may not be preserved for this method. But any valid
+ /// File should return either or both of eOpenOptionRead and
+ /// eOpenOptionWrite here.
+ ///
+ /// \return
+ /// OpenOptions flags for this file, or an error.
+ virtual llvm::Expected<OpenOptions> GetOptions() const;
+
+ llvm::Expected<const char *> GetOpenMode() const {
+ auto opts = GetOptions();
+ if (!opts)
+ return opts.takeError();
+ return GetStreamOpenModeFromOptions(opts.get());
+ }
/// Get the permissions for a this file.
///
@@ -346,47 +345,94 @@
/// a non-zero width and height, false otherwise.
bool GetIsRealTerminal();
+ /// Return true if this file is a terminal which supports colors.
+ ///
+ /// \return
+ /// True iff this is a terminal and it supports colors.
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)));
+ operator bool() const { return IsValid(); };
- size_t PrintfVarArg(const char *format, va_list args);
+ bool operator!() const { return !IsValid(); };
- void SetOptions(uint32_t options) { m_options = options; }
-
- static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
+ static char ID;
+ virtual bool isA(const void *classID) const { return classID == &ID; }
+ static bool classof(const File *file) { return file->isA(&ID); }
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;
+
+ void CalculateInteractiveAndTerminal();
+
+private:
+ File(const File &) = delete;
+ const File &operator=(const File &) = delete;
+};
+
+class NativeFile : public File {
+public:
+ NativeFile()
+ : m_descriptor(kInvalidDescriptor), m_own_descriptor(false),
+ m_stream(kInvalidStream), m_options(), m_own_stream(false) {}
+
+ NativeFile(FILE *fh, bool transfer_ownership)
+ : m_descriptor(kInvalidDescriptor), m_own_descriptor(false), m_stream(fh),
+ m_options(), m_own_stream(transfer_ownership) {}
+
+ NativeFile(int fd, OpenOptions options, bool transfer_ownership)
+ : m_descriptor(fd), m_own_descriptor(transfer_ownership),
+ m_stream(kInvalidStream), m_options(options), m_own_stream(false) {}
+
+ ~NativeFile() override { Close(); }
+
+ bool IsValid() const override {
+ return DescriptorIsValid() || StreamIsValid();
+ }
+
+ Status Read(void *buf, size_t &num_bytes) override;
+ Status Write(const void *buf, size_t &num_bytes) override;
+ Status Close() override;
+ WaitableHandle GetWaitableHandle() override;
+ Status GetFileSpec(FileSpec &file_spec) const override;
+ int GetDescriptor() const override;
+ FILE *GetStream() override;
+ off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr) override;
+ off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr) override;
+ off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr) override;
+ Status Read(void *dst, size_t &num_bytes, off_t &offset) override;
+ Status Write(const void *src, size_t &num_bytes, off_t &offset) override;
+ Status Flush() override;
+ Status Sync() override;
+ size_t PrintfVarArg(const char *format, va_list args) override;
+ llvm::Expected<OpenOptions> GetOptions() const override;
+
+ static char ID;
+ virtual bool isA(const void *classID) const override {
+ return classID == &ID || File::isA(classID);
+ }
+ static bool classof(const File *file) { return file->isA(&ID); }
+
+protected:
+ bool DescriptorIsValid() const {
+ return File::DescriptorIsValid(m_descriptor);
+ }
+ bool StreamIsValid() const { return m_stream != kInvalidStream; }
+
+ // Member variables
+ int m_descriptor;
+ bool m_own_descriptor;
+ FILE *m_stream;
+ OpenOptions m_options;
+ bool m_own_stream;
std::mutex offset_access_mutex;
private:
- DISALLOW_COPY_AND_ASSIGN(File);
+ NativeFile(const NativeFile &) = delete;
+ const NativeFile &operator=(const NativeFile &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_File_h_
+#endif // LLDB_HOST_FILE_H
diff --git a/linux-x64/clang/include/lldb/Host/FileCache.h b/linux-x64/clang/include/lldb/Host/FileCache.h
index 0c1ef19..df0d9a8 100644
--- a/linux-x64/clang/include/lldb/Host/FileCache.h
+++ b/linux-x64/clang/include/lldb/Host/FileCache.h
@@ -5,8 +5,8 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_FileCache_h
-#define liblldb_Host_FileCache_h
+#ifndef LLDB_HOST_FILECACHE_H
+#define LLDB_HOST_FILECACHE_H
#include <map>
#include <stdint.h>
@@ -14,6 +14,7 @@
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
+#include "lldb/Host/File.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h"
@@ -22,12 +23,12 @@
private:
FileCache() {}
- typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
+ typedef std::map<lldb::user_id_t, lldb::FileUP> FDToFileMap;
public:
static FileCache &GetInstance();
- lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
+ lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
uint32_t mode, Status &error);
bool CloseFile(lldb::user_id_t fd, Status &error);
diff --git a/linux-x64/clang/include/lldb/Host/FileSystem.h b/linux-x64/clang/include/lldb/Host/FileSystem.h
index 865b09b..02ff5f3 100644
--- a/linux-x64/clang/include/lldb/Host/FileSystem.h
+++ b/linux-x64/clang/include/lldb/Host/FileSystem.h
@@ -6,17 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_FileSystem_h
-#define liblldb_Host_FileSystem_h
+#ifndef LLDB_HOST_FILESYSTEM_H
+#define LLDB_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/FileCollector.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "lldb/lldb-types.h"
@@ -33,13 +33,14 @@
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) {}
+ m_home_directory(), m_mapped(false) {}
+ FileSystem(std::shared_ptr<llvm::FileCollectorBase> collector)
+ : m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)),
+ m_home_directory(), m_mapped(false) {}
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
bool mapped = false)
- : m_fs(fs), m_collector(nullptr), m_mapped(mapped) {}
+ : m_fs(std::move(fs)), m_collector(nullptr), m_home_directory(),
+ m_mapped(mapped) {}
FileSystem(const FileSystem &fs) = delete;
FileSystem &operator=(const FileSystem &fs) = delete;
@@ -47,7 +48,7 @@
static FileSystem &Instance();
static void Initialize();
- static void Initialize(FileCollector &collector);
+ static void Initialize(std::shared_ptr<llvm::FileCollectorBase> collector);
static llvm::Error Initialize(const FileSpec &mapping);
static void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
static void Terminate();
@@ -63,9 +64,10 @@
/// 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);
+ llvm::Expected<std::unique_ptr<File>>
+ Open(const FileSpec &file_spec, File::OpenOptions options,
+ uint32_t permissions = lldb::eFilePermissionsFileDefault,
+ bool should_close_fd = true);
/// Get a directory iterator.
/// \{
@@ -153,6 +155,10 @@
/// Call into the Host to see if it can help find the file.
bool ResolveExecutableLocation(FileSpec &file_spec);
+ /// Get the user home directory.
+ bool GetHomeDirectory(llvm::SmallVectorImpl<char> &path) const;
+ bool GetHomeDirectory(FileSpec &file_spec) const;
+
enum EnumerateDirectoryResult {
/// Enumerate next entry in the current directory.
eEnumerateDirectoryResultNext,
@@ -185,10 +191,16 @@
return m_fs;
}
+ void Collect(const FileSpec &file_spec);
+ void Collect(const llvm::Twine &file);
+
+ void SetHomeDirectory(std::string home_directory);
+
private:
static llvm::Optional<FileSystem> &InstanceImpl();
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
- FileCollector *m_collector;
+ std::shared_ptr<llvm::FileCollectorBase> m_collector;
+ std::string m_home_directory;
bool m_mapped;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Host/Host.h b/linux-x64/clang/include/lldb/Host/Host.h
index 884c5cf..76792cc 100644
--- a/linux-x64/clang/include/lldb/Host/Host.h
+++ b/linux-x64/clang/include/lldb/Host/Host.h
@@ -27,8 +27,8 @@
class FileAction;
class ProcessLaunchInfo;
class ProcessInstanceInfo;
-class ProcessInstanceInfoList;
class ProcessInstanceInfoMatch;
+typedef std::vector<ProcessInstanceInfo> ProcessInstanceInfoList;
// Exit Type for inferior processes
struct WaitStatus {
@@ -196,19 +196,34 @@
static Status ShellExpandArguments(ProcessLaunchInfo &launch_info);
/// Run a shell command.
- /// \arg command shouldn't be NULL
+ /// \arg command shouldn't be empty
/// \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,
+ static Status RunShellCommand(llvm::StringRef 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 run_in_shell = true,
+ bool hide_stderr = false);
+
+ /// Run a shell command.
+ /// \arg shell Pass an empty string if you want to use the default shell
+ /// interpreter \arg 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 \b false, redirect stderr to stdout
+ static Status RunShellCommand(llvm::StringRef shell, llvm::StringRef command,
+ const FileSpec &working_dir, int *status_ptr,
+ int *signo_ptr, std::string *command_output,
+ const Timeout<std::micro> &timeout,
+ bool run_in_shell = true,
bool hide_stderr = false);
/// Run a shell command.
@@ -222,7 +237,23 @@
int *status_ptr, int *signo_ptr,
std::string *command_output,
const Timeout<std::micro> &timeout,
- bool run_in_default_shell = true,
+ bool run_in_shell = true,
+ bool hide_stderr = false);
+
+ /// Run a shell command.
+ /// \arg shell Pass an empty string if you want to use the default
+ /// shell interpreter \arg 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 \b false, redirect stderr to stdout
+ static Status RunShellCommand(llvm::StringRef shell, 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_shell = true,
bool hide_stderr = false);
static bool OpenFileInExternalEditor(const FileSpec &file_spec,
@@ -232,6 +263,10 @@
static std::unique_ptr<Connection>
CreateDefaultConnection(llvm::StringRef url);
+
+protected:
+ static uint32_t FindProcessesImpl(const ProcessInstanceInfoMatch &match_info,
+ ProcessInstanceInfoList &proc_infos);
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Host/HostGetOpt.h b/linux-x64/clang/include/lldb/Host/HostGetOpt.h
index dedeb2e..746e03e 100644
--- a/linux-x64/clang/include/lldb/Host/HostGetOpt.h
+++ b/linux-x64/clang/include/lldb/Host/HostGetOpt.h
@@ -5,7 +5,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-#pragma once
+
+#ifndef LLDB_HOST_HOSTGETOPT_H
+#define LLDB_HOST_HOSTGETOPT_H
#if !defined(_MSC_VER) && !defined(__NetBSD__)
@@ -21,3 +23,5 @@
#include <lldb/Host/common/GetOptInc.h>
#endif
+
+#endif // LLDB_HOST_HOSTGETOPT_H
diff --git a/linux-x64/clang/include/lldb/Host/HostInfo.h b/linux-x64/clang/include/lldb/Host/HostInfo.h
index 196127d..b7010d6 100644
--- a/linux-x64/clang/include/lldb/Host/HostInfo.h
+++ b/linux-x64/clang/include/lldb/Host/HostInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostInfo_h_
-#define lldb_Host_HostInfo_h_
+#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.
@@ -35,7 +35,7 @@
#if defined(_WIN32)
#include "lldb/Host/windows/HostInfoWindows.h"
#define HOST_INFO_TYPE HostInfoWindows
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__EMSCRIPTEN__)
#if defined(__ANDROID__)
#include "lldb/Host/android/HostInfoAndroid.h"
#define HOST_INFO_TYPE HostInfoAndroid
diff --git a/linux-x64/clang/include/lldb/Host/HostInfoBase.h b/linux-x64/clang/include/lldb/Host/HostInfoBase.h
index 6f66889..15bb168 100644
--- a/linux-x64/clang/include/lldb/Host/HostInfoBase.h
+++ b/linux-x64/clang/include/lldb/Host/HostInfoBase.h
@@ -6,12 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostInfoBase_h_
-#define lldb_Host_HostInfoBase_h_
+#ifndef LLDB_HOST_HOSTINFOBASE_H
+#define LLDB_HOST_HOSTINFOBASE_H
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
#include "lldb/Utility/UserIDResolver.h"
+#include "lldb/Utility/XcodeSDK.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/StringRef.h"
@@ -23,6 +25,11 @@
class FileSpec;
+struct SharedCacheImageInfo {
+ UUID uuid;
+ lldb::DataBufferSP data_sp;
+};
+
class HostInfoBase {
private:
// Static class, unconstructable.
@@ -33,17 +40,12 @@
static void Initialize();
static void Terminate();
- /// Gets the host target triple as a const string.
+ /// Gets the host target triple.
///
/// \return
- /// A const string object containing the host target triple.
- static llvm::StringRef GetTargetTriple();
+ /// The host target triple.
+ static llvm::Triple 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
@@ -96,6 +98,19 @@
static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
llvm::StringRef dir);
+ static FileSpec GetXcodeContentsDirectory() { return {}; }
+ static FileSpec GetXcodeDeveloperDirectory() { return {}; }
+
+ /// Return the directory containing a specific Xcode SDK.
+ static llvm::StringRef GetXcodeSDKPath(XcodeSDK sdk) { return {}; }
+
+ /// Return information about module \p image_name if it is loaded in
+ /// the current process's address space.
+ static SharedCacheImageInfo
+ GetSharedCacheImageInfo(llvm::StringRef image_name) {
+ return {};
+ }
+
protected:
static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeProcess.h b/linux-x64/clang/include/lldb/Host/HostNativeProcess.h
index c86a2ae..d1e577d 100644
--- a/linux-x64/clang/include/lldb/Host/HostNativeProcess.h
+++ b/linux-x64/clang/include/lldb/Host/HostNativeProcess.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostNativeProcess_h_
-#define lldb_Host_HostNativeProcess_h_
+#ifndef LLDB_HOST_HOSTNATIVEPROCESS_H
+#define LLDB_HOST_HOSTNATIVEPROCESS_H
#if defined(_WIN32)
#include "lldb/Host/windows/HostProcessWindows.h"
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h b/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h
index aaa517d..642c634 100644
--- a/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h
+++ b/linux-x64/clang/include/lldb/Host/HostNativeProcessBase.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostNativeProcessBase_h_
-#define lldb_Host_HostNativeProcessBase_h_
+#ifndef LLDB_HOST_HOSTNATIVEPROCESSBASE_H
+#define LLDB_HOST_HOSTNATIVEPROCESSBASE_H
#include "lldb/Host/HostProcess.h"
#include "lldb/Utility/Status.h"
@@ -19,7 +19,9 @@
class HostThread;
class HostNativeProcessBase {
- DISALLOW_COPY_AND_ASSIGN(HostNativeProcessBase);
+ HostNativeProcessBase(const HostNativeProcessBase &) = delete;
+ const HostNativeProcessBase &
+ operator=(const HostNativeProcessBase &) = delete;
public:
HostNativeProcessBase() : m_process(LLDB_INVALID_PROCESS) {}
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThread.h b/linux-x64/clang/include/lldb/Host/HostNativeThread.h
index 8bf6584..cef08f0 100644
--- a/linux-x64/clang/include/lldb/Host/HostNativeThread.h
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThread.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostNativeThread_h_
-#define lldb_Host_HostNativeThread_h_
+#ifndef LLDB_HOST_HOSTNATIVETHREAD_H
+#define LLDB_HOST_HOSTNATIVETHREAD_H
#include "HostNativeThreadForward.h"
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h b/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h
index a196f0b..0dfd363 100644
--- a/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThreadBase.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostNativeThreadBase_h_
-#define lldb_Host_HostNativeThreadBase_h_
+#ifndef LLDB_HOST_HOSTNATIVETHREADBASE_H
+#define LLDB_HOST_HOSTNATIVETHREADBASE_H
#include "lldb/Utility/Status.h"
#include "lldb/lldb-defines.h"
@@ -23,7 +23,8 @@
class HostNativeThreadBase {
friend class ThreadLauncher;
- DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
+ HostNativeThreadBase(const HostNativeThreadBase &) = delete;
+ const HostNativeThreadBase &operator=(const HostNativeThreadBase &) = delete;
public:
HostNativeThreadBase();
diff --git a/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h b/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h
index 261d3c7..35b6e2f 100644
--- a/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h
+++ b/linux-x64/clang/include/lldb/Host/HostNativeThreadForward.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostNativeThreadForward_h_
-#define lldb_Host_HostNativeThreadForward_h_
+#ifndef LLDB_HOST_HOSTNATIVETHREADFORWARD_H
+#define LLDB_HOST_HOSTNATIVETHREADFORWARD_H
namespace lldb_private {
#if defined(_WIN32)
diff --git a/linux-x64/clang/include/lldb/Host/HostProcess.h b/linux-x64/clang/include/lldb/Host/HostProcess.h
index d48ff1f..0b7c303 100644
--- a/linux-x64/clang/include/lldb/Host/HostProcess.h
+++ b/linux-x64/clang/include/lldb/Host/HostProcess.h
@@ -6,13 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostProcess_h_
-#define lldb_Host_HostProcess_h_
+#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
diff --git a/linux-x64/clang/include/lldb/Host/HostThread.h b/linux-x64/clang/include/lldb/Host/HostThread.h
index 7bf2a1d..d3477e1 100644
--- a/linux-x64/clang/include/lldb/Host/HostThread.h
+++ b/linux-x64/clang/include/lldb/Host/HostThread.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostThread_h_
-#define lldb_Host_HostThread_h_
+#ifndef LLDB_HOST_HOSTTHREAD_H
+#define LLDB_HOST_HOSTTHREAD_H
#include "lldb/Host/HostNativeThreadForward.h"
#include "lldb/Utility/Status.h"
diff --git a/linux-x64/clang/include/lldb/Host/LZMA.h b/linux-x64/clang/include/lldb/Host/LZMA.h
new file mode 100644
index 0000000..5314dab
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Host/LZMA.h
@@ -0,0 +1,34 @@
+//===-- LZMA.h --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_LZMA_H
+#define LLDB_HOST_LZMA_H
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace llvm {
+class Error;
+} // End of namespace llvm
+
+namespace lldb_private {
+
+namespace lzma {
+
+bool isAvailable();
+
+llvm::Expected<uint64_t>
+getUncompressedSize(llvm::ArrayRef<uint8_t> InputBuffer);
+
+llvm::Error uncompress(llvm::ArrayRef<uint8_t> InputBuffer,
+ llvm::SmallVectorImpl<uint8_t> &Uncompressed);
+
+} // End of namespace lzma
+
+} // End of namespace lldb_private
+
+#endif // LLDB_HOST_LZMA_H
diff --git a/linux-x64/clang/include/lldb/Host/LockFile.h b/linux-x64/clang/include/lldb/Host/LockFile.h
index 2a1cd3d..ff09eb4 100644
--- a/linux-x64/clang/include/lldb/Host/LockFile.h
+++ b/linux-x64/clang/include/lldb/Host/LockFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_LockFile_h_
-#define liblldb_Host_LockFile_h_
+#ifndef LLDB_HOST_LOCKFILE_H
+#define LLDB_HOST_LOCKFILE_H
#if defined(_WIN32)
#include "lldb/Host/windows/LockFileWindows.h"
@@ -21,4 +21,4 @@
}
#endif
-#endif // liblldb_Host_LockFile_h_
+#endif // LLDB_HOST_LOCKFILE_H
diff --git a/linux-x64/clang/include/lldb/Host/LockFileBase.h b/linux-x64/clang/include/lldb/Host/LockFileBase.h
index be9e258..6a5fd42 100644
--- a/linux-x64/clang/include/lldb/Host/LockFileBase.h
+++ b/linux-x64/clang/include/lldb/Host/LockFileBase.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_LockFileBase_h_
-#define liblldb_Host_LockFileBase_h_
+#ifndef LLDB_HOST_LOCKFILEBASE_H
+#define LLDB_HOST_LOCKFILEBASE_H
#include "lldb/Utility/Status.h"
diff --git a/linux-x64/clang/include/lldb/Host/MainLoop.h b/linux-x64/clang/include/lldb/Host/MainLoop.h
index d59aa28..9ca5040 100644
--- a/linux-x64/clang/include/lldb/Host/MainLoop.h
+++ b/linux-x64/clang/include/lldb/Host/MainLoop.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_MainLoop_h_
-#define lldb_Host_MainLoop_h_
+#ifndef LLDB_HOST_MAINLOOP_H
+#define LLDB_HOST_MAINLOOP_H
#include "lldb/Host/Config.h"
#include "lldb/Host/MainLoopBase.h"
@@ -86,7 +86,8 @@
int m_signo;
friend class MainLoop;
- DISALLOW_COPY_AND_ASSIGN(SignalHandle);
+ SignalHandle(const SignalHandle &) = delete;
+ const SignalHandle &operator=(const SignalHandle &) = delete;
};
struct SignalInfo {
@@ -108,4 +109,4 @@
} // namespace lldb_private
-#endif // lldb_Host_MainLoop_h_
+#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
index 3fee2b2..fa8cc77 100644
--- a/linux-x64/clang/include/lldb/Host/MainLoopBase.h
+++ b/linux-x64/clang/include/lldb/Host/MainLoopBase.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_posix_MainLoopBase_h_
-#define lldb_Host_posix_MainLoopBase_h_
+#ifndef LLDB_HOST_MAINLOOPBASE_H
+#define LLDB_HOST_MAINLOOPBASE_H
#include "lldb/Utility/IOObject.h"
#include "lldb/Utility/Status.h"
@@ -75,13 +75,14 @@
IOObject::WaitableHandle m_handle;
friend class MainLoopBase;
- DISALLOW_COPY_AND_ASSIGN(ReadHandle);
+ ReadHandle(const ReadHandle &) = delete;
+ const ReadHandle &operator=(const ReadHandle &) = delete;
};
-private:
- DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
+ MainLoopBase(const MainLoopBase &) = delete;
+ const MainLoopBase &operator=(const MainLoopBase &) = delete;
};
} // namespace lldb_private
-#endif // lldb_Host_posix_MainLoopBase_h_
+#endif // LLDB_HOST_MAINLOOPBASE_H
diff --git a/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h b/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h
index 59111a0..e2fce42 100644
--- a/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h
+++ b/linux-x64/clang/include/lldb/Host/MonitoringProcessLauncher.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_MonitoringProcessLauncher_h_
-#define lldb_Host_MonitoringProcessLauncher_h_
+#ifndef LLDB_HOST_MONITORINGPROCESSLAUNCHER_H
+#define LLDB_HOST_MONITORINGPROCESSLAUNCHER_H
#include <memory>
#include "lldb/Host/ProcessLauncher.h"
@@ -31,4 +31,4 @@
} // namespace lldb_private
-#endif // lldb_Host_MonitoringProcessLauncher_h_
+#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
index ca05946..7c84c11 100644
--- a/linux-x64/clang/include/lldb/Host/OptionParser.h
+++ b/linux-x64/clang/include/lldb/Host/OptionParser.h
@@ -6,13 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionParser_h_
-#define liblldb_OptionParser_h_
+#ifndef LLDB_HOST_OPTIONPARSER_H
+#define LLDB_HOST_OPTIONPARSER_H
#include <mutex>
#include <string>
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/ArrayRef.h"
struct option;
@@ -37,8 +38,11 @@
static void EnableError(bool error);
- static int Parse(int argc, char *const argv[], llvm::StringRef optstring,
- const Option *longopts, int *longindex);
+ /// Argv must be an argument vector "as passed to main", i.e. terminated with
+ /// a nullptr.
+ static int Parse(llvm::MutableArrayRef<char *> argv,
+ llvm::StringRef optstring, const Option *longopts,
+ int *longindex);
static char *GetOptionArgument();
static int GetOptionIndex();
@@ -47,4 +51,4 @@
};
}
-#endif // liblldb_OptionParser_h_
+#endif // LLDB_HOST_OPTIONPARSER_H
diff --git a/linux-x64/clang/include/lldb/Host/Pipe.h b/linux-x64/clang/include/lldb/Host/Pipe.h
index ea75342..06daf1f 100644
--- a/linux-x64/clang/include/lldb/Host/Pipe.h
+++ b/linux-x64/clang/include/lldb/Host/Pipe.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_Pipe_h_
-#define liblldb_Host_Pipe_h_
+#ifndef LLDB_HOST_PIPE_H
+#define LLDB_HOST_PIPE_H
#if defined(_WIN32)
#include "lldb/Host/windows/PipeWindows.h"
@@ -21,4 +21,4 @@
}
#endif
-#endif // liblldb_Host_Pipe_h_
+#endif // LLDB_HOST_PIPE_H
diff --git a/linux-x64/clang/include/lldb/Host/PipeBase.h b/linux-x64/clang/include/lldb/Host/PipeBase.h
index 1aa4db3..48c19b8 100644
--- a/linux-x64/clang/include/lldb/Host/PipeBase.h
+++ b/linux-x64/clang/include/lldb/Host/PipeBase.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_PipeBase_h_
-#define liblldb_Host_PipeBase_h_
+#ifndef LLDB_HOST_PIPEBASE_H
+#define LLDB_HOST_PIPEBASE_H
#include <chrono>
#include <string>
diff --git a/linux-x64/clang/include/lldb/Host/PosixApi.h b/linux-x64/clang/include/lldb/Host/PosixApi.h
index 04ca3a8..4cbbd62 100644
--- a/linux-x64/clang/include/lldb/Host/PosixApi.h
+++ b/linux-x64/clang/include/lldb/Host/PosixApi.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_PosixApi_h
-#define liblldb_Host_PosixApi_h
+#ifndef LLDB_HOST_POSIXAPI_H
+#define LLDB_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
diff --git a/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h b/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h
index d068aa6..ee97555 100644
--- a/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h
+++ b/linux-x64/clang/include/lldb/Host/ProcessLaunchInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ProcessLaunch_Info_h
-#define liblldb_ProcessLaunch_Info_h
+#ifndef LLDB_HOST_PROCESSLAUNCHINFO_H
+#define LLDB_HOST_PROCESSLAUNCHINFO_H
// C++ Headers
#include <string>
@@ -94,10 +94,9 @@
void Clear();
- bool ConvertArgumentsForLaunchingInShell(Status &error, bool localhost,
- bool will_debug,
+ bool ConvertArgumentsForLaunchingInShell(Status &error, bool will_debug,
bool first_arg_is_full_shell_command,
- int32_t num_resumes);
+ uint32_t num_resumes);
void
SetMonitorProcessCallback(const Host::MonitorChildProcessCallback &callback,
@@ -165,4 +164,4 @@
};
}
-#endif // liblldb_ProcessLaunch_Info_h
+#endif // LLDB_HOST_PROCESSLAUNCHINFO_H
diff --git a/linux-x64/clang/include/lldb/Host/ProcessLauncher.h b/linux-x64/clang/include/lldb/Host/ProcessLauncher.h
index a5b6a6c..9467b2c 100644
--- a/linux-x64/clang/include/lldb/Host/ProcessLauncher.h
+++ b/linux-x64/clang/include/lldb/Host/ProcessLauncher.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_ProcessLauncher_h_
-#define lldb_Host_ProcessLauncher_h_
+#ifndef LLDB_HOST_PROCESSLAUNCHER_H
+#define LLDB_HOST_PROCESSLAUNCHER_H
namespace lldb_private {
diff --git a/linux-x64/clang/include/lldb/Host/ProcessRunLock.h b/linux-x64/clang/include/lldb/Host/ProcessRunLock.h
index 4927fbb..43463d1 100644
--- a/linux-x64/clang/include/lldb/Host/ProcessRunLock.h
+++ b/linux-x64/clang/include/lldb/Host/ProcessRunLock.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ProcessRunLock_h_
-#define liblldb_ProcessRunLock_h_
+#ifndef LLDB_HOST_PROCESSRUNLOCK_H
+#define LLDB_HOST_PROCESSRUNLOCK_H
#include <stdint.h>
#include <time.h>
@@ -67,7 +67,8 @@
ProcessRunLock *m_lock;
private:
- DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
+ ProcessRunLocker(const ProcessRunLocker &) = delete;
+ const ProcessRunLocker &operator=(const ProcessRunLocker &) = delete;
};
protected:
@@ -75,9 +76,10 @@
bool m_running;
private:
- DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
+ ProcessRunLock(const ProcessRunLock &) = delete;
+ const ProcessRunLock &operator=(const ProcessRunLock &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ProcessRunLock_h_
+#endif // LLDB_HOST_PROCESSRUNLOCK_H
diff --git a/linux-x64/clang/include/lldb/Host/PseudoTerminal.h b/linux-x64/clang/include/lldb/Host/PseudoTerminal.h
index 8b27890..350f926 100644
--- a/linux-x64/clang/include/lldb/Host/PseudoTerminal.h
+++ b/linux-x64/clang/include/lldb/Host/PseudoTerminal.h
@@ -9,11 +9,11 @@
#ifndef LLDB_HOST_PSEUDOTERMINAL_H
#define LLDB_HOST_PSEUDOTERMINAL_H
+#include "lldb/lldb-defines.h"
+#include "llvm/Support/Error.h"
#include <fcntl.h>
#include <string>
-#include "lldb/lldb-defines.h"
-
namespace lldb_private {
/// \class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h"
@@ -29,189 +29,160 @@
/// Default constructor
///
- /// Constructs this object with invalid master and slave file descriptors.
+ /// Constructs this object with invalid primary and secondary 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
+ /// The destructor will close the primary and secondary file descriptors if
+ /// they are valid and ownership has not been released using one of: @li
+ /// PseudoTerminal::ReleasePrimaryFileDescriptor() @li
/// PseudoTerminal::ReleaseSaveFileDescriptor()
~PseudoTerminal();
- /// Close the master file descriptor if it is valid.
- void CloseMasterFileDescriptor();
+ /// Close the primary file descriptor if it is valid.
+ void ClosePrimaryFileDescriptor();
- /// Close the slave file descriptor if it is valid.
- void CloseSlaveFileDescriptor();
+ /// Close the secondary file descriptor if it is valid.
+ void CloseSecondaryFileDescriptor();
/// 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
+ /// returned. If the pid is valid, the primary 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.
+ /// the secondary pseudo terminal and the primary 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
+ /// This class will close the file descriptors for the primary/secondary when
+ /// the destructor is called. The file handles can be released using either:
+ /// @li PseudoTerminal::ReleasePrimaryFileDescriptor() @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);
+ /// \b Parent process: a child process ID that is greater
+ /// than zero, or an error if the fork fails.
+ /// \b Child process: zero.
+ llvm::Expected<lldb::pid_t> Fork();
- /// The master file descriptor accessor.
+ /// The primary file descriptor accessor.
///
- /// This object retains ownership of the master file descriptor when this
+ /// This object retains ownership of the primary 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.
+ /// PseudoTerminal::ReleasePrimaryFileDescriptor() if this object should
+ /// release ownership of the secondary file descriptor.
///
/// \return
- /// The master file descriptor, or PseudoTerminal::invalid_fd
- /// if the master file descriptor is not currently valid.
+ /// The primary file descriptor, or PseudoTerminal::invalid_fd
+ /// if the primary file descriptor is not currently valid.
///
- /// \see PseudoTerminal::ReleaseMasterFileDescriptor()
- int GetMasterFileDescriptor() const;
+ /// \see PseudoTerminal::ReleasePrimaryFileDescriptor()
+ int GetPrimaryFileDescriptor() const;
- /// The slave file descriptor accessor.
+ /// The secondary file descriptor accessor.
///
- /// This object retains ownership of the slave file descriptor when this
+ /// This object retains ownership of the secondary 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.
+ /// PseudoTerminal::ReleaseSecondaryFileDescriptor() if this object should
+ /// release ownership of the secondary file descriptor.
///
/// \return
- /// The slave file descriptor, or PseudoTerminal::invalid_fd
- /// if the slave file descriptor is not currently valid.
+ /// The secondary file descriptor, or PseudoTerminal::invalid_fd
+ /// if the secondary file descriptor is not currently valid.
///
- /// \see PseudoTerminal::ReleaseSlaveFileDescriptor()
- int GetSlaveFileDescriptor() const;
+ /// \see PseudoTerminal::ReleaseSecondaryFileDescriptor()
+ int GetSecondaryFileDescriptor() const;
- /// Get the name of the slave pseudo terminal.
+ /// Get the name of the secondary pseudo terminal.
///
- /// A master pseudo terminal should already be valid prior to
+ /// A primary 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.
+ /// The name of the secondary pseudo terminal.
///
- /// \see PseudoTerminal::OpenFirstAvailableMaster()
- const char *GetSlaveName(char *error_str, size_t error_len) const;
+ /// \see PseudoTerminal::OpenFirstAvailablePrimary()
+ std::string GetSecondaryName() 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
+ /// permissions. The opened primary 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
+ /// PseudoTerminal::GetPrimaryFileDescriptor() accessor. Clients can call the
+ /// PseudoTerminal::ReleasePrimaryFileDescriptor() accessor function if they
+ /// wish to use the primary file descriptor beyond the lifespan of this
/// object.
///
- /// If this object still has a valid master file descriptor when its
+ /// If this object still has a valid primary 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);
+ /// \see PseudoTerminal::GetPrimaryFileDescriptor() @see
+ /// PseudoTerminal::ReleasePrimaryFileDescriptor()
+ llvm::Error OpenFirstAvailablePrimary(int oflag);
- /// Open the slave for the current master pseudo terminal.
+ /// Open the secondary for the current primary pseudo terminal.
///
- /// A master pseudo terminal should already be valid prior to
- /// calling this function. The opened slave file descriptor is stored in
+ /// A primary pseudo terminal should already be valid prior to
+ /// calling this function. The opened secondary 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
+ /// PseudoTerminal::GetSecondaryFileDescriptor() accessor. Clients can call
+ /// the PseudoTerminal::ReleaseSecondaryFileDescriptor() accessor function if
+ /// they wish to use the secondary file descriptor beyond the lifespan of this
/// object.
///
- /// If this object still has a valid slave file descriptor when its
+ /// If this object still has a valid secondary 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);
+ /// \see PseudoTerminal::OpenFirstAvailablePrimary() @see
+ /// PseudoTerminal::GetSecondaryFileDescriptor() @see
+ /// PseudoTerminal::ReleaseSecondaryFileDescriptor()
+ llvm::Error OpenSecondary(int oflag);
- /// Release the master file descriptor.
+ /// Release the primary file descriptor.
///
- /// Releases ownership of the master pseudo terminal file descriptor without
- /// closing it. The destructor for this class will close the master file
+ /// Releases ownership of the primary pseudo terminal file descriptor without
+ /// closing it. The destructor for this class will close the primary file
/// descriptor if the ownership isn't released using this call and the
- /// master file descriptor has been opened.
+ /// primary file descriptor has been opened.
///
/// \return
- /// The master file descriptor, or PseudoTerminal::invalid_fd
+ /// The primary file descriptor, or PseudoTerminal::invalid_fd
/// if the mast file descriptor is not currently valid.
- int ReleaseMasterFileDescriptor();
+ int ReleasePrimaryFileDescriptor();
- /// Release the slave file descriptor.
+ /// Release the secondary 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.
+ /// Release ownership of the secondary pseudo terminal file descriptor without
+ /// closing it. The destructor for this class will close the secondary file
+ /// descriptor if the ownership isn't released using this call and the
+ /// secondary 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();
+ /// The secondary file descriptor, or PseudoTerminal::invalid_fd
+ /// if the secondary file descriptor is not currently valid.
+ int ReleaseSecondaryFileDescriptor();
protected:
// Member variables
- int m_master_fd; ///< The file descriptor for the master.
- int m_slave_fd; ///< The file descriptor for the slave.
+ int m_primary_fd; ///< The file descriptor for the primary.
+ int m_secondary_fd; ///< The file descriptor for the secondary.
private:
- DISALLOW_COPY_AND_ASSIGN(PseudoTerminal);
+ PseudoTerminal(const PseudoTerminal &) = delete;
+ const PseudoTerminal &operator=(const PseudoTerminal &) = delete;
};
} // namespace lldb_private
-#endif // #ifndef liblldb_PseudoTerminal_h_
+#endif // LLDB_HOST_PSEUDOTERMINAL_H
diff --git a/linux-x64/clang/include/lldb/Host/SafeMachO.h b/linux-x64/clang/include/lldb/Host/SafeMachO.h
index ec9887e..d7c376d 100644
--- a/linux-x64/clang/include/lldb/Host/SafeMachO.h
+++ b/linux-x64/clang/include/lldb/Host/SafeMachO.h
@@ -5,8 +5,8 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SafeMachO_h_
-#define liblldb_SafeMachO_h_
+#ifndef LLDB_HOST_SAFEMACHO_H
+#define LLDB_HOST_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
@@ -112,4 +112,4 @@
#include "llvm/BinaryFormat/MachO.h"
-#endif // liblldb_SafeMachO_h_
+#endif // LLDB_HOST_SAFEMACHO_H
diff --git a/linux-x64/clang/include/lldb/Host/Socket.h b/linux-x64/clang/include/lldb/Host/Socket.h
index 6f96bd7..36db0ec 100644
--- a/linux-x64/clang/include/lldb/Host/Socket.h
+++ b/linux-x64/clang/include/lldb/Host/Socket.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_Socket_h_
-#define liblldb_Host_Socket_h_
+#ifndef LLDB_HOST_SOCKET_H
+#define LLDB_HOST_SOCKET_H
#include <memory>
#include <string>
@@ -31,11 +31,13 @@
namespace lldb_private {
-#if defined(_MSC_VER)
+#if defined(_WIN32)
typedef SOCKET NativeSocket;
#else
typedef int NativeSocket;
#endif
+class TCPSocket;
+class UDPSocket;
class Socket : public IOObject {
public:
@@ -64,13 +66,16 @@
// 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 llvm::Expected<std::unique_ptr<TCPSocket>>
+ TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit,
+ Predicate<uint16_t> *predicate, int backlog = 5);
+
+ static llvm::Expected<std::unique_ptr<Socket>>
+ TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit);
+
+ static llvm::Expected<std::unique_ptr<UDPSocket>>
+ UdpConnect(llvm::StringRef host_and_port, bool child_processes_inherit);
+
static Status UnixDomainConnect(llvm::StringRef host_and_port,
bool child_processes_inherit,
Socket *&socket);
@@ -122,8 +127,9 @@
SocketProtocol m_protocol;
NativeSocket m_socket;
bool m_child_processes_inherit;
+ bool m_should_close_fd;
};
} // namespace lldb_private
-#endif // liblldb_Host_Socket_h_
+#endif // LLDB_HOST_SOCKET_H
diff --git a/linux-x64/clang/include/lldb/Host/SocketAddress.h b/linux-x64/clang/include/lldb/Host/SocketAddress.h
index 620827f..862e110 100644
--- a/linux-x64/clang/include/lldb/Host/SocketAddress.h
+++ b/linux-x64/clang/include/lldb/Host/SocketAddress.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SocketAddress_h_
-#define liblldb_SocketAddress_h_
+#ifndef LLDB_HOST_SOCKETADDRESS_H
+#define LLDB_HOST_SOCKETADDRESS_H
#include <stdint.h>
@@ -48,8 +48,6 @@
~SocketAddress();
// Operators
- const SocketAddress &operator=(const SocketAddress &rhs);
-
const SocketAddress &operator=(const struct addrinfo *addr_info);
const SocketAddress &operator=(const struct sockaddr &s);
@@ -187,4 +185,4 @@
} // namespace lldb_private
-#endif // liblldb_SocketAddress_h_
+#endif // LLDB_HOST_SOCKETADDRESS_H
diff --git a/linux-x64/clang/include/lldb/Host/StringConvert.h b/linux-x64/clang/include/lldb/Host/StringConvert.h
index 4b2c690..ad629ff 100644
--- a/linux-x64/clang/include/lldb/Host/StringConvert.h
+++ b/linux-x64/clang/include/lldb/Host/StringConvert.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StringConvert_h_
-#define liblldb_StringConvert_h_
+#ifndef LLDB_HOST_STRINGCONVERT_H
+#define LLDB_HOST_STRINGCONVERT_H
#include <stdint.h>
diff --git a/linux-x64/clang/include/lldb/Host/TaskPool.h b/linux-x64/clang/include/lldb/Host/TaskPool.h
deleted file mode 100644
index 49805ce..0000000
--- a/linux-x64/clang/include/lldb/Host/TaskPool.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//===--------------------- 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
index e5e96ee..6199322 100644
--- a/linux-x64/clang/include/lldb/Host/Terminal.h
+++ b/linux-x64/clang/include/lldb/Host/Terminal.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Terminal_h_
-#define liblldb_Terminal_h_
+#ifndef LLDB_HOST_TERMINAL_H
+#define LLDB_HOST_TERMINAL_H
#if defined(__cplusplus)
#include "lldb/Host/Config.h"
@@ -117,7 +117,7 @@
// Member variables
Terminal m_tty; ///< A terminal
int m_tflags; ///< Cached tflags information.
-#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
+#if LLDB_ENABLE_TERMIOS
std::unique_ptr<struct termios>
m_termios_up; ///< Cached terminal state information.
#endif
@@ -179,4 +179,4 @@
} // namespace lldb_private
#endif // #if defined(__cplusplus)
-#endif // #ifndef liblldb_Terminal_h_
+#endif // LLDB_HOST_TERMINAL_H
diff --git a/linux-x64/clang/include/lldb/Host/ThreadLauncher.h b/linux-x64/clang/include/lldb/Host/ThreadLauncher.h
index e45ffa9..00b42fa 100644
--- a/linux-x64/clang/include/lldb/Host/ThreadLauncher.h
+++ b/linux-x64/clang/include/lldb/Host/ThreadLauncher.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_ThreadLauncher_h_
-#define lldb_Host_ThreadLauncher_h_
+#ifndef LLDB_HOST_THREADLAUNCHER_H
+#define LLDB_HOST_THREADLAUNCHER_H
#include "lldb/Host/HostThread.h"
#include "lldb/lldb-types.h"
diff --git a/linux-x64/clang/include/lldb/Host/Time.h b/linux-x64/clang/include/lldb/Host/Time.h
index b27eb08..83b76ec 100644
--- a/linux-x64/clang/include/lldb/Host/Time.h
+++ b/linux-x64/clang/include/lldb/Host/Time.h
@@ -8,8 +8,8 @@
// Include system time headers, adding missing functions as necessary
-#ifndef liblldb_Host_Time_h_
-#define liblldb_Host_Time_h_
+#ifndef LLDB_HOST_TIME_H
+#define LLDB_HOST_TIME_H
#ifdef __ANDROID__
#include <android/api-level.h>
@@ -22,4 +22,4 @@
#include <time.h>
#endif
-#endif // liblldb_Host_Time_h_
+#endif // LLDB_HOST_TIME_H
diff --git a/linux-x64/clang/include/lldb/Host/XML.h b/linux-x64/clang/include/lldb/Host/XML.h
index 625cf43..a80f1e9 100644
--- a/linux-x64/clang/include/lldb/Host/XML.h
+++ b/linux-x64/clang/include/lldb/Host/XML.h
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_XML_h_
-#define liblldb_XML_h_
+#ifndef LLDB_HOST_XML_H
+#define LLDB_HOST_XML_H
-#if defined(LIBXML2_DEFINED)
+#include "lldb/Host/Config.h"
+
+#if LLDB_ENABLE_LIBXML2
#include <libxml/xmlreader.h>
#endif
@@ -25,7 +27,7 @@
namespace lldb_private {
-#if defined(LIBXML2_DEFINED)
+#if LLDB_ENABLE_LIBXML2
typedef xmlNodePtr XMLNodeImpl;
typedef xmlDocPtr XMLDocumentImpl;
#else
@@ -177,4 +179,4 @@
} // namespace lldb_private
-#endif // liblldb_XML_h_
+#endif // LLDB_HOST_XML_H
diff --git a/linux-x64/clang/include/lldb/Host/common/GetOptInc.h b/linux-x64/clang/include/lldb/Host/common/GetOptInc.h
index c69f722..3fb9add 100644
--- a/linux-x64/clang/include/lldb/Host/common/GetOptInc.h
+++ b/linux-x64/clang/include/lldb/Host/common/GetOptInc.h
@@ -1,4 +1,13 @@
-#pragma once
+//===-- GetOptInc.h ---------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_COMMON_GETOPTINC_H
+#define LLDB_HOST_COMMON_GETOPTINC_H
#include "lldb/lldb-defines.h"
@@ -50,3 +59,5 @@
int getopt_long_only(int argc, char *const *argv, const char *optstring,
const struct option *longopts, int *longindex);
#endif
+
+#endif // LLDB_HOST_COMMON_GETOPTINC_H
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h b/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h
index c2725b2..21d2f09 100644
--- a/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h
+++ b/linux-x64/clang/include/lldb/Host/common/NativeBreakpointList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_NativeBreakpointList_h_
-#define liblldb_NativeBreakpointList_h_
+#ifndef LLDB_HOST_COMMON_NATIVEBREAKPOINTLIST_H
+#define LLDB_HOST_COMMON_NATIVEBREAKPOINTLIST_H
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-types.h"
@@ -23,4 +23,4 @@
using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>;
}
-#endif // ifndef liblldb_NativeBreakpointList_h_
+#endif // LLDB_HOST_COMMON_NATIVEBREAKPOINTLIST_H
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h b/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h
index f05b8d0..5be9cb6 100644
--- a/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/linux-x64/clang/include/lldb/Host/common/NativeProcessProtocol.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_NativeProcessProtocol_h_
-#define liblldb_NativeProcessProtocol_h_
+#ifndef LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
+#define LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
#include "NativeBreakpointList.h"
#include "NativeThreadProtocol.h"
@@ -17,6 +17,7 @@
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/TraceOptions.h"
+#include "lldb/Utility/UnimplementedError.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-types.h"
#include "llvm/ADT/ArrayRef.h"
@@ -32,6 +33,14 @@
class MemoryRegionInfo;
class ResumeActionList;
+struct SVR4LibraryInfo {
+ std::string name;
+ lldb::addr_t link_map;
+ lldb::addr_t base_addr;
+ lldb::addr_t ld_addr;
+ lldb::addr_t next;
+};
+
// NativeProcessProtocol
class NativeProcessProtocol {
public:
@@ -76,16 +85,51 @@
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
size_t &bytes_read);
+ /// Reads a null terminated string from memory.
+ ///
+ /// Reads up to \p max_size bytes of memory until it finds a '\0'.
+ /// If a '\0' is not found then it reads max_size-1 bytes as a string and a
+ /// '\0' is added as the last character of the \p buffer.
+ ///
+ /// \param[in] addr
+ /// The address in memory to read from.
+ ///
+ /// \param[in] buffer
+ /// An allocated buffer with at least \p max_size size.
+ ///
+ /// \param[in] max_size
+ /// The maximum number of bytes to read from memory until it reads the
+ /// string.
+ ///
+ /// \param[out] total_bytes_read
+ /// The number of bytes read from memory into \p buffer.
+ ///
+ /// \return
+ /// Returns a StringRef backed up by the \p buffer passed in.
+ llvm::Expected<llvm::StringRef>
+ ReadCStringFromMemory(lldb::addr_t addr, char *buffer, size_t max_size,
+ size_t &total_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 llvm::Expected<lldb::addr_t> AllocateMemory(size_t size,
+ uint32_t permissions) {
+ return llvm::make_error<UnimplementedError>();
+ }
- virtual Status DeallocateMemory(lldb::addr_t addr) = 0;
+ virtual llvm::Error DeallocateMemory(lldb::addr_t addr) {
+ return llvm::make_error<UnimplementedError>();
+ }
virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
+ virtual llvm::Expected<std::vector<SVR4LibraryInfo>>
+ GetLoadedSVR4Libraries() {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Not implemented");
+ }
+
virtual bool IsAlive() const;
virtual size_t UpdateThreads() = 0;
@@ -340,20 +384,19 @@
/// \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.
+ /// The configuration being used for tracing.
+ ///
+ /// \return A status indicating what went wrong.
virtual Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions &config) {
return Status("Not implemented");
}
+ /// \copydoc Process::GetSupportedTraceType()
+ virtual llvm::Expected<TraceTypeInfo> GetSupportedTraceType() {
+ return llvm::make_error<UnimplementedError>();
+ }
+
protected:
struct SoftwareBreakpoint {
uint32_t ref_count;
@@ -391,6 +434,8 @@
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
NativeDelegate &delegate);
+ void SetID(lldb::pid_t pid) { m_pid = pid; }
+
// interface for state handling
void SetState(lldb::StateType state, bool notify_delegates = true);
@@ -434,4 +479,4 @@
};
} // namespace lldb_private
-#endif // #ifndef liblldb_NativeProcessProtocol_h_
+#endif // LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h b/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h
index 6bba8f2..f7568fe 100644
--- a/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h
+++ b/linux-x64/clang/include/lldb/Host/common/NativeRegisterContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_NativeRegisterContext_h_
-#define liblldb_NativeRegisterContext_h_
+#ifndef LLDB_HOST_COMMON_NATIVEREGISTERCONTEXT_H
+#define LLDB_HOST_COMMON_NATIVEREGISTERCONTEXT_H
#include "lldb/Host/common/NativeWatchpointList.h"
#include "lldb/lldb-private.h"
@@ -16,6 +16,8 @@
class NativeThreadProtocol;
+enum class ExpeditedRegs { Minimal, Full };
+
class NativeRegisterContext
: public std::enable_shared_from_this<NativeRegisterContext> {
public:
@@ -75,6 +77,8 @@
virtual bool ClearHardwareWatchpoint(uint32_t hw_index);
+ virtual Status ClearWatchpointHit(uint32_t hw_index);
+
virtual Status ClearAllHardwareWatchpoints();
virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit);
@@ -114,6 +118,11 @@
virtual NativeThreadProtocol &GetThread() { return m_thread; }
+ virtual std::vector<uint32_t>
+ GetExpeditedRegisters(ExpeditedRegs expType) const;
+
+ virtual bool RegisterOffsetIsDynamic() const { return false; }
+
const RegisterInfo *GetRegisterInfoByName(llvm::StringRef reg_name,
uint32_t start_idx = 0);
@@ -170,9 +179,11 @@
private:
// For RegisterContext only
- DISALLOW_COPY_AND_ASSIGN(NativeRegisterContext);
+ NativeRegisterContext(const NativeRegisterContext &) = delete;
+ const NativeRegisterContext &
+ operator=(const NativeRegisterContext &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_NativeRegisterContext_h_
+#endif // LLDB_HOST_COMMON_NATIVEREGISTERCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h b/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h
index 36ae679..8d4c035 100644
--- a/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h
+++ b/linux-x64/clang/include/lldb/Host/common/NativeThreadProtocol.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_NativeThreadProtocol_h_
-#define liblldb_NativeThreadProtocol_h_
+#ifndef LLDB_HOST_COMMON_NATIVETHREADPROTOCOL_H
+#define LLDB_HOST_COMMON_NATIVETHREADPROTOCOL_H
#include <memory>
@@ -53,4 +53,4 @@
};
}
-#endif // #ifndef liblldb_NativeThreadProtocol_h_
+#endif // LLDB_HOST_COMMON_NATIVETHREADPROTOCOL_H
diff --git a/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h b/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h
index c83ba1e..66f93bf 100644
--- a/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h
+++ b/linux-x64/clang/include/lldb/Host/common/NativeWatchpointList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_NativeWatchpointList_h_
-#define liblldb_NativeWatchpointList_h_
+#ifndef LLDB_HOST_COMMON_NATIVEWATCHPOINTLIST_H
+#define LLDB_HOST_COMMON_NATIVEWATCHPOINTLIST_H
#include "lldb/Utility/Status.h"
#include "lldb/lldb-private-forward.h"
@@ -38,4 +38,4 @@
};
}
-#endif // ifndef liblldb_NativeWatchpointList_h_
+#endif // LLDB_HOST_COMMON_NATIVEWATCHPOINTLIST_H
diff --git a/linux-x64/clang/include/lldb/Host/common/TCPSocket.h b/linux-x64/clang/include/lldb/Host/common/TCPSocket.h
index faf3bb6..b782c9e 100644
--- a/linux-x64/clang/include/lldb/Host/common/TCPSocket.h
+++ b/linux-x64/clang/include/lldb/Host/common/TCPSocket.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TCPSocket_h_
-#define liblldb_TCPSocket_h_
+#ifndef LLDB_HOST_COMMON_TCPSOCKET_H
+#define LLDB_HOST_COMMON_TCPSOCKET_H
#include "lldb/Host/Socket.h"
#include "lldb/Host/SocketAddress.h"
@@ -57,4 +57,4 @@
};
}
-#endif // ifndef liblldb_TCPSocket_h_
+#endif // LLDB_HOST_COMMON_TCPSOCKET_H
diff --git a/linux-x64/clang/include/lldb/Host/common/UDPSocket.h b/linux-x64/clang/include/lldb/Host/common/UDPSocket.h
index b7b6db6..bae707e 100644
--- a/linux-x64/clang/include/lldb/Host/common/UDPSocket.h
+++ b/linux-x64/clang/include/lldb/Host/common/UDPSocket.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UDPSocket_h_
-#define liblldb_UDPSocket_h_
+#ifndef LLDB_HOST_COMMON_UDPSOCKET_H
+#define LLDB_HOST_COMMON_UDPSOCKET_H
#include "lldb/Host/Socket.h"
@@ -16,8 +16,8 @@
public:
UDPSocket(bool should_close, bool child_processes_inherit);
- static Status Connect(llvm::StringRef name, bool child_processes_inherit,
- Socket *&socket);
+ static llvm::Expected<std::unique_ptr<UDPSocket>>
+ Connect(llvm::StringRef name, bool child_processes_inherit);
std::string GetRemoteConnectionURI() const override;
@@ -33,4 +33,4 @@
};
}
-#endif // ifndef liblldb_UDPSocket_h_
+#endif // LLDB_HOST_COMMON_UDPSOCKET_H
diff --git a/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h b/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h
index d49e27a..ee9f12a 100644
--- a/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/linux-x64/clang/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -6,11 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_macosx_HostInfoMacOSX_h_
-#define lldb_Host_macosx_HostInfoMacOSX_h_
+#ifndef LLDB_HOST_MACOSX_HOSTINFOMACOSX_H
+#define LLDB_HOST_MACOSX_HOSTINFOMACOSX_H
#include "lldb/Host/posix/HostInfoPosix.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/XcodeSDK.h"
#include "llvm/Support/VersionTuple.h"
namespace lldb_private {
@@ -27,9 +28,19 @@
public:
static llvm::VersionTuple GetOSVersion();
+ static llvm::VersionTuple GetMacCatalystVersion();
static bool GetOSBuildString(std::string &s);
static bool GetOSKernelDescription(std::string &s);
static FileSpec GetProgramFileSpec();
+ static FileSpec GetXcodeContentsDirectory();
+ static FileSpec GetXcodeDeveloperDirectory();
+
+ /// Query xcrun to find an Xcode SDK directory.
+ static llvm::StringRef GetXcodeSDKPath(XcodeSDK sdk);
+
+ /// Shared cache utilities
+ static SharedCacheImageInfo
+ GetSharedCacheImageInfo(llvm::StringRef image_name);
protected:
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
diff --git a/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h b/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h
index 4247de6..4e41119 100644
--- a/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h
+++ b/linux-x64/clang/include/lldb/Host/macosx/HostThreadMacOSX.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_macosx_HostThreadMacOSX_h_
-#define lldb_Host_macosx_HostThreadMacOSX_h_
+#ifndef LLDB_HOST_MACOSX_HOSTTHREADMACOSX_H
+#define LLDB_HOST_MACOSX_HOSTTHREADMACOSX_H
#include "lldb/Host/posix/HostThreadPosix.h"
diff --git a/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
index b25fc47..3ee8f9d 100644
--- a/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
-#define liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
+#ifndef LLDB_HOST_POSIX_CONNECTIONFILEDESCRIPTORPOSIX_H
+#define LLDB_HOST_POSIX_CONNECTIONFILEDESCRIPTORPOSIX_H
#include <atomic>
#include <memory>
@@ -116,9 +116,11 @@
private:
void InitializeSocket(Socket *socket);
- DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
+ ConnectionFileDescriptor(const ConnectionFileDescriptor &) = delete;
+ const ConnectionFileDescriptor &
+ operator=(const ConnectionFileDescriptor &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ConnectionFileDescriptor_h_
+#endif // LLDB_HOST_POSIX_CONNECTIONFILEDESCRIPTORPOSIX_H
diff --git a/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h b/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h
index e407ce1..35c3381 100644
--- a/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h
+++ b/linux-x64/clang/include/lldb/Host/posix/DomainSocket.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DomainSocket_h_
-#define liblldb_DomainSocket_h_
+#ifndef LLDB_HOST_POSIX_DOMAINSOCKET_H
+#define LLDB_HOST_POSIX_DOMAINSOCKET_H
#include "lldb/Host/Socket.h"
@@ -34,4 +34,4 @@
};
}
-#endif // ifndef liblldb_DomainSocket_h_
+#endif // LLDB_HOST_POSIX_DOMAINSOCKET_H
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h
index 2691013..825c79f 100644
--- a/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/HostInfoPosix.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_posix_HostInfoPosix_h_
-#define lldb_Host_posix_HostInfoPosix_h_
+#ifndef LLDB_HOST_POSIX_HOSTINFOPOSIX_H
+#define LLDB_HOST_POSIX_HOSTINFOPOSIX_H
#include "lldb/Host/HostInfoBase.h"
#include "lldb/Utility/FileSpec.h"
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h
index a313358..5def1b7 100644
--- a/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/HostProcessPosix.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_HostProcesPosix_h_
-#define lldb_Host_HostProcesPosix_h_
+#ifndef LLDB_HOST_POSIX_HOSTPROCESSPOSIX_H
+#define LLDB_HOST_POSIX_HOSTPROCESSPOSIX_H
#include "lldb/Host/HostNativeProcessBase.h"
#include "lldb/Utility/Status.h"
@@ -39,4 +39,4 @@
} // namespace lldb_private
-#endif // lldb_Host_HostProcesPosix_h_
+#endif // LLDB_HOST_POSIX_HOSTPROCESSPOSIX_H
diff --git a/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h b/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h
index 54012e1..6c8e09f 100644
--- a/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/HostThreadPosix.h
@@ -6,15 +6,16 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_posix_HostThreadPosix_h_
-#define lldb_Host_posix_HostThreadPosix_h_
+#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);
+ HostThreadPosix(const HostThreadPosix &) = delete;
+ const HostThreadPosix &operator=(const HostThreadPosix &) = delete;
public:
HostThreadPosix();
@@ -29,4 +30,4 @@
} // namespace lldb_private
-#endif // lldb_Host_posix_HostThreadPosix_h_
+#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
index 63333bf..870f9a2 100644
--- a/linux-x64/clang/include/lldb/Host/posix/LockFilePosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/LockFilePosix.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_posix_LockFilePosix_h_
-#define liblldb_Host_posix_LockFilePosix_h_
+#ifndef LLDB_HOST_POSIX_LOCKFILEPOSIX_H
+#define LLDB_HOST_POSIX_LOCKFILEPOSIX_H
#include "lldb/Host/LockFileBase.h"
@@ -32,4 +32,4 @@
} // namespace lldb_private
-#endif // liblldb_Host_posix_LockFilePosix_h_
+#endif // LLDB_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
index df341f2..77c0e2f 100644
--- a/linux-x64/clang/include/lldb/Host/posix/PipePosix.h
+++ b/linux-x64/clang/include/lldb/Host/posix/PipePosix.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_posix_PipePosix_h_
-#define liblldb_Host_posix_PipePosix_h_
+#ifndef LLDB_HOST_POSIX_PIPEPOSIX_H
+#define LLDB_HOST_POSIX_PIPEPOSIX_H
#if defined(__cplusplus)
#include "lldb/Host/PipeBase.h"
@@ -77,4 +77,4 @@
} // namespace lldb_private
#endif // #if defined(__cplusplus)
-#endif // liblldb_Host_posix_PipePosix_h_
+#endif // LLDB_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
index 15e2d6d..427fb5b 100644
--- a/linux-x64/clang/include/lldb/Host/posix/ProcessLauncherPosixFork.h
+++ b/linux-x64/clang/include/lldb/Host/posix/ProcessLauncherPosixFork.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Host_posix_ProcessLauncherPosixFork_h_
-#define lldb_Host_posix_ProcessLauncherPosixFork_h_
+#ifndef LLDB_HOST_POSIX_PROCESSLAUNCHERPOSIXFORK_H
+#define LLDB_HOST_POSIX_PROCESSLAUNCHERPOSIXFORK_H
#include "lldb/Host/ProcessLauncher.h"
diff --git a/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h b/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h
index 8856708..d8f06a7 100644
--- a/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h
+++ b/linux-x64/clang/include/lldb/Host/windows/ConnectionGenericFileWindows.h
@@ -56,7 +56,9 @@
std::string m_uri;
- DISALLOW_COPY_AND_ASSIGN(ConnectionGenericFile);
+ ConnectionGenericFile(const ConnectionGenericFile &) = delete;
+ const ConnectionGenericFile &
+ operator=(const ConnectionGenericFile &) = delete;
};
}
diff --git a/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h b/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h
index be3f7fe..a745395 100644
--- a/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h
+++ b/linux-x64/clang/include/lldb/Host/windows/HostThreadWindows.h
@@ -16,7 +16,8 @@
namespace lldb_private {
class HostThreadWindows : public HostNativeThreadBase {
- DISALLOW_COPY_AND_ASSIGN(HostThreadWindows);
+ HostThreadWindows(const HostThreadWindows &) = delete;
+ const HostThreadWindows &operator=(const HostThreadWindows &) = delete;
public:
HostThreadWindows();
@@ -25,10 +26,10 @@
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;
+ Status Join(lldb::thread_result_t *result) override;
+ Status Cancel() override;
+ void Reset() override;
+ bool EqualsThread(lldb::thread_t thread) const override;
lldb::tid_t GetThreadId() const;
diff --git a/linux-x64/clang/include/lldb/Host/windows/PosixApi.h b/linux-x64/clang/include/lldb/Host/windows/PosixApi.h
index 6a6ed3e..aee7394 100644
--- a/linux-x64/clang/include/lldb/Host/windows/PosixApi.h
+++ b/linux-x64/clang/include/lldb/Host/windows/PosixApi.h
@@ -31,20 +31,30 @@
#define SIGKILL 9
#define SIGSTOP 20
-#if defined(_MSC_VER)
+#ifndef S_IRUSR
#define S_IRUSR S_IREAD /* read, user */
#define S_IWUSR S_IWRITE /* write, user */
#define S_IXUSR 0 /* execute, user */
#endif
+#ifndef S_IRGRP
#define S_IRGRP 0 /* read, group */
#define S_IWGRP 0 /* write, group */
#define S_IXGRP 0 /* execute, group */
+#endif
+#ifndef S_IROTH
#define S_IROTH 0 /* read, others */
#define S_IWOTH 0 /* write, others */
#define S_IXOTH 0 /* execute, others */
+#endif
+#ifndef S_IRWXU
#define S_IRWXU 0
+#endif
+#ifndef S_IRWXG
#define S_IRWXG 0
+#endif
+#ifndef S_IRWXO
#define S_IRWXO 0
+#endif
#if HAVE_SYS_TYPES_H
// pyconfig.h typedefs this. We require python headers to be included before
@@ -88,7 +98,6 @@
// 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
diff --git a/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h b/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h
index e765f1e..81aea5b 100644
--- a/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h
+++ b/linux-x64/clang/include/lldb/Host/windows/ProcessLauncherWindows.h
@@ -18,8 +18,8 @@
class ProcessLauncherWindows : public ProcessLauncher {
public:
- virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
- Status &error);
+ HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+ Status &error) override;
protected:
HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);