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/API/LLDB.h b/linux-x64/clang/include/lldb/API/LLDB.h
index 0806ab7..f7390cf 100644
--- a/linux-x64/clang/include/lldb/API/LLDB.h
+++ b/linux-x64/clang/include/lldb/API/LLDB.h
@@ -6,17 +6,18 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_LLDB_h_
-#define LLDB_LLDB_h_
+#ifndef LLDB_API_LLDB_H
+#define LLDB_API_LLDB_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBBreakpointName.h"
#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBBreakpointName.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandInterpreterRunOptions.h"
#include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBCommunication.h"
#include "lldb/API/SBCompileUnit.h"
@@ -24,10 +25,12 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBDeclaration.h"
#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBEnvironment.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBExecutionContext.h"
#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFile.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBFrame.h"
@@ -77,4 +80,4 @@
#include "lldb/API/SBVariablesOptions.h"
#include "lldb/API/SBWatchpoint.h"
-#endif // LLDB_LLDB_h_
+#endif // LLDB_API_LLDB_H
diff --git a/linux-x64/clang/include/lldb/API/SBAddress.h b/linux-x64/clang/include/lldb/API/SBAddress.h
index 2874a36..5a792a2 100644
--- a/linux-x64/clang/include/lldb/API/SBAddress.h
+++ b/linux-x64/clang/include/lldb/API/SBAddress.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBAddress_h_
-#define LLDB_SBAddress_h_
+#ifndef LLDB_API_SBADDRESS_H
+#define LLDB_API_SBADDRESS_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBModule.h"
@@ -115,9 +115,9 @@
const lldb_private::Address &ref() const;
- SBAddress(const lldb_private::Address *lldb_object_ptr);
+ SBAddress(const lldb_private::Address &address);
- void SetAddress(const lldb_private::Address *lldb_object_ptr);
+ void SetAddress(const lldb_private::Address &address);
private:
std::unique_ptr<lldb_private::Address> m_opaque_up;
@@ -127,4 +127,4 @@
} // namespace lldb
-#endif // LLDB_SBAddress_h_
+#endif // LLDB_API_SBADDRESS_H
diff --git a/linux-x64/clang/include/lldb/API/SBAttachInfo.h b/linux-x64/clang/include/lldb/API/SBAttachInfo.h
index 3c20a08..9b211d0 100644
--- a/linux-x64/clang/include/lldb/API/SBAttachInfo.h
+++ b/linux-x64/clang/include/lldb/API/SBAttachInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBAttachInfo_h_
-#define LLDB_SBAttachInfo_h_
+#ifndef LLDB_API_SBATTACHINFO_H
+#define LLDB_API_SBATTACHINFO_H
#include "lldb/API/SBDefines.h"
@@ -174,4 +174,4 @@
} // namespace lldb
-#endif // LLDB_SBAttachInfo_h_
+#endif // LLDB_API_SBATTACHINFO_H
diff --git a/linux-x64/clang/include/lldb/API/SBBlock.h b/linux-x64/clang/include/lldb/API/SBBlock.h
index 0ca92ff..be1ae18 100644
--- a/linux-x64/clang/include/lldb/API/SBBlock.h
+++ b/linux-x64/clang/include/lldb/API/SBBlock.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBBlock_h_
-#define LLDB_SBBlock_h_
+#ifndef LLDB_API_SBBLOCK_H
+#define LLDB_API_SBBLOCK_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFrame.h"
@@ -92,4 +92,4 @@
} // namespace lldb
-#endif // LLDB_SBBlock_h_
+#endif // LLDB_API_SBBLOCK_H
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpoint.h b/linux-x64/clang/include/lldb/API/SBBreakpoint.h
index 75c0e69..e13dbc5 100644
--- a/linux-x64/clang/include/lldb/API/SBBreakpoint.h
+++ b/linux-x64/clang/include/lldb/API/SBBreakpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBBreakpoint_h_
-#define LLDB_SBBreakpoint_h_
+#ifndef LLDB_API_SBBREAKPOINT_H
+#define LLDB_API_SBBREAKPOINT_H
#include "lldb/API/SBDefines.h"
@@ -42,6 +42,8 @@
void ClearAllBreakpointSites();
+ lldb::SBTarget GetTarget() const;
+
lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
@@ -94,6 +96,9 @@
void SetScriptCallbackFunction(const char *callback_function_name);
+ SBError SetScriptCallbackFunction(const char *callback_function_name,
+ SBStructuredData &extra_args);
+
void SetCommandLineCommands(SBStringList &commands);
bool GetCommandLineCommands(SBStringList &commands);
@@ -102,6 +107,8 @@
bool AddName(const char *new_name);
+ SBError AddNameWithErrorHandling(const char *new_name);
+
void RemoveName(const char *name_to_remove);
bool MatchesName(const char *name);
@@ -135,7 +142,9 @@
// Can only be called from a ScriptedBreakpointResolver...
SBError
AddLocation(SBAddress &address);
-
+
+ SBStructuredData SerializeToStructuredData();
+
private:
friend class SBBreakpointList;
friend class SBBreakpointLocation;
@@ -178,4 +187,4 @@
} // namespace lldb
-#endif // LLDB_SBBreakpoint_h_
+#endif // LLDB_API_SBBREAKPOINT_H
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h b/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h
index 085bed9..a906727 100644
--- a/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h
+++ b/linux-x64/clang/include/lldb/API/SBBreakpointLocation.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBBreakpointLocation_h_
-#define LLDB_SBBreakpointLocation_h_
+#ifndef LLDB_API_SBBREAKPOINTLOCATION_H
+#define LLDB_API_SBBREAKPOINTLOCATION_H
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBDefines.h"
@@ -55,11 +55,14 @@
void SetScriptCallbackFunction(const char *callback_function_name);
+ SBError SetScriptCallbackFunction(const char *callback_function_name,
+ lldb::SBStructuredData &extra_args);
+
SBError SetScriptCallbackBody(const char *script_body_text);
- void SetCommandLineCommands(SBStringList &commands);
+ void SetCommandLineCommands(lldb::SBStringList &commands);
- bool GetCommandLineCommands(SBStringList &commands);
+ bool GetCommandLineCommands(lldb::SBStringList &commands);
void SetThreadID(lldb::tid_t sb_thread_id);
@@ -97,4 +100,4 @@
} // namespace lldb
-#endif // LLDB_SBBreakpointLocation_h_
+#endif // LLDB_API_SBBREAKPOINTLOCATION_H
diff --git a/linux-x64/clang/include/lldb/API/SBBreakpointName.h b/linux-x64/clang/include/lldb/API/SBBreakpointName.h
index 018238b..8dd2c4e 100644
--- a/linux-x64/clang/include/lldb/API/SBBreakpointName.h
+++ b/linux-x64/clang/include/lldb/API/SBBreakpointName.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBBreakpointName_h_
-#define LLDB_SBBreakpointName_h_
+#ifndef LLDB_API_SBBREAKPOINTNAME_H
+#define LLDB_API_SBBREAKPOINTNAME_H
#include "lldb/API/SBDefines.h"
@@ -85,9 +85,12 @@
void SetScriptCallbackFunction(const char *callback_function_name);
- void SetCommandLineCommands(SBStringList &commands);
+ SBError SetScriptCallbackFunction(const char *callback_function_name,
+ SBStructuredData &extra_args);
- bool GetCommandLineCommands(SBStringList &commands);
+ void SetCommandLineCommands(lldb::SBStringList &commands);
+
+ bool GetCommandLineCommands(lldb::SBStringList &commands);
SBError SetScriptCallbackBody(const char *script_body_text);
@@ -116,4 +119,4 @@
} // namespace lldb
-#endif // LLDB_SBBreakpointName_h_
+#endif // LLDB_API_SBBREAKPOINTNAME_H
diff --git a/linux-x64/clang/include/lldb/API/SBBroadcaster.h b/linux-x64/clang/include/lldb/API/SBBroadcaster.h
index fc5e888..69a516a 100644
--- a/linux-x64/clang/include/lldb/API/SBBroadcaster.h
+++ b/linux-x64/clang/include/lldb/API/SBBroadcaster.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBBroadcaster_h_
-#define LLDB_SBBroadcaster_h_
+#ifndef LLDB_API_SBBROADCASTER_H
+#define LLDB_API_SBBROADCASTER_H
#include "lldb/API/SBDefines.h"
@@ -81,4 +81,4 @@
} // namespace lldb
-#endif // LLDB_SBBroadcaster_h_
+#endif // LLDB_API_SBBROADCASTER_H
diff --git a/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h b/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h
index 6c80e8e..2364a8d 100644
--- a/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h
+++ b/linux-x64/clang/include/lldb/API/SBCommandInterpreter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBCommandInterpreter_h_
-#define LLDB_SBCommandInterpreter_h_
+#ifndef LLDB_API_SBCOMMANDINTERPRETER_H
+#define LLDB_API_SBCOMMANDINTERPRETER_H
#include <memory>
@@ -16,52 +16,6 @@
namespace lldb {
-class LLDB_API SBCommandInterpreterRunOptions {
- friend class SBDebugger;
- friend class SBCommandInterpreter;
-
-public:
- SBCommandInterpreterRunOptions();
- ~SBCommandInterpreterRunOptions();
-
- bool GetStopOnContinue() const;
-
- void SetStopOnContinue(bool);
-
- bool GetStopOnError() const;
-
- void SetStopOnError(bool);
-
- bool GetStopOnCrash() const;
-
- void SetStopOnCrash(bool);
-
- bool GetEchoCommands() const;
-
- void SetEchoCommands(bool);
-
- bool GetEchoCommentCommands() const;
-
- void SetEchoCommentCommands(bool echo);
-
- bool GetPrintResults() const;
-
- void SetPrintResults(bool);
-
- bool GetAddToHistory() const;
-
- void SetAddToHistory(bool);
-
-private:
- lldb_private::CommandInterpreterRunOptions *get() const;
-
- lldb_private::CommandInterpreterRunOptions &ref() const;
-
- // This is set in the constructor and will always be valid.
- mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions>
- m_opaque_up;
-};
-
class SBCommandInterpreter {
public:
enum {
@@ -111,15 +65,89 @@
lldb::SBCommand AddMultiwordCommand(const char *name, const char *help);
+ /// Add a new command to the lldb::CommandInterpreter.
+ ///
+ /// The new command won't support autorepeat. If you need this functionality,
+ /// use the override of this function that accepts the \a auto_repeat_command
+ /// parameter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help);
+ /// Add a new command to the lldb::CommandInterpreter.
+ ///
+ /// The new command won't support autorepeat. If you need this functionality,
+ /// use the override of this function that accepts the \a auto_repeat_command
+ /// parameter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \param[in] syntax
+ /// The syntax to show as part of the help message of this command. This
+ /// could include a description of the different arguments and flags this
+ /// command accepts.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help, const char *syntax);
+ /// Add a new command to the lldb::CommandInterpreter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \param[in] syntax
+ /// The syntax to show as part of the help message of this command. This
+ /// could include a description of the different arguments and flags this
+ /// command accepts.
+ ///
+ /// \param[in] auto_repeat_command
+ /// Autorepeating is triggered when the user presses Enter successively
+ /// after executing a command. If \b nullptr is provided, the previous
+ /// exact command will be repeated. If \b "" is provided, autorepeating
+ /// is disabled. Otherwise, the provided string is used as a repeat
+ /// command.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax,
+ const char *auto_repeat_command);
+
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result);
+ void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result,
+ bool is_repl);
void
SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result);
@@ -283,14 +311,90 @@
lldb::SBCommand AddMultiwordCommand(const char *name,
const char *help = nullptr);
+ /// Add a new subcommand to the lldb::SBCommand.
+ ///
+ /// The new command won't support autorepeat. If you need this functionality,
+ /// use the override of this function that accepts the \a auto_repeat
+ /// parameter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help = nullptr);
+ /// Add a new subcommand to the lldb::SBCommand.
+ ///
+ /// The new command won't support autorepeat. If you need this functionality,
+ /// use the override of this function that accepts the \a auto_repeat_command
+ /// parameter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \param[in] syntax
+ /// The syntax to show as part of the help message of this command. This
+ /// could include a description of the different arguments and flags this
+ /// command accepts.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
lldb::SBCommand AddCommand(const char *name,
lldb::SBCommandPluginInterface *impl,
const char *help, const char *syntax);
+ /// Add a new subcommand to the lldb::SBCommand.
+ ///
+ /// The new command won't support autorepeat. If you need this functionality,
+ /// use the override of this function that accepts the \a auto_repeat_command
+ /// parameter.
+ ///
+ /// \param[in] name
+ /// The name of the command.
+ ///
+ /// \param[in] impl
+ /// The handler of this command.
+ ///
+ /// \param[in] help
+ /// The general description to show as part of the help message of this
+ /// command.
+ ///
+ /// \param[in] syntax
+ /// The syntax to show as part of the help message of this command. This
+ /// could include a description of the different arguments and flags this
+ /// command accepts.
+ ///
+ /// \param[in] auto_repeat_command
+ /// Autorepeating is triggered when the user presses Enter successively
+ /// after executing a command. If \b nullptr is provided, the previous
+ /// exact command will be repeated. If \b "" is provided, autorepeating
+ /// is disabled. Otherwise, the provided string is used as a repeat
+ /// command.
+ ///
+ /// \return
+ /// A lldb::SBCommand representing the newly created command.
+ lldb::SBCommand AddCommand(const char *name,
+ lldb::SBCommandPluginInterface *impl,
+ const char *help, const char *syntax,
+ const char *auto_repeat_command);
+
private:
friend class SBDebugger;
friend class SBCommandInterpreter;
@@ -302,4 +406,4 @@
} // namespace lldb
-#endif // LLDB_SBCommandInterpreter_h_
+#endif // LLDB_API_SBCOMMANDINTERPRETER_H
diff --git a/linux-x64/clang/include/lldb/API/SBCommandInterpreterRunOptions.h b/linux-x64/clang/include/lldb/API/SBCommandInterpreterRunOptions.h
new file mode 100644
index 0000000..3c00513
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBCommandInterpreterRunOptions.h
@@ -0,0 +1,106 @@
+//===-- SBCommandInterpreterRunOptions.h ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBCOMMANDINTERPRETERRUNOPTIONS_H
+#define LLDB_API_SBCOMMANDINTERPRETERRUNOPTIONS_H
+
+#include <memory>
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb_private {
+class CommandInterpreterRunOptions;
+class CommandInterpreterRunResult;
+} // namespace lldb_private
+
+namespace lldb {
+
+class LLDB_API SBCommandInterpreterRunOptions {
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+public:
+ SBCommandInterpreterRunOptions();
+ SBCommandInterpreterRunOptions(const SBCommandInterpreterRunOptions &rhs);
+ ~SBCommandInterpreterRunOptions();
+
+ SBCommandInterpreterRunOptions &
+ operator=(const SBCommandInterpreterRunOptions &rhs);
+
+ bool GetStopOnContinue() const;
+
+ void SetStopOnContinue(bool);
+
+ bool GetStopOnError() const;
+
+ void SetStopOnError(bool);
+
+ bool GetStopOnCrash() const;
+
+ void SetStopOnCrash(bool);
+
+ bool GetEchoCommands() const;
+
+ void SetEchoCommands(bool);
+
+ bool GetEchoCommentCommands() const;
+
+ void SetEchoCommentCommands(bool echo);
+
+ bool GetPrintResults() const;
+
+ void SetPrintResults(bool);
+
+ bool GetAddToHistory() const;
+
+ void SetAddToHistory(bool);
+
+ bool GetAutoHandleEvents() const;
+
+ void SetAutoHandleEvents(bool);
+
+ bool GetSpawnThread() const;
+
+ void SetSpawnThread(bool);
+
+private:
+ lldb_private::CommandInterpreterRunOptions *get() const;
+
+ lldb_private::CommandInterpreterRunOptions &ref() const;
+
+ // This is set in the constructor and will always be valid.
+ mutable std::unique_ptr<lldb_private::CommandInterpreterRunOptions>
+ m_opaque_up;
+};
+
+class LLDB_API SBCommandInterpreterRunResult {
+ friend class SBDebugger;
+ friend class SBCommandInterpreter;
+
+public:
+ SBCommandInterpreterRunResult();
+ SBCommandInterpreterRunResult(const SBCommandInterpreterRunResult &rhs);
+ ~SBCommandInterpreterRunResult();
+
+ SBCommandInterpreterRunResult &
+ operator=(const SBCommandInterpreterRunResult &rhs);
+
+ int GetNumberOfErrors() const;
+ lldb::CommandInterpreterResult GetResult() const;
+
+private:
+ SBCommandInterpreterRunResult(
+ const lldb_private::CommandInterpreterRunResult &rhs);
+
+ // This is set in the constructor and will always be valid.
+ std::unique_ptr<lldb_private::CommandInterpreterRunResult> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_API_SBCOMMANDINTERPRETERRUNOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h b/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h
index 2877afb..4ee296e 100644
--- a/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h
+++ b/linux-x64/clang/include/lldb/API/SBCommandReturnObject.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBCommandReturnObject_h_
-#define LLDB_SBCommandReturnObject_h_
+#ifndef LLDB_API_SBCOMMANDRETURNOBJECT_H
+#define LLDB_API_SBCOMMANDRETURNOBJECT_H
#include <stdio.h>
@@ -15,23 +15,27 @@
#include "lldb/API/SBDefines.h"
+namespace lldb_private {
+class SBCommandReturnObjectImpl;
+}
+
namespace lldb {
class LLDB_API SBCommandReturnObject {
public:
SBCommandReturnObject();
+ SBCommandReturnObject(lldb_private::CommandReturnObject &ref);
+
+ // rvalue ctor+assignment are incompatible with Reproducers.
+
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
~SBCommandReturnObject();
- const lldb::SBCommandReturnObject &
+ lldb::SBCommandReturnObject &
operator=(const lldb::SBCommandReturnObject &rhs);
- SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
-
- lldb_private::CommandReturnObject *Release();
-
explicit operator bool() const;
bool IsValid() const;
@@ -40,13 +44,21 @@
const char *GetError();
- size_t PutOutput(FILE *fh);
+ size_t PutOutput(FILE *fh); // DEPRECATED
+
+ size_t PutOutput(SBFile file);
+
+ size_t PutOutput(FileSP file);
size_t GetOutputSize();
size_t GetErrorSize();
- size_t PutError(FILE *fh);
+ size_t PutError(FILE *fh); // DEPRECATED
+
+ size_t PutError(SBFile file);
+
+ size_t PutError(FileSP file);
void Clear();
@@ -64,14 +76,21 @@
bool GetDescription(lldb::SBStream &description);
- // deprecated, these two functions do not take ownership of file handle
- void SetImmediateOutputFile(FILE *fh);
+ void SetImmediateOutputFile(FILE *fh); // DEPRECATED
- void SetImmediateErrorFile(FILE *fh);
+ void SetImmediateErrorFile(FILE *fh); // DEPRECATED
- void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
+ void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED
- void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
+ void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED
+
+ void SetImmediateOutputFile(SBFile file);
+
+ void SetImmediateErrorFile(SBFile file);
+
+ void SetImmediateOutputFile(FileSP file);
+
+ void SetImmediateErrorFile(FileSP file);
void PutCString(const char *string, int len = -1);
@@ -86,6 +105,9 @@
void SetError(const char *error_cstr);
+ // ref() is internal for LLDB only.
+ lldb_private::CommandReturnObject &ref() const;
+
protected:
friend class SBCommandInterpreter;
friend class SBOptions;
@@ -96,14 +118,10 @@
lldb_private::CommandReturnObject &operator*() const;
- lldb_private::CommandReturnObject &ref() const;
-
- void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
-
private:
- std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
+ std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
};
} // namespace lldb
-#endif // LLDB_SBCommandReturnObject_h_
+#endif // LLDB_API_SBCOMMANDRETURNOBJECT_H
diff --git a/linux-x64/clang/include/lldb/API/SBCommunication.h b/linux-x64/clang/include/lldb/API/SBCommunication.h
index 5b803fc..84c341c 100644
--- a/linux-x64/clang/include/lldb/API/SBCommunication.h
+++ b/linux-x64/clang/include/lldb/API/SBCommunication.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBCommunication_h_
-#define LLDB_SBCommunication_h_
+#ifndef LLDB_API_SBCOMMUNICATION_H
+#define LLDB_API_SBCOMMUNICATION_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
@@ -72,7 +72,8 @@
void *callback_baton);
private:
- DISALLOW_COPY_AND_ASSIGN(SBCommunication);
+ SBCommunication(const SBCommunication &) = delete;
+ const SBCommunication &operator=(const SBCommunication &) = delete;
lldb_private::Communication *m_opaque;
bool m_opaque_owned;
@@ -80,4 +81,4 @@
} // namespace lldb
-#endif // LLDB_SBCommunication_h_
+#endif // LLDB_API_SBCOMMUNICATION_H
diff --git a/linux-x64/clang/include/lldb/API/SBCompileUnit.h b/linux-x64/clang/include/lldb/API/SBCompileUnit.h
index b6b1382..0c05ef4 100644
--- a/linux-x64/clang/include/lldb/API/SBCompileUnit.h
+++ b/linux-x64/clang/include/lldb/API/SBCompileUnit.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBCompileUnit_h_
-#define LLDB_SBCompileUnit_h_
+#ifndef LLDB_API_SBCOMPILEUNIT_H
+#define LLDB_API_SBCOMPILEUNIT_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
@@ -92,4 +92,4 @@
} // namespace lldb
-#endif // LLDB_SBCompileUnit_h_
+#endif // LLDB_API_SBCOMPILEUNIT_H
diff --git a/linux-x64/clang/include/lldb/API/SBData.h b/linux-x64/clang/include/lldb/API/SBData.h
index 886fe82..95c8086 100644
--- a/linux-x64/clang/include/lldb/API/SBData.h
+++ b/linux-x64/clang/include/lldb/API/SBData.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBData_h_
-#define LLDB_SBData_h_
+#ifndef LLDB_API_SBDATA_H
+#define LLDB_API_SBDATA_H
#include "lldb/API/SBDefines.h"
@@ -152,4 +152,4 @@
} // namespace lldb
-#endif // LLDB_SBData_h_
+#endif // LLDB_API_SBDATA_H
diff --git a/linux-x64/clang/include/lldb/API/SBDebugger.h b/linux-x64/clang/include/lldb/API/SBDebugger.h
index 417cead..b3bfa23 100644
--- a/linux-x64/clang/include/lldb/API/SBDebugger.h
+++ b/linux-x64/clang/include/lldb/API/SBDebugger.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBDebugger_h_
-#define LLDB_SBDebugger_h_
+#ifndef LLDB_API_SBDEBUGGER_H
+#define LLDB_API_SBDEBUGGER_H
#include <stdio.h>
@@ -88,6 +88,24 @@
FILE *GetErrorFileHandle();
+ SBError SetInputFile(SBFile file);
+
+ SBError SetOutputFile(SBFile file);
+
+ SBError SetErrorFile(SBFile file);
+
+ SBError SetInputFile(FileSP file);
+
+ SBError SetOutputFile(FileSP file);
+
+ SBError SetErrorFile(FileSP file);
+
+ SBFile GetInputFile();
+
+ SBFile GetOutputFile();
+
+ SBFile GetErrorFile();
+
void SaveInputTerminalState();
void RestoreInputTerminalState();
@@ -99,7 +117,14 @@
lldb::SBListener GetListener();
void HandleProcessEvent(const lldb::SBProcess &process,
- const lldb::SBEvent &event, FILE *out, FILE *err);
+ const lldb::SBEvent &event, FILE *out,
+ FILE *err); // DEPRECATED
+
+ void HandleProcessEvent(const lldb::SBProcess &process,
+ const lldb::SBEvent &event, SBFile out, SBFile err);
+
+ void HandleProcessEvent(const lldb::SBProcess &process,
+ const lldb::SBEvent &event, FileSP out, FileSP err);
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
const char *platform_name,
@@ -174,6 +199,10 @@
bool GetUseColor() const;
+ bool SetUseSourceCache(bool use_source_cache);
+
+ bool GetUseSourceCache() const;
+
static bool GetDefaultArchitecture(char *arch_name, size_t arch_name_len);
static bool SetDefaultArchitecture(const char *arch_name);
@@ -261,13 +290,50 @@
SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier);
+ /// Run the command interpreter.
+ ///
+ /// \param[in] auto_handle_events
+ /// If true, automatically handle resulting events. This takes precedence
+ /// and overrides the corresponding option in
+ /// SBCommandInterpreterRunOptions.
+ ///
+ /// \param[in] spawn_thread
+ /// If true, start a new thread for IO handling. This takes precedence
+ /// and overrides the corresponding option in
+ /// SBCommandInterpreterRunOptions.
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread);
+ /// Run the command interpreter.
+ ///
+ /// \param[in] auto_handle_events
+ /// If true, automatically handle resulting events. This takes precedence
+ /// and overrides the corresponding option in
+ /// SBCommandInterpreterRunOptions.
+ ///
+ /// \param[in] spawn_thread
+ /// If true, start a new thread for IO handling. This takes precedence
+ /// and overrides the corresponding option in
+ /// SBCommandInterpreterRunOptions.
+ ///
+ /// \param[in] options
+ /// Parameter collection of type SBCommandInterpreterRunOptions.
+ ///
+ /// \param[out] num_errors
+ /// The number of errors.
+ ///
+ /// \param[out] quit_requested
+ /// Whether a quit was requested.
+ ///
+ /// \param[out] stopped_for_crash
+ /// Whether the interpreter stopped for a crash.
void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
SBCommandInterpreterRunOptions &options,
int &num_errors, bool &quit_requested,
bool &stopped_for_crash);
+ SBCommandInterpreterRunResult
+ RunCommandInterpreter(const SBCommandInterpreterRunOptions &options);
+
SBError RunREPL(lldb::LanguageType language, const char *repl_options);
private:
@@ -294,4 +360,4 @@
} // namespace lldb
-#endif // LLDB_SBDebugger_h_
+#endif // LLDB_API_SBDEBUGGER_H
diff --git a/linux-x64/clang/include/lldb/API/SBDeclaration.h b/linux-x64/clang/include/lldb/API/SBDeclaration.h
index d2b423e..aeaa28e 100644
--- a/linux-x64/clang/include/lldb/API/SBDeclaration.h
+++ b/linux-x64/clang/include/lldb/API/SBDeclaration.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBDeclaration_h_
-#define LLDB_SBDeclaration_h_
+#ifndef LLDB_API_SBDECLARATION_H
+#define LLDB_API_SBDECLARATION_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
@@ -68,4 +68,4 @@
} // namespace lldb
-#endif // LLDB_SBDeclaration_h_
+#endif // LLDB_API_SBDECLARATION_H
diff --git a/linux-x64/clang/include/lldb/API/SBDefines.h b/linux-x64/clang/include/lldb/API/SBDefines.h
index 838c84c..a5b639c 100644
--- a/linux-x64/clang/include/lldb/API/SBDefines.h
+++ b/linux-x64/clang/include/lldb/API/SBDefines.h
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBDefines_h_
-#define LLDB_SBDefines_h_
-
+#ifndef LLDB_API_SBDEFINES_H
+#define LLDB_API_SBDEFINES_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
@@ -29,6 +28,7 @@
class LLDB_API SBCommand;
class LLDB_API SBCommandInterpreter;
class LLDB_API SBCommandInterpreterRunOptions;
+class LLDB_API SBCommandInterpreterRunResult;
class LLDB_API SBCommandPluginInterface;
class LLDB_API SBCommandReturnObject;
class LLDB_API SBCommunication;
@@ -36,11 +36,13 @@
class LLDB_API SBData;
class LLDB_API SBDebugger;
class LLDB_API SBDeclaration;
+class LLDB_API SBEnvironment;
class LLDB_API SBError;
class LLDB_API SBEvent;
class LLDB_API SBEventList;
class LLDB_API SBExecutionContext;
class LLDB_API SBExpressionOptions;
+class LLDB_API SBFile;
class LLDB_API SBFileSpec;
class LLDB_API SBFileSpecList;
class LLDB_API SBFrame;
@@ -98,4 +100,4 @@
lldb::SBBreakpointLocation &location);
}
-#endif // LLDB_SBDefines_h_
+#endif // LLDB_API_SBDEFINES_H
diff --git a/linux-x64/clang/include/lldb/API/SBEnvironment.h b/linux-x64/clang/include/lldb/API/SBEnvironment.h
new file mode 100644
index 0000000..f40ee01
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBEnvironment.h
@@ -0,0 +1,137 @@
+//===-- SBEnvironment.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBENVIRONMENT_H
+#define LLDB_API_SBENVIRONMENT_H
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBEnvironment {
+public:
+ SBEnvironment();
+
+ SBEnvironment(const lldb::SBEnvironment &rhs);
+
+ ~SBEnvironment();
+
+ const lldb::SBEnvironment &operator=(const lldb::SBEnvironment &rhs);
+
+ /// Return the value of a given environment variable.
+ ///
+ /// \param [in] name
+ /// The name of the environment variable.
+ ///
+ /// \return
+ /// The value of the environment variable or null if not present.
+ /// If the environment variable has no value but is present, a valid
+ /// pointer to an empty string will be returned.
+ const char *Get(const char *name);
+
+ /// \return
+ /// The number of environment variables.
+ size_t GetNumValues();
+
+ /// Return the name of the environment variable at a given index from the
+ /// internal list of environment variables.
+ ///
+ /// \param [in] index
+ /// The index of the environment variable in the internal list.
+ ///
+ /// \return
+ /// The name at the given index or null if the index is invalid.
+ const char *GetNameAtIndex(size_t index);
+
+ /// Return the value of the environment variable at a given index from the
+ /// internal list of environment variables.
+ ///
+ /// \param [in] index
+ /// The index of the environment variable in the internal list.
+ ///
+ /// \return
+ /// The value at the given index or null if the index is invalid.
+ /// If the environment variable has no value but is present, a valid
+ /// pointer to an empty string will be returned.
+ const char *GetValueAtIndex(size_t index);
+
+ /// Return all environment variables contained in this object. Each variable
+ /// is returned as a string with the following format
+ /// name=value
+ ///
+ /// \return
+ /// Return an lldb::SBStringList object with the environment variables.
+ SBStringList GetEntries();
+
+ /// Add or replace an existing environment variable. The input must be a
+ /// string with the format
+ /// name=value
+ ///
+ /// \param [in] name_and_value
+ /// The entry to set which conforms to the format mentioned above.
+ void PutEntry(const char *name_and_value);
+
+ /// Update this object with the given environment variables. The input is a
+ /// list of entries with the same format required by SBEnvironment::PutEntry.
+ ///
+ /// If append is false, the provided environment will replace the existing
+ /// environment. Otherwise, existing values will be updated of left untouched
+ /// accordingly.
+ ///
+ /// \param [in] entries
+ /// The environment variable entries.
+ ///
+ /// \param [in] append
+ /// Flag that controls whether to replace the existing environment.
+ void SetEntries(const SBStringList &entries, bool append);
+
+ /// Set the value of a given environment variable.
+ /// If the variable exists, its value is updated only if overwrite is true.
+ ///
+ /// \param [in] name
+ /// The name of the environment variable to set.
+ ///
+ /// \param [in] value
+ /// The value of the environment variable to set.
+ ///
+ /// \param [in] overwrite
+ /// Flag that indicates whether to overwrite an existing environment
+ /// variable.
+ ///
+ /// \return
+ /// Return whether the variable was added or modified.
+ bool Set(const char *name, const char *value, bool overwrite);
+
+ /// Unset an environment variable if exists.
+ ///
+ /// \param [in] name
+ /// The name of the environment variable to unset.
+ ///
+ /// \return
+ /// Return whether a variable was actually unset.
+ bool Unset(const char *name);
+
+ /// Delete all the environment variables.
+ void Clear();
+
+protected:
+ friend class SBPlatform;
+ friend class SBTarget;
+ friend class SBLaunchInfo;
+
+ SBEnvironment(lldb_private::Environment rhs);
+
+ lldb_private::Environment &ref() const;
+
+private:
+ std::unique_ptr<lldb_private::Environment> m_opaque_up;
+};
+
+} // namespace lldb
+
+#endif // LLDB_API_SBENVIRONMENT_H
diff --git a/linux-x64/clang/include/lldb/API/SBError.h b/linux-x64/clang/include/lldb/API/SBError.h
index b076f87..e1960ef 100644
--- a/linux-x64/clang/include/lldb/API/SBError.h
+++ b/linux-x64/clang/include/lldb/API/SBError.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBError_h_
-#define LLDB_SBError_h_
+#ifndef LLDB_API_SBERROR_H
+#define LLDB_API_SBERROR_H
#include "lldb/API/SBDefines.h"
@@ -70,6 +70,7 @@
friend class SBTrace;
friend class SBValue;
friend class SBWatchpoint;
+ friend class SBFile;
lldb_private::Status *get();
@@ -89,4 +90,4 @@
} // namespace lldb
-#endif // LLDB_SBError_h_
+#endif // LLDB_API_SBERROR_H
diff --git a/linux-x64/clang/include/lldb/API/SBEvent.h b/linux-x64/clang/include/lldb/API/SBEvent.h
index d297cbe..a7975bf 100644
--- a/linux-x64/clang/include/lldb/API/SBEvent.h
+++ b/linux-x64/clang/include/lldb/API/SBEvent.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBEvent_h_
-#define LLDB_SBEvent_h_
+#ifndef LLDB_API_SBEVENT_H
+#define LLDB_API_SBEVENT_H
#include "lldb/API/SBDefines.h"
@@ -84,4 +84,4 @@
} // namespace lldb
-#endif // LLDB_SBEvent_h_
+#endif // LLDB_API_SBEVENT_H
diff --git a/linux-x64/clang/include/lldb/API/SBExecutionContext.h b/linux-x64/clang/include/lldb/API/SBExecutionContext.h
index 45c0b1b..d8447ae 100644
--- a/linux-x64/clang/include/lldb/API/SBExecutionContext.h
+++ b/linux-x64/clang/include/lldb/API/SBExecutionContext.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBExecutionContext_h_
-#define LLDB_SBExecutionContext_h_
+#ifndef LLDB_API_SBEXECUTIONCONTEXT_H
+#define LLDB_API_SBEXECUTIONCONTEXT_H
#include "lldb/API/SBDefines.h"
@@ -60,4 +60,4 @@
} // namespace lldb
-#endif // LLDB_SBExecutionContext_h_
+#endif // LLDB_API_SBEXECUTIONCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/API/SBExpressionOptions.h b/linux-x64/clang/include/lldb/API/SBExpressionOptions.h
index 04cd74f..9fc6e9e 100644
--- a/linux-x64/clang/include/lldb/API/SBExpressionOptions.h
+++ b/linux-x64/clang/include/lldb/API/SBExpressionOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBExpressionOptions_h_
-#define LLDB_SBExpressionOptions_h_
+#ifndef LLDB_API_SBEXPRESSIONOPTIONS_H
+#define LLDB_API_SBEXPRESSIONOPTIONS_H
#include "lldb/API/SBDefines.h"
@@ -86,6 +86,10 @@
bool GetAutoApplyFixIts();
+ void SetRetriesWithFixIts(uint64_t retries);
+
+ uint64_t GetRetriesWithFixIts();
+
bool GetTopLevel();
void SetTopLevel(bool b = true);
@@ -112,4 +116,4 @@
} // namespace lldb
-#endif // LLDB_SBExpressionOptions_h_
+#endif // LLDB_API_SBEXPRESSIONOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/API/SBFile.h b/linux-x64/clang/include/lldb/API/SBFile.h
new file mode 100644
index 0000000..a8b1652
--- /dev/null
+++ b/linux-x64/clang/include/lldb/API/SBFile.h
@@ -0,0 +1,50 @@
+//===-- SBFile.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBFILE_H
+#define LLDB_API_SBFILE_H
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb {
+
+class LLDB_API SBFile {
+ friend class SBInstruction;
+ friend class SBInstructionList;
+ friend class SBDebugger;
+ friend class SBCommandReturnObject;
+ friend class SBProcess;
+
+public:
+ SBFile();
+ SBFile(FileSP file_sp);
+ SBFile(const SBFile &rhs);
+ SBFile(FILE *file, bool transfer_ownership);
+ SBFile(int fd, const char *mode, bool transfer_ownership);
+ ~SBFile();
+
+ SBFile &operator=(const SBFile &rhs);
+
+ SBError Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read);
+ SBError Write(const uint8_t *buf, size_t num_bytes, size_t *bytes_written);
+ SBError Flush();
+ bool IsValid() const;
+ SBError Close();
+
+ operator bool() const;
+ bool operator!() const;
+
+ FileSP GetFile() const;
+
+private:
+ FileSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_API_SBFILE_H
diff --git a/linux-x64/clang/include/lldb/API/SBFileSpec.h b/linux-x64/clang/include/lldb/API/SBFileSpec.h
index 2714977..a2f02ac 100644
--- a/linux-x64/clang/include/lldb/API/SBFileSpec.h
+++ b/linux-x64/clang/include/lldb/API/SBFileSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBFileSpec_h_
-#define LLDB_SBFileSpec_h_
+#ifndef LLDB_API_SBFILESPEC_H
+#define LLDB_API_SBFILESPEC_H
#include "lldb/API/SBDefines.h"
@@ -92,4 +92,4 @@
} // namespace lldb
-#endif // LLDB_SBFileSpec_h_
+#endif // LLDB_API_SBFILESPEC_H
diff --git a/linux-x64/clang/include/lldb/API/SBFileSpecList.h b/linux-x64/clang/include/lldb/API/SBFileSpecList.h
index 5a13150..1a65486 100644
--- a/linux-x64/clang/include/lldb/API/SBFileSpecList.h
+++ b/linux-x64/clang/include/lldb/API/SBFileSpecList.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBFileSpecList_h_
-#define LLDB_SBFileSpecList_h_
+#ifndef LLDB_API_SBFILESPECLIST_H
+#define LLDB_API_SBFILESPECLIST_H
#include "lldb/API/SBDefines.h"
@@ -54,4 +54,4 @@
} // namespace lldb
-#endif // LLDB_SBFileSpecList_h_
+#endif // LLDB_API_SBFILESPECLIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBFrame.h b/linux-x64/clang/include/lldb/API/SBFrame.h
index b213f89..2e368ac 100644
--- a/linux-x64/clang/include/lldb/API/SBFrame.h
+++ b/linux-x64/clang/include/lldb/API/SBFrame.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBFrame_h_
-#define LLDB_SBFrame_h_
+#ifndef LLDB_API_SBFRAME_H
+#define LLDB_API_SBFRAME_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBValueList.h"
@@ -202,4 +202,4 @@
} // namespace lldb
-#endif // LLDB_SBFrame_h_
+#endif // LLDB_API_SBFRAME_H
diff --git a/linux-x64/clang/include/lldb/API/SBFunction.h b/linux-x64/clang/include/lldb/API/SBFunction.h
index 43f01d7..bd643a6 100644
--- a/linux-x64/clang/include/lldb/API/SBFunction.h
+++ b/linux-x64/clang/include/lldb/API/SBFunction.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBFunction_h_
-#define LLDB_SBFunction_h_
+#ifndef LLDB_API_SBFUNCTION_H
+#define LLDB_API_SBFUNCTION_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
@@ -79,4 +79,4 @@
} // namespace lldb
-#endif // LLDB_SBFunction_h_
+#endif // LLDB_API_SBFUNCTION_H
diff --git a/linux-x64/clang/include/lldb/API/SBHostOS.h b/linux-x64/clang/include/lldb/API/SBHostOS.h
index ecd7920..b170f8d 100644
--- a/linux-x64/clang/include/lldb/API/SBHostOS.h
+++ b/linux-x64/clang/include/lldb/API/SBHostOS.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBHostOS_h_
-#define LLDB_SBHostOS_h_
+#ifndef LLDB_API_SBHOSTOS_H
+#define LLDB_API_SBHOSTOS_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
@@ -41,4 +41,4 @@
} // namespace lldb
-#endif // LLDB_SBHostOS_h_
+#endif // LLDB_API_SBHOSTOS_H
diff --git a/linux-x64/clang/include/lldb/API/SBInstruction.h b/linux-x64/clang/include/lldb/API/SBInstruction.h
index 0bb5877..7d07e16 100644
--- a/linux-x64/clang/include/lldb/API/SBInstruction.h
+++ b/linux-x64/clang/include/lldb/API/SBInstruction.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBInstruction_h_
-#define LLDB_SBInstruction_h_
+#ifndef LLDB_API_SBINSTRUCTION_H
+#define LLDB_API_SBINSTRUCTION_H
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
@@ -55,6 +55,10 @@
void Print(FILE *out);
+ void Print(SBFile out);
+
+ void Print(FileSP out);
+
bool GetDescription(lldb::SBStream &description);
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
@@ -82,4 +86,4 @@
} // namespace lldb
-#endif // LLDB_SBInstruction_h_
+#endif // LLDB_API_SBINSTRUCTION_H
diff --git a/linux-x64/clang/include/lldb/API/SBInstructionList.h b/linux-x64/clang/include/lldb/API/SBInstructionList.h
index 4434d50..ae89880 100644
--- a/linux-x64/clang/include/lldb/API/SBInstructionList.h
+++ b/linux-x64/clang/include/lldb/API/SBInstructionList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBInstructionList_h_
-#define LLDB_SBInstructionList_h_
+#ifndef LLDB_API_SBINSTRUCTIONLIST_H
+#define LLDB_API_SBINSTRUCTIONLIST_H
#include "lldb/API/SBDefines.h"
@@ -46,6 +46,10 @@
void Print(FILE *out);
+ void Print(SBFile out);
+
+ void Print(FileSP out);
+
bool GetDescription(lldb::SBStream &description);
bool DumpEmulationForAllInstructions(const char *triple);
@@ -56,6 +60,8 @@
friend class SBTarget;
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
+ bool GetDescription(lldb_private::Stream &description);
+
private:
lldb::DisassemblerSP m_opaque_sp;
@@ -63,4 +69,4 @@
} // namespace lldb
-#endif // LLDB_SBInstructionList_h_
+#endif // LLDB_API_SBINSTRUCTIONLIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h b/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h
index d28c441..38aac05 100644
--- a/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h
+++ b/linux-x64/clang/include/lldb/API/SBLanguageRuntime.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBLanguageRuntime_h_
-#define LLDB_SBLanguageRuntime_h_
+#ifndef LLDB_API_SBLANGUAGERUNTIME_H
+#define LLDB_API_SBLANGUAGERUNTIME_H
#include "lldb/API/SBDefines.h"
@@ -22,4 +22,4 @@
} // namespace lldb
-#endif // LLDB_SBLanguageRuntime_h_
+#endif // LLDB_API_SBLANGUAGERUNTIME_H
diff --git a/linux-x64/clang/include/lldb/API/SBLaunchInfo.h b/linux-x64/clang/include/lldb/API/SBLaunchInfo.h
index c7b381f..04ebb57 100644
--- a/linux-x64/clang/include/lldb/API/SBLaunchInfo.h
+++ b/linux-x64/clang/include/lldb/API/SBLaunchInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBLaunchInfo_h_
-#define LLDB_SBLaunchInfo_h_
+#ifndef LLDB_API_SBLAUNCHINFO_H
+#define LLDB_API_SBLAUNCHINFO_H
#include "lldb/API/SBDefines.h"
@@ -26,6 +26,10 @@
~SBLaunchInfo();
+ SBLaunchInfo(const SBLaunchInfo &rhs);
+
+ SBLaunchInfo &operator=(const SBLaunchInfo &rhs);
+
lldb::pid_t GetProcessID();
uint32_t GetUserID();
@@ -90,8 +94,41 @@
const char *GetEnvironmentEntryAtIndex(uint32_t idx);
+ /// Update this object with the given environment variables.
+ ///
+ /// If append is false, the provided environment will replace the existing
+ /// environment. Otherwise, existing values will be updated of left untouched
+ /// accordingly.
+ ///
+ /// \param [in] envp
+ /// The new environment variables as a list of strings with the following
+ /// format
+ /// name=value
+ ///
+ /// \param [in] append
+ /// Flag that controls whether to replace the existing environment.
void SetEnvironmentEntries(const char **envp, bool append);
+ /// Update this object with the given environment variables.
+ ///
+ /// If append is false, the provided environment will replace the existing
+ /// environment. Otherwise, existing values will be updated of left untouched
+ /// accordingly.
+ ///
+ /// \param [in] env
+ /// The new environment variables.
+ ///
+ /// \param [in] append
+ /// Flag that controls whether to replace the existing environment.
+ void SetEnvironment(const SBEnvironment &env, bool append);
+
+ /// Return the environment variables of this object.
+ ///
+ /// \return
+ /// An lldb::SBEnvironment object which is a copy of the SBLaunchInfo's
+ /// environment.
+ SBEnvironment GetEnvironment();
+
void Clear();
const char *GetWorkingDirectory() const;
@@ -146,4 +183,4 @@
} // namespace lldb
-#endif // LLDB_SBLaunchInfo_h_
+#endif // LLDB_API_SBLAUNCHINFO_H
diff --git a/linux-x64/clang/include/lldb/API/SBLineEntry.h b/linux-x64/clang/include/lldb/API/SBLineEntry.h
index 855c28d..7c2431b 100644
--- a/linux-x64/clang/include/lldb/API/SBLineEntry.h
+++ b/linux-x64/clang/include/lldb/API/SBLineEntry.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBLineEntry_h_
-#define LLDB_SBLineEntry_h_
+#ifndef LLDB_API_SBLINEENTRY_H
+#define LLDB_API_SBLINEENTRY_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
@@ -75,4 +75,4 @@
} // namespace lldb
-#endif // LLDB_SBLineEntry_h_
+#endif // LLDB_API_SBLINEENTRY_H
diff --git a/linux-x64/clang/include/lldb/API/SBListener.h b/linux-x64/clang/include/lldb/API/SBListener.h
index 21aface..2144e79 100644
--- a/linux-x64/clang/include/lldb/API/SBListener.h
+++ b/linux-x64/clang/include/lldb/API/SBListener.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBListener_h_
-#define LLDB_SBListener_h_
+#ifndef LLDB_API_SBLISTENER_H
+#define LLDB_API_SBLISTENER_H
#include "lldb/API/SBDefines.h"
@@ -105,4 +105,4 @@
} // namespace lldb
-#endif // LLDB_SBListener_h_
+#endif // LLDB_API_SBLISTENER_H
diff --git a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h
index 2a9ae94..d82c706 100644
--- a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h
+++ b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBMemoryRegionInfo_h_
-#define LLDB_SBMemoryRegionInfo_h_
+#ifndef LLDB_API_SBMEMORYREGIONINFO_H
+#define LLDB_API_SBMEMORYREGIONINFO_H
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
@@ -95,4 +95,4 @@
} // namespace lldb
-#endif // LLDB_SBMemoryRegionInfo_h_
+#endif // LLDB_API_SBMEMORYREGIONINFO_H
diff --git a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h
index 5592efe..a7122ee 100644
--- a/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h
+++ b/linux-x64/clang/include/lldb/API/SBMemoryRegionInfoList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBMemoryRegionInfoList_h_
-#define LLDB_SBMemoryRegionInfoList_h_
+#ifndef LLDB_API_SBMEMORYREGIONINFOLIST_H
+#define LLDB_API_SBMEMORYREGIONINFOLIST_H
#include "lldb/API/SBDefines.h"
@@ -52,4 +52,4 @@
} // namespace lldb
-#endif // LLDB_SBMemoryRegionInfoList_h_
+#endif // LLDB_API_SBMEMORYREGIONINFOLIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBModule.h b/linux-x64/clang/include/lldb/API/SBModule.h
index d2b6a18..dd783fe 100644
--- a/linux-x64/clang/include/lldb/API/SBModule.h
+++ b/linux-x64/clang/include/lldb/API/SBModule.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBModule_h_
-#define LLDB_SBModule_h_
+#ifndef LLDB_API_SBMODULE_H
+#define LLDB_API_SBMODULE_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
@@ -288,12 +288,19 @@
lldb::SBAddress GetObjectFileHeaderAddress() const;
lldb::SBAddress GetObjectFileEntryPointAddress() const;
+ /// Get the number of global modules.
+ static uint32_t GetNumberAllocatedModules();
+
+ /// Remove any global modules which are no longer needed.
+ static void GarbageCollectAllocatedModules();
+
private:
friend class SBAddress;
friend class SBFrame;
friend class SBSection;
friend class SBSymbolContext;
friend class SBTarget;
+ friend class SBType;
explicit SBModule(const lldb::ModuleSP &module_sp);
@@ -306,4 +313,4 @@
} // namespace lldb
-#endif // LLDB_SBModule_h_
+#endif // LLDB_API_SBMODULE_H
diff --git a/linux-x64/clang/include/lldb/API/SBModuleSpec.h b/linux-x64/clang/include/lldb/API/SBModuleSpec.h
index 29b3117..7529879 100644
--- a/linux-x64/clang/include/lldb/API/SBModuleSpec.h
+++ b/linux-x64/clang/include/lldb/API/SBModuleSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBModuleSpec_h_
-#define LLDB_SBModuleSpec_h_
+#ifndef LLDB_API_SBMODULESPEC_H
+#define LLDB_API_SBMODULESPEC_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBFileSpec.h"
@@ -119,4 +119,4 @@
} // namespace lldb
-#endif // LLDB_SBModuleSpec_h_
+#endif // LLDB_API_SBMODULESPEC_H
diff --git a/linux-x64/clang/include/lldb/API/SBPlatform.h b/linux-x64/clang/include/lldb/API/SBPlatform.h
index 7207b2e..98291f1 100644
--- a/linux-x64/clang/include/lldb/API/SBPlatform.h
+++ b/linux-x64/clang/include/lldb/API/SBPlatform.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBPlatform_h_
-#define LLDB_SBPlatform_h_
+#ifndef LLDB_API_SBPLATFORM_H
+#define LLDB_API_SBPLATFORM_H
#include "lldb/API/SBDefines.h"
@@ -28,7 +28,7 @@
~SBPlatformConnectOptions();
- void operator=(const SBPlatformConnectOptions &rhs);
+ SBPlatformConnectOptions &operator=(const SBPlatformConnectOptions &rhs);
const char *GetURL();
@@ -51,14 +51,21 @@
class LLDB_API SBPlatformShellCommand {
public:
+ SBPlatformShellCommand(const char *shell, const char *shell_command);
SBPlatformShellCommand(const char *shell_command);
SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
+ SBPlatformShellCommand &operator=(const SBPlatformShellCommand &rhs);
+
~SBPlatformShellCommand();
void Clear();
+ const char *GetShell();
+
+ void SetShell(const char *shell);
+
const char *GetCommand();
void SetCommand(const char *shell_command);
@@ -89,8 +96,14 @@
SBPlatform(const char *platform_name);
+ SBPlatform(const SBPlatform &rhs);
+
+ SBPlatform &operator=(const SBPlatform &rhs);
+
~SBPlatform();
+ static SBPlatform GetHostPlatform();
+
explicit operator bool() const;
bool IsValid() const;
@@ -146,6 +159,14 @@
SBUnixSignals GetUnixSignals() const;
+ /// Return the environment variables of the remote platform connection
+ /// process.
+ ///
+ /// \return
+ /// An lldb::SBEnvironment object which is a copy of the platform's
+ /// environment.
+ SBEnvironment GetEnvironment();
+
protected:
friend class SBDebugger;
friend class SBTarget;
@@ -163,4 +184,4 @@
} // namespace lldb
-#endif // LLDB_SBPlatform_h_
+#endif // LLDB_API_SBPLATFORM_H
diff --git a/linux-x64/clang/include/lldb/API/SBProcess.h b/linux-x64/clang/include/lldb/API/SBProcess.h
index 863cb3c..a90ec2a 100644
--- a/linux-x64/clang/include/lldb/API/SBProcess.h
+++ b/linux-x64/clang/include/lldb/API/SBProcess.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBProcess_h_
-#define LLDB_SBProcess_h_
+#ifndef LLDB_API_SBPROCESS_H
+#define LLDB_API_SBPROCESS_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
@@ -67,6 +67,10 @@
void ReportEventState(const lldb::SBEvent &event, FILE *out) const;
+ void ReportEventState(const lldb::SBEvent &event, SBFile file) const;
+
+ void ReportEventState(const lldb::SBEvent &event, FileSP file) const;
+
void AppendEventStateReport(const lldb::SBEvent &event,
lldb::SBCommandReturnObject &result);
@@ -218,6 +222,8 @@
bool GetDescription(lldb::SBStream &description);
+ SBStructuredData GetExtendedCrashInformation();
+
/// Start Tracing with the given SBTraceOptions.
///
/// \param[in] options
@@ -412,4 +418,4 @@
} // namespace lldb
-#endif // LLDB_SBProcess_h_
+#endif // LLDB_API_SBPROCESS_H
diff --git a/linux-x64/clang/include/lldb/API/SBProcessInfo.h b/linux-x64/clang/include/lldb/API/SBProcessInfo.h
index 86dba9a..0cc5f6a 100644
--- a/linux-x64/clang/include/lldb/API/SBProcessInfo.h
+++ b/linux-x64/clang/include/lldb/API/SBProcessInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBProcessInfo_h_
-#define LLDB_SBProcessInfo_h_
+#ifndef LLDB_API_SBPROCESSINFO_H
+#define LLDB_API_SBPROCESSINFO_H
#include "lldb/API/SBDefines.h"
@@ -62,4 +62,4 @@
} // namespace lldb
-#endif // LLDB_SBProcessInfo_h_
+#endif // LLDB_API_SBPROCESSINFO_H
diff --git a/linux-x64/clang/include/lldb/API/SBQueue.h b/linux-x64/clang/include/lldb/API/SBQueue.h
index 0124c1c..c563f3e 100644
--- a/linux-x64/clang/include/lldb/API/SBQueue.h
+++ b/linux-x64/clang/include/lldb/API/SBQueue.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBQueue_h_
-#define LLDB_SBQueue_h_
+#ifndef LLDB_API_SBQUEUE_H
+#define LLDB_API_SBQUEUE_H
#include <vector>
@@ -66,4 +66,4 @@
} // namespace lldb
-#endif // LLDB_SBQueue_h_
+#endif // LLDB_API_SBQUEUE_H
diff --git a/linux-x64/clang/include/lldb/API/SBQueueItem.h b/linux-x64/clang/include/lldb/API/SBQueueItem.h
index 455a1f9..435dafe 100644
--- a/linux-x64/clang/include/lldb/API/SBQueueItem.h
+++ b/linux-x64/clang/include/lldb/API/SBQueueItem.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBQueueItem_h_
-#define LLDB_SBQueueItem_h_
+#ifndef LLDB_API_SBQUEUEITEM_H
+#define LLDB_API_SBQUEUEITEM_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
@@ -46,4 +46,4 @@
} // namespace lldb
-#endif // LLDB_SBQueueItem_h_
+#endif // LLDB_API_SBQUEUEITEM_H
diff --git a/linux-x64/clang/include/lldb/API/SBReproducer.h b/linux-x64/clang/include/lldb/API/SBReproducer.h
index 0f1739d..ecf28d6 100644
--- a/linux-x64/clang/include/lldb/API/SBReproducer.h
+++ b/linux-x64/clang/include/lldb/API/SBReproducer.h
@@ -11,8 +11,32 @@
#include "lldb/API/SBDefines.h"
+namespace lldb_private {
+namespace repro {
+struct ReplayOptions;
+}
+} // namespace lldb_private
+
namespace lldb {
+class LLDB_API SBReplayOptions {
+public:
+ SBReplayOptions();
+ SBReplayOptions(const SBReplayOptions &rhs);
+ ~SBReplayOptions();
+
+ SBReplayOptions &operator=(const SBReplayOptions &rhs);
+
+ void SetVerify(bool verify);
+ bool GetVerify() const;
+
+ void SetCheckVersion(bool check);
+ bool GetCheckVersion() const;
+
+private:
+ std::unique_ptr<lldb_private::repro::ReplayOptions> m_opaque_up;
+};
+
/// The SBReproducer class is special because it bootstraps the capture and
/// replay of SB API calls. As a result we cannot rely on any other SB objects
/// in the interface or implementation of this class.
@@ -21,6 +45,20 @@
static const char *Capture();
static const char *Capture(const char *path);
static const char *Replay(const char *path);
+ static const char *Replay(const char *path, bool skip_version_check);
+ static const char *Replay(const char *path, const SBReplayOptions &options);
+ static const char *PassiveReplay(const char *path);
+ static const char *Finalize(const char *path);
+ static const char *GetPath();
+ static bool SetAutoGenerate(bool b);
+ static bool Generate();
+
+ /// The working directory is set to the current working directory when the
+ /// reproducers are initialized. This method allows setting a different
+ /// working directory. This is used by the API test suite which temporarily
+ /// changes the directory to where the test lives. This is a NO-OP in every
+ /// mode but capture.
+ static void SetWorkingDirectory(const char *path);
};
} // namespace lldb
diff --git a/linux-x64/clang/include/lldb/API/SBSection.h b/linux-x64/clang/include/lldb/API/SBSection.h
index 06a195e..d722dbe 100644
--- a/linux-x64/clang/include/lldb/API/SBSection.h
+++ b/linux-x64/clang/include/lldb/API/SBSection.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBSection_h_
-#define LLDB_SBSection_h_
+#ifndef LLDB_API_SBSECTION_H
+#define LLDB_API_SBSECTION_H
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
@@ -98,4 +98,4 @@
} // namespace lldb
-#endif // LLDB_SBSection_h_
+#endif // LLDB_API_SBSECTION_H
diff --git a/linux-x64/clang/include/lldb/API/SBSourceManager.h b/linux-x64/clang/include/lldb/API/SBSourceManager.h
index 3d69aa2..c8302db 100644
--- a/linux-x64/clang/include/lldb/API/SBSourceManager.h
+++ b/linux-x64/clang/include/lldb/API/SBSourceManager.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBSourceManager_h_
-#define LLDB_SBSourceManager_h_
+#ifndef LLDB_API_SBSOURCEMANAGER_H
+#define LLDB_API_SBSOURCEMANAGER_H
#include "lldb/API/SBDefines.h"
@@ -44,4 +44,4 @@
} // namespace lldb
-#endif // LLDB_SBSourceManager_h_
+#endif // LLDB_API_SBSOURCEMANAGER_H
diff --git a/linux-x64/clang/include/lldb/API/SBStream.h b/linux-x64/clang/include/lldb/API/SBStream.h
index 8afbf45..f44b87b 100644
--- a/linux-x64/clang/include/lldb/API/SBStream.h
+++ b/linux-x64/clang/include/lldb/API/SBStream.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBStream_h_
-#define LLDB_SBStream_h_
+#ifndef LLDB_API_SBSTREAM_H
+#define LLDB_API_SBSTREAM_H
#include <stdio.h>
@@ -37,8 +37,14 @@
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+ void Print(const char *str);
+
void RedirectToFile(const char *path, bool append);
+ void RedirectToFile(lldb::SBFile file);
+
+ void RedirectToFile(lldb::FileSP file);
+
void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
@@ -95,11 +101,12 @@
lldb_private::Stream &ref();
private:
- DISALLOW_COPY_AND_ASSIGN(SBStream);
+ SBStream(const SBStream &) = delete;
+ const SBStream &operator=(const SBStream &) = delete;
std::unique_ptr<lldb_private::Stream> m_opaque_up;
bool m_is_file;
};
} // namespace lldb
-#endif // LLDB_SBStream_h_
+#endif // LLDB_API_SBSTREAM_H
diff --git a/linux-x64/clang/include/lldb/API/SBStringList.h b/linux-x64/clang/include/lldb/API/SBStringList.h
index 1df1e45..4842c16 100644
--- a/linux-x64/clang/include/lldb/API/SBStringList.h
+++ b/linux-x64/clang/include/lldb/API/SBStringList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBStringList_h_
-#define LLDB_SBStringList_h_
+#ifndef LLDB_API_SBSTRINGLIST_H
+#define LLDB_API_SBSTRINGLIST_H
#include "lldb/API/SBDefines.h"
@@ -62,4 +62,4 @@
} // namespace lldb
-#endif // LLDB_SBStringList_h_
+#endif // LLDB_API_SBSTRINGLIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBStructuredData.h b/linux-x64/clang/include/lldb/API/SBStructuredData.h
index 5b10133..44a86bd 100644
--- a/linux-x64/clang/include/lldb/API/SBStructuredData.h
+++ b/linux-x64/clang/include/lldb/API/SBStructuredData.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef SBStructuredData_h
-#define SBStructuredData_h
+#ifndef LLDB_API_SBSTRUCTUREDDATA_H
+#define LLDB_API_SBSTRUCTUREDDATA_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBModule.h"
@@ -91,9 +91,15 @@
friend class SBTraceOptions;
friend class SBDebugger;
friend class SBTarget;
+ friend class SBProcess;
+ friend class SBThread;
+ friend class SBThreadPlan;
+ friend class SBBreakpoint;
+ friend class SBBreakpointLocation;
+ friend class SBBreakpointName;
StructuredDataImplUP m_impl_up;
};
} // namespace lldb
-#endif /* SBStructuredData_h */
+#endif // LLDB_API_SBSTRUCTUREDDATA_H
diff --git a/linux-x64/clang/include/lldb/API/SBSymbol.h b/linux-x64/clang/include/lldb/API/SBSymbol.h
index 52486b8..66f73c8 100644
--- a/linux-x64/clang/include/lldb/API/SBSymbol.h
+++ b/linux-x64/clang/include/lldb/API/SBSymbol.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBSymbol_h_
-#define LLDB_SBSymbol_h_
+#ifndef LLDB_API_SBSYMBOL_H
+#define LLDB_API_SBSYMBOL_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDefines.h"
@@ -83,4 +83,4 @@
} // namespace lldb
-#endif // LLDB_SBSymbol_h_
+#endif // LLDB_API_SBSYMBOL_H
diff --git a/linux-x64/clang/include/lldb/API/SBSymbolContext.h b/linux-x64/clang/include/lldb/API/SBSymbolContext.h
index 3d16d09..16ad29e 100644
--- a/linux-x64/clang/include/lldb/API/SBSymbolContext.h
+++ b/linux-x64/clang/include/lldb/API/SBSymbolContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBSymbolContext_h_
-#define LLDB_SBSymbolContext_h_
+#ifndef LLDB_API_SBSYMBOLCONTEXT_H
+#define LLDB_API_SBSYMBOLCONTEXT_H
#include "lldb/API/SBBlock.h"
#include "lldb/API/SBCompileUnit.h"
@@ -80,4 +80,4 @@
} // namespace lldb
-#endif // LLDB_SBSymbolContext_h_
+#endif // LLDB_API_SBSYMBOLCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/API/SBSymbolContextList.h b/linux-x64/clang/include/lldb/API/SBSymbolContextList.h
index 577993c..4026afc 100644
--- a/linux-x64/clang/include/lldb/API/SBSymbolContextList.h
+++ b/linux-x64/clang/include/lldb/API/SBSymbolContextList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBSymbolContextList_h_
-#define LLDB_SBSymbolContextList_h_
+#ifndef LLDB_API_SBSYMBOLCONTEXTLIST_H
+#define LLDB_API_SBSYMBOLCONTEXTLIST_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBSymbolContext.h"
@@ -55,4 +55,4 @@
} // namespace lldb
-#endif // LLDB_SBSymbolContextList_h_
+#endif // LLDB_API_SBSYMBOLCONTEXTLIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBTarget.h b/linux-x64/clang/include/lldb/API/SBTarget.h
index 80a7fa0..30f4005 100644
--- a/linux-x64/clang/include/lldb/API/SBTarget.h
+++ b/linux-x64/clang/include/lldb/API/SBTarget.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTarget_h_
-#define LLDB_SBTarget_h_
+#ifndef LLDB_API_SBTARGET_H
+#define LLDB_API_SBTARGET_H
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
@@ -94,6 +94,15 @@
/// A platform object.
lldb::SBPlatform GetPlatform();
+ /// Return the environment variables that would be used to launch a new
+ /// process.
+ ///
+ /// \return
+ /// An lldb::SBEnvironment object which is a copy of the target's
+ /// environment.
+
+ SBEnvironment GetEnvironment();
+
/// Install any binaries that need to be installed.
///
/// This function does nothing when debugging on the host system.
@@ -127,7 +136,9 @@
/// The argument array.
///
/// \param[in] envp
- /// The environment array.
+ /// The environment array. If this is null, the default
+ /// environment values (provided through `settings set
+ /// target.env-vars`) will be used.
///
/// \param[in] stdin_path
/// The path to use when re-directing the STDIN of the new
@@ -175,7 +186,9 @@
/// The argument array.
///
/// \param[in] envp
- /// The environment array.
+ /// The environment array. If this isn't provided, the default
+ /// environment values (provided through `settings set
+ /// target.env-vars`) will be used.
///
/// \param[in] working_directory
/// The working directory to have the child process run in
@@ -547,6 +560,12 @@
uint32_t column, lldb::addr_t offset,
SBFileSpecList &module_list);
+ lldb::SBBreakpoint
+ BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
+ uint32_t column, lldb::addr_t offset,
+ SBFileSpecList &module_list,
+ bool move_to_nearest_code);
+
lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
const char *module_name = nullptr);
@@ -829,6 +848,7 @@
friend class SBFunction;
friend class SBInstruction;
friend class SBModule;
+ friend class SBPlatform;
friend class SBProcess;
friend class SBSection;
friend class SBSourceManager;
@@ -849,4 +869,4 @@
} // namespace lldb
-#endif // LLDB_SBTarget_h_
+#endif // LLDB_API_SBTARGET_H
diff --git a/linux-x64/clang/include/lldb/API/SBThread.h b/linux-x64/clang/include/lldb/API/SBThread.h
index da8726a..894120c 100644
--- a/linux-x64/clang/include/lldb/API/SBThread.h
+++ b/linux-x64/clang/include/lldb/API/SBThread.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBThread_h_
-#define LLDB_SBThread_h_
+#ifndef LLDB_API_SBTHREAD_H
+#define LLDB_API_SBTHREAD_H
#include "lldb/API/SBDefines.h"
@@ -122,6 +122,10 @@
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
bool resume_immediately);
+ SBError StepUsingScriptedThreadPlan(const char *script_class_name,
+ lldb::SBStructuredData &args_data,
+ bool resume_immediately);
+
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
void RunToAddress(lldb::addr_t addr);
@@ -228,4 +232,4 @@
} // namespace lldb
-#endif // LLDB_SBThread_h_
+#endif // LLDB_API_SBTHREAD_H
diff --git a/linux-x64/clang/include/lldb/API/SBThreadCollection.h b/linux-x64/clang/include/lldb/API/SBThreadCollection.h
index 1c6b463..fe57a6b 100644
--- a/linux-x64/clang/include/lldb/API/SBThreadCollection.h
+++ b/linux-x64/clang/include/lldb/API/SBThreadCollection.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBThreadCollection_h_
-#define LLDB_SBThreadCollection_h_
+#ifndef LLDB_API_SBTHREADCOLLECTION_H
+#define LLDB_API_SBTHREADCOLLECTION_H
#include "lldb/API/SBDefines.h"
@@ -54,4 +54,4 @@
} // namespace lldb
-#endif // LLDB_SBThreadCollection_h_
+#endif // LLDB_API_SBTHREADCOLLECTION_H
diff --git a/linux-x64/clang/include/lldb/API/SBThreadPlan.h b/linux-x64/clang/include/lldb/API/SBThreadPlan.h
index 007e9e2..0dc4843 100644
--- a/linux-x64/clang/include/lldb/API/SBThreadPlan.h
+++ b/linux-x64/clang/include/lldb/API/SBThreadPlan.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBThreadPlan_h_
-#define LLDB_SBThreadPlan_h_
+#ifndef LLDB_API_SBTHREADPLAN_H
+#define LLDB_API_SBTHREADPLAN_H
#include "lldb/API/SBDefines.h"
@@ -28,6 +28,9 @@
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
+ SBThreadPlan(lldb::SBThread &thread, const char *class_name,
+ lldb::SBStructuredData &args_data);
+
~SBThreadPlan();
explicit operator bool() const;
@@ -74,6 +77,10 @@
bool IsValid();
+ bool GetStopOthers();
+
+ void SetStopOthers(bool stop_others);
+
// This section allows an SBThreadPlan to push another of the common types of
// plans...
SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
@@ -100,6 +107,9 @@
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
SBError &error);
+ SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
+ lldb::SBStructuredData &args_data,
+ SBError &error);
private:
friend class SBBreakpoint;
@@ -111,12 +121,13 @@
friend class lldb_private::QueueImpl;
friend class SBQueueItem;
- lldb_private::ThreadPlan *get();
+ lldb::ThreadPlanSP GetSP() const { return m_opaque_wp.lock(); }
+ lldb_private::ThreadPlan *get() const { return GetSP().get(); }
void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp);
- lldb::ThreadPlanSP m_opaque_sp;
+ lldb::ThreadPlanWP m_opaque_wp;
};
} // namespace lldb
-#endif // LLDB_SBThreadPlan_h_
+#endif // LLDB_API_SBTHREADPLAN_H
diff --git a/linux-x64/clang/include/lldb/API/SBTrace.h b/linux-x64/clang/include/lldb/API/SBTrace.h
index 87c67ad..053abae 100644
--- a/linux-x64/clang/include/lldb/API/SBTrace.h
+++ b/linux-x64/clang/include/lldb/API/SBTrace.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTrace_h_
-#define LLDB_SBTrace_h_
+#ifndef LLDB_API_SBTRACE_H
+#define LLDB_API_SBTRACE_H
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBError.h"
@@ -113,4 +113,4 @@
};
} // namespace lldb
-#endif // LLDB_SBTrace_h_
+#endif // LLDB_API_SBTRACE_H
diff --git a/linux-x64/clang/include/lldb/API/SBTraceOptions.h b/linux-x64/clang/include/lldb/API/SBTraceOptions.h
index 4c586bf..22d71fb 100644
--- a/linux-x64/clang/include/lldb/API/SBTraceOptions.h
+++ b/linux-x64/clang/include/lldb/API/SBTraceOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef SBTRACEOPTIONS_H_
-#define SBTRACEOPTIONS_H_
+#ifndef LLDB_API_SBTRACEOPTIONS_H
+#define LLDB_API_SBTRACEOPTIONS_H
#include "lldb/API/SBDefines.h"
@@ -56,4 +56,4 @@
};
}
-#endif /* SBTRACEOPTIONS_H_ */
+#endif // LLDB_API_SBTRACEOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/API/SBType.h b/linux-x64/clang/include/lldb/API/SBType.h
index b3f92b7..529b4d0 100644
--- a/linux-x64/clang/include/lldb/API/SBType.h
+++ b/linux-x64/clang/include/lldb/API/SBType.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBType_h_
-#define LLDB_SBType_h_
+#ifndef LLDB_API_SBTYPE_H
+#define LLDB_API_SBTYPE_H
#include "lldb/API/SBDefines.h"
@@ -131,6 +131,8 @@
bool IsAnonymousType();
+ bool IsScopedEnumerationType();
+
lldb::SBType GetPointerType();
lldb::SBType GetPointeeType();
@@ -150,6 +152,9 @@
lldb::SBType GetVectorElementType();
lldb::SBType GetCanonicalType();
+
+ lldb::SBType GetEnumerationIntegerType();
+
// Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
// type eBasicTypeInvalid will be returned
lldb::BasicType GetBasicType();
@@ -185,6 +190,8 @@
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx);
+ lldb::SBModule GetModule();
+
const char *GetName();
const char *GetDisplayTypeName();
@@ -259,4 +266,4 @@
} // namespace lldb
-#endif // LLDB_SBType_h_
+#endif // LLDB_API_SBTYPE_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeCategory.h b/linux-x64/clang/include/lldb/API/SBTypeCategory.h
index c0f4cee..ee1c0f6 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeCategory.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeCategory.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeCategory_h_
-#define LLDB_SBTypeCategory_h_
+#ifndef LLDB_API_SBTYPECATEGORY_H
+#define LLDB_API_SBTYPECATEGORY_H
#include "lldb/API/SBDefines.h"
@@ -113,4 +113,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeCategory_h_
+#endif // LLDB_API_SBTYPECATEGORY_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h b/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h
index 2410dbc..45f8cc6 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeEnumMember.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeEnumMember_h_
-#define LLDB_SBTypeEnumMember_h_
+#ifndef LLDB_API_SBTYPEENUMMEMBER_H
+#define LLDB_API_SBTYPEENUMMEMBER_H
#include "lldb/API/SBDefines.h"
@@ -80,4 +80,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeEnumMember_h_
+#endif // LLDB_API_SBTYPEENUMMEMBER_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeFilter.h b/linux-x64/clang/include/lldb/API/SBTypeFilter.h
index 4a0de11..5f02e23 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeFilter.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeFilter.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeFilter_h_
-#define LLDB_SBTypeFilter_h_
+#ifndef LLDB_API_SBTYPEFILTER_H
+#define LLDB_API_SBTYPEFILTER_H
#include "lldb/API/SBDefines.h"
@@ -71,4 +71,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeFilter_h_
+#endif // LLDB_API_SBTYPEFILTER_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeFormat.h b/linux-x64/clang/include/lldb/API/SBTypeFormat.h
index 8a0ac77..b340459 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeFormat.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeFormat.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeFormat_h_
-#define LLDB_SBTypeFormat_h_
+#ifndef LLDB_API_SBTYPEFORMAT_H
+#define LLDB_API_SBTYPEFORMAT_H
#include "lldb/API/SBDefines.h"
@@ -75,4 +75,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeFormat_h_
+#endif // LLDB_API_SBTYPEFORMAT_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h b/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h
index 9fe449d..eee424c 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeNameSpecifier.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeNameSpecifier_h_
-#define LLDB_SBTypeNameSpecifier_h_
+#ifndef LLDB_API_SBTYPENAMESPECIFIER_H
+#define LLDB_API_SBTYPENAMESPECIFIER_H
#include "lldb/API/SBDefines.h"
@@ -62,4 +62,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeNameSpecifier_h_
+#endif // LLDB_API_SBTYPENAMESPECIFIER_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeSummary.h b/linux-x64/clang/include/lldb/API/SBTypeSummary.h
index bb7121f..929bfb6 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeSummary.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeSummary.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeSummary_h_
-#define LLDB_SBTypeSummary_h_
+#ifndef LLDB_API_SBTYPESUMMARY_H
+#define LLDB_API_SBTYPESUMMARY_H
#include "lldb/API/SBDefines.h"
@@ -136,4 +136,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeSummary_h_
+#endif // LLDB_API_SBTYPESUMMARY_H
diff --git a/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h b/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h
index c190643..9dab9d8 100644
--- a/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h
+++ b/linux-x64/clang/include/lldb/API/SBTypeSynthetic.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBTypeSynthetic_h_
-#define LLDB_SBTypeSynthetic_h_
+#ifndef LLDB_API_SBTYPESYNTHETIC_H
+#define LLDB_API_SBTYPESYNTHETIC_H
#include "lldb/API/SBDefines.h"
@@ -77,4 +77,4 @@
} // namespace lldb
-#endif // LLDB_SBTypeSynthetic_h_
+#endif // LLDB_API_SBTYPESYNTHETIC_H
diff --git a/linux-x64/clang/include/lldb/API/SBUnixSignals.h b/linux-x64/clang/include/lldb/API/SBUnixSignals.h
index c7e99d1..9757eac 100644
--- a/linux-x64/clang/include/lldb/API/SBUnixSignals.h
+++ b/linux-x64/clang/include/lldb/API/SBUnixSignals.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBUnixSignals_h_
-#define LLDB_SBUnixSignals_h_
+#ifndef LLDB_API_SBUNIXSIGNALS_H
+#define LLDB_API_SBUNIXSIGNALS_H
#include "lldb/API/SBDefines.h"
@@ -68,4 +68,4 @@
} // namespace lldb
-#endif // LLDB_SBUnixSignals_h_
+#endif // LLDB_API_SBUNIXSIGNALS_H
diff --git a/linux-x64/clang/include/lldb/API/SBValue.h b/linux-x64/clang/include/lldb/API/SBValue.h
index c36ba20..69be025 100644
--- a/linux-x64/clang/include/lldb/API/SBValue.h
+++ b/linux-x64/clang/include/lldb/API/SBValue.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBValue_h_
-#define LLDB_SBValue_h_
+#ifndef LLDB_API_SBVALUE_H
+#define LLDB_API_SBVALUE_H
#include "lldb/API/SBData.h"
#include "lldb/API/SBDefines.h"
@@ -75,8 +75,6 @@
const char *GetObjectDescription();
- const char *GetTypeValidatorResult();
-
lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic);
lldb::SBValue GetStaticValue();
@@ -432,4 +430,4 @@
} // namespace lldb
-#endif // LLDB_SBValue_h_
+#endif // LLDB_API_SBVALUE_H
diff --git a/linux-x64/clang/include/lldb/API/SBValueList.h b/linux-x64/clang/include/lldb/API/SBValueList.h
index d305b35..dc8389b 100644
--- a/linux-x64/clang/include/lldb/API/SBValueList.h
+++ b/linux-x64/clang/include/lldb/API/SBValueList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBValueList_h_
-#define LLDB_SBValueList_h_
+#ifndef LLDB_API_SBVALUELIST_H
+#define LLDB_API_SBVALUELIST_H
#include "lldb/API/SBDefines.h"
@@ -72,4 +72,4 @@
} // namespace lldb
-#endif // LLDB_SBValueList_h_
+#endif // LLDB_API_SBVALUELIST_H
diff --git a/linux-x64/clang/include/lldb/API/SBVariablesOptions.h b/linux-x64/clang/include/lldb/API/SBVariablesOptions.h
index e226ce4..53ab4b7 100644
--- a/linux-x64/clang/include/lldb/API/SBVariablesOptions.h
+++ b/linux-x64/clang/include/lldb/API/SBVariablesOptions.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBVariablesOptions_h_
-#define LLDB_SBVariablesOptions_h_
+#ifndef LLDB_API_SBVARIABLESOPTIONS_H
+#define LLDB_API_SBVARIABLESOPTIONS_H
#include "lldb/API/SBDefines.h"
@@ -79,4 +79,4 @@
} // namespace lldb
-#endif // LLDB_SBValue_h_
+#endif // LLDB_API_SBVARIABLESOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/API/SBWatchpoint.h b/linux-x64/clang/include/lldb/API/SBWatchpoint.h
index 05ff0ca..08c5faa 100644
--- a/linux-x64/clang/include/lldb/API/SBWatchpoint.h
+++ b/linux-x64/clang/include/lldb/API/SBWatchpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_SBWatchpoint_h_
-#define LLDB_SBWatchpoint_h_
+#ifndef LLDB_API_SBWATCHPOINT_H
+#define LLDB_API_SBWATCHPOINT_H
#include "lldb/API/SBDefines.h"
@@ -82,4 +82,4 @@
} // namespace lldb
-#endif // LLDB_SBWatchpoint_h_
+#endif // LLDB_API_SBWATCHPOINT_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h b/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h
index f561b6d..ddb70b7 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/Breakpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Breakpoint_h_
-#define liblldb_Breakpoint_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINT_H
+#define LLDB_BREAKPOINT_BREAKPOINT_H
#include <memory>
#include <string>
@@ -20,6 +20,7 @@
#include "lldb/Breakpoint/BreakpointName.h"
#include "lldb/Breakpoint/BreakpointOptions.h"
#include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/Breakpoint/StoppointHitCounter.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Utility/Event.h"
#include "lldb/Utility/StringList.h"
@@ -137,12 +138,14 @@
lldb::BreakpointSP m_new_breakpoint_sp;
BreakpointLocationCollection m_locations;
- DISALLOW_COPY_AND_ASSIGN(BreakpointEventData);
+ BreakpointEventData(const BreakpointEventData &) = delete;
+ const BreakpointEventData &operator=(const BreakpointEventData &) = delete;
};
// Saving & restoring breakpoints:
static lldb::BreakpointSP CreateFromStructuredData(
- Target &target, StructuredData::ObjectSP &data_object_sp, Status &error);
+ lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp,
+ Status &error);
static bool
SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp,
@@ -193,7 +196,7 @@
/// Tell this breakpoint to scan a given module list and resolve any new
/// locations that match the breakpoint's specifications.
///
- /// \param[in] changed_modules
+ /// \param[in] module_list
/// The list of modules to look in for new locations.
///
/// \param[in] new_locations
@@ -205,7 +208,7 @@
/// which case we will remove any locations that are in modules that got
/// unloaded.
///
- /// \param[in] changedModules
+ /// \param[in] changed_modules
/// The list of modules to look in for new locations.
/// \param[in] load_event
/// If \b true then the modules were loaded, if \b false, unloaded.
@@ -372,10 +375,6 @@
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
/// handled on the public event thread after the stop has been posted.
- ///
- /// \return
- /// \b true if the process should stop when you hit the breakpoint.
- /// \b false if it should continue.
void SetCallback(BreakpointHitCallback callback, void *baton,
bool is_synchronous = false);
@@ -522,7 +521,7 @@
if (name_to_remove)
m_name_list.erase(name_to_remove);
}
-
+
public:
bool MatchesName(const char *name) {
return m_name_list.find(name) != m_name_list.end();
@@ -546,7 +545,7 @@
/// if the condition says to stop and false otherwise.
///
void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
- m_precondition_sp = precondition_sp;
+ m_precondition_sp = std::move(precondition_sp);
}
bool EvaluatePrecondition(StoppointCallbackContext &context);
@@ -554,14 +553,14 @@
lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
// Produces the OR'ed values for all the names assigned to this breakpoint.
- const BreakpointName::Permissions &GetPermissions() const {
- return m_permissions;
+ const BreakpointName::Permissions &GetPermissions() const {
+ return m_permissions;
}
- BreakpointName::Permissions &GetPermissions() {
- return m_permissions;
+ BreakpointName::Permissions &GetPermissions() {
+ return m_permissions;
}
-
+
bool AllowList() const {
return GetPermissions().GetAllowList();
}
@@ -572,6 +571,11 @@
return GetPermissions().GetAllowDelete();
}
+ // This one should only be used by Target to copy breakpoints from target to
+ // target - primarily from the dummy target to prime new targets.
+ static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target,
+ const Breakpoint &bp_to_copy_from);
+
protected:
friend class Target;
// Protected Methods
@@ -621,17 +625,9 @@
bool IgnoreCountShouldStop();
- void IncrementHitCount() { m_hit_count++; }
-
- void DecrementHitCount() {
- assert(m_hit_count > 0);
- m_hit_count--;
- }
-
private:
- // This one should only be used by Target to copy breakpoints from target to
- // target - primarily from the dummy target to prime new targets.
- Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);
+ // To call from CopyFromBreakpoint.
+ Breakpoint(Target &new_target, const Breakpoint &bp_to_copy_from);
// For Breakpoint only
bool m_being_created;
@@ -658,19 +654,22 @@
m_locations; // The list of locations currently found for this breakpoint.
std::string m_kind_description;
bool m_resolve_indirect_symbols;
- uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been
- // hit. This is kept
- // separately from the locations hit counts, since locations can go away when
- // their backing library gets unloaded, and we would lose hit counts.
+
+ /// Number of times this breakpoint has been hit. This is kept separately
+ /// from the locations hit counts, since locations can go away when their
+ /// backing library gets unloaded, and we would lose hit counts.
+ StoppointHitCounter m_hit_counter;
+
BreakpointName::Permissions m_permissions;
void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
void SendBreakpointChangedEvent(BreakpointEventData *data);
- DISALLOW_COPY_AND_ASSIGN(Breakpoint);
+ Breakpoint(const Breakpoint &) = delete;
+ const Breakpoint &operator=(const Breakpoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Breakpoint_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINT_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h
index 0951329..64432f2 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointID.h
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointID_h_
-#define liblldb_BreakpointID_h_
-
+#ifndef LLDB_BREAKPOINT_BREAKPOINTID_H
+#define LLDB_BREAKPOINT_BREAKPOINTID_H
#include "lldb/lldb-private.h"
@@ -65,7 +64,7 @@
/// If it is a mal-formed breakpoint name, error will be set to an appropriate
/// error string.
///
- /// \param[in] input
+ /// \param[in] str
/// A string containing JUST the breakpoint description.
/// \param[out] error
/// If the name is a well-formed breakpoint name, set to success,
@@ -95,4 +94,4 @@
} // namespace lldb_private
-#endif // liblldb_BreakpointID_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTID_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h
index c642922..924cb1f 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointIDList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointIDList_h_
-#define liblldb_BreakpointIDList_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTIDLIST_H
+#define LLDB_BREAKPOINT_BREAKPOINTIDLIST_H
#include <utility>
#include <vector>
@@ -68,9 +68,10 @@
BreakpointIDArray m_breakpoint_ids;
BreakpointID m_invalid_id;
- DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
+ BreakpointIDList(const BreakpointIDList &) = delete;
+ const BreakpointIDList &operator=(const BreakpointIDList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointIDList_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTIDLIST_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h
index fe10adb..346972e 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointList_h_
-#define liblldb_BreakpointList_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTLIST_H
+#define LLDB_BREAKPOINT_BREAKPOINTLIST_H
#include <list>
#include <mutex>
@@ -67,8 +67,10 @@
/// The breakpoint name for which to search.
///
/// \result
- /// \bfalse if the input name was not a legal breakpoint name.
- bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps);
+ /// error if the input name was not a legal breakpoint name, vector
+ /// of breakpoints otherwise.
+ llvm::Expected<std::vector<lldb::BreakpointSP>>
+ FindBreakpointsByName(const char *name);
/// Returns the number of elements in this breakpoint list.
///
@@ -138,7 +140,7 @@
/// Sets the passed in Locker to hold the Breakpoint List mutex.
///
- /// \param[in] locker
+ /// \param[in] lock
/// The locker object that is set.
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
@@ -166,9 +168,10 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(BreakpointList);
+ BreakpointList(const BreakpointList &) = delete;
+ const BreakpointList &operator=(const BreakpointList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointList_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTLIST_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h
index 7b27160..4e1c57a 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocation.h
@@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointLocation_h_
-#define liblldb_BreakpointLocation_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTLOCATION_H
+#define LLDB_BREAKPOINT_BREAKPOINTLOCATION_H
#include <memory>
#include <mutex>
#include "lldb/Breakpoint/BreakpointOptions.h"
-#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Breakpoint/StoppointHitCounter.h"
#include "lldb/Core/Address.h"
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
@@ -35,15 +35,14 @@
/// be useful if you've set options on the locations.
class BreakpointLocation
- : public std::enable_shared_from_this<BreakpointLocation>,
- public StoppointLocation {
+ : public std::enable_shared_from_this<BreakpointLocation> {
public:
- ~BreakpointLocation() override;
+ ~BreakpointLocation();
/// Gets the load address for this breakpoint location \return
/// Returns breakpoint location load address, \b
/// LLDB_INVALID_ADDRESS if not yet set.
- lldb::addr_t GetLoadAddress() const override;
+ lldb::addr_t GetLoadAddress() const;
/// Gets the Address for this breakpoint location \return
/// Returns breakpoint location Address.
@@ -63,11 +62,11 @@
/// \return
/// \b true if this breakpoint location thinks we should stop,
/// \b false otherwise.
- bool ShouldStop(StoppointCallbackContext *context) override;
+ bool ShouldStop(StoppointCallbackContext *context);
// The next section deals with various breakpoint options.
- /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
+ /// If \a enabled is \b true, enable the breakpoint, if \b false disable it.
void SetEnabled(bool enabled);
/// Check the Enable/Disable state.
@@ -85,15 +84,18 @@
/// \b true if the breakpoint is set to auto-continue, \b false if not.
bool IsAutoContinue() const;
+ /// Return the current Hit Count.
+ uint32_t GetHitCount() const { return m_hit_counter.GetValue(); }
+
/// Return the current Ignore Count.
///
/// \return
/// The number of breakpoint hits to be ignored.
- uint32_t GetIgnoreCount();
+ uint32_t GetIgnoreCount() const;
/// Set the breakpoint to ignore the next \a count breakpoint hits.
///
- /// \param[in] count
+ /// \param[in] n
/// The number of breakpoint hits to ignore.
void SetIgnoreCount(uint32_t n);
@@ -192,7 +194,7 @@
void GetDescription(Stream *s, lldb::DescriptionLevel level);
/// Standard "Dump" method. At present it does nothing.
- void Dump(Stream *s) const override;
+ void Dump(Stream *s) const;
/// Use this to set location specific breakpoint options.
///
@@ -224,9 +226,6 @@
/// \param[in] context
/// Described the breakpoint event.
///
- /// \param[in] bp_loc_id
- /// Which breakpoint location hit this breakpoint.
- ///
/// \return
/// \b true if the target should stop at this breakpoint and \b
/// false not.
@@ -271,6 +270,9 @@
/// \b true or \b false as given in the description above.
bool EquivalentToLocation(BreakpointLocation &location);
+ /// Returns the breakpoint location ID.
+ lldb::break_id_t GetID() const { return m_loc_id; }
+
protected:
friend class BreakpointSite;
friend class BreakpointLocationList;
@@ -341,6 +343,9 @@
/// multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code
///changed.
+ lldb::break_id_t m_loc_id; ///< Breakpoint location ID.
+ StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint
+ /// location has been hit.
void SetShouldResolveIndirectFunctions(bool do_resolve) {
m_should_resolve_indirect_functions = do_resolve;
@@ -348,9 +353,10 @@
void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind);
- DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
+ BreakpointLocation(const BreakpointLocation &) = delete;
+ const BreakpointLocation &operator=(const BreakpointLocation &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointLocation_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTLOCATION_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h
index 3da52eb..ffdb81e 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationCollection.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointLocationCollection_h_
-#define liblldb_BreakpointLocationCollection_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
+#define LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
#include <mutex>
#include <vector>
@@ -22,17 +22,14 @@
BreakpointLocationCollection();
~BreakpointLocationCollection();
-
+
BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs);
/// Add the breakpoint \a bp_loc_sp to the list.
///
- /// \param[in] bp_sp
+ /// \param[in] bp_loc_sp
/// Shared pointer to the breakpoint location that will get added
/// to the list.
- ///
- /// \result
- /// Returns breakpoint location id.
void Add(const lldb::BreakpointLocationSP &bp_loc_sp);
/// Removes the breakpoint location given by \b breakID from this
@@ -66,7 +63,7 @@
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID, const version.
///
- /// \param[in] breakID
+ /// \param[in] break_id
/// The breakpoint location ID to seek for.
///
/// \param[in] break_loc_id
@@ -112,9 +109,6 @@
/// \param[in] context
/// This contains the information about this stop.
///
- /// \param[in] breakID
- /// This break ID that we hit.
- ///
/// \return
/// \b true if we should stop, \b false otherwise.
bool ShouldStop(StoppointCallbackContext *context);
@@ -181,4 +175,4 @@
} // namespace lldb_private
-#endif // liblldb_BreakpointLocationCollection_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTLOCATIONCOLLECTION_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h
index b7e0e49..4b36c91 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointLocationList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointLocationList_h_
-#define liblldb_BreakpointLocationList_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTLOCATIONLIST_H
+#define LLDB_BREAKPOINT_BREAKPOINTLOCATIONLIST_H
#include <map>
#include <mutex>
@@ -75,7 +75,7 @@
/// \param[in] module
/// The module to seek in.
///
- /// \param[in]
+ /// \param[in] bp_loc_list
/// A breakpoint collection that gets any breakpoint locations
/// that match \a module appended to.
///
@@ -166,14 +166,6 @@
/// list.
BreakpointLocationList(Breakpoint &owner);
- /// Add the breakpoint \a bp_loc_sp to the list.
- ///
- /// \param[in] bp_sp
- /// Shared pointer to the breakpoint location that will get
- /// added to the list.
- ///
- /// \result
- /// Returns breakpoint location id.
lldb::BreakpointLocationSP Create(const Address &addr,
bool resolve_indirect_symbols);
@@ -189,7 +181,7 @@
lldb::BreakpointLocationSP from_location_sp);
bool RemoveLocation(const lldb::BreakpointLocationSP &bp_loc_sp);
-
+
void RemoveLocationByIndex(size_t idx);
void RemoveInvalidLocations(const ArchSpec &arch);
@@ -220,4 +212,4 @@
} // namespace lldb_private
-#endif // liblldb_BreakpointLocationList_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTLOCATIONLIST_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h
index 61020a6..8786dbc 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointName.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Breakpoint_Name_h_
-#define liblldb_Breakpoint_Name_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTNAME_H
+#define LLDB_BREAKPOINT_BREAKPOINTNAME_H
#include <memory>
#include <string>
@@ -205,4 +205,4 @@
} // namespace lldb_private
-#endif // liblldb_Breakpoint_Name_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTNAME_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h
index cdac5d3..85b8e02 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointOptions_h_
-#define liblldb_BreakpointOptions_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H
+#define LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H
#include <memory>
#include <string>
@@ -51,7 +51,7 @@
: user_source(user_source), script_source(), interpreter(interp),
stop_on_error(true) {}
- ~CommandData() = default;
+ virtual ~CommandData() = default;
static const char *GetSerializationKey() { return "BKPTCMDData"; }
@@ -88,7 +88,8 @@
explicit CommandBaton(std::unique_ptr<CommandData> Data)
: TypedBaton(std::move(Data)) {}
- void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+ void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level,
+ unsigned indentation) const override;
};
typedef std::shared_ptr<CommandBaton> CommandBatonSP;
@@ -107,6 +108,12 @@
/// \param[in] ignore
/// How many breakpoint hits we should ignore before stopping.
///
+ /// \param[in] one_shot
+ /// Should this breakpoint delete itself after being hit once.
+ ///
+ /// \param[in] auto_continue
+ /// Should this breakpoint auto-continue after running its commands.
+ ///
BreakpointOptions(const char *condition, bool enabled = true,
int32_t ignore = 0, bool one_shot = false,
bool auto_continue = false);
@@ -129,7 +136,7 @@
// Operators
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
-
+
/// Copy over only the options set in the incoming BreakpointOptions.
void CopyOverSetOptions(const BreakpointOptions &rhs);
@@ -261,7 +268,7 @@
bool IsEnabled() const { return m_enabled; }
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
- void SetEnabled(bool enabled) {
+ void SetEnabled(bool enabled) {
m_enabled = enabled;
m_set_flags.Set(eEnabled);
}
@@ -272,7 +279,7 @@
bool IsAutoContinue() const { return m_auto_continue; }
/// Set the auto-continue state.
- void SetAutoContinue(bool auto_continue) {
+ void SetAutoContinue(bool auto_continue) {
m_auto_continue = auto_continue;
m_set_flags.Set(eAutoContinue);
}
@@ -283,17 +290,16 @@
bool IsOneShot() const { return m_one_shot; }
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
- void SetOneShot(bool one_shot) {
- m_one_shot = one_shot;
- m_set_flags.Set(eOneShot);
+ void SetOneShot(bool one_shot) {
+ m_one_shot = one_shot;
+ m_set_flags.Set(eOneShot);
}
/// Set the breakpoint to ignore the next \a count breakpoint hits.
- /// \param[in] count
+ /// \param[in] n
/// The number of breakpoint hits to ignore.
-
- void SetIgnoreCount(uint32_t n) {
- m_ignore_count = n;
+ void SetIgnoreCount(uint32_t n) {
+ m_ignore_count = n;
m_set_flags.Set(eIgnoreCount);
}
@@ -319,7 +325,10 @@
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
- /// Returns true if the breakpoint option has a callback set.
+ /// Check if the breakpoint option has a callback set.
+ ///
+ /// \return
+ /// If the breakpoint option has a callback, \b true otherwise \b false.
bool HasCallback() const;
/// This is the default empty callback.
@@ -332,13 +341,13 @@
/// A UP holding the new'ed CommandData object.
/// The breakpoint will take ownership of pointer held by this object.
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
-
+
void Clear();
-
+
bool AnySet() const {
return m_set_flags.AnySet(eAllOptions);
}
-
+
protected:
// Classes that inherit from BreakpointOptions can see and modify these
bool IsOptionSet(OptionKind kind)
@@ -367,24 +376,34 @@
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
private:
- // For BreakpointOptions only
- BreakpointHitCallback m_callback; // This is the callback function pointer
- lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
+ /// For BreakpointOptions only
+
+ /// This is the callback function pointer
+ BreakpointHitCallback m_callback;
+ /// This is the client data for the callback
+ lldb::BatonSP m_callback_baton_sp;
bool m_baton_is_command_baton;
bool m_callback_is_synchronous;
bool m_enabled;
+ /// If set, the breakpoint delete itself after being hit once.
bool m_one_shot;
- uint32_t m_ignore_count; // Number of times to ignore this breakpoint
- std::unique_ptr<ThreadSpec>
- m_thread_spec_up; // Thread for which this breakpoint will take
- std::string m_condition_text; // The condition to test.
- size_t m_condition_text_hash; // Its hash, so that locations know when the
- // condition is updated.
- bool m_auto_continue; // If set, auto-continue from breakpoint.
- Flags m_set_flags; // Which options are set at this level. Drawn
- // from BreakpointOptions::SetOptionsFlags.
+ /// Number of times to ignore this breakpoint.
+ uint32_t m_ignore_count;
+ /// Thread for which this breakpoint will stop.
+ std::unique_ptr<ThreadSpec> m_thread_spec_up;
+ /// The condition to test.
+ std::string m_condition_text;
+ /// Its hash, so that locations know when the condition is updated.
+ size_t m_condition_text_hash;
+ /// If set, inject breakpoint condition into process.
+ bool m_inject_condition;
+ /// If set, auto-continue from breakpoint.
+ bool m_auto_continue;
+ /// Which options are set at this level.
+ /// Drawn from BreakpointOptions::SetOptionsFlags.
+ Flags m_set_flags;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointOptions_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h
index 2a9461b..5f0c11b 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointPrecondition.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointPrecondition_h_
-#define liblldb_BreakpointPrecondition_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTPRECONDITION_H
+#define LLDB_BREAKPOINT_BREAKPOINTPRECONDITION_H
#include "lldb/lldb-enumerations.h"
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h
index 11e183b..d067b1e 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolver.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolver_h_
-#define liblldb_BreakpointResolver_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVER_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVER_H
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Core/Address.h"
@@ -44,10 +44,8 @@
/// The breakpoint that owns this resolver.
/// \param[in] resolverType
/// The concrete breakpoint resolver type for this breakpoint.
- ///
- /// \result
- /// Returns breakpoint location id.
- BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType,
+ BreakpointResolver(const lldb::BreakpointSP &bkpt,
+ unsigned char resolverType,
lldb::addr_t offset = 0);
/// The Destructor is virtual, all significant breakpoint resolvers derive
@@ -58,7 +56,15 @@
///
/// \param[in] bkpt
/// The breakpoint that owns this resolver.
- void SetBreakpoint(Breakpoint *bkpt);
+ void SetBreakpoint(const lldb::BreakpointSP &bkpt);
+
+ /// This gets the breakpoint for this resolver.
+ lldb::BreakpointSP GetBreakpoint() const {
+ auto breakpoint_sp = m_breakpoint.expired() ? lldb::BreakpointSP() :
+ m_breakpoint.lock();
+ assert(breakpoint_sp);
+ return breakpoint_sp;
+ }
/// This updates the offset for this breakpoint. All the locations
/// currently set for this breakpoint will have their offset adjusted when
@@ -68,12 +74,6 @@
/// The offset to add to all locations.
void SetOffset(lldb::addr_t offset);
- /// This updates the offset for this breakpoint. All the locations
- /// currently set for this breakpoint will have their offset adjusted when
- /// this is called.
- ///
- /// \param[in] offset
- /// The offset to add to all locations.
lldb::addr_t GetOffset() const { return m_offset; }
/// In response to this method the resolver scans all the modules in the
@@ -158,7 +158,7 @@
static ResolverTy NameToResolverTy(llvm::StringRef name);
virtual lldb::BreakpointResolverSP
- CopyForBreakpoint(Breakpoint &breakpoint) = 0;
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) = 0;
protected:
// Used for serializing resolver options:
@@ -186,7 +186,7 @@
};
static const char
*g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
-
+
virtual void NotifyBreakpointSet() {};
public:
@@ -211,20 +211,21 @@
lldb::BreakpointLocationSP AddLocation(Address loc_addr,
bool *new_location = nullptr);
- Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
- lldb::addr_t m_offset; // A random offset the user asked us to add to any
- // breakpoints we set.
-
private:
/// Helper for \p SetSCMatchesByLine.
void AddLocation(SearchFilter &filter, const SymbolContext &sc,
bool skip_prologue, llvm::StringRef log_ident);
+ lldb::BreakpointWP m_breakpoint; // This is the breakpoint we add locations to.
+ lldb::addr_t m_offset; // A random offset the user asked us to add to any
+ // breakpoints we set.
+
// Subclass identifier (for llvm isa/dyn_cast)
const unsigned char SubclassID;
- DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
+ BreakpointResolver(const BreakpointResolver &) = delete;
+ const BreakpointResolver &operator=(const BreakpointResolver &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolver_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h
index 949a788..5454487 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverAddress.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolverAddress_h_
-#define liblldb_BreakpointResolverAddress_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
#include "lldb/Breakpoint/BreakpointResolver.h"
#include "lldb/Core/ModuleSpec.h"
@@ -21,15 +21,17 @@
class BreakpointResolverAddress : public BreakpointResolver {
public:
- BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr);
+ BreakpointResolverAddress(const lldb::BreakpointSP &bkpt,
+ const Address &addr);
- BreakpointResolverAddress(Breakpoint *bkpt, const Address &addr,
+ BreakpointResolverAddress(const lldb::BreakpointSP &bkpt,
+ const Address &addr,
const FileSpec &module_spec);
- ~BreakpointResolverAddress() override;
+ ~BreakpointResolverAddress() override = default;
static BreakpointResolver *
- CreateFromStructuredData(Breakpoint *bkpt,
+ CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
const StructuredData::Dictionary &options_dict,
Status &error);
@@ -41,8 +43,8 @@
ModuleList &modules) override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -56,11 +58,12 @@
return V->getResolverID() == BreakpointResolver::AddressResolver;
}
- lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
protected:
- Address
- m_addr; // The address - may be Section Offset or may be just an offset
+ Address m_addr; // The address - may be Section Offset or
+ // may be just an offset
lldb::addr_t m_resolved_addr; // The current value of the resolved load
// address for this breakpoint,
FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an
@@ -68,9 +71,11 @@
// to a Section+Offset address in this module, whenever that module gets
// around to being loaded.
private:
- DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
+ BreakpointResolverAddress(const BreakpointResolverAddress &) = delete;
+ const BreakpointResolverAddress &
+ operator=(const BreakpointResolverAddress &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverAddress_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERADDRESS_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index f146a70..222fc6f 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolverFileLine_h_
-#define liblldb_BreakpointResolverFileLine_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
#include "lldb/Breakpoint/BreakpointResolver.h"
@@ -20,23 +20,24 @@
class BreakpointResolverFileLine : public BreakpointResolver {
public:
- BreakpointResolverFileLine(Breakpoint *bkpt, const FileSpec &resolver,
+ BreakpointResolverFileLine(const lldb::BreakpointSP &bkpt,
+ const FileSpec &resolver,
uint32_t line_no, uint32_t column,
lldb::addr_t m_offset, bool check_inlines,
bool skip_prologue, bool exact_match);
static BreakpointResolver *
- CreateFromStructuredData(Breakpoint *bkpt,
+ CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
const StructuredData::Dictionary &data_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
- ~BreakpointResolverFileLine() override;
+ ~BreakpointResolverFileLine() override = default;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -52,7 +53,8 @@
return V->getResolverID() == BreakpointResolver::FileLineResolver;
}
- lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
protected:
void FilterContexts(SymbolContextList &sc_list, bool is_relative);
@@ -67,9 +69,11 @@
bool m_exact_match;
private:
- DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
+ BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete;
+ const BreakpointResolverFileLine &
+ operator=(const BreakpointResolverFileLine &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverFileLine_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILELINE_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
index 9631457..138d555 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolverFileRegex_h_
-#define liblldb_BreakpointResolverFileRegex_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
#include <set>
#include "lldb/Breakpoint/BreakpointResolver.h"
@@ -24,21 +24,21 @@
class BreakpointResolverFileRegex : public BreakpointResolver {
public:
BreakpointResolverFileRegex(
- Breakpoint *bkpt, RegularExpression ®ex,
+ const lldb::BreakpointSP &bkpt, RegularExpression regex,
const std::unordered_set<std::string> &func_name_set, bool exact_match);
static BreakpointResolver *
- CreateFromStructuredData(Breakpoint *bkpt,
+ CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
const StructuredData::Dictionary &options_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
- ~BreakpointResolverFileRegex() override;
+ ~BreakpointResolverFileRegex() override = default;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -56,7 +56,8 @@
return V->getResolverID() == BreakpointResolver::FileRegexResolver;
}
- lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
protected:
friend class Breakpoint;
@@ -69,9 +70,11 @@
// comp_unit passed in.
private:
- DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
+ BreakpointResolverFileRegex(const BreakpointResolverFileRegex &) = delete;
+ const BreakpointResolverFileRegex &
+ operator=(const BreakpointResolverFileRegex &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverFileRegex_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERFILEREGEX_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h
index 85a41b6..7a9fc46 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolverName_h_
-#define liblldb_BreakpointResolverName_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERNAME_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVERNAME_H
#include <string>
#include <vector>
@@ -23,43 +23,45 @@
class BreakpointResolverName : public BreakpointResolver {
public:
- BreakpointResolverName(Breakpoint *bkpt, const char *name,
+ BreakpointResolverName(const lldb::BreakpointSP &bkpt, const char *name,
lldb::FunctionNameType name_type_mask,
lldb::LanguageType language,
Breakpoint::MatchType type, lldb::addr_t offset,
bool skip_prologue);
// This one takes an array of names. It is always MatchType = Exact.
- BreakpointResolverName(Breakpoint *bkpt, const char *names[],
+ BreakpointResolverName(const lldb::BreakpointSP &bkpt, const char *names[],
size_t num_names,
lldb::FunctionNameType name_type_mask,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
// This one takes a C++ array of names. It is always MatchType = Exact.
- BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names,
+ BreakpointResolverName(const lldb::BreakpointSP &bkpt,
+ std::vector<std::string> names,
lldb::FunctionNameType name_type_mask,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
// Creates a function breakpoint by regular expression. Takes over control
// of the lifespan of func_regex.
- BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex,
+ BreakpointResolverName(const lldb::BreakpointSP &bkpt,
+ RegularExpression func_regex,
lldb::LanguageType language, lldb::addr_t offset,
bool skip_prologue);
static BreakpointResolver *
- CreateFromStructuredData(Breakpoint *bkpt,
+ CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
const StructuredData::Dictionary &data_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
- ~BreakpointResolverName() override;
+ ~BreakpointResolverName() override = default;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -73,7 +75,8 @@
return V->getResolverID() == BreakpointResolver::NameResolver;
}
- lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
protected:
BreakpointResolverName(const BreakpointResolverName &rhs);
@@ -91,4 +94,4 @@
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverName_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERNAME_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h
index 980bb46..26fd6f2 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointResolverScripted.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointResolverScripted_h_
-#define liblldb_BreakpointResolverScripted_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H
+#define LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H
#include "lldb/lldb-forward.h"
#include "lldb/Breakpoint/BreakpointResolver.h"
@@ -23,24 +23,23 @@
class BreakpointResolverScripted : public BreakpointResolver {
public:
- BreakpointResolverScripted(Breakpoint *bkpt,
+ BreakpointResolverScripted(const lldb::BreakpointSP &bkpt,
const llvm::StringRef class_name,
lldb::SearchDepth depth,
- StructuredDataImpl *args_data,
- ScriptInterpreter &script_interp);
+ StructuredDataImpl *args_data);
- ~BreakpointResolverScripted() override;
+ ~BreakpointResolverScripted() override = default;
static BreakpointResolver *
- CreateFromStructuredData(Breakpoint *bkpt,
+ CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
const StructuredData::Dictionary &options_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -54,12 +53,13 @@
return V->getResolverID() == BreakpointResolver::PythonResolver;
}
- lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::BreakpointResolverSP
+ CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
protected:
void NotifyBreakpointSet() override;
private:
- void CreateImplementationIfNeeded();
+ void CreateImplementationIfNeeded(lldb::BreakpointSP bkpt);
ScriptInterpreter *GetScriptInterpreter();
std::string m_class_name;
@@ -70,9 +70,11 @@
// SBStructuredData).
StructuredData::GenericSP m_implementation_sp;
- DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted);
+ BreakpointResolverScripted(const BreakpointResolverScripted &) = delete;
+ const BreakpointResolverScripted &
+ operator=(const BreakpointResolverScripted &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointResolverScripted_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h
index 51ed84f..fc32c04 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSite.h
@@ -6,16 +6,16 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointSite_h_
-#define liblldb_BreakpointSite_h_
-
+#ifndef LLDB_BREAKPOINT_BREAKPOINTSITE_H
+#define LLDB_BREAKPOINT_BREAKPOINTSITE_H
#include <list>
#include <mutex>
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
-#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Breakpoint/StoppointSite.h"
+#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-forward.h"
@@ -33,7 +33,7 @@
/// by the process.
class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
- public StoppointLocation {
+ public StoppointSite {
public:
enum Type {
eSoftware, // Breakpoint opcode has been written to memory and
@@ -99,15 +99,12 @@
bool ShouldStop(StoppointCallbackContext *context) override;
/// Standard Dump method
- ///
- /// \param[in] context
- /// The stream to dump this output.
void Dump(Stream *s) const override;
/// The "Owners" are the breakpoint locations that share this breakpoint
/// site. The method adds the \a owner to this breakpoint site's owner list.
///
- /// \param[in] context
+ /// \param[in] owner
/// \a owner is the Breakpoint Location to add.
void AddOwner(const lldb::BreakpointLocationSP &owner);
@@ -123,8 +120,9 @@
/// GetNumberOfOwners() - 1 so you can use this method to iterate over the
/// owners
///
- /// \param[in] index
+ /// \param[in] idx
/// The index in the list of owners for which you wish the owner location.
+ ///
/// \return
/// A shared pointer to the breakpoint location at that index.
lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx);
@@ -185,6 +183,12 @@
/// \b false otherwise.
bool IsInternal() const;
+ bool IsHardware() const override {
+ lldbassert(BreakpointSite::Type::eHardware == GetType() ||
+ !HardwareRequired());
+ return BreakpointSite::Type::eHardware == GetType();
+ }
+
BreakpointSite::Type GetType() const { return m_type; }
void SetType(BreakpointSite::Type type) { m_type = type; }
@@ -201,9 +205,6 @@
/// The method removes the owner at \a break_loc_id from this breakpoint
/// list.
- ///
- /// \param[in] context
- /// \a break_loc_id is the Breakpoint Location to remove.
size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
BreakpointSite::Type m_type; ///< The type of this breakpoint site.
@@ -229,9 +230,10 @@
const lldb::BreakpointLocationSP &owner, lldb::addr_t m_addr,
bool use_hardware);
- DISALLOW_COPY_AND_ASSIGN(BreakpointSite);
+ BreakpointSite(const BreakpointSite &) = delete;
+ const BreakpointSite &operator=(const BreakpointSite &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_BreakpointSite_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTSITE_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h
index b10d119..98091bb 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/BreakpointSiteList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_BreakpointSiteList_h_
-#define liblldb_BreakpointSiteList_h_
+#ifndef LLDB_BREAKPOINT_BREAKPOINTSITELIST_H
+#define LLDB_BREAKPOINT_BREAKPOINTSITELIST_H
#include <functional>
#include <map>
@@ -170,4 +170,4 @@
} // namespace lldb_private
-#endif // liblldb_BreakpointSiteList_h_
+#endif // LLDB_BREAKPOINT_BREAKPOINTSITELIST_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h b/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h
index f20b100..36df77c 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/Stoppoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Stoppoint_h_
-#define liblldb_Stoppoint_h_
+#ifndef LLDB_BREAKPOINT_STOPPOINT_H
+#define LLDB_BREAKPOINT_STOPPOINT_H
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
@@ -37,9 +37,10 @@
private:
// For Stoppoint only
- DISALLOW_COPY_AND_ASSIGN(Stoppoint);
+ Stoppoint(const Stoppoint &) = delete;
+ const Stoppoint &operator=(const Stoppoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Stoppoint_h_
+#endif // LLDB_BREAKPOINT_STOPPOINT_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h
index c1724a6..db02ddd 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/StoppointCallbackContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StoppointCallbackContext_h_
-#define liblldb_StoppointCallbackContext_h_
+#ifndef LLDB_BREAKPOINT_STOPPOINTCALLBACKCONTEXT_H
+#define LLDB_BREAKPOINT_STOPPOINTCALLBACKCONTEXT_H
#include "lldb/Target/ExecutionContext.h"
#include "lldb/lldb-private.h"
@@ -48,4 +48,4 @@
} // namespace lldb_private
-#endif // liblldb_StoppointCallbackContext_h_
+#endif // LLDB_BREAKPOINT_STOPPOINTCALLBACKCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointHitCounter.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointHitCounter.h
new file mode 100644
index 0000000..26f816d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/StoppointHitCounter.h
@@ -0,0 +1,43 @@
+//===-- StoppointHitCounter.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
+#define LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
+
+#include <assert.h>
+#include <cstdint>
+#include <limits>
+
+#include "lldb/Utility/LLDBAssert.h"
+
+namespace lldb_private {
+
+class StoppointHitCounter {
+public:
+ uint32_t GetValue() const { return m_hit_count; }
+
+ void Increment(uint32_t difference = 1) {
+ lldbassert(std::numeric_limits<uint32_t>::max() - m_hit_count >= difference);
+ m_hit_count += difference;
+ }
+
+ void Decrement(uint32_t difference = 1) {
+ lldbassert(m_hit_count >= difference);
+ m_hit_count -= difference;
+ }
+
+ void Reset() { m_hit_count = 0; }
+
+private:
+ /// Number of times this breakpoint/watchpoint has been hit.
+ uint32_t m_hit_count = 0;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_BREAKPOINT_STOPPOINT_HIT_COUNTER_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h
deleted file mode 100644
index 3926f45..0000000
--- a/linux-x64/clang/include/lldb/Breakpoint/StoppointLocation.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===-- StoppointLocation.h -------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_StoppointLocation_h_
-#define liblldb_StoppointLocation_h_
-
-#include "lldb/Utility/UserID.h"
-#include "lldb/lldb-private.h"
-// #include "lldb/Breakpoint/BreakpointOptions.h"
-
-namespace lldb_private {
-
-class StoppointLocation {
-public:
- // Constructors and Destructors
- StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
-
- StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
- uint32_t byte_size, bool hardware);
-
- virtual ~StoppointLocation();
-
- // Operators
-
- // Methods
- virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
-
- virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
-
- uint32_t GetByteSize() const { return m_byte_size; }
-
- uint32_t GetHitCount() const { return m_hit_count; }
-
- uint32_t GetHardwareIndex() const { return m_hardware_index; }
-
- bool HardwareRequired() const { return m_hardware; }
-
- virtual bool IsHardware() const {
- return m_hardware_index != LLDB_INVALID_INDEX32;
- }
-
- virtual bool ShouldStop(StoppointCallbackContext *context) { return true; }
-
- virtual void Dump(Stream *stream) const {}
-
- void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
-
- lldb::break_id_t GetID() const { return m_loc_id; }
-
-protected:
- // Classes that inherit from StoppointLocation can see and modify these
- lldb::break_id_t m_loc_id; // Stoppoint location ID
- lldb::addr_t
- m_addr; // The load address of this stop point. The base Stoppoint doesn't
- // store a full Address since that's not needed for the breakpoint sites.
- bool m_hardware; // True if this point has been is required to use hardware
- // (which may fail due to lack of resources)
- uint32_t m_hardware_index; // The hardware resource index for this
- // breakpoint/watchpoint
- uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length
- // of the trap opcode for
- // software breakpoints, or the optional length in bytes for hardware
- // breakpoints, or the length of the watchpoint.
- uint32_t
- m_hit_count; // Number of times this breakpoint/watchpoint has been hit
-
- // If you override this, be sure to call the base class to increment the
- // internal counter.
- void IncrementHitCount() { ++m_hit_count; }
-
- void DecrementHitCount();
-
-private:
- // For StoppointLocation only
- DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
- StoppointLocation() = delete;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_StoppointLocation_h_
diff --git a/linux-x64/clang/include/lldb/Breakpoint/StoppointSite.h b/linux-x64/clang/include/lldb/Breakpoint/StoppointSite.h
new file mode 100644
index 0000000..7e5e334
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Breakpoint/StoppointSite.h
@@ -0,0 +1,81 @@
+//===-- StoppointSite.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_BREAKPOINT_STOPPOINTSITE_H
+#define LLDB_BREAKPOINT_STOPPOINTSITE_H
+
+#include "lldb/Breakpoint/StoppointHitCounter.h"
+#include "lldb/Utility/UserID.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class StoppointSite {
+public:
+ StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
+
+ StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr,
+ uint32_t byte_size, bool hardware);
+
+ virtual ~StoppointSite() = default;
+
+ virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
+
+ virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
+
+ uint32_t GetByteSize() const { return m_byte_size; }
+
+ uint32_t GetHitCount() const { return m_hit_counter.GetValue(); }
+
+ void ResetHitCount() { m_hit_counter.Reset(); }
+
+ bool HardwareRequired() const { return m_is_hardware_required; }
+
+ virtual bool IsHardware() const = 0;
+
+ uint32_t GetHardwareIndex() const { return m_hardware_index; }
+
+ void SetHardwareIndex(uint32_t index) { m_hardware_index = index; }
+
+ virtual bool ShouldStop(StoppointCallbackContext* context) = 0;
+
+ virtual void Dump(Stream* stream) const = 0;
+
+ lldb::break_id_t GetID() const { return m_id; }
+
+protected:
+ /// Stoppoint site ID.
+ lldb::break_id_t m_id;
+
+ /// The load address of this stop point.
+ lldb::addr_t m_addr;
+
+ /// True if this point is required to use hardware (which may fail due to
+ /// the lack of resources).
+ bool m_is_hardware_required;
+
+ /// The hardware resource index for this breakpoint/watchpoint.
+ uint32_t m_hardware_index;
+
+ /// The size in bytes of stoppoint, e.g. the length of the trap opcode for
+ /// software breakpoints, or the optional length in bytes for hardware
+ /// breakpoints, or the length of the watchpoint.
+ uint32_t m_byte_size;
+
+ /// Number of times this breakpoint/watchpoint has been hit.
+ StoppointHitCounter m_hit_counter;
+
+private:
+ StoppointSite(const StoppointSite &) = delete;
+ const StoppointSite &operator=(const StoppointSite &) = delete;
+ StoppointSite() = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_BREAKPOINT_STOPPOINTSITE_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h b/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h
index e71f89b..41b723a 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/Watchpoint.h
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Watchpoint_h_
-#define liblldb_Watchpoint_h_
+#ifndef LLDB_BREAKPOINT_WATCHPOINT_H
+#define LLDB_BREAKPOINT_WATCHPOINT_H
#include <memory>
#include <string>
-#include "lldb/Breakpoint/StoppointLocation.h"
+#include "lldb/Breakpoint/StoppointSite.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Target.h"
@@ -22,7 +22,7 @@
namespace lldb_private {
class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
- public StoppointLocation {
+ public StoppointSite {
public:
class WatchpointEventData : public EventData {
public:
@@ -54,7 +54,8 @@
lldb::WatchpointEventType m_watchpoint_event;
lldb::WatchpointSP m_new_watchpoint_sp;
- DISALLOW_COPY_AND_ASSIGN(WatchpointEventData);
+ WatchpointEventData(const WatchpointEventData &) = delete;
+ const WatchpointEventData &operator=(const WatchpointEventData &) = delete;
};
Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
@@ -69,7 +70,6 @@
// This doesn't really enable/disable the watchpoint. It is currently just
// for use in the Process plugin's {Enable,Disable}Watchpoint, which should
// be used instead.
-
void SetEnabled(bool enabled, bool notify = true);
bool IsHardware() const override;
@@ -113,10 +113,6 @@
/// If \b true the callback will be run on the private event thread
/// before the stop event gets reported. If false, the callback will get
/// handled on the public event thread after the stop has been posted.
- ///
- /// \return
- /// \b true if the process should stop when you hit the watchpoint.
- /// \b false if it should continue.
void SetCallback(WatchpointHitCallback callback, void *callback_baton,
bool is_synchronous = false);
@@ -162,11 +158,9 @@
friend class Target;
friend class WatchpointList;
- void ResetHitCount() { m_hit_count = 0; }
-
void ResetHistoricValues() {
- m_old_value_sp.reset(nullptr);
- m_new_value_sp.reset(nullptr);
+ m_old_value_sp.reset();
+ m_new_value_sp.reset();
}
Target &m_target;
@@ -203,15 +197,16 @@
std::unique_ptr<UserExpression> m_condition_up; // The condition to test.
- void SetID(lldb::watch_id_t id) { m_loc_id = id; }
+ void SetID(lldb::watch_id_t id) { m_id = id; }
void SendWatchpointChangedEvent(lldb::WatchpointEventType eventKind);
void SendWatchpointChangedEvent(WatchpointEventData *data);
- DISALLOW_COPY_AND_ASSIGN(Watchpoint);
+ Watchpoint(const Watchpoint &) = delete;
+ const Watchpoint &operator=(const Watchpoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Watchpoint_h_
+#endif // LLDB_BREAKPOINT_WATCHPOINT_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h b/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h
index 98c6483..283f991 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/WatchpointList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_WatchpointList_h_
-#define liblldb_WatchpointList_h_
+#ifndef LLDB_BREAKPOINT_WATCHPOINTLIST_H
+#define LLDB_BREAKPOINT_WATCHPOINTLIST_H
#include <list>
#include <mutex>
@@ -180,7 +180,7 @@
/// Sets the passed in Locker to hold the Watchpoint List mutex.
///
- /// \param[in] locker
+ /// \param[in] lock
/// The locker object that is set.
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
@@ -203,4 +203,4 @@
} // namespace lldb_private
-#endif // liblldb_WatchpointList_h_
+#endif // LLDB_BREAKPOINT_WATCHPOINTLIST_H
diff --git a/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h b/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h
index b395dde..0a18c52 100644
--- a/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h
+++ b/linux-x64/clang/include/lldb/Breakpoint/WatchpointOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_WatchpointOptions_h_
-#define liblldb_WatchpointOptions_h_
+#ifndef LLDB_BREAKPOINT_WATCHPOINTOPTIONS_H
+#define LLDB_BREAKPOINT_WATCHPOINTOPTIONS_H
#include <memory>
#include <string>
@@ -180,7 +180,8 @@
CommandBaton(std::unique_ptr<CommandData> Data)
: TypedBaton(std::move(Data)) {}
- void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+ void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level,
+ unsigned indentation) const override;
};
protected:
@@ -197,4 +198,4 @@
} // namespace lldb_private
-#endif // liblldb_WatchpointOptions_h_
+#endif // LLDB_BREAKPOINT_WATCHPOINTOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/Core/Address.h b/linux-x64/clang/include/lldb/Core/Address.h
index 080c00e..71e50b9 100644
--- a/linux-x64/clang/include/lldb/Core/Address.h
+++ b/linux-x64/clang/include/lldb/Core/Address.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Address_h_
-#define liblldb_Address_h_
+#ifndef LLDB_CORE_ADDRESS_H
+#define LLDB_CORE_ADDRESS_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-forward.h"
@@ -61,45 +61,55 @@
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function
/// to display Address contents in a variety of ways.
enum DumpStyle {
- DumpStyleInvalid, ///< Invalid dump style
- DumpStyleSectionNameOffset, ///< Display as the section name + offset.
- ///< \code
+ /// Invalid dump style.
+ DumpStyleInvalid,
+ /// Display as the section name + offset.
+ /// \code
/// // address for printf in libSystem.B.dylib as a section name + offset
- /// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf \endcode
- DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset
- ///(debug output).
- ///< \code
+ /// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf
+ /// \endcode
+ DumpStyleSectionNameOffset,
+ /// Display as the section pointer + offset (debug output).
+ /// \code
/// // address for printf in libSystem.B.dylib as a section pointer +
- /// offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode
- DumpStyleFileAddress, ///< Display as the file address (if any).
- ///< \code
+ /// offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf
+ /// \endcode
+ DumpStyleSectionPointerOffset,
+ /// Display as the file address (if any).
+ /// \code
/// // address for printf in libSystem.B.dylib as a file address
- /// 0x000000000005dcff \endcode
- DumpStyleModuleWithFileAddress, ///< Display as the file address with the
- /// module name prepended (if any).
- ///< \code
+ /// 0x000000000005dcff
+ /// \endcode
+ ///
+ DumpStyleFileAddress,
+ /// Display as the file address with the module name prepended (if any).
+ /// \code
/// // address for printf in libSystem.B.dylib as a file address
- /// libSystem.B.dylib[0x000000000005dcff] \endcode
- DumpStyleLoadAddress, ///< Display as the load address (if resolved).
- ///< \code
+ /// libSystem.B.dylib[0x000000000005dcff]
+ /// \endcode
+ DumpStyleModuleWithFileAddress,
+ /// Display as the load address (if resolved).
+ /// \code
/// // address for printf in libSystem.B.dylib as a load address
- /// 0x00007fff8306bcff \endcode
- DumpStyleResolvedDescription, ///< Display the details about what an address
- /// resolves to. This can
- ///< be anything from a symbol context summary (module, function/symbol,
- ///< and file and line), to information about what the pointer points to
- ///< if the address is in a section (section of pointers, c strings, etc).
+ /// 0x00007fff8306bcff
+ /// \endcode
+ DumpStyleLoadAddress,
+ /// Display the details about what an address resolves to. This can be
+ /// anything from a symbol context summary (module, function/symbol, and
+ /// file and line), to information about what the pointer points to if the
+ /// address is in a section (section of pointers, c strings, etc).
+ DumpStyleResolvedDescription,
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
- DumpStyleNoFunctionName, ///< Elide the function name; display an offset
- /// into the current function.
- ///< Used primarily in disassembly symbolication
- DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for
- /// an address for all symbol
- ///< context members.
- DumpStyleResolvedPointerDescription ///< Dereference a pointer at the
- /// current address and then lookup the
- ///< dereferenced address using DumpStyleResolvedDescription
+ /// Elide the function name; display an offset into the current function.
+ /// Used primarily in disassembly symbolication
+ DumpStyleNoFunctionName,
+ /// Detailed symbol context information for an address for all symbol
+ /// context members.
+ DumpStyleDetailedSymbolContext,
+ /// Dereference a pointer at the current address and then lookup the
+ /// dereferenced address using DumpStyleResolvedDescription
+ DumpStyleResolvedPointerDescription
};
/// Default constructor.
@@ -121,7 +131,7 @@
///
/// Initialize the address with the supplied \a section and \a offset.
///
- /// \param[in] section
+ /// \param[in] section_sp
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
@@ -179,9 +189,9 @@
/// The Right Hand Side const Address object reference.
///
/// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// -1 if lhs < rhs
+ /// 0 if lhs == rhs
+ /// 1 if lhs > rhs
static int CompareFileAddress(const Address &lhs, const Address &rhs);
static int CompareLoadAddress(const Address &lhs, const Address &rhs,
@@ -338,6 +348,23 @@
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
const SectionList *sections);
+ /// Resolve this address to its containing function and optionally get
+ /// that function's address range.
+ ///
+ /// \param[out] sym_ctx
+ /// The symbol context describing the function in which this address lies
+ ///
+ /// \parm[out] addr_range_ptr
+ /// Pointer to the AddressRange to fill in with the function's address
+ /// range. Caller may pass null if they don't need the address range.
+ ///
+ /// \return
+ /// Returns \b false if the function/symbol could not be resolved
+ /// or if the address range was requested and could not be resolved;
+ /// returns \b true otherwise.
+ bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx,
+ lldb_private::AddressRange *addr_range_ptr = nullptr);
+
/// Set the address to represent \a load_addr.
///
/// The address will attempt to find a loaded section within \a target that
@@ -416,7 +443,7 @@
/// Set accessor for the section.
///
- /// \param[in] section
+ /// \param[in] section_sp
/// A new lldb::Section pointer to use as the section base. Can
/// be NULL for absolute addresses that are not relative to
/// any section.
@@ -488,4 +515,4 @@
} // namespace lldb_private
-#endif // liblldb_Address_h_
+#endif // LLDB_CORE_ADDRESS_H
diff --git a/linux-x64/clang/include/lldb/Core/AddressRange.h b/linux-x64/clang/include/lldb/Core/AddressRange.h
index 4a019bf..8ccf96a 100644
--- a/linux-x64/clang/include/lldb/Core/AddressRange.h
+++ b/linux-x64/clang/include/lldb/Core/AddressRange.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_AddressRange_h_
-#define liblldb_AddressRange_h_
+#ifndef LLDB_CORE_ADDRESSRANGE_H
+#define LLDB_CORE_ADDRESSRANGE_H
#include "lldb/Core/Address.h"
#include "lldb/lldb-forward.h"
@@ -123,7 +123,7 @@
/// Check if the resolved file address \a file_addr is contained within this
/// object's file address range.
///
- /// \param[in] so_addr
+ /// \param[in] file_addr
/// A section offset address object reference.
///
/// \return
@@ -147,9 +147,6 @@
/// Check if the resolved load address \a load_addr is contained within this
/// object's load address range.
///
- /// \param[in] so_addr
- /// A section offset address object reference.
- ///
/// \return
/// Returns \b true if both \a this has a resolvable load
/// address value and \a so_addr is contained in the address
@@ -250,4 +247,4 @@
} // namespace lldb_private
-#endif // liblldb_AddressRange_h_
+#endif // LLDB_CORE_ADDRESSRANGE_H
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolver.h b/linux-x64/clang/include/lldb/Core/AddressResolver.h
index cd95c7c..9ac058a 100644
--- a/linux-x64/clang/include/lldb/Core/AddressResolver.h
+++ b/linux-x64/clang/include/lldb/Core/AddressResolver.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_AddressResolver_h_
-#define liblldb_AddressResolver_h_
+#ifndef LLDB_CORE_ADDRESSRESOLVER_H
+#define LLDB_CORE_ADDRESSRESOLVER_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/SearchFilter.h"
@@ -55,9 +55,10 @@
std::vector<AddressRange> m_address_ranges;
private:
- DISALLOW_COPY_AND_ASSIGN(AddressResolver);
+ AddressResolver(const AddressResolver &) = delete;
+ const AddressResolver &operator=(const AddressResolver &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_AddressResolver_h_
+#endif // LLDB_CORE_ADDRESSRESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h b/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h
index b98e7d4..46bf415 100644
--- a/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h
+++ b/linux-x64/clang/include/lldb/Core/AddressResolverFileLine.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_AddressResolverFileLine_h_
-#define liblldb_AddressResolverFileLine_h_
+#ifndef LLDB_CORE_ADDRESSRESOLVERFILELINE_H
+#define LLDB_CORE_ADDRESSRESOLVERFILELINE_H
#include "lldb/Core/AddressResolver.h"
#include "lldb/Core/SearchFilter.h"
@@ -34,8 +34,8 @@
~AddressResolverFileLine() override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -48,9 +48,11 @@
// functions or not.
private:
- DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine);
+ AddressResolverFileLine(const AddressResolverFileLine &) = delete;
+ const AddressResolverFileLine &
+ operator=(const AddressResolverFileLine &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_AddressResolverFileLine_h_
+#endif // LLDB_CORE_ADDRESSRESOLVERFILELINE_H
diff --git a/linux-x64/clang/include/lldb/Core/AddressResolverName.h b/linux-x64/clang/include/lldb/Core/AddressResolverName.h
index ad14ef6..0ec1ef0 100644
--- a/linux-x64/clang/include/lldb/Core/AddressResolverName.h
+++ b/linux-x64/clang/include/lldb/Core/AddressResolverName.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_AddressResolverName_h_
-#define liblldb_AddressResolverName_h_
+#ifndef LLDB_CORE_ADDRESSRESOLVERNAME_H
+#define LLDB_CORE_ADDRESSRESOLVERNAME_H
#include "lldb/Core/AddressResolver.h"
#include "lldb/Core/SearchFilter.h"
@@ -31,7 +31,7 @@
// Creates a function breakpoint by regular expression. Takes over control
// of the lifespan of func_regex.
- AddressResolverName(RegularExpression &func_regex);
+ AddressResolverName(RegularExpression func_regex);
AddressResolverName(const char *class_name, const char *method,
AddressResolver::MatchType type);
@@ -39,8 +39,8 @@
~AddressResolverName() override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -54,9 +54,10 @@
AddressResolver::MatchType m_match_type;
private:
- DISALLOW_COPY_AND_ASSIGN(AddressResolverName);
+ AddressResolverName(const AddressResolverName &) = delete;
+ const AddressResolverName &operator=(const AddressResolverName &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_AddressResolverName_h_
+#endif // LLDB_CORE_ADDRESSRESOLVERNAME_H
diff --git a/linux-x64/clang/include/lldb/Core/Architecture.h b/linux-x64/clang/include/lldb/Core/Architecture.h
index d8dbbb4..2ea8bd3 100644
--- a/linux-x64/clang/include/lldb/Core/Architecture.h
+++ b/linux-x64/clang/include/lldb/Core/Architecture.h
@@ -15,9 +15,6 @@
class Architecture : public PluginInterface {
public:
- Architecture() = default;
- ~Architecture() override = default;
-
/// This is currently intended to handle cases where a
/// program stops at an instruction that won't get executed and it
/// allows the stop reason, like "breakpoint hit", to be replaced
@@ -100,10 +97,6 @@
Target &target) const {
return addr;
}
-
-private:
- Architecture(const Architecture &) = delete;
- void operator=(const Architecture &) = delete;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Core/ClangForward.h b/linux-x64/clang/include/lldb/Core/ClangForward.h
deleted file mode 100644
index 6b24b47..0000000
--- a/linux-x64/clang/include/lldb/Core/ClangForward.h
+++ /dev/null
@@ -1,134 +0,0 @@
-//===-- ClangForward.h ------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangForward_h_
-#define liblldb_ClangForward_h_
-
-
-#if defined(__cplusplus)
-
-namespace clang {
-namespace Builtin {
-class Context;
-}
-
-class Action;
-class ASTConsumer;
-class ASTContext;
-class ASTRecordLayout;
-class AddrLabelExpr;
-class AnalyzerOptions;
-class BinaryOperator;
-class ClassTemplateDecl;
-class ClassTemplateSpecializationDecl;
-class CodeGenOptions;
-class CodeGenerator;
-class CompilerInstance;
-class CompoundStmt;
-class CXXBaseSpecifier;
-class CXXBoolLiteralExpr;
-class CXXFunctionalCastExpr;
-class CXXMethodDecl;
-class CXXNamedCastExpr;
-class CXXRecordDecl;
-class CXXThisExpr;
-class CharacterLiteral;
-class CompoundAssignOperator;
-class Decl;
-class DeclarationName;
-class DeclaratorDecl;
-class DeclContext;
-class DeclRefExpr;
-class DeclStmt;
-class DependencyOutputOptions;
-class Diagnostic;
-class DiagnosticConsumer;
-class DiagnosticsEngine;
-class DiagnosticOptions;
-class EnumDecl;
-class EnumConstantDecl;
-class Expr;
-class ExternalASTSource;
-class ExtVectorElementExpr;
-class FieldDecl;
-class FileManager;
-class FileSystemOptions;
-class FloatingLiteral;
-class FrontendOptions;
-class FunctionDecl;
-class FunctionTemplateDecl;
-class FunctionTemplateSpecializationInfo;
-class GotoStmt;
-class HeaderSearchOptions;
-class IdentifierInfo;
-class IdentifierTable;
-class IntegerLiteral;
-class LabelStmt;
-class LangOptions;
-class MacroDirective;
-class MemberExpr;
-class Module;
-class NamedDecl;
-class NamespaceDecl;
-class NonTypeTemplateParmDecl;
-class ObjCEncodeExpr;
-class ObjCImplicitSetterGetterRefExpr;
-class ObjCInterfaceDecl;
-class ObjCIvarDecl;
-class ObjCIvarRefExpr;
-class ObjCMessageExpr;
-class ObjCMethodDecl;
-class ObjCPropertyRefExpr;
-class ObjCProtocolDecl;
-class ObjCProtocolExpr;
-class ObjCSelectorExpr;
-class ObjCSuperExpr;
-class ParenExpr;
-class ParmVarDecl;
-class PredefinedExpr;
-class PreprocessorOptions;
-class PreprocessorOutputOptions;
-class QualType;
-class QualifiedNameType;
-class RecordDecl;
-class SelectorTable;
-class SizeOfAlignOfExpr;
-class SourceLocation;
-class SourceManager;
-class Stmt;
-class StmtIteratorBase;
-class StringLiteral;
-class TagDecl;
-class TargetInfo;
-class TargetOptions;
-class TemplateArgument;
-class TemplateDecl;
-class TemplateParameterList;
-class TemplateTemplateParmDecl;
-class TemplateTypeParmDecl;
-class TextDiagnosticBuffer;
-class TranslationUnitDecl;
-class Type;
-class TypeDecl;
-class TypedefDecl;
-class TypesCompatibleExpr;
-class UnaryOperator;
-class ValueDecl;
-class VarDecl;
-struct PrintingPolicy;
-}
-
-namespace llvm {
-class APInt;
-class APSInt;
-class LLVMContext;
-class ExecutionEngine;
-}
-
-#endif // #if defined(__cplusplus)
-#endif // liblldb_ClangForward_h_
diff --git a/linux-x64/clang/include/lldb/Core/Communication.h b/linux-x64/clang/include/lldb/Core/Communication.h
index 901b8fd..354c4bb 100644
--- a/linux-x64/clang/include/lldb/Core/Communication.h
+++ b/linux-x64/clang/include/lldb/Core/Communication.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Communication_h_
-#define liblldb_Communication_h_
+#ifndef LLDB_CORE_COMMUNICATION_H
+#define LLDB_CORE_COMMUNICATION_H
#include "lldb/Host/HostThread.h"
#include "lldb/Utility/Broadcaster.h"
@@ -221,7 +221,7 @@
///
/// \see
/// class Connection
- void SetConnection(Connection *connection);
+ void SetConnection(std::unique_ptr<Connection> connection);
/// Starts a read thread whose sole purpose it to read bytes from the
/// current connection. This function will call connection's read function:
@@ -285,7 +285,7 @@
///
void SynchronizeWithReadThread();
- static const char *ConnectionStatusAsCString(lldb::ConnectionStatus status);
+ static std::string ConnectionStatusAsString(lldb::ConnectionStatus status);
bool GetCloseOnEOF() const { return m_close_on_eof; }
@@ -359,9 +359,10 @@
size_t GetCachedBytes(void *dst, size_t dst_len);
private:
- DISALLOW_COPY_AND_ASSIGN(Communication);
+ Communication(const Communication &) = delete;
+ const Communication &operator=(const Communication &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Communication_h_
+#endif // LLDB_CORE_COMMUNICATION_H
diff --git a/linux-x64/clang/include/lldb/Core/Debugger.h b/linux-x64/clang/include/lldb/Core/Debugger.h
index 8e60871..68daae1 100644
--- a/linux-x64/clang/include/lldb/Core/Debugger.h
+++ b/linux-x64/clang/include/lldb/Core/Debugger.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Debugger_h_
-#define liblldb_Debugger_h_
+#ifndef LLDB_CORE_DEBUGGER_H
+#define LLDB_CORE_DEBUGGER_H
#include <stdint.h>
@@ -17,6 +17,7 @@
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/Core/SourceManager.h"
+#include "lldb/Core/StreamFile.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/Terminal.h"
@@ -113,20 +114,29 @@
void SetAsyncExecution(bool async);
- lldb::StreamFileSP GetInputFile() { return m_input_file_sp; }
+ lldb::FileSP GetInputFileSP() { return m_input_file_sp; }
- lldb::StreamFileSP GetOutputFile() { return m_output_file_sp; }
+ lldb::StreamFileSP GetOutputStreamSP() { return m_output_stream_sp; }
- lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; }
+ lldb::StreamFileSP GetErrorStreamSP() { return m_error_stream_sp; }
+
+ File &GetInputFile() { return *m_input_file_sp; }
+
+ File &GetOutputFile() { return m_output_stream_sp->GetFile(); }
+
+ File &GetErrorFile() { return m_error_stream_sp->GetFile(); }
+
+ StreamFile &GetOutputStream() { return *m_output_stream_sp; }
+
+ StreamFile &GetErrorStream() { return *m_error_stream_sp; }
repro::DataRecorder *GetInputRecorder();
- void SetInputFileHandle(FILE *fh, bool tranfer_ownership,
- repro::DataRecorder *recorder = nullptr);
+ void SetInputFile(lldb::FileSP file, repro::DataRecorder *recorder = nullptr);
- void SetOutputFileHandle(FILE *fh, bool tranfer_ownership);
+ void SetOutputFile(lldb::FileSP file);
- void SetErrorFileHandle(FILE *fh, bool tranfer_ownership);
+ void SetErrorFile(lldb::FileSP file);
void SaveInputTerminalState();
@@ -141,7 +151,9 @@
return *m_command_interpreter_up;
}
- ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
+ ScriptInterpreter *
+ GetScriptInterpreter(bool can_create = true,
+ llvm::Optional<lldb::ScriptLanguage> language = {});
lldb::ListenerSP GetListener() { return m_listener_sp; }
@@ -174,17 +186,19 @@
// If any of the streams are not set, set them to the in/out/err stream of
// the top most input reader to ensure they at least have something
- void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in,
+ void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in,
lldb::StreamFileSP &out,
lldb::StreamFileSP &err);
- void PushIOHandler(const lldb::IOHandlerSP &reader_sp,
- bool cancel_top_handler = true);
+ /// Run the given IO handler and return immediately.
+ void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp,
+ bool cancel_top_handler = true);
- bool PopIOHandler(const lldb::IOHandlerSP &reader_sp);
+ /// Run the given IO handler and block until it's complete.
+ void RunIOHandlerSync(const lldb::IOHandlerSP &reader_sp);
- // Synchronously run an input reader until it is done
- void RunIOHandler(const lldb::IOHandlerSP &reader_sp);
+ /// Remove the given IO handler if it's currently active.
+ bool RemoveIOHandler(const lldb::IOHandlerSP &reader_sp);
bool IsTopIOHandler(const lldb::IOHandlerSP &reader_sp);
@@ -259,6 +273,12 @@
bool SetUseColor(bool use_color);
+ bool GetUseAutosuggestion() const;
+
+ bool GetUseSourceCache() const;
+
+ bool SetUseSourceCache(bool use_source_cache);
+
bool GetHighlightSource() const;
lldb::StopShowColumn GetStopShowColumn() const;
@@ -273,6 +293,10 @@
uint32_t GetDisassemblyLineCount() const;
+ llvm::StringRef GetStopShowLineMarkerAnsiPrefix() const;
+
+ llvm::StringRef GetStopShowLineMarkerAnsiSuffix() const;
+
bool GetAutoOneLineSummaries() const;
bool GetAutoIndent() const;
@@ -295,7 +319,7 @@
bool LoadPlugin(const FileSpec &spec, Status &error);
- void ExecuteIOHandlers();
+ void RunIOHandlers();
bool IsForwardingEvents();
@@ -310,8 +334,8 @@
// This is for use in the command interpreter, when you either want the
// selected target, or if no target is present you want to prime the dummy
// target with entities that will be copied over to new targets.
- Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
- Target *GetDummyTarget();
+ Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
+ Target &GetDummyTarget() { return *m_dummy_target_sp; }
lldb::BroadcasterManagerSP GetBroadcasterManager() {
return m_broadcaster_manager_sp;
@@ -327,6 +351,11 @@
static lldb::thread_result_t EventHandlerThread(lldb::thread_arg_t arg);
+ void PushIOHandler(const lldb::IOHandlerSP &reader_sp,
+ bool cancel_top_handler = true);
+
+ bool PopIOHandler(const lldb::IOHandlerSP &reader_sp);
+
bool HasIOHandlerThread();
bool StartIOHandlerThread();
@@ -345,9 +374,10 @@
void HandleThreadEvent(const lldb::EventSP &event_sp);
- size_t GetProcessSTDOUT(Process *process, Stream *stream);
-
- size_t GetProcessSTDERR(Process *process, Stream *stream);
+ // Ensures two threads don't attempt to flush process output in parallel.
+ std::mutex m_output_flush_mutex;
+ void FlushProcessOutput(Process &process, bool flush_stdout,
+ bool flush_stderr);
SourceManager::SourceFileCache &GetSourceFileCache() {
return m_source_file_cache;
@@ -355,9 +385,10 @@
void InstanceInitialize();
- lldb::StreamFileSP m_input_file_sp;
- lldb::StreamFileSP m_output_file_sp;
- lldb::StreamFileSP m_error_file_sp;
+ // these should never be NULL
+ lldb::FileSP m_input_file_sp;
+ lldb::StreamFileSP m_output_stream_sp;
+ lldb::StreamFileSP m_error_stream_sp;
/// Used for shadowing the input file when capturing a reproducer.
repro::DataRecorder *m_input_recorder;
@@ -384,10 +415,13 @@
// source file cache.
std::unique_ptr<CommandInterpreter> m_command_interpreter_up;
- lldb::ScriptInterpreterSP m_script_interpreter_sp;
std::recursive_mutex m_script_interpreter_mutex;
+ std::array<lldb::ScriptInterpreterSP, lldb::eScriptLanguageUnknown>
+ m_script_interpreters;
- IOHandlerStack m_input_reader_stack;
+ IOHandlerStack m_io_handler_stack;
+ std::recursive_mutex m_io_handler_synchronous_mutex;
+
llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams;
std::shared_ptr<llvm::raw_ostream> m_log_callback_stream_sp;
ConstString m_instance_name;
@@ -399,6 +433,7 @@
Broadcaster m_sync_broadcaster;
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
+ lldb::TargetSP m_dummy_target_sp;
// Events for m_sync_broadcaster
enum {
@@ -410,9 +445,10 @@
// object
Debugger(lldb::LogOutputCallback m_log_callback, void *baton);
- DISALLOW_COPY_AND_ASSIGN(Debugger);
+ Debugger(const Debugger &) = delete;
+ const Debugger &operator=(const Debugger &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Debugger_h_
+#endif // LLDB_CORE_DEBUGGER_H
diff --git a/linux-x64/clang/include/lldb/Core/Disassembler.h b/linux-x64/clang/include/lldb/Core/Disassembler.h
index ba9ca87..9a694de 100644
--- a/linux-x64/clang/include/lldb/Core/Disassembler.h
+++ b/linux-x64/clang/include/lldb/Core/Disassembler.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Disassembler_h_
-#define liblldb_Disassembler_h_
+#ifndef LLDB_CORE_DISASSEMBLER_H
+#define LLDB_CORE_DISASSEMBLER_H
#include "lldb/Core/Address.h"
#include "lldb/Core/EmulateInstruction.h"
@@ -48,6 +48,7 @@
class Debugger;
class Disassembler;
class Module;
+class StackFrame;
class Stream;
class SymbolContext;
class SymbolContextList;
@@ -270,6 +271,13 @@
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const;
+ /// Get the instruction at the given address.
+ ///
+ /// \return
+ /// A valid \a InstructionSP if the address could be found, or null
+ /// otherwise.
+ lldb::InstructionSP GetInstructionAtAddress(const Address &addr);
+
//------------------------------------------------------------------
/// Get the index of the next branch instruction.
///
@@ -279,14 +287,15 @@
/// @param[in] start
/// The instruction index of the first instruction to check.
///
- /// @param[in] target
- /// A LLDB target object that is used to resolve addresses.
- ///
/// @param[in] ignore_calls
/// It true, then fine the first branch instruction that isn't
/// a function call (a branch that calls and returns to the next
/// instruction). If false, find the instruction index of any
/// branch in the list.
+ ///
+ /// @param[out] found_calls
+ /// If non-null, this will be set to true if any calls were found in
+ /// extending the range.
///
/// @return
/// The instruction index of the first branch that is at or past
@@ -294,8 +303,8 @@
/// found.
//------------------------------------------------------------------
uint32_t GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target,
- bool ignore_calls) const;
+ bool ignore_calls,
+ bool *found_calls) const;
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr,
Target &target);
@@ -344,7 +353,8 @@
protected:
std::string m_description;
- DISALLOW_COPY_AND_ASSIGN(PseudoInstruction);
+ PseudoInstruction(const PseudoInstruction &) = delete;
+ const PseudoInstruction &operator=(const PseudoInstruction &) = delete;
};
class Disassembler : public std::enable_shared_from_this<Disassembler>,
@@ -374,13 +384,19 @@
FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name);
// This version will use the value in the Target settings if flavor is NULL;
- static lldb::DisassemblerSP
- FindPluginForTarget(const lldb::TargetSP target_sp, const ArchSpec &arch,
- const char *flavor, const char *plugin_name);
+ static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
+ const ArchSpec &arch,
+ const char *flavor,
+ const char *plugin_name);
+
+ struct Limit {
+ enum { Bytes, Instructions } kind;
+ lldb::addr_t value;
+ };
static lldb::DisassemblerSP
DisassembleRange(const ArchSpec &arch, const char *plugin_name,
- const char *flavor, const ExecutionContext &exe_ctx,
+ const char *flavor, Target &target,
const AddressRange &disasm_range, bool prefer_file_cache);
static lldb::DisassemblerSP
@@ -391,63 +407,26 @@
static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
const char *plugin_name, const char *flavor,
- const ExecutionContext &exe_ctx,
- const AddressRange &range, uint32_t num_instructions,
- bool mixed_source_and_assembly,
+ const ExecutionContext &exe_ctx, const Address &start,
+ Limit limit, bool mixed_source_and_assembly,
uint32_t num_mixed_context_lines, uint32_t options,
Stream &strm);
static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
- const char *plugin_name, const char *flavor,
- const ExecutionContext &exe_ctx, const Address &start,
- uint32_t num_instructions,
- bool mixed_source_and_assembly,
- uint32_t num_mixed_context_lines, uint32_t options,
- Stream &strm);
-
- static size_t
- Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
- const char *flavor, const ExecutionContext &exe_ctx,
- SymbolContextList &sc_list, uint32_t num_instructions,
- bool mixed_source_and_assembly, uint32_t num_mixed_context_lines,
- uint32_t options, Stream &strm);
-
- static bool
- Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
- const char *flavor, const ExecutionContext &exe_ctx,
- ConstString name, Module *module,
- uint32_t num_instructions, bool mixed_source_and_assembly,
- uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
-
- static bool
- Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
- const char *flavor, const ExecutionContext &exe_ctx,
- uint32_t num_instructions, bool mixed_source_and_assembly,
- uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
+ StackFrame &frame, Stream &strm);
// Constructors and Destructors
Disassembler(const ArchSpec &arch, const char *flavor);
~Disassembler() override;
- typedef const char *(*SummaryCallback)(const Instruction &inst,
- ExecutionContext *exe_context,
- void *user_data);
+ void PrintInstructions(Debugger &debugger, const ArchSpec &arch,
+ const ExecutionContext &exe_ctx,
+ bool mixed_source_and_assembly,
+ uint32_t num_mixed_context_lines, uint32_t options,
+ Stream &strm);
- static bool PrintInstructions(Disassembler *disasm_ptr, Debugger &debugger,
- const ArchSpec &arch,
- const ExecutionContext &exe_ctx,
- uint32_t num_instructions,
- bool mixed_source_and_assembly,
- uint32_t num_mixed_context_lines,
- uint32_t options, Stream &strm);
-
- size_t ParseInstructions(const ExecutionContext *exe_ctx,
- const AddressRange &range, Stream *error_strm_ptr,
- bool prefer_file_cache);
-
- size_t ParseInstructions(const ExecutionContext *exe_ctx,
- const Address &range, uint32_t num_instructions,
- bool prefer_file_cache);
+ size_t ParseInstructions(Target &target, Address address, Limit limit,
+ Stream *error_strm_ptr, bool prefer_file_cache);
virtual size_t DecodeInstructions(const Address &base_addr,
const DataExtractor &data,
@@ -543,9 +522,10 @@
private:
// For Disassembler only
- DISALLOW_COPY_AND_ASSIGN(Disassembler);
+ Disassembler(const Disassembler &) = delete;
+ const Disassembler &operator=(const Disassembler &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Disassembler_h_
+#endif // LLDB_CORE_DISASSEMBLER_H
diff --git a/linux-x64/clang/include/lldb/Core/EmulateInstruction.h b/linux-x64/clang/include/lldb/Core/EmulateInstruction.h
index 6b19c17..a575488 100644
--- a/linux-x64/clang/include/lldb/Core/EmulateInstruction.h
+++ b/linux-x64/clang/include/lldb/Core/EmulateInstruction.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_EmulateInstruction_h_
-#define lldb_EmulateInstruction_h_
+#ifndef LLDB_CORE_EMULATEINSTRUCTION_H
+#define LLDB_CORE_EMULATEINSTRUCTION_H
#include <string>
@@ -499,9 +499,10 @@
private:
// For EmulateInstruction only
- DISALLOW_COPY_AND_ASSIGN(EmulateInstruction);
+ EmulateInstruction(const EmulateInstruction &) = delete;
+ const EmulateInstruction &operator=(const EmulateInstruction &) = delete;
};
} // namespace lldb_private
-#endif // lldb_EmulateInstruction_h_
+#endif // LLDB_CORE_EMULATEINSTRUCTION_H
diff --git a/linux-x64/clang/include/lldb/Core/FileLineResolver.h b/linux-x64/clang/include/lldb/Core/FileLineResolver.h
index 1967ed5..68e252e 100644
--- a/linux-x64/clang/include/lldb/Core/FileLineResolver.h
+++ b/linux-x64/clang/include/lldb/Core/FileLineResolver.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_FileLineResolver_h_
-#define liblldb_FileLineResolver_h_
+#ifndef LLDB_CORE_FILELINERESOLVER_H
+#define LLDB_CORE_FILELINERESOLVER_H
#include "lldb/Core/SearchFilter.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -37,8 +37,8 @@
~FileLineResolver() override;
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool containing) override;
+ SymbolContext &context,
+ Address *addr) override;
lldb::SearchDepth GetDepth() override;
@@ -58,9 +58,10 @@
// functions or not.
private:
- DISALLOW_COPY_AND_ASSIGN(FileLineResolver);
+ FileLineResolver(const FileLineResolver &) = delete;
+ const FileLineResolver &operator=(const FileLineResolver &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_FileLineResolver_h_
+#endif // LLDB_CORE_FILELINERESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Core/FileSpecList.h b/linux-x64/clang/include/lldb/Core/FileSpecList.h
index 79623ef..3e412a7 100644
--- a/linux-x64/clang/include/lldb/Core/FileSpecList.h
+++ b/linux-x64/clang/include/lldb/Core/FileSpecList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_FileSpecList_h_
-#define liblldb_FileSpecList_h_
+#ifndef LLDB_CORE_FILESPECLIST_H
+#define LLDB_CORE_FILESPECLIST_H
#if defined(__cplusplus)
#include "lldb/Utility/FileSpec.h"
@@ -25,6 +25,9 @@
/// A class that contains a mutable list of FileSpec objects.
class FileSpecList {
public:
+ typedef std::vector<FileSpec> collection;
+ typedef collection::const_iterator const_iterator;
+
/// Default constructor.
///
/// Initialize this object with an empty file list.
@@ -76,6 +79,15 @@
/// \b true if the file was appended, \b false otherwise.
bool AppendIfUnique(const FileSpec &file);
+ /// Inserts a new FileSpec into the FileSpecList constructed in-place with
+ /// the given arguments.
+ ///
+ /// \param[in] args
+ /// Arguments to create the FileSpec
+ template <class... Args> void EmplaceBack(Args &&... args) {
+ m_files.emplace_back(std::forward<Args>(args)...);
+ }
+
/// Clears the file list.
void Clear();
@@ -182,13 +194,14 @@
static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay,
FileSpecList &matches);
+ const_iterator begin() const { return m_files.begin(); }
+ const_iterator end() const { return m_files.end(); }
+
protected:
- typedef std::vector<FileSpec>
- collection; ///< The collection type for the file list.
collection m_files; ///< A collection of FileSpec objects.
};
} // namespace lldb_private
#endif // #if defined(__cplusplus)
-#endif // liblldb_FileSpecList_h_
+#endif // LLDB_CORE_FILESPECLIST_H
diff --git a/linux-x64/clang/include/lldb/Core/FormatEntity.h b/linux-x64/clang/include/lldb/Core/FormatEntity.h
index 634d9df..91999f6 100644
--- a/linux-x64/clang/include/lldb/Core/FormatEntity.h
+++ b/linux-x64/clang/include/lldb/Core/FormatEntity.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_FormatEntity_h_
-#define liblldb_FormatEntity_h_
+#ifndef LLDB_CORE_FORMATENTITY_H
+#define LLDB_CORE_FORMATENTITY_H
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/FileSpec.h"
@@ -61,6 +61,7 @@
ThreadName,
ThreadQueue,
ThreadStopReason,
+ ThreadStopReasonRaw,
ThreadReturnValue,
ThreadCompletedExpression,
ScriptThread,
@@ -85,6 +86,7 @@
FunctionName,
FunctionNameWithArgs,
FunctionNameNoArgs,
+ FunctionMangledName,
FunctionAddrOffset,
FunctionAddrOffsetConcrete,
FunctionLineOffset,
@@ -199,7 +201,7 @@
llvm::StringRef &variable_name,
llvm::StringRef &variable_format);
- static size_t AutoComplete(lldb_private::CompletionRequest &request);
+ static void AutoComplete(lldb_private::CompletionRequest &request);
// Format the current elements into the stream \a s.
//
@@ -217,4 +219,4 @@
};
} // namespace lldb_private
-#endif // liblldb_FormatEntity_h_
+#endif // LLDB_CORE_FORMATENTITY_H
diff --git a/linux-x64/clang/include/lldb/Core/Highlighter.h b/linux-x64/clang/include/lldb/Core/Highlighter.h
index 88d3bb3..b138e57 100644
--- a/linux-x64/clang/include/lldb/Core/Highlighter.h
+++ b/linux-x64/clang/include/lldb/Core/Highlighter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Highlighter_h_
-#define liblldb_Highlighter_h_
+#ifndef LLDB_CORE_HIGHLIGHTER_H
+#define LLDB_CORE_HIGHLIGHTER_H
#include <utility>
#include <vector>
@@ -43,8 +43,6 @@
void Apply(Stream &s, llvm::StringRef value) const;
/// Sets the prefix and suffix strings.
- /// \param prefix
- /// \param suffix
void Set(llvm::StringRef prefix, llvm::StringRef suffix);
};
@@ -93,13 +91,15 @@
public:
Highlighter() = default;
virtual ~Highlighter() = default;
- DISALLOW_COPY_AND_ASSIGN(Highlighter);
+ Highlighter(const Highlighter &) = delete;
+ const Highlighter &operator=(const Highlighter &) = delete;
/// Returns a human readable name for the selected highlighter.
virtual llvm::StringRef GetName() const = 0;
/// Highlights the given line
/// \param options
+ /// The highlight options.
/// \param line
/// The user supplied line that needs to be highlighted.
/// \param cursor_pos
@@ -153,4 +153,4 @@
} // namespace lldb_private
-#endif // liblldb_Highlighter_h_
+#endif // LLDB_CORE_HIGHLIGHTER_H
diff --git a/linux-x64/clang/include/lldb/Core/IOHandler.h b/linux-x64/clang/include/lldb/Core/IOHandler.h
index b718067..2e8f322 100644
--- a/linux-x64/clang/include/lldb/Core/IOHandler.h
+++ b/linux-x64/clang/include/lldb/Core/IOHandler.h
@@ -6,14 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_IOHandler_h_
-#define liblldb_IOHandler_h_
+#ifndef LLDB_CORE_IOHANDLER_H
+#define LLDB_CORE_IOHANDLER_H
#include "lldb/Core/ValueObjectList.h"
+#include "lldb/Host/Config.h"
+#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/Predicate.h"
-#include "lldb/Utility/Reproducer.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-defines.h"
@@ -30,6 +31,9 @@
namespace lldb_private {
class Debugger;
+namespace repro {
+class DataRecorder;
+}
}
namespace curses {
@@ -50,6 +54,7 @@
REPL,
ProcessIO,
PythonInterpreter,
+ LuaInterpreter,
PythonCode,
Other
};
@@ -57,8 +62,7 @@
IOHandler(Debugger &debugger, IOHandler::Type type);
IOHandler(Debugger &debugger, IOHandler::Type type,
- const lldb::StreamFileSP &input_sp,
- const lldb::StreamFileSP &output_sp,
+ const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp,
const lldb::StreamFileSP &error_sp, uint32_t flags,
repro::DataRecorder *data_recorder);
@@ -93,6 +97,8 @@
virtual void Deactivate() { m_active = false; }
+ virtual void TerminalSizeChanged() {}
+
virtual const char *GetPrompt() {
// Prompt support isn't mandatory
return nullptr;
@@ -122,11 +128,11 @@
FILE *GetErrorFILE();
- lldb::StreamFileSP &GetInputStreamFile();
+ lldb::FileSP GetInputFileSP();
- lldb::StreamFileSP &GetOutputStreamFile();
+ lldb::StreamFileSP GetOutputStreamFileSP();
- lldb::StreamFileSP &GetErrorStreamFile();
+ lldb::StreamFileSP GetErrorStreamFileSP();
Debugger &GetDebugger() { return m_debugger; }
@@ -164,7 +170,7 @@
protected:
Debugger &m_debugger;
- lldb::StreamFileSP m_input_sp;
+ lldb::FileSP m_input_sp;
lldb::StreamFileSP m_output_sp;
lldb::StreamFileSP m_error_sp;
repro::DataRecorder *m_data_recorder;
@@ -176,7 +182,8 @@
bool m_active;
private:
- DISALLOW_COPY_AND_ASSIGN(IOHandler);
+ IOHandler(const IOHandler &) = delete;
+ const IOHandler &operator=(const IOHandler &) = delete;
};
/// A delegate class for use with IOHandler subclasses.
@@ -198,10 +205,11 @@
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
- virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
- const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions);
+ virtual llvm::Optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
+ llvm::StringRef line);
+
+ virtual void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request);
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
@@ -334,7 +342,7 @@
repro::DataRecorder *data_recorder);
IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
- const lldb::StreamFileSP &input_sp,
+ const lldb::FileSP &input_sp,
const lldb::StreamFileSP &output_sp,
const lldb::StreamFileSP &error_sp, uint32_t flags,
const char *editline_name, // Used for saving history files
@@ -350,7 +358,7 @@
const char *, bool, bool, uint32_t,
IOHandlerDelegate &) = delete;
- IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &,
+ IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &,
const lldb::StreamFileSP &, const lldb::StreamFileSP &,
uint32_t, const char *, const char *, const char *, bool,
bool, uint32_t, IOHandlerDelegate &) = delete;
@@ -369,6 +377,8 @@
void Deactivate() override;
+ void TerminalSizeChanged() override;
+
ConstString GetControlSequence(char ch) override {
return m_delegate.IOHandlerGetControlSequence(ch);
}
@@ -408,22 +418,21 @@
void PrintAsync(Stream *stream, const char *s, size_t len) override;
private:
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
static bool IsInputCompleteCallback(Editline *editline, StringList &lines,
void *baton);
static int FixIndentationCallback(Editline *editline, const StringList &lines,
int cursor_position, void *baton);
- static int AutoCompleteCallback(const char *current_line, const char *cursor,
- const char *last_char,
- int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions,
- void *baton);
+ static llvm::Optional<std::string> SuggestionCallback(llvm::StringRef line,
+ void *baton);
+
+ static void AutoCompleteCallback(CompletionRequest &request, void *baton);
#endif
protected:
-#ifndef LLDB_DISABLE_LIBEDIT
+#if LLDB_ENABLE_LIBEDIT
std::unique_ptr<Editline> m_editline_up;
#endif
IOHandlerDelegate &m_delegate;
@@ -437,6 +446,7 @@
bool m_interrupt_exits;
bool m_editing; // Set to true when fetching a line manually (not using
// libedit)
+ std::string m_line_buffer;
};
// The order of base classes is important. Look at the constructor of
@@ -450,10 +460,8 @@
bool GetResponse() const { return m_user_response; }
- int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
- const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions) override;
+ void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request) override;
void IOHandlerInputComplete(IOHandler &io_handler,
std::string &data) override;
@@ -463,48 +471,9 @@
bool m_user_response;
};
-class IOHandlerCursesGUI : public IOHandler {
-public:
- IOHandlerCursesGUI(Debugger &debugger);
-
- ~IOHandlerCursesGUI() override;
-
- void Run() override;
-
- void Cancel() override;
-
- bool Interrupt() override;
-
- void GotEOF() override;
-
- void Activate() override;
-
- void Deactivate() override;
-
-protected:
- curses::ApplicationAP m_app_ap;
-};
-
-class IOHandlerCursesValueObjectList : public IOHandler {
-public:
- IOHandlerCursesValueObjectList(Debugger &debugger,
- ValueObjectList &valobj_list);
-
- ~IOHandlerCursesValueObjectList() override;
-
- void Run() override;
-
- void GotEOF() override;
-
-protected:
- ValueObjectList m_valobj_list;
-};
-
class IOHandlerStack {
public:
- IOHandlerStack() : m_stack(), m_mutex(), m_top(nullptr) {}
-
- ~IOHandlerStack() = default;
+ IOHandlerStack() = default;
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -581,12 +550,13 @@
typedef std::vector<lldb::IOHandlerSP> collection;
collection m_stack;
mutable std::recursive_mutex m_mutex;
- IOHandler *m_top;
+ IOHandler *m_top = nullptr;
private:
- DISALLOW_COPY_AND_ASSIGN(IOHandlerStack);
+ IOHandlerStack(const IOHandlerStack &) = delete;
+ const IOHandlerStack &operator=(const IOHandlerStack &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_IOHandler_h_
+#endif // LLDB_CORE_IOHANDLER_H
diff --git a/linux-x64/clang/include/lldb/Core/IOHandlerCursesGUI.h b/linux-x64/clang/include/lldb/Core/IOHandlerCursesGUI.h
new file mode 100644
index 0000000..22ca735
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Core/IOHandlerCursesGUI.h
@@ -0,0 +1,42 @@
+//===-- IOHandlerCursesGUI.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_CORE_IOHANDLERCURSESGUI_H
+#define LLDB_CORE_IOHANDLERCURSESGUI_H
+
+#include "lldb/Core/IOHandler.h"
+
+namespace lldb_private {
+
+class IOHandlerCursesGUI : public IOHandler {
+public:
+ IOHandlerCursesGUI(Debugger &debugger);
+
+ ~IOHandlerCursesGUI() override;
+
+ void Run() override;
+
+ void Cancel() override;
+
+ bool Interrupt() override;
+
+ void GotEOF() override;
+
+ void Activate() override;
+
+ void Deactivate() override;
+
+ void TerminalSizeChanged() override;
+
+protected:
+ curses::ApplicationAP m_app_ap;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_CORE_IOHANDLERCURSESGUI_H
diff --git a/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h b/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h
index f7f8360..49400f7 100644
--- a/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h
+++ b/linux-x64/clang/include/lldb/Core/LoadedModuleInfoList.h
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_LoadedModuleInfoList_h_
-#define liblldb_LoadedModuleInfoList_h_
-
+#ifndef LLDB_CORE_LOADEDMODULEINFOLIST_H
+#define LLDB_CORE_LOADEDMODULEINFOLIST_H
#include <cassert>
#include <string>
@@ -84,9 +83,6 @@
}
bool operator==(LoadedModuleInfo const &rhs) const {
- if (e_num != rhs.e_num)
- return false;
-
for (size_t i = 0; i < e_num; ++i) {
if (m_has[i] != rhs.m_has[i])
return false;
@@ -116,4 +112,4 @@
};
} // namespace lldb_private
-#endif // liblldb_LoadedModuleInfoList_h_
+#endif // LLDB_CORE_LOADEDMODULEINFOLIST_H
diff --git a/linux-x64/clang/include/lldb/Core/Mangled.h b/linux-x64/clang/include/lldb/Core/Mangled.h
index fb52afd..c03fc1e 100644
--- a/linux-x64/clang/include/lldb/Core/Mangled.h
+++ b/linux-x64/clang/include/lldb/Core/Mangled.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Mangled_h_
-#define liblldb_Mangled_h_
+#ifndef LLDB_CORE_MANGLED_H
+#define LLDB_CORE_MANGLED_H
#if defined(__cplusplus)
#include "lldb/lldb-enumerations.h"
@@ -49,21 +49,7 @@
/// Default constructor.
///
/// Initialize with both mangled and demangled names empty.
- Mangled();
-
- /// Construct with name.
- ///
- /// Constructor with an optional string and a boolean indicating if it is
- /// the mangled version.
- ///
- /// \param[in] name
- /// The already const name to copy into this object.
- ///
- /// \param[in] is_mangled
- /// If \b true then \a name is a mangled name, if \b false then
- /// \a name is demangled.
- Mangled(ConstString name, bool is_mangled);
- Mangled(llvm::StringRef name, bool is_mangled);
+ Mangled() = default;
/// Construct with name.
///
@@ -76,12 +62,6 @@
explicit Mangled(llvm::StringRef name);
- /// Destructor
- ///
- /// Releases its ref counts on the mangled and demangled strings that live
- /// in the global string pool.
- ~Mangled();
-
/// Convert to pointer operator.
///
/// This allows code to check a Mangled object to see if it contains a valid
@@ -128,9 +108,9 @@
/// A const reference to the Right Hand Side object to compare.
///
/// \return
- /// \li -1 if \a lhs is less than \a rhs
- /// \li 0 if \a lhs is equal to \a rhs
- /// \li 1 if \a lhs is greater than \a rhs
+ /// -1 if \a lhs is less than \a rhs
+ /// 0 if \a lhs is equal to \a rhs
+ /// 1 if \a lhs is greater than \a rhs
static int Compare(const Mangled &lhs, const Mangled &rhs);
/// Dump a description of this object to a Stream \a s.
@@ -152,13 +132,13 @@
///
/// \return
/// A const reference to the demangled name string object.
- ConstString GetDemangledName(lldb::LanguageType language) const;
+ ConstString GetDemangledName() const;
/// Display demangled name get accessor.
///
/// \return
/// A const reference to the display demangled name string object.
- ConstString GetDisplayDemangledName(lldb::LanguageType language) const;
+ ConstString GetDisplayDemangledName() const;
void SetDemangledName(ConstString name) { m_demangled = name; }
@@ -185,8 +165,7 @@
/// A const reference to the preferred name string object if this
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
- ConstString GetName(lldb::LanguageType language,
- NamePreference preference = ePreferDemangled) const;
+ ConstString GetName(NamePreference preference = ePreferDemangled) const;
/// Check if "name" matches either the mangled or demangled name.
///
@@ -195,13 +174,12 @@
///
/// \return
/// \b True if \a name matches either name, \b false otherwise.
- bool NameMatches(ConstString name, lldb::LanguageType language) const {
+ bool NameMatches(ConstString name) const {
if (m_mangled == name)
return true;
- return GetDemangledName(language) == name;
+ return GetDemangledName() == name;
}
- bool NameMatches(const RegularExpression ®ex,
- lldb::LanguageType language) const;
+ bool NameMatches(const RegularExpression ®ex) const;
/// Get the memory cost of this object.
///
@@ -281,6 +259,15 @@
bool DemangleWithRichManglingInfo(RichManglingContext &context,
SkipMangledNameFn *skip_mangled_name);
+ /// Try to identify the mangling scheme used.
+ /// \param[in] name
+ /// The name we are attempting to identify the mangling scheme for.
+ ///
+ /// \return
+ /// eManglingSchemeNone if no known mangling scheme could be identified
+ /// for s, otherwise the enumerator for the mangling scheme detected.
+ static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef const name);
+
private:
/// Mangled member variables.
ConstString m_mangled; ///< The mangled version of the name
@@ -293,4 +280,4 @@
} // namespace lldb_private
#endif // #if defined(__cplusplus)
-#endif // liblldb_Mangled_h_
+#endif // LLDB_CORE_MANGLED_H
diff --git a/linux-x64/clang/include/lldb/Core/MappedHash.h b/linux-x64/clang/include/lldb/Core/MappedHash.h
index 7dc9b5b..a27ec82 100644
--- a/linux-x64/clang/include/lldb/Core/MappedHash.h
+++ b/linux-x64/clang/include/lldb/Core/MappedHash.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_MappedHash_h_
-#define liblldb_MappedHash_h_
+#ifndef LLDB_CORE_MAPPEDHASH_H
+#define LLDB_CORE_MAPPEDHASH_H
#include <assert.h>
#include <stdint.h>
@@ -307,4 +307,4 @@
};
};
-#endif // liblldb_MappedHash_h_
+#endif // LLDB_CORE_MAPPEDHASH_H
diff --git a/linux-x64/clang/include/lldb/Core/Module.h b/linux-x64/clang/include/lldb/Core/Module.h
index 544895e..9eb7477 100644
--- a/linux-x64/clang/include/lldb/Core/Module.h
+++ b/linux-x64/clang/include/lldb/Core/Module.h
@@ -6,10 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Module_h_
-#define liblldb_Module_h_
+#ifndef LLDB_CORE_MODULE_H
+#define LLDB_CORE_MODULE_H
#include "lldb/Core/Address.h"
+#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContextScope.h"
@@ -19,6 +20,7 @@
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/XcodeSDK.h"
#include "lldb/Utility/UUID.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
@@ -49,7 +51,6 @@
class SymbolContext;
class SymbolContextList;
class SymbolFile;
-class SymbolVendor;
class Symtab;
class Target;
class TypeList;
@@ -67,8 +68,8 @@
/// accessors are called. For example the object file (ObjectFile)
/// representation will only be parsed if the object file is requested using
/// the Module::GetObjectFile() is called. The debug symbols will only be
-/// parsed if the symbol vendor (SymbolVendor) is requested using the
-/// Module::GetSymbolVendor() is called.
+/// parsed if the symbol file (SymbolFile) is requested using the
+/// Module::GetSymbolFile() method.
///
/// The module will parse more detailed information as more queries are made.
class Module : public std::enable_shared_from_this<Module>,
@@ -191,7 +192,7 @@
lldb::ModuleSP CalculateSymbolContextModule() override;
void
- GetDescription(Stream *s,
+ GetDescription(llvm::raw_ostream &s,
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
/// Get the module path and object name.
@@ -247,13 +248,13 @@
ConstString name,
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
- size_t FindSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- SymbolContextList &sc_list);
+ void FindSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
- size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
- lldb::SymbolType symbol_type,
- SymbolContextList &sc_list);
+ void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
/// Find a function symbols in the object file's symbol table.
///
@@ -267,11 +268,8 @@
///
/// \param[out] sc_list
/// A list to append any matching symbol contexts to.
- ///
- /// \return
- /// The number of symbol contexts that were added to \a sc_list
- size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
- SymbolContextList &sc_list);
+ void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
/// Find compile units by partial or full path.
///
@@ -281,19 +279,10 @@
/// \param[in] path
/// The name of the function we are looking for.
///
- /// \param[in] append
- /// If \b true, then append any compile units that were found
- /// to \a sc_list. If \b false, then the \a sc_list is cleared
- /// and the contents of \a sc_list are replaced.
- ///
/// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
- ///
- /// \return
- /// The number of matches added to \a sc_list.
- size_t FindCompileUnits(const FileSpec &path, bool append,
- SymbolContextList &sc_list);
+ void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
/// Find functions by name.
///
@@ -304,30 +293,19 @@
/// \param[in] name
/// The name of the compile unit we are looking for.
///
- /// \param[in] namespace_decl
- /// If valid, a namespace to search in.
- ///
/// \param[in] name_type_mask
/// A bit mask of bits that indicate what kind of names should
/// be used when doing the lookup. Bits include fully qualified
/// names, base names, C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
- /// \param[in] append
- /// If \b true, any matches will be appended to \a sc_list, else
- /// matches replace the contents of \a sc_list.
- ///
/// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
- ///
- /// \return
- /// The number of matches added to \a sc_list.
- size_t FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- lldb::FunctionNameType name_type_mask, bool symbols_ok,
- bool inlines_ok, bool append,
- SymbolContextList &sc_list);
+ void FindFunctions(ConstString name,
+ const CompilerDeclContext &parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask, bool symbols_ok,
+ bool inlines_ok, SymbolContextList &sc_list);
/// Find functions by name.
///
@@ -338,19 +316,11 @@
/// \param[in] regex
/// A regular expression to use when matching the name.
///
- /// \param[in] append
- /// If \b true, any matches will be appended to \a sc_list, else
- /// matches replace the contents of \a sc_list.
- ///
/// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
- ///
- /// \return
- /// The number of matches added to \a sc_list.
- size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok,
- bool inlines_ok, bool append,
- SymbolContextList &sc_list);
+ void FindFunctions(const RegularExpression ®ex, bool symbols_ok,
+ bool inlines_ok, SymbolContextList &sc_list);
/// Find addresses by file/line
///
@@ -395,11 +365,9 @@
/// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// \return
- /// The number of matches added to \a variable_list.
- size_t FindGlobalVariables(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches, VariableList &variable_list);
+ void FindGlobalVariables(ConstString name,
+ const CompilerDeclContext &parent_decl_ctx,
+ size_t max_matches, VariableList &variable_list);
/// Find global and static variables by regular expression.
///
@@ -413,17 +381,14 @@
/// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// \return
- /// The number of matches added to \a variable_list.
- size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
- VariableList &variable_list);
+ void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
+ VariableList &variable_list);
/// Find types by name.
///
- /// Type lookups in modules go through the SymbolVendor (which will use one
- /// or more SymbolFile subclasses). The SymbolFile needs to be able to
- /// lookup types by basename and not the fully qualified typename. This
- /// allows the type accelerator tables to stay small, even with heavily
+ /// Type lookups in modules go through the SymbolFile. The SymbolFile needs to
+ /// be able to lookup types by basename and not the fully qualified typename.
+ /// This allows the type accelerator tables to stay small, even with heavily
/// templatized C++. The type search will then narrow down the search
/// results. If "exact_match" is true, then the type search will only match
/// exact type name matches. If "exact_match" is false, the type will match
@@ -446,16 +411,26 @@
/// omitted to make finding types that a user may type
/// easier.
///
- /// \param[out] type_list
+ /// \param[out] types
/// A type list gets populated with any matches.
///
- /// \return
- /// The number of matches added to \a type_list.
- size_t
+ void
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeList &types);
+ /// Find types by name.
+ ///
+ /// This behaves like the other FindTypes method but allows to
+ /// specify a DeclContext and a language for the type being searched
+ /// for.
+ ///
+ /// \param searched_symbol_files
+ /// Prevents one file from being visited multiple times.
+ void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+
lldb::TypeSP FindFirstType(const SymbolContext &sc,
ConstString type_name, bool exact_match);
@@ -467,17 +442,11 @@
/// The name of a type within a namespace that should not include
/// any qualifying namespaces (just a type basename).
///
- /// \param[in] namespace_decl
- /// The namespace declaration that this type must exist in.
- ///
/// \param[out] type_list
/// A type list gets populated with any matches.
- ///
- /// \return
- /// The number of matches added to \a type_list.
- size_t FindTypesInNamespace(ConstString type_name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches, TypeList &type_list);
+ void FindTypesInNamespace(ConstString type_name,
+ const CompilerDeclContext &parent_decl_ctx,
+ size_t max_matches, TypeList &type_list);
/// Get const accessor for the module architecture.
///
@@ -537,9 +506,10 @@
return m_object_mod_time;
}
- void SetObjectModificationTime(const llvm::sys::TimePoint<> &mod_time) {
- m_mod_time = mod_time;
- }
+ /// This callback will be called by SymbolFile implementations when
+ /// parsing a compile unit that contains SDK information.
+ /// \param sysroot will be added to the path remapping dictionary.
+ void RegisterXcodeSDK(llvm::StringRef sdk, llvm::StringRef sysroot);
/// Tells whether this module is capable of being the main executable for a
/// process.
@@ -638,27 +608,19 @@
ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr, Status &error,
size_t size_to_read = 512);
- /// Get the symbol vendor interface for the current architecture.
- ///
- /// If the symbol vendor file has not been located yet, this function will
- /// find the best SymbolVendor plug-in that can use the current object file.
- ///
- /// \return
- /// If this module does not have a valid object file, or no
- /// plug-in can be found that can use the object file, nullptr will
- /// be returned, else a valid symbol vendor plug-in interface
- /// will be returned. The returned pointer is owned by this
- /// object and remains valid as long as the object is around.
- virtual SymbolVendor *
- GetSymbolVendor(bool can_create = true,
- lldb_private::Stream *feedback_strm = nullptr);
- /// Get accessor the type list for this module.
+ /// Get the module's symbol file
///
- /// \return
- /// A valid type list pointer, or nullptr if there is no valid
- /// symbol vendor for this module.
- TypeList *GetTypeList();
+ /// If the symbol file has already been loaded, this function returns it. All
+ /// arguments are ignored. If the symbol file has not been located yet, and
+ /// the can_create argument is false, the function returns nullptr. If
+ /// can_create is true, this function will find the best SymbolFile plug-in
+ /// that can use the current object file. feedback_strm, if not null, is used
+ /// to report the details of the search process.
+ virtual SymbolFile *GetSymbolFile(bool can_create = true,
+ Stream *feedback_strm = nullptr);
+
+ Symtab *GetSymtab();
/// Get a reference to the UUID value contained in this object.
///
@@ -819,7 +781,8 @@
bool GetIsDynamicLinkEditor();
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language);
// Special error functions that can do printf style formatting that will
// prepend the message with something appropriate for this module (like the
@@ -848,7 +811,7 @@
// when the module first gets created.
bool FileHasChanged() const;
- // SymbolVendor, SymbolFile and ObjectFile member objects should lock the
+ // SymbolFile and ObjectFile member objects should lock the
// module mutex to avoid deadlocks.
std::recursive_mutex &GetMutex() const { return m_mutex; }
@@ -896,16 +859,19 @@
bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
bool RemapSourceFile(const char *, std::string &) const = delete;
+ /// Update the ArchSpec to a more specific variant.
+ bool MergeArchitecture(const ArchSpec &arch_spec);
+
/// \class LookupInfo Module.h "lldb/Core/Module.h"
/// A class that encapsulates name lookup information.
///
/// Users can type a wide variety of partial names when setting breakpoints
- /// by name or when looking for functions by name. SymbolVendor and
- /// SymbolFile objects are only required to implement name lookup for
- /// function basenames and for fully mangled names. This means if the user
- /// types in a partial name, we must reduce this to a name lookup that will
- /// work with all SymbolFile objects. So we might reduce a name lookup to
- /// look for a basename, and then prune out any results that don't match.
+ /// by name or when looking for functions by name. The SymbolFile object is
+ /// only required to implement name lookup for function basenames and for
+ /// fully mangled names. This means if the user types in a partial name, we
+ /// must reduce this to a name lookup that will work with all SymbolFile
+ /// objects. So we might reduce a name lookup to look for a basename, and then
+ /// prune out any results that don't match.
///
/// The "m_name" member variable represents the name as it was typed by the
/// user. "m_lookup_name" will be the name we actually search for through
@@ -988,6 +954,12 @@
///by \a m_file.
uint64_t m_object_offset;
llvm::sys::TimePoint<> m_object_mod_time;
+
+ /// DataBuffer containing the module image, if it was provided at
+ /// construction time. Otherwise the data will be retrieved by mapping
+ /// one of the FileSpec members above.
+ lldb::DataBufferSP m_data_sp;
+
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
///parser for this module as it may or may
///not be shared with the SymbolFile
@@ -1003,16 +975,17 @@
///references to them
TypeSystemMap m_type_system_map; ///< A map of any type systems associated
///with this module
- PathMappingList m_source_mappings; ///< Module specific source remappings for
- ///when you have debug info for a module
- ///that doesn't match where the sources
- ///currently are
+ /// Module specific source remappings for when you have debug info for a
+ /// module that doesn't match where the sources currently are.
+ PathMappingList m_source_mappings =
+ ModuleList::GetGlobalModuleListProperties().GetSymlinkMappings();
+
lldb::SectionListUP m_sections_up; ///< Unified section list for module that
/// is used by the ObjectFile and and
/// ObjectFile instances for the debug info
std::atomic<bool> m_did_load_objfile{false};
- std::atomic<bool> m_did_load_symbol_vendor{false};
+ std::atomic<bool> m_did_load_symfile{false};
std::atomic<bool> m_did_set_uuid{false};
mutable bool m_file_has_changed : 1,
m_first_file_changed_log : 1; /// See if the module was modified after it
@@ -1072,15 +1045,16 @@
private:
Module(); // Only used internally by CreateJITModule ()
- size_t FindTypes_Impl(
- ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, size_t max_matches,
+ void FindTypes_Impl(
+ ConstString name, const CompilerDeclContext &parent_decl_ctx,
+ size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types);
- DISALLOW_COPY_AND_ASSIGN(Module);
+ Module(const Module &) = delete;
+ const Module &operator=(const Module &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Module_h_
+#endif // LLDB_CORE_MODULE_H
diff --git a/linux-x64/clang/include/lldb/Core/ModuleChild.h b/linux-x64/clang/include/lldb/Core/ModuleChild.h
index 8a81c1a..63eb137 100644
--- a/linux-x64/clang/include/lldb/Core/ModuleChild.h
+++ b/linux-x64/clang/include/lldb/Core/ModuleChild.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ModuleChild_h_
-#define liblldb_ModuleChild_h_
+#ifndef LLDB_CORE_MODULECHILD_H
+#define LLDB_CORE_MODULECHILD_H
#include "lldb/lldb-forward.h"
@@ -20,7 +20,7 @@
public:
/// Construct with owning module.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The module that owns the object that inherits from this
/// class.
ModuleChild(const lldb::ModuleSP &module_sp);
@@ -46,17 +46,16 @@
/// Set accessor for the module pointer.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// A new module that owns the object that inherits from this
- /// class.
+ /// class.
void SetModule(const lldb::ModuleSP &module_sp);
protected:
- // Member variables
- lldb::ModuleWP m_module_wp; ///< The Module that owns the object that inherits
- ///< from this class.
+ /// The Module that owns the object that inherits from this class.
+ lldb::ModuleWP m_module_wp;
};
} // namespace lldb_private
-#endif // liblldb_ModuleChild_h_
+#endif // LLDB_CORE_MODULECHILD_H
diff --git a/linux-x64/clang/include/lldb/Core/ModuleList.h b/linux-x64/clang/include/lldb/Core/ModuleList.h
index 1e26c35..46a718f 100644
--- a/linux-x64/clang/include/lldb/Core/ModuleList.h
+++ b/linux-x64/clang/include/lldb/Core/ModuleList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ModuleList_h_
-#define liblldb_ModuleList_h_
+#ifndef LLDB_CORE_MODULELIST_H
+#define LLDB_CORE_MODULELIST_H
#include "lldb/Core/Address.h"
#include "lldb/Core/ModuleSpec.h"
@@ -20,6 +20,7 @@
#include "lldb/lldb-types.h"
#include "llvm/ADT/DenseSet.h"
+#include "llvm/Support/RWMutex.h"
#include <functional>
#include <list>
@@ -46,14 +47,21 @@
class VariableList;
class ModuleListProperties : public Properties {
+ mutable llvm::sys::RWMutex m_symlink_paths_mutex;
+ PathMappingList m_symlink_paths;
+
+ void UpdateSymlinkMappings();
+
public:
ModuleListProperties();
FileSpec GetClangModulesCachePath() const;
- bool SetClangModulesCachePath(llvm::StringRef path);
+ bool SetClangModulesCachePath(const FileSpec &path);
bool GetEnableExternalLookup() const;
bool SetEnableExternalLookup(bool new_value);
-};
+
+ PathMappingList GetSymlinkMappings() const;
+};
/// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
/// A collection class for Module objects.
@@ -116,10 +124,10 @@
/// If true, and a notifier function is set, the notifier function
/// will be called. Defaults to true.
///
- /// When this ModuleList is the Target's ModuleList, the notifier
- /// function is Target::ModulesDidLoad -- the call to
- /// ModulesDidLoad may be deferred when adding multiple Modules
- /// to the Target, but it must be called at the end,
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidLoad -- the call to
+ /// ModulesDidLoad may be deferred when adding multiple Modules
+ /// to the Target, but it must be called at the end,
/// before resuming execution.
void Append(const lldb::ModuleSP &module_sp, bool notify = true);
@@ -131,20 +139,24 @@
///
/// \param[in] module_sp
/// A shared pointer to a module to replace in this collection.
- void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
+ ///
+ /// \param[in] old_modules
+ /// Optional pointer to a vector which, if provided, will have shared
+ /// pointers to the replaced module(s) appended to it.
+ void ReplaceEquivalent(
+ const lldb::ModuleSP &module_sp,
+ llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules = nullptr);
/// Append a module to the module list, if it is not already there.
///
- /// \param[in] module_sp
- ///
/// \param[in] notify
/// If true, and a notifier function is set, the notifier function
/// will be called. Defaults to true.
///
- /// When this ModuleList is the Target's ModuleList, the notifier
- /// function is Target::ModulesDidLoad -- the call to
- /// ModulesDidLoad may be deferred when adding multiple Modules
- /// to the Target, but it must be called at the end,
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidLoad -- the call to
+ /// ModulesDidLoad may be deferred when adding multiple Modules
+ /// to the Target, but it must be called at the end,
/// before resuming execution.
bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify = true);
@@ -225,20 +237,6 @@
/// \see ModuleList::GetSize()
Module *GetModulePointerAtIndex(size_t idx) const;
- /// Get the module pointer for the module at index \a idx without acquiring
- /// the ModuleList mutex. This MUST already have been acquired with
- /// ModuleList::GetMutex and locked for this call to be safe.
- ///
- /// \param[in] idx
- /// An index into this module collection.
- ///
- /// \return
- /// A pointer to a Module which can by nullptr if \a idx is out
- /// of range.
- ///
- /// \see ModuleList::GetSize()
- Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
-
/// Find compile units by partial or full path.
///
/// Finds all compile units that match \a path in all of the modules and
@@ -247,35 +245,24 @@
/// \param[in] path
/// The name of the compile unit we are looking for.
///
- /// \param[in] append
- /// If \b true, then append any compile units that were found
- /// to \a sc_list. If \b false, then the \a sc_list is cleared
- /// and the contents of \a sc_list are replaced.
- ///
/// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
- ///
- /// \return
- /// The number of matches added to \a sc_list.
- size_t FindCompileUnits(const FileSpec &path, bool append,
- SymbolContextList &sc_list) const;
+ void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const;
/// \see Module::FindFunctions ()
- size_t FindFunctions(ConstString name,
- lldb::FunctionNameType name_type_mask,
- bool include_symbols, bool include_inlines, bool append,
- SymbolContextList &sc_list) const;
+ void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask,
+ bool include_symbols, bool include_inlines,
+ SymbolContextList &sc_list) const;
/// \see Module::FindFunctionSymbols ()
- size_t FindFunctionSymbols(ConstString name,
- lldb::FunctionNameType name_type_mask,
- SymbolContextList &sc_list);
+ void FindFunctionSymbols(ConstString name,
+ lldb::FunctionNameType name_type_mask,
+ SymbolContextList &sc_list);
/// \see Module::FindFunctions ()
- size_t FindFunctions(const RegularExpression &name, bool include_symbols,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
+ void FindFunctions(const RegularExpression &name, bool include_symbols,
+ bool include_inlines, SymbolContextList &sc_list);
/// Find global and static variables by name.
///
@@ -289,11 +276,8 @@
///
/// \param[in] variable_list
/// A list of variables that gets the matches appended to.
- ///
- /// \return
- /// The number of matches added to \a variable_list.
- size_t FindGlobalVariables(ConstString name, size_t max_matches,
- VariableList &variable_list) const;
+ void FindGlobalVariables(ConstString name, size_t max_matches,
+ VariableList &variable_list) const;
/// Find global and static variables by regular expression.
///
@@ -306,15 +290,12 @@
///
/// \param[in] variable_list
/// A list of variables that gets the matches appended to.
- ///
- /// \return
- /// The number of matches added to \a variable_list.
- size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
- VariableList &variable_list) const;
+ void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
+ VariableList &variable_list) const;
/// Finds the first module whose file specification matches \a file_spec.
///
- /// \param[in] file_spec_ptr
+ /// \param[in] module_spec
/// A file specification object to match against the Module's
/// file specifications. If \a file_spec does not have
/// directory information, matches will occur by matching only
@@ -322,26 +303,11 @@
/// NULL, then file specifications won't be compared when
/// searching for matching modules.
///
- /// \param[in] arch_ptr
- /// The architecture to search for if non-NULL. If this value
- /// is NULL no architecture matching will be performed.
- ///
- /// \param[in] uuid_ptr
- /// The uuid to search for if non-NULL. If this value is NULL
- /// no uuid matching will be performed.
- ///
- /// \param[in] object_name
- /// An optional object name that must match as well. This value
- /// can be NULL.
- ///
/// \param[out] matching_module_list
/// A module list that gets filled in with any modules that
/// match the search criteria.
- ///
- /// \return
- /// The number of matching modules found by the search.
- size_t FindModules(const ModuleSpec &module_spec,
- ModuleList &matching_module_list) const;
+ void FindModules(const ModuleSpec &module_spec,
+ ModuleList &matching_module_list) const;
lldb::ModuleSP FindModule(const Module *module_ptr) const;
@@ -354,15 +320,13 @@
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
- size_t FindSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- SymbolContextList &sc_list,
- bool append = false) const;
+ void FindSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list) const;
- size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
- lldb::SymbolType symbol_type,
- SymbolContextList &sc_list,
- bool append = false) const;
+ void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list) const;
/// Find types by name.
///
@@ -373,32 +337,17 @@
/// \param[in] name
/// The name of the type we are looking for.
///
- /// \param[in] append
- /// If \b true, any matches will be appended to \a
- /// variable_list, else matches replace the contents of
- /// \a variable_list.
- ///
/// \param[in] max_matches
/// Allow the number of matches to be limited to \a
/// max_matches. Specify UINT32_MAX to get all possible matches.
///
- /// \param[in] encoding
- /// Limit the search to specific types, or get all types if
- /// set to Type::invalid.
- ///
- /// \param[in] udt_name
- /// If the encoding is a user defined type, specify the name
- /// of the user defined type ("struct", "union", "class", etc).
- ///
- /// \param[out] type_list
+ /// \param[out] types
/// A type list gets populated with any matches.
///
- /// \return
- /// The number of matches added to \a type_list.
- size_t FindTypes(Module *search_first, ConstString name,
- bool name_is_fully_qualified, size_t max_matches,
- llvm::DenseSet<SymbolFile *> &searched_symbol_files,
- TypeList &types) const;
+ void FindTypes(Module *search_first, ConstString name,
+ bool name_is_fully_qualified, size_t max_matches,
+ llvm::DenseSet<SymbolFile *> &searched_symbol_files,
+ TypeList &types) const;
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
@@ -438,10 +387,10 @@
/// If true, and a notifier function is set, the notifier function
/// will be called. Defaults to true.
///
- /// When this ModuleList is the Target's ModuleList, the notifier
- /// function is Target::ModulesDidUnload -- the call to
- /// ModulesDidUnload may be deferred when removing multiple Modules
- /// from the Target, but it must be called at the end,
+ /// When this ModuleList is the Target's ModuleList, the notifier
+ /// function is Target::ModulesDidUnload -- the call to
+ /// ModulesDidUnload may be deferred when removing multiple Modules
+ /// from the Target, but it must be called at the end,
/// before resuming execution.
bool Remove(const lldb::ModuleSP &module_sp, bool notify = true);
@@ -476,6 +425,7 @@
/// \return
/// The number of modules in the module list.
size_t GetSize() const;
+ bool IsEmpty() const { return !GetSize(); }
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
Stream *feedback_stream = nullptr,
@@ -485,22 +435,21 @@
static bool ModuleIsInCache(const Module *module_ptr);
- static Status GetSharedModule(const ModuleSpec &module_spec,
- lldb::ModuleSP &module_sp,
- const FileSpecList *module_search_paths_ptr,
- lldb::ModuleSP *old_module_sp_ptr,
- bool *did_create_ptr,
- bool always_create = false);
+ static Status
+ GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr,
+ llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
+ bool *did_create_ptr, bool always_create = false);
static bool RemoveSharedModule(lldb::ModuleSP &module_sp);
- static size_t FindSharedModules(const ModuleSpec &module_spec,
- ModuleList &matching_module_list);
+ static void FindSharedModules(const ModuleSpec &module_spec,
+ ModuleList &matching_module_list);
static size_t RemoveOrphanSharedModules(bool mandatory);
static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr);
-
+
void ForEach(std::function<bool(const lldb::ModuleSP &module_sp)> const
&callback) const;
@@ -528,15 +477,17 @@
typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter,
std::recursive_mutex>
ModuleIterable;
- ModuleIterable Modules() { return ModuleIterable(m_modules, GetMutex()); }
+ ModuleIterable Modules() const {
+ return ModuleIterable(m_modules, GetMutex());
+ }
typedef AdaptedIterable<collection, lldb::ModuleSP, vector_adapter>
ModuleIterableNoLocking;
- ModuleIterableNoLocking ModulesNoLocking() {
+ ModuleIterableNoLocking ModulesNoLocking() const {
return ModuleIterableNoLocking(m_modules);
}
};
} // namespace lldb_private
-#endif // liblldb_ModuleList_h_
+#endif // LLDB_CORE_MODULELIST_H
diff --git a/linux-x64/clang/include/lldb/Core/ModuleSpec.h b/linux-x64/clang/include/lldb/Core/ModuleSpec.h
index ab0f4e9..9dd398a 100644
--- a/linux-x64/clang/include/lldb/Core/ModuleSpec.h
+++ b/linux-x64/clang/include/lldb/Core/ModuleSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ModuleSpec_h_
-#define liblldb_ModuleSpec_h_
+#ifndef LLDB_CORE_MODULESPEC_H
+#define LLDB_CORE_MODULESPEC_H
#include "lldb/Host/FileSystem.h"
#include "lldb/Target/PathMappingList.h"
@@ -30,11 +30,19 @@
m_object_name(), m_object_offset(0), m_object_size(0),
m_source_mappings() {}
- ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID())
+ /// If the \param data argument is passed, its contents will be used
+ /// as the module contents instead of trying to read them from
+ /// \param file_spec.
+ ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID(),
+ lldb::DataBufferSP data = lldb::DataBufferSP())
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),
- m_uuid(uuid), m_object_name(), m_object_offset(0),
- m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
- m_source_mappings() {}
+ m_uuid(uuid), m_object_name(), m_object_offset(0), m_source_mappings(),
+ m_data(data) {
+ if (data)
+ m_object_size = data->GetByteSize();
+ else if (m_file)
+ m_object_size = FileSystem::Instance().GetByteSize(file_spec);
+ }
ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch),
@@ -42,30 +50,6 @@
m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
m_source_mappings() {}
- ModuleSpec(const ModuleSpec &rhs)
- : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file),
- m_symbol_file(rhs.m_symbol_file), m_arch(rhs.m_arch),
- m_uuid(rhs.m_uuid), m_object_name(rhs.m_object_name),
- m_object_offset(rhs.m_object_offset), m_object_size(rhs.m_object_size),
- m_object_mod_time(rhs.m_object_mod_time),
- m_source_mappings(rhs.m_source_mappings) {}
-
- ModuleSpec &operator=(const ModuleSpec &rhs) {
- if (this != &rhs) {
- m_file = rhs.m_file;
- m_platform_file = rhs.m_platform_file;
- m_symbol_file = rhs.m_symbol_file;
- m_arch = rhs.m_arch;
- m_uuid = rhs.m_uuid;
- m_object_name = rhs.m_object_name;
- m_object_offset = rhs.m_object_offset;
- m_object_size = rhs.m_object_size;
- m_object_mod_time = rhs.m_object_mod_time;
- m_source_mappings = rhs.m_source_mappings;
- }
- return *this;
- }
-
FileSpec *GetFileSpecPtr() { return (m_file ? &m_file : nullptr); }
const FileSpec *GetFileSpecPtr() const {
@@ -146,6 +130,8 @@
PathMappingList &GetSourceMappingList() const { return m_source_mappings; }
+ lldb::DataBufferSP GetData() const { return m_data; }
+
void Clear() {
m_file.Clear();
m_platform_file.Clear();
@@ -207,7 +193,7 @@
if (dumped_something)
strm.PutCString(", ");
strm.Printf("arch = ");
- m_arch.DumpTriple(strm);
+ m_arch.DumpTriple(strm.AsRawOstream());
dumped_something = true;
}
if (m_uuid.IsValid()) {
@@ -251,24 +237,18 @@
if (match_module_spec.GetObjectName() &&
match_module_spec.GetObjectName() != GetObjectName())
return false;
- if (match_module_spec.GetFileSpecPtr()) {
- const FileSpec &fspec = match_module_spec.GetFileSpec();
- if (!FileSpec::Equal(fspec, GetFileSpec(),
- !fspec.GetDirectory().IsEmpty()))
- return false;
- }
- if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) {
- const FileSpec &fspec = match_module_spec.GetPlatformFileSpec();
- if (!FileSpec::Equal(fspec, GetPlatformFileSpec(),
- !fspec.GetDirectory().IsEmpty()))
- return false;
+ if (!FileSpec::Match(match_module_spec.GetFileSpec(), GetFileSpec()))
+ return false;
+ if (GetPlatformFileSpec() &&
+ !FileSpec::Match(match_module_spec.GetPlatformFileSpec(),
+ GetPlatformFileSpec())) {
+ return false;
}
// Only match the symbol file spec if there is one in this ModuleSpec
- if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) {
- const FileSpec &fspec = match_module_spec.GetSymbolFileSpec();
- if (!FileSpec::Equal(fspec, GetSymbolFileSpec(),
- !fspec.GetDirectory().IsEmpty()))
- return false;
+ if (GetSymbolFileSpec() &&
+ !FileSpec::Match(match_module_spec.GetSymbolFileSpec(),
+ GetSymbolFileSpec())) {
+ return false;
}
if (match_module_spec.GetArchitecturePtr()) {
if (exact_arch_match) {
@@ -295,6 +275,7 @@
uint64_t m_object_size;
llvm::sys::TimePoint<> m_object_mod_time;
mutable PathMappingList m_source_mappings;
+ lldb::DataBufferSP m_data = {};
};
class ModuleSpecList {
@@ -380,8 +361,8 @@
return false;
}
- size_t FindMatchingModuleSpecs(const ModuleSpec &module_spec,
- ModuleSpecList &matching_list) const {
+ void FindMatchingModuleSpecs(const ModuleSpec &module_spec,
+ ModuleSpecList &matching_list) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
bool exact_arch_match = true;
const size_t initial_match_count = matching_list.GetSize();
@@ -400,7 +381,6 @@
matching_list.Append(spec);
}
}
- return matching_list.GetSize() - initial_match_count;
}
void Dump(Stream &strm) {
@@ -422,4 +402,4 @@
} // namespace lldb_private
-#endif // liblldb_ModuleSpec_h_
+#endif // LLDB_CORE_MODULESPEC_H
diff --git a/linux-x64/clang/include/lldb/Core/Opcode.h b/linux-x64/clang/include/lldb/Core/Opcode.h
index 1a30ce4..a812ae2 100644
--- a/linux-x64/clang/include/lldb/Core/Opcode.h
+++ b/linux-x64/clang/include/lldb/Core/Opcode.h
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Opcode_h
-#define lldb_Opcode_h
+#ifndef LLDB_CORE_OPCODE_H
+#define LLDB_CORE_OPCODE_H
#include "lldb/Utility/Endian.h"
#include "lldb/lldb-enumerations.h"
-#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/SwapByteOrder.h"
#include <assert.h>
#include <stdint.h>
@@ -270,4 +270,4 @@
} // namespace lldb_private
-#endif // lldb_Opcode_h
+#endif // LLDB_CORE_OPCODE_H
diff --git a/linux-x64/clang/include/lldb/Core/PluginInterface.h b/linux-x64/clang/include/lldb/Core/PluginInterface.h
index 6e625a6..5bdb2f4 100644
--- a/linux-x64/clang/include/lldb/Core/PluginInterface.h
+++ b/linux-x64/clang/include/lldb/Core/PluginInterface.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_PluginInterface_h_
-#define liblldb_PluginInterface_h_
+#ifndef LLDB_CORE_PLUGININTERFACE_H
+#define LLDB_CORE_PLUGININTERFACE_H
#include "lldb/lldb-private.h"
@@ -15,13 +15,17 @@
class PluginInterface {
public:
- virtual ~PluginInterface() {}
+ PluginInterface() = default;
+ virtual ~PluginInterface() = default;
virtual ConstString GetPluginName() = 0;
virtual uint32_t GetPluginVersion() = 0;
+
+ PluginInterface(const PluginInterface &) = delete;
+ PluginInterface &operator=(const PluginInterface &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_PluginInterface_h_
+#endif // LLDB_CORE_PLUGININTERFACE_H
diff --git a/linux-x64/clang/include/lldb/Core/PluginManager.h b/linux-x64/clang/include/lldb/Core/PluginManager.h
index 1bac1e5..0ac8308 100644
--- a/linux-x64/clang/include/lldb/Core/PluginManager.h
+++ b/linux-x64/clang/include/lldb/Core/PluginManager.h
@@ -6,10 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_PluginManager_h_
-#define liblldb_PluginManager_h_
+#ifndef LLDB_CORE_PLUGINMANAGER_H
+#define LLDB_CORE_PLUGINMANAGER_H
#include "lldb/Core/Architecture.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-enumerations.h"
@@ -20,6 +22,25 @@
#include <stddef.h>
#include <stdint.h>
+#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName) \
+ namespace lldb_private { \
+ void lldb_initialize_##PluginName() { ClassName::Initialize(); } \
+ void lldb_terminate_##PluginName() { ClassName::Terminate(); } \
+ }
+
+#define LLDB_PLUGIN_DEFINE(PluginName) \
+ LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
+
+// FIXME: Generate me with CMake
+#define LLDB_PLUGIN_DECLARE(PluginName) \
+ namespace lldb_private { \
+ extern void lldb_initialize_##PluginName(); \
+ extern void lldb_terminate_##PluginName(); \
+ }
+
+#define LLDB_PLUGIN_INITIALIZE(PluginName) lldb_initialize_##PluginName()
+#define LLDB_PLUGIN_TERMINATE(PluginName) lldb_terminate_##PluginName()
+
namespace lldb_private {
class CommandInterpreter;
class ConstString;
@@ -40,15 +61,8 @@
static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
- static ABICreateInstance
- GetABICreateCallbackForPluginName(ConstString name);
-
// Architecture
- using ArchitectureCreateInstance =
- std::unique_ptr<Architecture> (*)(const ArchSpec &);
-
- static void RegisterPlugin(ConstString name,
- llvm::StringRef description,
+ static void RegisterPlugin(ConstString name, llvm::StringRef description,
ArchitectureCreateInstance create_callback);
static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
@@ -93,9 +107,6 @@
static JITLoaderCreateInstance
GetJITLoaderCreateCallbackAtIndex(uint32_t idx);
- static JITLoaderCreateInstance
- GetJITLoaderCreateCallbackForPluginName(ConstString name);
-
// EmulateInstruction
static bool RegisterPlugin(ConstString name, const char *description,
EmulateInstructionCreateInstance create_callback);
@@ -130,9 +141,6 @@
static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx);
- static LanguageCreateInstance
- GetLanguageCreateCallbackForPluginName(ConstString name);
-
// LanguageRuntime
static bool RegisterPlugin(
ConstString name, const char *description,
@@ -151,9 +159,6 @@
static LanguageRuntimeGetExceptionPrecondition
GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx);
- static LanguageRuntimeCreateInstance
- GetLanguageRuntimeCreateCallbackForPluginName(ConstString name);
-
// SystemRuntime
static bool RegisterPlugin(ConstString name, const char *description,
SystemRuntimeCreateInstance create_callback);
@@ -163,9 +168,6 @@
static SystemRuntimeCreateInstance
GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
- static SystemRuntimeCreateInstance
- GetSystemRuntimeCreateCallbackForPluginName(ConstString name);
-
// ObjectFile
static bool
RegisterPlugin(ConstString name, const char *description,
@@ -185,9 +187,6 @@
static ObjectFileGetModuleSpecifications
GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
- static ObjectFileCreateInstance
- GetObjectFileCreateCallbackForPluginName(ConstString name);
-
static ObjectFileCreateMemoryInstance
GetObjectFileCreateMemoryCallbackForPluginName(ConstString name);
@@ -205,9 +204,6 @@
static ObjectContainerCreateInstance
GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
- static ObjectContainerCreateInstance
- GetObjectContainerCreateCallbackForPluginName(ConstString name);
-
static ObjectFileGetModuleSpecifications
GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
@@ -228,8 +224,8 @@
static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
- static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
- StringList &matches);
+ static void AutoCompletePlatformName(llvm::StringRef partial_name,
+ CompletionRequest &request);
// Process
static bool
RegisterPlugin(ConstString name, const char *description,
@@ -247,6 +243,9 @@
static const char *GetProcessPluginDescriptionAtIndex(uint32_t idx);
+ static void AutoCompleteProcessName(llvm::StringRef partial_name,
+ CompletionRequest &request);
+
// ScriptInterpreter
static bool RegisterPlugin(ConstString name, const char *description,
lldb::ScriptLanguage script_lang,
@@ -307,9 +306,6 @@
static StructuredDataPluginCreateInstance
GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx);
- static StructuredDataPluginCreateInstance
- GetStructuredDataPluginCreateCallbackForPluginName(ConstString name);
-
static StructuredDataFilterLaunchInfo
GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
bool &iteration_complete);
@@ -325,9 +321,6 @@
static SymbolFileCreateInstance
GetSymbolFileCreateCallbackAtIndex(uint32_t idx);
- static SymbolFileCreateInstance
- GetSymbolFileCreateCallbackForPluginName(ConstString name);
-
// SymbolVendor
static bool RegisterPlugin(ConstString name, const char *description,
SymbolVendorCreateInstance create_callback);
@@ -337,8 +330,41 @@
static SymbolVendorCreateInstance
GetSymbolVendorCreateCallbackAtIndex(uint32_t idx);
- static SymbolVendorCreateInstance
- GetSymbolVendorCreateCallbackForPluginName(ConstString name);
+ // Trace
+ static bool RegisterPlugin(ConstString name, const char *description,
+ TraceCreateInstance create_callback,
+ llvm::StringRef schema,
+ TraceGetStartCommand get_start_command);
+
+ static bool UnregisterPlugin(TraceCreateInstance create_callback);
+
+ static TraceCreateInstance GetTraceCreateCallback(ConstString plugin_name);
+
+ static lldb::CommandObjectSP
+ GetTraceStartCommand(llvm::StringRef plugin_name,
+ CommandInterpreter &interpreter);
+
+ /// Get the JSON schema for a trace session file corresponding to the given
+ /// plugin.
+ ///
+ /// \param[in] plugin_name
+ /// The name of the plugin.
+ ///
+ /// \return
+ /// An empty \a StringRef if no plugin was found with that plugin name,
+ /// otherwise the actual schema is returned.
+ static llvm::StringRef GetTraceSchema(ConstString plugin_name);
+
+ /// Get the JSON schema for a trace session file corresponding to the plugin
+ /// given by its index.
+ ///
+ /// \param[in] index
+ /// The index of the plugin to get the schema of.
+ ///
+ /// \return
+ /// An empty \a StringRef if the index is greater than or equal to the
+ /// number plugins, otherwise the actual schema is returned.
+ static llvm::StringRef GetTraceSchema(size_t index);
// UnwindAssembly
static bool RegisterPlugin(ConstString name, const char *description,
@@ -349,9 +375,6 @@
static UnwindAssemblyCreateInstance
GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx);
- static UnwindAssemblyCreateInstance
- GetUnwindAssemblyCreateCallbackForPluginName(ConstString name);
-
// MemoryHistory
static bool RegisterPlugin(ConstString name, const char *description,
MemoryHistoryCreateInstance create_callback);
@@ -361,9 +384,6 @@
static MemoryHistoryCreateInstance
GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx);
- static MemoryHistoryCreateInstance
- GetMemoryHistoryCreateCallbackForPluginName(ConstString name);
-
// InstrumentationRuntime
static bool
RegisterPlugin(ConstString name, const char *description,
@@ -379,49 +399,31 @@
static InstrumentationRuntimeCreateInstance
GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
- static InstrumentationRuntimeCreateInstance
- GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
-
// TypeSystem
- static bool RegisterPlugin(
- ConstString name, const char *description,
- TypeSystemCreateInstance create_callback,
- TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+ static bool RegisterPlugin(ConstString name, const char *description,
+ TypeSystemCreateInstance create_callback,
+ LanguageSet supported_languages_for_types,
+ LanguageSet supported_languages_for_expressions);
static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
static TypeSystemCreateInstance
GetTypeSystemCreateCallbackAtIndex(uint32_t idx);
- static TypeSystemCreateInstance
- GetTypeSystemCreateCallbackForPluginName(ConstString name);
+ static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
- static TypeSystemEnumerateSupportedLanguages
- GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
-
- static TypeSystemEnumerateSupportedLanguages
- GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
- ConstString name);
+ static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
// REPL
- static bool
- RegisterPlugin(ConstString name, const char *description,
- REPLCreateInstance create_callback,
- REPLEnumerateSupportedLanguages enumerate_languages_callback);
+ static bool RegisterPlugin(ConstString name, const char *description,
+ REPLCreateInstance create_callback,
+ LanguageSet supported_languages);
static bool UnregisterPlugin(REPLCreateInstance create_callback);
static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
- static REPLCreateInstance
- GetREPLCreateCallbackForPluginName(ConstString name);
-
- static REPLEnumerateSupportedLanguages
- GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
-
- static REPLEnumerateSupportedLanguages
- GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
- ConstString name);
+ static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
// Some plug-ins might register a DebuggerInitializeCallback callback when
// registering the plug-in. After a new Debugger instance is created, this
@@ -439,32 +441,28 @@
ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
- GetSettingForPlatformPlugin(Debugger &debugger,
- ConstString setting_name);
+ GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name);
static bool CreateSettingForPlatformPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
- GetSettingForProcessPlugin(Debugger &debugger,
- ConstString setting_name);
+ GetSettingForProcessPlugin(Debugger &debugger, ConstString setting_name);
static bool CreateSettingForProcessPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
- GetSettingForSymbolFilePlugin(Debugger &debugger,
- ConstString setting_name);
+ GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name);
static bool CreateSettingForSymbolFilePlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
- GetSettingForJITLoaderPlugin(Debugger &debugger,
- ConstString setting_name);
+ GetSettingForJITLoaderPlugin(Debugger &debugger, ConstString setting_name);
static bool CreateSettingForJITLoaderPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
@@ -489,4 +487,4 @@
} // namespace lldb_private
-#endif // liblldb_PluginManager_h_
+#endif // LLDB_CORE_PLUGINMANAGER_H
diff --git a/linux-x64/clang/include/lldb/Core/RichManglingContext.h b/linux-x64/clang/include/lldb/Core/RichManglingContext.h
index e6fa259..68f80e7 100644
--- a/linux-x64/clang/include/lldb/Core/RichManglingContext.h
+++ b/linux-x64/clang/include/lldb/Core/RichManglingContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RichManglingContext_h_
-#define liblldb_RichManglingContext_h_
+#ifndef LLDB_CORE_RICHMANGLINGCONTEXT_H
+#define LLDB_CORE_RICHMANGLINGCONTEXT_H
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
diff --git a/linux-x64/clang/include/lldb/Core/STLUtils.h b/linux-x64/clang/include/lldb/Core/STLUtils.h
deleted file mode 100644
index 830aca3..0000000
--- a/linux-x64/clang/include/lldb/Core/STLUtils.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===-- STLUtils.h ----------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_STLUtils_h_
-#define liblldb_STLUtils_h_
-
-#include <string.h>
-
-#include <map>
-#include <ostream>
-#include <vector>
-
-
-// C string less than compare function object
-struct CStringCompareFunctionObject {
- bool operator()(const char *s1, const char *s2) const {
- return strcmp(s1, s2) < 0;
- }
-};
-
-// C string equality function object (binary predicate).
-struct CStringEqualBinaryPredicate {
- bool operator()(const char *s1, const char *s2) const {
- return strcmp(s1, s2) == 0;
- }
-};
-
-// Templated type for finding an entry in a std::map<F,S> whose value is equal
-// to something
-template <class F, class S> class ValueEquals {
-public:
- ValueEquals(const S &val) : second_value(val) {}
-
- // Compare the second item
- bool operator()(std::pair<const F, S> elem) {
- return elem.second == second_value;
- }
-
-private:
- S second_value;
-};
-
-template <class T>
-inline void PrintAllCollectionElements(std::ostream &s, const T &coll,
- const char *header_cstr = nullptr,
- const char *separator_cstr = " ") {
- typename T::const_iterator pos;
-
- if (header_cstr)
- s << header_cstr;
- for (pos = coll.begin(); pos != coll.end(); ++pos) {
- s << *pos << separator_cstr;
- }
- s << std::endl;
-}
-
-// The function object below can be used to delete a STL container that
-// contains C++ object pointers.
-//
-// Usage: std::for_each(vector.begin(), vector.end(), for_each_delete());
-
-struct for_each_cplusplus_delete {
- template <typename T> void operator()(T *ptr) { delete ptr; }
-};
-
-typedef std::vector<std::string> STLStringArray;
-typedef std::vector<const char *> CStringArray;
-
-#endif // liblldb_STLUtils_h_
diff --git a/linux-x64/clang/include/lldb/Core/SearchFilter.h b/linux-x64/clang/include/lldb/Core/SearchFilter.h
index f38690c..54dc65e 100644
--- a/linux-x64/clang/include/lldb/Core/SearchFilter.h
+++ b/linux-x64/clang/include/lldb/Core/SearchFilter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SearchFilter_h_
-#define liblldb_SearchFilter_h_
+#ifndef LLDB_CORE_SEARCHFILTER_H
+#define LLDB_CORE_SEARCHFILTER_H
#include "lldb/Core/FileSpecList.h"
#include "lldb/Utility/StructuredData.h"
@@ -52,8 +52,8 @@
virtual ~Searcher();
virtual CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context, Address *addr,
- bool complete) = 0;
+ SymbolContext &context,
+ Address *addr) = 0;
virtual lldb::SearchDepth GetDepth() = 0;
@@ -84,7 +84,7 @@
public:
/// The basic constructor takes a Target, which gives the space to search.
///
- /// \param[in] target
+ /// \param[in] target_sp
/// The Target that provides the module list to search.
SearchFilter(const lldb::TargetSP &target_sp);
@@ -98,15 +98,19 @@
/// The file spec to check against the filter.
/// \return
/// \b true if \a spec passes, and \b false otherwise.
+ ///
+ /// \note the default implementation always returns \c true.
virtual bool ModulePasses(const FileSpec &spec);
/// Call this method with a Module to see if that module passes the filter.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The Module to check against the filter.
///
/// \return
/// \b true if \a module passes, and \b false otherwise.
+ ///
+ /// \note the default implementation always returns \c true.
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
/// Call this method with a Address to see if \a address passes the filter.
@@ -116,6 +120,8 @@
///
/// \return
/// \b true if \a address passes, and \b false otherwise.
+ ///
+ /// \note the default implementation always returns \c true.
virtual bool AddressPasses(Address &addr);
/// Call this method with a FileSpec to see if \a file spec passes the
@@ -126,6 +132,8 @@
///
/// \return
/// \b true if \a file spec passes, and \b false otherwise.
+ ///
+ /// \note the default implementation always returns \c true.
virtual bool CompUnitPasses(FileSpec &fileSpec);
/// Call this method with a CompileUnit to see if \a comp unit passes the
@@ -136,6 +144,8 @@
///
/// \return
/// \b true if \a Comp Unit passes, and \b false otherwise.
+ ///
+ /// \note the default implementation always returns \c true.
virtual bool CompUnitPasses(CompileUnit &compUnit);
/// Call this method with a Function to see if \a function passes the
@@ -187,10 +197,10 @@
/// Standard "Dump" method. At present it does nothing.
virtual void Dump(Stream *s) const;
- lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
+ lldb::SearchFilterSP CreateCopy(lldb::TargetSP& target_sp);
static lldb::SearchFilterSP
- CreateFromStructuredData(Target &target,
+ CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
@@ -261,13 +271,13 @@
const SymbolContext &context,
Searcher &searcher);
- virtual lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) = 0;
+ virtual lldb::SearchFilterSP DoCreateCopy() = 0;
void SetTarget(lldb::TargetSP &target_sp) { m_target_sp = target_sp; }
- lldb::TargetSP
- m_target_sp; // Every filter has to be associated with a target for
- // now since you need a starting place for the search.
+ lldb::TargetSP m_target_sp; // Every filter has to be associated with
+ // a target for now since you need a starting
+ // place for the search.
private:
unsigned char SubclassID;
};
@@ -288,14 +298,14 @@
bool ModulePasses(const lldb::ModuleSP &module_sp) override;
static lldb::SearchFilterSP
- CreateFromStructuredData(Target &target,
+ CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
protected:
- lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::SearchFilterSP DoCreateCopy() override;
};
/// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
@@ -306,7 +316,7 @@
/// The basic constructor takes a Target, which gives the space to search,
/// and the module to restrict the search to.
///
- /// \param[in] target
+ /// \param[in] targetSP
/// The Target that provides the module list to search.
///
/// \param[in] module
@@ -321,10 +331,6 @@
bool AddressPasses(Address &address) override;
- bool CompUnitPasses(FileSpec &fileSpec) override;
-
- bool CompUnitPasses(CompileUnit &compUnit) override;
-
void GetDescription(Stream *s) override;
uint32_t GetFilterRequiredItems() override;
@@ -334,14 +340,14 @@
void Search(Searcher &searcher) override;
static lldb::SearchFilterSP
- CreateFromStructuredData(Target &target,
+ CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
protected:
- lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::SearchFilterSP DoCreateCopy() override;
private:
FileSpec m_module_spec;
@@ -352,10 +358,10 @@
/// The basic constructor takes a Target, which gives the space to search,
/// and the module list to restrict the search to.
///
- /// \param[in] target
+ /// \param[in] targetSP
/// The Target that provides the module list to search.
///
- /// \param[in] module
+ /// \param[in] module_list
/// The Module that limits the search.
SearchFilterByModuleList(const lldb::TargetSP &targetSP,
const FileSpecList &module_list);
@@ -366,18 +372,12 @@
~SearchFilterByModuleList() override;
- SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs);
-
bool ModulePasses(const lldb::ModuleSP &module_sp) override;
bool ModulePasses(const FileSpec &spec) override;
bool AddressPasses(Address &address) override;
- bool CompUnitPasses(FileSpec &fileSpec) override;
-
- bool CompUnitPasses(CompileUnit &compUnit) override;
-
void GetDescription(Stream *s) override;
uint32_t GetFilterRequiredItems() override;
@@ -387,7 +387,7 @@
void Search(Searcher &searcher) override;
static lldb::SearchFilterSP
- CreateFromStructuredData(Target &target,
+ CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
@@ -396,9 +396,8 @@
void SerializeUnwrapped(StructuredData::DictionarySP &options_dict_sp);
protected:
- lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::SearchFilterSP DoCreateCopy() override;
-protected:
FileSpecList m_module_spec_list;
};
@@ -406,23 +405,12 @@
public:
/// The basic constructor takes a Target, which gives the space to search,
/// and the module list to restrict the search to.
- ///
- /// \param[in] target
- /// The Target that provides the module list to search.
- ///
- /// \param[in] module
- /// The Module that limits the search.
SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP,
const FileSpecList &module_list,
const FileSpecList &cu_list);
- SearchFilterByModuleListAndCU(const SearchFilterByModuleListAndCU &rhs);
-
~SearchFilterByModuleListAndCU() override;
- SearchFilterByModuleListAndCU &
- operator=(const SearchFilterByModuleListAndCU &rhs);
-
bool AddressPasses(Address &address) override;
bool CompUnitPasses(FileSpec &fileSpec) override;
@@ -438,14 +426,14 @@
void Search(Searcher &searcher) override;
static lldb::SearchFilterSP
- CreateFromStructuredData(Target &target,
+ CreateFromStructuredData(const lldb::TargetSP& target_sp,
const StructuredData::Dictionary &data_dict,
Status &error);
StructuredData::ObjectSP SerializeToStructuredData() override;
protected:
- lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::SearchFilterSP DoCreateCopy() override;
private:
FileSpecList m_cu_spec_list;
@@ -453,4 +441,4 @@
} // namespace lldb_private
-#endif // liblldb_SearchFilter_h_
+#endif // LLDB_CORE_SEARCHFILTER_H
diff --git a/linux-x64/clang/include/lldb/Core/Section.h b/linux-x64/clang/include/lldb/Core/Section.h
index 542849b..af2bb78 100644
--- a/linux-x64/clang/include/lldb/Core/Section.h
+++ b/linux-x64/clang/include/lldb/Core/Section.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Section_h_
-#define liblldb_Section_h_
+#ifndef LLDB_CORE_SECTION_H
+#define LLDB_CORE_SECTION_H
#include "lldb/Core/ModuleChild.h"
#include "lldb/Utility/ConstString.h"
@@ -29,7 +29,6 @@
class DataExtractor;
class ObjectFile;
class Section;
-class Stream;
class Target;
class SectionList {
@@ -38,9 +37,13 @@
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
- SectionList();
+ const_iterator begin() const { return m_sections.begin(); }
+ const_iterator end() const { return m_sections.end(); }
+ const_iterator begin() { return m_sections.begin(); }
+ const_iterator end() { return m_sections.end(); }
- ~SectionList();
+ /// Create an empty list.
+ SectionList() = default;
SectionList &operator=(const SectionList &rhs);
@@ -52,7 +55,8 @@
bool ContainsSection(lldb::user_id_t sect_id) const;
- void Dump(Stream *s, Target *target, bool show_header, uint32_t depth) const;
+ void Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
+ bool show_header, uint32_t depth) const;
lldb::SectionSP FindSectionByName(ConstString section_dstr) const;
@@ -123,9 +127,10 @@
const SectionList &GetChildren() const { return m_children; }
- void Dump(Stream *s, Target *target, uint32_t depth) const;
+ void Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
+ uint32_t depth) const;
- void DumpName(Stream *s) const;
+ void DumpName(llvm::raw_ostream &s) const;
lldb::addr_t GetLoadBaseAddress(Target *target) const;
@@ -263,9 +268,10 @@
// This is specified as
// as a multiple number of a host bytes
private:
- DISALLOW_COPY_AND_ASSIGN(Section);
+ Section(const Section &) = delete;
+ const Section &operator=(const Section &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Section_h_
+#endif // LLDB_CORE_SECTION_H
diff --git a/linux-x64/clang/include/lldb/Core/SourceManager.h b/linux-x64/clang/include/lldb/Core/SourceManager.h
index bca8177..7549c30 100644
--- a/linux-x64/clang/include/lldb/Core/SourceManager.h
+++ b/linux-x64/clang/include/lldb/Core/SourceManager.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SourceManager_h_
-#define liblldb_SourceManager_h_
+#ifndef LLDB_CORE_SOURCEMANAGER_H
+#define LLDB_CORE_SOURCEMANAGER_H
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-defines.h"
@@ -54,8 +54,6 @@
bool LineIsValid(uint32_t line);
- bool FileSpecMatches(const FileSpec &file_spec);
-
const FileSpec &GetFileSpec() { return m_file_spec; }
uint32_t GetSourceMapModificationID() const { return m_source_map_mod_id; }
@@ -103,6 +101,9 @@
void AddSourceFile(const FileSP &file_sp);
FileSP FindSourceFile(const FileSpec &file_spec) const;
+ // Removes all elements from the cache.
+ void Clear() { m_file_cache.clear(); }
+
protected:
typedef std::map<FileSpec, FileSP> FileCache;
FileCache m_file_cache;
@@ -118,7 +119,7 @@
~SourceManager();
- FileSP GetLastFile() { return m_last_file_sp; }
+ FileSP GetLastFile() { return GetFile(m_last_file_spec); }
size_t
DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line,
@@ -140,7 +141,9 @@
bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line);
- bool DefaultFileAndLineSet() { return (m_last_file_sp.get() != nullptr); }
+ bool DefaultFileAndLineSet() {
+ return (GetFile(m_last_file_spec).get() != nullptr);
+ }
void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex,
uint32_t start_line, uint32_t end_line,
@@ -149,7 +152,7 @@
FileSP GetFile(const FileSpec &file_spec);
protected:
- FileSP m_last_file_sp;
+ FileSpec m_last_file_spec;
uint32_t m_last_line;
uint32_t m_last_count;
bool m_default_set;
@@ -157,11 +160,12 @@
lldb::DebuggerWP m_debugger_wp;
private:
- DISALLOW_COPY_AND_ASSIGN(SourceManager);
+ SourceManager(const SourceManager &) = delete;
+ const SourceManager &operator=(const SourceManager &) = delete;
};
bool operator==(const SourceManager::File &lhs, const SourceManager::File &rhs);
} // namespace lldb_private
-#endif // liblldb_SourceManager_h_
+#endif // LLDB_CORE_SOURCEMANAGER_H
diff --git a/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h b/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h
index 6237e12..949a798 100644
--- a/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h
+++ b/linux-x64/clang/include/lldb/Core/StreamAsynchronousIO.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamAsynchronousIO_h_
-#define liblldb_StreamAsynchronousIO_h_
+#ifndef LLDB_CORE_STREAMASYNCHRONOUSIO_H
+#define LLDB_CORE_STREAMASYNCHRONOUSIO_H
#include "lldb/Utility/Stream.h"
@@ -37,4 +37,4 @@
} // namespace lldb_private
-#endif // liblldb_StreamAsynchronousIO_h
+#endif // LLDB_CORE_STREAMASYNCHRONOUSIO_H
diff --git a/linux-x64/clang/include/lldb/Core/StreamBuffer.h b/linux-x64/clang/include/lldb/Core/StreamBuffer.h
index 6c51651..9c48ddb 100644
--- a/linux-x64/clang/include/lldb/Core/StreamBuffer.h
+++ b/linux-x64/clang/include/lldb/Core/StreamBuffer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamBuffer_h_
-#define liblldb_StreamBuffer_h_
+#ifndef LLDB_CORE_STREAMBUFFER_H
+#define LLDB_CORE_STREAMBUFFER_H
#include "lldb/Utility/Stream.h"
#include "llvm/ADT/SmallVector.h"
@@ -51,4 +51,4 @@
} // namespace lldb_private
-#endif // #ifndef liblldb_StreamBuffer_h_
+#endif // LLDB_CORE_STREAMBUFFER_H
diff --git a/linux-x64/clang/include/lldb/Core/StreamFile.h b/linux-x64/clang/include/lldb/Core/StreamFile.h
index 54aeab1..e71e31e 100644
--- a/linux-x64/clang/include/lldb/Core/StreamFile.h
+++ b/linux-x64/clang/include/lldb/Core/StreamFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamFile_h_
-#define liblldb_StreamFile_h_
+#ifndef LLDB_CORE_STREAMFILE_H
+#define LLDB_CORE_STREAMFILE_H
#include "lldb/Host/File.h"
#include "lldb/Utility/Stream.h"
@@ -21,38 +21,37 @@
class StreamFile : public Stream {
public:
- // Constructors and Destructors
- StreamFile();
-
StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
StreamFile(int fd, bool transfer_ownership);
- StreamFile(const char *path);
-
- StreamFile(const char *path, uint32_t options,
+ StreamFile(const char *path, File::OpenOptions options,
uint32_t permissions = lldb::eFilePermissionsFileDefault);
StreamFile(FILE *fh, bool transfer_ownership);
+ StreamFile(std::shared_ptr<File> file) : m_file_sp(file) { assert(file); };
+
~StreamFile() override;
- File &GetFile() { return m_file; }
+ File &GetFile() { return *m_file_sp; }
- const File &GetFile() const { return m_file; }
+ const File &GetFile() const { return *m_file_sp; }
+
+ std::shared_ptr<File> GetFileSP() { return m_file_sp; }
void Flush() override;
-
protected:
// Classes that inherit from StreamFile can see and modify these
- File m_file;
+ std::shared_ptr<File> m_file_sp; // never NULL
size_t WriteImpl(const void *s, size_t length) override;
private:
- DISALLOW_COPY_AND_ASSIGN(StreamFile);
+ StreamFile(const StreamFile &) = delete;
+ const StreamFile &operator=(const StreamFile &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_StreamFile_h_
+#endif // LLDB_CORE_STREAMFILE_H
diff --git a/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h b/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h
index 79a709a..929ce21 100644
--- a/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h
+++ b/linux-x64/clang/include/lldb/Core/StructuredDataImpl.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StructuredDataImpl_h_
-#define liblldb_StructuredDataImpl_h_
+#ifndef LLDB_CORE_STRUCTUREDDATAIMPL_H
+#define LLDB_CORE_STRUCTUREDDATAIMPL_H
#include "lldb/Target/StructuredDataPlugin.h"
#include "lldb/Utility/Event.h"
@@ -54,7 +54,8 @@
return error;
}
- m_data_sp->Dump(stream);
+ llvm::json::OStream s(stream.AsRawOstream());
+ m_data_sp->Serialize(s);
return error;
}
@@ -67,14 +68,18 @@
return error;
}
- // Grab the plugin.
- auto plugin_sp = lldb::StructuredDataPluginSP(m_plugin_wp);
+ // Grab the plugin
+ lldb::StructuredDataPluginSP plugin_sp = m_plugin_wp.lock();
+
+ // If there's no plugin, call underlying data's dump method:
if (!plugin_sp) {
- error.SetErrorString("Cannot pretty print structured data: "
- "plugin doesn't exist.");
+ if (!m_data_sp) {
+ error.SetErrorString("No data to describe.");
+ return error;
+ }
+ m_data_sp->Dump(stream, true);
return error;
}
-
// Get the data's description.
return plugin_sp->GetDescription(m_data_sp, stream);
}
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h
index c485b91..2f6eb28 100644
--- a/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeDenseMap.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadSafeDenseMap_h_
-#define liblldb_ThreadSafeDenseMap_h_
+#ifndef LLDB_CORE_THREADSAFEDENSEMAP_H
+#define LLDB_CORE_THREADSAFEDENSEMAP_H
#include <mutex>
@@ -62,4 +62,4 @@
} // namespace lldb_private
-#endif // liblldb_ThreadSafeSTLMap_h_
+#endif // LLDB_CORE_THREADSAFEDENSEMAP_H
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h
deleted file mode 100644
index df0208c..0000000
--- a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLMap.h
+++ /dev/null
@@ -1,128 +0,0 @@
-//===-- ThreadSafeSTLMap.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ThreadSafeSTLMap_h_
-#define liblldb_ThreadSafeSTLMap_h_
-
-#include <map>
-#include <mutex>
-
-#include "lldb/lldb-defines.h"
-
-namespace lldb_private {
-
-template <typename _Key, typename _Tp> class ThreadSafeSTLMap {
-public:
- typedef std::map<_Key, _Tp> collection;
- typedef typename collection::iterator iterator;
- typedef typename collection::const_iterator const_iterator;
- // Constructors and Destructors
- ThreadSafeSTLMap() : m_collection(), m_mutex() {}
-
- ~ThreadSafeSTLMap() {}
-
- bool IsEmpty() const {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.empty();
- }
-
- void Clear() {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.clear();
- }
-
- size_t Erase(const _Key &key) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return EraseNoLock(key);
- }
-
- size_t EraseNoLock(const _Key &key) { return m_collection.erase(key); }
-
- bool GetValueForKey(const _Key &key, _Tp &value) const {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return GetValueForKeyNoLock(key, value);
- }
-
- // Call this if you have already manually locked the mutex using the
- // GetMutex() accessor
- bool GetValueForKeyNoLock(const _Key &key, _Tp &value) const {
- const_iterator pos = m_collection.find(key);
- if (pos != m_collection.end()) {
- value = pos->second;
- return true;
- }
- return false;
- }
-
- bool GetFirstKeyForValue(const _Tp &value, _Key &key) const {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return GetFirstKeyForValueNoLock(value, key);
- }
-
- bool GetFirstKeyForValueNoLock(const _Tp &value, _Key &key) const {
- const_iterator pos, end = m_collection.end();
- for (pos = m_collection.begin(); pos != end; ++pos) {
- if (pos->second == value) {
- key = pos->first;
- return true;
- }
- }
- return false;
- }
-
- bool LowerBound(const _Key &key, _Key &match_key, _Tp &match_value,
- bool decrement_if_not_equal) const {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return LowerBoundNoLock(key, match_key, match_value,
- decrement_if_not_equal);
- }
-
- bool LowerBoundNoLock(const _Key &key, _Key &match_key, _Tp &match_value,
- bool decrement_if_not_equal) const {
- const_iterator pos = m_collection.lower_bound(key);
- if (pos != m_collection.end()) {
- match_key = pos->first;
- if (decrement_if_not_equal && key != match_key &&
- pos != m_collection.begin()) {
- --pos;
- match_key = pos->first;
- }
- match_value = pos->second;
- return true;
- }
- return false;
- }
-
- iterator lower_bound_unsafe(const _Key &key) {
- return m_collection.lower_bound(key);
- }
-
- void SetValueForKey(const _Key &key, const _Tp &value) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- SetValueForKeyNoLock(key, value);
- }
-
- // Call this if you have already manually locked the mutex using the
- // GetMutex() accessor
- void SetValueForKeyNoLock(const _Key &key, const _Tp &value) {
- m_collection[key] = value;
- }
-
- std::recursive_mutex &GetMutex() { return m_mutex; }
-
-private:
- collection m_collection;
- mutable std::recursive_mutex m_mutex;
-
- // For ThreadSafeSTLMap only
- DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ThreadSafeSTLMap_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h b/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h
deleted file mode 100644
index e1666a6..0000000
--- a/linux-x64/clang/include/lldb/Core/ThreadSafeSTLVector.h
+++ /dev/null
@@ -1,72 +0,0 @@
-//===-- ThreadSafeSTLVector.h ------------------------------------*- C++
-//-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ThreadSafeSTLVector_h_
-#define liblldb_ThreadSafeSTLVector_h_
-
-#include <mutex>
-#include <vector>
-
-#include "lldb/lldb-defines.h"
-
-namespace lldb_private {
-
-template <typename _Object> class ThreadSafeSTLVector {
-public:
- typedef std::vector<_Object> collection;
- typedef typename collection::iterator iterator;
- typedef typename collection::const_iterator const_iterator;
- // Constructors and Destructors
- ThreadSafeSTLVector() : m_collection(), m_mutex() {}
-
- ~ThreadSafeSTLVector() = default;
-
- bool IsEmpty() const {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.empty();
- }
-
- void Clear() {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.clear();
- }
-
- size_t GetCount() {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.size();
- }
-
- void AppendObject(_Object &object) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- m_collection.push_back(object);
- }
-
- _Object GetObject(size_t index) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- return m_collection.at(index);
- }
-
- void SetObject(size_t index, const _Object &object) {
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
- m_collection.at(index) = object;
- }
-
- std::recursive_mutex &GetMutex() { return m_mutex; }
-
-private:
- collection m_collection;
- mutable std::recursive_mutex m_mutex;
-
- // For ThreadSafeSTLVector only
- DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ThreadSafeSTLVector_h_
diff --git a/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h b/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h
index 91f9681..38b8034 100644
--- a/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h
+++ b/linux-x64/clang/include/lldb/Core/ThreadSafeValue.h
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadSafeValue_h_
-#define liblldb_ThreadSafeValue_h_
-
+#ifndef LLDB_CORE_THREADSAFEVALUE_H
+#define LLDB_CORE_THREADSAFEVALUE_H
#include <mutex>
@@ -54,8 +53,9 @@
mutable std::recursive_mutex m_mutex;
// For ThreadSafeValue only
- DISALLOW_COPY_AND_ASSIGN(ThreadSafeValue);
+ ThreadSafeValue(const ThreadSafeValue &) = delete;
+ const ThreadSafeValue &operator=(const ThreadSafeValue &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadSafeValue_h_
+#endif // LLDB_CORE_THREADSAFEVALUE_H
diff --git a/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h b/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h
index 9949bd4..e37027a 100644
--- a/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h
+++ b/linux-x64/clang/include/lldb/Core/UniqueCStringMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UniqueCStringMap_h_
-#define liblldb_UniqueCStringMap_h_
+#ifndef LLDB_CORE_UNIQUECSTRINGMAP_H
+#define LLDB_CORE_UNIQUECSTRINGMAP_H
#include <algorithm>
#include <vector>
@@ -32,6 +32,10 @@
T value;
};
+ typedef std::vector<Entry> collection;
+ typedef typename collection::iterator iterator;
+ typedef typename collection::const_iterator const_iterator;
+
// Call this function multiple times to add a bunch of entries to this map,
// then later call UniqueCStringMap<T>::Sort() before doing any searches by
// name.
@@ -175,6 +179,18 @@
}
}
+ iterator begin() { return m_map.begin(); }
+ iterator end() { return m_map.end(); }
+ const_iterator begin() const { return m_map.begin(); }
+ const_iterator end() const { return m_map.end(); }
+
+ // Range-based for loop for all entries of the specified ConstString name.
+ llvm::iterator_range<const_iterator>
+ equal_range(ConstString unique_cstr) const {
+ return llvm::make_range(
+ std::equal_range(m_map.begin(), m_map.end(), unique_cstr, Compare()));
+ };
+
protected:
struct Compare {
bool operator()(const Entry &lhs, const Entry &rhs) {
@@ -196,12 +212,9 @@
return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
}
};
- typedef std::vector<Entry> collection;
- typedef typename collection::iterator iterator;
- typedef typename collection::const_iterator const_iterator;
collection m_map;
};
} // namespace lldb_private
-#endif // liblldb_UniqueCStringMap_h_
+#endif // LLDB_CORE_UNIQUECSTRINGMAP_H
diff --git a/linux-x64/clang/include/lldb/Core/UserSettingsController.h b/linux-x64/clang/include/lldb/Core/UserSettingsController.h
index 6ae3bde..f40ad54 100644
--- a/linux-x64/clang/include/lldb/Core/UserSettingsController.h
+++ b/linux-x64/clang/include/lldb/Core/UserSettingsController.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UserSettingsController_h_
-#define liblldb_UserSettingsController_h_
+#ifndef LLDB_CORE_USERSETTINGSCONTROLLER_H
+#define LLDB_CORE_USERSETTINGSCONTROLLER_H
#include "lldb/Utility/Status.h"
#include "lldb/lldb-forward.h"
@@ -88,4 +88,4 @@
} // namespace lldb_private
-#endif // liblldb_UserSettingsController_h_
+#endif // LLDB_CORE_USERSETTINGSCONTROLLER_H
diff --git a/linux-x64/clang/include/lldb/Core/Value.h b/linux-x64/clang/include/lldb/Core/Value.h
index b786e48..0ff773e 100644
--- a/linux-x64/clang/include/lldb/Core/Value.h
+++ b/linux-x64/clang/include/lldb/Core/Value.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Value_h_
-#define liblldb_Value_h_
+#ifndef LLDB_CORE_VALUE_H
+#define LLDB_CORE_VALUE_H
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -43,8 +43,6 @@
// m_value contains...
// ============================
eValueTypeScalar, // raw scalar value
- eValueTypeVector, // byte array of m_vector.length with endianness of
- // m_vector.byte_order
eValueTypeFileAddress, // file address value
eValueTypeLoadAddress, // load address value
eValueTypeHostAddress // host address value (for memory in the process that
@@ -62,66 +60,8 @@
eContextTypeVariable // lldb_private::Variable *
};
- const static size_t kMaxByteSize = 32u;
-
- struct Vector {
- // The byte array must be big enough to hold vector registers for any
- // supported target.
- uint8_t bytes[kMaxByteSize];
- size_t length;
- lldb::ByteOrder byte_order;
-
- Vector() : length(0), byte_order(lldb::eByteOrderInvalid) {}
-
- Vector(const Vector &vector) { *this = vector; }
- const Vector &operator=(const Vector &vector) {
- SetBytes(vector.bytes, vector.length, vector.byte_order);
- return *this;
- }
-
- void Clear() { length = 0; }
-
- bool SetBytes(const void *bytes, size_t length,
- lldb::ByteOrder byte_order) {
- this->length = length;
- this->byte_order = byte_order;
- if (length)
- ::memcpy(this->bytes, bytes,
- length < kMaxByteSize ? length : kMaxByteSize);
- return IsValid();
- }
-
- bool IsValid() const {
- return (length > 0 && length < kMaxByteSize &&
- byte_order != lldb::eByteOrderInvalid);
- }
- // Casts a vector, if valid, to an unsigned int of matching or largest
- // supported size. Truncates to the beginning of the vector if required.
- // Returns a default constructed Scalar if the Vector data is internally
- // inconsistent.
- llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
- ((type128 *)bytes)->x);
- Scalar GetAsScalar() const {
- Scalar scalar;
- if (IsValid()) {
- if (length == 1)
- scalar = *(const uint8_t *)bytes;
- else if (length == 2)
- scalar = *(const uint16_t *)bytes;
- else if (length == 4)
- scalar = *(const uint32_t *)bytes;
- else if (length == 8)
- scalar = *(const uint64_t *)bytes;
- else if (length >= 16)
- scalar = rhs;
- }
- return scalar;
- }
- };
-
Value();
Value(const Scalar &scalar);
- Value(const Vector &vector);
Value(const void *bytes, int len);
Value(const Value &rhs);
@@ -153,8 +93,7 @@
m_context = p;
if (m_context_type == eContextTypeRegisterInfo) {
RegisterInfo *reg_info = GetRegisterInfo();
- if (reg_info->encoding == lldb::eEncodingVector &&
- m_vector.byte_order != lldb::eByteOrderInvalid)
+ if (reg_info->encoding == lldb::eEncodingVector)
SetValueType(eValueTypeScalar);
}
}
@@ -167,30 +106,8 @@
const Scalar &GetScalar() const { return m_value; }
- const Vector &GetVector() const { return m_vector; }
-
Scalar &GetScalar() { return m_value; }
- Vector &GetVector() { return m_vector; }
-
- bool SetVectorBytes(const Vector &vector) {
- m_vector = vector;
- return m_vector.IsValid();
- }
-
- bool SetVectorBytes(uint8_t *bytes, size_t length,
- lldb::ByteOrder byte_order) {
- return m_vector.SetBytes(bytes, length, byte_order);
- }
-
- bool SetScalarFromVector() {
- if (m_vector.IsValid()) {
- m_value = m_vector.GetAsScalar();
- return true;
- }
- return false;
- }
-
size_t ResizeData(size_t len);
size_t AppendDataToHostBuffer(const Value &rhs);
@@ -210,7 +127,6 @@
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
- uint32_t data_offset,
Module *module); // Can be nullptr
static const char *GetValueTypeAsCString(ValueType context_type);
@@ -226,7 +142,6 @@
protected:
Scalar m_value;
- Vector m_vector;
CompilerType m_compiler_type;
void *m_context;
ValueType m_value_type;
@@ -259,4 +174,4 @@
} // namespace lldb_private
-#endif // liblldb_Value_h_
+#endif // LLDB_CORE_VALUE_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObject.h b/linux-x64/clang/include/lldb/Core/ValueObject.h
index 0808b86..a665e7a 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObject.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObject.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObject_h_
-#define liblldb_ValueObject_h_
+#ifndef LLDB_CORE_VALUEOBJECT_H
+#define LLDB_CORE_VALUEOBJECT_H
#include "lldb/Core/Value.h"
#include "lldb/Symbol/CompilerType.h"
@@ -179,7 +179,6 @@
eClearUserVisibleDataItemsLocation = 1u << 3,
eClearUserVisibleDataItemsDescription = 1u << 4,
eClearUserVisibleDataItemsSyntheticChildren = 1u << 5,
- eClearUserVisibleDataItemsValidator = 1u << 6,
eClearUserVisibleDataItemsAllStrings =
eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary |
eClearUserVisibleDataItemsLocation |
@@ -359,7 +358,7 @@
virtual bool CanProvideValue();
// Subclasses must implement the functions below.
- virtual uint64_t GetByteSize() = 0;
+ virtual llvm::Optional<uint64_t> GetByteSize() = 0;
virtual lldb::ValueType GetValueType() const = 0;
@@ -397,10 +396,8 @@
bool IsIntegerType(bool &is_signed);
- virtual bool GetBaseClassPath(Stream &s);
-
virtual void GetExpressionPath(
- Stream &s, bool qualify_cxx_base_classes,
+ Stream &s,
GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);
lldb::ValueObjectSP GetValueForExpressionPath(
@@ -510,8 +507,6 @@
std::string &destination,
const TypeSummaryOptions &options);
- std::pair<TypeValidatorResult, std::string> GetValidationStatus();
-
const char *GetObjectDescription();
bool HasSpecialPrintableRepresentation(
@@ -580,7 +575,7 @@
virtual lldb::ValueObjectSP GetNonSyntheticValue();
- lldb::ValueObjectSP GetSyntheticValue(bool use_synthetic = true);
+ lldb::ValueObjectSP GetSyntheticValue();
virtual bool HasSyntheticValue();
@@ -707,22 +702,12 @@
}
void SetSummaryFormat(lldb::TypeSummaryImplSP format) {
- m_type_summary_sp = format;
+ m_type_summary_sp = std::move(format);
ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
}
- lldb::TypeValidatorImplSP GetValidator() {
- UpdateFormatsIfNeeded();
- return m_type_validator_sp;
- }
-
- void SetValidator(lldb::TypeValidatorImplSP format) {
- m_type_validator_sp = format;
- ClearUserVisibleData(eClearUserVisibleDataItemsValidator);
- }
-
void SetValueFormat(lldb::TypeFormatImplSP format) {
- m_type_format_sp = format;
+ m_type_format_sp = std::move(format);
ClearUserVisibleData(eClearUserVisibleDataItemsValue);
}
@@ -857,9 +842,6 @@
// differs from the summary
// in that the summary is consed up by us, the object_desc_string is builtin.
- llvm::Optional<std::pair<TypeValidatorResult, std::string>>
- m_validation_result;
-
CompilerType m_override_type; // If the type of the value object should be
// overridden, the type to impose.
@@ -888,7 +870,6 @@
lldb::TypeSummaryImplSP m_type_summary_sp;
lldb::TypeFormatImplSP m_type_format_sp;
lldb::SyntheticChildrenSP m_synthetic_children_sp;
- lldb::TypeValidatorImplSP m_type_validator_sp;
ProcessModID m_user_id_of_forced_summary;
AddressType m_address_type_of_ptr_or_ref_children;
@@ -906,7 +887,6 @@
m_is_synthetic_children_generated : 1;
friend class ValueObjectChild;
- friend class ClangExpressionDeclMap; // For GetValue
friend class ExpressionVariable; // For SetName
friend class Target; // For SetName
friend class ValueObjectConstResultImpl;
@@ -922,7 +902,7 @@
// Use this constructor to create a "root variable object". The ValueObject
// will be locked to this context through-out its lifespan.
- ValueObject(ExecutionContextScope *exe_scope,
+ ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager,
AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
// Use this constructor to create a ValueObject owned by another ValueObject.
@@ -946,7 +926,7 @@
virtual bool HasDynamicValueTypeInfo() { return false; }
- virtual void CalculateSyntheticValue(bool use_synthetic = true);
+ virtual void CalculateSyntheticValue();
// Should only be called by ValueObject::GetChildAtIndex() Returns a
// ValueObject managed by this ValueObject's manager.
@@ -983,8 +963,14 @@
void SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType);
+protected:
+ virtual void DoUpdateChildrenAddressType(ValueObject &valobj) { return; };
+
private:
virtual CompilerType MaybeCalculateCompleteType();
+ void UpdateChildrenAddressType() {
+ GetRoot()->DoUpdateChildrenAddressType(*this);
+ }
lldb::ValueObjectSP GetValueForExpressionPath_Impl(
llvm::StringRef expression_cstr,
@@ -993,7 +979,8 @@
const GetValueForExpressionPathOptions &options,
ExpressionPathAftermath *final_task_on_target);
- DISALLOW_COPY_AND_ASSIGN(ValueObject);
+ ValueObject(const ValueObject &) = delete;
+ const ValueObject &operator=(const ValueObject &) = delete;
};
// A value object manager class that is seeded with the static variable value
@@ -1039,4 +1026,4 @@
} // namespace lldb_private
-#endif // liblldb_ValueObject_h_
+#endif // LLDB_CORE_VALUEOBJECT_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectCast.h b/linux-x64/clang/include/lldb/Core/ValueObjectCast.h
index feee493..342803f 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectCast.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectCast.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectCast_h_
-#define liblldb_ValueObjectCast_h_
+#ifndef LLDB_CORE_VALUEOBJECTCAST_H
+#define LLDB_CORE_VALUEOBJECTCAST_H
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
@@ -30,7 +30,7 @@
ConstString name,
const CompilerType &cast_type);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
size_t CalculateNumChildren(uint32_t max) override;
@@ -57,9 +57,10 @@
CompilerType m_cast_type;
private:
- DISALLOW_COPY_AND_ASSIGN(ValueObjectCast);
+ ValueObjectCast(const ValueObjectCast &) = delete;
+ const ValueObjectCast &operator=(const ValueObjectCast &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectCast_h_
+#endif // LLDB_CORE_VALUEOBJECTCAST_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectChild.h b/linux-x64/clang/include/lldb/Core/ValueObjectChild.h
index 76209a2..9a9fd92 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectChild.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectChild.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectChild_h_
-#define liblldb_ValueObjectChild_h_
+#ifndef LLDB_CORE_VALUEOBJECTCHILD_H
+#define LLDB_CORE_VALUEOBJECTCHILD_H
#include "lldb/Core/ValueObject.h"
@@ -30,7 +30,7 @@
public:
~ValueObjectChild() override;
- uint64_t GetByteSize() override { return m_byte_size; }
+ llvm::Optional<uint64_t> GetByteSize() override { return m_byte_size; }
lldb::offset_t GetByteOffset() override { return m_byte_offset; }
@@ -75,7 +75,6 @@
// void
// ReadValueFromMemory (ValueObject* parent, lldb::addr_t address);
-protected:
friend class ValueObject;
friend class ValueObjectConstResult;
friend class ValueObjectConstResultImpl;
@@ -88,9 +87,10 @@
AddressType child_ptr_or_ref_addr_type,
uint64_t language_flags);
- DISALLOW_COPY_AND_ASSIGN(ValueObjectChild);
+ ValueObjectChild(const ValueObjectChild &) = delete;
+ const ValueObjectChild &operator=(const ValueObjectChild &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectChild_h_
+#endif // LLDB_CORE_VALUEOBJECTCHILD_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h
index 3bc957e..8d823ba 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResult.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectConstResult_h_
-#define liblldb_ValueObjectConstResult_h_
+#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULT_H
+#define LLDB_CORE_VALUEOBJECTCONSTRESULT_H
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
@@ -62,7 +62,7 @@
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
const Status &error);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override;
@@ -113,7 +113,7 @@
CompilerType GetCompilerTypeImpl() override;
ConstString m_type_name;
- uint64_t m_byte_size;
+ llvm::Optional<uint64_t> m_byte_size;
ValueObjectConstResultImpl m_impl;
@@ -121,34 +121,40 @@
friend class ValueObjectConstResultImpl;
ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager,
lldb::ByteOrder byte_order, uint32_t addr_byte_size,
lldb::addr_t address);
ValueObjectConstResult(ExecutionContextScope *exe_scope,
- const CompilerType &compiler_type,
- ConstString name, const DataExtractor &data,
- lldb::addr_t address);
+ ValueObjectManager &manager,
+ const CompilerType &compiler_type, ConstString name,
+ const DataExtractor &data, lldb::addr_t address);
ValueObjectConstResult(ExecutionContextScope *exe_scope,
- const CompilerType &compiler_type,
- ConstString name,
+ ValueObjectManager &manager,
+ const CompilerType &compiler_type, ConstString name,
const lldb::DataBufferSP &result_data_sp,
lldb::ByteOrder byte_order, uint32_t addr_size,
lldb::addr_t address);
ValueObjectConstResult(ExecutionContextScope *exe_scope,
- const CompilerType &compiler_type,
- ConstString name, lldb::addr_t address,
- AddressType address_type, uint32_t addr_byte_size);
+ ValueObjectManager &manager,
+ const CompilerType &compiler_type, ConstString name,
+ lldb::addr_t address, AddressType address_type,
+ uint32_t addr_byte_size);
- ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager, const Value &value,
ConstString name, Module *module = nullptr);
- ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error);
+ ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager, const Status &error);
- DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult);
+ ValueObjectConstResult(const ValueObjectConstResult &) = delete;
+ const ValueObjectConstResult &
+ operator=(const ValueObjectConstResult &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResult_h_
+#endif // LLDB_CORE_VALUEOBJECTCONSTRESULT_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h
index be9b12b..ba81785 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultCast.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectConstResultCast_h_
-#define liblldb_ValueObjectConstResultCast_h_
+#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
+#define LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
#include "lldb/Core/ValueObjectCast.h"
#include "lldb/Core/ValueObjectConstResultImpl.h"
@@ -61,9 +61,11 @@
friend class ValueObjectConstResult;
friend class ValueObjectConstResultImpl;
- DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultCast);
+ ValueObjectConstResultCast(const ValueObjectConstResultCast &) = delete;
+ const ValueObjectConstResultCast &
+ operator=(const ValueObjectConstResultCast &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResultCast_h_
+#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h
index 16fa74f..b3606bf 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultChild.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectConstResultChild_h_
-#define liblldb_ValueObjectConstResultChild_h_
+#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
+#define LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
#include "lldb/Core/ValueObjectChild.h"
#include "lldb/Core/ValueObjectConstResultImpl.h"
@@ -70,9 +70,11 @@
friend class ValueObjectConstResult;
friend class ValueObjectConstResultImpl;
- DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultChild);
+ ValueObjectConstResultChild(const ValueObjectConstResultChild &) = delete;
+ const ValueObjectConstResultChild &
+ operator=(const ValueObjectConstResultChild &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResultChild_h_
+#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTCHILD_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h
index ffac98e..1316bf6 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectConstResultImpl.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectConstResultImpl_h_
-#define liblldb_ValueObjectConstResultImpl_h_
+#ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
+#define LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-defines.h"
@@ -71,9 +71,11 @@
lldb::ValueObjectSP m_load_addr_backend;
lldb::ValueObjectSP m_address_of_backend;
- DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResultImpl);
+ ValueObjectConstResultImpl(const ValueObjectConstResultImpl &) = delete;
+ const ValueObjectConstResultImpl &
+ operator=(const ValueObjectConstResultImpl &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectConstResultImpl_h_
+#endif // LLDB_CORE_VALUEOBJECTCONSTRESULTIMPL_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h b/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h
index f656d42..2806857 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectDynamicValue.h
@@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectDynamicValue_h_
-#define liblldb_ValueObjectDynamicValue_h_
+#ifndef LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
+#define LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
#include "lldb/Core/Address.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/SharingPtr.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
@@ -35,7 +34,7 @@
public:
~ValueObjectDynamicValue() override;
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;
@@ -128,9 +127,11 @@
ValueObjectDynamicValue(ValueObject &parent,
lldb::DynamicValueType use_dynamic);
- DISALLOW_COPY_AND_ASSIGN(ValueObjectDynamicValue);
+ ValueObjectDynamicValue(const ValueObjectDynamicValue &) = delete;
+ const ValueObjectDynamicValue &
+ operator=(const ValueObjectDynamicValue &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectDynamicValue_h_
+#endif // LLDB_CORE_VALUEOBJECTDYNAMICVALUE_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectList.h b/linux-x64/clang/include/lldb/Core/ValueObjectList.h
index 42d1967..f99fba4 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectList.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectList_h_
-#define liblldb_ValueObjectList_h_
+#ifndef LLDB_CORE_VALUEOBJECTLIST_H
+#define LLDB_CORE_VALUEOBJECTLIST_H
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
@@ -59,4 +59,4 @@
} // namespace lldb_private
-#endif // liblldb_ValueObjectList_h_
+#endif // LLDB_CORE_VALUEOBJECTLIST_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h b/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h
index df3557f..b5d5e6e 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectMemory.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectMemory_h_
-#define liblldb_ValueObjectMemory_h_
+#ifndef LLDB_CORE_VALUEOBJECTMEMORY_H
+#define LLDB_CORE_VALUEOBJECTMEMORY_H
#include "lldb/Core/Address.h"
#include "lldb/Core/ValueObject.h"
@@ -40,7 +40,7 @@
const Address &address,
const CompilerType &ast_type);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;
@@ -64,15 +64,18 @@
CompilerType m_compiler_type;
private:
- ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
+ ValueObjectMemory(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager, llvm::StringRef name,
const Address &address, lldb::TypeSP &type_sp);
- ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
+ ValueObjectMemory(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager, llvm::StringRef name,
const Address &address, const CompilerType &ast_type);
// For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
+ ValueObjectMemory(const ValueObjectMemory &) = delete;
+ const ValueObjectMemory &operator=(const ValueObjectMemory &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectMemory_h_
+#endif // LLDB_CORE_VALUEOBJECTMEMORY_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h b/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h
index e584be6..3968584 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectRegister.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectRegister_h_
-#define liblldb_ValueObjectRegister_h_
+#ifndef LLDB_CORE_VALUEOBJECTREGISTER_H
+#define LLDB_CORE_VALUEOBJECTREGISTER_H
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
@@ -28,43 +28,6 @@
class Scalar;
class Stream;
-// A ValueObject that contains a root variable that may or may not
-// have children.
-class ValueObjectRegisterContext : public ValueObject {
-public:
- ~ValueObjectRegisterContext() override;
-
- uint64_t GetByteSize() override;
-
- lldb::ValueType GetValueType() const override {
- return lldb::eValueTypeRegisterSet;
- }
-
- ConstString GetTypeName() override;
-
- ConstString GetQualifiedTypeName() override;
-
- ConstString GetDisplayTypeName() override;
-
- size_t CalculateNumChildren(uint32_t max) override;
-
- ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
- int32_t synthetic_index) override;
-
-protected:
- bool UpdateValue() override;
-
- CompilerType GetCompilerTypeImpl() override;
-
- lldb::RegisterContextSP m_reg_ctx_sp;
-
-private:
- ValueObjectRegisterContext(ValueObject &parent,
- lldb::RegisterContextSP ®_ctx_sp);
- // For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
-};
-
class ValueObjectRegisterSet : public ValueObject {
public:
~ValueObjectRegisterSet() override;
@@ -73,7 +36,7 @@
lldb::RegisterContextSP ®_ctx_sp,
uint32_t set_idx);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override {
return lldb::eValueTypeRegisterSet;
@@ -106,10 +69,13 @@
friend class ValueObjectRegisterContext;
ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager,
lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx);
// For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
+ ValueObjectRegisterSet(const ValueObjectRegisterSet &) = delete;
+ const ValueObjectRegisterSet &
+ operator=(const ValueObjectRegisterSet &) = delete;
};
class ValueObjectRegister : public ValueObject {
@@ -120,7 +86,7 @@
lldb::RegisterContextSP ®_ctx_sp,
uint32_t reg_num);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override {
return lldb::eValueTypeRegister;
@@ -137,7 +103,7 @@
bool ResolveValue(Scalar &scalar) override;
void
- GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
+ GetExpressionPath(Stream &s,
GetExpressionPathFormat epformat =
eGetExpressionPathFormatDereferencePointers) override;
@@ -160,12 +126,14 @@
ValueObjectRegister(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp,
uint32_t reg_num);
ValueObjectRegister(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager,
lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num);
// For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
+ ValueObjectRegister(const ValueObjectRegister &) = delete;
+ const ValueObjectRegister &operator=(const ValueObjectRegister &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectRegister_h_
+#endif // LLDB_CORE_VALUEOBJECTREGISTER_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h b/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h
index 3b14a3e..41c461c 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -6,11 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectSyntheticFilter_h_
-#define liblldb_ValueObjectSyntheticFilter_h_
+#ifndef LLDB_CORE_VALUEOBJECTSYNTHETICFILTER_H
+#define LLDB_CORE_VALUEOBJECTSYNTHETICFILTER_H
-#include "lldb/Core/ThreadSafeSTLMap.h"
-#include "lldb/Core/ThreadSafeSTLVector.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
@@ -38,7 +36,7 @@
public:
~ValueObjectSynthetic() override;
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;
@@ -68,7 +66,7 @@
bool IsSynthetic() override { return true; }
- void CalculateSyntheticValue(bool use_synthetic) override {}
+ void CalculateSyntheticValue() override {}
bool IsDynamic() override {
return ((m_parent != nullptr) ? m_parent->IsDynamic() : false);
@@ -135,19 +133,24 @@
lldb::SyntheticChildrenSP m_synth_sp;
std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_up;
- typedef ThreadSafeSTLMap<uint32_t, ValueObject *> ByIndexMap;
- typedef ThreadSafeSTLMap<const char *, uint32_t> NameToIndexMap;
- typedef ThreadSafeSTLVector<lldb::ValueObjectSP> SyntheticChildrenCache;
+ typedef std::map<uint32_t, ValueObject *> ByIndexMap;
+ typedef std::map<const char *, uint32_t> NameToIndexMap;
+ typedef std::vector<lldb::ValueObjectSP> SyntheticChildrenCache;
typedef ByIndexMap::iterator ByIndexIterator;
typedef NameToIndexMap::iterator NameToIndexIterator;
+ std::mutex m_child_mutex;
+ /// Guarded by m_child_mutex;
ByIndexMap m_children_byindex;
+ /// Guarded by m_child_mutex;
NameToIndexMap m_name_toindex;
+ /// Guarded by m_child_mutex;
+ SyntheticChildrenCache m_synthetic_children_cache;
+
uint32_t m_synthetic_children_count; // FIXME use the ValueObject's
// ChildrenManager instead of a special
// purpose solution
- SyntheticChildrenCache m_synthetic_children_cache;
ConstString m_parent_type_name;
@@ -161,9 +164,10 @@
void CopyValueData(ValueObject *source);
- DISALLOW_COPY_AND_ASSIGN(ValueObjectSynthetic);
+ ValueObjectSynthetic(const ValueObjectSynthetic &) = delete;
+ const ValueObjectSynthetic &operator=(const ValueObjectSynthetic &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectSyntheticFilter_h_
+#endif // LLDB_CORE_VALUEOBJECTSYNTHETICFILTER_H
diff --git a/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h b/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h
index 86bb8ef..23fdedb 100644
--- a/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h
+++ b/linux-x64/clang/include/lldb/Core/ValueObjectVariable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ValueObjectVariable_h_
-#define liblldb_ValueObjectVariable_h_
+#ifndef LLDB_CORE_VALUEOBJECTVARIABLE_H
+#define LLDB_CORE_VALUEOBJECTVARIABLE_H
#include "lldb/Core/ValueObject.h"
@@ -37,7 +37,7 @@
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
const lldb::VariableSP &var_sp);
- uint64_t GetByteSize() override;
+ llvm::Optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;
@@ -67,6 +67,8 @@
protected:
bool UpdateValue() override;
+
+ void DoUpdateChildrenAddressType(ValueObject &valobj) override;
CompilerType GetCompilerTypeImpl() override;
@@ -77,11 +79,13 @@
private:
ValueObjectVariable(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager,
const lldb::VariableSP &var_sp);
// For ValueObject only
- DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable);
+ ValueObjectVariable(const ValueObjectVariable &) = delete;
+ const ValueObjectVariable &operator=(const ValueObjectVariable &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ValueObjectVariable_h_
+#endif // LLDB_CORE_VALUEOBJECTVARIABLE_H
diff --git a/linux-x64/clang/include/lldb/Core/dwarf.h b/linux-x64/clang/include/lldb/Core/dwarf.h
index afe62e0..cd9cf24 100644
--- a/linux-x64/clang/include/lldb/Core/dwarf.h
+++ b/linux-x64/clang/include/lldb/Core/dwarf.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef DebugBase_dwarf_h_
-#define DebugBase_dwarf_h_
+#ifndef LLDB_CORE_DWARF_H
+#define LLDB_CORE_DWARF_H
#include "lldb/Utility/RangeMap.h"
#include <stdint.h>
@@ -22,7 +22,7 @@
typedef int32_t dw_sleb128_t;
typedef uint16_t dw_attr_t;
typedef uint16_t dw_form_t;
-typedef uint16_t dw_tag_t;
+typedef llvm::dwarf::Tag dw_tag_t;
typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
// any addresses in the compile units that get
// parsed
@@ -71,6 +71,6 @@
//#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and
//returns an error (no args)
-typedef lldb_private::RangeArray<dw_addr_t, dw_addr_t, 2> DWARFRangeList;
+typedef lldb_private::RangeVector<dw_addr_t, dw_addr_t, 2> DWARFRangeList;
-#endif // DebugBase_dwarf_h_
+#endif // LLDB_CORE_DWARF_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
index b541789..e9742bc 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CXXFunctionPointer_h_
-#define liblldb_CXXFunctionPointer_h_
+#ifndef LLDB_DATAFORMATTERS_CXXFUNCTIONPOINTER_H
+#define LLDB_DATAFORMATTERS_CXXFUNCTIONPOINTER_H
#include "lldb/lldb-forward.h"
@@ -18,4 +18,4 @@
} // namespace formatters
} // namespace lldb_private
-#endif // liblldb_CXXFunctionPointer_h_
+#endif // LLDB_DATAFORMATTERS_CXXFUNCTIONPOINTER_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
index cdb2eab..7be07d6 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_DataVisualization_h_
-#define lldb_DataVisualization_h_
-
+#ifndef LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
+#define LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/FormatManager.h"
@@ -51,12 +50,6 @@
static lldb::SyntheticChildrenSP
GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
- static lldb::TypeValidatorImplSP
- GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
-
- static lldb::TypeValidatorImplSP
- GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
-
static bool
AnyMatches(ConstString type_name,
TypeCategoryImpl::FormatCategoryItems items =
@@ -76,9 +69,9 @@
static void Clear();
- static void
- ForEach(std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
- callback);
+ static void ForEach(std::function<bool(const TypeMatcher &,
+ const lldb::TypeSummaryImplSP &)>
+ callback);
static uint32_t GetCount();
};
@@ -128,4 +121,4 @@
} // namespace lldb_private
-#endif // lldb_DataVisualization_h_
+#endif // LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
index c374115..2f3bdf8 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_DumpValueObjectOptions_h_
-#define lldb_DumpValueObjectOptions_h_
+#ifndef LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
+#define LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
#include <string>
@@ -127,7 +127,6 @@
DumpValueObjectOptions &
SetPointerAsArray(const PointerAsArraySettings &ptr_array);
-public:
uint32_t m_max_depth = UINT32_MAX;
lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
uint32_t m_omit_summary_depth = 0;
@@ -157,4 +156,4 @@
} // namespace lldb_private
-#endif // lldb_DumpValueObjectOptions_h_
+#endif // LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
index 7a6774b..e75aaee 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_FormatCache_h_
-#define lldb_FormatCache_h_
+#ifndef LLDB_DATAFORMATTERS_FORMATCACHE_H
+#define LLDB_DATAFORMATTERS_FORMATCACHE_H
#include <map>
#include <mutex>
@@ -24,77 +24,43 @@
bool m_format_cached : 1;
bool m_summary_cached : 1;
bool m_synthetic_cached : 1;
- bool m_validator_cached : 1;
lldb::TypeFormatImplSP m_format_sp;
lldb::TypeSummaryImplSP m_summary_sp;
lldb::SyntheticChildrenSP m_synthetic_sp;
- lldb::TypeValidatorImplSP m_validator_sp;
public:
Entry();
- Entry(lldb::TypeFormatImplSP);
- Entry(lldb::TypeSummaryImplSP);
- Entry(lldb::SyntheticChildrenSP);
- Entry(lldb::TypeValidatorImplSP);
- Entry(lldb::TypeFormatImplSP, lldb::TypeSummaryImplSP,
- lldb::SyntheticChildrenSP, lldb::TypeValidatorImplSP);
+ template<typename ImplSP> bool IsCached();
bool IsFormatCached();
-
bool IsSummaryCached();
-
bool IsSyntheticCached();
- bool IsValidatorCached();
+ void Get(lldb::TypeFormatImplSP &);
+ void Get(lldb::TypeSummaryImplSP &);
+ void Get(lldb::SyntheticChildrenSP &);
- lldb::TypeFormatImplSP GetFormat();
-
- lldb::TypeSummaryImplSP GetSummary();
-
- lldb::SyntheticChildrenSP GetSynthetic();
-
- lldb::TypeValidatorImplSP GetValidator();
-
- void SetFormat(lldb::TypeFormatImplSP);
-
- void SetSummary(lldb::TypeSummaryImplSP);
-
- void SetSynthetic(lldb::SyntheticChildrenSP);
-
- void SetValidator(lldb::TypeValidatorImplSP);
+ void Set(lldb::TypeFormatImplSP);
+ void Set(lldb::TypeSummaryImplSP);
+ void Set(lldb::SyntheticChildrenSP);
};
typedef std::map<ConstString, Entry> CacheMap;
CacheMap m_map;
std::recursive_mutex m_mutex;
- uint64_t m_cache_hits;
- uint64_t m_cache_misses;
+ uint64_t m_cache_hits = 0;
+ uint64_t m_cache_misses = 0;
Entry &GetEntry(ConstString type);
public:
- FormatCache();
+ FormatCache() = default;
- bool GetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
-
- bool GetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
-
- bool GetSynthetic(ConstString type,
- lldb::SyntheticChildrenSP &synthetic_sp);
-
- bool GetValidator(ConstString type,
- lldb::TypeValidatorImplSP &summary_sp);
-
- void SetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
-
- void SetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
-
- void SetSynthetic(ConstString type,
- lldb::SyntheticChildrenSP &synthetic_sp);
-
- void SetValidator(ConstString type,
- lldb::TypeValidatorImplSP &synthetic_sp);
+ template <typename ImplSP> bool Get(ConstString type, ImplSP &format_impl_sp);
+ void Set(ConstString type, lldb::TypeFormatImplSP &format_sp);
+ void Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
+ void Set(ConstString type, lldb::SyntheticChildrenSP &synthetic_sp);
void Clear();
@@ -102,6 +68,7 @@
uint64_t GetCacheMisses() { return m_cache_misses; }
};
+
} // namespace lldb_private
-#endif // lldb_FormatCache_h_
+#endif // LLDB_DATAFORMATTERS_FORMATCACHE_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
index 5144bc6..e398913 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_FormatClasses_h_
-#define lldb_FormatClasses_h_
+#ifndef LLDB_DATAFORMATTERS_FORMATCLASSES_H
+#define LLDB_DATAFORMATTERS_FORMATCLASSES_H
#include <functional>
#include <memory>
@@ -17,7 +17,6 @@
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
-#include "lldb/DataFormatters/TypeValidator.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
#include "lldb/lldb-enumerations.h"
@@ -40,22 +39,19 @@
typedef HardcodedFormatterFinders<TypeFormatImpl> HardcodedFormatFinder;
typedef HardcodedFormatterFinders<TypeSummaryImpl> HardcodedSummaryFinder;
typedef HardcodedFormatterFinders<SyntheticChildren> HardcodedSyntheticFinder;
- typedef HardcodedFormatterFinders<TypeValidatorImpl> HardcodedValidatorFinder;
};
class FormattersMatchCandidate {
public:
- FormattersMatchCandidate(ConstString name, uint32_t reason, bool strip_ptr,
+ FormattersMatchCandidate(ConstString name, bool strip_ptr,
bool strip_ref, bool strip_tydef)
- : m_type_name(name), m_reason(reason), m_stripped_pointer(strip_ptr),
+ : m_type_name(name), m_stripped_pointer(strip_ptr),
m_stripped_reference(strip_ref), m_stripped_typedef(strip_tydef) {}
~FormattersMatchCandidate() = default;
ConstString GetTypeName() const { return m_type_name; }
- uint32_t GetReason() const { return m_reason; }
-
bool DidStripPointer() const { return m_stripped_pointer; }
bool DidStripReference() const { return m_stripped_reference; }
@@ -77,7 +73,6 @@
private:
ConstString m_type_name;
- uint32_t m_reason;
bool m_stripped_pointer;
bool m_stripped_reference;
bool m_stripped_typedef;
@@ -114,21 +109,21 @@
TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex)
: m_is_regex(is_regex), m_type() {
- m_type.m_type_name = name;
+ m_type.m_type_name = std::string(name);
}
// if constructing with a given type, is_regex cannot be true since we are
// giving an exact type to match
TypeNameSpecifierImpl(lldb::TypeSP type) : m_is_regex(false), m_type() {
if (type) {
- m_type.m_type_name = type->GetName().GetStringRef();
+ m_type.m_type_name = std::string(type->GetName().GetStringRef());
m_type.m_compiler_type = type->GetForwardCompilerType();
}
}
TypeNameSpecifierImpl(CompilerType type) : m_is_regex(false), m_type() {
if (type.IsValid()) {
- m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
+ m_type.m_type_name.assign(type.GetTypeName().GetCString());
m_type.m_compiler_type = type;
}
}
@@ -156,10 +151,11 @@
};
TypeOrName m_type;
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
+ TypeNameSpecifierImpl(const TypeNameSpecifierImpl &) = delete;
+ const TypeNameSpecifierImpl &
+ operator=(const TypeNameSpecifierImpl &) = delete;
};
} // namespace lldb_private
-#endif // lldb_FormatClasses_h_
+#endif // LLDB_DATAFORMATTERS_FORMATCLASSES_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
index afaafda..978ad14 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_FormatManager_h_
-#define lldb_FormatManager_h_
+#ifndef LLDB_DATAFORMATTERS_FORMATMANAGER_H
+#define LLDB_DATAFORMATTERS_FORMATMANAGER_H
#include <atomic>
#include <initializer_list>
@@ -34,7 +34,7 @@
// this file's objects directly
class FormatManager : public IFormatChangeListener {
- typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
+ typedef FormattersContainer<TypeSummaryImpl> NamedSummariesMap;
typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
public:
@@ -52,24 +52,15 @@
void
EnableCategory(ConstString category_name,
TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
- EnableCategory(category_name, pos,
- std::initializer_list<lldb::LanguageType>());
+ EnableCategory(category_name, pos, {});
}
void EnableCategory(ConstString category_name,
TypeCategoryMap::Position pos, lldb::LanguageType lang) {
- std::initializer_list<lldb::LanguageType> langs = {lang};
- EnableCategory(category_name, pos, langs);
- }
-
- void EnableCategory(ConstString category_name,
- TypeCategoryMap::Position pos = TypeCategoryMap::Default,
- std::initializer_list<lldb::LanguageType> langs = {}) {
TypeCategoryMap::ValueSP category_sp;
if (m_categories_map.Get(category_name, category_sp) && category_sp) {
m_categories_map.Enable(category_sp, pos);
- for (const lldb::LanguageType lang : langs)
- category_sp->AddLanguage(lang);
+ category_sp->AddLanguage(lang);
}
}
@@ -127,9 +118,6 @@
lldb::ScriptedSyntheticChildrenSP
GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
- lldb::TypeValidatorImplSP
- GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
-
lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
lldb::DynamicValueType use_dynamic);
@@ -139,9 +127,6 @@
lldb::SyntheticChildrenSP
GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
- lldb::TypeValidatorImplSP GetValidator(ValueObject &valobj,
- lldb::DynamicValueType use_dynamic);
-
bool
AnyMatches(ConstString type_name,
TypeCategoryImpl::FormatCategoryItems items =
@@ -159,13 +144,6 @@
static const char *GetFormatAsCString(lldb::Format format);
- // if the user tries to add formatters for, say, "struct Foo" those will not
- // match any type because of the way we strip qualifiers from typenames this
- // method looks for the case where the user is adding a
- // "class","struct","enum" or "union" Foo and strips the unnecessary
- // qualifier
- static ConstString GetValidTypeName(ConstString type);
-
// when DataExtractor dumps a vectorOfT, it uses a predefined format for each
// item this method returns it, or eFormatInvalid if vector_format is not a
// vectorOf
@@ -185,7 +163,6 @@
GetPossibleMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic) {
FormattersMatchVector matches;
GetPossibleMatches(valobj, valobj.GetCompilerType(),
- lldb_private::eFormatterChoiceCriterionDirectChoice,
use_dynamic, matches, false, false, false, true);
return matches;
}
@@ -198,11 +175,8 @@
GetCandidateLanguages(lldb::LanguageType lang_type);
private:
- static std::vector<lldb::LanguageType>
- GetCandidateLanguages(ValueObject &valobj);
-
static void GetPossibleMatches(ValueObject &valobj,
- CompilerType compiler_type, uint32_t reason,
+ CompilerType compiler_type,
lldb::DynamicValueType use_dynamic,
FormattersMatchVector &entries,
bool did_strip_ptr, bool did_strip_ref,
@@ -220,14 +194,10 @@
ConstString m_system_category_name;
ConstString m_vectortypes_category_name;
- lldb::TypeFormatImplSP GetHardcodedFormat(FormattersMatchData &);
-
- lldb::TypeSummaryImplSP GetHardcodedSummaryFormat(FormattersMatchData &);
-
- lldb::SyntheticChildrenSP
- GetHardcodedSyntheticChildren(FormattersMatchData &);
-
- lldb::TypeValidatorImplSP GetHardcodedValidator(FormattersMatchData &);
+ template <typename ImplSP>
+ ImplSP Get(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+ template <typename ImplSP> ImplSP GetCached(FormattersMatchData &match_data);
+ template <typename ImplSP> ImplSP GetHardcoded(FormattersMatchData &);
TypeCategoryMap &GetCategories() { return m_categories_map; }
@@ -246,4 +216,4 @@
} // namespace lldb_private
-#endif // lldb_FormatManager_h_
+#endif // LLDB_DATAFORMATTERS_FORMATMANAGER_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
index 9d7d373..2f56218 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_FormattersContainer_h_
-#define lldb_FormattersContainer_h_
+#ifndef LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
+#define LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
#include <functional>
#include <map>
@@ -22,7 +22,6 @@
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
-#include "lldb/DataFormatters/TypeValidator.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StringLexer.h"
@@ -38,61 +37,146 @@
virtual uint32_t GetCurrentRevision() = 0;
};
-// if the user tries to add formatters for, say, "struct Foo" those will not
-// match any type because of the way we strip qualifiers from typenames this
-// method looks for the case where the user is adding a "class","struct","enum"
-// or "union" Foo and strips the unnecessary qualifier
-static inline ConstString GetValidTypeName_Impl(ConstString type) {
- if (type.IsEmpty())
- return type;
+/// Class for matching type names.
+class TypeMatcher {
+ RegularExpression m_type_name_regex;
+ ConstString m_type_name;
+ /// False if m_type_name_regex should be used for matching. False if this is
+ /// just matching by comparing with m_type_name string.
+ bool m_is_regex;
- std::string type_cstr(type.AsCString());
- lldb_utility::StringLexer type_lexer(type_cstr);
+ // if the user tries to add formatters for, say, "struct Foo" those will not
+ // match any type because of the way we strip qualifiers from typenames this
+ // method looks for the case where the user is adding a
+ // "class","struct","enum" or "union" Foo and strips the unnecessary qualifier
+ static ConstString StripTypeName(ConstString type) {
+ if (type.IsEmpty())
+ return type;
- type_lexer.AdvanceIf("class ");
- type_lexer.AdvanceIf("enum ");
- type_lexer.AdvanceIf("struct ");
- type_lexer.AdvanceIf("union ");
+ std::string type_cstr(type.AsCString());
+ StringLexer type_lexer(type_cstr);
- while (type_lexer.NextIf({' ', '\t', '\v', '\f'}).first)
- ;
+ type_lexer.AdvanceIf("class ");
+ type_lexer.AdvanceIf("enum ");
+ type_lexer.AdvanceIf("struct ");
+ type_lexer.AdvanceIf("union ");
- return ConstString(type_lexer.GetUnlexed());
-}
+ while (type_lexer.NextIf({' ', '\t', '\v', '\f'}).first)
+ ;
-template <typename KeyType, typename ValueType> class FormattersContainer;
+ return ConstString(type_lexer.GetUnlexed());
+ }
-template <typename KeyType, typename ValueType> class FormatMap {
public:
- typedef typename ValueType::SharedPointer ValueSP;
- typedef std::map<KeyType, ValueSP> MapType;
- typedef typename MapType::iterator MapIterator;
- typedef std::function<bool(KeyType, const ValueSP &)> ForEachCallback;
+ TypeMatcher() = delete;
+ /// Creates a matcher that accepts any type with exactly the given type name.
+ TypeMatcher(ConstString type_name)
+ : m_type_name(type_name), m_is_regex(false) {}
+ /// Creates a matcher that accepts any type matching the given regex.
+ TypeMatcher(RegularExpression regex)
+ : m_type_name_regex(std::move(regex)), m_is_regex(true) {}
- FormatMap(IFormatChangeListener *lst)
- : m_map(), m_map_mutex(), listener(lst) {}
+ /// True iff this matches the given type name.
+ bool Matches(ConstString type_name) const {
+ if (m_is_regex)
+ return m_type_name_regex.Execute(type_name.GetStringRef());
+ return m_type_name == type_name ||
+ StripTypeName(m_type_name) == StripTypeName(type_name);
+ }
- void Add(KeyType name, const ValueSP &entry) {
+ /// Returns the underlying match string for this TypeMatcher.
+ ConstString GetMatchString() const {
+ if (m_is_regex)
+ return ConstString(m_type_name_regex.GetText());
+ return StripTypeName(m_type_name);
+ }
+
+ /// Returns true if this TypeMatcher and the given one were most created by
+ /// the same match string.
+ /// The main purpose of this function is to find existing TypeMatcher
+ /// instances by the user input that created them. This is necessary as LLDB
+ /// allows referencing existing TypeMatchers in commands by the user input
+ /// that originally created them:
+ /// (lldb) type summary add --summary-string \"A\" -x TypeName
+ /// (lldb) type summary delete TypeName
+ bool CreatedBySameMatchString(TypeMatcher other) const {
+ return GetMatchString() == other.GetMatchString();
+ }
+};
+
+template <typename ValueType> class FormattersContainer {
+public:
+ typedef typename std::shared_ptr<ValueType> ValueSP;
+ typedef std::vector<std::pair<TypeMatcher, ValueSP>> MapType;
+ typedef std::function<bool(const TypeMatcher &, const ValueSP &)>
+ ForEachCallback;
+ typedef typename std::shared_ptr<FormattersContainer<ValueType>>
+ SharedPointer;
+
+ friend class TypeCategoryImpl;
+
+ FormattersContainer(IFormatChangeListener *lst) : listener(lst) {}
+
+ void Add(TypeMatcher matcher, const ValueSP &entry) {
if (listener)
entry->GetRevision() = listener->GetCurrentRevision();
else
entry->GetRevision() = 0;
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- m_map[name] = entry;
+ Delete(matcher);
+ m_map.emplace_back(std::move(matcher), std::move(entry));
if (listener)
listener->Changed();
}
- bool Delete(KeyType name) {
+ bool Delete(TypeMatcher matcher) {
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- MapIterator iter = m_map.find(name);
- if (iter == m_map.end())
- return false;
- m_map.erase(name);
- if (listener)
- listener->Changed();
- return true;
+ for (auto iter = m_map.begin(); iter != m_map.end(); ++iter)
+ if (iter->first.CreatedBySameMatchString(matcher)) {
+ m_map.erase(iter);
+ if (listener)
+ listener->Changed();
+ return true;
+ }
+ return false;
+ }
+
+ bool Get(ConstString type, ValueSP &entry) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ for (auto &formatter : llvm::reverse(m_map)) {
+ if (formatter.first.Matches(type)) {
+ entry = formatter.second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetExact(TypeMatcher matcher, ValueSP &entry) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ for (const auto &pos : m_map)
+ if (pos.first.CreatedBySameMatchString(matcher)) {
+ entry = pos.second;
+ return true;
+ }
+ return false;
+ }
+
+ ValueSP GetAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ if (index >= m_map.size())
+ return ValueSP();
+ return m_map[index].second;
+ }
+
+ lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ if (index >= m_map.size())
+ return lldb::TypeNameSpecifierImplSP();
+ TypeMatcher type_matcher = m_map[index].first;
+ return std::make_shared<TypeNameSpecifierImpl>(
+ type_matcher.GetMatchString().GetStringRef(), true);
}
void Clear() {
@@ -102,242 +186,52 @@
listener->Changed();
}
- bool Get(KeyType name, ValueSP &entry) {
- std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- MapIterator iter = m_map.find(name);
- if (iter == m_map.end())
- return false;
- entry = iter->second;
- return true;
- }
-
void ForEach(ForEachCallback callback) {
if (callback) {
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++) {
- KeyType type = pos->first;
- if (!callback(type, pos->second))
+ for (const auto &pos : m_map) {
+ const TypeMatcher &type = pos.first;
+ if (!callback(type, pos.second))
break;
}
}
}
- uint32_t GetCount() { return m_map.size(); }
-
- ValueSP GetValueAtIndex(size_t index) {
+ uint32_t GetCount() {
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- MapIterator iter = m_map.begin();
- MapIterator end = m_map.end();
- while (index > 0) {
- iter++;
- index--;
- if (end == iter)
- return ValueSP();
- }
- return iter->second;
+ return m_map.size();
}
- KeyType GetKeyAtIndex(size_t index) {
- std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
- MapIterator iter = m_map.begin();
- MapIterator end = m_map.end();
- while (index > 0) {
- iter++;
- index--;
- if (end == iter)
- return KeyType();
- }
- return iter->first;
+ void AutoComplete(CompletionRequest &request) {
+ ForEach([&request](const TypeMatcher &matcher, const ValueSP &value) {
+ request.TryCompleteCurrentArg(matcher.GetMatchString().GetStringRef());
+ return true;
+ });
}
protected:
- MapType m_map;
- std::recursive_mutex m_map_mutex;
- IFormatChangeListener *listener;
+ FormattersContainer(const FormattersContainer &) = delete;
+ const FormattersContainer &operator=(const FormattersContainer &) = delete;
- MapType &map() { return m_map; }
-
- std::recursive_mutex &mutex() { return m_map_mutex; }
-
- friend class FormattersContainer<KeyType, ValueType>;
- friend class FormatManager;
-};
-
-template <typename KeyType, typename ValueType> class FormattersContainer {
-protected:
- typedef FormatMap<KeyType, ValueType> BackEndType;
-
-public:
- typedef typename BackEndType::MapType MapType;
- typedef typename MapType::iterator MapIterator;
- typedef typename MapType::key_type MapKeyType;
- typedef typename MapType::mapped_type MapValueType;
- typedef typename BackEndType::ForEachCallback ForEachCallback;
- typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
- SharedPointer;
-
- friend class TypeCategoryImpl;
-
- FormattersContainer(std::string name, IFormatChangeListener *lst)
- : m_format_map(lst), m_name(name) {}
-
- void Add(const MapKeyType &type, const MapValueType &entry) {
- Add_Impl(type, entry, static_cast<KeyType *>(nullptr));
- }
-
- bool Delete(ConstString type) {
- return Delete_Impl(type, static_cast<KeyType *>(nullptr));
- }
-
- bool Get(ValueObject &valobj, MapValueType &entry,
- lldb::DynamicValueType use_dynamic, uint32_t *why = nullptr) {
- uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
- CompilerType ast_type(valobj.GetCompilerType());
- bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
- if (ret)
- entry = MapValueType(entry);
- else
- entry = MapValueType();
- if (why)
- *why = value;
- return ret;
- }
-
- bool Get(ConstString type, MapValueType &entry) {
- return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
- }
-
- bool GetExact(ConstString type, MapValueType &entry) {
- return GetExact_Impl(type, entry, static_cast<KeyType *>(nullptr));
- }
-
- MapValueType GetAtIndex(size_t index) {
- return m_format_map.GetValueAtIndex(index);
- }
-
- lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index) {
- return GetTypeNameSpecifierAtIndex_Impl(index,
- static_cast<KeyType *>(nullptr));
- }
-
- void Clear() { m_format_map.Clear(); }
-
- void ForEach(ForEachCallback callback) { m_format_map.ForEach(callback); }
-
- uint32_t GetCount() { return m_format_map.GetCount(); }
-
-protected:
- BackEndType m_format_map;
- std::string m_name;
-
- DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
-
- void Add_Impl(const MapKeyType &type, const MapValueType &entry,
- lldb::RegularExpressionSP *dummy) {
- m_format_map.Add(type, entry);
- }
-
- void Add_Impl(ConstString type, const MapValueType &entry,
- ConstString *dummy) {
- m_format_map.Add(GetValidTypeName_Impl(type), entry);
- }
-
- bool Delete_Impl(ConstString type, ConstString *dummy) {
- return m_format_map.Delete(type);
- }
-
- bool Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy) {
- std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
- MapIterator pos, end = m_format_map.map().end();
- for (pos = m_format_map.map().begin(); pos != end; pos++) {
- lldb::RegularExpressionSP regex = pos->first;
- if (type.GetStringRef() == regex->GetText()) {
- m_format_map.map().erase(pos);
- if (m_format_map.listener)
- m_format_map.listener->Changed();
- return true;
- }
- }
- return false;
- }
-
- bool Get_Impl(ConstString type, MapValueType &entry, ConstString *dummy) {
- return m_format_map.Get(type, entry);
- }
-
- bool GetExact_Impl(ConstString type, MapValueType &entry,
- ConstString *dummy) {
- return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
- }
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierAtIndex_Impl(size_t index, ConstString *dummy) {
- ConstString key = m_format_map.GetKeyAtIndex(index);
- if (key)
- return lldb::TypeNameSpecifierImplSP(
- new TypeNameSpecifierImpl(key.AsCString(), false));
- else
- return lldb::TypeNameSpecifierImplSP();
- }
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierAtIndex_Impl(size_t index,
- lldb::RegularExpressionSP *dummy) {
- lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
- if (regex.get() == nullptr)
- return lldb::TypeNameSpecifierImplSP();
- return lldb::TypeNameSpecifierImplSP(
- new TypeNameSpecifierImpl(regex->GetText().str().c_str(), true));
- }
-
- bool Get_Impl(ConstString key, MapValueType &value,
- lldb::RegularExpressionSP *dummy) {
- llvm::StringRef key_str = key.GetStringRef();
- std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
- MapIterator pos, end = m_format_map.map().end();
- for (pos = m_format_map.map().begin(); pos != end; pos++) {
- lldb::RegularExpressionSP regex = pos->first;
- if (regex->Execute(key_str)) {
- value = pos->second;
- return true;
- }
- }
- return false;
- }
-
- bool GetExact_Impl(ConstString key, MapValueType &value,
- lldb::RegularExpressionSP *dummy) {
- std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
- MapIterator pos, end = m_format_map.map().end();
- for (pos = m_format_map.map().begin(); pos != end; pos++) {
- lldb::RegularExpressionSP regex = pos->first;
- if (regex->GetText() == key.GetStringRef()) {
- value = pos->second;
- return true;
- }
- }
- return false;
- }
-
- bool Get(const FormattersMatchVector &candidates, MapValueType &entry,
- uint32_t *reason) {
+ bool Get(const FormattersMatchVector &candidates, ValueSP &entry) {
for (const FormattersMatchCandidate &candidate : candidates) {
if (Get(candidate.GetTypeName(), entry)) {
if (candidate.IsMatch(entry) == false) {
entry.reset();
continue;
} else {
- if (reason)
- *reason = candidate.GetReason();
return true;
}
}
}
return false;
}
+
+ MapType m_map;
+ std::recursive_mutex m_map_mutex;
+ IFormatChangeListener *listener;
};
} // namespace lldb_private
-#endif // lldb_FormattersContainer_h_
+#endif // LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
index 79bd376..a5b0da5 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_FormattersHelpers_h_
-#define lldb_FormattersHelpers_h_
+#ifndef LLDB_DATAFORMATTERS_FORMATTERSHELPERS_H
+#define LLDB_DATAFORMATTERS_FORMATTERSHELPERS_H
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
@@ -56,6 +56,8 @@
lldb::addr_t GetArrayAddressOrPointerValue(ValueObject &valobj);
+lldb::ValueObjectSP GetValueOfLibCXXCompressedPair(ValueObject &pair);
+
time_t GetOSXEpoch();
struct InferiorSizedWord {
@@ -184,4 +186,4 @@
} // namespace formatters
} // namespace lldb_private
-#endif // lldb_FormattersHelpers_h_
+#endif // LLDB_DATAFORMATTERS_FORMATTERSHELPERS_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
index f109d46..d767673 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_LanguageCategory_h_
-#define lldb_LanguageCategory_h_
-
+#ifndef LLDB_DATAFORMATTERS_LANGUAGECATEGORY_H
+#define LLDB_DATAFORMATTERS_LANGUAGECATEGORY_H
#include "lldb/DataFormatters/FormatCache.h"
#include "lldb/DataFormatters/FormatClasses.h"
@@ -25,27 +24,11 @@
LanguageCategory(lldb::LanguageType lang_type);
- bool Get(FormattersMatchData &match_data, lldb::TypeFormatImplSP &format_sp);
-
- bool Get(FormattersMatchData &match_data, lldb::TypeSummaryImplSP &format_sp);
-
- bool Get(FormattersMatchData &match_data,
- lldb::SyntheticChildrenSP &format_sp);
-
- bool Get(FormattersMatchData &match_data,
- lldb::TypeValidatorImplSP &format_sp);
-
+ template <typename ImplSP>
+ bool Get(FormattersMatchData &match_data, ImplSP &format_sp);
+ template <typename ImplSP>
bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
- lldb::TypeFormatImplSP &format_sp);
-
- bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
- lldb::TypeSummaryImplSP &format_sp);
-
- bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
- lldb::SyntheticChildrenSP &format_sp);
-
- bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
- lldb::TypeValidatorImplSP &format_sp);
+ ImplSP &format_sp);
lldb::TypeCategoryImplSP GetCategory() const;
@@ -63,7 +46,9 @@
HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
- HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators;
+
+ template <typename ImplSP>
+ auto &GetHardcodedFinder();
lldb_private::FormatCache m_format_cache;
@@ -72,4 +57,4 @@
} // namespace lldb_private
-#endif // lldb_LanguageCategory_h_
+#endif // LLDB_DATAFORMATTERS_LANGUAGECATEGORY_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
index 41d5edd..4a6e2e9 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StringPrinter_h_
-#define liblldb_StringPrinter_h_
+#ifndef LLDB_DATAFORMATTERS_STRINGPRINTER_H
+#define LLDB_DATAFORMATTERS_STRINGPRINTER_H
#include <functional>
#include <string>
@@ -24,309 +24,127 @@
enum class GetPrintableElementType { ASCII, UTF8 };
- class ReadStringAndDumpToStreamOptions {
+ enum class EscapeStyle { CXX, Swift };
+
+ class DumpToStreamOptions {
public:
- ReadStringAndDumpToStreamOptions()
- : m_location(0), m_process_sp(), m_stream(nullptr), m_prefix_token(),
- m_suffix_token(), m_quote('"'), m_source_size(0),
- m_needs_zero_termination(true), m_escape_non_printables(true),
- m_ignore_max_length(false), m_zero_is_terminator(true),
- m_language_type(lldb::eLanguageTypeUnknown) {}
+ DumpToStreamOptions() = default;
- ReadStringAndDumpToStreamOptions(ValueObject &valobj);
-
- ReadStringAndDumpToStreamOptions &SetLocation(uint64_t l) {
- m_location = l;
- return *this;
- }
-
- uint64_t GetLocation() const { return m_location; }
-
- ReadStringAndDumpToStreamOptions &SetProcessSP(lldb::ProcessSP p) {
- m_process_sp = p;
- return *this;
- }
-
- lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
-
- ReadStringAndDumpToStreamOptions &SetStream(Stream *s) {
- m_stream = s;
- return *this;
- }
+ void SetStream(Stream *s) { m_stream = s; }
Stream *GetStream() const { return m_stream; }
- ReadStringAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
- m_prefix_token = p;
- return *this;
- }
+ void SetPrefixToken(const std::string &p) { m_prefix_token = p; }
- ReadStringAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
- m_prefix_token.clear();
- return *this;
- }
+ void SetPrefixToken(std::nullptr_t) { m_prefix_token.clear(); }
const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
- ReadStringAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
- m_suffix_token = p;
- return *this;
- }
+ void SetSuffixToken(const std::string &p) { m_suffix_token = p; }
- ReadStringAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
- m_suffix_token.clear();
- return *this;
- }
+ void SetSuffixToken(std::nullptr_t) { m_suffix_token.clear(); }
const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
- ReadStringAndDumpToStreamOptions &SetQuote(char q) {
- m_quote = q;
- return *this;
- }
+ void SetQuote(char q) { m_quote = q; }
char GetQuote() const { return m_quote; }
- ReadStringAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
- m_source_size = s;
- return *this;
- }
+ void SetSourceSize(uint32_t s) { m_source_size = s; }
uint32_t GetSourceSize() const { return m_source_size; }
- ReadStringAndDumpToStreamOptions &SetNeedsZeroTermination(bool z) {
- m_needs_zero_termination = z;
- return *this;
- }
+ void SetNeedsZeroTermination(bool z) { m_needs_zero_termination = z; }
bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
- ReadStringAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
- m_zero_is_terminator = e;
- return *this;
- }
+ void SetBinaryZeroIsTerminator(bool e) { m_zero_is_terminator = e; }
bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
- ReadStringAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
- m_escape_non_printables = e;
- return *this;
- }
+ void SetEscapeNonPrintables(bool e) { m_escape_non_printables = e; }
bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
- ReadStringAndDumpToStreamOptions &SetIgnoreMaxLength(bool e) {
- m_ignore_max_length = e;
- return *this;
- }
+ void SetIgnoreMaxLength(bool e) { m_ignore_max_length = e; }
bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
- ReadStringAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
- m_language_type = l;
- return *this;
- }
+ void SetEscapeStyle(EscapeStyle style) { m_escape_style = style; }
- lldb::LanguageType GetLanguage() const
-
- {
- return m_language_type;
- }
+ EscapeStyle GetEscapeStyle() const { return m_escape_style; }
private:
- uint64_t m_location;
- lldb::ProcessSP m_process_sp;
- Stream *m_stream;
+ /// The used output stream.
+ Stream *m_stream = nullptr;
+ /// String that should be printed before the heading quote character.
std::string m_prefix_token;
+ /// String that should be printed after the trailing quote character.
std::string m_suffix_token;
- char m_quote;
- uint32_t m_source_size;
- bool m_needs_zero_termination;
- bool m_escape_non_printables;
- bool m_ignore_max_length;
- bool m_zero_is_terminator;
- lldb::LanguageType m_language_type;
+ /// The quote character that should surround the string.
+ char m_quote = '"';
+ /// The length of the memory region that should be dumped in bytes.
+ uint32_t m_source_size = 0;
+ bool m_needs_zero_termination = true;
+ /// True iff non-printable characters should be escaped when dumping
+ /// them to the stream.
+ bool m_escape_non_printables = true;
+ /// True iff the max-string-summary-length setting of the target should
+ /// be ignored.
+ bool m_ignore_max_length = false;
+ /// True iff a zero bytes ('\0') should terminate the memory region that
+ /// is being dumped.
+ bool m_zero_is_terminator = true;
+ /// The language-specific style for escaping special characters.
+ EscapeStyle m_escape_style = EscapeStyle::CXX;
};
- class ReadBufferAndDumpToStreamOptions {
+ class ReadStringAndDumpToStreamOptions : public DumpToStreamOptions {
public:
- ReadBufferAndDumpToStreamOptions()
- : m_data(), m_stream(nullptr), m_prefix_token(), m_suffix_token(),
- m_quote('"'), m_source_size(0), m_escape_non_printables(true),
- m_zero_is_terminator(true), m_is_truncated(false),
- m_language_type(lldb::eLanguageTypeUnknown) {}
+ ReadStringAndDumpToStreamOptions() = default;
+
+ ReadStringAndDumpToStreamOptions(ValueObject &valobj);
+
+ void SetLocation(uint64_t l) { m_location = l; }
+
+ uint64_t GetLocation() const { return m_location; }
+
+ void SetProcessSP(lldb::ProcessSP p) { m_process_sp = std::move(p); }
+
+ lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
+
+ void SetHasSourceSize(bool e) { m_has_source_size = e; }
+
+ bool HasSourceSize() const { return m_has_source_size; }
+
+ private:
+ uint64_t m_location = 0;
+ lldb::ProcessSP m_process_sp;
+ /// True iff we know the source size of the string.
+ bool m_has_source_size = false;
+ };
+
+ class ReadBufferAndDumpToStreamOptions : public DumpToStreamOptions {
+ public:
+ ReadBufferAndDumpToStreamOptions() = default;
ReadBufferAndDumpToStreamOptions(ValueObject &valobj);
ReadBufferAndDumpToStreamOptions(
const ReadStringAndDumpToStreamOptions &options);
- ReadBufferAndDumpToStreamOptions &SetData(DataExtractor d) {
- m_data = d;
- return *this;
- }
+ void SetData(DataExtractor d) { m_data = d; }
lldb_private::DataExtractor GetData() const { return m_data; }
- ReadBufferAndDumpToStreamOptions &SetStream(Stream *s) {
- m_stream = s;
- return *this;
- }
-
- Stream *GetStream() const { return m_stream; }
-
- ReadBufferAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
- m_prefix_token = p;
- return *this;
- }
-
- ReadBufferAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
- m_prefix_token.clear();
- return *this;
- }
-
- const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
-
- ReadBufferAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
- m_suffix_token = p;
- return *this;
- }
-
- ReadBufferAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
- m_suffix_token.clear();
- return *this;
- }
-
- const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
-
- ReadBufferAndDumpToStreamOptions &SetQuote(char q) {
- m_quote = q;
- return *this;
- }
-
- char GetQuote() const { return m_quote; }
-
- ReadBufferAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
- m_source_size = s;
- return *this;
- }
-
- uint32_t GetSourceSize() const { return m_source_size; }
-
- ReadBufferAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
- m_escape_non_printables = e;
- return *this;
- }
-
- bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
-
- ReadBufferAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
- m_zero_is_terminator = e;
- return *this;
- }
-
- bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
-
- ReadBufferAndDumpToStreamOptions &SetIsTruncated(bool t) {
- m_is_truncated = t;
- return *this;
- }
+ void SetIsTruncated(bool t) { m_is_truncated = t; }
bool GetIsTruncated() const { return m_is_truncated; }
-
- ReadBufferAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
- m_language_type = l;
- return *this;
- }
-
- lldb::LanguageType GetLanguage() const
-
- {
- return m_language_type;
- }
-
private:
DataExtractor m_data;
- Stream *m_stream;
- std::string m_prefix_token;
- std::string m_suffix_token;
- char m_quote;
- uint32_t m_source_size;
- bool m_escape_non_printables;
- bool m_zero_is_terminator;
- bool m_is_truncated;
- lldb::LanguageType m_language_type;
+ bool m_is_truncated = false;
};
- // I can't use a std::unique_ptr for this because the Deleter is a template
- // argument there
- // and I want the same type to represent both pointers I want to free and
- // pointers I don't need to free - which is what this class essentially is
- // It's very specialized to the needs of this file, and not suggested for
- // general use
- template <typename T = uint8_t, typename U = char, typename S = size_t>
- struct StringPrinterBufferPointer {
- public:
- typedef std::function<void(const T *)> Deleter;
-
- StringPrinterBufferPointer(std::nullptr_t ptr)
- : m_data(nullptr), m_size(0), m_deleter() {}
-
- StringPrinterBufferPointer(const T *bytes, S size,
- Deleter deleter = nullptr)
- : m_data(bytes), m_size(size), m_deleter(deleter) {}
-
- StringPrinterBufferPointer(const U *bytes, S size,
- Deleter deleter = nullptr)
- : m_data(reinterpret_cast<const T *>(bytes)), m_size(size),
- m_deleter(deleter) {}
-
- StringPrinterBufferPointer(StringPrinterBufferPointer &&rhs)
- : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
- rhs.m_data = nullptr;
- }
-
- StringPrinterBufferPointer(const StringPrinterBufferPointer &rhs)
- : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
- rhs.m_data = nullptr; // this is why m_data has to be mutable
- }
-
- ~StringPrinterBufferPointer() {
- if (m_data && m_deleter)
- m_deleter(m_data);
- m_data = nullptr;
- }
-
- const T *GetBytes() const { return m_data; }
-
- const S GetSize() const { return m_size; }
-
- StringPrinterBufferPointer &
- operator=(const StringPrinterBufferPointer &rhs) {
- if (m_data && m_deleter)
- m_deleter(m_data);
- m_data = rhs.m_data;
- m_size = rhs.m_size;
- m_deleter = rhs.m_deleter;
- rhs.m_data = nullptr;
- return *this;
- }
-
- private:
- mutable const T *m_data;
- size_t m_size;
- Deleter m_deleter;
- };
-
- typedef std::function<StringPrinter::StringPrinterBufferPointer<
- uint8_t, char, size_t>(uint8_t *, uint8_t *, uint8_t *&)>
- EscapingHelper;
- typedef std::function<EscapingHelper(GetPrintableElementType)>
- EscapingHelperGenerator;
-
- static EscapingHelper
- GetDefaultEscapingHelper(GetPrintableElementType elem_type);
-
template <StringElementType element_type>
static bool
ReadStringAndDumpToStream(const ReadStringAndDumpToStreamOptions &options);
@@ -339,4 +157,4 @@
} // namespace formatters
} // namespace lldb_private
-#endif // liblldb_StringPrinter_h_
+#endif // LLDB_DATAFORMATTERS_STRINGPRINTER_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
index bdb393a..2c93059 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_TypeCategory_h_
-#define lldb_TypeCategory_h_
+#ifndef LLDB_DATAFORMATTERS_TYPECATEGORY_H
+#define LLDB_DATAFORMATTERS_TYPECATEGORY_H
#include <initializer_list>
#include <memory>
@@ -25,14 +25,13 @@
template <typename FormatterImpl> class FormatterContainerPair {
public:
- typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
- typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl>
- RegexMatchContainer;
+ typedef FormattersContainer<FormatterImpl> ExactMatchContainer;
+ typedef FormattersContainer<FormatterImpl> RegexMatchContainer;
- typedef typename ExactMatchContainer::MapType ExactMatchMap;
- typedef typename RegexMatchContainer::MapType RegexMatchMap;
+ typedef TypeMatcher ExactMatchMap;
+ typedef TypeMatcher RegexMatchMap;
- typedef typename ExactMatchContainer::MapValueType MapValueType;
+ typedef typename ExactMatchContainer::ValueSP MapValueType;
typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
@@ -42,10 +41,9 @@
typedef
typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
- FormatterContainerPair(const char *exact_name, const char *regex_name,
- IFormatChangeListener *clist)
- : m_exact_sp(new ExactMatchContainer(std::string(exact_name), clist)),
- m_regex_sp(new RegexMatchContainer(std::string(regex_name), clist)) {}
+ FormatterContainerPair(IFormatChangeListener *clist)
+ : m_exact_sp(new ExactMatchContainer(clist)),
+ m_regex_sp(new RegexMatchContainer(clist)) {}
~FormatterContainerPair() = default;
@@ -67,7 +65,6 @@
typedef FormatterContainerPair<TypeFormatImpl> FormatContainer;
typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer;
typedef FormatterContainerPair<TypeFilterImpl> FilterContainer;
- typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
public:
@@ -86,9 +83,6 @@
typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
- typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
- typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
-
template <typename T> class ForEachCallbacks {
public:
ForEachCallbacks() = default;
@@ -97,64 +91,52 @@
template <typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(FormatContainer::ExactMatchForEachCallback callback) {
- m_format_exact = callback;
+ m_format_exact = std::move(callback);
return *this;
}
template <typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
- m_format_regex = callback;
+ m_format_regex = std::move(callback);
return *this;
}
template <typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
- m_summary_exact = callback;
+ m_summary_exact = std::move(callback);
return *this;
}
template <typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
- m_summary_regex = callback;
+ m_summary_regex = std::move(callback);
return *this;
}
template <typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(FilterContainer::ExactMatchForEachCallback callback) {
- m_filter_exact = callback;
+ m_filter_exact = std::move(callback);
return *this;
}
template <typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
- m_filter_regex = callback;
+ m_filter_regex = std::move(callback);
return *this;
}
template <typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(SynthContainer::ExactMatchForEachCallback callback) {
- m_synth_exact = callback;
+ m_synth_exact = std::move(callback);
return *this;
}
template <typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
- m_synth_regex = callback;
- return *this;
- }
- template <typename U = TypeValidatorImpl>
- typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
- SetExact(ValidatorContainer::ExactMatchForEachCallback callback) {
- m_validator_exact = callback;
- return *this;
- }
- template <typename U = TypeValidatorImpl>
- typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
- SetWithRegex(ValidatorContainer::RegexMatchForEachCallback callback) {
- m_validator_regex = callback;
+ m_synth_regex = std::move(callback);
return *this;
}
@@ -188,15 +170,6 @@
return m_synth_regex;
}
- ValidatorContainer::ExactMatchForEachCallback
- GetValidatorExactCallback() const {
- return m_validator_exact;
- }
- ValidatorContainer::RegexMatchForEachCallback
- GetValidatorRegexCallback() const {
- return m_validator_regex;
- }
-
private:
FormatContainer::ExactMatchForEachCallback m_format_exact;
FormatContainer::RegexMatchForEachCallback m_format_regex;
@@ -209,13 +182,9 @@
SynthContainer::ExactMatchForEachCallback m_synth_exact;
SynthContainer::RegexMatchForEachCallback m_synth_regex;
-
- ValidatorContainer::ExactMatchForEachCallback m_validator_exact;
- ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
};
- TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
- std::initializer_list<lldb::LanguageType> langs = {});
+ TypeCategoryImpl(IFormatChangeListener *clist, ConstString name);
template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
@@ -230,10 +199,6 @@
GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
-
- GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback());
- GetRegexTypeValidatorsContainer()->ForEach(
- foreach.GetValidatorRegexCallback());
}
FormatContainerSP GetTypeFormatsContainer() {
@@ -278,9 +243,6 @@
SynthContainer::MapValueType
GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
- ValidatorContainer::MapValueType
- GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
-
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForFormatAtIndex(size_t index);
@@ -311,19 +273,6 @@
lldb::TypeNameSpecifierImplSP
GetTypeNameSpecifierForSyntheticAtIndex(size_t index);
- ValidatorContainerSP GetTypeValidatorsContainer() {
- return m_validator_cont.GetExactMatch();
- }
-
- RegexValidatorContainerSP GetRegexTypeValidatorsContainer() {
- return m_validator_cont.GetRegexMatch();
- }
-
- ValidatorContainer::MapValueType GetValidatorAtIndex(size_t index);
-
- lldb::TypeNameSpecifierImplSP
- GetTypeNameSpecifierForValidatorAtIndex(size_t index);
-
bool IsEnabled() const { return m_enabled; }
uint32_t GetEnabledPosition() {
@@ -333,17 +282,14 @@
return m_enabled_position;
}
- bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
- lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr);
+ bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
+ lldb::TypeFormatImplSP &entry);
- bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
- lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr);
+ bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
+ lldb::TypeSummaryImplSP &entry);
- bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
- lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr);
-
- bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
- lldb::TypeValidatorImplSP &entry, uint32_t *reason = nullptr);
+ bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates,
+ lldb::SyntheticChildrenSP &entry);
void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);
@@ -359,8 +305,6 @@
void AddLanguage(lldb::LanguageType lang);
- bool HasLanguage(lldb::LanguageType lang);
-
std::string GetDescription();
bool AnyMatches(ConstString type_name,
@@ -376,7 +320,6 @@
SummaryContainer m_summary_cont;
FilterContainer m_filter_cont;
SynthContainer m_synth_cont;
- ValidatorContainer m_validator_cont;
bool m_enabled;
@@ -394,7 +337,7 @@
void Disable() { Enable(false, UINT32_MAX); }
- bool IsApplicable(ValueObject &valobj);
+ bool IsApplicable(lldb::LanguageType lang);
uint32_t GetLastEnabledPosition() { return m_enabled_position; }
@@ -404,24 +347,15 @@
friend class LanguageCategory;
friend class TypeCategoryMap;
- friend class FormattersContainer<ConstString, TypeFormatImpl>;
- friend class FormattersContainer<lldb::RegularExpressionSP, TypeFormatImpl>;
+ friend class FormattersContainer<TypeFormatImpl>;
- friend class FormattersContainer<ConstString, TypeSummaryImpl>;
- friend class FormattersContainer<lldb::RegularExpressionSP, TypeSummaryImpl>;
+ friend class FormattersContainer<TypeSummaryImpl>;
- friend class FormattersContainer<ConstString, TypeFilterImpl>;
- friend class FormattersContainer<lldb::RegularExpressionSP, TypeFilterImpl>;
+ friend class FormattersContainer<TypeFilterImpl>;
- friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
- friend class FormattersContainer<lldb::RegularExpressionSP,
- ScriptedSyntheticChildren>;
-
- friend class FormattersContainer<ConstString, TypeValidatorImpl>;
- friend class FormattersContainer<lldb::RegularExpressionSP,
- TypeValidatorImpl>;
+ friend class FormattersContainer<ScriptedSyntheticChildren>;
};
} // namespace lldb_private
-#endif // lldb_TypeCategory_h_
+#endif // LLDB_DATAFORMATTERS_TYPECATEGORY_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
index 753b58c..4dbca29 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_TypeCategoryMap_h_
-#define lldb_TypeCategoryMap_h_
+#ifndef LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
+#define LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
#include <functional>
#include <list>
@@ -77,21 +77,15 @@
uint32_t GetCount() { return m_map.size(); }
- lldb::TypeFormatImplSP GetFormat(FormattersMatchData &match_data);
-
- lldb::TypeSummaryImplSP GetSummaryFormat(FormattersMatchData &match_data);
-
- lldb::SyntheticChildrenSP
- GetSyntheticChildren(FormattersMatchData &match_data);
-
- lldb::TypeValidatorImplSP GetValidator(FormattersMatchData &match_data);
+ template <typename ImplSP> void Get(FormattersMatchData &, ImplSP &);
private:
class delete_matching_categories {
lldb::TypeCategoryImplSP ptr;
public:
- delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p) {}
+ delete_matching_categories(lldb::TypeCategoryImplSP p)
+ : ptr(std::move(p)) {}
bool operator()(const lldb::TypeCategoryImplSP &other) {
return ptr.get() == other.get();
@@ -110,9 +104,9 @@
std::recursive_mutex &mutex() { return m_map_mutex; }
- friend class FormattersContainer<KeyType, ValueType>;
+ friend class FormattersContainer<ValueType>;
friend class FormatManager;
};
} // namespace lldb_private
-#endif // lldb_TypeCategoryMap_h_
+#endif // LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
index 77e8c0e..b8ed6a3 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_TypeFormat_h_
-#define lldb_TypeFormat_h_
-
+#ifndef LLDB_DATAFORMATTERS_TYPEFORMAT_H
+#define LLDB_DATAFORMATTERS_TYPEFORMAT_H
#include <functional>
#include <string>
@@ -153,7 +152,8 @@
uint32_t m_my_revision;
private:
- DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
+ TypeFormatImpl(const TypeFormatImpl &) = delete;
+ const TypeFormatImpl &operator=(const TypeFormatImpl &) = delete;
};
class TypeFormatImpl_Format : public TypeFormatImpl {
@@ -181,7 +181,9 @@
lldb::Format m_format;
private:
- DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_Format);
+ TypeFormatImpl_Format(const TypeFormatImpl_Format &) = delete;
+ const TypeFormatImpl_Format &
+ operator=(const TypeFormatImpl_Format &) = delete;
};
class TypeFormatImpl_EnumType : public TypeFormatImpl {
@@ -210,8 +212,10 @@
mutable std::unordered_map<void *, CompilerType> m_types;
private:
- DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
+ TypeFormatImpl_EnumType(const TypeFormatImpl_EnumType &) = delete;
+ const TypeFormatImpl_EnumType &
+ operator=(const TypeFormatImpl_EnumType &) = delete;
};
} // namespace lldb_private
-#endif // lldb_TypeFormat_h_
+#endif // LLDB_DATAFORMATTERS_TYPEFORMAT_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
index 9c97b36..ce3195d 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_TypeSummary_h_
-#define lldb_TypeSummary_h_
+#ifndef LLDB_DATAFORMATTERS_TYPESUMMARY_H
+#define LLDB_DATAFORMATTERS_TYPESUMMARY_H
#include <stdint.h>
@@ -270,7 +270,8 @@
private:
Kind m_kind;
- DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
+ TypeSummaryImpl(const TypeSummaryImpl &) = delete;
+ const TypeSummaryImpl &operator=(const TypeSummaryImpl &) = delete;
};
// simple string-based summaries, using ${var to show data
@@ -297,7 +298,8 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
+ StringSummaryFormat(const StringSummaryFormat &) = delete;
+ const StringSummaryFormat &operator=(const StringSummaryFormat &) = delete;
};
// summaries implemented via a C++ function
@@ -320,7 +322,7 @@
const char *GetTextualInfo() const { return m_description.c_str(); }
- void SetBackendFunction(Callback cb_func) { m_impl = cb_func; }
+ void SetBackendFunction(Callback cb_func) { m_impl = std::move(cb_func); }
void SetTextualInfo(const char *descr) {
if (descr)
@@ -341,7 +343,9 @@
typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
private:
- DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
+ CXXFunctionSummaryFormat(const CXXFunctionSummaryFormat &) = delete;
+ const CXXFunctionSummaryFormat &
+ operator=(const CXXFunctionSummaryFormat &) = delete;
};
// Python-based summaries, running script code to show data
@@ -387,8 +391,9 @@
typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
private:
- DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
+ ScriptSummaryFormat(const ScriptSummaryFormat &) = delete;
+ const ScriptSummaryFormat &operator=(const ScriptSummaryFormat &) = delete;
};
} // namespace lldb_private
-#endif // lldb_TypeSummary_h_
+#endif // LLDB_DATAFORMATTERS_TYPESUMMARY_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
index 93443cf..fa14582 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_TypeSynthetic_h_
-#define lldb_TypeSynthetic_h_
+#ifndef LLDB_DATAFORMATTERS_TYPESYNTHETIC_H
+#define LLDB_DATAFORMATTERS_TYPESYNTHETIC_H
#include <stdint.h>
@@ -96,7 +96,9 @@
private:
bool m_valid;
- DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
+ SyntheticChildrenFrontEnd(const SyntheticChildrenFrontEnd &) = delete;
+ const SyntheticChildrenFrontEnd &
+ operator=(const SyntheticChildrenFrontEnd &) = delete;
};
class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
@@ -121,7 +123,10 @@
lldb::ValueObjectSP GetSyntheticValue() override = 0;
private:
- DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
+ SyntheticValueProviderFrontEnd(const SyntheticValueProviderFrontEnd &) =
+ delete;
+ const SyntheticValueProviderFrontEnd &
+ operator=(const SyntheticValueProviderFrontEnd &) = delete;
};
class SyntheticChildren {
@@ -265,7 +270,8 @@
Flags m_flags;
private:
- DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
+ SyntheticChildren(const SyntheticChildren &) = delete;
+ const SyntheticChildren &operator=(const SyntheticChildren &) = delete;
};
class TypeFilterImpl : public SyntheticChildren {
@@ -333,7 +339,8 @@
private:
TypeFilterImpl *filter;
- DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ FrontEnd(const FrontEnd &) = delete;
+ const FrontEnd &operator=(const FrontEnd &) = delete;
};
SyntheticChildrenFrontEnd::AutoPointer
@@ -344,7 +351,8 @@
typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
private:
- DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
+ TypeFilterImpl(const TypeFilterImpl &) = delete;
+ const TypeFilterImpl &operator=(const TypeFilterImpl &) = delete;
};
class CXXSyntheticChildren : public SyntheticChildren {
@@ -354,7 +362,7 @@
CreateFrontEndCallback;
CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
const char *description, CreateFrontEndCallback callback)
- : SyntheticChildren(flags), m_create_callback(callback),
+ : SyntheticChildren(flags), m_create_callback(std::move(callback)),
m_description(description ? description : "") {}
bool IsScripted() override { return false; }
@@ -372,7 +380,8 @@
std::string m_description;
private:
- DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+ CXXSyntheticChildren(const CXXSyntheticChildren &) = delete;
+ const CXXSyntheticChildren &operator=(const CXXSyntheticChildren &) = delete;
};
class ScriptedSyntheticChildren : public SyntheticChildren {
@@ -435,7 +444,8 @@
StructuredData::ObjectSP m_wrapper_sp;
ScriptInterpreter *m_interpreter;
- DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ FrontEnd(const FrontEnd &) = delete;
+ const FrontEnd &operator=(const FrontEnd &) = delete;
};
SyntheticChildrenFrontEnd::AutoPointer
@@ -448,8 +458,10 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
+ ScriptedSyntheticChildren(const ScriptedSyntheticChildren &) = delete;
+ const ScriptedSyntheticChildren &
+ operator=(const ScriptedSyntheticChildren &) = delete;
};
} // namespace lldb_private
-#endif // lldb_TypeSynthetic_h_
+#endif // LLDB_DATAFORMATTERS_TYPESYNTHETIC_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h b/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
deleted file mode 100644
index 531812e..0000000
--- a/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
+++ /dev/null
@@ -1,201 +0,0 @@
-//===-- TypeValidator.h ------------------------------------------*- C++
-//-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_TypeValidator_h_
-#define lldb_TypeValidator_h_
-
-
-#include <functional>
-#include <string>
-
-
-#include "lldb/lldb-enumerations.h"
-#include "lldb/lldb-private-enumerations.h"
-#include "lldb/lldb-public.h"
-
-namespace lldb_private {
-
-class TypeValidatorImpl {
-public:
- class Flags {
- public:
- Flags() : m_flags(lldb::eTypeOptionCascade) {}
-
- Flags(const Flags &other) : m_flags(other.m_flags) {}
-
- Flags(uint32_t value) : m_flags(value) {}
-
- Flags &operator=(const Flags &rhs) {
- if (&rhs != this)
- m_flags = rhs.m_flags;
-
- return *this;
- }
-
- Flags &operator=(const uint32_t &rhs) {
- m_flags = rhs;
- return *this;
- }
-
- Flags &Clear() {
- m_flags = 0;
- return *this;
- }
-
- bool GetCascades() const {
- return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
- }
-
- Flags &SetCascades(bool value = true) {
- if (value)
- m_flags |= lldb::eTypeOptionCascade;
- else
- m_flags &= ~lldb::eTypeOptionCascade;
- return *this;
- }
-
- bool GetSkipPointers() const {
- return (m_flags & lldb::eTypeOptionSkipPointers) ==
- lldb::eTypeOptionSkipPointers;
- }
-
- Flags &SetSkipPointers(bool value = true) {
- if (value)
- m_flags |= lldb::eTypeOptionSkipPointers;
- else
- m_flags &= ~lldb::eTypeOptionSkipPointers;
- return *this;
- }
-
- bool GetSkipReferences() const {
- return (m_flags & lldb::eTypeOptionSkipReferences) ==
- lldb::eTypeOptionSkipReferences;
- }
-
- Flags &SetSkipReferences(bool value = true) {
- if (value)
- m_flags |= lldb::eTypeOptionSkipReferences;
- else
- m_flags &= ~lldb::eTypeOptionSkipReferences;
- return *this;
- }
-
- bool GetNonCacheable() const {
- return (m_flags & lldb::eTypeOptionNonCacheable) ==
- lldb::eTypeOptionNonCacheable;
- }
-
- Flags &SetNonCacheable(bool value = true) {
- if (value)
- m_flags |= lldb::eTypeOptionNonCacheable;
- else
- m_flags &= ~lldb::eTypeOptionNonCacheable;
- return *this;
- }
-
- uint32_t GetValue() { return m_flags; }
-
- void SetValue(uint32_t value) { m_flags = value; }
-
- private:
- uint32_t m_flags;
- };
-
- TypeValidatorImpl(const Flags &flags = Flags());
-
- typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
-
- virtual ~TypeValidatorImpl();
-
- bool Cascades() const { return m_flags.GetCascades(); }
- bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
- bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
- bool NonCacheable() const { return m_flags.GetNonCacheable(); }
-
- void SetCascades(bool value) { m_flags.SetCascades(value); }
-
- void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
-
- void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
-
- void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
-
- uint32_t GetOptions() { return m_flags.GetValue(); }
-
- void SetOptions(uint32_t value) { m_flags.SetValue(value); }
-
- uint32_t &GetRevision() { return m_my_revision; }
-
- enum class Type { eTypeUnknown, eTypeCXX };
-
- struct ValidationResult {
- TypeValidatorResult m_result;
- std::string m_message;
- };
-
- virtual Type GetType() { return Type::eTypeUnknown; }
-
- // we are using a ValueObject* instead of a ValueObjectSP because we do not
- // need to hold on to this for extended periods of time and we trust the
- // ValueObject to stay around for as long as it is required for us to
- // generate its value
- virtual ValidationResult FormatObject(ValueObject *valobj) const = 0;
-
- virtual std::string GetDescription() = 0;
-
- static ValidationResult Success();
-
- static ValidationResult Failure(std::string message);
-
-protected:
- Flags m_flags;
- uint32_t m_my_revision;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl);
-};
-
-class TypeValidatorImpl_CXX : public TypeValidatorImpl {
-public:
- typedef std::function<TypeValidatorImpl::ValidationResult(
- ValueObject *valobj)>
- ValidatorFunction;
-
- TypeValidatorImpl_CXX(ValidatorFunction f, std::string d,
- const TypeValidatorImpl::Flags &flags = Flags());
-
- typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
-
- ~TypeValidatorImpl_CXX() override;
-
- ValidatorFunction GetValidatorFunction() const {
- return m_validator_function;
- }
-
- void SetValidatorFunction(ValidatorFunction f) { m_validator_function = f; }
-
- TypeValidatorImpl::Type GetType() override {
- return TypeValidatorImpl::Type::eTypeCXX;
- }
-
- ValidationResult FormatObject(ValueObject *valobj) const override;
-
- std::string GetDescription() override;
-
-protected:
- std::string m_description;
- ValidatorFunction m_validator_function;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX);
-};
-
-} // namespace lldb_private
-
-#endif // lldb_TypeValidator_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
index 41adc2d..f1301d8 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_ValueObjectPrinter_h_
-#define lldb_ValueObjectPrinter_h_
-
+#ifndef LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
+#define LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
@@ -58,12 +57,10 @@
const char *GetDescriptionForDisplay();
- const char *GetRootNameForDisplay(const char *if_fail = nullptr);
+ const char *GetRootNameForDisplay();
bool ShouldPrintValueObject();
- bool ShouldPrintValidation();
-
bool IsNil();
bool IsUninitialized();
@@ -76,10 +73,6 @@
bool IsAggregate();
- bool PrintValidationMarkerIfNeeded();
-
- bool PrintValidationErrorIfNeeded();
-
bool PrintLocationIfNeeded();
void PrintDecl();
@@ -145,13 +138,13 @@
std::string m_summary;
std::string m_error;
bool m_val_summary_ok;
- std::pair<TypeValidatorResult, std::string> m_validation;
friend struct StringSummaryFormat;
- DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
+ ValueObjectPrinter(const ValueObjectPrinter &) = delete;
+ const ValueObjectPrinter &operator=(const ValueObjectPrinter &) = delete;
};
} // namespace lldb_private
-#endif // lldb_ValueObjectPrinter_h_
+#endif // LLDB_DATAFORMATTERS_VALUEOBJECTPRINTER_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
index cde4be4..33650a3 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_VectorIterator_h_
-#define liblldb_VectorIterator_h_
+#ifndef LLDB_DATAFORMATTERS_VECTORITERATOR_H
+#define LLDB_DATAFORMATTERS_VECTORITERATOR_H
#include "lldb/lldb-forward.h"
@@ -42,4 +42,4 @@
} // namespace formatters
} // namespace lldb_private
-#endif // liblldb_CF_h_
+#endif // LLDB_DATAFORMATTERS_VECTORITERATOR_H
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorType.h b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
index b757f75..6a66b18 100644
--- a/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_VectorType_h_
-#define liblldb_VectorType_h_
+#ifndef LLDB_DATAFORMATTERS_VECTORTYPE_H
+#define LLDB_DATAFORMATTERS_VECTORTYPE_H
#include "lldb/lldb-forward.h"
@@ -21,4 +21,4 @@
} // namespace formatters
} // namespace lldb_private
-#endif // liblldb_VectorType_h_
+#endif // LLDB_DATAFORMATTERS_VECTORTYPE_H
diff --git a/linux-x64/clang/include/lldb/Expression/DWARFExpression.h b/linux-x64/clang/include/lldb/Expression/DWARFExpression.h
index 21830a5..c7d4e4b 100644
--- a/linux-x64/clang/include/lldb/Expression/DWARFExpression.h
+++ b/linux-x64/clang/include/lldb/Expression/DWARFExpression.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DWARFExpression_h_
-#define liblldb_DWARFExpression_h_
+#ifndef LLDB_EXPRESSION_DWARFEXPRESSION_H
+#define LLDB_EXPRESSION_DWARFEXPRESSION_H
#include "lldb/Core/Address.h"
#include "lldb/Core/Disassembler.h"
@@ -34,15 +34,6 @@
/// location expression or a location list and interprets it.
class DWARFExpression {
public:
- enum LocationListFormat : uint8_t {
- NonLocationList, // Not a location list
- RegularLocationList, // Location list format used in non-split dwarf files
- SplitDwarfLocationList, // Location list format used in pre-DWARF v5 split
- // dwarf files (.debug_loc.dwo)
- LocLists, // Location list format used in DWARF v5
- // (.debug_loclists/.debug_loclists.dwo).
- };
-
DWARFExpression();
/// Constructor
@@ -50,15 +41,8 @@
/// \param[in] data
/// A data extractor configured to read the DWARF location expression's
/// bytecode.
- ///
- /// \param[in] data_offset
- /// The offset of the location expression in the extractor.
- ///
- /// \param[in] data_length
- /// The byte length of the location expression.
DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
- const DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
- lldb::offset_t data_length);
+ const DWARFUnit *dwarf_cu);
/// Destructor
virtual ~DWARFExpression();
@@ -92,8 +76,8 @@
/// Search for a load address in the location list
///
- /// \param[in] process
- /// The process to use when resolving the load address
+ /// \param[in] func_load_addr
+ /// The actual address of the function containing this location list.
///
/// \param[in] addr
/// The address to resolve
@@ -105,7 +89,7 @@
// LocationListContainsLoadAddress (Process* process, const Address &addr)
// const;
//
- bool LocationListContainsAddress(lldb::addr_t loclist_base_addr,
+ bool LocationListContainsAddress(lldb::addr_t func_load_addr,
lldb::addr_t addr) const;
/// If a location is not a location list, return true if the location
@@ -145,13 +129,15 @@
/// Tells the expression that it refers to a location list.
///
- /// \param[in] slide
- /// This value should be a slide that is applied to any values
- /// in the location list data so the values become zero based
- /// offsets into the object that owns the location list. We need
- /// to make location lists relative to the objects that own them
- /// so we can relink addresses on the fly.
- void SetLocationListSlide(lldb::addr_t slide);
+ /// \param[in] cu_file_addr
+ /// The base address to use for interpreting relative location list
+ /// entries.
+ /// \param[in] func_file_addr
+ /// The file address of the function containing this location list. This
+ /// address will be used to relocate the location list on the fly (in
+ /// conjuction with the func_load_addr arguments).
+ void SetLocationListAddresses(lldb::addr_t cu_file_addr,
+ lldb::addr_t func_file_addr);
/// Return the call-frame-info style register kind
int GetRegisterKind();
@@ -165,8 +151,7 @@
/// Wrapper for the static evaluate function that accepts an
/// ExecutionContextScope instead of an ExecutionContext and uses member
/// variables to populate many operands
- bool Evaluate(ExecutionContextScope *exe_scope,
- lldb::addr_t loclist_base_load_addr,
+ bool Evaluate(ExecutionContextScope *exe_scope, lldb::addr_t func_load_addr,
const Value *initial_value_ptr, const Value *object_address_ptr,
Value &result, Status *error_ptr) const;
@@ -191,19 +176,6 @@
/// This is a static method so the opcodes need to be provided
/// explicitly.
///
- /// \param[in] expr_locals
- /// If the location expression was produced by the expression parser,
- /// the list of local variables referenced by the DWARF expression.
- /// This list should already have been populated during parsing;
- /// the DWARF expression refers to variables by index. Can be NULL if
- /// the location expression uses no locals.
- ///
- /// \param[in] decl_map
- /// If the location expression was produced by the expression parser,
- /// the list of external variables referenced by the location
- /// expression. Can be NULL if the location expression uses no
- /// external variables.
- ///
/// \param[in] reg_ctx
/// An optional parameter which provides a RegisterContext for use
/// when evaluating the expression (i.e. for fetching register values).
@@ -211,12 +183,6 @@
/// in the case where an expression needs to be evaluated while building
/// the stack frame list, this short-cut is available.
///
- /// \param[in] offset
- /// The offset of the location expression in the data extractor.
- ///
- /// \param[in] length
- /// The length in bytes of the location expression.
- ///
/// \param[in] reg_set
/// The call-frame-info style register kind.
///
@@ -236,8 +202,7 @@
/// details of the failure are provided through it.
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
- const DWARFUnit *dwarf_cu, const lldb::offset_t offset,
- const lldb::offset_t length,
+ const DWARFUnit *dwarf_cu,
const lldb::RegisterKind reg_set,
const Value *initial_value_ptr,
const Value *object_address_ptr, Value &result,
@@ -249,34 +214,23 @@
}
bool DumpLocationForAddress(Stream *s, lldb::DescriptionLevel level,
- lldb::addr_t loclist_base_load_addr,
- lldb::addr_t address, ABI *abi);
-
- static size_t LocationListSize(const DWARFUnit *dwarf_cu,
- const DataExtractor &debug_loc_data,
- lldb::offset_t offset);
-
- static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
- int address_size, int dwarf_ref_size,
- bool location_expression);
-
- static void PrintDWARFLocationList(Stream &s, const DWARFUnit *cu,
- const DataExtractor &debug_loc_data,
- lldb::offset_t offset);
+ lldb::addr_t func_load_addr, lldb::addr_t address,
+ ABI *abi);
bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op);
+ llvm::Optional<DataExtractor>
+ GetLocationExpression(lldb::addr_t load_function_start,
+ lldb::addr_t addr) const;
+
private:
/// Pretty-prints the location expression to a stream
///
- /// \param[in] stream
+ /// \param[in] s
/// The stream to use for pretty-printing.
///
- /// \param[in] offset
- /// The offset into the data buffer of the opcodes to be printed.
- ///
- /// \param[in] length
- /// The length in bytes of the opcodes to be printed.
+ /// \param[in] data
+ /// The data extractor.
///
/// \param[in] level
/// The level of detail to use in pretty-printing.
@@ -284,19 +238,9 @@
/// \param[in] abi
/// An optional ABI plug-in that can be used to resolve register
/// names.
- void DumpLocation(Stream *s, lldb::offset_t offset, lldb::offset_t length,
+ void DumpLocation(Stream *s, const DataExtractor &data,
lldb::DescriptionLevel level, ABI *abi) const;
- bool GetLocation(lldb::addr_t base_addr, lldb::addr_t pc,
- lldb::offset_t &offset, lldb::offset_t &len);
-
- static bool AddressRangeForLocationListEntry(
- const DWARFUnit *dwarf_cu, const DataExtractor &debug_loc_data,
- lldb::offset_t *offset_ptr, lldb::addr_t &low_pc, lldb::addr_t &high_pc);
-
- bool GetOpAndEndOffsets(StackFrame &frame, lldb::offset_t &op_offset,
- lldb::offset_t &end_offset);
-
/// Module which defined this expression.
lldb::ModuleWP m_module_wp;
@@ -311,12 +255,13 @@
/// One of the defines that starts with LLDB_REGKIND_
lldb::RegisterKind m_reg_kind;
- /// A value used to slide the location list offsets so that m_c they are
- /// relative to the object that owns the location list (the function for
- /// frame base and variable location lists)
- lldb::addr_t m_loclist_slide;
+ struct LoclistAddresses {
+ lldb::addr_t cu_file_addr;
+ lldb::addr_t func_file_addr;
+ };
+ llvm::Optional<LoclistAddresses> m_loclist_addresses;
};
} // namespace lldb_private
-#endif // liblldb_DWARFExpression_h_
+#endif // LLDB_EXPRESSION_DWARFEXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h b/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h
index 7e3e2bb..c0271c9 100644
--- a/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h
+++ b/linux-x64/clang/include/lldb/Expression/DiagnosticManager.h
@@ -6,12 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_DiagnosticManager_h
-#define lldb_DiagnosticManager_h
+#ifndef LLDB_EXPRESSION_DIAGNOSTICMANAGER_H
+#define LLDB_EXPRESSION_DIAGNOSTICMANAGER_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include <string>
@@ -23,7 +24,6 @@
eDiagnosticOriginUnknown = 0,
eDiagnosticOriginLLDB,
eDiagnosticOriginClang,
- eDiagnosticOriginGo,
eDiagnosticOriginSwift,
eDiagnosticOriginLLVM
};
@@ -47,7 +47,6 @@
switch (kind) {
case eDiagnosticOriginUnknown:
case eDiagnosticOriginLLDB:
- case eDiagnosticOriginGo:
case eDiagnosticOriginLLVM:
return true;
case eDiagnosticOriginClang:
@@ -79,7 +78,7 @@
bool precede_with_newline = true) {
if (precede_with_newline)
m_message.push_back('\n');
- m_message.append(message);
+ m_message += message;
}
protected:
@@ -89,7 +88,7 @@
uint32_t m_compiler_id; // Compiler-specific diagnostic ID
};
-typedef std::vector<Diagnostic *> DiagnosticList;
+typedef std::vector<std::unique_ptr<Diagnostic>> DiagnosticList;
class DiagnosticManager {
public:
@@ -98,45 +97,33 @@
m_fixed_expression.clear();
}
- // The diagnostic manager holds a list of diagnostics, which are owned by the
- // manager.
const DiagnosticList &Diagnostics() { return m_diagnostics; }
- ~DiagnosticManager() {
- for (Diagnostic *diag : m_diagnostics) {
- delete diag;
- }
- }
-
- bool HasFixIts() {
- for (Diagnostic *diag : m_diagnostics) {
- if (diag->HasFixIts())
- return true;
- }
- return false;
+ bool HasFixIts() const {
+ return llvm::any_of(m_diagnostics,
+ [](const std::unique_ptr<Diagnostic> &diag) {
+ return diag->HasFixIts();
+ });
}
void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
DiagnosticOrigin origin,
uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
- m_diagnostics.push_back(
- new Diagnostic(message, severity, origin, compiler_id));
+ m_diagnostics.emplace_back(
+ std::make_unique<Diagnostic>(message, severity, origin, compiler_id));
}
- void AddDiagnostic(Diagnostic *diagnostic) {
- m_diagnostics.push_back(diagnostic);
+ void AddDiagnostic(std::unique_ptr<Diagnostic> diagnostic) {
+ m_diagnostics.push_back(std::move(diagnostic));
}
- void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
-
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
__attribute__((format(printf, 3, 4)));
- size_t PutString(DiagnosticSeverity severity, llvm::StringRef str);
+ void PutString(DiagnosticSeverity severity, llvm::StringRef str);
void AppendMessageToDiagnostic(llvm::StringRef str) {
- if (!m_diagnostics.empty()) {
+ if (!m_diagnostics.empty())
m_diagnostics.back()->AppendMessage(str);
- }
}
// Returns a string containing errors in this format:
@@ -153,7 +140,6 @@
// Moves fixed_expression to the internal storage.
void SetFixedExpression(std::string fixed_expression) {
m_fixed_expression = std::move(fixed_expression);
- fixed_expression.clear();
}
protected:
@@ -162,4 +148,4 @@
};
}
-#endif /* lldb_DiagnosticManager_h */
+#endif // LLDB_EXPRESSION_DIAGNOSTICMANAGER_H
diff --git a/linux-x64/clang/include/lldb/Expression/DynamicCheckerFunctions.h b/linux-x64/clang/include/lldb/Expression/DynamicCheckerFunctions.h
new file mode 100644
index 0000000..02bce5a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Expression/DynamicCheckerFunctions.h
@@ -0,0 +1,62 @@
+//===-- DynamicCheckerFunctions.h -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H
+#define LLDB_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H
+
+#include "lldb/lldb-types.h"
+
+namespace lldb_private {
+
+class DiagnosticManager;
+class ExecutionContext;
+
+/// Encapsulates dynamic check functions used by expressions.
+///
+/// Each of the utility functions encapsulated in this class is responsible
+/// for validating some data that an expression is about to use. Examples
+/// are:
+///
+/// a = *b; // check that b is a valid pointer
+/// [b init]; // check that b is a valid object to send "init" to
+///
+/// The class installs each checker function into the target process and makes
+/// it available to IRDynamicChecks to use.
+class DynamicCheckerFunctions {
+public:
+ enum DynamicCheckerFunctionsKind {
+ DCF_Clang,
+ };
+
+ DynamicCheckerFunctions(DynamicCheckerFunctionsKind kind) : m_kind(kind) {}
+ virtual ~DynamicCheckerFunctions() = default;
+
+ /// Install the utility functions into a process. This binds the instance
+ /// of DynamicCheckerFunctions to that process.
+ ///
+ /// \param[in] diagnostic_manager
+ /// A diagnostic manager to report errors to.
+ ///
+ /// \param[in] exe_ctx
+ /// The execution context to install the functions into.
+ ///
+ /// \return
+ /// True on success; false on failure, or if the functions have
+ /// already been installed.
+ virtual bool Install(DiagnosticManager &diagnostic_manager,
+ ExecutionContext &exe_ctx) = 0;
+ virtual bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message) = 0;
+
+ DynamicCheckerFunctionsKind GetKind() const { return m_kind; }
+
+private:
+ const DynamicCheckerFunctionsKind m_kind;
+};
+} // namespace lldb_private
+
+#endif // LLDB_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H
diff --git a/linux-x64/clang/include/lldb/Expression/Expression.h b/linux-x64/clang/include/lldb/Expression/Expression.h
index 2f0183c..aaac889 100644
--- a/linux-x64/clang/include/lldb/Expression/Expression.h
+++ b/linux-x64/clang/include/lldb/Expression/Expression.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Expression_h_
-#define liblldb_Expression_h_
+#ifndef LLDB_EXPRESSION_EXPRESSION_H
+#define LLDB_EXPRESSION_EXPRESSION_H
#include <map>
#include <string>
@@ -32,22 +32,11 @@
/// LLVM IR from the expression.
class Expression {
public:
- /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
- enum ExpressionKind {
- eKindFunctionCaller,
- eKindClangFunctionCaller,
- eKindUserExpression,
- eKindLLVMUserExpression,
- eKindClangUserExpression,
- eKindUtilityFunction,
- eKindClangUtilityFunction,
- };
-
enum ResultType { eResultTypeAny, eResultTypeId };
- Expression(Target &target, ExpressionKind kind);
+ Expression(Target &target);
- Expression(ExecutionContextScope &exe_scope, ExpressionKind kind);
+ Expression(ExecutionContextScope &exe_scope);
/// Destructor
virtual ~Expression() {}
@@ -62,7 +51,13 @@
/// Return the language that should be used when parsing. To use the
/// default, return eLanguageTypeUnknown.
- virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; }
+ virtual lldb::LanguageType Language() const {
+ return lldb::eLanguageTypeUnknown;
+ }
+
+ /// Return the Materializer that the parser should use when registering
+ /// external values.
+ virtual Materializer *GetMaterializer() { return nullptr; }
/// Return the desired result type of the function, or eResultTypeAny if
/// indifferent.
@@ -90,12 +85,9 @@
virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; }
- /// LLVM-style RTTI support.
- ExpressionKind getKind() const { return m_kind; }
-
-private:
- /// LLVM-style RTTI support.
- const ExpressionKind m_kind;
+ // LLVM RTTI support
+ virtual bool isA(const void *ClassID) const = 0;
+
protected:
lldb::TargetWP m_target_wp; /// Expression's always have to have a target...
lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but
@@ -111,4 +103,4 @@
} // namespace lldb_private
-#endif // liblldb_Expression_h_
+#endif // LLDB_EXPRESSION_EXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionParser.h b/linux-x64/clang/include/lldb/Expression/ExpressionParser.h
index 59f7c15..71d2410 100644
--- a/linux-x64/clang/include/lldb/Expression/ExpressionParser.h
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionParser.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ExpressionParser_h_
-#define liblldb_ExpressionParser_h_
+#ifndef LLDB_EXPRESSION_EXPRESSIONPARSER_H
+#define LLDB_EXPRESSION_EXPRESSIONPARSER_H
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/Status.h"
@@ -29,7 +29,7 @@
///
/// Initializes class variables.
///
- /// \param[in] exe_scope,
+ /// \param[in] exe_scope
/// If non-NULL, an execution context scope that can help to
/// correctly create an expression with a valid process for
/// optional tuning Objective-C runtime support. Can be NULL.
@@ -76,17 +76,6 @@
virtual bool Complete(CompletionRequest &request, unsigned line, unsigned pos,
unsigned typed_pos) = 0;
- /// Parse a single expression and convert it to IR using Clang. Don't wrap
- /// the expression in anything at all.
- ///
- /// \param[in] diagnostic_manager
- /// The diagnostic manager in which to store the errors and warnings.
- ///
- /// \return
- /// The number of errors encountered during parsing. 0 means
- /// success.
- virtual unsigned Parse(DiagnosticManager &diagnostic_manager) = 0;
-
/// Try to use the FixIts in the diagnostic_manager to rewrite the
/// expression. If successful, the rewritten expression is stored in the
/// diagnostic_manager, get it out with GetFixedExpression.
@@ -144,4 +133,4 @@
};
}
-#endif // liblldb_ExpressionParser_h_
+#endif // LLDB_EXPRESSION_EXPRESSIONPARSER_H
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h b/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h
index d0d01b5..a3be739 100644
--- a/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionSourceCode.h
@@ -6,31 +6,39 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ExpressionSourceCode_h
-#define liblldb_ExpressionSourceCode_h
+#ifndef LLDB_EXPRESSION_EXPRESSIONSOURCECODE_H
+#define LLDB_EXPRESSION_EXPRESSIONSOURCECODE_H
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
#include <string>
namespace lldb_private {
class ExpressionSourceCode {
+protected:
+ enum Wrapping : bool {
+ Wrap = true,
+ NoWrap = false,
+ };
+
public:
- bool NeedsWrapping() const { return m_wrap; }
+ bool NeedsWrapping() const { return m_wrap == Wrap; }
const char *GetName() const { return m_name.c_str(); }
protected:
- ExpressionSourceCode(const char *name, const char *prefix, const char *body,
- bool wrap)
- : m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
+ ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
+ llvm::StringRef body, Wrapping wrap)
+ : m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
+ m_wrap(wrap) {}
std::string m_name;
std::string m_prefix;
std::string m_body;
- bool m_wrap;
+ Wrapping m_wrap;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h b/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h
index 9c64553..1bba30a 100644
--- a/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionTypeSystemHelper.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef ExpressionTypeSystemHelper_h
-#define ExpressionTypeSystemHelper_h
+#ifndef LLDB_EXPRESSION_EXPRESSIONTYPESYSTEMHELPER_H
+#define LLDB_EXPRESSION_EXPRESSIONTYPESYSTEMHELPER_H
#include "llvm/Support/Casting.h"
@@ -44,4 +44,4 @@
} // namespace lldb_private
-#endif /* ExpressionTypeSystemHelper_h */
+#endif // LLDB_EXPRESSION_EXPRESSIONTYPESYSTEMHELPER_H
diff --git a/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h b/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h
index 08c9872..4259e63 100644
--- a/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h
+++ b/linux-x64/clang/include/lldb/Expression/ExpressionVariable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ExpressionVariable_h_
-#define liblldb_ExpressionVariable_h_
+#ifndef LLDB_EXPRESSION_EXPRESSIONVARIABLE_H
+#define LLDB_EXPRESSION_EXPRESSIONVARIABLE_H
#include <memory>
#include <vector>
@@ -32,7 +32,7 @@
virtual ~ExpressionVariable();
- size_t GetByteSize() { return m_frozen_sp->GetByteSize(); }
+ llvm::Optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
ConstString GetName() { return m_frozen_sp->GetName(); }
@@ -98,9 +98,7 @@
EVTypeIsReference = 1 << 6, ///< The original type of this variable is a
///reference, so materialize the value rather
///than the location
- EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type
- ///must be resolved after parsing is complete
- EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or
+ EVBareRegister = 1 << 7 ///< This variable is a direct reference to $pc or
///some other entity.
};
@@ -223,11 +221,7 @@
uint32_t addr_byte_size) = 0;
/// Return a new persistent variable name with the specified prefix.
- ConstString GetNextPersistentVariableName(Target &target,
- llvm::StringRef prefix);
-
- virtual llvm::StringRef
- GetPersistentVariablePrefix(bool is_error = false) const = 0;
+ virtual ConstString GetNextPersistentVariableName(bool is_error = false) = 0;
virtual void
RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
@@ -239,6 +233,10 @@
void RegisterExecutionUnit(lldb::IRExecutionUnitSP &execution_unit_sp);
+protected:
+ virtual llvm::StringRef
+ GetPersistentVariablePrefix(bool is_error = false) const = 0;
+
private:
LLVMCastKind m_kind;
@@ -253,4 +251,4 @@
} // namespace lldb_private
-#endif // liblldb_ExpressionVariable_h_
+#endif // LLDB_EXPRESSION_EXPRESSIONVARIABLE_H
diff --git a/linux-x64/clang/include/lldb/Expression/FunctionCaller.h b/linux-x64/clang/include/lldb/Expression/FunctionCaller.h
index ea9d020..f35ee82 100644
--- a/linux-x64/clang/include/lldb/Expression/FunctionCaller.h
+++ b/linux-x64/clang/include/lldb/Expression/FunctionCaller.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_FunctionCaller_h_
-#define liblldb_FunctionCaller_h_
+#ifndef LLDB_EXPRESSION_FUNCTIONCALLER_H
+#define LLDB_EXPRESSION_FUNCTIONCALLER_H
#include <list>
#include <memory>
@@ -54,22 +54,20 @@
/// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
/// argument space will be managed for you.
class FunctionCaller : public Expression {
+ // LLVM RTTI support
+ static char ID;
+
public:
- /// LLVM-style RTTI support.
- static bool classof(const Expression *E) {
- return E->getKind() == eKindFunctionCaller;
- }
-
+ bool isA(const void *ClassID) const override { return ClassID == &ID; }
+ static bool classof(const Expression *obj) { return obj->isA(&ID); }
+
/// Constructor
///
/// \param[in] exe_scope
/// An execution context scope that gets us at least a target and
/// process.
///
- /// \param[in] ast_context
- /// The AST context to evaluate argument types in.
- ///
- /// \param[in] return_qualtype
+ /// \param[in] return_type
/// An opaque Clang QualType for the function result. Should be
/// defined in ast_context.
///
@@ -223,21 +221,12 @@
/// The execution context to insert the function and its arguments
/// into.
///
- /// \param[in] func_addr
- /// The address of the function in the target process.
- ///
/// \param[in] args_addr
/// The address of the argument struct.
///
/// \param[in] diagnostic_manager
/// The diagnostic manager to report errors to.
///
- /// \param[in] stop_others
- /// True if other threads should pause during execution.
- ///
- /// \param[in] unwind_on_error
- /// True if the thread plan may simply be discarded if an error occurs.
- ///
/// \return
/// A ThreadPlan shared pointer for executing the function.
lldb::ThreadPlanSP
@@ -347,4 +336,4 @@
} // namespace lldb_private
-#endif // liblldb_FunctionCaller_h_
+#endif // LLDB_EXPRESSION_FUNCTIONCALLER_H
diff --git a/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h b/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h
deleted file mode 100644
index 26f1cdb..0000000
--- a/linux-x64/clang/include/lldb/Expression/IRDynamicChecks.h
+++ /dev/null
@@ -1,146 +0,0 @@
-//===-- IRDynamicChecks.h ---------------------------------------------*- C++
-//-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_IRDynamicChecks_h_
-#define liblldb_IRDynamicChecks_h_
-
-#include "lldb/lldb-types.h"
-#include "llvm/Pass.h"
-
-namespace llvm {
-class BasicBlock;
-class CallInst;
-class Constant;
-class Function;
-class Instruction;
-class Module;
-class DataLayout;
-class Value;
-}
-
-namespace lldb_private {
-
-class ClangExpressionDeclMap;
-class ExecutionContext;
-class Stream;
-
-/// \class DynamicCheckerFunctions IRDynamicChecks.h
-/// "lldb/Expression/IRDynamicChecks.h" Encapsulates dynamic check functions
-/// used by expressions.
-///
-/// Each of the utility functions encapsulated in this class is responsible
-/// for validating some data that an expression is about to use. Examples
-/// are:
-///
-/// a = *b; // check that b is a valid pointer [b init]; // check that b
-/// is a valid object to send "init" to
-///
-/// The class installs each checker function into the target process and makes
-/// it available to IRDynamicChecks to use.
-class DynamicCheckerFunctions {
-public:
- /// Constructor
- DynamicCheckerFunctions();
-
- /// Destructor
- ~DynamicCheckerFunctions();
-
- /// Install the utility functions into a process. This binds the instance
- /// of DynamicCheckerFunctions to that process.
- ///
- /// \param[in] diagnostic_manager
- /// A diagnostic manager to report errors to.
- ///
- /// \param[in] exe_ctx
- /// The execution context to install the functions into.
- ///
- /// \return
- /// True on success; false on failure, or if the functions have
- /// already been installed.
- bool Install(DiagnosticManager &diagnostic_manager,
- ExecutionContext &exe_ctx);
-
- bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message);
-
- std::unique_ptr<UtilityFunction> m_valid_pointer_check;
- std::unique_ptr<UtilityFunction> m_objc_object_check;
-};
-
-/// \class IRDynamicChecks IRDynamicChecks.h
-/// "lldb/Expression/IRDynamicChecks.h" Adds dynamic checks to a user-entered
-/// expression to reduce its likelihood of crashing
-///
-/// When an IR function is executed in the target process, it may cause
-/// crashes or hangs by dereferencing NULL pointers, trying to call
-/// Objective-C methods on objects that do not respond to them, and so forth.
-///
-/// IRDynamicChecks adds calls to the functions in DynamicCheckerFunctions to
-/// appropriate locations in an expression's IR.
-class IRDynamicChecks : public llvm::ModulePass {
-public:
- /// Constructor
- ///
- /// \param[in] checker_functions
- /// The checker functions for the target process.
- ///
- /// \param[in] func_name
- /// The name of the function to prepare for execution in the target.
- ///
- /// \param[in] decl_map
- /// The mapping used to look up entities in the target process. In
- /// this case, used to find objc_msgSend
- IRDynamicChecks(DynamicCheckerFunctions &checker_functions,
- const char *func_name = "$__lldb_expr");
-
- /// Destructor
- ~IRDynamicChecks() override;
-
- /// Run this IR transformer on a single module
- ///
- /// \param[in] M
- /// The module to run on. This module is searched for the function
- /// $__lldb_expr, and that function is passed to the passes one by
- /// one.
- ///
- /// \return
- /// True on success; false otherwise
- bool runOnModule(llvm::Module &M) override;
-
- /// Interface stub
- void assignPassManager(
- llvm::PMStack &PMS,
- llvm::PassManagerType T = llvm::PMT_ModulePassManager) override;
-
- /// Returns PMT_ModulePassManager
- llvm::PassManagerType getPotentialPassManagerType() const override;
-
-private:
- /// A basic block-level pass to find all pointer dereferences and
- /// validate them before use.
-
- /// The top-level pass implementation
- ///
- /// \param[in] M
- /// The module currently being processed.
- ///
- /// \param[in] BB
- /// The basic block currently being processed.
- ///
- /// \return
- /// True on success; false otherwise
- bool FindDataLoads(llvm::Module &M, llvm::BasicBlock &BB);
-
- std::string m_func_name; ///< The name of the function to add checks to
- DynamicCheckerFunctions
- &m_checker_functions; ///< The checker functions for the process
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_IRDynamicChecks_h_
diff --git a/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h b/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h
index beff44d..ad3c737 100644
--- a/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h
+++ b/linux-x64/clang/include/lldb/Expression/IRExecutionUnit.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_IRExecutionUnit_h_
-#define liblldb_IRExecutionUnit_h_
+#ifndef LLDB_EXPRESSION_IREXECUTIONUNIT_H
+#define LLDB_EXPRESSION_IREXECUTIONUNIT_H
#include <atomic>
#include <memory>
@@ -71,7 +71,7 @@
llvm::Module *GetModule() { return m_module; }
llvm::Function *GetFunction() {
- return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString())
+ return ((m_module != nullptr) ? m_module->getFunction(m_name.GetStringRef())
: nullptr);
}
@@ -173,6 +173,8 @@
/// The address in the target process.
lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address);
+ typedef std::pair<lldb::addr_t, uintptr_t> AddrRange;
+
/// Look up the object in m_address_map that contains a given address, find
/// where it was copied to, and return its address range in the target
/// process
@@ -182,12 +184,11 @@
///
/// \return
/// The range of the containing object in the target process.
- typedef std::pair<lldb::addr_t, uintptr_t> AddrRange;
AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address);
/// Commit all allocations to the process and record where they were stored.
///
- /// \param[in] process
+ /// \param[in] process_sp
/// The process to allocate memory in.
///
/// \return
@@ -204,7 +205,7 @@
/// Write the contents of all allocations to the process.
///
- /// \param[in] local_address
+ /// \param[in] process_sp
/// The process containing the allocations.
///
/// \return
@@ -298,16 +299,18 @@
return false;
}
+ // Ignore any EHFrame registration.
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
size_t Size) override {}
+ void deregisterEHFrames() override {}
uint64_t getSymbolAddress(const std::string &Name) override;
-
+
// Find the address of the symbol Name. If Name is a missing weak symbol
// then missing_weak will be true.
- uint64_t GetSymbolAddressAndPresence(const std::string &Name,
+ uint64_t GetSymbolAddressAndPresence(const std::string &Name,
bool &missing_weak);
-
+
llvm::JITSymbol findSymbol(const std::string &Name) override;
void *getPointerToNamedFunction(const std::string &Name,
@@ -326,18 +329,16 @@
static const unsigned eSectionIDInvalid = (unsigned)-1;
- /// \class AllocationRecord IRExecutionUnit.h
- /// "lldb/Expression/IRExecutionUnit.h" Encapsulates a single allocation
- /// request made by the JIT.
- ///
- /// Allocations made by the JIT are first queued up and then applied in bulk
- /// to the underlying process.
enum class AllocationKind { Stub, Code, Data, Global, Bytes };
static lldb::SectionType
GetSectionTypeFromSectionName(const llvm::StringRef &name,
AllocationKind alloc_kind);
+ /// Encapsulates a single allocation request made by the JIT.
+ ///
+ /// Allocations made by the JIT are first queued up and then applied in bulk
+ /// to the underlying process.
struct AllocationRecord {
std::string m_name;
lldb::addr_t m_process_address;
@@ -405,4 +406,4 @@
} // namespace lldb_private
-#endif // liblldb_IRExecutionUnit_h_
+#endif // LLDB_EXPRESSION_IREXECUTIONUNIT_H
diff --git a/linux-x64/clang/include/lldb/Expression/IRInterpreter.h b/linux-x64/clang/include/lldb/Expression/IRInterpreter.h
index 6148093..98ece96 100644
--- a/linux-x64/clang/include/lldb/Expression/IRInterpreter.h
+++ b/linux-x64/clang/include/lldb/Expression/IRInterpreter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_IRInterpreter_h_
-#define liblldb_IRInterpreter_h_
+#ifndef LLDB_EXPRESSION_IRINTERPRETER_H
+#define LLDB_EXPRESSION_IRINTERPRETER_H
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Stream.h"
@@ -22,7 +22,6 @@
namespace lldb_private {
-class ClangExpressionDeclMap;
class IRMemoryMap;
}
diff --git a/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h b/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h
index d6a17a9..abec544 100644
--- a/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h
+++ b/linux-x64/clang/include/lldb/Expression/IRMemoryMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_IRMemoryMap_h_
-#define lldb_IRMemoryMap_h_
+#ifndef LLDB_EXPRESSION_IRMEMORYMAP_H
+#define LLDB_EXPRESSION_IRMEMORYMAP_H
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/UserID.h"
@@ -107,7 +107,8 @@
size_t size, uint32_t permissions, uint8_t alignment,
AllocationPolicy m_policy);
- DISALLOW_COPY_AND_ASSIGN(Allocation);
+ Allocation(const Allocation &) = delete;
+ const Allocation &operator=(const Allocation &) = delete;
};
static_assert(sizeof(Allocation) <=
diff --git a/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h b/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h
index c2af723..244a28a 100644
--- a/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h
+++ b/linux-x64/clang/include/lldb/Expression/LLVMUserExpression.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_LLVMUserExpression_h
-#define liblldb_LLVMUserExpression_h
+#ifndef LLDB_EXPRESSION_LLVMUSEREXPRESSION_H
+#define LLDB_EXPRESSION_LLVMUSEREXPRESSION_H
#include <map>
#include <string>
@@ -30,11 +30,14 @@
/// implementations of LLVMUserExpression - which will be vended through the
/// appropriate TypeSystem.
class LLVMUserExpression : public UserExpression {
+ // LLVM RTTI support
+ static char ID;
+
public:
- /// LLVM-style RTTI support.
- static bool classof(const Expression *E) {
- return E->getKind() == eKindLLVMUserExpression;
+ bool isA(const void *ClassID) const override {
+ return ClassID == &ID || UserExpression::isA(ClassID);
}
+ static bool classof(const Expression *obj) { return obj->isA(&ID); }
// The IRPasses struct is filled in by a runtime after an expression is
// compiled and can be used to to run fixups/analysis passes as required.
@@ -51,8 +54,7 @@
LLVMUserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
llvm::StringRef prefix, lldb::LanguageType language,
ResultType desired_type,
- const EvaluateExpressionOptions &options,
- ExpressionKind kind);
+ const EvaluateExpressionOptions &options);
~LLVMUserExpression() override;
bool FinalizeJITExecution(
@@ -63,12 +65,12 @@
bool CanInterpret() override { return m_can_interpret; }
+ Materializer *GetMaterializer() override { return m_materializer_up.get(); }
+
/// Return the string that the parser should parse. Must be a full
/// translation unit.
const char *Text() override { return m_transformed_text.c_str(); }
- lldb::ModuleSP GetJITModule() override;
-
protected:
lldb::ExpressionResults
DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
@@ -103,22 +105,6 @@
/// when running the
/// expression.
lldb::ModuleWP m_jit_module_wp;
- bool m_enforce_valid_object; ///< True if the expression parser should enforce
- ///the presence of a valid class pointer
- /// in order to generate the expression as a method.
- bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++
- ///member function (true if it was parsed
- /// when exe_ctx was in a C++ method).
- bool m_in_objectivec_method; ///< True if the expression is compiled as an
- ///Objective-C method (true if it was parsed
- /// when exe_ctx was in an Objective-C method).
- bool m_in_static_method; ///< True if the expression is compiled as a static
- ///(or class) method (currently true if it
- /// was parsed when exe_ctx was in an Objective-C class method).
- bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
- ///passed in. False if the expression
- /// doesn't really use them and they can be NULL.
- bool m_const_object; ///< True if "this" is const.
Target *m_target; ///< The target for storing persistent data like types and
///variables.
diff --git a/linux-x64/clang/include/lldb/Expression/Materializer.h b/linux-x64/clang/include/lldb/Expression/Materializer.h
index 603b4e0..754e67c 100644
--- a/linux-x64/clang/include/lldb/Expression/Materializer.h
+++ b/linux-x64/clang/include/lldb/Expression/Materializer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Materializer_h
-#define liblldb_Materializer_h
+#ifndef LLDB_EXPRESSION_MATERIALIZER_H
+#define LLDB_EXPRESSION_MATERIALIZER_H
#include <memory>
#include <vector>
@@ -22,14 +22,12 @@
class Materializer {
public:
- Materializer();
+ Materializer() = default;
~Materializer();
class Dematerializer {
public:
- Dematerializer()
- : m_materializer(nullptr), m_map(nullptr),
- m_process_address(LLDB_INVALID_ADDRESS) {}
+ Dematerializer() = default;
~Dematerializer() { Wipe(); }
@@ -56,11 +54,11 @@
}
}
- Materializer *m_materializer;
+ Materializer *m_materializer = nullptr;
lldb::ThreadWP m_thread_wp;
StackID m_stack_id;
- IRMemoryMap *m_map;
- lldb::addr_t m_process_address;
+ IRMemoryMap *m_map = nullptr;
+ lldb::addr_t m_process_address = LLDB_INVALID_ADDRESS;
};
typedef std::shared_ptr<Dematerializer> DematerializerSP;
@@ -115,8 +113,6 @@
void SetOffset(uint32_t offset) { m_offset = offset; }
protected:
- void SetSizeAndAlignmentFromType(CompilerType &type);
-
uint32_t m_alignment;
uint32_t m_size;
uint32_t m_offset;
@@ -130,10 +126,10 @@
DematerializerWP m_dematerializer_wp;
EntityVector m_entities;
- uint32_t m_current_offset;
- uint32_t m_struct_alignment;
+ uint32_t m_current_offset = 0;
+ uint32_t m_struct_alignment = 8;
};
} // namespace lldb_private
-#endif // liblldb_Materializer_h
+#endif // LLDB_EXPRESSION_MATERIALIZER_H
diff --git a/linux-x64/clang/include/lldb/Expression/REPL.h b/linux-x64/clang/include/lldb/Expression/REPL.h
index 850d2f6..a0df53e 100644
--- a/linux-x64/clang/include/lldb/Expression/REPL.h
+++ b/linux-x64/clang/include/lldb/Expression/REPL.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_REPL_h
-#define lldb_REPL_h
+#ifndef LLDB_EXPRESSION_REPL_H
+#define LLDB_EXPRESSION_REPL_H
#include <string>
@@ -32,7 +32,7 @@
/// Get a REPL with an existing target (or, failing that, a debugger to use),
/// and (optional) extra arguments for the compiler.
///
- /// \param[out] error
+ /// \param[out] Status
/// If this language is supported but the REPL couldn't be created, this
/// error is populated with the reason.
///
@@ -103,10 +103,8 @@
void IOHandlerInputComplete(IOHandler &io_handler,
std::string &line) override;
- int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
- const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions) override;
+ void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request) override;
protected:
static int CalculateActualIndentation(const StringList &lines);
@@ -132,8 +130,8 @@
lldb::ValueObjectSP &valobj_sp,
ExpressionVariable *var = nullptr) = 0;
- virtual int CompleteCode(const std::string ¤t_code,
- StringList &matches) = 0;
+ virtual void CompleteCode(const std::string ¤t_code,
+ CompletionRequest &request) = 0;
OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
OptionGroupValueObjectDisplay m_varobj_options;
@@ -160,4 +158,4 @@
} // namespace lldb_private
-#endif // lldb_REPL_h
+#endif // LLDB_EXPRESSION_REPL_H
diff --git a/linux-x64/clang/include/lldb/Expression/UserExpression.h b/linux-x64/clang/include/lldb/Expression/UserExpression.h
index b1d52f8..8236c41 100644
--- a/linux-x64/clang/include/lldb/Expression/UserExpression.h
+++ b/linux-x64/clang/include/lldb/Expression/UserExpression.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UserExpression_h_
-#define liblldb_UserExpression_h_
+#ifndef LLDB_EXPRESSION_USEREXPRESSION_H
+#define LLDB_EXPRESSION_USEREXPRESSION_H
#include <memory>
#include <string>
@@ -33,12 +33,13 @@
/// implementations of UserExpression - which will be vended through the
/// appropriate TypeSystem.
class UserExpression : public Expression {
+ /// LLVM RTTI support.
+ static char ID;
+
public:
- /// LLVM-style RTTI support.
- static bool classof(const Expression *E) {
- return E->getKind() == eKindUserExpression;
- }
-
+ bool isA(const void *ClassID) const override { return ClassID == &ID; }
+ static bool classof(const Expression *obj) { return obj->isA(&ID); }
+
enum { kDefaultTimeout = 500000u };
/// Constructor
@@ -46,10 +47,6 @@
/// \param[in] expr
/// The expression to parse.
///
- /// \param[in] expr_prefix
- /// If non-nullptr, a C string containing translation-unit level
- /// definitions to be included when the expression is parsed.
- ///
/// \param[in] language
/// If not eLanguageTypeUnknown, a language to use when parsing
/// the expression. Currently restricted to those languages
@@ -61,8 +58,7 @@
UserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
llvm::StringRef prefix, lldb::LanguageType language,
ResultType desired_type,
- const EvaluateExpressionOptions &options,
- ExpressionKind kind);
+ const EvaluateExpressionOptions &options);
/// Destructor
~UserExpression() override;
@@ -166,8 +162,14 @@
/// A pointer to direct at the persistent variable in which the
/// expression's result is stored.
///
- /// \param[in] function_stack_pointer
- /// A pointer to the base of the function's stack frame. This
+ /// \param[in] function_stack_bottom
+ /// A pointer to the bottom of the function's stack frame. This
+ /// is used to determine whether the expression result resides in
+ /// memory that will still be valid, or whether it needs to be
+ /// treated as homeless for the purpose of future expressions.
+ ///
+ /// \param[in] function_stack_top
+ /// A pointer to the top of the function's stack frame. This
/// is used to determine whether the expression result resides in
/// memory that will still be valid, or whether it needs to be
/// treated as homeless for the purpose of future expressions.
@@ -192,7 +194,7 @@
/// Return the language that should be used when parsing. To use the
/// default, return eLanguageTypeUnknown.
- lldb::LanguageType Language() override { return m_language; }
+ lldb::LanguageType Language() const override { return m_language; }
/// Return the desired result type of the function, or eResultTypeAny if
/// indifferent.
@@ -211,8 +213,6 @@
return lldb::ExpressionVariableSP();
}
- virtual lldb::ModuleSP GetJITModule() { return lldb::ModuleSP(); }
-
/// Evaluate one expression in the scratch context of the target passed in
/// the exe_ctx and return its result.
///
@@ -242,9 +242,6 @@
/// If non-nullptr, the fixed expression is copied into the provided
/// string.
///
- /// \param[out] jit_module_sp_ptr
- /// If non-nullptr, used to persist the generated IR module.
- ///
/// \param[in] ctx_obj
/// If specified, then the expression will be evaluated in the context of
/// this object. It means that the context object's address will be
@@ -263,7 +260,6 @@
llvm::StringRef expr_cstr, llvm::StringRef expr_prefix,
lldb::ValueObjectSP &result_valobj_sp, Status &error,
std::string *fixed_expression = nullptr,
- lldb::ModuleSP *jit_module_sp_ptr = nullptr,
ValueObject *ctx_obj = nullptr);
static const Status::ValueType kNoResult =
@@ -312,4 +308,4 @@
} // namespace lldb_private
-#endif // liblldb_UserExpression_h_
+#endif // LLDB_EXPRESSION_USEREXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Expression/UtilityFunction.h b/linux-x64/clang/include/lldb/Expression/UtilityFunction.h
index 26da081..99fb321 100644
--- a/linux-x64/clang/include/lldb/Expression/UtilityFunction.h
+++ b/linux-x64/clang/include/lldb/Expression/UtilityFunction.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UtilityFunction_h_
-#define liblldb_UtilityFunction_h_
+#ifndef LLDB_EXPRESSION_UTILITYFUNCTION_H
+#define LLDB_EXPRESSION_UTILITYFUNCTION_H
#include <memory>
#include <string>
@@ -28,12 +28,13 @@
/// self-contained function meant to be used from other code. Utility
/// functions can perform error-checking for ClangUserExpressions,
class UtilityFunction : public Expression {
+ // LLVM RTTI support
+ static char ID;
+
public:
- /// LLVM-style RTTI support.
- static bool classof(const Expression *E) {
- return E->getKind() == eKindUtilityFunction;
- }
-
+ bool isA(const void *ClassID) const override { return ClassID == &ID; }
+ static bool classof(const Expression *obj) { return obj->isA(&ID); }
+
/// Constructor
///
/// \param[in] text
@@ -41,8 +42,8 @@
///
/// \param[in] name
/// The name of the function, as used in the text.
- UtilityFunction(ExecutionContextScope &exe_scope, const char *text,
- const char *name, ExpressionKind kind);
+ UtilityFunction(ExecutionContextScope &exe_scope, std::string text,
+ std::string name);
~UtilityFunction() override;
@@ -59,16 +60,16 @@
virtual bool Install(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx) = 0;
- /// Check whether the given PC is inside the function
+ /// Check whether the given address is inside the function
///
/// Especially useful if the function dereferences nullptr to indicate a
/// failed assert.
///
- /// \param[in] pc
- /// The program counter to check.
+ /// \param[in] address
+ /// The address to check.
///
/// \return
- /// True if the program counter falls within the function's bounds;
+ /// True if the address falls within the function's bounds;
/// false if not (or the function is not JIT compiled)
bool ContainsAddress(lldb::addr_t address) {
// nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, so
@@ -109,12 +110,13 @@
protected:
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
lldb::ModuleWP m_jit_module_wp;
- std::string m_function_text; ///< The text of the function. Must be a
- ///well-formed translation unit.
- std::string m_function_name; ///< The name of the function.
+ /// The text of the function. Must be a well-formed translation unit.
+ std::string m_function_text;
+ /// The name of the function.
+ std::string m_function_name;
std::unique_ptr<FunctionCaller> m_caller_up;
};
} // namespace lldb_private
-#endif // liblldb_UtilityFunction_h_
+#endif // LLDB_EXPRESSION_UTILITYFUNCTION_H
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);
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h b/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h
index e616ad1..4426bfb 100644
--- a/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h
+++ b/linux-x64/clang/include/lldb/Initialization/SystemInitializer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
-#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
+#ifndef LLDB_INITIALIZATION_SYSTEMINITIALIZER_H
+#define LLDB_INITIALIZATION_SYSTEMINITIALIZER_H
#include "llvm/Support/Error.h"
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h b/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h
index ad7e58e..3a50816 100644
--- a/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h
+++ b/linux-x64/clang/include/lldb/Initialization/SystemInitializerCommon.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
-#define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+#ifndef LLDB_INITIALIZATION_SYSTEMINITIALIZERCOMMON_H
+#define LLDB_INITIALIZATION_SYSTEMINITIALIZERCOMMON_H
#include "SystemInitializer.h"
@@ -31,4 +31,4 @@
} // namespace lldb_private
-#endif // LLDB_INITIALIZATION_SYSTEM_INITIALIZER_COMMON_H
+#endif // LLDB_INITIALIZATION_SYSTEMINITIALIZERCOMMON_H
diff --git a/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h b/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h
index 2e99b86..27e1a22 100644
--- a/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h
+++ b/linux-x64/clang/include/lldb/Initialization/SystemLifetimeManager.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
-#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
+#ifndef LLDB_INITIALIZATION_SYSTEMLIFETIMEMANAGER_H
+#define LLDB_INITIALIZATION_SYSTEMLIFETIMEMANAGER_H
#include "lldb/Initialization/SystemInitializer.h"
#include "lldb/lldb-private-types.h"
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h b/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h
index c2a7a38..26826db 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandAlias.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandAlias_h_
-#define liblldb_CommandAlias_h_
+#ifndef LLDB_INTERPRETER_COMMANDALIAS_H
+#define LLDB_INTERPRETER_COMMANDALIAS_H
#include <memory>
@@ -36,11 +36,11 @@
bool WantsCompletion() override;
- int HandleCompletion(CompletionRequest &request) override;
+ void HandleCompletion(CompletionRequest &request) override;
- int HandleArgumentCompletion(
- CompletionRequest &request,
- OptionElementVector &opt_element_vector) override;
+ void
+ HandleArgumentCompletion(CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override;
Options *GetOptions() override;
@@ -81,4 +81,4 @@
};
} // namespace lldb_private
-#endif // liblldb_CommandAlias_h_
+#endif // LLDB_INTERPRETER_COMMANDALIAS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h b/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h
index 3d09db5..c80bde0 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandCompletions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_CommandCompletions_h_
-#define lldb_CommandCompletions_h_
+#ifndef LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
+#define LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
#include <set>
@@ -23,13 +23,6 @@
class TildeExpressionResolver;
class CommandCompletions {
public:
- // This is the command completion callback that is used to complete the
- // argument of the option it is bound to (in the OptionDefinition table
- // below). Return the total number of matches.
- typedef int (*CompletionCallback)(CommandInterpreter &interpreter,
- CompletionRequest &request,
- // A search filter to limit the search...
- lldb_private::SearchFilter *searcher);
enum CommonCompletionTypes {
eNoCompletion = 0u,
eSourceFileCompletion = (1u << 0),
@@ -41,15 +34,26 @@
ePlatformPluginCompletion = (1u << 6),
eArchitectureCompletion = (1u << 7),
eVariablePathCompletion = (1u << 8),
+ eRegisterCompletion = (1u << 9),
+ eBreakpointCompletion = (1u << 10),
+ eProcessPluginCompletion = (1u << 11),
+ eDisassemblyFlavorCompletion = (1u << 12),
+ eTypeLanguageCompletion = (1u << 13),
+ eFrameIndexCompletion = (1u << 14),
+ eModuleUUIDCompletion = (1u << 15),
+ eStopHookIDCompletion = (1u << 16),
+ eThreadIndexCompletion = (1u << 17),
+ eWatchPointIDCompletion = (1u << 18),
+ eBreakpointNameCompletion = (1u << 19),
+ eProcessIDCompletion = (1u << 20),
+ eProcessNameCompletion = (1u << 21),
+ eRemoteDiskFileCompletion = (1u << 22),
+ eRemoteDiskDirectoryCompletion = (1u << 23),
+ eTypeCategoryNameCompletion = (1u << 24),
// This item serves two purposes. It is the last element in the enum, so
// you can add custom enums starting from here in your Option class. Also
// if you & in this bit the base code will not process the option.
- eCustomCompletion = (1u << 9)
- };
-
- struct CommonCompletionElement {
- uint32_t type;
- CompletionCallback callback;
+ eCustomCompletion = (1u << 24)
};
static bool InvokeCommonCompletionCallbacks(
@@ -57,147 +61,98 @@
lldb_private::CompletionRequest &request, SearchFilter *searcher);
// These are the generic completer functions:
- static int DiskFiles(CommandInterpreter &interpreter,
- CompletionRequest &request, SearchFilter *searcher);
+ static void DiskFiles(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
- static int DiskFiles(const llvm::Twine &partial_file_name,
- StringList &matches, TildeExpressionResolver &Resolver);
+ static void DiskFiles(const llvm::Twine &partial_file_name,
+ StringList &matches, TildeExpressionResolver &Resolver);
- static int DiskDirectories(CommandInterpreter &interpreter,
- CompletionRequest &request,
- SearchFilter *searcher);
+ static void DiskDirectories(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
- static int DiskDirectories(const llvm::Twine &partial_file_name,
- StringList &matches,
- TildeExpressionResolver &Resolver);
+ static void DiskDirectories(const llvm::Twine &partial_file_name,
+ StringList &matches,
+ TildeExpressionResolver &Resolver);
- static int SourceFiles(CommandInterpreter &interpreter,
- CompletionRequest &request, SearchFilter *searcher);
+ static void RemoteDiskFiles(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
- static int Modules(CommandInterpreter &interpreter,
- CompletionRequest &request, SearchFilter *searcher);
+ static void RemoteDiskDirectories(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
- static int Symbols(CommandInterpreter &interpreter,
- CompletionRequest &request, SearchFilter *searcher);
+ static void SourceFiles(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
- static int SettingsNames(CommandInterpreter &interpreter,
+ static void Modules(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void ModuleUUIDs(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void Symbols(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void SettingsNames(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void PlatformPluginNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static void ArchitectureNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static void VariablePath(CommandInterpreter &interpreter,
CompletionRequest &request, SearchFilter *searcher);
- static int PlatformPluginNames(CommandInterpreter &interpreter,
+ static void Registers(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void Breakpoints(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void BreakpointNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static void ProcessPluginNames(CommandInterpreter &interpreter,
CompletionRequest &request,
SearchFilter *searcher);
- static int ArchitectureNames(CommandInterpreter &interpreter,
- CompletionRequest &request,
- SearchFilter *searcher);
+ static void ProcessIDs(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
- static int VariablePath(CommandInterpreter &interpreter,
+ static void ProcessNames(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void DisassemblyFlavors(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
+
+ static void TypeLanguages(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void FrameIndexes(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
+
+ static void StopHookIDs(CommandInterpreter &interpreter,
CompletionRequest &request, SearchFilter *searcher);
- // The Completer class is a convenient base class for building searchers that
- // go along with the SearchFilter passed to the standard Completer functions.
- class Completer : public Searcher {
- public:
- Completer(CommandInterpreter &interpreter, CompletionRequest &request);
+ static void ThreadIndexes(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
- ~Completer() override;
+ static void WatchPointIDs(CommandInterpreter &interpreter,
+ CompletionRequest &request, SearchFilter *searcher);
- CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
- Address *addr, bool complete) override = 0;
-
- lldb::SearchDepth GetDepth() override = 0;
-
- virtual size_t DoCompletion(SearchFilter *filter) = 0;
-
- protected:
- CommandInterpreter &m_interpreter;
- CompletionRequest &m_request;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Completer);
- };
-
- // SourceFileCompleter implements the source file completer
- class SourceFileCompleter : public Completer {
- public:
- SourceFileCompleter(CommandInterpreter &interpreter,
- bool include_support_files, CompletionRequest &request);
-
- lldb::SearchDepth GetDepth() override;
-
- Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete) override;
-
- size_t DoCompletion(SearchFilter *filter) override;
-
- private:
- bool m_include_support_files;
- FileSpecList m_matching_files;
- const char *m_file_name;
- const char *m_dir_name;
-
- DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
- };
-
- // ModuleCompleter implements the module completer
- class ModuleCompleter : public Completer {
- public:
- ModuleCompleter(CommandInterpreter &interpreter,
- CompletionRequest &request);
-
- lldb::SearchDepth GetDepth() override;
-
- Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete) override;
-
- size_t DoCompletion(SearchFilter *filter) override;
-
- private:
- const char *m_file_name;
- const char *m_dir_name;
-
- DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
- };
-
- // SymbolCompleter implements the symbol completer
- class SymbolCompleter : public Completer {
- public:
- SymbolCompleter(CommandInterpreter &interpreter,
- CompletionRequest &request);
-
- lldb::SearchDepth GetDepth() override;
-
- Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete) override;
-
- size_t DoCompletion(SearchFilter *filter) override;
-
- private:
- // struct NameCmp {
- // bool operator() (const ConstString& lhs, const ConstString&
- // rhs) const
- // {
- // return lhs < rhs;
- // }
- // };
-
- RegularExpression m_regex;
- typedef std::set<ConstString> collection;
- collection m_match_set;
-
- DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
- };
-
-private:
- static CommonCompletionElement g_common_completions[];
+ static void TypeCategoryNames(CommandInterpreter &interpreter,
+ CompletionRequest &request,
+ SearchFilter *searcher);
};
} // namespace lldb_private
-#endif // lldb_CommandCompletions_h_
+#endif // LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h b/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h
index c1386f8..fbb4224 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandHistory.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandHistory_h_
-#define liblldb_CommandHistory_h_
+#ifndef LLDB_INTERPRETER_COMMANDHISTORY_H
+#define LLDB_INTERPRETER_COMMANDHISTORY_H
#include <mutex>
#include <string>
@@ -46,7 +46,8 @@
static const char g_repeat_char = '!';
private:
- DISALLOW_COPY_AND_ASSIGN(CommandHistory);
+ CommandHistory(const CommandHistory &) = delete;
+ const CommandHistory &operator=(const CommandHistory &) = delete;
typedef std::vector<std::string> History;
mutable std::recursive_mutex m_mutex;
@@ -55,4 +56,4 @@
} // namespace lldb_private
-#endif // liblldb_CommandHistory_h_
+#endif // LLDB_INTERPRETER_COMMANDHISTORY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h b/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h
index c3dd660..c4f9dd2 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandInterpreter.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandInterpreter_h_
-#define liblldb_CommandInterpreter_h_
+#ifndef LLDB_INTERPRETER_COMMANDINTERPRETER_H
+#define LLDB_INTERPRETER_COMMANDINTERPRETER_H
#include "lldb/Core/Debugger.h"
#include "lldb/Core/IOHandler.h"
@@ -20,12 +20,39 @@
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/Event.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
#include <mutex>
namespace lldb_private {
+class CommandInterpreter;
+
+class CommandInterpreterRunResult {
+public:
+ CommandInterpreterRunResult()
+ : m_num_errors(0), m_result(lldb::eCommandInterpreterResultSuccess) {}
+
+ uint32_t GetNumErrors() const { return m_num_errors; }
+
+ lldb::CommandInterpreterResult GetResult() const { return m_result; }
+
+ bool IsResult(lldb::CommandInterpreterResult result) {
+ return m_result == result;
+ }
+
+protected:
+ friend CommandInterpreter;
+
+ void IncrementNumberOfErrors() { m_num_errors++; }
+
+ void SetResult(lldb::CommandInterpreterResult result) { m_result = result; }
+
+private:
+ int m_num_errors;
+ lldb::CommandInterpreterResult m_result;
+};
class CommandInterpreterRunOptions {
public:
@@ -51,7 +78,7 @@
/// \param[in] echo_comments
/// If \b true, echo command even if it is a pure comment line. If
/// \b false, print no ouput in this case. This setting has an effect only
- /// if \param echo_commands is \b true.
+ /// if echo_commands is \b true.
/// \param[in] print_results
/// If \b true and the command succeeds, print the results of the command
/// after executing it. If \b false, execute silently.
@@ -144,6 +171,20 @@
m_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo;
}
+ bool GetAutoHandleEvents() const {
+ return DefaultToYes(m_auto_handle_events);
+ }
+
+ void SetAutoHandleEvents(bool auto_handle_events) {
+ m_auto_handle_events = auto_handle_events ? eLazyBoolYes : eLazyBoolNo;
+ }
+
+ bool GetSpawnThread() const { return DefaultToNo(m_spawn_thread); }
+
+ void SetSpawnThread(bool spawn_thread) {
+ m_spawn_thread = spawn_thread ? eLazyBoolYes : eLazyBoolNo;
+ }
+
LazyBool m_stop_on_continue;
LazyBool m_stop_on_error;
LazyBool m_stop_on_crash;
@@ -152,6 +193,8 @@
LazyBool m_print_results;
LazyBool m_print_errors;
LazyBool m_add_to_history;
+ LazyBool m_auto_handle_events;
+ LazyBool m_spawn_thread;
private:
static bool DefaultToYes(LazyBool flag) {
@@ -213,7 +256,7 @@
}
void SourceInitFileCwd(CommandReturnObject &result);
- void SourceInitFileHome(CommandReturnObject &result);
+ void SourceInitFileHome(CommandReturnObject &result, bool is_repl = false);
bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
bool can_replace);
@@ -222,7 +265,7 @@
bool can_replace);
lldb::CommandObjectSP GetCommandSPExact(llvm::StringRef cmd,
- bool include_aliases) const;
+ bool include_aliases = false) const;
CommandObject *GetCommandObject(llvm::StringRef cmd,
StringList *matches = nullptr,
@@ -308,31 +351,16 @@
CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
- // This handles command line completion. You are given a pointer to the
- // command string buffer, to the current cursor, and to the end of the string
- // (in case it is not NULL terminated). You also passed in an StringList
- // object to fill with the returns. The first element of the array will be
- // filled with the string that you would need to insert at the cursor point
- // to complete the cursor point to the longest common matching prefix. If you
- // want to limit the number of elements returned, set max_return_elements to
- // the number of elements you want returned. Otherwise set
- // max_return_elements to -1. If you want to start some way into the match
- // list, then set match_start_point to the desired start point. Returns: -1
- // if the completion character should be inserted -2 if the entire command
- // line should be deleted and replaced with matches.GetStringAtIndex(0)
- // INT_MAX if the number of matches is > max_return_elements, but it is
- // expensive to compute. Otherwise, returns the number of matches.
- //
- // FIXME: Only max_return_elements == -1 is supported at present.
- int HandleCompletion(const char *current_line, const char *cursor,
- const char *last_char, int match_start_point,
- int max_return_elements, StringList &matches,
- StringList &descriptions);
+ /// Returns the auto-suggestion string that should be added to the given
+ /// command line.
+ llvm::Optional<std::string> GetAutoSuggestionForCommand(llvm::StringRef line);
- // This version just returns matches, and doesn't compute the substring. It
- // is here so the Help command can call it for the first argument. It uses
- // a CompletionRequest for simplicity reasons.
- int HandleCompletionMatches(CompletionRequest &request);
+ // This handles command line completion.
+ void HandleCompletion(CompletionRequest &request);
+
+ // This version just returns matches, and doesn't compute the substring. It
+ // is here so the Help command can call it for the first argument.
+ void HandleCompletionMatches(CompletionRequest &request);
int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
bool include_aliases,
@@ -445,15 +473,16 @@
bool IsActive();
- void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
- CommandInterpreterRunOptions &options);
+ CommandInterpreterRunResult
+ RunCommandInterpreter(CommandInterpreterRunOptions &options);
+
void GetLLDBCommandsFromIOHandler(const char *prompt,
IOHandlerDelegate &delegate,
- bool asynchronously, void *baton);
+ void *baton = nullptr);
void GetPythonCommandsFromIOHandler(const char *prompt,
IOHandlerDelegate &delegate,
- bool asynchronously, void *baton);
+ void *baton = nullptr);
const char *GetCommandPrefix();
@@ -461,14 +490,26 @@
bool GetExpandRegexAliases() const;
bool GetPromptOnQuit() const;
+ void SetPromptOnQuit(bool enable);
- void SetPromptOnQuit(bool b);
+ bool GetSaveSessionOnQuit() const;
+ void SetSaveSessionOnQuit(bool enable);
bool GetEchoCommands() const;
- void SetEchoCommands(bool b);
+ void SetEchoCommands(bool enable);
bool GetEchoCommentCommands() const;
- void SetEchoCommentCommands(bool b);
+ void SetEchoCommentCommands(bool enable);
+
+ const CommandObject::CommandMap &GetUserCommands() const {
+ return m_user_dict;
+ }
+
+ const CommandObject::CommandMap &GetCommands() const {
+ return m_command_dict;
+ }
+
+ const CommandObject::CommandMap &GetAliases() const { return m_alias_dict; }
/// Specify if the command interpreter should allow that the user can
/// specify a custom exit code when calling 'quit'.
@@ -492,18 +533,26 @@
bool GetStopCmdSourceOnError() const;
- uint32_t GetNumErrors() const { return m_num_errors; }
-
- bool GetQuitRequested() const { return m_quit_requested; }
-
lldb::IOHandlerSP
GetIOHandler(bool force_create = false,
CommandInterpreterRunOptions *options = nullptr);
- bool GetStoppedForCrash() const { return m_stopped_for_crash; }
-
bool GetSpaceReplPrompts() const;
+ /// Save the current debugger session transcript to a file on disk.
+ /// \param output_file
+ /// The file path to which the session transcript will be written. Since
+ /// the argument is optional, an arbitrary temporary file will be create
+ /// when no argument is passed.
+ /// \param result
+ /// This is used to pass function output and error messages.
+ /// \return \b true if the session transcript was successfully written to
+ /// disk, \b false otherwise.
+ bool SaveTranscript(CommandReturnObject &result,
+ llvm::Optional<std::string> output_file = llvm::None);
+
+ FileSpec GetCurrentSourceDir();
+
protected:
friend class Debugger;
@@ -519,7 +568,9 @@
bool IOHandlerInterrupt(IOHandler &io_handler) override;
- size_t GetProcessOutput();
+ void GetProcessOutput();
+
+ bool DidProcessStopAbnormally() const;
void SetSynchronous(bool value);
@@ -588,19 +639,25 @@
ChildrenTruncatedWarningStatus m_truncation_warning; // Whether we truncated
// children and whether
// the user has been told
+
+ // FIXME: Stop using this to control adding to the history and then replace
+ // this with m_command_source_dirs.size().
uint32_t m_command_source_depth;
+ /// A stack of directory paths. When not empty, the last one is the directory
+ /// of the file that's currently sourced.
+ std::vector<FileSpec> m_command_source_dirs;
std::vector<uint32_t> m_command_source_flags;
- uint32_t m_num_errors;
- bool m_quit_requested;
- bool m_stopped_for_crash;
+ CommandInterpreterRunResult m_result;
// The exit code the user has requested when calling the 'quit' command.
// No value means the user hasn't set a custom exit code so far.
llvm::Optional<int> m_quit_exit_code;
// If the driver is accepts custom exit codes for the 'quit' command.
bool m_allow_exit_code = false;
+
+ StreamString m_transcript_stream;
};
} // namespace lldb_private
-#endif // liblldb_CommandInterpreter_h_
+#endif // LLDB_INTERPRETER_COMMANDINTERPRETER_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObject.h b/linux-x64/clang/include/lldb/Interpreter/CommandObject.h
index 31f7f12..d5ad969 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandObject.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandObject.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandObject_h_
-#define liblldb_CommandObject_h_
+#ifndef LLDB_INTERPRETER_COMMANDOBJECT_H
+#define LLDB_INTERPRETER_COMMANDOBJECT_H
#include <map>
#include <string>
@@ -40,7 +40,7 @@
const bool add_all = cmd_str.empty();
for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
- if (add_all || (iter->first.find(cmd_str, 0) == 0)) {
+ if (add_all || (iter->first.find(std::string(cmd_str), 0) == 0)) {
++number_added;
matches.AppendString(iter->first.c_str());
if (descriptions)
@@ -90,14 +90,15 @@
{
lldb::CommandArgumentType arg_type;
ArgumentRepetitionType arg_repetition;
- uint32_t arg_opt_set_association; // This arg might be associated only with
- // some particular option set(s).
- CommandArgumentData()
- : arg_type(lldb::eArgTypeNone), arg_repetition(eArgRepeatPlain),
- arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg
- // associates to all option
- // sets.
- {}
+ /// This arg might be associated only with some particular option set(s). By
+ /// default the arg associates to all option sets.
+ uint32_t arg_opt_set_association;
+
+ CommandArgumentData(lldb::CommandArgumentType type = lldb::eArgTypeNone,
+ ArgumentRepetitionType repetition = eArgRepeatPlain,
+ uint32_t opt_set = LLDB_OPT_SET_ALL)
+ : arg_type(type), arg_repetition(repetition),
+ arg_opt_set_association(opt_set) {}
};
typedef std::vector<CommandArgumentData>
@@ -226,38 +227,20 @@
/// option. Don't override this method, override HandleArgumentCompletion
/// instead unless you have special reasons.
///
- /// \param[in/out] request
+ /// \param[in,out] request
/// The completion request that needs to be answered.
- ///
- /// FIXME: This is the wrong return value, since we also need to make a
- /// distinction between
- /// total number of matches, and the window the user wants returned.
- ///
- /// \return
- /// \btrue if we were in an option, \bfalse otherwise.
- virtual int HandleCompletion(CompletionRequest &request);
+ virtual void HandleCompletion(CompletionRequest &request);
- /// The input array contains a parsed version of the line. The insertion
- /// point is given by cursor_index (the index in input of the word containing
- /// the cursor) and cursor_char_position (the position of the cursor in that
- /// word.)
+ /// The input array contains a parsed version of the line.
+ ///
/// We've constructed the map of options and their arguments as well if that
/// is helpful for the completion.
///
- /// \param[in/out] request
+ /// \param[in,out] request
/// The completion request that needs to be answered.
- ///
- /// FIXME: This is the wrong return value, since we also need to make a
- /// distinction between
- /// total number of matches, and the window the user wants returned.
- ///
- /// \return
- /// The number of completions.
- virtual int
+ virtual void
HandleArgumentCompletion(CompletionRequest &request,
- OptionElementVector &opt_element_vector) {
- return 0;
- }
+ OptionElementVector &opt_element_vector) {}
bool HelpTextContainsWord(llvm::StringRef search_word,
bool search_short_help = true,
@@ -279,8 +262,8 @@
/// Get the command that appropriate for a "repeat" of the current command.
///
- /// \param[in] current_command_line
- /// The complete current command line.
+ /// \param[in] current_command_args
+ /// The command arguments.
///
/// \return
/// nullptr if there is no special repeat command - it will use the
@@ -348,8 +331,9 @@
// This is for use in the command interpreter, when you either want the
// selected target, or if no target is present you want to prime the dummy
// target with entities that will be copied over to new targets.
- Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
- Target *GetDummyTarget();
+ Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
+ Target &GetSelectedTarget();
+ Target &GetDummyTarget();
// If a command needs to use the "current" thread, use this call. Command
// objects will have an ExecutionContext to use, and that may or may not have
@@ -428,4 +412,4 @@
} // namespace lldb_private
-#endif // liblldb_CommandObject_h_
+#endif // LLDB_INTERPRETER_COMMANDOBJECT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h b/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h
index 660e9d4..f330a74 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandObjectMultiword.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandObjectMultiword_h_
-#define liblldb_CommandObjectMultiword_h_
+#ifndef LLDB_INTERPRETER_COMMANDOBJECTMULTIWORD_H
+#define LLDB_INTERPRETER_COMMANDOBJECTMULTIWORD_H
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Utility/CompletionRequest.h"
@@ -50,7 +50,7 @@
bool WantsRawCommandString() override { return false; }
- int HandleCompletion(CompletionRequest &request) override;
+ void HandleCompletion(CompletionRequest &request) override;
const char *GetRepeatCommand(Args ¤t_command_args,
uint32_t index) override;
@@ -82,6 +82,10 @@
// for this object.
virtual CommandObject *GetProxyCommandObject() = 0;
+ llvm::StringRef GetSyntax() override;
+
+ llvm::StringRef GetHelp() override;
+
llvm::StringRef GetHelpLong() override;
bool IsRemovable() const override;
@@ -112,15 +116,20 @@
Options *GetOptions() override;
- int HandleCompletion(CompletionRequest &request) override;
+ void HandleCompletion(CompletionRequest &request) override;
- int HandleArgumentCompletion(
- CompletionRequest &request,
- OptionElementVector &opt_element_vector) override;
+ void
+ HandleArgumentCompletion(CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override;
const char *GetRepeatCommand(Args ¤t_command_args,
uint32_t index) override;
+ /// \return
+ /// An error message to be displayed when the command is executed (i.e.
+ /// Execute is called) and \a GetProxyCommandObject returned null.
+ virtual llvm::StringRef GetUnsupportedError();
+
bool Execute(const char *args_string, CommandReturnObject &result) override;
protected:
@@ -131,4 +140,4 @@
} // namespace lldb_private
-#endif // liblldb_CommandObjectMultiword_h_
+#endif // LLDB_INTERPRETER_COMMANDOBJECTMULTIWORD_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h b/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h
deleted file mode 100644
index 7f06e26..0000000
--- a/linux-x64/clang/include/lldb/Interpreter/CommandObjectRegexCommand.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- CommandObjectRegexCommand.h -----------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CommandObjectRegexCommand_h_
-#define liblldb_CommandObjectRegexCommand_h_
-
-#include <list>
-
-#include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Utility/CompletionRequest.h"
-#include "lldb/Utility/RegularExpression.h"
-
-namespace lldb_private {
-
-// CommandObjectRegexCommand
-
-class CommandObjectRegexCommand : public CommandObjectRaw {
-public:
- CommandObjectRegexCommand(CommandInterpreter &interpreter, llvm::StringRef name,
- llvm::StringRef help, llvm::StringRef syntax,
- uint32_t max_matches, uint32_t completion_type_mask,
- bool is_removable);
-
- ~CommandObjectRegexCommand() override;
-
- bool IsRemovable() const override { return m_is_removable; }
-
- bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
-
- bool HasRegexEntries() const { return !m_entries.empty(); }
-
- int HandleCompletion(CompletionRequest &request) override;
-
-protected:
- bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
-
- struct Entry {
- RegularExpression regex;
- std::string command;
- };
-
- typedef std::list<Entry> EntryCollection;
- const uint32_t m_max_matches;
- const uint32_t m_completion_type_mask;
- EntryCollection m_entries;
- bool m_is_removable;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CommandObjectRegexCommand);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectRegexCommand_h_
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h b/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h
index 5483c15..218cc87 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandOptionValidators.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandOptionValidators_h_
-#define liblldb_CommandOptionValidators_h_
+#ifndef LLDB_INTERPRETER_COMMANDOPTIONVALIDATORS_H
+#define LLDB_INTERPRETER_COMMANDOPTIONVALIDATORS_H
#include "lldb/lldb-private-types.h"
@@ -25,4 +25,4 @@
} // namespace lldb_private
-#endif // liblldb_CommandOptionValidators_h_
+#endif // LLDB_INTERPRETER_COMMANDOPTIONVALIDATORS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h b/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h
index a5f6126..a7c2eea 100644
--- a/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h
+++ b/linux-x64/clang/include/lldb/Interpreter/CommandReturnObject.h
@@ -6,10 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CommandReturnObject_h_
-#define liblldb_CommandReturnObject_h_
+#ifndef LLDB_INTERPRETER_COMMANDRETURNOBJECT_H
+#define LLDB_INTERPRETER_COMMANDRETURNOBJECT_H
-#include "lldb/Core/STLUtils.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StreamTee.h"
@@ -17,6 +16,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/WithColor.h"
#include <memory>
@@ -24,21 +24,21 @@
class CommandReturnObject {
public:
- CommandReturnObject();
+ CommandReturnObject(bool colors);
~CommandReturnObject();
llvm::StringRef GetOutputData() {
lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
if (stream_sp)
- return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return std::static_pointer_cast<StreamString>(stream_sp)->GetString();
return llvm::StringRef();
}
llvm::StringRef GetErrorData() {
lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
if (stream_sp)
- return static_pointer_cast<StreamString>(stream_sp)->GetString();
+ return std::static_pointer_cast<StreamString>(stream_sp)->GetString();
return llvm::StringRef();
}
@@ -46,7 +46,7 @@
// Make sure we at least have our normal string stream output stream
lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
if (!stream_sp) {
- stream_sp.reset(new StreamString());
+ stream_sp = std::make_shared<StreamString>();
m_out_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
}
return m_out_stream;
@@ -56,19 +56,19 @@
// Make sure we at least have our normal string stream output stream
lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
if (!stream_sp) {
- stream_sp.reset(new StreamString());
+ stream_sp = std::make_shared<StreamString>();
m_err_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
}
return m_err_stream;
}
- void SetImmediateOutputFile(FILE *fh, bool transfer_fh_ownership = false) {
- lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+ void SetImmediateOutputFile(lldb::FileSP file_sp) {
+ lldb::StreamSP stream_sp(new StreamFile(file_sp));
m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
}
- void SetImmediateErrorFile(FILE *fh, bool transfer_fh_ownership = false) {
- lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+ void SetImmediateErrorFile(lldb::FileSP file_sp) {
+ lldb::StreamSP stream_sp(new StreamFile(file_sp));
m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
}
@@ -144,14 +144,6 @@
void SetInteractive(bool b);
- bool GetAbnormalStopWasExpected() const {
- return m_abnormal_stop_was_expected;
- }
-
- void SetAbnormalStopWasExpected(bool signal_was_expected) {
- m_abnormal_stop_was_expected = signal_was_expected;
- }
-
private:
enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
@@ -162,16 +154,8 @@
bool m_did_change_process_state;
bool m_interactive; // If true, then the input handle from the debugger will
// be hooked up
- bool m_abnormal_stop_was_expected; // This is to support
- // eHandleCommandFlagStopOnCrash vrs.
- // attach.
- // The attach command often ends up with the process stopped due to a signal.
- // Normally that would mean stop on crash should halt batch execution, but we
- // obviously don't want that for attach. Using this flag, the attach command
- // (and anything else for which this is relevant) can say that the signal is
- // expected, and batch command execution can continue.
};
} // namespace lldb_private
-#endif // liblldb_CommandReturnObject_h_
+#endif // LLDB_INTERPRETER_COMMANDRETURNOBJECT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h
index 4b7f9fe..1eadf45 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupArchitecture.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupArchitecture_h_
-#define liblldb_OptionGroupArchitecture_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPARCHITECTURE_H
+#define LLDB_INTERPRETER_OPTIONGROUPARCHITECTURE_H
#include "lldb/Interpreter/Options.h"
#include "lldb/Utility/ArchSpec.h"
@@ -42,4 +42,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupArchitecture_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPARCHITECTURE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h
index 7749045..061e313 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupBoolean.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupBoolean_h_
-#define liblldb_OptionGroupBoolean_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
+#define LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/Options.h"
@@ -48,4 +48,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupBoolean_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPBOOLEAN_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h
index cce3714..374cf10 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupFile_h_
-#define liblldb_OptionGroupFile_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPFILE_H
+#define LLDB_INTERPRETER_OPTIONGROUPFILE_H
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
@@ -78,4 +78,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupFile_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPFILE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h
index 1b5020a..62c6f97 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupFormat.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupFormat_h_
-#define liblldb_OptionGroupFormat_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPFORMAT_H
+#define LLDB_INTERPRETER_OPTIONGROUPFORMAT_H
#include "lldb/Interpreter/OptionValueFormat.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
@@ -78,4 +78,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupFormat_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPFORMAT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h
index 82d68b7..a71998f 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupOutputFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupOutputFile_h_
-#define liblldb_OptionGroupOutputFile_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPOUTPUTFILE_H
+#define LLDB_INTERPRETER_OPTIONGROUPOUTPUTFILE_H
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
@@ -45,4 +45,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupOutputFile_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPOUTPUTFILE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h
index ea5a3f3..99945e5 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupPlatform_h_
-#define liblldb_OptionGroupPlatform_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
+#define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
#include "lldb/Interpreter/Options.h"
#include "lldb/Utility/ConstString.h"
@@ -70,4 +70,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupPlatform_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
new file mode 100644
index 0000000..d4c924a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
@@ -0,0 +1,63 @@
+//===-- OptionGroupPythonClassWithDict.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_OPTIONGROUPPYTHONCLASSWITHDICT_H
+#define LLDB_INTERPRETER_OPTIONGROUPPYTHONCLASSWITHDICT_H
+
+#include "lldb/lldb-types.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+
+// Use this Option group if you have a python class that implements some
+// Python extension point, and you pass a SBStructuredData to the class
+// __init__ method.
+// class_option specifies the class name
+// the key and value options are read in in pairs, and a
+// StructuredData::Dictionary is constructed with those pairs.
+class OptionGroupPythonClassWithDict : public OptionGroup {
+public:
+ OptionGroupPythonClassWithDict(const char *class_use,
+ bool is_class = true,
+ int class_option = 'C',
+ int key_option = 'k',
+ int value_option = 'v');
+
+ ~OptionGroupPythonClassWithDict() override;
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef<OptionDefinition>(m_option_definition);
+ }
+
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+ ExecutionContext *execution_context) override;
+ Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+ Status OptionParsingFinished(ExecutionContext *execution_context) override;
+
+ const StructuredData::DictionarySP GetStructuredData() {
+ return m_dict_sp;
+ }
+ const std::string &GetName() {
+ return m_name;
+ }
+
+protected:
+ std::string m_name;
+ std::string m_current_key;
+ StructuredData::DictionarySP m_dict_sp;
+ std::string m_class_usage_text, m_key_usage_text, m_value_usage_text;
+ bool m_is_class;
+ OptionDefinition m_option_definition[4];
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_OPTIONGROUPPYTHONCLASSWITHDICT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h
index ce10589..1a3b5bd 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupString.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupString_h_
-#define liblldb_OptionGroupString_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPSTRING_H
+#define LLDB_INTERPRETER_OPTIONGROUPSTRING_H
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/Options.h"
@@ -45,4 +45,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupString_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPSTRING_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h
index 12f08a3..783c4b6 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUInt64.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupUInt64_h_
-#define liblldb_OptionGroupUInt64_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPUINT64_H
+#define LLDB_INTERPRETER_OPTIONGROUPUINT64_H
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/Options.h"
@@ -46,4 +46,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupUInt64_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPUINT64_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h
index 22fc3a1..b1c779f 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupUUID.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupUUID_h_
-#define liblldb_OptionGroupUUID_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPUUID_H
+#define LLDB_INTERPRETER_OPTIONGROUPUUID_H
#include "lldb/Interpreter/OptionValueUUID.h"
#include "lldb/Interpreter/Options.h"
@@ -38,4 +38,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupUUID_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPUUID_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
index 5a1bbc9..1ad5332 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupValueObjectDisplay_h_
-#define liblldb_OptionGroupValueObjectDisplay_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPVALUEOBJECTDISPLAY_H
+#define LLDB_INTERPRETER_OPTIONGROUPVALUEOBJECTDISPLAY_H
#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/Options.h"
@@ -55,4 +55,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionGroupValueObjectDisplay_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPVALUEOBJECTDISPLAY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h
index 0c042f4..252ca3b 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupVariable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupVariable_h_
-#define liblldb_OptionGroupVariable_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPVARIABLE_H
+#define LLDB_INTERPRETER_OPTIONGROUPVARIABLE_H
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/Options.h"
@@ -41,9 +41,10 @@
OptionValueString summary_string; // a summary string
private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupVariable);
+ OptionGroupVariable(const OptionGroupVariable &) = delete;
+ const OptionGroupVariable &operator=(const OptionGroupVariable &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupVariable_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPVARIABLE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h b/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h
index 3729c00..6a6c863 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionGroupWatchpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionGroupWatchpoint_h_
-#define liblldb_OptionGroupWatchpoint_h_
+#ifndef LLDB_INTERPRETER_OPTIONGROUPWATCHPOINT_H
+#define LLDB_INTERPRETER_OPTIONGROUPWATCHPOINT_H
#include "lldb/Interpreter/Options.h"
@@ -46,9 +46,11 @@
bool watch_type_specified;
private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint);
+ OptionGroupWatchpoint(const OptionGroupWatchpoint &) = delete;
+ const OptionGroupWatchpoint &
+ operator=(const OptionGroupWatchpoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_OptionGroupWatchpoint_h_
+#endif // LLDB_INTERPRETER_OPTIONGROUPWATCHPOINT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValue.h b/linux-x64/clang/include/lldb/Interpreter/OptionValue.h
index 0b85bc1..a8176e3 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValue.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValue.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValue_h_
-#define liblldb_OptionValue_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUE_H
+#define LLDB_INTERPRETER_OPTIONVALUE_H
#include "lldb/Core/FormatEntity.h"
#include "lldb/Utility/CompletionRequest.h"
@@ -31,6 +31,7 @@
eTypeChar,
eTypeDictionary,
eTypeEnum,
+ eTypeFileLineColumn,
eTypeFileSpec,
eTypeFileSpecList,
eTypeFormat,
@@ -58,12 +59,7 @@
eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue)
};
- OptionValue()
- : m_callback(nullptr), m_baton(nullptr), m_value_was_set(false) {}
-
- OptionValue(const OptionValue &rhs)
- : m_callback(rhs.m_callback), m_baton(rhs.m_baton),
- m_value_was_set(rhs.m_value_was_set) {}
+ OptionValue() : m_value_was_set(false) {}
virtual ~OptionValue() = default;
@@ -89,12 +85,12 @@
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
- virtual bool Clear() = 0;
+ virtual void Clear() = 0;
virtual lldb::OptionValueSP DeepCopy() const = 0;
- virtual size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request);
+ virtual void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request);
// Subclasses can override these functions
virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
@@ -140,6 +136,8 @@
return eTypeDictionary;
case 1u << eTypeEnum:
return eTypeEnum;
+ case 1u << eTypeFileLineColumn:
+ return eTypeFileLineColumn;
case 1u << eTypeFileSpec:
return eTypeFileSpec;
case 1u << eTypeFileSpecList:
@@ -308,22 +306,19 @@
m_parent_wp = parent_sp;
}
- void SetValueChangedCallback(OptionValueChangedCallback callback,
- void *baton) {
- assert(m_callback == nullptr);
- m_callback = callback;
- m_baton = baton;
+ void SetValueChangedCallback(std::function<void()> callback) {
+ assert(!m_callback);
+ m_callback = std::move(callback);
}
void NotifyValueChanged() {
if (m_callback)
- m_callback(m_baton, this);
+ m_callback();
}
protected:
lldb::OptionValueWP m_parent_wp;
- OptionValueChangedCallback m_callback;
- void *m_baton;
+ std::function<void()> m_callback;
bool m_value_was_set; // This can be used to see if a value has been set
// by a call to SetValueFromCString(). It is often
// handy to know if an option value was set from the
@@ -334,4 +329,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValue_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h
index f8f4068..809261e 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArch.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueArch_h_
-#define liblldb_OptionValueArch_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEARCH_H
+#define LLDB_INTERPRETER_OPTIONVALUEARCH_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Utility/ArchSpec.h"
@@ -47,16 +47,15 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
- size_t AutoComplete(CommandInterpreter &interpreter,
- lldb_private::CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ lldb_private::CompletionRequest &request) override;
// Subclass specific functions
@@ -81,4 +80,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueArch_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEARCH_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h
index 0254b9a..25f7fdd 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArgs.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueArgs_h_
-#define liblldb_OptionValueArgs_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEARGS_H
+#define LLDB_INTERPRETER_OPTIONVALUEARGS_H
#include "lldb/Interpreter/OptionValueArray.h"
@@ -28,4 +28,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueArgs_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEARGS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h
index 10f3bf5..4546bbb 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueArray.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueArray_h_
-#define liblldb_OptionValueArray_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEARRAY_H
+#define LLDB_INTERPRETER_OPTIONVALUEARRAY_H
#include <vector>
@@ -36,10 +36,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_values.clear();
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -125,4 +124,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueArray_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEARRAY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h
index 2fc97d4..1af14a4 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueBoolean.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueBoolean_h_
-#define liblldb_OptionValueBoolean_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEBOOLEAN_H
+#define LLDB_INTERPRETER_OPTIONVALUEBOOLEAN_H
#include "lldb/Interpreter/OptionValue.h"
@@ -37,14 +37,13 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
- size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
// Subclass specific functions
@@ -85,4 +84,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueBoolean_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEBOOLEAN_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h
index d866136..a8ecf50 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueChar.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueChar_h_
-#define liblldb_OptionValueChar_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUECHAR_H
+#define LLDB_INTERPRETER_OPTIONVALUECHAR_H
#include "lldb/Interpreter/OptionValue.h"
@@ -38,10 +38,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
// Subclass specific functions
@@ -68,4 +67,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueChar_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUECHAR_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h
index 8785d38..dab1c3e 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueDictionary.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueDictionary_h_
-#define liblldb_OptionValueDictionary_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
+#define LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
#include <map>
@@ -35,10 +35,9 @@
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
- bool Clear() override {
+ void Clear() override {
m_values.clear();
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -81,4 +80,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueDictionary_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEDICTIONARY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h
index 71f3ab5..12c6473 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueEnumeration_h_
-#define liblldb_OptionValueEnumeration_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
+#define LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Interpreter/OptionValue.h"
@@ -47,16 +47,15 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
- size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
// Subclass specific functions
@@ -83,4 +82,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueEnumeration_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEENUMERATION_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileColonLine.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileColonLine.h
new file mode 100644
index 0000000..713deea
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileColonLine.h
@@ -0,0 +1,64 @@
+//===-- OptionValueFileColonLine.h ------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_OPTIONVALUEFILECOLONLINE_H
+#define LLDB_INTERPRETER_OPTIONVALUEFILECOLONLINE_H
+
+#include "lldb/Interpreter/OptionValue.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/Chrono.h"
+
+namespace lldb_private {
+
+class OptionValueFileColonLine : public OptionValue {
+public:
+ OptionValueFileColonLine();
+ OptionValueFileColonLine(const llvm::StringRef input);
+
+ ~OptionValueFileColonLine() override {}
+
+ OptionValue::Type GetType() const override { return eTypeFileLineColumn; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Status
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+ Status
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
+
+ void Clear() override {
+ m_file_spec.Clear();
+ m_line_number = LLDB_INVALID_LINE_NUMBER;
+ m_column_number = LLDB_INVALID_COLUMN_NUMBER;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
+
+ FileSpec &GetFileSpec() { return m_file_spec; }
+ uint32_t GetLineNumber() { return m_line_number; }
+ uint32_t GetColumnNumber() { return m_column_number; }
+
+ void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
+
+protected:
+ FileSpec m_file_spec;
+ uint32_t m_line_number;
+ uint32_t m_column_number;
+ uint32_t m_completion_mask;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_OPTIONVALUEFILECOLONLINE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h
index aa1022a..4fde3f6 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueFileSpec_h_
-#define liblldb_OptionValueFileSpec_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
+#define LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
#include "lldb/Interpreter/OptionValue.h"
@@ -41,18 +41,17 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
m_data_sp.reset();
m_data_mod_time = llvm::sys::TimePoint<>();
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
- size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
// Subclass specific functions
@@ -86,4 +85,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueFileSpec_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEFILESPEC_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h
index 5607437..3877352 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFileSpecList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueFileSpecList_h_
-#define liblldb_OptionValueFileSpecList_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEFILESPECLIST_H
+#define LLDB_INTERPRETER_OPTIONVALUEFILESPECLIST_H
#include <mutex>
@@ -39,11 +39,10 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
std::lock_guard<std::recursive_mutex> lock(m_mutex);
m_current_value.Clear();
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -74,4 +73,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueFileSpecList_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEFILESPECLIST_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h
index 020f4ae..5a83ff3 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormat.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueFormat_h_
-#define liblldb_OptionValueFormat_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEFORMAT_H
+#define LLDB_INTERPRETER_OPTIONVALUEFORMAT_H
#include "lldb/Interpreter/OptionValue.h"
@@ -38,10 +38,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -63,4 +62,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueFormat_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEFORMAT_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h
index b05be95..7c2f9fb 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueFormatEntity.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueFormatEntity_h_
-#define liblldb_OptionValueFormatEntity_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
+#define LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
#include "lldb/Core/FormatEntity.h"
#include "lldb/Interpreter/OptionValue.h"
@@ -34,12 +34,12 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override;
+ void Clear() override;
lldb::OptionValueSP DeepCopy() const override;
- size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
// Subclass specific functions
@@ -64,4 +64,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueFormatEntity_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEFORMATENTITY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h
index 505dc89..1293652 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueLanguage.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueLanguage_h_
-#define liblldb_OptionValueLanguage_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
+#define LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/lldb-enumerations.h"
@@ -41,10 +41,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -66,4 +65,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueLanguage_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUELANGUAGE_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h b/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h
index 35c2af4..6d1a081 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValuePathMappings.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValuePathMappings_h_
-#define liblldb_OptionValuePathMappings_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEPATHMAPPINGS_H
+#define LLDB_INTERPRETER_OPTIONVALUEPATHMAPPINGS_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Target/PathMappingList.h"
@@ -35,10 +35,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_path_mappings.Clear(m_notify_changes);
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -58,4 +57,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValuePathMappings_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEPATHMAPPINGS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h
index bea2b3c..d60afde 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueProperties.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueProperties_h_
-#define liblldb_OptionValueProperties_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEPROPERTIES_H
+#define LLDB_INTERPRETER_OPTIONVALUEPROPERTIES_H
#include <vector>
@@ -34,7 +34,7 @@
Type GetType() const override { return eTypeProperties; }
- bool Clear() override;
+ void Clear() override;
lldb::OptionValueSP DeepCopy() const override;
@@ -104,11 +104,6 @@
Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
llvm::StringRef path, llvm::StringRef value) override;
- virtual bool PredicateMatches(const ExecutionContext *exe_ctx,
- llvm::StringRef predicate) const {
- return false;
- }
-
OptionValueArch *
GetPropertyAtIndexAsOptionValueArch(const ExecutionContext *exe_ctx,
uint32_t idx) const;
@@ -198,8 +193,7 @@
ConstString name);
void SetValueChangedCallback(uint32_t property_idx,
- OptionValueChangedCallback callback,
- void *baton);
+ std::function<void()> callback);
protected:
Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
@@ -219,4 +213,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueProperties_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEPROPERTIES_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h
index f5b2557..4751a1d 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueRegex.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueRegex_h_
-#define liblldb_OptionValueRegex_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEREGEX_H
+#define LLDB_INTERPRETER_OPTIONVALUEREGEX_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Utility/RegularExpression.h"
@@ -17,7 +17,8 @@
class OptionValueRegex : public OptionValue {
public:
OptionValueRegex(const char *value = nullptr)
- : OptionValue(), m_regex(llvm::StringRef::withNullAsEmpty(value)) {}
+ : OptionValue(), m_regex(llvm::StringRef::withNullAsEmpty(value)),
+ m_default_regex_str(llvm::StringRef::withNullAsEmpty(value).str()) {}
~OptionValueRegex() override = default;
@@ -35,10 +36,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
- m_regex.Clear();
+ void Clear() override {
+ m_regex = RegularExpression(m_default_regex_str);
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -50,17 +50,18 @@
void SetCurrentValue(const char *value) {
if (value && value[0])
- m_regex.Compile(llvm::StringRef(value));
+ m_regex = RegularExpression(llvm::StringRef(value));
else
- m_regex.Clear();
+ m_regex = RegularExpression();
}
bool IsValid() const { return m_regex.IsValid(); }
protected:
RegularExpression m_regex;
+ std::string m_default_regex_str;
};
} // namespace lldb_private
-#endif // liblldb_OptionValueRegex_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEREGEX_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h
index c2e8ff4..87917c1 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueSInt64.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueSInt64_h_
-#define liblldb_OptionValueSInt64_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUESINT64_H
+#define LLDB_INTERPRETER_OPTIONVALUESINT64_H
#include "lldb/Interpreter/OptionValue.h"
@@ -50,10 +50,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -102,4 +101,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueSInt64_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUESINT64_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h
index d9e76d8..ed44dae 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueString.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueString_h_
-#define liblldb_OptionValueString_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUESTRING_H
+#define LLDB_INTERPRETER_OPTIONVALUESTRING_H
#include <string>
@@ -85,10 +85,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -136,4 +135,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueString_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUESTRING_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h
index 5978cdb..1164fb8 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueUInt64.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueUInt64_h_
-#define liblldb_OptionValueUInt64_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEUINT64_H
+#define LLDB_INTERPRETER_OPTIONVALUEUINT64_H
#include "lldb/Interpreter/OptionValue.h"
@@ -47,10 +47,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_current_value = m_default_value;
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -79,4 +78,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueUInt64_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEUINT64_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h b/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h
index 7273e35..1f663e9 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValueUUID.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValueUUID_h_
-#define liblldb_OptionValueUUID_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUEUUID_H
+#define LLDB_INTERPRETER_OPTIONVALUEUUID_H
#include "lldb/Utility/UUID.h"
#include "lldb/Interpreter/OptionValue.h"
@@ -36,10 +36,9 @@
SetValueFromString(const char *,
VarSetOperationType = eVarSetOperationAssign) = delete;
- bool Clear() override {
+ void Clear() override {
m_uuid.Clear();
m_value_was_set = false;
- return true;
}
lldb::OptionValueSP DeepCopy() const override;
@@ -52,8 +51,8 @@
void SetCurrentValue(const UUID &value) { m_uuid = value; }
- size_t AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) override;
+ void AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) override;
protected:
UUID m_uuid;
@@ -61,4 +60,4 @@
} // namespace lldb_private
-#endif // liblldb_OptionValueUUID_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUEUUID_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/OptionValues.h b/linux-x64/clang/include/lldb/Interpreter/OptionValues.h
index d90b286..6efc9e1 100644
--- a/linux-x64/clang/include/lldb/Interpreter/OptionValues.h
+++ b/linux-x64/clang/include/lldb/Interpreter/OptionValues.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OptionValues_h_
-#define liblldb_OptionValues_h_
+#ifndef LLDB_INTERPRETER_OPTIONVALUES_H
+#define LLDB_INTERPRETER_OPTIONVALUES_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValueArch.h"
@@ -17,6 +17,7 @@
#include "lldb/Interpreter/OptionValueChar.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Interpreter/OptionValueEnumeration.h"
+#include "lldb/Interpreter/OptionValueFileColonLine.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueFormat.h"
@@ -30,4 +31,4 @@
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/OptionValueUUID.h"
-#endif // liblldb_OptionValues_h_
+#endif // LLDB_INTERPRETER_OPTIONVALUES_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/Options.h b/linux-x64/clang/include/lldb/Interpreter/Options.h
index a008d51..9738cce 100644
--- a/linux-x64/clang/include/lldb/Interpreter/Options.h
+++ b/linux-x64/clang/include/lldb/Interpreter/Options.h
@@ -6,14 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Options_h_
-#define liblldb_Options_h_
+#ifndef LLDB_INTERPRETER_OPTIONS_H
+#define LLDB_INTERPRETER_OPTIONS_H
#include <set>
#include <vector>
#include "lldb/Utility/Args.h"
#include "lldb/Utility/CompletionRequest.h"
+#include "lldb/Utility/OptionDefinition.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-private.h"
@@ -40,12 +41,6 @@
typedef std::vector<OptionArgElement> OptionElementVector;
-static inline bool isprint8(int ch) {
- if (ch & 0xffffff00u)
- return false;
- return isprint(ch);
-}
-
/// \class Options Options.h "lldb/Interpreter/Options.h"
/// A command line option parsing protocol class.
///
@@ -163,7 +158,7 @@
/// Handles the generic bits of figuring out whether we are in an option,
/// and if so completing it.
///
- /// \param[in/out] request
+ /// \param[in,out] request
/// The completion request that we need to act upon.
///
/// \param[in] interpreter
@@ -182,19 +177,12 @@
/// Handles the generic bits of figuring out whether we are in an option,
/// and if so completing it.
///
- /// \param[in/out] request
+ /// \param[in,out] request
/// The completion request that we need to act upon.
///
/// \param[in] interpreter
/// The command interpreter doing the completion.
- ///
- /// FIXME: This is the wrong return value, since we also need to
- /// make a distinction between total number of matches, and the window the
- /// user wants returned.
- ///
- /// \return
- /// \btrue if we were in an option, \bfalse otherwise.
- virtual bool
+ virtual void
HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
OptionElementVector &opt_element_vector,
int opt_element_index,
@@ -335,4 +323,4 @@
} // namespace lldb_private
-#endif // liblldb_Options_h_
+#endif // LLDB_INTERPRETER_OPTIONS_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/Property.h b/linux-x64/clang/include/lldb/Interpreter/Property.h
index 797aee4..97ec7ca 100644
--- a/linux-x64/clang/include/lldb/Interpreter/Property.h
+++ b/linux-x64/clang/include/lldb/Interpreter/Property.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Property_h_
-#define liblldb_Property_h_
+#ifndef LLDB_INTERPRETER_PROPERTY_H
+#define LLDB_INTERPRETER_PROPERTY_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Utility/ConstString.h"
@@ -64,8 +64,7 @@
uint32_t output_width,
bool display_qualified_name) const;
- void SetValueChangedCallback(OptionValueChangedCallback callback,
- void *baton);
+ void SetValueChangedCallback(std::function<void()> callback);
protected:
ConstString m_name;
@@ -76,4 +75,4 @@
} // namespace lldb_private
-#endif // liblldb_Property_h_
+#endif // LLDB_INTERPRETER_PROPERTY_H
diff --git a/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h b/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h
index c8fa390..4abd1ca 100644
--- a/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/linux-x64/clang/include/lldb/Interpreter/ScriptInterpreter.h
@@ -6,19 +6,19 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ScriptInterpreter_h_
-#define liblldb_ScriptInterpreter_h_
-
-#include "lldb/lldb-private.h"
+#ifndef LLDB_INTERPRETER_SCRIPTINTERPRETER_H
+#define LLDB_INTERPRETER_SCRIPTINTERPRETER_H
#include "lldb/Breakpoint/BreakpointOptions.h"
+#include "lldb/Core/Communication.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/SearchFilter.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Utility/Broadcaster.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StructuredData.h"
-
-#include "lldb/Host/PseudoTerminal.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -29,7 +29,38 @@
virtual ~ScriptInterpreterLocker() = default;
private:
- DISALLOW_COPY_AND_ASSIGN(ScriptInterpreterLocker);
+ ScriptInterpreterLocker(const ScriptInterpreterLocker &) = delete;
+ const ScriptInterpreterLocker &
+ operator=(const ScriptInterpreterLocker &) = delete;
+};
+
+class ScriptInterpreterIORedirect {
+public:
+ /// Create an IO redirect. If IO is enabled, this will redirects the output
+ /// to the command return object if set or to the debugger otherwise. If IO
+ /// is disabled, it will redirect all IO to /dev/null.
+ static llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
+ Create(bool enable_io, Debugger &debugger, CommandReturnObject *result);
+
+ ~ScriptInterpreterIORedirect();
+
+ lldb::FileSP GetInputFile() const { return m_input_file_sp; }
+ lldb::FileSP GetOutputFile() const { return m_output_file_sp->GetFileSP(); }
+ lldb::FileSP GetErrorFile() const { return m_error_file_sp->GetFileSP(); }
+
+ /// Flush our output and error file handles.
+ void Flush();
+
+private:
+ ScriptInterpreterIORedirect(std::unique_ptr<File> input,
+ std::unique_ptr<File> output);
+ ScriptInterpreterIORedirect(Debugger &debugger, CommandReturnObject *result);
+
+ lldb::FileSP m_input_file_sp;
+ lldb::StreamFileSP m_output_file_sp;
+ lldb::StreamFileSP m_error_file_sp;
+ Communication m_communication;
+ bool m_disconnect;
};
class ScriptInterpreter : public PluginInterface {
@@ -65,6 +96,9 @@
bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
+ // If this is true then any exceptions raised by the script will be
+ // cleared with PyErr_Clear(). If false then they will be left for
+ // the caller to clean up
bool GetMaskoutErrors() const { return m_maskout_errors; }
ExecuteScriptOptions &SetEnableIO(bool enable) {
@@ -117,8 +151,10 @@
return error;
}
- virtual Status GenerateBreakpointCommandCallbackData(StringList &input,
- std::string &output) {
+ virtual Status GenerateBreakpointCommandCallbackData(
+ StringList &input,
+ std::string &output,
+ bool has_extra_args) {
Status error;
error.SetErrorString("not implemented");
return error;
@@ -208,6 +244,8 @@
virtual StructuredData::ObjectSP
CreateScriptedThreadPlan(const char *class_name,
+ StructuredDataImpl *args_data,
+ std::string &error_str,
lldb::ThreadPlanSP thread_plan_sp) {
return StructuredData::ObjectSP();
}
@@ -260,6 +298,23 @@
return lldb::eSearchDepthModule;
}
+ virtual StructuredData::GenericSP
+ CreateScriptedStopHook(lldb::TargetSP target_sp, const char *class_name,
+ StructuredDataImpl *args_data, Status &error) {
+ error.SetErrorString("Creating scripted stop-hooks with the current "
+ "script interpreter is not supported.");
+ return StructuredData::GenericSP();
+ }
+
+ // This dispatches to the handle_stop method of the stop-hook class. It
+ // returns a "should_stop" bool.
+ virtual bool
+ ScriptedStopHookHandleStop(StructuredData::GenericSP implementor_sp,
+ ExecutionContext &exc_ctx,
+ lldb::StreamSP stream_sp) {
+ return true;
+ }
+
virtual StructuredData::ObjectSP
LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) {
return StructuredData::ObjectSP();
@@ -306,14 +361,20 @@
return error;
}
- void SetBreakpointCommandCallbackFunction(
+ Status SetBreakpointCommandCallbackFunction(
std::vector<BreakpointOptions *> &bp_options_vec,
- const char *function_name);
+ const char *function_name, StructuredData::ObjectSP extra_args_sp);
- /// Set a one-liner as the callback for the breakpoint.
- virtual void
- SetBreakpointCommandCallbackFunction(BreakpointOptions *bp_options,
- const char *function_name) {}
+ /// Set a script function as the callback for the breakpoint.
+ virtual Status
+ SetBreakpointCommandCallbackFunction(
+ BreakpointOptions *bp_options,
+ const char *function_name,
+ StructuredData::ObjectSP extra_args_sp) {
+ Status error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
/// Set a one-liner as the callback for the watchpoint.
virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options,
@@ -444,12 +505,10 @@
virtual bool CheckObjectExists(const char *name) { return false; }
virtual bool
- LoadScriptingModule(const char *filename, bool can_reload, bool init_session,
+ LoadScriptingModule(const char *filename, bool init_session,
lldb_private::Status &error,
- StructuredData::ObjectSP *module_sp = nullptr) {
- error.SetErrorString("loading unimplemented");
- return false;
- }
+ StructuredData::ObjectSP *module_sp = nullptr,
+ FileSpec extra_search_dir = {});
virtual bool IsReservedWord(const char *word) { return false; }
@@ -457,14 +516,16 @@
const char *GetScriptInterpreterPtyName();
- int GetMasterFileDescriptor();
+ virtual llvm::Expected<unsigned>
+ GetMaxPositionalArgumentsForCallable(const llvm::StringRef &callable_name) {
+ return llvm::createStringError(
+ llvm::inconvertibleErrorCode(), "Unimplemented function");
+ }
static std::string LanguageToString(lldb::ScriptLanguage language);
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
- virtual void ResetOutputFileHandle(FILE *new_fh) {} // By default, do nothing.
-
lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
protected:
@@ -474,4 +535,4 @@
} // namespace lldb_private
-#endif // liblldb_ScriptInterpreter_h_
+#endif // LLDB_INTERPRETER_SCRIPTINTERPRETER_H
diff --git a/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h b/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h
index a74b444..24f9f1a 100644
--- a/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h
+++ b/linux-x64/clang/include/lldb/Symbol/ArmUnwindInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ArmUnwindInfo_h_
-#define liblldb_ArmUnwindInfo_h_
+#ifndef LLDB_SYMBOL_ARMUNWINDINFO_H
+#define LLDB_SYMBOL_ARMUNWINDINFO_H
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/DataExtractor.h"
@@ -65,4 +65,4 @@
} // namespace lldb_private
-#endif // liblldb_ArmUnwindInfo_h_
+#endif // LLDB_SYMBOL_ARMUNWINDINFO_H
diff --git a/linux-x64/clang/include/lldb/Symbol/Block.h b/linux-x64/clang/include/lldb/Symbol/Block.h
index 36d0944..de94556 100644
--- a/linux-x64/clang/include/lldb/Symbol/Block.h
+++ b/linux-x64/clang/include/lldb/Symbol/Block.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Block_h_
-#define liblldb_Block_h_
+#ifndef LLDB_SYMBOL_BLOCK_H
+#define LLDB_SYMBOL_BLOCK_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Symbol/CompilerType.h"
@@ -40,7 +40,7 @@
/// blocks.
class Block : public UserID, public SymbolContextScope {
public:
- typedef RangeArray<uint32_t, uint32_t, 1> RangeList;
+ typedef RangeVector<uint32_t, uint32_t, 1> RangeList;
typedef RangeList::Entry Range;
/// Construct with a User ID \a uid, \a depth.
@@ -57,12 +57,6 @@
/// depth parsing. Common values would be the index into a
/// table, or an offset into the debug information.
///
- /// \param[in] depth
- /// The integer depth of this block in the block list hierarchy.
- ///
- /// \param[in] block_list
- /// The block list that this object belongs to.
- ///
/// \see BlockList
Block(lldb::user_id_t uid);
@@ -77,14 +71,6 @@
void AddChild(const lldb::BlockSP &child_block_sp);
/// Add a new offset range to this block.
- ///
- /// \param[in] start_offset
- /// An offset into this Function's address range that
- /// describes the start address of a range for this block.
- ///
- /// \param[in] end_offset
- /// An offset into this Function's address range that
- /// describes the end address of a range for this block.
void AddRange(const Range &range);
void FinalizeRanges();
@@ -232,10 +218,6 @@
/// Get the variable list for this block and optionally all child blocks if
/// \a get_child_variables is \b true.
///
- /// \param[in] get_child_variables
- /// If \b true, all variables from all child blocks will be
- /// added to the variable list.
- ///
/// \param[in] can_create
/// If \b true, the variables can be parsed if they already
/// haven't been, else the current state of the block will be
@@ -243,11 +225,9 @@
/// to see the current state of what has been parsed up to this
/// point.
///
- /// \param[in] add_inline_child_block_variables
- /// If this is \b false, no child variables of child blocks
- /// that are inlined functions will be gotten. If \b true then
- /// all child variables will be added regardless of whether they
- /// come from inlined functions or not.
+ /// \param[in] get_child_block_variables
+ /// If \b true, all variables from all child blocks will be
+ /// added to the variable list.
///
/// \return
/// A variable list shared pointer that contains all variables
@@ -396,9 +376,10 @@
Block *GetSiblingForChild(const Block *child_block) const;
private:
- DISALLOW_COPY_AND_ASSIGN(Block);
+ Block(const Block &) = delete;
+ const Block &operator=(const Block &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Block_h_
+#endif // LLDB_SYMBOL_BLOCK_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CallFrameInfo.h b/linux-x64/clang/include/lldb/Symbol/CallFrameInfo.h
new file mode 100644
index 0000000..7db8722
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Symbol/CallFrameInfo.h
@@ -0,0 +1,28 @@
+//===-- CallFrameInfo.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License 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_SYMBOL_CALLFRAMEINFO_H
+#define LLDB_SYMBOL_CALLFRAMEINFO_H
+
+#include "lldb/Core/Address.h"
+
+namespace lldb_private {
+
+class CallFrameInfo {
+public:
+ virtual ~CallFrameInfo() = default;
+
+ virtual bool GetAddressRange(Address addr, AddressRange &range) = 0;
+
+ virtual bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan) = 0;
+ virtual bool GetUnwindPlan(const AddressRange &range, UnwindPlan &unwind_plan) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_SYMBOL_CALLFRAMEINFO_H
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h b/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h
deleted file mode 100644
index dda9f43..0000000
--- a/linux-x64/clang/include/lldb/Symbol/ClangASTContext.h
+++ /dev/null
@@ -1,1057 +0,0 @@
-//===-- ClangASTContext.h ---------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangASTContext_h_
-#define liblldb_ClangASTContext_h_
-
-#include <stdint.h>
-
-#include <functional>
-#include <initializer_list>
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/ExternalASTMerger.h"
-#include "clang/AST/TemplateBase.h"
-#include "llvm/ADT/APSInt.h"
-#include "llvm/ADT/SmallVector.h"
-
-#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/TypeSystem.h"
-#include "lldb/Utility/ConstString.h"
-#include "lldb/lldb-enumerations.h"
-
-class DWARFASTParserClang;
-class PDBASTParser;
-
-namespace lldb_private {
-
-class Declaration;
-
-class ClangASTContext : public TypeSystem {
-public:
- typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
- typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
- clang::ObjCInterfaceDecl *);
-
- // llvm casting support
- static bool classof(const TypeSystem *ts) {
- return ts->getKind() == TypeSystem::eKindClang;
- }
-
- // Constructors and Destructors
- ClangASTContext(const char *triple = nullptr);
-
- ~ClangASTContext() override;
-
- void Finalize() override;
-
- // PluginInterface functions
- ConstString GetPluginName() override;
-
- uint32_t GetPluginVersion() override;
-
- static ConstString GetPluginNameStatic();
-
- static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
- Module *module, Target *target);
-
- static void EnumerateSupportedLanguages(
- std::set<lldb::LanguageType> &languages_for_types,
- std::set<lldb::LanguageType> &languages_for_expressions);
-
- static void Initialize();
-
- static void Terminate();
-
- static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx);
-
- clang::ASTContext *getASTContext();
-
- void setASTContext(clang::ASTContext *ast_ctx);
-
- clang::Builtin::Context *getBuiltinContext();
-
- clang::IdentifierTable *getIdentifierTable();
-
- clang::LangOptions *getLanguageOptions();
-
- clang::SelectorTable *getSelectorTable();
-
- clang::FileManager *getFileManager();
-
- clang::SourceManager *getSourceManager();
-
- clang::DiagnosticsEngine *getDiagnosticsEngine();
-
- clang::DiagnosticConsumer *getDiagnosticConsumer();
-
- clang::MangleContext *getMangleContext();
-
- std::shared_ptr<clang::TargetOptions> &getTargetOptions();
-
- clang::TargetInfo *getTargetInfo();
-
- void setSema(clang::Sema *s);
- clang::Sema *getSema() { return m_sema; }
-
- void Clear();
-
- const char *GetTargetTriple();
-
- void SetTargetTriple(const char *target_triple);
-
- void SetArchitecture(const ArchSpec &arch);
-
- bool HasExternalSource();
-
- void SetExternalSource(
- llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
-
- void RemoveExternalSource();
-
- bool GetCompleteDecl(clang::Decl *decl) {
- return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
- }
-
- static void DumpDeclHiearchy(clang::Decl *decl);
-
- static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
-
- static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
-
- static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
-
- void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id);
-
- void SetMetadata(const void *object, ClangASTMetadata &meta_data) {
- SetMetadata(getASTContext(), object, meta_data);
- }
-
- static void SetMetadata(clang::ASTContext *ast, const void *object,
- ClangASTMetadata &meta_data);
-
- ClangASTMetadata *GetMetadata(const void *object) {
- return GetMetadata(getASTContext(), object);
- }
-
- static ClangASTMetadata *GetMetadata(clang::ASTContext *ast,
- const void *object);
-
- // Basic Types
- CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
- size_t bit_size) override;
-
- static CompilerType GetBuiltinTypeForEncodingAndBitSize(
- clang::ASTContext *ast, lldb::Encoding encoding, uint32_t bit_size);
-
- CompilerType GetBasicType(lldb::BasicType type);
-
- static CompilerType GetBasicType(clang::ASTContext *ast,
- lldb::BasicType type);
-
- static CompilerType GetBasicType(clang::ASTContext *ast,
- ConstString name);
-
- static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
-
- CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(const char *type_name,
- uint32_t dw_ate,
- uint32_t bit_size);
-
- CompilerType GetCStringType(bool is_const);
-
- static CompilerType GetUnknownAnyType(clang::ASTContext *ast);
-
- CompilerType GetUnknownAnyType() {
- return ClangASTContext::GetUnknownAnyType(getASTContext());
- }
-
- static clang::DeclContext *GetDeclContextForType(clang::QualType type);
-
- static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
-
- uint32_t GetPointerByteSize() override;
-
- static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
-
- clang::DeclContext *GetTranslationUnitDecl() {
- return GetTranslationUnitDecl(getASTContext());
- }
-
- static clang::Decl *CopyDecl(clang::ASTContext *dest_context,
- clang::ASTContext *source_context,
- clang::Decl *source_decl);
-
- static bool AreTypesSame(CompilerType type1, CompilerType type2,
- bool ignore_qualifiers = false);
-
- static CompilerType GetTypeForDecl(clang::NamedDecl *decl);
-
- static CompilerType GetTypeForDecl(clang::TagDecl *decl);
-
- static CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
-
- template <typename RecordDeclType>
- CompilerType
- GetTypeForIdentifier(ConstString type_name,
- clang::DeclContext *decl_context = nullptr) {
- CompilerType compiler_type;
-
- if (type_name.GetLength()) {
- clang::ASTContext *ast = getASTContext();
- if (ast) {
- if (!decl_context)
- decl_context = ast->getTranslationUnitDecl();
-
- clang::IdentifierInfo &myIdent =
- ast->Idents.get(type_name.GetCString());
- clang::DeclarationName myName =
- ast->DeclarationNames.getIdentifier(&myIdent);
-
- clang::DeclContext::lookup_result result =
- decl_context->lookup(myName);
-
- if (!result.empty()) {
- clang::NamedDecl *named_decl = result[0];
- if (const RecordDeclType *record_decl =
- llvm::dyn_cast<RecordDeclType>(named_decl))
- compiler_type.SetCompilerType(
- ast, clang::QualType(record_decl->getTypeForDecl(), 0));
- }
- }
- }
-
- return compiler_type;
- }
-
- CompilerType CreateStructForIdentifier(
- ConstString type_name,
- const std::initializer_list<std::pair<const char *, CompilerType>>
- &type_fields,
- bool packed = false);
-
- CompilerType GetOrCreateStructForIdentifier(
- ConstString type_name,
- const std::initializer_list<std::pair<const char *, CompilerType>>
- &type_fields,
- bool packed = false);
-
- static bool IsOperator(const char *name,
- clang::OverloadedOperatorKind &op_kind);
-
- // Structure, Unions, Classes
-
- static clang::AccessSpecifier
- ConvertAccessTypeToAccessSpecifier(lldb::AccessType access);
-
- static clang::AccessSpecifier
- UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
-
- static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
- bool omit_empty_base_classes);
-
- CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
- lldb::AccessType access_type, const char *name,
- int kind, lldb::LanguageType language,
- ClangASTMetadata *metadata = nullptr);
-
- class TemplateParameterInfos {
- public:
- bool IsValid() const {
- if (args.empty())
- return false;
- return args.size() == names.size() &&
- ((bool)pack_name == (bool)packed_args) &&
- (!packed_args || !packed_args->packed_args);
- }
-
- llvm::SmallVector<const char *, 2> names;
- llvm::SmallVector<clang::TemplateArgument, 2> args;
-
- const char * pack_name = nullptr;
- std::unique_ptr<TemplateParameterInfos> packed_args;
- };
-
- clang::FunctionTemplateDecl *
- CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx,
- clang::FunctionDecl *func_decl, const char *name,
- const TemplateParameterInfos &infos);
-
- void CreateFunctionTemplateSpecializationInfo(
- clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
- const TemplateParameterInfos &infos);
-
- clang::ClassTemplateDecl *
- CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
- lldb::AccessType access_type, const char *class_name,
- int kind, const TemplateParameterInfos &infos);
-
- clang::TemplateTemplateParmDecl *
- CreateTemplateTemplateParmDecl(const char *template_name);
-
- clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
- clang::DeclContext *decl_ctx,
- clang::ClassTemplateDecl *class_template_decl, int kind,
- const TemplateParameterInfos &infos);
-
- CompilerType
- CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
- class_template_specialization_decl);
-
- static clang::DeclContext *
- GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl);
-
- static clang::DeclContext *
- GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl);
-
- static bool CheckOverloadedOperatorKindParameterCount(
- bool is_method, clang::OverloadedOperatorKind op_kind,
- uint32_t num_params);
-
- bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
-
- static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field,
- uint32_t &bitfield_bit_size);
-
- static bool RecordHasFields(const clang::RecordDecl *record_decl);
-
- CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx,
- bool isForwardDecl, bool isInternal,
- ClangASTMetadata *metadata = nullptr);
-
- bool SetTagTypeKind(clang::QualType type, int kind) const;
-
- bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl,
- int default_accessibility,
- int *assigned_accessibilities,
- size_t num_assigned_accessibilities);
-
- // Returns a mask containing bits from the ClangASTContext::eTypeXXX
- // enumerations
-
- // Namespace Declarations
-
- clang::NamespaceDecl *
- GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx,
- bool is_inline = false);
-
- static clang::NamespaceDecl *
- GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name,
- clang::DeclContext *decl_ctx,
- bool is_inline = false);
-
- // Function Types
-
- clang::FunctionDecl *
- CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name,
- const CompilerType &function_Type, int storage,
- bool is_inline);
-
- static CompilerType CreateFunctionType(clang::ASTContext *ast,
- const CompilerType &result_type,
- const CompilerType *args,
- unsigned num_args, bool is_variadic,
- unsigned type_quals,
- clang::CallingConv cc);
-
- static CompilerType CreateFunctionType(clang::ASTContext *ast,
- const CompilerType &result_type,
- const CompilerType *args,
- unsigned num_args, bool is_variadic,
- unsigned type_quals) {
- return ClangASTContext::CreateFunctionType(
- ast, result_type, args, num_args, is_variadic, type_quals, clang::CC_C);
- }
-
- CompilerType CreateFunctionType(const CompilerType &result_type,
- const CompilerType *args, unsigned num_args,
- bool is_variadic, unsigned type_quals) {
- return ClangASTContext::CreateFunctionType(
- getASTContext(), result_type, args, num_args, is_variadic, type_quals);
- }
-
- CompilerType CreateFunctionType(const CompilerType &result_type,
- const CompilerType *args, unsigned num_args,
- bool is_variadic, unsigned type_quals,
- clang::CallingConv cc) {
- return ClangASTContext::CreateFunctionType(getASTContext(), result_type,
- args, num_args, is_variadic,
- type_quals, cc);
- }
-
- clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
- const char *name,
- const CompilerType ¶m_type,
- int storage);
-
- void SetFunctionParameters(clang::FunctionDecl *function_decl,
- clang::ParmVarDecl **params, unsigned num_params);
-
- CompilerType CreateBlockPointerType(const CompilerType &function_type);
-
- // Array Types
-
- CompilerType CreateArrayType(const CompilerType &element_type,
- size_t element_count, bool is_vector);
-
- // Enumeration Types
- CompilerType CreateEnumerationType(const char *name,
- clang::DeclContext *decl_ctx,
- const Declaration &decl,
- const CompilerType &integer_qual_type,
- bool is_scoped);
-
- // Integer type functions
-
- static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast,
- size_t bit_size, bool is_signed);
-
- CompilerType GetPointerSizedIntType(bool is_signed) {
- return GetPointerSizedIntType(getASTContext(), is_signed);
- }
-
- static CompilerType GetPointerSizedIntType(clang::ASTContext *ast,
- bool is_signed);
-
- // Floating point functions
-
- static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
- size_t bit_size);
-
- // TypeSystem methods
- DWARFASTParser *GetDWARFParser() override;
- PDBASTParser *GetPDBParser() override;
-
- // ClangASTContext callbacks for external source lookups.
- static void CompleteTagDecl(void *baton, clang::TagDecl *);
-
- static void CompleteObjCInterfaceDecl(void *baton,
- clang::ObjCInterfaceDecl *);
-
- static bool LayoutRecordType(
- void *baton, const clang::RecordDecl *record_decl, uint64_t &size,
- uint64_t &alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &base_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &vbase_offsets);
-
- // CompilerDecl override functions
- ConstString DeclGetName(void *opaque_decl) override;
-
- ConstString DeclGetMangledName(void *opaque_decl) override;
-
- CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
-
- CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
-
- size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
-
- CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
- size_t arg_idx) override;
-
- // CompilerDeclContext override functions
-
- std::vector<CompilerDecl>
- DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
- const bool ignore_using_decls) override;
-
- bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
-
- ConstString DeclContextGetName(void *opaque_decl_ctx) override;
-
- ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
-
- bool DeclContextIsClassMethod(void *opaque_decl_ctx,
- lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) override;
-
- bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
- void *other_opaque_decl_ctx) override;
-
- // Clang specific clang::DeclContext functions
-
- static clang::DeclContext *
- DeclContextGetAsDeclContext(const CompilerDeclContext &dc);
-
- static clang::ObjCMethodDecl *
- DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc);
-
- static clang::CXXMethodDecl *
- DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc);
-
- static clang::FunctionDecl *
- DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc);
-
- static clang::NamespaceDecl *
- DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc);
-
- static ClangASTMetadata *DeclContextGetMetaData(const CompilerDeclContext &dc,
- const void *object);
-
- static clang::ASTContext *
- DeclContextGetClangASTContext(const CompilerDeclContext &dc);
-
- // Tests
-
- bool IsArrayType(lldb::opaque_compiler_type_t type,
- CompilerType *element_type, uint64_t *size,
- bool *is_incomplete) override;
-
- bool IsVectorType(lldb::opaque_compiler_type_t type,
- CompilerType *element_type, uint64_t *size) override;
-
- bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
-
- bool IsAnonymousType(lldb::opaque_compiler_type_t type) override;
-
- bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
-
- bool IsCharType(lldb::opaque_compiler_type_t type) override;
-
- bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
-
- bool IsConst(lldb::opaque_compiler_type_t type) override;
-
- bool IsCStringType(lldb::opaque_compiler_type_t type,
- uint32_t &length) override;
-
- static bool IsCXXClassType(const CompilerType &type);
-
- bool IsDefined(lldb::opaque_compiler_type_t type) override;
-
- bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
- bool &is_complex) override;
-
- bool IsFunctionType(lldb::opaque_compiler_type_t type,
- bool *is_variadic_ptr) override;
-
- uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
- CompilerType *base_type_ptr) override;
-
- size_t
- GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
- const size_t index) override;
-
- bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
-
- bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
- CompilerType *function_pointer_type_ptr) override;
-
- bool IsIntegerType(lldb::opaque_compiler_type_t type,
- bool &is_signed) override;
-
- bool IsEnumerationType(lldb::opaque_compiler_type_t type,
- bool &is_signed) override;
-
- static bool IsObjCClassType(const CompilerType &type);
-
- static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
- bool check_superclass);
-
- static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
-
- static bool IsObjCObjectPointerType(const CompilerType &type,
- CompilerType *target_type = nullptr);
-
- bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
-
- static bool IsClassType(lldb::opaque_compiler_type_t type);
-
- static bool IsEnumType(lldb::opaque_compiler_type_t type);
-
- bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
- CompilerType *target_type, // Can pass nullptr
- bool check_cplusplus, bool check_objc) override;
-
- bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
-
- bool IsPointerType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type) override;
-
- bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type) override;
-
- bool IsReferenceType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type, bool *is_rvalue) override;
-
- bool IsScalarType(lldb::opaque_compiler_type_t type) override;
-
- bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
-
- bool IsVoidType(lldb::opaque_compiler_type_t type) override;
-
- bool CanPassInRegisters(const CompilerType &type) override;
-
- bool SupportsLanguage(lldb::LanguageType language) override;
-
- static bool GetCXXClassName(const CompilerType &type,
- std::string &class_name);
-
- static bool GetObjCClassName(const CompilerType &type,
- std::string &class_name);
-
- // Type Completion
-
- bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
-
- // Accessors
-
- ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
-
- uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_or_element_compiler_type) override;
-
- lldb::LanguageType
- GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
-
- lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
-
- unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
-
- // Creating related types
-
- // Using the current type, create a new typedef to that type using
- // "typedef_name" as the name and "decl_ctx" as the decl context.
- static CompilerType
- CreateTypedefType(const CompilerType &type, const char *typedef_name,
- const CompilerDeclContext &compiler_decl_ctx);
-
- CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
- uint64_t *stride) override;
-
- CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
- uint64_t size) override;
-
- CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
-
- // Returns -1 if this isn't a function of if the function doesn't have a
- // prototype Returns a value >= 0 if there is a prototype.
- int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
- size_t idx) override;
-
- CompilerType
- GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
-
- size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
-
- TypeMemberFunctionImpl
- GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
- size_t idx) override;
-
- CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetLValueReferenceType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetRValueReferenceType(lldb::opaque_compiler_type_t type) override;
-
- CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override;
-
- CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override;
-
- CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override;
-
- CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
- const char *name,
- const CompilerDeclContext &decl_ctx) override;
-
- // If the current object represents a typedef type, get the underlying type
- CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
-
- // Create related types using the current type's AST
- CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
-
- // Exploring the type
-
- llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
- ExecutionContextScope *exe_scope) {
- if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
- return (*bit_size + 7) / 8;
- return llvm::None;
- }
-
- llvm::Optional<uint64_t>
- GetBitSize(lldb::opaque_compiler_type_t type,
- ExecutionContextScope *exe_scope) override;
-
- lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
- uint64_t &count) override;
-
- lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
-
- size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
-
- uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
- bool omit_empty_base_classes,
- const ExecutionContext *exe_ctx) override;
-
- CompilerType GetBuiltinTypeByName(ConstString name) override;
-
- lldb::BasicType
- GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
-
- static lldb::BasicType
- GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type,
- ConstString name);
-
- void ForEachEnumerator(
- lldb::opaque_compiler_type_t type,
- std::function<bool(const CompilerType &integer_type,
- ConstString name,
- const llvm::APSInt &value)> const &callback) override;
-
- uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
- std::string &name, uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr,
- bool *is_bitfield_ptr) override;
-
- uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override;
-
- uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override;
-
- CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
- size_t idx,
- uint32_t *bit_offset_ptr) override;
-
- CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
- size_t idx,
- uint32_t *bit_offset_ptr) override;
-
- static uint32_t GetNumPointeeChildren(clang::QualType type);
-
- CompilerType GetChildCompilerTypeAtIndex(
- lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
- bool transparent_pointers, bool omit_empty_base_classes,
- bool ignore_array_bounds, std::string &child_name,
- uint32_t &child_byte_size, int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
- bool &child_is_base_class, bool &child_is_deref_of_parent,
- ValueObject *valobj, uint64_t &language_flags) override;
-
- // Lookup a child given a name. This function will match base class names and
- // member member names in "clang_type" only, not descendants.
- uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
- const char *name,
- bool omit_empty_base_classes) override;
-
- // Lookup a child member given a name. This function will match member names
- // only and will descend into "clang_type" children in search for the first
- // member in this class, or any base class that matches "name".
- // TODO: Return all matches for a given name by returning a
- // vector<vector<uint32_t>>
- // so we catch all names that match a given child name, not just the first.
- size_t
- GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
- const char *name, bool omit_empty_base_classes,
- std::vector<uint32_t> &child_indexes) override;
-
- size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
-
- lldb::TemplateArgumentKind
- GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
- size_t idx) override;
- CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx) override;
- llvm::Optional<CompilerType::IntegralTemplateArgument>
- GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx) override;
-
- CompilerType GetTypeForFormatters(void *type) override;
-
-#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
- // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx
- // could not be found in decl_ctx.
- uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
- clang::DeclContext *child_decl_ctx,
- ConstString *child_name = nullptr,
- CompilerType *child_type = nullptr);
-
- // Modifying RecordType
- static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
- llvm::StringRef name,
- const CompilerType &field_type,
- lldb::AccessType access,
- uint32_t bitfield_bit_size);
-
- static void BuildIndirectFields(const CompilerType &type);
-
- static void SetIsPacked(const CompilerType &type);
-
- static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
- llvm::StringRef name,
- const CompilerType &var_type,
- lldb::AccessType access);
-
- clang::CXXMethodDecl *
- AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name,
- const char *mangled_name,
- const CompilerType &method_type,
- lldb::AccessType access, bool is_virtual,
- bool is_static, bool is_inline, bool is_explicit,
- bool is_attr_used, bool is_artificial);
-
- void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type);
-
- // C++ Base Classes
- std::unique_ptr<clang::CXXBaseSpecifier>
- CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type,
- lldb::AccessType access, bool is_virtual,
- bool base_of_class);
-
- bool TransferBaseClasses(
- lldb::opaque_compiler_type_t type,
- std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases);
-
- static bool SetObjCSuperClass(const CompilerType &type,
- const CompilerType &superclass_compiler_type);
-
- static bool AddObjCClassProperty(const CompilerType &type,
- const char *property_name,
- const CompilerType &property_compiler_type,
- clang::ObjCIvarDecl *ivar_decl,
- const char *property_setter_name,
- const char *property_getter_name,
- uint32_t property_attributes,
- ClangASTMetadata *metadata);
-
- static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
- const CompilerType &type,
- const char *name, // the full symbol name as seen in the symbol table
- // (lldb::opaque_compiler_type_t type, "-[NString
- // stringWithCString:]")
- const CompilerType &method_compiler_type, lldb::AccessType access,
- bool is_artificial, bool is_variadic);
-
- static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
- bool has_extern);
-
- static bool GetHasExternalStorage(const CompilerType &type);
- // Tag Declarations
- static bool StartTagDeclarationDefinition(const CompilerType &type);
-
- static bool CompleteTagDeclarationDefinition(const CompilerType &type);
-
- // Modifying Enumeration types
- clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
- const CompilerType &enum_type, const Declaration &decl, const char *name,
- int64_t enum_value, uint32_t enum_value_bit_size);
- clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
- const CompilerType &enum_type, const Declaration &decl, const char *name,
- const llvm::APSInt &value);
-
- CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
-
- // Pointers & References
-
- // Call this function using the class type when you want to make a member
- // pointer type to pointee_type.
- static CompilerType CreateMemberPointerType(const CompilerType &type,
- const CompilerType &pointee_type);
-
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
- const char *s, uint8_t *dst,
- size_t dst_size) override;
-
- // Dumping types
-#ifndef NDEBUG
- /// Convenience LLVM-style dump method for use in the debugger only.
- /// In contrast to the other \p Dump() methods this directly invokes
- /// \p clang::QualType::dump().
- LLVM_DUMP_METHOD void dump(lldb::opaque_compiler_type_t type) const override;
-#endif
-
- void Dump(Stream &s);
-
- void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
- Stream *s, lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size,
- uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
- bool show_types, bool show_summary, bool verbose,
- uint32_t depth) override;
-
- bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
- lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size,
- uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
- ExecutionContextScope *exe_scope) override;
-
- void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
- Stream *s, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size) override;
-
- void DumpTypeDescription(
- lldb::opaque_compiler_type_t type) override; // Dump to stdout
-
- void DumpTypeDescription(lldb::opaque_compiler_type_t type,
- Stream *s) override;
-
- static void DumpTypeName(const CompilerType &type);
-
- static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
-
- static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
-
- static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
-
- static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
-
- clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
-
- static clang::ObjCInterfaceDecl *
- GetAsObjCInterfaceDecl(const CompilerType &type);
-
- clang::ClassTemplateDecl *ParseClassTemplateDecl(
- clang::DeclContext *decl_ctx, lldb::AccessType access_type,
- const char *parent_name, int tag_decl_kind,
- const ClangASTContext::TemplateParameterInfos &template_param_infos);
-
- clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx);
-
- clang::UsingDirectiveDecl *
- CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
- clang::NamespaceDecl *ns_decl);
-
- clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
- clang::NamedDecl *target);
-
- clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
- const char *name,
- clang::QualType type);
-
- static lldb::opaque_compiler_type_t
- GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
-
- static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
- if (type)
- return clang::QualType::getFromOpaquePtr(type);
- return clang::QualType();
- }
-
- static clang::QualType
- GetCanonicalQualType(lldb::opaque_compiler_type_t type) {
- if (type)
- return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
- return clang::QualType();
- }
-
- clang::DeclarationName
- GetDeclarationName(const char *name, const CompilerType &function_clang_type);
-
- virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() {
- return m_origins;
- }
-protected:
- const clang::ClassTemplateSpecializationDecl *
- GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
-
- // Classes that inherit from ClangASTContext can see and modify these
- // clang-format off
- std::string m_target_triple;
- std::unique_ptr<clang::ASTContext> m_ast_up;
- std::unique_ptr<clang::LangOptions> m_language_options_up;
- std::unique_ptr<clang::FileManager> m_file_manager_up;
- std::unique_ptr<clang::FileSystemOptions> m_file_system_options_up;
- std::unique_ptr<clang::SourceManager> m_source_manager_up;
- std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
- std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
- std::shared_ptr<clang::TargetOptions> m_target_options_rp;
- std::unique_ptr<clang::TargetInfo> m_target_info_up;
- std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
- std::unique_ptr<clang::SelectorTable> m_selector_table_up;
- std::unique_ptr<clang::Builtin::Context> m_builtins_up;
- std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
- std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
- std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
- std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
- CompleteTagDeclCallback m_callback_tag_decl;
- CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
- void * m_callback_baton;
- clang::ExternalASTMerger::OriginMap m_origins;
- uint32_t m_pointer_byte_size;
- bool m_ast_owned;
- bool m_can_evaluate_expressions;
- /// The sema associated that is currently used to build this ASTContext.
- /// May be null if we are already done parsing this ASTContext or the
- /// ASTContext wasn't created by parsing source code.
- clang::Sema * m_sema = nullptr;
- // clang-format on
-private:
- // For ClangASTContext only
- ClangASTContext(const ClangASTContext &);
- const ClangASTContext &operator=(const ClangASTContext &);
-};
-
-class ClangASTContextForExpressions : public ClangASTContext {
-public:
- ClangASTContextForExpressions(Target &target);
-
- ~ClangASTContextForExpressions() override = default;
-
- UserExpression *
- GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix,
- lldb::LanguageType language,
- Expression::ResultType desired_type,
- const EvaluateExpressionOptions &options,
- ValueObject *ctx_obj) override;
-
- FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
- const Address &function_address,
- const ValueList &arg_value_list,
- const char *name) override;
-
- UtilityFunction *GetUtilityFunction(const char *text,
- const char *name) override;
-
- PersistentExpressionState *GetPersistentExpressionState() override;
-
- clang::ExternalASTMerger &GetMergerUnchecked();
-
- const clang::ExternalASTMerger::OriginMap &GetOriginMap() override {
- return GetMergerUnchecked().GetOrigins();
- }
-private:
- lldb::TargetWP m_target_wp;
- lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
- ///persistent
- ///variables
- ///associated with
- ///this process for
- ///the expression
- ///parser.
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangASTContext_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h b/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h
deleted file mode 100644
index 353b123..0000000
--- a/linux-x64/clang/include/lldb/Symbol/ClangASTImporter.h
+++ /dev/null
@@ -1,401 +0,0 @@
-//===-- ClangASTImporter.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangASTImporter_h_
-#define liblldb_ClangASTImporter_h_
-
-#include <map>
-#include <memory>
-#include <set>
-#include <vector>
-
-#include "clang/AST/ASTImporter.h"
-#include "clang/AST/CharUnits.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/Basic/FileManager.h"
-#include "clang/Basic/FileSystemOptions.h"
-
-#include "lldb/Host/FileSystem.h"
-#include "lldb/Symbol/CompilerDeclContext.h"
-#include "lldb/Symbol/CxxModuleHandler.h"
-#include "lldb/lldb-types.h"
-
-#include "llvm/ADT/DenseMap.h"
-
-namespace lldb_private {
-
-class ClangASTMetrics {
-public:
- static void DumpCounters(Log *log);
- static void ClearLocalCounters() { local_counters = {0, 0, 0, 0, 0, 0}; }
-
- static void RegisterVisibleQuery() {
- ++global_counters.m_visible_query_count;
- ++local_counters.m_visible_query_count;
- }
-
- static void RegisterLexicalQuery() {
- ++global_counters.m_lexical_query_count;
- ++local_counters.m_lexical_query_count;
- }
-
- static void RegisterLLDBImport() {
- ++global_counters.m_lldb_import_count;
- ++local_counters.m_lldb_import_count;
- }
-
- static void RegisterClangImport() {
- ++global_counters.m_clang_import_count;
- ++local_counters.m_clang_import_count;
- }
-
- static void RegisterDeclCompletion() {
- ++global_counters.m_decls_completed_count;
- ++local_counters.m_decls_completed_count;
- }
-
- static void RegisterRecordLayout() {
- ++global_counters.m_record_layout_count;
- ++local_counters.m_record_layout_count;
- }
-
-private:
- struct Counters {
- uint64_t m_visible_query_count;
- uint64_t m_lexical_query_count;
- uint64_t m_lldb_import_count;
- uint64_t m_clang_import_count;
- uint64_t m_decls_completed_count;
- uint64_t m_record_layout_count;
- };
-
- static Counters global_counters;
- static Counters local_counters;
-
- static void DumpCounters(Log *log, Counters &counters);
-};
-
-class ClangASTImporter {
-public:
- struct LayoutInfo {
- LayoutInfo()
- : bit_size(0), alignment(0), field_offsets(), base_offsets(),
- vbase_offsets() {}
- uint64_t bit_size;
- uint64_t alignment;
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- vbase_offsets;
- };
-
- ClangASTImporter()
- : m_file_manager(clang::FileSystemOptions(),
- FileSystem::Instance().GetVirtualFileSystem()) {}
-
- clang::QualType CopyType(clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx, clang::QualType type);
-
- lldb::opaque_compiler_type_t CopyType(clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- lldb::opaque_compiler_type_t type);
-
- CompilerType CopyType(ClangASTContext &dst, const CompilerType &src_type);
-
- clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx,
- clang::Decl *decl);
-
- lldb::opaque_compiler_type_t DeportType(clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- lldb::opaque_compiler_type_t type);
-
- clang::Decl *DeportDecl(clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx, clang::Decl *decl);
-
- void InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout);
-
- bool LayoutRecordType(
- const clang::RecordDecl *record_decl, uint64_t &bit_size,
- uint64_t &alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &base_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &vbase_offsets);
-
- bool CanImport(const CompilerType &type);
-
- bool Import(const CompilerType &type);
-
- bool CompleteType(const CompilerType &compiler_type);
-
- void CompleteDecl(clang::Decl *decl);
-
- bool CompleteTagDecl(clang::TagDecl *decl);
-
- bool CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin);
-
- bool CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *interface_decl);
-
- bool CompleteAndFetchChildren(clang::QualType type);
-
- bool RequireCompleteType(clang::QualType type);
-
- bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
- clang::ASTContext **original_ctx) {
- DeclOrigin origin = GetDeclOrigin(decl);
-
- if (original_decl)
- *original_decl = origin.decl;
-
- if (original_ctx)
- *original_ctx = origin.ctx;
-
- return origin.Valid();
- }
-
- void SetDeclOrigin(const clang::Decl *decl, clang::Decl *original_decl);
-
- ClangASTMetadata *GetDeclMetadata(const clang::Decl *decl);
-
- //
- // Namespace maps
- //
-
- typedef std::vector<std::pair<lldb::ModuleSP, CompilerDeclContext>>
- NamespaceMap;
- typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
-
- void RegisterNamespaceMap(const clang::NamespaceDecl *decl,
- NamespaceMapSP &namespace_map);
-
- NamespaceMapSP GetNamespaceMap(const clang::NamespaceDecl *decl);
-
- void BuildNamespaceMap(const clang::NamespaceDecl *decl);
-
- //
- // Completers for maps
- //
-
- class MapCompleter {
- public:
- virtual ~MapCompleter();
-
- virtual void CompleteNamespaceMap(NamespaceMapSP &namespace_map,
- ConstString name,
- NamespaceMapSP &parent_map) const = 0;
- };
-
- void InstallMapCompleter(clang::ASTContext *dst_ctx,
- MapCompleter &completer) {
- ASTContextMetadataSP context_md;
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter == m_metadata_map.end()) {
- context_md = ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
- m_metadata_map[dst_ctx] = context_md;
- } else {
- context_md = context_md_iter->second;
- }
-
- context_md->m_map_completer = &completer;
- }
-
- void ForgetDestination(clang::ASTContext *dst_ctx);
- void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
-
-private:
- struct DeclOrigin {
- DeclOrigin() : ctx(nullptr), decl(nullptr) {}
-
- DeclOrigin(clang::ASTContext *_ctx, clang::Decl *_decl)
- : ctx(_ctx), decl(_decl) {}
-
- DeclOrigin(const DeclOrigin &rhs) {
- ctx = rhs.ctx;
- decl = rhs.decl;
- }
-
- void operator=(const DeclOrigin &rhs) {
- ctx = rhs.ctx;
- decl = rhs.decl;
- }
-
- bool Valid() { return (ctx != nullptr || decl != nullptr); }
-
- clang::ASTContext *ctx;
- clang::Decl *decl;
- };
-
- typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
-
- /// ASTImporter that intercepts and records the import process of the
- /// underlying ASTImporter.
- ///
- /// This class updates the map from declarations to their original
- /// declarations and can record and complete declarations that have been
- /// imported in a certain interval.
- ///
- /// When intercepting a declaration import, the ASTImporterDelegate uses the
- /// CxxModuleHandler to replace any missing or malformed declarations with
- /// their counterpart from a C++ module.
- class ASTImporterDelegate : public clang::ASTImporter {
- public:
- ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
- clang::ASTContext *source_ctx)
- : clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
- master.m_file_manager, true /*minimal*/),
- m_decls_to_deport(nullptr), m_decls_already_deported(nullptr),
- m_master(master), m_source_ctx(source_ctx) {}
-
- /// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
- /// and deattaches it at the end of the scope. Supports being used multiple
- /// times on the same ASTImporterDelegate instance in nested scopes.
- class CxxModuleScope {
- /// The handler we attach to the ASTImporterDelegate.
- CxxModuleHandler m_handler;
- /// The ASTImporterDelegate we are supposed to attach the handler to.
- ASTImporterDelegate &m_delegate;
- /// True iff we attached the handler to the ASTImporterDelegate.
- bool m_valid = false;
-
- public:
- CxxModuleScope(ASTImporterDelegate &delegate, clang::ASTContext *dst_ctx)
- : m_delegate(delegate) {
- // If the delegate doesn't have a CxxModuleHandler yet, create one
- // and attach it.
- if (!delegate.m_std_handler) {
- m_handler = CxxModuleHandler(delegate, dst_ctx);
- m_valid = true;
- delegate.m_std_handler = &m_handler;
- }
- }
- ~CxxModuleScope() {
- if (m_valid) {
- // Make sure no one messed with the handler we placed.
- assert(m_delegate.m_std_handler == &m_handler);
- m_delegate.m_std_handler = nullptr;
- }
- }
- };
-
- protected:
- llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
-
- public:
- // A call to "InitDeportWorkQueues" puts the delegate into deport mode.
- // In deport mode, every copied Decl that could require completion is
- // recorded and placed into the decls_to_deport set.
- //
- // A call to "ExecuteDeportWorkQueues" completes all the Decls that
- // are in decls_to_deport, adding any Decls it sees along the way that it
- // hasn't already deported. It proceeds until decls_to_deport is empty.
- //
- // These calls must be paired. Leaving a delegate in deport mode or trying
- // to start deport delegate with a new pair of queues will result in an
- // assertion failure.
-
- void
- InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport,
- std::set<clang::NamedDecl *> *decls_already_deported);
- void ExecuteDeportWorkQueues();
-
- void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
-
- void Imported(clang::Decl *from, clang::Decl *to) override;
-
- clang::Decl *GetOriginalDecl(clang::Decl *To) override;
-
- /// Decls we should ignore when mapping decls back to their original
- /// ASTContext. Used by the CxxModuleHandler to mark declarations that
- /// were created from the 'std' C++ module to prevent that the Importer
- /// tries to sync them with the broken equivalent in the debug info AST.
- std::set<clang::Decl *> m_decls_to_ignore;
- std::set<clang::NamedDecl *> *m_decls_to_deport;
- std::set<clang::NamedDecl *> *m_decls_already_deported;
- ClangASTImporter &m_master;
- clang::ASTContext *m_source_ctx;
- CxxModuleHandler *m_std_handler = nullptr;
- };
-
- typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
- typedef std::map<clang::ASTContext *, ImporterDelegateSP> DelegateMap;
- typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP>
- NamespaceMetaMap;
-
- struct ASTContextMetadata {
- ASTContextMetadata(clang::ASTContext *dst_ctx)
- : m_dst_ctx(dst_ctx), m_delegates(), m_origins(), m_namespace_maps(),
- m_map_completer(nullptr) {}
-
- clang::ASTContext *m_dst_ctx;
- DelegateMap m_delegates;
- OriginMap m_origins;
-
- NamespaceMetaMap m_namespace_maps;
- MapCompleter *m_map_completer;
- };
-
- typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP;
- typedef std::map<const clang::ASTContext *, ASTContextMetadataSP>
- ContextMetadataMap;
-
- ContextMetadataMap m_metadata_map;
-
- ASTContextMetadataSP GetContextMetadata(clang::ASTContext *dst_ctx) {
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter == m_metadata_map.end()) {
- ASTContextMetadataSP context_md =
- ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
- m_metadata_map[dst_ctx] = context_md;
- return context_md;
- } else {
- return context_md_iter->second;
- }
- }
-
- ASTContextMetadataSP MaybeGetContextMetadata(clang::ASTContext *dst_ctx) {
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter != m_metadata_map.end())
- return context_md_iter->second;
- else
- return ASTContextMetadataSP();
- }
-
- ImporterDelegateSP GetDelegate(clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx) {
- ASTContextMetadataSP context_md = GetContextMetadata(dst_ctx);
-
- DelegateMap &delegates = context_md->m_delegates;
- DelegateMap::iterator delegate_iter = delegates.find(src_ctx);
-
- if (delegate_iter == delegates.end()) {
- ImporterDelegateSP delegate =
- ImporterDelegateSP(new ASTImporterDelegate(*this, dst_ctx, src_ctx));
- delegates[src_ctx] = delegate;
- return delegate;
- } else {
- return delegate_iter->second;
- }
- }
-
- DeclOrigin GetDeclOrigin(const clang::Decl *decl);
-
- clang::FileManager m_file_manager;
- typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo>
- RecordDeclToLayoutMap;
-
- RecordDeclToLayoutMap m_record_decl_to_layout_map;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangASTImporter_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
deleted file mode 100644
index a2d4f81..0000000
--- a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ /dev/null
@@ -1,138 +0,0 @@
-//===-- ClangExternalASTSourceCallbacks.h -----------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangExternalASTSourceCallbacks_h_
-#define liblldb_ClangExternalASTSourceCallbacks_h_
-
-#include <stdint.h>
-
-#include "clang/AST/CharUnits.h"
-#include "llvm/ADT/DenseMap.h"
-
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
-#include "lldb/Symbol/CompilerType.h"
-#include "lldb/lldb-enumerations.h"
-
-namespace lldb_private {
-
-class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon {
-public:
- typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
- typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
- clang::ObjCInterfaceDecl *);
- typedef void (*FindExternalVisibleDeclsByNameCallback)(
- void *baton, const clang::DeclContext *DC, clang::DeclarationName Name,
- llvm::SmallVectorImpl<clang::NamedDecl *> *results);
- typedef bool (*LayoutRecordTypeCallback)(
- void *baton, const clang::RecordDecl *Record, uint64_t &Size,
- uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &VirtualBaseOffsets);
-
- ClangExternalASTSourceCallbacks(
- CompleteTagDeclCallback tag_decl_callback,
- CompleteObjCInterfaceDeclCallback objc_decl_callback,
- FindExternalVisibleDeclsByNameCallback find_by_name_callback,
- LayoutRecordTypeCallback layout_record_type_callback,
- void *callback_baton)
- : m_callback_tag_decl(tag_decl_callback),
- m_callback_objc_decl(objc_decl_callback),
- m_callback_find_by_name(find_by_name_callback),
- m_callback_layout_record_type(layout_record_type_callback),
- m_callback_baton(callback_baton) {}
-
- // clang::ExternalASTSource
-
- clang::Decl *GetExternalDecl(uint32_t ID) override {
- // This method only needs to be implemented if the AST source ever passes
- // back decl sets as VisibleDeclaration objects.
- return nullptr;
- }
-
- clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
- // This operation is meant to be used via a LazyOffsetPtr. It only needs
- // to be implemented if the AST source uses methods like
- // FunctionDecl::setLazyBody when building decls.
- return nullptr;
- }
-
- clang::Selector GetExternalSelector(uint32_t ID) override {
- // This operation only needs to be implemented if the AST source returns
- // non-zero for GetNumKnownSelectors().
- return clang::Selector();
- }
-
- uint32_t GetNumExternalSelectors() override { return 0; }
-
- clang::CXXBaseSpecifier *
- GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
- return nullptr;
- }
-
- virtual void MaterializeVisibleDecls(const clang::DeclContext *decl_ctx) {}
-
- void FindExternalLexicalDecls(
- const clang::DeclContext *DC,
- llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
- llvm::SmallVectorImpl<clang::Decl *> &Result) override;
-
- bool
- FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx,
- clang::DeclarationName decl_name) override;
-
- void CompleteType(clang::TagDecl *tag_decl) override;
-
- void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
-
- bool layoutRecordType(
- const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
- &VirtualBaseOffsets) override;
-
- void SetExternalSourceCallbacks(
- CompleteTagDeclCallback tag_decl_callback,
- CompleteObjCInterfaceDeclCallback objc_decl_callback,
- FindExternalVisibleDeclsByNameCallback find_by_name_callback,
- LayoutRecordTypeCallback layout_record_type_callback,
- void *callback_baton) {
- m_callback_tag_decl = tag_decl_callback;
- m_callback_objc_decl = objc_decl_callback;
- m_callback_find_by_name = find_by_name_callback;
- m_callback_layout_record_type = layout_record_type_callback;
- m_callback_baton = callback_baton;
- }
-
- void RemoveExternalSourceCallbacks(void *callback_baton) {
- if (callback_baton == m_callback_baton) {
- m_callback_tag_decl = nullptr;
- m_callback_objc_decl = nullptr;
- m_callback_find_by_name = nullptr;
- m_callback_layout_record_type = nullptr;
- }
- }
-
-protected:
- // Classes that inherit from ClangExternalASTSourceCallbacks can see and
- // modify these
- CompleteTagDeclCallback m_callback_tag_decl;
- CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
- FindExternalVisibleDeclsByNameCallback m_callback_find_by_name;
- LayoutRecordTypeCallback m_callback_layout_record_type;
- void *m_callback_baton;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangExternalASTSourceCallbacks_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h
deleted file mode 100644
index 8e69f6d..0000000
--- a/linux-x64/clang/include/lldb/Symbol/ClangExternalASTSourceCommon.h
+++ /dev/null
@@ -1,143 +0,0 @@
-//===-- ClangExternalASTSourceCommon.h --------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ClangExternalASTSourceCommon_h
-#define liblldb_ClangExternalASTSourceCommon_h
-
-// Clang headers like to use NDEBUG inside of them to enable/disable debug
-// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
-// or another. This is bad because it means that if clang was built in release
-// mode, it assumes that you are building in release mode which is not always
-// the case. You can end up with functions that are defined as empty in header
-// files when NDEBUG is not defined, and this can cause link errors with the
-// clang .a files that you have since you might be missing functions in the .a
-// file. So we have to define NDEBUG when including clang headers to avoid any
-// mismatches. This is covered by rdar://problem/8691220
-
-#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF)
-#define LLDB_DEFINED_NDEBUG_FOR_CLANG
-#define NDEBUG
-// Need to include assert.h so it is as clang would expect it to be (disabled)
-#include <assert.h>
-#endif
-
-#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG
-#undef NDEBUG
-#undef LLDB_DEFINED_NDEBUG_FOR_CLANG
-// Need to re-include assert.h so it is as _we_ would expect it to be (enabled)
-#include <assert.h>
-#endif
-
-#include "clang/AST/ExternalASTSource.h"
-
-#include "lldb/Core/dwarf.h"
-#include "lldb/lldb-defines.h"
-#include "lldb/lldb-enumerations.h"
-
-namespace lldb_private {
-
-class ClangASTMetadata {
-public:
- ClangASTMetadata()
- : m_user_id(0), m_union_is_user_id(false), m_union_is_isa_ptr(false),
- m_has_object_ptr(false), m_is_self(false), m_is_dynamic_cxx(true) {}
-
- bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx; }
-
- void SetIsDynamicCXXType(bool b) { m_is_dynamic_cxx = b; }
-
- void SetUserID(lldb::user_id_t user_id) {
- m_user_id = user_id;
- m_union_is_user_id = true;
- m_union_is_isa_ptr = false;
- }
-
- lldb::user_id_t GetUserID() const {
- if (m_union_is_user_id)
- return m_user_id;
- else
- return LLDB_INVALID_UID;
- }
-
- void SetISAPtr(uint64_t isa_ptr) {
- m_isa_ptr = isa_ptr;
- m_union_is_user_id = false;
- m_union_is_isa_ptr = true;
- }
-
- uint64_t GetISAPtr() const {
- if (m_union_is_isa_ptr)
- return m_isa_ptr;
- else
- return 0;
- }
-
- void SetObjectPtrName(const char *name) {
- m_has_object_ptr = true;
- if (strcmp(name, "self") == 0)
- m_is_self = true;
- else if (strcmp(name, "this") == 0)
- m_is_self = false;
- else
- m_has_object_ptr = false;
- }
-
- lldb::LanguageType GetObjectPtrLanguage() const {
- if (m_has_object_ptr) {
- if (m_is_self)
- return lldb::eLanguageTypeObjC;
- else
- return lldb::eLanguageTypeC_plus_plus;
- }
- return lldb::eLanguageTypeUnknown;
- }
-
- const char *GetObjectPtrName() const {
- if (m_has_object_ptr) {
- if (m_is_self)
- return "self";
- else
- return "this";
- } else
- return nullptr;
- }
-
- bool HasObjectPtr() const { return m_has_object_ptr; }
-
- void Dump(Stream *s);
-
-private:
- union {
- lldb::user_id_t m_user_id;
- uint64_t m_isa_ptr;
- };
-
- bool m_union_is_user_id : 1, m_union_is_isa_ptr : 1, m_has_object_ptr : 1,
- m_is_self : 1, m_is_dynamic_cxx : 1;
-};
-
-class ClangExternalASTSourceCommon : public clang::ExternalASTSource {
-public:
- ClangExternalASTSourceCommon();
- ~ClangExternalASTSourceCommon() override;
-
- ClangASTMetadata *GetMetadata(const void *object);
- void SetMetadata(const void *object, ClangASTMetadata &metadata);
- bool HasMetadata(const void *object);
-
- static ClangExternalASTSourceCommon *Lookup(clang::ExternalASTSource *source);
-
-private:
- typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;
-
- MetadataMap m_metadata;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ClangExternalASTSourceCommon_h
diff --git a/linux-x64/clang/include/lldb/Symbol/ClangUtil.h b/linux-x64/clang/include/lldb/Symbol/ClangUtil.h
deleted file mode 100644
index d610603..0000000
--- a/linux-x64/clang/include/lldb/Symbol/ClangUtil.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===-- ClangUtil.h ---------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-// A collection of helper methods and data structures for manipulating clang
-// types and decls.
-//===----------------------------------------------------------------------===//
-
-#ifndef LLDB_SYMBOL_CLANGUTIL_H
-#define LLDB_SYMBOL_CLANGUTIL_H
-
-#include "clang/AST/Type.h"
-
-#include "lldb/Symbol/CompilerType.h"
-
-namespace clang {
-class TagDecl;
-}
-
-namespace lldb_private {
-struct ClangUtil {
- static bool IsClangType(const CompilerType &ct);
-
- static clang::QualType GetQualType(const CompilerType &ct);
-
- static clang::QualType GetCanonicalQualType(const CompilerType &ct);
-
- static CompilerType RemoveFastQualifiers(const CompilerType &ct);
-
- static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
-};
-}
-
-#endif
diff --git a/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h b/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h
index 2646661..e622c5f 100644
--- a/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h
+++ b/linux-x64/clang/include/lldb/Symbol/CompactUnwindInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CompactUnwindInfo_h_
-#define liblldb_CompactUnwindInfo_h_
+#ifndef LLDB_SYMBOL_COMPACTUNWINDINFO_H
+#define LLDB_SYMBOL_COMPACTUNWINDINFO_H
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
@@ -164,4 +164,4 @@
} // namespace lldb_private
-#endif // liblldb_CompactUnwindInfo_h_
+#endif // LLDB_SYMBOL_COMPACTUNWINDINFO_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CompileUnit.h b/linux-x64/clang/include/lldb/Symbol/CompileUnit.h
index c3ba2e2..256148f 100644
--- a/linux-x64/clang/include/lldb/Symbol/CompileUnit.h
+++ b/linux-x64/clang/include/lldb/Symbol/CompileUnit.h
@@ -6,19 +6,21 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CompUnit_h_
-#define liblldb_CompUnit_h_
+#ifndef LLDB_SYMBOL_COMPILEUNIT_H
+#define LLDB_SYMBOL_COMPILEUNIT_H
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SourceModule.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
namespace lldb_private {
/// \class CompileUnit CompileUnit.h "lldb/Symbol/CompileUnit.h"
@@ -34,7 +36,6 @@
/// table.
class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
public ModuleChild,
- public FileSpec,
public UserID,
public SymbolContextScope {
public:
@@ -44,7 +45,7 @@
/// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the
/// source language type.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The parent module that owns this compile unit. This value
/// must be a valid pointer value.
///
@@ -82,7 +83,7 @@
/// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the
/// source language type.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The parent module that owns this compile unit. This value
/// must be a valid pointer value.
///
@@ -115,9 +116,6 @@
const FileSpec &file_spec, lldb::user_id_t uid,
lldb::LanguageType language, lldb_private::LazyBool is_optimized);
- /// Destructor
- ~CompileUnit() override;
-
/// Add a function to this compile unit.
///
/// Typically called by the SymbolFile plug-ins as they partially parse the
@@ -163,6 +161,18 @@
void ForeachFunction(
llvm::function_ref<bool(const lldb::FunctionSP &)> lambda) const;
+ /// Find a function in the compile unit based on the predicate matching_lambda
+ ///
+ /// \param[in] matching_lambda
+ /// A predicate that will be used within FindFunction to evaluate each
+ /// FunctionSP in m_functions_by_uid. When the predicate returns true
+ /// FindFunction will return the corresponding FunctionSP.
+ ///
+ /// \return
+ /// The first FunctionSP that the matching_lambda prediate returns true for.
+ lldb::FunctionSP FindFunction(
+ llvm::function_ref<bool(const lldb::FunctionSP &)> matching_lambda);
+
/// Dump the compile unit contents to the stream \a s.
///
/// \param[in] s
@@ -212,6 +222,9 @@
const FileSpec *file_spec_ptr, bool exact,
LineEntry *line_entry);
+ /// Return the primary source file associated with this compile unit.
+ const FileSpec &GetPrimaryFile() const { return m_file_spec; }
+
/// Get the line table for the compile unit.
///
/// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins
@@ -225,6 +238,25 @@
DebugMacros *GetDebugMacros();
+ /// Apply a lambda to each external lldb::Module referenced by this
+ /// compilation unit. Recursively also descends into the referenced external
+ /// modules of any encountered compilation unit.
+ ///
+ /// \param visited_symbol_files
+ /// A set of SymbolFiles that were already visited to avoid
+ /// visiting one file more than once.
+ ///
+ /// \param[in] lambda
+ /// The lambda that should be applied to every function. The lambda can
+ /// return true if the iteration should be aborted earlier.
+ ///
+ /// \return
+ /// If the lambda early-exited, this function returns true to
+ /// propagate the early exit.
+ virtual bool ForEachExternalModule(
+ llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
+ llvm::function_ref<bool(Module &)> lambda);
+
/// Get the compile unit's support file list.
///
/// The support file list is used by the line table, and any objects that
@@ -298,6 +330,8 @@
/// A line table object pointer that this object now owns.
void SetLineTable(LineTable *line_table);
+ void SetSupportFiles(const FileSpecList &support_files);
+
void SetDebugMacros(const DebugMacrosSP &debug_macros);
/// Set accessor for the variable list.
@@ -347,14 +381,11 @@
/// A SymbolContext list class that will get any matching
/// entries appended to.
///
- /// \return
- /// The number of new matches that were added to \a sc_list.
- ///
/// \see enum SymbolContext::Scope
- uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
- bool check_inlines, bool exact,
- lldb::SymbolContextItem resolve_scope,
- SymbolContextList &sc_list);
+ void ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
+ bool check_inlines, bool exact,
+ lldb::SymbolContextItem resolve_scope,
+ SymbolContextList &sc_list);
/// Get whether compiler optimizations were enabled for this compile unit
///
@@ -384,6 +415,8 @@
/// All modules, including the current module, imported by this
/// compile unit.
std::vector<SourceModule> m_imported_modules;
+ /// The primary file associated with this compile unit.
+ FileSpec m_file_spec;
/// Files associated with this compile unit's line table and
/// declarations.
FileSpecList m_support_files;
@@ -414,9 +447,10 @@
(1u << 6) ///< Have we parsed the debug macros already?
};
- DISALLOW_COPY_AND_ASSIGN(CompileUnit);
+ CompileUnit(const CompileUnit &) = delete;
+ const CompileUnit &operator=(const CompileUnit &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_CompUnit_h_
+#endif // LLDB_SYMBOL_COMPILEUNIT_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h b/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h
index 4817ec4..67290b9 100644
--- a/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerDecl.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CompilerDecl_h_
-#define liblldb_CompilerDecl_h_
+#ifndef LLDB_SYMBOL_COMPILERDECL_H
+#define LLDB_SYMBOL_COMPILERDECL_H
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Utility/ConstString.h"
@@ -15,16 +15,28 @@
namespace lldb_private {
+/// Represents a generic declaration such as a function declaration.
+///
+/// This class serves as an abstraction for a declaration inside one of the
+/// TypeSystems implemented by the language plugins. It does not have any actual
+/// logic in it but only stores an opaque pointer and a pointer to the
+/// TypeSystem that gives meaning to this opaque pointer. All methods of this
+/// class should call their respective method in the TypeSystem interface and
+/// pass the opaque pointer along.
+///
+/// \see lldb_private::TypeSystem
class CompilerDecl {
public:
// Constructors and Destructors
- CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {}
+ CompilerDecl() = default;
+ /// Creates a CompilerDecl with the given TypeSystem and opaque pointer.
+ ///
+ /// This constructor should only be called from the respective TypeSystem
+ /// implementation.
CompilerDecl(TypeSystem *type_system, void *decl)
: m_type_system(type_system), m_opaque_decl(decl) {}
- ~CompilerDecl() {}
-
// Tests
explicit operator bool() const { return IsValid(); }
@@ -39,8 +51,6 @@
return m_type_system != nullptr && m_opaque_decl != nullptr;
}
- bool IsClang() const;
-
// Accessors
TypeSystem *GetTypeSystem() const { return m_type_system; }
@@ -75,8 +85,8 @@
CompilerType GetFunctionArgumentType(size_t arg_idx) const;
private:
- TypeSystem *m_type_system;
- void *m_opaque_decl;
+ TypeSystem *m_type_system = nullptr;
+ void *m_opaque_decl = nullptr;
};
bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs);
@@ -84,4 +94,4 @@
} // namespace lldb_private
-#endif // #ifndef liblldb_CompilerDecl_h_
+#endif // LLDB_SYMBOL_COMPILERDECL_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h b/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h
index e7958c0..87d4ca3 100644
--- a/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerDeclContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CompilerDeclContext_h_
-#define liblldb_CompilerDeclContext_h_
+#ifndef LLDB_SYMBOL_COMPILERDECLCONTEXT_H
+#define LLDB_SYMBOL_COMPILERDECLCONTEXT_H
#include <vector>
@@ -16,16 +16,32 @@
namespace lldb_private {
+/// Represents a generic declaration context in a program. A declaration context
+/// is data structure that contains declarations (e.g. namespaces).
+///
+/// This class serves as an abstraction for a declaration context inside one of
+/// the TypeSystems implemented by the language plugins. It does not have any
+/// actual logic in it but only stores an opaque pointer and a pointer to the
+/// TypeSystem that gives meaning to this opaque pointer. All methods of this
+/// class should call their respective method in the TypeSystem interface and
+/// pass the opaque pointer along.
+///
+/// \see lldb_private::TypeSystem
class CompilerDeclContext {
public:
- // Constructors and Destructors
- CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {}
+ /// Constructs an invalid CompilerDeclContext.
+ CompilerDeclContext() = default;
+ /// Constructs a CompilerDeclContext with the given opaque decl context
+ /// and its respective TypeSystem instance.
+ ///
+ /// This constructor should only be called from the respective TypeSystem
+ /// implementation.
+ ///
+ /// \see lldb_private::TypeSystemClang::CreateDeclContext(clang::DeclContext*)
CompilerDeclContext(TypeSystem *type_system, void *decl_ctx)
: m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {}
- ~CompilerDeclContext() {}
-
// Tests
explicit operator bool() const { return IsValid(); }
@@ -40,8 +56,6 @@
return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
}
- bool IsClang() const;
-
std::vector<CompilerDecl> FindDeclByName(ConstString name,
const bool ignore_using_decls);
@@ -102,11 +116,9 @@
ConstString GetScopeQualifiedName() const;
- bool IsStructUnionOrClass() const;
-
private:
- TypeSystem *m_type_system;
- void *m_opaque_decl_ctx;
+ TypeSystem *m_type_system = nullptr;
+ void *m_opaque_decl_ctx = nullptr;
};
bool operator==(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
@@ -114,4 +126,4 @@
} // namespace lldb_private
-#endif // #ifndef liblldb_CompilerDeclContext_h_
+#endif // LLDB_SYMBOL_COMPILERDECLCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CompilerType.h b/linux-x64/clang/include/lldb/Symbol/CompilerType.h
index 98d9165..5a0e8e5 100644
--- a/linux-x64/clang/include/lldb/Symbol/CompilerType.h
+++ b/linux-x64/clang/include/lldb/Symbol/CompilerType.h
@@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_CompilerType_h_
-#define liblldb_CompilerType_h_
+#ifndef LLDB_SYMBOL_COMPILERTYPE_H
+#define LLDB_SYMBOL_COMPILERTYPE_H
#include <functional>
#include <string>
#include <vector>
-#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -21,45 +20,54 @@
class DataExtractor;
-// A class that can carry around a clang ASTContext and a opaque clang
-// QualType. A clang::QualType can be easily reconstructed from an opaque clang
-// type and often the ASTContext is needed when doing various type related
-// tasks, so this class allows both items to travel in a single very
-// lightweight class that can be used. There are many static equivalents of the
-// member functions that allow the ASTContext and the opaque clang QualType to
-// be specified for ease of use and to avoid code duplication.
+/// Generic representation of a type in a programming language.
+///
+/// This class serves as an abstraction for a type inside one of the TypeSystems
+/// implemented by the language plugins. It does not have any actual logic in it
+/// but only stores an opaque pointer and a pointer to the TypeSystem that
+/// gives meaning to this opaque pointer. All methods of this class should call
+/// their respective method in the TypeSystem interface and pass the opaque
+/// pointer along.
+///
+/// \see lldb_private::TypeSystem
class CompilerType {
public:
- // Constructors and Destructors
- CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
- CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
+ /// Creates a CompilerType with the given TypeSystem and opaque compiler type.
+ ///
+ /// This constructor should only be called from the respective TypeSystem
+ /// implementation.
+ ///
+ /// \see lldb_private::TypeSystemClang::GetType(clang::QualType)
+ CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
+ : m_type(type), m_type_system(type_system) {
+ assert(Verify() && "verification failed");
+ }
CompilerType(const CompilerType &rhs)
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
- CompilerType() : m_type(nullptr), m_type_system(nullptr) {}
+ CompilerType() = default;
- ~CompilerType();
-
- // Operators
-
+ /// Operators.
+ /// \{
const CompilerType &operator=(const CompilerType &rhs) {
m_type = rhs.m_type;
m_type_system = rhs.m_type_system;
return *this;
}
- // Tests
-
- explicit operator bool() const {
- return m_type != nullptr && m_type_system != nullptr;
- }
-
bool operator<(const CompilerType &rhs) const {
if (m_type_system == rhs.m_type_system)
return m_type < rhs.m_type;
return m_type_system < rhs.m_type_system;
}
+ /// \}
+
+ /// Tests.
+ /// \{
+ explicit operator bool() const {
+ return m_type != nullptr && m_type_system != nullptr;
+ }
bool IsValid() const { return m_type != nullptr && m_type_system != nullptr; }
@@ -74,6 +82,8 @@
bool IsAnonymousType() const;
+ bool IsScopedEnumerationType() const;
+
bool IsBeingDefined() const;
bool IsCharType() const;
@@ -88,7 +98,7 @@
bool IsFloatingPointType(uint32_t &count, bool &is_complex) const;
- bool IsFunctionType(bool *is_variadic_ptr = nullptr) const;
+ bool IsFunctionType() const;
uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
@@ -110,13 +120,9 @@
bool IsPolymorphicClass() const;
- bool
- IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
- return IsPossibleDynamicType(target_type, true, false);
- }
-
- bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
- bool check_cplusplus, bool check_objc) const;
+ /// \param target_type Can pass nullptr.
+ bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus,
+ bool check_objc) const;
bool IsPointerToScalarType() const;
@@ -136,23 +142,22 @@
bool IsTypedefType() const;
bool IsVoidType() const;
+ /// \}
- // Type Completion
-
+ /// Type Completion.
+ /// \{
bool GetCompleteType() const;
+ /// \}
- // AST related queries
-
+ /// AST related queries.
+ /// \{
size_t GetPointerByteSize() const;
+ /// \}
- // Accessors
-
+ /// Accessors.
+ /// \{
TypeSystem *GetTypeSystem() const { return m_type_system; }
- ConstString GetConstQualifiedTypeName() const;
-
- ConstString GetConstTypeName() const;
-
ConstString GetTypeName() const;
ConstString GetDisplayTypeName() const;
@@ -169,13 +174,12 @@
void SetCompilerType(TypeSystem *type_system,
lldb::opaque_compiler_type_t type);
- void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
-
unsigned GetTypeQualifiers() const;
+ /// \}
- // Creating related types
-
- CompilerType GetArrayElementType(uint64_t *stride = nullptr) const;
+ /// Creating related types.
+ /// \{
+ CompilerType GetArrayElementType(ExecutionContextScope *exe_scope) const;
CompilerType GetArrayType(uint64_t size) const;
@@ -183,8 +187,10 @@
CompilerType GetFullyUnqualifiedType() const;
- // Returns -1 if this isn't a function of if the function doesn't have a
- // prototype Returns a value >= 0 if there is a prototype.
+ CompilerType GetEnumerationIntegerType() const;
+
+ /// Returns -1 if this isn't a function of if the function doesn't
+ /// have a prototype Returns a value >= 0 if there is a prototype.
int GetFunctionArgumentCount() const;
CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const;
@@ -195,57 +201,65 @@
TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx);
- // If this type is a reference to a type (L value or R value reference),
- // return a new type with the reference removed, else return the current type
- // itself.
+ /// If this type is a reference to a type (L value or R value reference),
+ /// return a new type with the reference removed, else return the current type
+ /// itself.
CompilerType GetNonReferenceType() const;
- // If this type is a pointer type, return the type that the pointer points
- // to, else return an invalid type.
+ /// If this type is a pointer type, return the type that the pointer points
+ /// to, else return an invalid type.
CompilerType GetPointeeType() const;
- // Return a new CompilerType that is a pointer to this type
+ /// Return a new CompilerType that is a pointer to this type
CompilerType GetPointerType() const;
- // Return a new CompilerType that is a L value reference to this type if this
- // type is valid and the type system supports L value references, else return
- // an invalid type.
+ /// Return a new CompilerType that is a L value reference to this type if this
+ /// type is valid and the type system supports L value references, else return
+ /// an invalid type.
CompilerType GetLValueReferenceType() const;
- // Return a new CompilerType that is a R value reference to this type if this
- // type is valid and the type system supports R value references, else return
- // an invalid type.
+ /// Return a new CompilerType that is a R value reference to this type if this
+ /// type is valid and the type system supports R value references, else return
+ /// an invalid type.
CompilerType GetRValueReferenceType() const;
- // Return a new CompilerType adds a const modifier to this type if this type
- // is valid and the type system supports const modifiers, else return an
- // invalid type.
+ /// Return a new CompilerType adds a const modifier to this type if this type
+ /// is valid and the type system supports const modifiers, else return an
+ /// invalid type.
CompilerType AddConstModifier() const;
- // Return a new CompilerType adds a volatile modifier to this type if this
- // type is valid and the type system supports volatile modifiers, else return
- // an invalid type.
+ /// Return a new CompilerType adds a volatile modifier to this type if this
+ /// type is valid and the type system supports volatile modifiers, else return
+ /// an invalid type.
CompilerType AddVolatileModifier() const;
- // Return a new CompilerType adds a restrict modifier to this type if this
- // type is valid and the type system supports restrict modifiers, else return
- // an invalid type.
+ /// Return a new CompilerType that is the atomic type of this type. If this
+ /// type is not valid or the type system doesn't support atomic types, this
+ /// returns an invalid type.
+ CompilerType GetAtomicType() const;
+
+ /// Return a new CompilerType adds a restrict modifier to this type if this
+ /// type is valid and the type system supports restrict modifiers, else return
+ /// an invalid type.
CompilerType AddRestrictModifier() const;
- // Create a typedef to this type using "name" as the name of the typedef this
- // type is valid and the type system supports typedefs, else return an
- // invalid type.
+ /// Create a typedef to this type using "name" as the name of the typedef this
+ /// type is valid and the type system supports typedefs, else return an
+ /// invalid type.
+ /// \param payload The typesystem-specific \p lldb::Type payload.
CompilerType CreateTypedef(const char *name,
- const CompilerDeclContext &decl_ctx) const;
+ const CompilerDeclContext &decl_ctx,
+ uint32_t payload) const;
- // If the current object represents a typedef type, get the underlying type
+ /// If the current object represents a typedef type, get the underlying type
CompilerType GetTypedefedType() const;
- // Create related types using the current type's AST
+ /// Create related types using the current type's AST
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const;
+ /// \}
- // Exploring the type
-
+ /// Exploring the type.
+ /// \{
struct IntegralTemplateArgument;
/// Return the size of the type in bytes.
@@ -257,7 +271,8 @@
lldb::Format GetFormat() const;
- size_t GetTypeBitAlign() const;
+ llvm::Optional<size_t>
+ GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
uint32_t GetNumChildren(bool omit_empty_base_classes,
const ExecutionContext *exe_ctx) const;
@@ -266,12 +281,11 @@
static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
- // If this type is an enumeration, iterate through all of its enumerators
- // using a callback. If the callback returns true, keep iterating, else abort
- // the iteration.
+ /// If this type is an enumeration, iterate through all of its enumerators
+ /// using a callback. If the callback returns true, keep iterating, else abort
+ /// the iteration.
void ForEachEnumerator(
- std::function<bool(const CompilerType &integer_type,
- ConstString name,
+ std::function<bool(const CompilerType &integer_type, ConstString name,
const llvm::APSInt &value)> const &callback) const;
uint32_t GetNumFields() const;
@@ -306,17 +320,17 @@
bool &child_is_deref_of_parent, ValueObject *valobj,
uint64_t &language_flags) const;
- // Lookup a child given a name. This function will match base class names and
- // member member names in "clang_type" only, not descendants.
+ /// Lookup a child given a name. This function will match base class names and
+ /// member member names in "clang_type" only, not descendants.
uint32_t GetIndexOfChildWithName(const char *name,
bool omit_empty_base_classes) const;
- // Lookup a child member given a name. This function will match member names
- // only and will descend into "clang_type" children in search for the first
- // member in this class, or any base class that matches "name".
- // TODO: Return all matches for a given name by returning a
- // vector<vector<uint32_t>>
- // so we catch all names that match a given child name, not just the first.
+ /// Lookup a child member given a name. This function will match member names
+ /// only and will descend into "clang_type" children in search for the first
+ /// member in this class, or any base class that matches "name".
+ /// TODO: Return all matches for a given name by returning a
+ /// vector<vector<uint32_t>>
+ /// so we catch all names that match a given child name, not just the first.
size_t
GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes,
std::vector<uint32_t> &child_indexes) const;
@@ -326,7 +340,7 @@
lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const;
CompilerType GetTypeTemplateArgument(size_t idx) const;
- // Returns the value of the template argument and its type.
+ /// Returns the value of the template argument and its type.
llvm::Optional<IntegralTemplateArgument>
GetIntegralTemplateArgument(size_t idx) const;
@@ -335,16 +349,10 @@
LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const;
bool IsMeaninglessWithoutDynamicResolution() const;
+ /// \}
- // Pointers & References
-
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- size_t ConvertStringToFloatValue(const char *s, uint8_t *dst,
- size_t dst_size) const;
-
- // Dumping types
-
+ /// Dumping types.
+ /// \{
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
/// Don't call this function from actual code.
@@ -366,29 +374,36 @@
const DataExtractor &data, lldb::offset_t data_offset,
size_t data_byte_size);
- void DumpTypeDescription() const; // Dump to stdout
+ /// Dump to stdout.
+ void DumpTypeDescription(lldb::DescriptionLevel level =
+ lldb::eDescriptionLevelFull) const;
- void DumpTypeDescription(Stream *s) const;
+ /// Print a description of the type to a stream. The exact implementation
+ /// varies, but the expectation is that eDescriptionLevelFull returns a
+ /// source-like representation of the type, whereas eDescriptionLevelVerbose
+ /// does a dump of the underlying AST if applicable.
+ void DumpTypeDescription(Stream *s, lldb::DescriptionLevel level =
+ lldb::eDescriptionLevelFull) const;
+ /// \}
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
- size_t data_byte_size, Scalar &value) const;
-
- bool SetValueFromScalar(const Scalar &value, Stream &strm);
-
- bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
- AddressType address_type, DataExtractor &data);
-
- bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
- AddressType address_type, StreamString &new_value);
-
+ size_t data_byte_size, Scalar &value,
+ ExecutionContextScope *exe_scope) const;
void Clear() {
m_type = nullptr;
m_type_system = nullptr;
}
private:
- lldb::opaque_compiler_type_t m_type;
- TypeSystem *m_type_system;
+#ifndef NDEBUG
+ /// If the type is valid, ask the TypeSystem to verify the integrity
+ /// of the type to catch CompilerTypes that mix and match invalid
+ /// TypeSystem/Opaque type pairs.
+ bool Verify() const;
+#endif
+
+ lldb::opaque_compiler_type_t m_type = nullptr;
+ TypeSystem *m_type_system = nullptr;
};
bool operator==(const CompilerType &lhs, const CompilerType &rhs);
@@ -401,4 +416,4 @@
} // namespace lldb_private
-#endif // liblldb_CompilerType_h_
+#endif // LLDB_SYMBOL_COMPILERTYPE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h b/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h
deleted file mode 100644
index f4aef36..0000000
--- a/linux-x64/clang/include/lldb/Symbol/CxxModuleHandler.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//===-- CxxModuleHandler.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CxxModuleHandler_h_
-#define liblldb_CxxModuleHandler_h_
-
-#include "clang/AST/ASTImporter.h"
-#include "clang/Sema/Sema.h"
-#include "llvm/ADT/StringSet.h"
-
-namespace lldb_private {
-
-/// Handles importing decls into an ASTContext with an attached C++ module.
-///
-/// This class searches a C++ module (which must be attached to the target
-/// ASTContext) for an equivalent decl to the one that should be imported.
-/// If the decl that is found in the module is a suitable replacement
-/// for the decl that should be imported, the module decl will be treated as
-/// the result of the import process.
-///
-/// If the Decl that should be imported is a template specialization
-/// that doesn't exist yet in the target ASTContext (e.g. `std::vector<int>`),
-/// then this class tries to create the template specialization in the target
-/// ASTContext. This is only possible if the CxxModuleHandler can determine
-/// that instantiating this template is safe to do, e.g. because the target
-/// decl is a container class from the STL.
-class CxxModuleHandler {
- /// The ASTImporter that should be used to import any Decls which aren't
- /// directly handled by this class itself.
- clang::ASTImporter *m_importer = nullptr;
-
- /// The Sema instance of the target ASTContext.
- clang::Sema *m_sema = nullptr;
-
- /// List of template names this class currently supports. These are the
- /// template names inside the 'std' namespace such as 'vector' or 'list'.
- llvm::StringSet<> m_supported_templates;
-
- /// Tries to manually instantiate the given foreign template in the target
- /// context (designated by m_sema).
- llvm::Optional<clang::Decl *> tryInstantiateStdTemplate(clang::Decl *d);
-
-public:
- CxxModuleHandler() = default;
- CxxModuleHandler(clang::ASTImporter &importer, clang::ASTContext *target);
-
- /// Attempts to import the given decl into the target ASTContext by
- /// deserializing it from the 'std' module. This function returns a Decl if a
- /// Decl has been deserialized from the 'std' module. Otherwise this function
- /// returns nothing.
- llvm::Optional<clang::Decl *> Import(clang::Decl *d);
-
- /// Returns true iff this instance is capable of importing any declarations
- /// in the target ASTContext.
- bool isValid() const { return m_sema != nullptr; }
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CxxModuleHandler_h_
diff --git a/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h b/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h
index 104075f..f85bc7e 100644
--- a/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h
+++ b/linux-x64/clang/include/lldb/Symbol/DWARFCallFrameInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DWARFCallFrameInfo_h_
-#define liblldb_DWARFCallFrameInfo_h_
+#ifndef LLDB_SYMBOL_DWARFCALLFRAMEINFO_H
+#define LLDB_SYMBOL_DWARFCALLFRAMEINFO_H
#include <map>
#include <mutex>
@@ -166,4 +166,4 @@
} // namespace lldb_private
-#endif // liblldb_DWARFCallFrameInfo_h_
+#endif // LLDB_SYMBOL_DWARFCALLFRAMEINFO_H
diff --git a/linux-x64/clang/include/lldb/Symbol/DebugMacros.h b/linux-x64/clang/include/lldb/Symbol/DebugMacros.h
index d364299..0ea70f5 100644
--- a/linux-x64/clang/include/lldb/Symbol/DebugMacros.h
+++ b/linux-x64/clang/include/lldb/Symbol/DebugMacros.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DebugMacros_h_
-#define liblldb_DebugMacros_h_
+#ifndef LLDB_SYMBOL_DEBUGMACROS_H
+#define LLDB_SYMBOL_DEBUGMACROS_H
#include <memory>
#include <vector>
@@ -23,9 +23,10 @@
class DebugMacroEntry {
public:
- enum EntryType { INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT };
+ enum EntryType : uint8_t {
+ INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT
+ };
-public:
static DebugMacroEntry CreateDefineEntry(uint32_t line, const char *str);
static DebugMacroEntry CreateUndefEntry(uint32_t line, const char *str);
@@ -42,7 +43,7 @@
~DebugMacroEntry() = default;
- EntryType GetType() const { return m_type; }
+ EntryType GetType() const { return static_cast<EntryType>(m_type); }
uint64_t GetLineNumber() const { return m_line; }
@@ -60,7 +61,7 @@
DebugMacroEntry(EntryType type, const DebugMacrosSP &debug_macros_sp);
- EntryType m_type : 3;
+ uint32_t m_type : 3;
uint32_t m_line : 29;
uint32_t m_debug_line_file_idx;
ConstString m_str;
@@ -87,11 +88,12 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(DebugMacros);
+ DebugMacros(const DebugMacros &) = delete;
+ const DebugMacros &operator=(const DebugMacros &) = delete;
std::vector<DebugMacroEntry> m_macro_entries;
};
} // namespace lldb_private
-#endif // liblldb_DebugMacros_h_
+#endif // LLDB_SYMBOL_DEBUGMACROS_H
diff --git a/linux-x64/clang/include/lldb/Symbol/DeclVendor.h b/linux-x64/clang/include/lldb/Symbol/DeclVendor.h
index 9c10fe1..67dcaf1 100644
--- a/linux-x64/clang/include/lldb/Symbol/DeclVendor.h
+++ b/linux-x64/clang/include/lldb/Symbol/DeclVendor.h
@@ -6,14 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DeclVendor_h_
-#define liblldb_DeclVendor_h_
+#ifndef LLDB_SYMBOL_DECLVENDOR_H
+#define LLDB_SYMBOL_DECLVENDOR_H
-#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-defines.h"
-#include "clang/AST/ExternalASTMerger.h"
-
#include <vector>
namespace lldb_private {
@@ -22,11 +19,19 @@
// declarations that are not necessarily backed by a specific symbol file.
class DeclVendor {
public:
+ enum DeclVendorKind {
+ eClangDeclVendor,
+ eClangModuleDeclVendor,
+ eAppleObjCDeclVendor,
+ eLastClangDeclVendor,
+ };
// Constructors and Destructors
- DeclVendor() {}
+ DeclVendor(DeclVendorKind kind) : m_kind(kind) {}
virtual ~DeclVendor() {}
+ DeclVendorKind GetKind() const { return m_kind; }
+
/// Look up the set of Decls that the DeclVendor currently knows about
/// matching a given name.
///
@@ -45,7 +50,7 @@
/// max_matches.
virtual uint32_t FindDecls(ConstString name, bool append,
uint32_t max_matches,
- std::vector<clang::NamedDecl *> &decls) = 0;
+ std::vector<CompilerDecl> &decls) = 0;
/// Look up the types that the DeclVendor currently knows about matching a
/// given name.
@@ -60,16 +65,12 @@
/// The vector of CompilerTypes that was found.
std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
- /// Interface for ExternalASTMerger. Returns an ImporterSource
- /// allowing type completion.
- ///
- /// \return
- /// An ImporterSource for this DeclVendor.
- virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
-
private:
// For DeclVendor only
- DISALLOW_COPY_AND_ASSIGN(DeclVendor);
+ DeclVendor(const DeclVendor &) = delete;
+ const DeclVendor &operator=(const DeclVendor &) = delete;
+
+ const DeclVendorKind m_kind;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Symbol/Declaration.h b/linux-x64/clang/include/lldb/Symbol/Declaration.h
index 63798f8..7f19f45 100644
--- a/linux-x64/clang/include/lldb/Symbol/Declaration.h
+++ b/linux-x64/clang/include/lldb/Symbol/Declaration.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Declaration_h_
-#define liblldb_Declaration_h_
+#ifndef LLDB_SYMBOL_DECLARATION_H
+#define LLDB_SYMBOL_DECLARATION_H
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-private.h"
@@ -55,16 +55,6 @@
{
}
- /// Construct with a reference to another Declaration object.
- Declaration(const Declaration &rhs)
- : m_file(rhs.m_file), m_line(rhs.m_line)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- ,
- m_column(rhs.m_column)
-#endif
- {
- }
-
/// Construct with a pointer to another Declaration object.
Declaration(const Declaration *decl_ptr)
: m_file(), m_line(0)
@@ -102,9 +92,9 @@
/// The Right Hand Side const Declaration object reference.
///
/// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// -1 if lhs < rhs
+ /// 0 if lhs == rhs
+ /// 1 if lhs > rhs
static int Compare(const Declaration &lhs, const Declaration &rhs);
/// Checks if this object has the same file and line as another declaration
@@ -212,4 +202,4 @@
} // namespace lldb_private
-#endif // liblldb_Declaration_h_
+#endif // LLDB_SYMBOL_DECLARATION_H
diff --git a/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h b/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h
index cc767d4..2e841b3 100644
--- a/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h
+++ b/linux-x64/clang/include/lldb/Symbol/FuncUnwinders.h
@@ -1,5 +1,5 @@
-#ifndef liblldb_FuncUnwinders_h
-#define liblldb_FuncUnwinders_h
+#ifndef LLDB_SYMBOL_FUNCUNWINDERS_H
+#define LLDB_SYMBOL_FUNCUNWINDERS_H
#include "lldb/Core/AddressRange.h"
#include "lldb/lldb-private-enumerations.h"
@@ -76,6 +76,11 @@
lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread);
+ lldb::UnwindPlanSP GetObjectFileUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetObjectFileAugmentedUnwindPlan(Target &target,
+ Thread &thread);
+
lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target);
lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
@@ -113,10 +118,12 @@
std::recursive_mutex m_mutex;
lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
+ lldb::UnwindPlanSP m_unwind_plan_object_file_sp;
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp;
// augmented by assembly inspection so it's valid everywhere
+ lldb::UnwindPlanSP m_unwind_plan_object_file_augmented_sp;
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp;
lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp;
@@ -130,7 +137,9 @@
// Fetching the UnwindPlans can be expensive - if we've already attempted to
// get one & failed, don't try again.
bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1,
+ m_tried_unwind_plan_object_file : 1,
m_tried_unwind_plan_debug_frame : 1,
+ m_tried_unwind_plan_object_file_augmented : 1,
m_tried_unwind_plan_eh_frame_augmented : 1,
m_tried_unwind_plan_debug_frame_augmented : 1,
m_tried_unwind_plan_compact_unwind : 1,
@@ -140,10 +149,11 @@
Address m_first_non_prologue_insn;
- DISALLOW_COPY_AND_ASSIGN(FuncUnwinders);
+ FuncUnwinders(const FuncUnwinders &) = delete;
+ const FuncUnwinders &operator=(const FuncUnwinders &) = delete;
}; // class FuncUnwinders
} // namespace lldb_private
-#endif // liblldb_FuncUnwinders_h
+#endif // LLDB_SYMBOL_FUNCUNWINDERS_H
diff --git a/linux-x64/clang/include/lldb/Symbol/Function.h b/linux-x64/clang/include/lldb/Symbol/Function.h
index f68a167..300d829 100644
--- a/linux-x64/clang/include/lldb/Symbol/Function.h
+++ b/linux-x64/clang/include/lldb/Symbol/Function.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Function_h_
-#define liblldb_Function_h_
+#ifndef LLDB_SYMBOL_FUNCTION_H
+#define LLDB_SYMBOL_FUNCTION_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Mangled.h"
@@ -17,8 +17,12 @@
#include "lldb/Utility/UserID.h"
#include "llvm/ADT/ArrayRef.h"
+#include <mutex>
+
namespace lldb_private {
+class ExecutionContext;
+
/// \class FunctionInfo Function.h "lldb/Symbol/Function.h"
/// A class that contains generic function information.
///
@@ -68,9 +72,9 @@
/// The Right Hand Side const FunctionInfo object reference.
///
/// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// -1 if lhs < rhs
+ /// 0 if lhs == rhs
+ /// 1 if lhs > rhs
static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs);
/// Dump a description of this object to a Stream.
@@ -111,10 +115,11 @@
virtual size_t MemorySize() const;
protected:
- // Member variables.
- ConstString m_name; ///< Function method name (not a mangled name).
- Declaration m_declaration; ///< Information describing where this function
- ///information was defined.
+ /// Function method name (not a mangled name).
+ ConstString m_name;
+
+ /// Information describing where this function information was defined.
+ Declaration m_declaration;
};
/// \class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
@@ -140,7 +145,7 @@
/// \param[in] call_decl_ptr
/// Optional calling location declaration information that
/// describes from where this inlined function was called.
- InlineFunctionInfo(const char *name, const char *mangled,
+ InlineFunctionInfo(const char *name, llvm::StringRef mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr);
@@ -183,9 +188,9 @@
/// reference.
///
/// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// -1 if lhs < rhs
+ /// 0 if lhs == rhs
+ /// 1 if lhs > rhs
int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs);
/// Dump a description of this object to a Stream.
@@ -197,11 +202,11 @@
/// The stream to which to dump the object description.
void Dump(Stream *s, bool show_fullpaths) const;
- void DumpStopContext(Stream *s, lldb::LanguageType language) const;
+ void DumpStopContext(Stream *s) const;
- ConstString GetName(lldb::LanguageType language) const;
+ ConstString GetName() const;
- ConstString GetDisplayName(lldb::LanguageType language) const;
+ ConstString GetDisplayName() const;
/// Get accessor for the call site declaration information.
///
@@ -238,36 +243,42 @@
size_t MemorySize() const override;
private:
- // Member variables.
- Mangled m_mangled; ///< Mangled inlined function name (can be empty if there
- ///is no mangled information).
+ /// Mangled inlined function name (can be empty if there is no mangled
+ /// information).
+ Mangled m_mangled;
+
Declaration m_call_decl;
};
class Function;
+/// \class CallSiteParameter Function.h "lldb/Symbol/Function.h"
+///
+/// Represent the locations of a parameter at a call site, both in the caller
+/// and in the callee.
+struct CallSiteParameter {
+ DWARFExpression LocationInCallee;
+ DWARFExpression LocationInCaller;
+};
+
+/// A vector of \c CallSiteParameter.
+using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>;
+
/// \class CallEdge Function.h "lldb/Symbol/Function.h"
///
/// Represent a call made within a Function. This can be used to find a path
-/// in the call graph between two functions.
+/// in the call graph between two functions, or to evaluate DW_OP_entry_value.
class CallEdge {
public:
- /// Construct a call edge using a symbol name to identify the calling
- /// function, and a return PC within the calling function to identify a
- /// specific call site.
- ///
- /// TODO: A symbol name may not be globally unique. To disambiguate ODR
- /// conflicts, it's necessary to determine the \c Target a call edge is
- /// associated with before resolving it.
- CallEdge(const char *symbol_name, lldb::addr_t return_pc);
-
- CallEdge(CallEdge &&) = default;
- CallEdge &operator=(CallEdge &&) = default;
+ enum class AddrType : uint8_t { Call, AfterCall };
+ virtual ~CallEdge() {}
/// Get the callee's definition.
///
- /// Note that this might lazily invoke the DWARF parser.
- Function *GetCallee(ModuleList &images);
+ /// Note that this might lazily invoke the DWARF parser. A register context
+ /// from the caller's activation is needed to find indirect call targets.
+ virtual Function *GetCallee(ModuleList &images,
+ ExecutionContext &exe_ctx) = 0;
/// Get the load PC address of the instruction which executes after the call
/// returns. Returns LLDB_INVALID_ADDRESS iff this is a tail call. \p caller
@@ -275,29 +286,108 @@
/// made the call.
lldb::addr_t GetReturnPCAddress(Function &caller, Target &target) const;
- /// Like \ref GetReturnPCAddress, but returns an unslid function-local PC
- /// offset.
- lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
+ /// Return an address in the caller. This can either be the address of the
+ /// call instruction, or the address of the instruction after the call.
+ std::pair<AddrType, lldb::addr_t> GetCallerAddress(Function &caller,
+ Target &target) const {
+ return {caller_address_type,
+ GetLoadAddress(caller_address, caller, target)};
+ }
+
+ bool IsTailCall() const { return is_tail_call; }
+
+ /// Get the call site parameters available at this call edge.
+ llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const {
+ return parameters;
+ }
+
+ /// Non-tail-calls go first, sorted by the return address. They are followed
+ /// by tail calls, which have no specific order.
+ std::pair<bool, lldb::addr_t> GetSortKey() const {
+ return {is_tail_call, GetUnresolvedReturnPCAddress()};
+ }
+
+protected:
+ CallEdge(AddrType caller_address_type, lldb::addr_t caller_address,
+ bool is_tail_call, CallSiteParameterArray &¶meters)
+ : caller_address(caller_address),
+ caller_address_type(caller_address_type), is_tail_call(is_tail_call),
+ parameters(std::move(parameters)) {}
+
+ /// Helper that finds the load address of \p unresolved_pc, a file address
+ /// which refers to an instruction within \p caller.
+ static lldb::addr_t GetLoadAddress(lldb::addr_t unresolved_pc,
+ Function &caller, Target &target);
+
+ /// Like \ref GetReturnPCAddress, but returns an unresolved file address.
+ lldb::addr_t GetUnresolvedReturnPCAddress() const {
+ return caller_address_type == AddrType::AfterCall && !is_tail_call
+ ? caller_address
+ : LLDB_INVALID_ADDRESS;
+ }
+
+private:
+ lldb::addr_t caller_address;
+ AddrType caller_address_type;
+ bool is_tail_call;
+
+ CallSiteParameterArray parameters;
+};
+
+/// A direct call site. Used to represent call sites where the address of the
+/// callee is fixed (e.g. a function call in C in which the call target is not
+/// a function pointer).
+class DirectCallEdge : public CallEdge {
+public:
+ /// Construct a call edge using a symbol name to identify the callee, and a
+ /// return PC within the calling function to identify a specific call site.
+ DirectCallEdge(const char *symbol_name, AddrType caller_address_type,
+ lldb::addr_t caller_address, bool is_tail_call,
+ CallSiteParameterArray &¶meters)
+ : CallEdge(caller_address_type, caller_address, is_tail_call,
+ std::move(parameters)) {
+ lazy_callee.symbol_name = symbol_name;
+ }
+
+ Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
private:
void ParseSymbolFileAndResolve(ModuleList &images);
- /// Either the callee's mangled name or its definition, discriminated by
- /// \ref resolved.
+ // Used to describe a direct call.
+ //
+ // Either the callee's mangled name or its definition, discriminated by
+ // \ref resolved.
union {
const char *symbol_name;
Function *def;
} lazy_callee;
- /// An invalid address if this is a tail call. Otherwise, the function-local
- /// PC offset. Adding this PC offset to the function's base load address
- /// gives the return PC for the call.
- lldb::addr_t return_pc;
-
/// Whether or not an attempt was made to find the callee's definition.
- bool resolved;
+ bool resolved = false;
+};
- DISALLOW_COPY_AND_ASSIGN(CallEdge);
+/// An indirect call site. Used to represent call sites where the address of
+/// the callee is not fixed, e.g. a call to a C++ virtual function (where the
+/// address is loaded out of a vtable), or a call to a function pointer in C.
+class IndirectCallEdge : public CallEdge {
+public:
+ /// Construct a call edge using a DWARFExpression to identify the callee, and
+ /// a return PC within the calling function to identify a specific call site.
+ IndirectCallEdge(DWARFExpression call_target, AddrType caller_address_type,
+ lldb::addr_t caller_address, bool is_tail_call,
+ CallSiteParameterArray &¶meters)
+ : CallEdge(caller_address_type, caller_address, is_tail_call,
+ std::move(parameters)),
+ call_target(std::move(call_target)) {}
+
+ Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
+
+private:
+ // Used to describe an indirect call.
+ //
+ // Specifies the location of the callee address in the calling frame.
+ DWARFExpression call_target;
};
/// \class Function Function.h "lldb/Symbol/Function.h"
@@ -396,11 +486,16 @@
/// Get the outgoing call edges from this function, sorted by their return
/// PC addresses (in increasing order).
- llvm::MutableArrayRef<CallEdge> GetCallEdges();
+ llvm::ArrayRef<std::unique_ptr<CallEdge>> GetCallEdges();
/// Get the outgoing tail-calling edges from this function. If none exist,
/// return None.
- llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
+ llvm::ArrayRef<std::unique_ptr<CallEdge>> GetTailCallingEdges();
+
+ /// Get the outgoing call edge from this function which has the given return
+ /// address \p return_pc, or return nullptr. Note that this will not return a
+ /// tail-calling edge.
+ CallEdge *GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target);
/// Get accessor for the block list.
///
@@ -543,34 +638,55 @@
protected:
enum {
- flagsCalculatedPrologueSize =
- (1 << 0) ///< Have we already tried to calculate the prologue size?
+ /// Whether we already tried to calculate the prologue size.
+ flagsCalculatedPrologueSize = (1 << 0)
};
- // Member variables.
- CompileUnit *m_comp_unit; ///< The compile unit that owns this function.
- lldb::user_id_t
- m_type_uid; ///< The user ID of for the prototype Type for this function.
- Type *m_type; ///< The function prototype type for this function that include
- ///the function info (FunctionInfo), return type and parameters.
- Mangled m_mangled; ///< The mangled function name if any, if empty, there is
- ///no mangled information.
- Block m_block; ///< All lexical blocks contained in this function.
- AddressRange m_range; ///< The function address range that covers the widest
- ///range needed to contain all blocks
- DWARFExpression m_frame_base; ///< The frame base expression for variables
- ///that are relative to the frame pointer.
- Flags m_flags;
- uint32_t
- m_prologue_byte_size; ///< Compute the prologue size once and cache it
+ /// The compile unit that owns this function.
+ CompileUnit *m_comp_unit;
- bool m_call_edges_resolved = false; ///< Whether call site info has been
- /// parsed.
- std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
+ /// The user ID of for the prototype Type for this function.
+ lldb::user_id_t m_type_uid;
+
+ /// The function prototype type for this function that includes the function
+ /// info (FunctionInfo), return type and parameters.
+ Type *m_type;
+
+ /// The mangled function name if any. If empty, there is no mangled
+ /// information.
+ Mangled m_mangled;
+
+ /// All lexical blocks contained in this function.
+ Block m_block;
+
+ /// The function address range that covers the widest range needed to contain
+ /// all blocks
+ AddressRange m_range;
+
+ /// The frame base expression for variables that are relative to the frame
+ /// pointer.
+ DWARFExpression m_frame_base;
+
+ Flags m_flags;
+
+ /// Compute the prologue size once and cache it.
+ uint32_t m_prologue_byte_size;
+
+ /// Exclusive lock that controls read/write access to m_call_edges and
+ /// m_call_edges_resolved.
+ std::mutex m_call_edges_lock;
+
+ /// Whether call site info has been parsed.
+ bool m_call_edges_resolved = false;
+
+ /// Outgoing call edges.
+ std::vector<std::unique_ptr<CallEdge>> m_call_edges;
+
private:
- DISALLOW_COPY_AND_ASSIGN(Function);
+ Function(const Function &) = delete;
+ const Function &operator=(const Function &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Function_h_
+#endif // LLDB_SYMBOL_FUNCTION_H
diff --git a/linux-x64/clang/include/lldb/Symbol/LineEntry.h b/linux-x64/clang/include/lldb/Symbol/LineEntry.h
index fe97a78..7e56ef8 100644
--- a/linux-x64/clang/include/lldb/Symbol/LineEntry.h
+++ b/linux-x64/clang/include/lldb/Symbol/LineEntry.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_LineEntry_h_
-#define liblldb_LineEntry_h_
+#ifndef LLDB_SYMBOL_LINEENTRY_H
+#define LLDB_SYMBOL_LINEENTRY_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Utility/FileSpec.h"
@@ -42,11 +42,6 @@
/// \param[in] s
/// The stream to which to dump the object description.
///
- /// \param[in] comp_unit
- /// The compile unit object that contains the support file
- /// list so the line entry can dump the file name (since this
- /// object contains a file index into the support file list).
- ///
/// \param[in] show_file
/// If \b true, display the filename with the line entry which
/// requires that the compile unit object \a comp_unit be a
@@ -75,11 +70,6 @@
/// \param[in] s
/// The stream to which to dump the object description.
///
- /// \param[in] comp_unit
- /// The compile unit object that contains the support file
- /// list so the line entry can dump the file name (since this
- /// object contains a file index into the support file list).
- ///
/// \return
/// Returns \b true if the file and line were properly dumped,
/// \b false otherwise.
@@ -102,9 +92,9 @@
/// The Right Hand Side const LineEntry object reference.
///
/// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// -1 if lhs < rhs
+ /// 0 if lhs == rhs
+ /// 1 if lhs > rhs
static int Compare(const LineEntry &lhs, const LineEntry &rhs);
/// Give the range for this LineEntry + any additional LineEntries for this
@@ -128,7 +118,7 @@
/// range.
///
/// If the initial LineEntry this method is called on is a line #0, only the
- /// range of contiuous LineEntries with line #0 will be included in the
+ /// range of continuous LineEntries with line #0 will be included in the
/// complete range.
///
/// @param[in] include_inlined_functions
@@ -143,7 +133,6 @@
///
/// \param[in] target_sp
/// Shared pointer to the target this LineEntry belongs to.
-
void ApplyFileMappings(lldb::TargetSP target_sp);
// Member variables.
@@ -184,4 +173,4 @@
} // namespace lldb_private
-#endif // liblldb_LineEntry_h_
+#endif // LLDB_SYMBOL_LINEENTRY_H
diff --git a/linux-x64/clang/include/lldb/Symbol/LineTable.h b/linux-x64/clang/include/lldb/Symbol/LineTable.h
index d24cc35..b48e82f 100644
--- a/linux-x64/clang/include/lldb/Symbol/LineTable.h
+++ b/linux-x64/clang/include/lldb/Symbol/LineTable.h
@@ -6,9 +6,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_LineTable_h_
-#define liblldb_LineTable_h_
+#ifndef LLDB_SYMBOL_LINETABLE_H
+#define LLDB_SYMBOL_LINETABLE_H
+#include "lldb/Core/Address.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/LineEntry.h"
@@ -29,7 +30,8 @@
virtual void Clear() = 0;
private:
- DISALLOW_COPY_AND_ASSIGN(LineSequence);
+ LineSequence(const LineSequence &) = delete;
+ const LineSequence &operator=(const LineSequence &) = delete;
};
/// \class LineTable LineTable.h "lldb/Symbol/LineTable.h"
@@ -42,6 +44,13 @@
/// The compile unit to which this line table belongs.
LineTable(CompileUnit *comp_unit);
+ /// Construct with entries found in \a sequences.
+ ///
+ /// \param[in] sequences
+ /// Unsorted list of line sequences.
+ LineTable(CompileUnit *comp_unit,
+ std::vector<std::unique_ptr<LineSequence>> &&sequences);
+
/// Destructor.
~LineTable();
@@ -64,11 +73,11 @@
bool is_epilogue_begin, bool is_terminal_entry);
// Used to instantiate the LineSequence helper class
- LineSequence *CreateLineSequenceContainer();
+ static std::unique_ptr<LineSequence> CreateLineSequenceContainer();
// Append an entry to a caller-provided collection that will later be
// inserted in this line table.
- void AppendLineEntryToSequence(LineSequence *sequence, lldb::addr_t file_addr,
+ static void AppendLineEntryToSequence(LineSequence *sequence, lldb::addr_t file_addr,
uint32_t line, uint16_t column,
uint16_t file_idx, bool is_start_of_statement,
bool is_start_of_basic_block,
@@ -135,8 +144,8 @@
/// If true, match only if you find a line entry exactly matching \a line.
/// If false, return the closest line entry greater than \a line.
///
- /// \param[out] line_entry
- /// A reference to a line entry object that will get a copy of
+ /// \param[out] line_entry_ptr
+ /// A pointer to a line entry object that will get a copy of
/// the line entry if \b true is returned, otherwise \a
/// line_entry is left untouched.
///
@@ -176,7 +185,7 @@
/// The number of line table entries in this line table.
uint32_t GetSize() const;
- typedef lldb_private::RangeArray<lldb::addr_t, lldb::addr_t, 32>
+ typedef lldb_private::RangeVector<lldb::addr_t, lldb::addr_t, 32>
FileAddressRanges;
/// Gets all contiguous file address ranges for the entire line table.
@@ -194,16 +203,6 @@
size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges,
bool append);
- /// Given a file range link map, relink the current line table and return a
- /// fixed up line table.
- ///
- /// \param[out] file_range_map
- /// A collection of file ranges that maps to new file ranges
- /// that will be used when linking the line table.
- ///
- /// \return
- /// A new line table if at least one line table entry was able
- /// to be mapped.
typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t>
FileRangeMap;
@@ -269,6 +268,8 @@
public:
LessThanBinaryPredicate(LineTable *line_table);
bool operator()(const LineTable::Entry &, const LineTable::Entry &) const;
+ bool operator()(const std::unique_ptr<LineSequence> &,
+ const std::unique_ptr<LineSequence> &) const;
protected:
LineTable *m_line_table;
@@ -338,9 +339,10 @@
bool ConvertEntryAtIndexToLineEntry(uint32_t idx, LineEntry &line_entry);
private:
- DISALLOW_COPY_AND_ASSIGN(LineTable);
+ LineTable(const LineTable &) = delete;
+ const LineTable &operator=(const LineTable &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_LineTable_h_
+#endif // LLDB_SYMBOL_LINETABLE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h b/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h
index 0ff834d..93b76e5 100644
--- a/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h
+++ b/linux-x64/clang/include/lldb/Symbol/LocateSymbolFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Symbols_h_
-#define liblldb_Symbols_h_
+#ifndef LLDB_SYMBOL_LOCATESYMBOLFILE_H
+#define LLDB_SYMBOL_LOCATESYMBOLFILE_H
#include <stdint.h>
@@ -55,4 +55,4 @@
} // namespace lldb_private
-#endif // liblldb_Symbols_h_
+#endif // LLDB_SYMBOL_LOCATESYMBOLFILE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h b/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h
index 9310fdc..1e01e93 100644
--- a/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h
+++ b/linux-x64/clang/include/lldb/Symbol/ObjectContainer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ObjectContainer_h_
-#define liblldb_ObjectContainer_h_
+#ifndef LLDB_SYMBOL_OBJECTCONTAINER_H
+#define LLDB_SYMBOL_OBJECTCONTAINER_H
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
@@ -167,9 +167,10 @@
m_data; ///< The data for this object file so things can be parsed lazily.
private:
- DISALLOW_COPY_AND_ASSIGN(ObjectContainer);
+ ObjectContainer(const ObjectContainer &) = delete;
+ const ObjectContainer &operator=(const ObjectContainer &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ObjectContainer_h_
+#endif // LLDB_SYMBOL_OBJECTCONTAINER_H
diff --git a/linux-x64/clang/include/lldb/Symbol/ObjectFile.h b/linux-x64/clang/include/lldb/Symbol/ObjectFile.h
index 84683e3..080724c 100644
--- a/linux-x64/clang/include/lldb/Symbol/ObjectFile.h
+++ b/linux-x64/clang/include/lldb/Symbol/ObjectFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ObjectFile_h_
-#define liblldb_ObjectFile_h_
+#ifndef LLDB_SYMBOL_OBJECTFILE_H
+#define LLDB_SYMBOL_OBJECTFILE_H
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
@@ -63,16 +63,22 @@
public:
enum Type {
eTypeInvalid = 0,
- eTypeCoreFile, /// A core file that has a checkpoint of a program's
- /// execution state
- eTypeExecutable, /// A normal executable
- eTypeDebugInfo, /// An object file that contains only debug information
- eTypeDynamicLinker, /// The platform's dynamic linker executable
- eTypeObjectFile, /// An intermediate object file
- eTypeSharedLibrary, /// A shared library that can be used during execution
- eTypeStubLibrary, /// A library that can be linked against but not used for
- /// execution
- eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
+ /// A core file that has a checkpoint of a program's execution state.
+ eTypeCoreFile,
+ /// A normal executable.
+ eTypeExecutable,
+ /// An object file that contains only debug information.
+ eTypeDebugInfo,
+ /// The platform's dynamic linker executable.
+ eTypeDynamicLinker,
+ /// An intermediate object file.
+ eTypeObjectFile,
+ /// A shared library that can be used during execution.
+ eTypeSharedLibrary,
+ /// A library that can be linked against but not used for execution.
+ eTypeStubLibrary,
+ /// JIT code that has symbols, sections and possibly debug info.
+ eTypeJIT,
eTypeUnknown
};
@@ -85,6 +91,17 @@
eStrataJIT
};
+ /// If we have a corefile binary hint, this enum
+ /// specifies the binary type which we can use to
+ /// select the correct DynamicLoader plugin.
+ enum BinaryType {
+ eBinaryTypeInvalid = 0,
+ eBinaryTypeUnknown,
+ eBinaryTypeKernel, /// kernel binary
+ eBinaryTypeUser, /// user process binary
+ eBinaryTypeStandalone /// standalone binary / firmware
+ };
+
struct LoadableData {
lldb::addr_t Dest;
llvm::ArrayRef<uint8_t> Contents;
@@ -124,7 +141,7 @@
/// ObjectFile plug-in interface and returns the first instance that can
/// parse the file.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The parent module that owns this object file.
///
/// \param[in] file_spec
@@ -152,7 +169,7 @@
/// ObjectFile plug-in interface and returns the first instance that can
/// parse the file.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// The parent module that owns this object file.
///
/// \param[in] process_sp
@@ -166,10 +183,10 @@
lldb::addr_t header_addr,
lldb::DataBufferSP &file_data_sp);
- static size_t GetModuleSpecifications(const FileSpec &file,
- lldb::offset_t file_offset,
- lldb::offset_t file_size,
- ModuleSpecList &specs);
+ static size_t
+ GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset,
+ lldb::offset_t file_size, ModuleSpecList &specs,
+ lldb::DataBufferSP data_sp = lldb::DataBufferSP());
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
lldb::DataBufferSP &data_sp,
@@ -201,9 +218,13 @@
/// \b false otherwise and \a archive_file and \a archive_object
/// are guaranteed to be remain unchanged.
static bool SplitArchivePathWithObject(
- const char *path_with_object, lldb_private::FileSpec &archive_file,
+ llvm::StringRef path_with_object, lldb_private::FileSpec &archive_file,
lldb_private::ConstString &archive_object, bool must_exist);
+ // LLVM RTTI support
+ static char ID;
+ virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
+
/// Gets the address size in bytes for the current object file.
///
/// \return
@@ -346,13 +367,6 @@
/// Frees the symbol table.
///
/// This function should only be used when an object file is
- ///
- /// \param[in] flags
- /// eSymtabFromUnifiedSectionList: Whether to clear symbol table
- /// for unified module section list, or object file.
- ///
- /// \return
- /// The symbol table for this object file.
virtual void ClearSymtab();
/// Gets the UUID for this object file.
@@ -366,17 +380,6 @@
/// returned.
virtual UUID GetUUID() = 0;
- /// Gets the symbol file spec list for this object file.
- ///
- /// If the object file format contains a debug symbol file link, the values
- /// will be returned in the FileSpecList.
- ///
- /// \return
- /// Returns filespeclist.
- virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() {
- return FileSpecList();
- }
-
/// Gets the file spec list of libraries re-exported by this object file.
///
/// If the object file format has the notion of one library re-exporting the
@@ -488,8 +491,8 @@
/// \return
/// Returns the identifier string if one exists, else an empty
/// string.
- virtual std::string GetIdentifierString () {
- return std::string();
+ virtual std::string GetIdentifierString () {
+ return std::string();
}
/// When the ObjectFile is a core file, lldb needs to locate the "binary" in
@@ -508,12 +511,17 @@
/// If the uuid of the binary is specified, this will be set.
/// If no UUID is available, will be cleared.
///
+ /// \param[out] type
+ /// Return the type of the binary, which will dictate which
+ /// DynamicLoader plugin should be used.
+ ///
/// \return
/// Returns true if either address or uuid has been set.
- virtual bool GetCorefileMainBinaryInfo (lldb::addr_t &address, UUID &uuid) {
- address = LLDB_INVALID_ADDRESS;
- uuid.Clear();
- return false;
+ virtual bool GetCorefileMainBinaryInfo(lldb::addr_t &address, UUID &uuid,
+ ObjectFile::BinaryType &type) {
+ address = LLDB_INVALID_ADDRESS;
+ uuid.Clear();
+ return false;
}
virtual lldb::RegisterContextSP
@@ -653,10 +661,11 @@
///
/// \param[in] target
/// Target where to load.
- ///
- /// \return
virtual std::vector<LoadableData> GetLoadableData(Target &target);
+ /// Creates a plugin-specific call frame info
+ virtual std::unique_ptr<CallFrameInfo> CreateCallFrameInfo();
+
protected:
// Member variables.
FileSpec m_file;
@@ -693,7 +702,8 @@
uint64_t Offset);
private:
- DISALLOW_COPY_AND_ASSIGN(ObjectFile);
+ ObjectFile(const ObjectFile &) = delete;
+ const ObjectFile &operator=(const ObjectFile &) = delete;
};
} // namespace lldb_private
@@ -710,4 +720,4 @@
};
} // namespace llvm
-#endif // liblldb_ObjectFile_h_
+#endif // LLDB_SYMBOL_OBJECTFILE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h b/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h
index e3a8587..fa77933 100644
--- a/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h
+++ b/linux-x64/clang/include/lldb/Symbol/PostfixExpression.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
+#include <vector>
namespace lldb_private {
@@ -211,7 +212,10 @@
/// Parse the given postfix expression. The parsed nodes are placed into the
/// provided allocator.
-Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
+Node *ParseOneExpression(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
+
+std::vector<std::pair<llvm::StringRef, Node *>>
+ParseFPOProgram(llvm::StringRef prog, llvm::BumpPtrAllocator &alloc);
/// Serialize the given expression tree as DWARF. The result is written into the
/// given stream. The AST should not contain any SymbolNodes. If the expression
diff --git a/linux-x64/clang/include/lldb/Symbol/SourceModule.h b/linux-x64/clang/include/lldb/Symbol/SourceModule.h
index b12ff01..7799b65 100644
--- a/linux-x64/clang/include/lldb/Symbol/SourceModule.h
+++ b/linux-x64/clang/include/lldb/Symbol/SourceModule.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SourceModule_h_
-#define liblldb_SourceModule_h_
+#ifndef LLDB_SYMBOL_SOURCEMODULE_H
+#define LLDB_SYMBOL_SOURCEMODULE_H
#include "lldb/Utility/ConstString.h"
#include <vector>
diff --git a/linux-x64/clang/include/lldb/Symbol/Symbol.h b/linux-x64/clang/include/lldb/Symbol/Symbol.h
index 1cbc2f5..3a235f2 100644
--- a/linux-x64/clang/include/lldb/Symbol/Symbol.h
+++ b/linux-x64/clang/include/lldb/Symbol/Symbol.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Symbol_h_
-#define liblldb_Symbol_h_
+#ifndef LLDB_SYMBOL_SYMBOL_H
+#define LLDB_SYMBOL_SYMBOL_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Mangled.h"
@@ -24,9 +24,8 @@
// drastically different meanings and sorting requirements.
Symbol();
- Symbol(uint32_t symID, const char *name, bool name_is_mangled,
- lldb::SymbolType type, bool external, bool is_debug,
- bool is_trampoline, bool is_artificial,
+ Symbol(uint32_t symID, llvm::StringRef name, lldb::SymbolType type,
+ bool external, bool is_debug, bool is_trampoline, bool is_artificial,
const lldb::SectionSP §ion_sp, lldb::addr_t value,
lldb::addr_t size, bool size_is_valid,
bool contains_linker_annotations, uint32_t flags);
@@ -44,7 +43,9 @@
bool Compare(ConstString name, lldb::SymbolType type) const;
- void Dump(Stream *s, Target *target, uint32_t index) const;
+ void Dump(Stream *s, Target *target, uint32_t index,
+ Mangled::NamePreference name_preference =
+ Mangled::ePreferDemangled) const;
bool ValueIsAddress() const;
@@ -266,4 +267,4 @@
} // namespace lldb_private
-#endif // liblldb_Symbol_h_
+#endif // LLDB_SYMBOL_SYMBOL_H
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolContext.h b/linux-x64/clang/include/lldb/Symbol/SymbolContext.h
index 55a3454..c513dbb 100644
--- a/linux-x64/clang/include/lldb/Symbol/SymbolContext.h
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SymbolContext_h_
-#define liblldb_SymbolContext_h_
+#ifndef LLDB_SYMBOL_SYMBOLCONTEXT_H
+#define LLDB_SYMBOL_SYMBOLCONTEXT_H
#include <memory>
#include <string>
@@ -51,7 +51,7 @@
///
/// Initialize all pointer to the specified values.
///
- /// \param[in] module
+ /// \param[in] module_sp
/// A Module pointer to the module for this context.
///
/// \param[in] comp_unit
@@ -84,18 +84,6 @@
~SymbolContext();
- /// Assignment operator.
- ///
- /// Copies the address value from another SymbolContext object \a rhs into
- /// \a this object.
- ///
- /// \param[in] rhs
- /// A const SymbolContext object reference to copy.
- ///
- /// \return
- /// A const SymbolContext object reference to \a this.
- const SymbolContext &operator=(const SymbolContext &rhs);
-
/// Clear the object's state.
///
/// Resets all pointer members to nullptr, and clears any class objects to
@@ -151,11 +139,19 @@
/// be printed. In disassembly formatting, where we want a format
/// like "<*+36>", this should be false and "*" will be printed
/// instead.
+ ///
+ /// \param[in] show_inline_callsite_line_info
+ /// When processing an inline block, the line info of the callsite
+ /// is dumped if this flag is \b true, otherwise the line info
+ /// of the actual inlined function is dumped.
+ ///
+ /// \return
+ /// \b true if some text was dumped, \b false otherwise.
bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
- bool show_function_arguments,
- bool show_function_name) const;
+ bool show_function_arguments, bool show_function_name,
+ bool show_inline_callsite_line_info = true) const;
/// Get the address range contained within a symbol context.
///
@@ -279,11 +275,6 @@
/// For instance, if the symbol context contains an inlined block, it will
/// return the inlined function name.
///
- /// \param[in] prefer_mangled
- /// if \btrue, then the mangled name will be returned if there
- /// is one. Otherwise the unmangled name will be returned if it
- /// is available.
- ///
/// \return
/// The name of the function represented by this symbol context.
ConstString GetFunctionName(
@@ -298,14 +289,6 @@
/// ModuleList::FindFunctions(...) call in order to get the correct line
/// table information for the symbol context. it will return the inlined
/// function name.
- ///
- /// \param[in] prefer_mangled
- /// if \btrue, then the mangled name will be returned if there
- /// is one. Otherwise the unmangled name will be returned if it
- /// is available.
- ///
- /// \return
- /// The name of the function represented by this symbol context.
LineEntry GetFunctionStartLineEntry() const;
/// Find the block containing the inlined block that contains this block.
@@ -319,13 +302,13 @@
/// \param[out] next_frame_sc
/// A new symbol context that does what the title says it does.
///
- /// \param[out] next_frame_addr
+ /// \param[out] inlined_frame_addr
/// This is what you should report as the PC in \a next_frame_sc.
///
/// \return
/// \b true if this SymbolContext specifies a block contained in an
/// inlined block. If this returns \b true, \a next_frame_sc and
- /// \a next_frame_addr will be filled in correctly.
+ /// \a inlined_frame_addr will be filled in correctly.
bool GetParentOfInlinedScope(const Address &curr_frame_pc,
SymbolContext &next_frame_sc,
Address &inlined_frame_addr) const;
@@ -365,7 +348,7 @@
void Clear();
- bool SymbolContextMatches(SymbolContext &sc);
+ bool SymbolContextMatches(const SymbolContext &sc);
bool AddressMatches(lldb::addr_t addr);
@@ -470,6 +453,8 @@
/// Returns the number of symbol context objects in the list.
uint32_t GetSize() const;
+ bool IsEmpty() const;
+
uint32_t NumLineEntriesWithLine(uint32_t line) const;
void GetDescription(Stream *s, lldb::DescriptionLevel level,
@@ -498,4 +483,4 @@
} // namespace lldb_private
-#endif // liblldb_SymbolContext_h_
+#endif // LLDB_SYMBOL_SYMBOLCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h b/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h
index a626302..3b244ca 100644
--- a/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolContextScope.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SymbolContextScope_h_
-#define liblldb_SymbolContextScope_h_
+#ifndef LLDB_SYMBOL_SYMBOLCONTEXTSCOPE_H
+#define LLDB_SYMBOL_SYMBOLCONTEXTSCOPE_H
#include "lldb/lldb-private.h"
@@ -100,4 +100,4 @@
} // namespace lldb_private
-#endif // liblldb_SymbolContextScope_h_
+#endif // LLDB_SYMBOL_SYMBOLCONTEXTSCOPE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolFile.h b/linux-x64/clang/include/lldb/Symbol/SymbolFile.h
index dbb723e..9f58069 100644
--- a/linux-x64/clang/include/lldb/Symbol/SymbolFile.h
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolFile.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SymbolFile_h_
-#define liblldb_SymbolFile_h_
+#ifndef LLDB_SYMBOL_SYMBOLFILE_H
+#define LLDB_SYMBOL_SYMBOLFILE_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/CompilerDecl.h"
@@ -16,9 +16,12 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SourceModule.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Utility/XcodeSDK.h"
#include "lldb/lldb-private.h"
-
#include "llvm/ADT/DenseSet.h"
+#include "llvm/Support/Errc.h"
#include <mutex>
@@ -31,7 +34,16 @@
namespace lldb_private {
class SymbolFile : public PluginInterface {
+ /// LLVM RTTI support.
+ static char ID;
+
public:
+ /// LLVM RTTI support.
+ /// \{
+ virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
+ static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+ /// \}
+
// Symbol file ability bits.
//
// Each symbol file can claim to support one or more symbol file abilities.
@@ -49,11 +61,12 @@
kAllAbilities = ((1u << 7) - 1u)
};
- static SymbolFile *FindPlugin(ObjectFile *obj_file);
+ static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
// Constructors and Destructors
- SymbolFile(ObjectFile *obj_file)
- : m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
+ SymbolFile(lldb::ObjectFileSP objfile_sp)
+ : m_objfile_sp(std::move(objfile_sp)), m_abilities(0),
+ m_calculated_abilities(false) {}
~SymbolFile() override {}
@@ -110,13 +123,50 @@
// Compile Unit function calls
// Approach 1 - iterator
- virtual uint32_t GetNumCompileUnits() = 0;
- virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
+ uint32_t GetNumCompileUnits();
+ lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
+
+ Symtab *GetSymtab();
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
+ /// Return the Xcode SDK comp_unit was compiled against.
+ virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) { return {}; }
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
+
+ /// Apply a lambda to each external lldb::Module referenced by this
+ /// \p comp_unit. Recursively also descends into the referenced external
+ /// modules of any encountered compilation unit.
+ ///
+ /// This function can be used to traverse Clang -gmodules debug
+ /// information, which is stored in DWARF files separate from the
+ /// object files.
+ ///
+ /// \param comp_unit
+ /// When this SymbolFile consists of multiple auxilliary
+ /// SymbolFiles, for example, a Darwin debug map that references
+ /// multiple .o files, comp_unit helps choose the auxilliary
+ /// file. In most other cases comp_unit's symbol file is
+ /// identical with *this.
+ ///
+ /// \param[in] lambda
+ /// The lambda that should be applied to every function. The lambda can
+ /// return true if the iteration should be aborted earlier.
+ ///
+ /// \param visited_symbol_files
+ /// A set of SymbolFiles that were already visited to avoid
+ /// visiting one file more than once.
+ ///
+ /// \return
+ /// If the lambda early-exited, this function returns true to
+ /// propagate the early exit.
+ virtual bool ForEachExternalModule(
+ lldb_private::CompileUnit &comp_unit,
+ llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
+ llvm::function_ref<bool(Module &)> lambda) {
+ return false;
+ }
virtual bool ParseSupportFiles(CompileUnit &comp_unit,
FileSpecList &support_files) = 0;
virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
@@ -139,7 +189,7 @@
};
/// If \c type_uid points to an array type, return its characteristics.
/// To support variable-length array types, this function takes an
- /// optional \p ExtecutionContext. If \c exe_ctx is non-null, the
+ /// optional \p ExecutionContext. If \c exe_ctx is non-null, the
/// dynamic characteristics for that context are returned.
virtual llvm::Optional<ArrayInfo>
GetDynamicArrayInfoForUID(lldb::user_id_t type_uid,
@@ -165,55 +215,59 @@
SymbolContextList &sc_list);
virtual void DumpClangAST(Stream &s) {}
- virtual uint32_t
- FindGlobalVariables(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- uint32_t max_matches, VariableList &variables);
- virtual uint32_t FindGlobalVariables(const RegularExpression ®ex,
- uint32_t max_matches,
- VariableList &variables);
- virtual uint32_t FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- lldb::FunctionNameType name_type_mask,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
- virtual uint32_t FindFunctions(const RegularExpression ®ex,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
- virtual uint32_t
- FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, uint32_t max_matches,
+ virtual void FindGlobalVariables(ConstString name,
+ const CompilerDeclContext &parent_decl_ctx,
+ uint32_t max_matches,
+ VariableList &variables);
+ virtual void FindGlobalVariables(const RegularExpression ®ex,
+ uint32_t max_matches,
+ VariableList &variables);
+ virtual void FindFunctions(ConstString name,
+ const CompilerDeclContext &parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask,
+ bool include_inlines, SymbolContextList &sc_list);
+ virtual void FindFunctions(const RegularExpression ®ex,
+ bool include_inlines, SymbolContextList &sc_list);
+ virtual void
+ FindTypes(ConstString name, const CompilerDeclContext &parent_decl_ctx,
+ uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types);
- virtual size_t FindTypes(const std::vector<CompilerContext> &context,
- bool append, TypeMap &types);
+
+ /// Find types specified by a CompilerContextPattern.
+ /// \param languages
+ /// Only return results in these languages.
+ /// \param searched_symbol_files
+ /// Prevents one file from being visited multiple times.
+ virtual void
+ FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
virtual void
GetMangledNamesForFunction(const std::string &scope_qualified_name,
std::vector<ConstString> &mangled_names);
- // virtual uint32_t FindTypes (const SymbolContext& sc, const
- // RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
- // types) = 0;
- virtual TypeList *GetTypeList();
- virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) = 0;
+
+ virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) = 0;
virtual void PreloadSymbols();
- virtual lldb_private::TypeSystem *
+ virtual llvm::Expected<lldb_private::TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language);
virtual CompilerDeclContext
- FindNamespace(ConstString name,
- const CompilerDeclContext *parent_decl_ctx) {
+ FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx) {
return CompilerDeclContext();
}
- ObjectFile *GetObjectFile() { return m_obj_file; }
- const ObjectFile *GetObjectFile() const { return m_obj_file; }
+ ObjectFile *GetObjectFile() { return m_objfile_sp.get(); }
+ const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); }
+ ObjectFile *GetMainObjectFile();
- virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
+ virtual std::vector<std::unique_ptr<CallEdge>>
+ ParseCallEdgesInFunction(UserID func_id) {
return {};
}
@@ -221,7 +275,7 @@
/// Notify the SymbolFile that the file addresses in the Sections
/// for this module have been changed.
- virtual void SectionFileAddressesChanged() {}
+ virtual void SectionFileAddressesChanged();
struct RegisterInfoResolver {
virtual ~RegisterInfoResolver(); // anchor
@@ -235,19 +289,38 @@
return nullptr;
}
- virtual void Dump(Stream &s) {}
+ /// Return the number of stack bytes taken up by the parameters to this
+ /// function.
+ virtual llvm::Expected<lldb::addr_t> GetParameterStackSize(Symbol &symbol) {
+ return llvm::createStringError(make_error_code(llvm::errc::not_supported),
+ "Operation not supported.");
+ }
+
+ virtual void Dump(Stream &s);
protected:
void AssertModuleLock();
+ virtual uint32_t CalculateNumCompileUnits() = 0;
+ virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0;
+ virtual TypeList &GetTypeList() { return m_type_list; }
- ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
+ void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
+
+ lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
+ // case it isn't the same as the module
+ // object file (debug symbols in a separate
+ // file)
+ llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
+ TypeList m_type_list;
+ Symtab *m_symtab = nullptr;
uint32_t m_abilities;
bool m_calculated_abilities;
private:
- DISALLOW_COPY_AND_ASSIGN(SymbolFile);
+ SymbolFile(const SymbolFile &) = delete;
+ const SymbolFile &operator=(const SymbolFile &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_SymbolFile_h_
+#endif // LLDB_SYMBOL_SYMBOLFILE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h b/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h
index c4015ff..5c785e8 100644
--- a/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h
+++ b/linux-x64/clang/include/lldb/Symbol/SymbolVendor.h
@@ -6,15 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SymbolVendor_h_
-#define liblldb_SymbolVendor_h_
+#ifndef LLDB_SYMBOL_SYMBOLVENDOR_H
+#define LLDB_SYMBOL_SYMBOLVENDOR_H
#include <vector>
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/SourceModule.h"
-#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/DenseSet.h"
@@ -36,133 +36,20 @@
// Constructors and Destructors
SymbolVendor(const lldb::ModuleSP &module_sp);
- ~SymbolVendor() override;
-
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
- virtual void Dump(Stream *s);
-
- virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit);
-
- virtual size_t ParseFunctions(CompileUnit &comp_unit);
-
- virtual bool ParseLineTable(CompileUnit &comp_unit);
-
- virtual bool ParseDebugMacros(CompileUnit &comp_unit);
-
- virtual bool ParseSupportFiles(CompileUnit &comp_unit,
- FileSpecList &support_files);
-
- virtual bool ParseIsOptimized(CompileUnit &comp_unit);
-
- virtual size_t ParseTypes(CompileUnit &comp_unit);
-
- virtual bool
- ParseImportedModules(const SymbolContext &sc,
- std::vector<SourceModule> &imported_modules);
-
- virtual size_t ParseBlocksRecursive(Function &func);
-
- virtual size_t ParseVariablesForContext(const SymbolContext &sc);
-
- virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
-
- virtual uint32_t ResolveSymbolContext(const Address &so_addr,
- lldb::SymbolContextItem resolve_scope,
- SymbolContext &sc);
-
- virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
- uint32_t line, bool check_inlines,
- lldb::SymbolContextItem resolve_scope,
- SymbolContextList &sc_list);
-
- virtual size_t FindGlobalVariables(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches,
- VariableList &variables);
-
- virtual size_t FindGlobalVariables(const RegularExpression ®ex,
- size_t max_matches,
- VariableList &variables);
-
- virtual size_t FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- lldb::FunctionNameType name_type_mask,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
-
- virtual size_t FindFunctions(const RegularExpression ®ex,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
-
- virtual size_t
- FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, size_t max_matches,
- llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
- TypeMap &types);
-
- virtual size_t FindTypes(const std::vector<CompilerContext> &context,
- bool append, TypeMap &types);
-
- virtual CompilerDeclContext
- FindNamespace(ConstString name,
- const CompilerDeclContext *parent_decl_ctx);
-
- virtual size_t GetNumCompileUnits();
-
- virtual bool SetCompileUnitAtIndex(size_t cu_idx,
- const lldb::CompUnitSP &cu_sp);
-
- virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
-
- TypeList &GetTypeList() { return m_type_list; }
-
- const TypeList &GetTypeList() const { return m_type_list; }
-
- virtual size_t GetTypes(SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask, TypeList &type_list);
-
SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
- FileSpec GetMainFileSpec() const;
-
- // Get module unified section list symbol table.
- virtual Symtab *GetSymtab();
-
- // Clear module unified section list symbol table.
- virtual void ClearSymtab();
-
- /// Notify the SymbolVendor that the file addresses in the Sections
- /// for this module have been changed.
- virtual void SectionFileAddressesChanged();
-
// PluginInterface protocol
ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
protected:
- // Classes that inherit from SymbolVendor can see and modify these
- typedef std::vector<lldb::CompUnitSP> CompileUnits;
- typedef CompileUnits::iterator CompileUnitIter;
- typedef CompileUnits::const_iterator CompileUnitConstIter;
-
- TypeList m_type_list; // Uniqued types for all parsers owned by this module
- CompileUnits m_compile_units; // The current compile units
- lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
- // case it isn't the same as the module
- // object file (debug symbols in a separate
- // file)
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
// can add more of these if needed.
- Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of
- // the symbol file each time when it is needed
-
-private:
- // For SymbolVendor only
- DISALLOW_COPY_AND_ASSIGN(SymbolVendor);
};
} // namespace lldb_private
-#endif // liblldb_SymbolVendor_h_
+#endif // LLDB_SYMBOL_SYMBOLVENDOR_H
diff --git a/linux-x64/clang/include/lldb/Symbol/Symtab.h b/linux-x64/clang/include/lldb/Symbol/Symtab.h
index 868edcd..c232925 100644
--- a/linux-x64/clang/include/lldb/Symbol/Symtab.h
+++ b/linux-x64/clang/include/lldb/Symbol/Symtab.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Symtab_h_
-#define liblldb_Symtab_h_
+#ifndef LLDB_SYMBOL_SYMTAB_H
+#define LLDB_SYMBOL_SYMTAB_H
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/Symbol.h"
@@ -40,8 +40,12 @@
uint32_t AddSymbol(const Symbol &symbol);
size_t GetNumSymbols() const;
void SectionFileAddressesChanged();
- void Dump(Stream *s, Target *target, SortOrder sort_type);
- void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes) const;
+ void
+ Dump(Stream *s, Target *target, SortOrder sort_type,
+ Mangled::NamePreference name_preference = Mangled::ePreferDemangled);
+ void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes,
+ Mangled::NamePreference name_preference =
+ Mangled::ePreferDemangled) const;
uint32_t GetIndexForSymbol(const Symbol *symbol) const;
std::recursive_mutex &GetMutex() { return m_mutex; }
Symbol *FindSymbolByID(lldb::user_id_t uid) const;
@@ -92,15 +96,15 @@
const RegularExpression ®ex, lldb::SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &indexes);
- size_t FindAllSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- std::vector<uint32_t> &symbol_indexes);
- size_t FindAllSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- Debug symbol_debug_type,
- Visibility symbol_visibility,
- std::vector<uint32_t> &symbol_indexes);
- size_t FindAllSymbolsMatchingRexExAndType(
+ void FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &symbol_indexes);
+ void FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ void FindAllSymbolsMatchingRexExAndType(
const RegularExpression ®ex, lldb::SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &symbol_indexes);
@@ -112,8 +116,8 @@
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
void ForEachSymbolContainingFileAddress(
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
- size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
- SymbolContextList &sc_list);
+ void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
void CalculateSymbolSizes();
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
@@ -139,7 +143,29 @@
typedef std::vector<Symbol> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
- typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+ class FileRangeToIndexMapCompare {
+ public:
+ FileRangeToIndexMapCompare(const Symtab &symtab) : m_symtab(symtab) {}
+ bool operator()(const uint32_t a_data, const uint32_t b_data) const {
+ return rank(a_data) > rank(b_data);
+ }
+
+ private:
+ // How much preferred is this symbol?
+ int rank(const uint32_t data) const {
+ const Symbol &symbol = *m_symtab.SymbolAtIndex(data);
+ if (symbol.IsExternal())
+ return 3;
+ if (symbol.IsWeak())
+ return 2;
+ if (symbol.IsDebug())
+ return 0;
+ return 1;
+ }
+ const Symtab &m_symtab;
+ };
+ typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t, 0,
+ FileRangeToIndexMapCompare>
FileRangeToIndexMap;
void InitNameIndexes();
void InitAddressIndexes();
@@ -198,9 +224,10 @@
const char *decl_context,
const std::set<const char *> &class_contexts);
- DISALLOW_COPY_AND_ASSIGN(Symtab);
+ Symtab(const Symtab &) = delete;
+ const Symtab &operator=(const Symtab &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Symtab_h_
+#endif // LLDB_SYMBOL_SYMTAB_H
diff --git a/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h b/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h
index 043a913..f02f992 100644
--- a/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h
+++ b/linux-x64/clang/include/lldb/Symbol/TaggedASTType.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TaggedASTType_h_
-#define liblldb_TaggedASTType_h_
+#ifndef LLDB_SYMBOL_TAGGEDASTTYPE_H
+#define LLDB_SYMBOL_TAGGEDASTTYPE_H
#include "lldb/Symbol/CompilerType.h"
diff --git a/linux-x64/clang/include/lldb/Symbol/Type.h b/linux-x64/clang/include/lldb/Symbol/Type.h
index efc9bf0..dd917cf 100644
--- a/linux-x64/clang/include/lldb/Symbol/Type.h
+++ b/linux-x64/clang/include/lldb/Symbol/Type.h
@@ -6,10 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Type_h_
-#define liblldb_Type_h_
+#ifndef LLDB_SYMBOL_TYPE_H
+#define LLDB_SYMBOL_TYPE_H
-#include "lldb/Core/ClangForward.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Declaration.h"
@@ -22,22 +21,28 @@
#include <set>
namespace lldb_private {
-// CompilerContext allows an array of these items to be passed to perform
-// detailed lookups in SymbolVendor and SymbolFile functions.
+
+/// CompilerContext allows an array of these items to be passed to perform
+/// detailed lookups in SymbolVendor and SymbolFile functions.
struct CompilerContext {
- CompilerContext(CompilerContextKind t, ConstString n)
- : type(t), name(n) {}
+ CompilerContext(CompilerContextKind t, ConstString n) : kind(t), name(n) {}
bool operator==(const CompilerContext &rhs) const {
- return type == rhs.type && name == rhs.name;
+ return kind == rhs.kind && name == rhs.name;
}
+ bool operator!=(const CompilerContext &rhs) const { return !(*this == rhs); }
void Dump() const;
- CompilerContextKind type;
+ CompilerContextKind kind;
ConstString name;
};
+/// Match \p context_chain against \p pattern, which may contain "Any"
+/// kinds. The \p context_chain should *not* contain any "Any" kinds.
+bool contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
+ llvm::ArrayRef<CompilerContext> pattern);
+
class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
public UserID {
public:
@@ -51,6 +56,7 @@
Type *operator->() { return GetType(); }
Type *GetType();
+ SymbolFile &GetSymbolFile() const { return m_symbol_file; }
protected:
SymbolFile &m_symbol_file;
@@ -75,53 +81,55 @@
eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type
/// whose UID is m_encoding_uid
eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type
- /// whose UID is m_encoding_uid
+ /// whose UID is m_encoding_uid,
+ eEncodingIsAtomicUID, ///< This type is the type whose UID is
+ /// m_encoding_uid as an atomic type.
eEncodingIsSyntheticUID
};
- // We must force the underlying type of the enum to be unsigned here. Not
- // all compilers behave the same with regards to the default underlying type
- // of an enum, but because this enum is used in an enum bitfield and integer
- // comparisons are done with the value we need to guarantee that it's always
- // unsigned so that, for example, eResolveStateFull doesn't compare less than
- // eResolveStateUnresolved when used in a 2-bit bitfield.
- typedef enum ResolveStateTag : unsigned {
- eResolveStateUnresolved = 0,
- eResolveStateForward = 1,
- eResolveStateLayout = 2,
- eResolveStateFull = 3
- } ResolveState;
+ enum class ResolveState : unsigned char {
+ Unresolved = 0,
+ Forward = 1,
+ Layout = 2,
+ Full = 3
+ };
Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type,
const Declaration &decl, const CompilerType &compiler_qual_type,
- ResolveState compiler_type_resolve_state);
+ ResolveState compiler_type_resolve_state, uint32_t opaque_payload = 0);
// This makes an invalid type. Used for functions that return a Type when
// they get an error.
Type();
- void Dump(Stream *s, bool show_context);
+ void Dump(Stream *s, bool show_context,
+ lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
void DumpTypeName(Stream *s);
- // Since Type instances only keep a "SymbolFile *" internally, other classes
- // like TypeImpl need make sure the module is still around before playing
- // with
- // Type instances. They can store a weak pointer to the Module;
+ /// Since Type instances only keep a "SymbolFile *" internally, other classes
+ /// like TypeImpl need make sure the module is still around before playing
+ /// with
+ /// Type instances. They can store a weak pointer to the Module;
lldb::ModuleSP GetModule();
- void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name);
+ /// GetModule may return module for compile unit's object file.
+ /// GetExeModule returns module for executable object file that contains
+ /// compile unit where type was actualy defined.
+ /// GetModule and GetExeModule may return the same value.
+ lldb::ModuleSP GetExeModule();
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name,
+ ExecutionContextScope *exe_scope);
SymbolFile *GetSymbolFile() { return m_symbol_file; }
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
- TypeList *GetTypeList();
-
ConstString GetName();
- llvm::Optional<uint64_t> GetByteSize();
+ llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
uint32_t GetNumChildren(bool omit_empty_base_classes);
@@ -197,17 +205,17 @@
uint32_t GetEncodingMask();
- bool IsCompleteObjCClass() { return m_flags.is_complete_objc_class; }
-
- void SetIsCompleteObjCClass(bool is_complete_objc_class) {
- m_flags.is_complete_objc_class = is_complete_objc_class;
- }
+ typedef uint32_t Payload;
+ /// Return the language-specific payload.
+ Payload GetPayload() { return m_payload; }
+ /// Return the language-specific payload.
+ void SetPayload(Payload opaque_payload) { m_payload = opaque_payload; }
protected:
ConstString m_name;
SymbolFile *m_symbol_file;
- SymbolContextScope
- *m_context; // The symbol context in which this type is defined
+ /// The symbol context in which this type is defined.
+ SymbolContextScope *m_context;
Type *m_encoding_type;
lldb::user_id_t m_encoding_uid;
EncodingDataType m_encoding_uid_type;
@@ -215,20 +223,13 @@
uint64_t m_byte_size_has_value : 1;
Declaration m_decl;
CompilerType m_compiler_type;
-
- struct Flags {
-#ifdef __GNUC__
- // using unsigned type here to work around a very noisy gcc warning
- unsigned compiler_type_resolve_state : 2;
-#else
- ResolveState compiler_type_resolve_state : 2;
-#endif
- bool is_complete_objc_class : 1;
- } m_flags;
+ ResolveState m_compiler_type_resolve_state;
+ /// Language-specific flags.
+ Payload m_payload;
Type *GetEncodingType();
- bool ResolveClangType(ResolveState compiler_type_resolve_state);
+ bool ResolveCompilerType(ResolveState compiler_type_resolve_state);
};
// the two classes here are used by the public API as a backend to the SBType
@@ -266,6 +267,8 @@
void Clear();
+ lldb::ModuleSP GetModule() const;
+
ConstString GetName() const;
ConstString GetDisplayTypeName() const;
@@ -293,8 +296,12 @@
private:
bool CheckModule(lldb::ModuleSP &module_sp) const;
+ bool CheckExeModule(lldb::ModuleSP &module_sp) const;
+ bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp,
+ lldb::ModuleSP &module_sp) const;
lldb::ModuleWP m_module_wp;
+ lldb::ModuleWP m_exe_module_wp;
CompilerType m_static_type;
CompilerType m_dynamic_type;
};
@@ -519,4 +526,4 @@
} // namespace lldb_private
-#endif // liblldb_Type_h_
+#endif // LLDB_SYMBOL_TYPE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeList.h b/linux-x64/clang/include/lldb/Symbol/TypeList.h
index 982f673..0339085 100644
--- a/linux-x64/clang/include/lldb/Symbol/TypeList.h
+++ b/linux-x64/clang/include/lldb/Symbol/TypeList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TypeList_h_
-#define liblldb_TypeList_h_
+#ifndef LLDB_SYMBOL_TYPELIST_H
+#define LLDB_SYMBOL_TYPELIST_H
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Iterable.h"
@@ -28,15 +28,14 @@
void Dump(Stream *s, bool show_context);
- // lldb::TypeSP
- // FindType(lldb::user_id_t uid);
-
TypeList FindTypes(ConstString name);
void Insert(const lldb::TypeSP &type);
uint32_t GetSize() const;
+ bool Empty() const { return !GetSize(); }
+
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
typedef std::vector<lldb::TypeSP> collection;
@@ -64,9 +63,10 @@
collection m_types;
- DISALLOW_COPY_AND_ASSIGN(TypeList);
+ TypeList(const TypeList &) = delete;
+ const TypeList &operator=(const TypeList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_TypeList_h_
+#endif // LLDB_SYMBOL_TYPELIST_H
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeMap.h b/linux-x64/clang/include/lldb/Symbol/TypeMap.h
index e7d2b25..ede54c1 100644
--- a/linux-x64/clang/include/lldb/Symbol/TypeMap.h
+++ b/linux-x64/clang/include/lldb/Symbol/TypeMap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TypeMap_h_
-#define liblldb_TypeMap_h_
+#ifndef LLDB_SYMBOL_TYPEMAP_H
+#define LLDB_SYMBOL_TYPEMAP_H
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Iterable.h"
@@ -26,7 +26,8 @@
void Clear();
- void Dump(Stream *s, bool show_context);
+ void Dump(Stream *s, bool show_context,
+ lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
TypeMap FindTypes(ConstString name);
@@ -66,9 +67,10 @@
collection m_types;
- DISALLOW_COPY_AND_ASSIGN(TypeMap);
+ TypeMap(const TypeMap &) = delete;
+ const TypeMap &operator=(const TypeMap &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_TypeMap_h_
+#endif // LLDB_SYMBOL_TYPEMAP_H
diff --git a/linux-x64/clang/include/lldb/Symbol/TypeSystem.h b/linux-x64/clang/include/lldb/Symbol/TypeSystem.h
index 4bef2a4..1fad8f6 100644
--- a/linux-x64/clang/include/lldb/Symbol/TypeSystem.h
+++ b/linux-x64/clang/include/lldb/Symbol/TypeSystem.h
@@ -6,16 +6,19 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TypeSystem_h_
-#define liblldb_TypeSystem_h_
+#ifndef LLDB_SYMBOL_TYPESYSTEM_H
+#define LLDB_SYMBOL_TYPESYSTEM_H
#include <functional>
#include <map>
#include <mutex>
#include <string>
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Error.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
@@ -29,51 +32,49 @@
namespace lldb_private {
-// Interface for representing the Type Systems in different languages.
+/// A SmallBitVector that represents a set of source languages (\p
+/// lldb::LanguageType). Each lldb::LanguageType is represented by
+/// the bit with the position of its enumerator. The largest
+/// LanguageType is < 64, so this is space-efficient and on 64-bit
+/// architectures a LanguageSet can be completely stack-allocated.
+struct LanguageSet {
+ llvm::SmallBitVector bitvector;
+ LanguageSet();
+
+ /// If the set contains a single language only, return it.
+ llvm::Optional<lldb::LanguageType> GetSingularLanguage();
+ void Insert(lldb::LanguageType language);
+ bool Empty() const;
+ size_t Size() const;
+ bool operator[](unsigned i) const;
+};
+
+/// Interface for representing a type system.
+///
+/// Implemented by language plugins to define the type system for a given
+/// language.
+///
+/// This interface extensively used opaque pointers to prevent that generic
+/// LLDB code has dependencies on language plugins. The type and semantics of
+/// these opaque pointers are defined by the TypeSystem implementation inside
+/// the respective language plugin. Opaque pointers from one TypeSystem
+/// instance should never be passed to a different TypeSystem instance (even
+/// when the language plugin for both TypeSystem instances is the same).
+///
+/// Most of the functions in this class should not be called directly but only
+/// called by their respective counterparts in CompilerType, CompilerDecl and
+/// CompilerDeclContext.
+///
+/// \see lldb_private::CompilerType
+/// \see lldb_private::CompilerDecl
+/// \see lldb_private::CompilerDeclContext
class TypeSystem : public PluginInterface {
public:
- // Intrusive type system that allows us to use llvm casting.
- //
- // To add a new type system:
- //
- // 1 - Add a new enumeration for llvm casting below for your TypeSystem
- // subclass, here we will use eKindFoo
- //
- // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs
- // to implement a static classof() function that returns your
- // enumeration:
- //
- // class Foo : public lldb_private::TypeSystem
- // {
- // static bool classof(const TypeSystem *ts)
- // {
- // return ts->getKind() == TypeSystem::eKindFoo;
- // }
- // };
- //
- // 3 - Contruct your TypeSystem subclass with the enumeration from below
- //
- // Foo() :
- // TypeSystem(TypeSystem::eKindFoo),
- // ...
- // {
- // }
- //
- // Then you can use the llvm casting on any "TypeSystem *" to get an instance
- // of your subclass.
- enum LLVMCastKind {
- eKindClang,
- eKindSwift,
- eKindOCaml,
- kNumKinds
- };
-
// Constructors and Destructors
- TypeSystem(LLVMCastKind kind);
-
~TypeSystem() override;
- LLVMCastKind getKind() const { return m_kind; }
+ // LLVM RTTI support
+ virtual bool isA(const void *ClassID) const = 0;
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
Module *module);
@@ -107,14 +108,14 @@
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx);
+ virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
+
// CompilerDeclContext functions
virtual std::vector<CompilerDecl>
DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
const bool ignore_imported_decls);
- virtual bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) = 0;
-
virtual ConstString DeclContextGetName(void *opaque_decl_ctx) = 0;
virtual ConstString
@@ -128,6 +129,11 @@
void *other_opaque_decl_ctx) = 0;
// Tests
+#ifndef NDEBUG
+ /// Verify the integrity of the type to catch CompilerTypes that mix
+ /// and match invalid TypeSystem/Opaque type pairs.
+ virtual bool Verify(lldb::opaque_compiler_type_t type) = 0;
+#endif
virtual bool IsArrayType(lldb::opaque_compiler_type_t type,
CompilerType *element_type, uint64_t *size,
@@ -146,8 +152,7 @@
virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type,
uint32_t &count, bool &is_complex) = 0;
- virtual bool IsFunctionType(lldb::opaque_compiler_type_t type,
- bool *is_variadic_ptr) = 0;
+ virtual bool IsFunctionType(lldb::opaque_compiler_type_t type) = 0;
virtual size_t
GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) = 0;
@@ -170,6 +175,8 @@
return false;
}
+ virtual bool IsScopedEnumerationType(lldb::opaque_compiler_type_t type) = 0;
+
virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *target_type, // Can pass NULL
bool check_cplusplus, bool check_objc) = 0;
@@ -198,6 +205,8 @@
virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type) = 0;
+ virtual ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type) = 0;
+
virtual uint32_t
GetTypeInfo(lldb::opaque_compiler_type_t type,
CompilerType *pointee_or_element_compiler_type) = 0;
@@ -209,14 +218,18 @@
// Creating related types
- virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
- uint64_t *stride) = 0;
+ virtual CompilerType
+ GetArrayElementType(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) = 0;
virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
uint64_t size);
virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) = 0;
+ virtual CompilerType
+ GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) = 0;
+
// Returns -1 if this isn't a function of if the function doesn't have a
// prototype Returns a value >= 0 if there is a prototype.
virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) = 0;
@@ -243,18 +256,25 @@
virtual CompilerType
GetRValueReferenceType(lldb::opaque_compiler_type_t type);
+ virtual CompilerType GetAtomicType(lldb::opaque_compiler_type_t type);
+
virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type);
virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type);
virtual CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type);
+ /// \param opaque_payload The m_payload field of Type, which may
+ /// carry TypeSystem-specific extra information.
virtual CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
const char *name,
- const CompilerDeclContext &decl_ctx);
+ const CompilerDeclContext &decl_ctx,
+ uint32_t opaque_payload);
// Exploring the type
+ virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
+
virtual llvm::Optional<uint64_t>
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;
@@ -359,11 +379,18 @@
uint32_t bitfield_bit_offset,
ExecutionContextScope *exe_scope) = 0;
- virtual void
- DumpTypeDescription(lldb::opaque_compiler_type_t type) = 0; // Dump to stdout
+ /// Dump the type to stdout.
+ virtual void DumpTypeDescription(
+ lldb::opaque_compiler_type_t type,
+ lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) = 0;
- virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type,
- Stream *s) = 0;
+ /// Print a description of the type to a stream. The exact implementation
+ /// varies, but the expectation is that eDescriptionLevelFull returns a
+ /// source-like representation of the type, whereas eDescriptionLevelVerbose
+ /// does a dump of the underlying AST if applicable.
+ virtual void DumpTypeDescription(
+ lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) = 0;
// TODO: These methods appear unused. Should they be removed?
@@ -375,13 +402,7 @@
lldb::offset_t data_offset,
size_t data_byte_size) = 0;
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
- const char *s, uint8_t *dst,
- size_t dst_size) = 0;
-
- // TODO: Determine if these methods should move to ClangASTContext.
+ // TODO: Determine if these methods should move to TypeSystemClang.
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
CompilerType *pointee_type) = 0;
@@ -391,7 +412,9 @@
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) = 0;
- virtual size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0;
+ virtual llvm::Optional<size_t>
+ GetTypeBitAlign(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) = 0;
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
@@ -446,10 +469,8 @@
return nullptr;
}
- virtual UtilityFunction *GetUtilityFunction(const char *text,
- const char *name) {
- return nullptr;
- }
+ virtual std::unique_ptr<UtilityFunction>
+ CreateUtilityFunction(std::string text, std::string name);
virtual PersistentExpressionState *GetPersistentExpressionState() {
return nullptr;
@@ -474,8 +495,7 @@
virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
protected:
- const LLVMCastKind m_kind; // Support for llvm casting
- SymbolFile *m_sym_file;
+ SymbolFile *m_sym_file = nullptr;
};
class TypeSystemMap {
@@ -491,25 +511,38 @@
// callback to keep iterating, false to stop iterating.
void ForEach(std::function<bool(TypeSystem *)> const &callback);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Module *module, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
+ bool can_create);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Target *target, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
+ bool can_create);
protected:
- // This function does not take the map mutex, and should only be called from
- // functions that do take the mutex.
- void AddToMap(lldb::LanguageType language,
- lldb::TypeSystemSP const &type_system_sp);
-
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
///multi-threaded environments.
collection m_map;
bool m_clear_in_progress;
+
+private:
+ typedef llvm::function_ref<lldb::TypeSystemSP()> CreateCallback;
+ /// Finds the type system for the given language. If no type system could be
+ /// found for a language and a CreateCallback was provided, the value returned
+ /// by the callback will be treated as the TypeSystem for the language.
+ ///
+ /// \param language The language for which the type system should be found.
+ /// \param create_callback A callback that will be called if no previously
+ /// created TypeSystem that fits the given language
+ /// could found. Can be omitted if a non-existent
+ /// type system should be treated as an error instead.
+ /// \return The found type system or an error.
+ llvm::Expected<TypeSystem &> GetTypeSystemForLanguage(
+ lldb::LanguageType language,
+ llvm::Optional<CreateCallback> create_callback = llvm::None);
};
} // namespace lldb_private
-#endif // liblldb_TypeSystem_h_
+#endif // LLDB_SYMBOL_TYPESYSTEM_H
diff --git a/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h b/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h
index 2b49aca..40814da 100644
--- a/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h
+++ b/linux-x64/clang/include/lldb/Symbol/UnwindPlan.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UnwindPlan_h
-#define liblldb_UnwindPlan_h
+#ifndef LLDB_SYMBOL_UNWINDPLAN_H
+#define LLDB_SYMBOL_UNWINDPLAN_H
#include <map>
#include <memory>
@@ -201,7 +201,8 @@
unspecified, // not specified
isRegisterPlusOffset, // FA = register + offset
isRegisterDereferenced, // FA = [reg]
- isDWARFExpression // FA = eval(dwarf_expr)
+ isDWARFExpression, // FA = eval(dwarf_expr)
+ isRaSearch, // FA = SP + offset + ???
};
FAValue() : m_type(unspecified), m_value() {}
@@ -214,6 +215,11 @@
bool IsUnspecified() const { return m_type == unspecified; }
+ void SetRaSearch(int32_t offset) {
+ m_type = isRaSearch;
+ m_value.ra_search_offset = offset;
+ }
+
bool IsRegisterPlusOffset() const {
return m_type == isRegisterPlusOffset;
}
@@ -250,9 +256,14 @@
ValueType GetValueType() const { return m_type; }
int32_t GetOffset() const {
- if (m_type == isRegisterPlusOffset)
- return m_value.reg.offset;
- return 0;
+ switch (m_type) {
+ case isRegisterPlusOffset:
+ return m_value.reg.offset;
+ case isRaSearch:
+ return m_value.ra_search_offset;
+ default:
+ return 0;
+ }
}
void IncOffset(int32_t delta) {
@@ -304,10 +315,11 @@
const uint8_t *opcodes;
uint16_t length;
} expr;
+ // For m_type == isRaSearch
+ int32_t ra_search_offset;
} m_value;
}; // class FAValue
- public:
Row();
Row(const UnwindPlan::Row &rhs) = default;
@@ -362,7 +374,6 @@
collection m_register_locations;
}; // class Row
-public:
typedef std::shared_ptr<Row> RowSP;
UnwindPlan(lldb::RegisterKind reg_kind)
@@ -370,6 +381,7 @@
m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
+ m_plan_is_for_signal_trap(eLazyBoolCalculate),
m_lsda_address(), m_personality_func_addr() {}
// Performs a deep copy of the plan, including all the rows (expensive).
@@ -381,6 +393,7 @@
m_plan_is_sourced_from_compiler(rhs.m_plan_is_sourced_from_compiler),
m_plan_is_valid_at_all_instruction_locations(
rhs.m_plan_is_valid_at_all_instruction_locations),
+ m_plan_is_for_signal_trap(rhs.m_plan_is_for_signal_trap),
m_lsda_address(rhs.m_lsda_address),
m_personality_func_addr(rhs.m_personality_func_addr) {
m_row_list.reserve(rhs.m_row_list.size());
@@ -463,6 +476,17 @@
m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn;
}
+ // Is this UnwindPlan for a signal trap frame? If so, then its saved pc
+ // may have been set manually by the signal dispatch code and therefore
+ // not follow a call to the child frame.
+ lldb_private::LazyBool GetUnwindPlanForSignalTrap() const {
+ return m_plan_is_for_signal_trap;
+ }
+
+ void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap) {
+ m_plan_is_for_signal_trap = is_for_signal_trap;
+ }
+
int GetRowCount() const;
void Clear() {
@@ -472,6 +496,7 @@
m_source_name.Clear();
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
+ m_plan_is_for_signal_trap = eLazyBoolCalculate;
m_lsda_address.Clear();
m_personality_func_addr.Clear();
}
@@ -502,6 +527,7 @@
m_source_name; // for logging, where this UnwindPlan originated from
lldb_private::LazyBool m_plan_is_sourced_from_compiler;
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
+ lldb_private::LazyBool m_plan_is_for_signal_trap;
Address m_lsda_address; // Where the language specific data area exists in the
// module - used
@@ -513,4 +539,4 @@
} // namespace lldb_private
-#endif // liblldb_UnwindPlan_h
+#endif // LLDB_SYMBOL_UNWINDPLAN_H
diff --git a/linux-x64/clang/include/lldb/Symbol/UnwindTable.h b/linux-x64/clang/include/lldb/Symbol/UnwindTable.h
index b4d7f06..9548b1f 100644
--- a/linux-x64/clang/include/lldb/Symbol/UnwindTable.h
+++ b/linux-x64/clang/include/lldb/Symbol/UnwindTable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UnwindTable_h
-#define liblldb_UnwindTable_h
+#ifndef LLDB_SYMBOL_UNWINDTABLE_H
+#define LLDB_SYMBOL_UNWINDTABLE_H
#include <map>
#include <mutex>
@@ -27,6 +27,8 @@
~UnwindTable();
+ lldb_private::CallFrameInfo *GetObjectFileUnwindInfo();
+
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
@@ -71,14 +73,16 @@
bool m_initialized; // delay some initialization until ObjectFile is set up
std::mutex m_mutex;
+ std::unique_ptr<CallFrameInfo> m_object_file_unwind_up;
std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up;
std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up;
- DISALLOW_COPY_AND_ASSIGN(UnwindTable);
+ UnwindTable(const UnwindTable &) = delete;
+ const UnwindTable &operator=(const UnwindTable &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_UnwindTable_h
+#endif // LLDB_SYMBOL_UNWINDTABLE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/Variable.h b/linux-x64/clang/include/lldb/Symbol/Variable.h
index 12daecf..0dcbbd8 100644
--- a/linux-x64/clang/include/lldb/Symbol/Variable.h
+++ b/linux-x64/clang/include/lldb/Symbol/Variable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Variable_h_
-#define liblldb_Variable_h_
+#ifndef LLDB_SYMBOL_VARIABLE_H
+#define LLDB_SYMBOL_VARIABLE_H
#include "lldb/Core/Mangled.h"
#include "lldb/Expression/DWARFExpression.h"
@@ -26,14 +26,14 @@
public:
typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
- // Constructors and Destructors
- Variable(lldb::user_id_t uid, const char *name,
- const char
- *mangled, // The mangled or fully qualified name of the variable.
- const lldb::SymbolFileTypeSP &symfile_type_sp,
- lldb::ValueType scope, SymbolContextScope *owner_scope,
- const RangeList &scope_range, Declaration *decl,
- const DWARFExpression &location, bool external, bool artificial,
+ /// Constructors and Destructors.
+ ///
+ /// \param mangled The mangled or fully qualified name of the variable.
+ Variable(lldb::user_id_t uid, const char *name, const char *mangled,
+ const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope,
+ SymbolContextScope *owner_scope, const RangeList &scope_range,
+ Declaration *decl, const DWARFExpression &location, bool external,
+ bool artificial, bool location_is_constant_data,
bool static_member = false);
virtual ~Variable();
@@ -50,11 +50,11 @@
SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
- // Since a variable can have a basename "i" and also a mangled named
- // "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
- // namespace)::i", this function will allow a generic match function that can
- // be called by commands and expression parsers to make sure we match
- // anything we come across.
+ /// Since a variable can have a basename "i" and also a mangled named
+ /// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
+ /// namespace)::i", this function will allow a generic match function that can
+ /// be called by commands and expression parsers to make sure we match
+ /// anything we come across.
bool NameMatches(ConstString name) const;
bool NameMatches(const RegularExpression ®ex) const;
@@ -65,6 +65,8 @@
lldb::ValueType GetScope() const { return m_scope; }
+ const RangeList &GetScopeRange() const { return m_scope_range; }
+
bool IsExternal() const { return m_external; }
bool IsArtificial() const { return m_artificial; }
@@ -99,34 +101,42 @@
GetVariableCallback callback, void *baton, VariableList &variable_list,
ValueObjectList &valobj_list);
- static size_t AutoComplete(const ExecutionContext &exe_ctx,
- CompletionRequest &request);
+ static void AutoComplete(const ExecutionContext &exe_ctx,
+ CompletionRequest &request);
CompilerDeclContext GetDeclContext();
CompilerDecl GetDecl();
protected:
- ConstString m_name; // The basename of the variable (no namespaces)
- Mangled m_mangled; // The mangled name of the variable
- lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable
- // (int, struct, class, etc)
- lldb::ValueType m_scope; // global, parameter, local
- SymbolContextScope
- *m_owner_scope; // The symbol file scope that this variable was defined in
- RangeList m_scope_range; // The list of ranges inside the owner's scope where
- // this variable is valid
- Declaration m_declaration; // Declaration location for this item.
- DWARFExpression m_location; // The location of this variable that can be fed
- // to DWARFExpression::Evaluate()
- uint8_t m_external : 1, // Visible outside the containing compile unit?
- m_artificial : 1, // Non-zero if the variable is not explicitly declared
- // in source
- m_loc_is_const_data : 1, // The m_location expression contains the
- // constant variable value data, not a DWARF
- // location
- m_static_member : 1; // Non-zero if variable is static member of a class
- // or struct.
+ /// The basename of the variable (no namespaces).
+ ConstString m_name;
+ /// The mangled name of the variable.
+ Mangled m_mangled;
+ /// The type pointer of the variable (int, struct, class, etc)
+ /// global, parameter, local.
+ lldb::SymbolFileTypeSP m_symfile_type_sp;
+ lldb::ValueType m_scope;
+ /// The symbol file scope that this variable was defined in
+ SymbolContextScope *m_owner_scope;
+ /// The list of ranges inside the owner's scope where this variable
+ /// is valid.
+ RangeList m_scope_range;
+ /// Declaration location for this item.
+ Declaration m_declaration;
+ /// The location of this variable that can be fed to
+ /// DWARFExpression::Evaluate().
+ DWARFExpression m_location;
+ /// Visible outside the containing compile unit?
+ unsigned m_external : 1;
+ /// Non-zero if the variable is not explicitly declared in source.
+ unsigned m_artificial : 1;
+ /// The m_location expression contains the constant variable value
+ /// data, not a DWARF location.
+ unsigned m_loc_is_const_data : 1;
+ /// Non-zero if variable is static member of a class or struct.
+ unsigned m_static_member : 1;
+
private:
Variable(const Variable &rhs) = delete;
Variable &operator=(const Variable &rhs) = delete;
@@ -134,4 +144,4 @@
} // namespace lldb_private
-#endif // liblldb_Variable_h_
+#endif // LLDB_SYMBOL_VARIABLE_H
diff --git a/linux-x64/clang/include/lldb/Symbol/VariableList.h b/linux-x64/clang/include/lldb/Symbol/VariableList.h
index 54d2758..9fea628 100644
--- a/linux-x64/clang/include/lldb/Symbol/VariableList.h
+++ b/linux-x64/clang/include/lldb/Symbol/VariableList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_VariableList_h_
-#define liblldb_VariableList_h_
+#ifndef LLDB_SYMBOL_VARIABLELIST_H
+#define LLDB_SYMBOL_VARIABLELIST_H
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Variable.h"
@@ -16,6 +16,8 @@
namespace lldb_private {
class VariableList {
+ typedef std::vector<lldb::VariableSP> collection;
+
public:
// Constructors and Destructors
// VariableList(const SymbolContext &symbol_context);
@@ -65,18 +67,23 @@
size_t GetSize() const;
bool Empty() const { return m_variables.empty(); }
-protected:
- typedef std::vector<lldb::VariableSP> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
+ iterator begin() { return m_variables.begin(); }
+ iterator end() { return m_variables.end(); }
+ const_iterator begin() const { return m_variables.begin(); }
+ const_iterator end() const { return m_variables.end(); }
+
+protected:
collection m_variables;
private:
// For VariableList only
- DISALLOW_COPY_AND_ASSIGN(VariableList);
+ VariableList(const VariableList &) = delete;
+ const VariableList &operator=(const VariableList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_VariableList_h_
+#endif // LLDB_SYMBOL_VARIABLELIST_H
diff --git a/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h b/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h
deleted file mode 100644
index f412b94..0000000
--- a/linux-x64/clang/include/lldb/Symbol/VerifyDecl.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- VerifyDecl.h --------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_VariableList_h_
-#define lldb_VariableList_h_
-
-#include "lldb/Core/ClangForward.h"
-
-namespace lldb_private {
-void VerifyDecl(clang::Decl *decl);
-}
-
-#endif
diff --git a/linux-x64/clang/include/lldb/Target/ABI.h b/linux-x64/clang/include/lldb/Target/ABI.h
index f254839..131b2ea 100644
--- a/linux-x64/clang/include/lldb/Target/ABI.h
+++ b/linux-x64/clang/include/lldb/Target/ABI.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ABI_h_
-#define liblldb_ABI_h_
+#ifndef LLDB_TARGET_ABI_H
+#define LLDB_TARGET_ABI_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/UnwindPlan.h"
@@ -15,8 +15,8 @@
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/MC/MCRegisterInfo.h"
-// forward define the llvm::Type class
namespace llvm {
class Type;
}
@@ -124,30 +124,68 @@
return pc;
}
- virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
+ llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; }
- bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
-
- bool GetRegisterInfoByKind(lldb::RegisterKind reg_kind, uint32_t reg_num,
- RegisterInfo &info);
+ virtual void AugmentRegisterInfo(RegisterInfo &info) = 0;
virtual bool GetPointerReturnRegister(const char *&name) { return false; }
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch);
protected:
- // Classes that inherit from ABI can see and modify these
- ABI(lldb::ProcessSP process_sp) {
- if (process_sp.get())
- m_process_wp = process_sp;
+ ABI(lldb::ProcessSP process_sp, std::unique_ptr<llvm::MCRegisterInfo> info_up)
+ : m_process_wp(process_sp), m_mc_register_info_up(std::move(info_up)) {
+ assert(m_mc_register_info_up && "ABI must have MCRegisterInfo");
}
+ /// Utility function to construct a MCRegisterInfo using the ArchSpec triple.
+ /// Plugins wishing to customize the construction can construct the
+ /// MCRegisterInfo themselves.
+ static std::unique_ptr<llvm::MCRegisterInfo>
+ MakeMCRegisterInfo(const ArchSpec &arch);
+
lldb::ProcessWP m_process_wp;
+ std::unique_ptr<llvm::MCRegisterInfo> m_mc_register_info_up;
private:
- DISALLOW_COPY_AND_ASSIGN(ABI);
+ ABI(const ABI &) = delete;
+ const ABI &operator=(const ABI &) = delete;
+};
+
+class RegInfoBasedABI : public ABI {
+public:
+ void AugmentRegisterInfo(RegisterInfo &info) override;
+
+protected:
+ using ABI::ABI;
+
+ bool GetRegisterInfoByName(llvm::StringRef name, RegisterInfo &info);
+
+ virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
+};
+
+class MCBasedABI : public ABI {
+public:
+ void AugmentRegisterInfo(RegisterInfo &info) override;
+
+ /// If the register name is of the form "<from_prefix>[<number>]" then change
+ /// the name to "<to_prefix>[<number>]". Otherwise, leave the name unchanged.
+ static void MapRegisterName(std::string ®, llvm::StringRef from_prefix,
+ llvm::StringRef to_prefix);
+protected:
+ using ABI::ABI;
+
+ /// Return eh_frame and dwarf numbers for the given register.
+ virtual std::pair<uint32_t, uint32_t> GetEHAndDWARFNums(llvm::StringRef reg);
+
+ /// Return the generic number of the given register.
+ virtual uint32_t GetGenericNum(llvm::StringRef reg) = 0;
+
+ /// For the given (capitalized) lldb register name, return the name of this
+ /// register in the MCRegisterInfo struct.
+ virtual std::string GetMCName(std::string reg) { return reg; }
};
} // namespace lldb_private
-#endif // liblldb_ABI_h_
+#endif // LLDB_TARGET_ABI_H
diff --git a/linux-x64/clang/include/lldb/Target/AssertFrameRecognizer.h b/linux-x64/clang/include/lldb/Target/AssertFrameRecognizer.h
new file mode 100644
index 0000000..2ecc957
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/AssertFrameRecognizer.h
@@ -0,0 +1,54 @@
+//===-- AssertFrameRecognizer.cpp -------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
+#define LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
+
+#include "lldb/Target/Process.h"
+#include "lldb/Target/StackFrameRecognizer.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+
+#include <tuple>
+
+namespace lldb_private {
+
+/// Registers the assert stack frame recognizer.
+///
+/// \param[in] process
+/// The process that is currently asserting. This will give us information on
+/// the target and the platform.
+void RegisterAssertFrameRecognizer(Process *process);
+
+/// \class AssertRecognizedStackFrame
+///
+/// Holds the stack frame where the assert is called from.
+class AssertRecognizedStackFrame : public RecognizedStackFrame {
+public:
+ AssertRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp);
+ lldb::StackFrameSP GetMostRelevantFrame() override;
+
+private:
+ lldb::StackFrameSP m_most_relevant_frame;
+};
+
+/// \class AssertFrameRecognizer
+///
+/// When a thread stops, it checks depending on the platform if the top frame is
+/// an abort stack frame. If so, it looks for an assert stack frame in the upper
+/// frames and set it as the most relavant frame when found.
+class AssertFrameRecognizer : public StackFrameRecognizer {
+public:
+ std::string GetName() override { return "Assert StackFrame Recognizer"; }
+ lldb::RecognizedStackFrameSP
+ RecognizeFrame(lldb::StackFrameSP frame_sp) override;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
diff --git a/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h b/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h
deleted file mode 100644
index 2852636..0000000
--- a/linux-x64/clang/include/lldb/Target/CPPLanguageRuntime.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//===-- CPPLanguageRuntime.h
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CPPLanguageRuntime_h_
-#define liblldb_CPPLanguageRuntime_h_
-
-#include <vector>
-#include "lldb/Core/PluginInterface.h"
-#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-class CPPLanguageRuntime : public LanguageRuntime {
-public:
- enum class LibCppStdFunctionCallableCase {
- Lambda = 0,
- CallableObject,
- FreeOrMemberFunction,
- Invalid
- };
-
- struct LibCppStdFunctionCallableInfo {
- Symbol callable_symbol;
- Address callable_address;
- LineEntry callable_line_entry;
- lldb::addr_t member__f_pointer_value = 0u;
- LibCppStdFunctionCallableCase callable_case =
- LibCppStdFunctionCallableCase::Invalid;
- };
-
- LibCppStdFunctionCallableInfo
- FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
-
- ~CPPLanguageRuntime() override;
-
- static char ID;
-
- bool isA(const void *ClassID) const override {
- return ClassID == &ID || LanguageRuntime::isA(ClassID);
- }
-
- static bool classof(const LanguageRuntime *runtime) {
- return runtime->isA(&ID);
- }
-
- lldb::LanguageType GetLanguageType() const override {
- return lldb::eLanguageTypeC_plus_plus;
- }
-
- static CPPLanguageRuntime *Get(Process &process) {
- return llvm::cast_or_null<CPPLanguageRuntime>(
- process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));
- }
-
- bool GetObjectDescription(Stream &str, ValueObject &object) override;
-
- bool GetObjectDescription(Stream &str, Value &value,
- ExecutionContextScope *exe_scope) override;
-
- /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
- ///
- /// \param[in] thread
- /// Curent thrad of execution.
- ///
- /// \param[in] stop_others
- /// True if other threads should pause during execution.
- ///
- /// \return
- /// A ThreadPlan Shared pointer
- lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
- bool stop_others) override;
-
- bool IsWhitelistedRuntimeValue(ConstString name) override;
-protected:
- // Classes that inherit from CPPLanguageRuntime can see and modify these
- CPPLanguageRuntime(Process *process);
-
-private:
- DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CPPLanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/DynamicLoader.h b/linux-x64/clang/include/lldb/Target/DynamicLoader.h
index 2bf3f32..dead3ee 100644
--- a/linux-x64/clang/include/lldb/Target/DynamicLoader.h
+++ b/linux-x64/clang/include/lldb/Target/DynamicLoader.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DynamicLoader_h_
-#define liblldb_DynamicLoader_h_
+#ifndef LLDB_TARGET_DYNAMICLOADER_H
+#define LLDB_TARGET_DYNAMICLOADER_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/Utility/FileSpec.h"
@@ -68,12 +68,6 @@
/// Construct with a process.
DynamicLoader(Process *process);
- /// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be inherited
- /// from by the plug-in instance.
- ~DynamicLoader() override;
-
/// Called after attaching a process.
///
/// Allow DynamicLoader plug-ins to execute some code after attaching to a
@@ -148,13 +142,9 @@
/// The equivalent symbol list - any equivalent symbols found are appended
/// to this list.
///
- /// \return
- /// Number of equivalent symbols found.
- virtual size_t FindEquivalentSymbols(Symbol *original_symbol,
- ModuleList &module_list,
- SymbolContextList &equivalent_symbols) {
- return 0;
- }
+ virtual void FindEquivalentSymbols(Symbol *original_symbol,
+ ModuleList &module_list,
+ SymbolContextList &equivalent_symbols) {}
/// Ask if it is ok to try and load or unload an shared library (image).
///
@@ -312,11 +302,8 @@
// Member variables.
Process
*m_process; ///< The process that this dynamic loader plug-in is tracking.
-
-private:
- DISALLOW_COPY_AND_ASSIGN(DynamicLoader);
};
} // namespace lldb_private
-#endif // liblldb_DynamicLoader_h_
+#endif // LLDB_TARGET_DYNAMICLOADER_H
diff --git a/linux-x64/clang/include/lldb/Target/ExecutionContext.h b/linux-x64/clang/include/lldb/Target/ExecutionContext.h
index 0819357..169d56a 100644
--- a/linux-x64/clang/include/lldb/Target/ExecutionContext.h
+++ b/linux-x64/clang/include/lldb/Target/ExecutionContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ExecutionContext_h_
-#define liblldb_ExecutionContext_h_
+#ifndef LLDB_TARGET_EXECUTIONCONTEXT_H
+#define LLDB_TARGET_EXECUTIONCONTEXT_H
#include <mutex>
@@ -565,4 +565,4 @@
} // namespace lldb_private
-#endif // liblldb_ExecutionContext_h_
+#endif // LLDB_TARGET_EXECUTIONCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h b/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h
index 0121ce6..d7003e9 100644
--- a/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h
+++ b/linux-x64/clang/include/lldb/Target/ExecutionContextScope.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ExecutionContextScope_h_
-#define liblldb_ExecutionContextScope_h_
+#ifndef LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
+#define LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
#include "lldb/lldb-private.h"
@@ -55,4 +55,4 @@
} // namespace lldb_private
-#endif // liblldb_ExecutionContextScope_h_
+#endif // LLDB_TARGET_EXECUTIONCONTEXTSCOPE_H
diff --git a/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h b/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h
index 4cee76d..eeec91f 100644
--- a/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h
+++ b/linux-x64/clang/include/lldb/Target/InstrumentationRuntime.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_InstrumentationRuntime_h_
-#define liblldb_InstrumentationRuntime_h_
+#ifndef LLDB_TARGET_INSTRUMENTATIONRUNTIME_H
+#define LLDB_TARGET_INSTRUMENTATIONRUNTIME_H
#include <map>
#include <vector>
@@ -53,7 +53,7 @@
lldb::ModuleSP GetRuntimeModuleSP() { return m_runtime_module; }
void SetRuntimeModuleSP(lldb::ModuleSP module_sp) {
- m_runtime_module = module_sp;
+ m_runtime_module = std::move(module_sp);
}
lldb::user_id_t GetBreakpointID() const { return m_breakpoint_id; }
@@ -92,4 +92,4 @@
} // namespace lldb_private
-#endif // liblldb_InstrumentationRuntime_h_
+#endif // LLDB_TARGET_INSTRUMENTATIONRUNTIME_H
diff --git a/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h
index 6c2a8ad..2cbf27d 100644
--- a/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+++ b/linux-x64/clang/include/lldb/Target/InstrumentationRuntimeStopInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_InstrumentationRuntimeStopInfo_h_
-#define liblldb_InstrumentationRuntimeStopInfo_h_
+#ifndef LLDB_TARGET_INSTRUMENTATIONRUNTIMESTOPINFO_H
+#define LLDB_TARGET_INSTRUMENTATIONRUNTIMESTOPINFO_H
#include <string>
@@ -39,4 +39,4 @@
} // namespace lldb_private
-#endif // liblldb_InstrumentationRuntimeStopInfo_h_
+#endif // LLDB_TARGET_INSTRUMENTATIONRUNTIMESTOPINFO_H
diff --git a/linux-x64/clang/include/lldb/Target/JITLoader.h b/linux-x64/clang/include/lldb/Target/JITLoader.h
index 1bafd82..790fdfa 100644
--- a/linux-x64/clang/include/lldb/Target/JITLoader.h
+++ b/linux-x64/clang/include/lldb/Target/JITLoader.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_JITLoader_h_
-#define liblldb_JITLoader_h_
+#ifndef LLDB_TARGET_JITLOADER_H
+#define LLDB_TARGET_JITLOADER_H
#include <vector>
@@ -65,4 +65,4 @@
} // namespace lldb_private
-#endif // liblldb_JITLoader_h_
+#endif // LLDB_TARGET_JITLOADER_H
diff --git a/linux-x64/clang/include/lldb/Target/JITLoaderList.h b/linux-x64/clang/include/lldb/Target/JITLoaderList.h
index 4cc3a9e..f8d34d2 100644
--- a/linux-x64/clang/include/lldb/Target/JITLoaderList.h
+++ b/linux-x64/clang/include/lldb/Target/JITLoaderList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_JITLoaderList_h_
-#define liblldb_JITLoaderList_h_
+#ifndef LLDB_TARGET_JITLOADERLIST_H
+#define LLDB_TARGET_JITLOADERLIST_H
#include <mutex>
#include <vector>
@@ -45,4 +45,4 @@
} // namespace lldb_private
-#endif // liblldb_JITLoaderList_h_
+#endif // LLDB_TARGET_JITLOADERLIST_H
diff --git a/linux-x64/clang/include/lldb/Target/Language.h b/linux-x64/clang/include/lldb/Target/Language.h
index 6ea6029..6368828 100644
--- a/linux-x64/clang/include/lldb/Target/Language.h
+++ b/linux-x64/clang/include/lldb/Target/Language.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Language_h_
-#define liblldb_Language_h_
+#ifndef LLDB_TARGET_LANGUAGE_H
+#define LLDB_TARGET_LANGUAGE_H
#include <functional>
#include <memory>
@@ -20,6 +20,7 @@
#include "lldb/DataFormatters/DumpValueObjectOptions.h"
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
@@ -175,17 +176,10 @@
virtual HardcodedFormatters::HardcodedSyntheticFinder
GetHardcodedSynthetics();
- virtual HardcodedFormatters::HardcodedValidatorFinder
- GetHardcodedValidators();
-
virtual std::vector<ConstString>
GetPossibleFormattersMatches(ValueObject &valobj,
lldb::DynamicValueType use_dynamic);
- virtual lldb_private::formatters::StringPrinter::EscapingHelper
- GetStringPrinterEscapingHelper(
- lldb_private::formatters::StringPrinter::GetPrintableElementType);
-
virtual std::unique_ptr<TypeScavenger> GetTypeScavenger();
virtual const char *GetLanguageSpecificTypeLookupHelp();
@@ -217,6 +211,10 @@
// nil/null object, this method returns true
virtual bool IsNilReference(ValueObject &valobj);
+ /// Returns the summary string for ValueObjects for which IsNilReference() is
+ /// true.
+ virtual llvm::StringRef GetNilReferenceSummaryString() { return {}; }
+
// for a ValueObject of some "reference type", if the language provides a
// technique to decide whether the reference has ever been assigned to some
// object, this method will return true if such detection is possible, and if
@@ -266,12 +264,9 @@
static std::set<lldb::LanguageType> GetSupportedLanguages();
- static void GetLanguagesSupportingTypeSystems(
- std::set<lldb::LanguageType> &languages,
- std::set<lldb::LanguageType> &languages_for_expressions);
-
- static void
- GetLanguagesSupportingREPLs(std::set<lldb::LanguageType> &languages);
+ static LanguageSet GetLanguagesSupportingTypeSystems();
+ static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions();
+ static LanguageSet GetLanguagesSupportingREPLs();
protected:
// Classes that inherit from Language can see and modify these
@@ -279,9 +274,10 @@
Language();
private:
- DISALLOW_COPY_AND_ASSIGN(Language);
+ Language(const Language &) = delete;
+ const Language &operator=(const Language &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Language_h_
+#endif // LLDB_TARGET_LANGUAGE_H
diff --git a/linux-x64/clang/include/lldb/Target/LanguageRuntime.h b/linux-x64/clang/include/lldb/Target/LanguageRuntime.h
index 3521f46..a3897ad 100644
--- a/linux-x64/clang/include/lldb/Target/LanguageRuntime.h
+++ b/linux-x64/clang/include/lldb/Target/LanguageRuntime.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_LanguageRuntime_h_
-#define liblldb_LanguageRuntime_h_
+#ifndef LLDB_TARGET_LANGUAGERUNTIME_H
+#define LLDB_TARGET_LANGUAGERUNTIME_H
#include "lldb/Breakpoint/BreakpointResolver.h"
#include "lldb/Breakpoint/BreakpointResolverName.h"
@@ -18,11 +18,10 @@
#include "lldb/Expression/LLVMUserExpression.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/Runtime.h"
#include "lldb/lldb-private.h"
#include "lldb/lldb-public.h"
-#include "clang/Basic/TargetOptions.h"
-
namespace lldb_private {
class ExceptionSearchFilter : public SearchFilter {
@@ -53,15 +52,13 @@
LanguageRuntime *m_language_runtime;
lldb::SearchFilterSP m_filter_sp;
- lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
+ lldb::SearchFilterSP DoCreateCopy() override;
void UpdateModuleListIfNeeded();
};
-class LanguageRuntime : public PluginInterface {
+class LanguageRuntime : public Runtime, public PluginInterface {
public:
- ~LanguageRuntime() override;
-
static LanguageRuntime *FindPlugin(Process *process,
lldb::LanguageType language);
@@ -129,14 +126,11 @@
return lldb::ThreadSP();
}
- Process *GetProcess() { return m_process; }
-
- Target &GetTargetRef() { return m_process->GetTarget(); }
-
virtual DeclVendor *GetDeclVendor() { return nullptr; }
virtual lldb::BreakpointResolverSP
- CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
+ CreateExceptionResolver(const lldb::BreakpointSP &bkpt,
+ bool catch_bp, bool throw_bp) = 0;
virtual lldb::SearchFilterSP CreateExceptionSearchFilter() {
return m_process->GetTarget().GetSearchFilterForModule(nullptr);
@@ -154,17 +148,14 @@
/// Identify whether a name is a runtime value that should not be hidden by
/// from the user interface.
- virtual bool IsWhitelistedRuntimeValue(ConstString name) { return false; }
+ virtual bool IsAllowedRuntimeValue(ConstString name) { return false; }
- virtual void ModulesDidLoad(const ModuleList &module_list) {}
-
- // Called by the Clang expression evaluation engine to allow runtimes to
- // alter the set of target options provided to the compiler. If the options
- // prototype is modified, runtimes must return true, false otherwise.
- virtual bool GetOverrideExprOptions(clang::TargetOptions &prototype) {
- return false;
+ virtual llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) {
+ return llvm::None;
}
+ virtual void ModulesDidLoad(const ModuleList &module_list) override {}
+
// Called by ClangExpressionParser::PrepareForExecution to query for any
// custom LLVM IR passes that need to be run before an expression is
// assembled and run.
@@ -183,15 +174,9 @@
static char ID;
protected:
- // Classes that inherit from LanguageRuntime can see and modify these
-
LanguageRuntime(Process *process);
- Process *m_process;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(LanguageRuntime);
};
} // namespace lldb_private
-#endif // liblldb_LanguageRuntime_h_
+#endif // LLDB_TARGET_LANGUAGERUNTIME_H
diff --git a/linux-x64/clang/include/lldb/Target/Memory.h b/linux-x64/clang/include/lldb/Target/Memory.h
index e62b8ef..b3ad22a 100644
--- a/linux-x64/clang/include/lldb/Target/Memory.h
+++ b/linux-x64/clang/include/lldb/Target/Memory.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Memory_h_
-#define liblldb_Memory_h_
+#ifndef LLDB_TARGET_MEMORY_H
+#define LLDB_TARGET_MEMORY_H
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
@@ -45,7 +45,7 @@
protected:
typedef std::map<lldb::addr_t, lldb::DataBufferSP> BlockMap;
- typedef RangeArray<lldb::addr_t, lldb::addr_t, 4> InvalidRanges;
+ typedef RangeVector<lldb::addr_t, lldb::addr_t, 4> InvalidRanges;
typedef Range<lldb::addr_t, lldb::addr_t> AddrRange;
// Classes that inherit from MemoryCache can see and modify these
std::recursive_mutex m_mutex;
@@ -59,7 +59,8 @@
uint32_t m_L2_cache_line_byte_size;
private:
- DISALLOW_COPY_AND_ASSIGN(MemoryCache);
+ MemoryCache(const MemoryCache &) = delete;
+ const MemoryCache &operator=(const MemoryCache &) = delete;
};
@@ -135,9 +136,10 @@
PermissionsToBlockMap m_memory_map;
private:
- DISALLOW_COPY_AND_ASSIGN(AllocatedMemoryCache);
+ AllocatedMemoryCache(const AllocatedMemoryCache &) = delete;
+ const AllocatedMemoryCache &operator=(const AllocatedMemoryCache &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Memory_h_
+#endif // LLDB_TARGET_MEMORY_H
diff --git a/linux-x64/clang/include/lldb/Target/MemoryHistory.h b/linux-x64/clang/include/lldb/Target/MemoryHistory.h
index 501751c..db1e868 100644
--- a/linux-x64/clang/include/lldb/Target/MemoryHistory.h
+++ b/linux-x64/clang/include/lldb/Target/MemoryHistory.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_MemoryHistory_h_
-#define liblldb_MemoryHistory_h_
+#ifndef LLDB_TARGET_MEMORYHISTORY_H
+#define LLDB_TARGET_MEMORYHISTORY_H
#include <vector>
@@ -30,4 +30,4 @@
} // namespace lldb_private
-#endif // liblldb_MemoryHistory_h_
+#endif // LLDB_TARGET_MEMORYHISTORY_H
diff --git a/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h b/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h
index 5cab2ef..19c6c17 100644
--- a/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h
+++ b/linux-x64/clang/include/lldb/Target/MemoryRegionInfo.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_MemoryRegionInfo_h
-#define lldb_MemoryRegionInfo_h
+#ifndef LLDB_TARGET_MEMORYREGIONINFO_H
+#define LLDB_TARGET_MEMORYREGIONINFO_H
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/RangeMap.h"
@@ -21,17 +21,20 @@
enum OptionalBool { eDontKnow = -1, eNo = 0, eYes = 1 };
- MemoryRegionInfo()
- : m_range(), m_read(eDontKnow), m_write(eDontKnow), m_execute(eDontKnow),
- m_mapped(eDontKnow), m_flash(eDontKnow), m_blocksize(0) {}
-
- ~MemoryRegionInfo() {}
+ MemoryRegionInfo() = default;
+ MemoryRegionInfo(RangeType range, OptionalBool read, OptionalBool write,
+ OptionalBool execute, OptionalBool mapped, ConstString name,
+ OptionalBool flash, lldb::offset_t blocksize,
+ OptionalBool memory_tagged)
+ : m_range(range), m_read(read), m_write(write), m_execute(execute),
+ m_mapped(mapped), m_name(name), m_flash(flash), m_blocksize(blocksize),
+ m_memory_tagged(memory_tagged) {}
RangeType &GetRange() { return m_range; }
void Clear() {
m_range.Clear();
- m_read = m_write = m_execute = eDontKnow;
+ m_read = m_write = m_execute = m_memory_tagged = eDontKnow;
}
const RangeType &GetRange() const { return m_range; }
@@ -46,6 +49,8 @@
ConstString GetName() const { return m_name; }
+ OptionalBool GetMemoryTagged() const { return m_memory_tagged; }
+
void SetReadable(OptionalBool val) { m_read = val; }
void SetWritable(OptionalBool val) { m_write = val; }
@@ -64,6 +69,8 @@
void SetBlocksize(lldb::offset_t blocksize) { m_blocksize = blocksize; }
+ void SetMemoryTagged(OptionalBool val) { m_memory_tagged = val; }
+
// Get permissions as a uint32_t that is a mask of one or more bits from the
// lldb::Permissions
uint32_t GetLLDBPermissions() const {
@@ -88,20 +95,23 @@
bool operator==(const MemoryRegionInfo &rhs) const {
return m_range == rhs.m_range && m_read == rhs.m_read &&
m_write == rhs.m_write && m_execute == rhs.m_execute &&
- m_mapped == rhs.m_mapped;
+ m_mapped == rhs.m_mapped && m_name == rhs.m_name &&
+ m_flash == rhs.m_flash && m_blocksize == rhs.m_blocksize &&
+ m_memory_tagged == rhs.m_memory_tagged;
}
bool operator!=(const MemoryRegionInfo &rhs) const { return !(*this == rhs); }
protected:
RangeType m_range;
- OptionalBool m_read;
- OptionalBool m_write;
- OptionalBool m_execute;
- OptionalBool m_mapped;
+ OptionalBool m_read = eDontKnow;
+ OptionalBool m_write = eDontKnow;
+ OptionalBool m_execute = eDontKnow;
+ OptionalBool m_mapped = eDontKnow;
ConstString m_name;
- OptionalBool m_flash;
- lldb::offset_t m_blocksize;
+ OptionalBool m_flash = eDontKnow;
+ lldb::offset_t m_blocksize = 0;
+ OptionalBool m_memory_tagged = eDontKnow;
};
inline bool operator<(const MemoryRegionInfo &lhs,
@@ -117,6 +127,9 @@
return lhs < rhs.GetRange().GetRangeBase();
}
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+ const MemoryRegionInfo &Info);
+
// Forward-declarable wrapper.
class MemoryRegionInfos : public std::vector<lldb_private::MemoryRegionInfo> {
public:
@@ -127,22 +140,14 @@
namespace llvm {
template <>
+/// If Options is empty, prints a textual representation of the value. If
+/// Options is a single character, it uses that character for the "yes" value,
+/// while "no" is printed as "-", and "don't know" as "?". This can be used to
+/// print the permissions in the traditional "rwx" form.
struct format_provider<lldb_private::MemoryRegionInfo::OptionalBool> {
static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B,
- raw_ostream &OS, StringRef Options) {
- switch(B) {
- case lldb_private::MemoryRegionInfo::eNo:
- OS << "no";
- return;
- case lldb_private::MemoryRegionInfo::eYes:
- OS << "yes";
- return;
- case lldb_private::MemoryRegionInfo::eDontKnow:
- OS << "don't know";
- return;
- }
- }
+ raw_ostream &OS, StringRef Options);
};
}
-#endif // #ifndef lldb_MemoryRegionInfo_h
+#endif // LLDB_TARGET_MEMORYREGIONINFO_H
diff --git a/linux-x64/clang/include/lldb/Target/ModuleCache.h b/linux-x64/clang/include/lldb/Target/ModuleCache.h
index 1196169..9dc0e09 100644
--- a/linux-x64/clang/include/lldb/Target/ModuleCache.h
+++ b/linux-x64/clang/include/lldb/Target/ModuleCache.h
@@ -71,4 +71,4 @@
} // namespace lldb_private
-#endif // utility_ModuleCache_h_
+#endif // LLDB_TARGET_MODULECACHE_H
diff --git a/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h b/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h
deleted file mode 100644
index 1fc8744..0000000
--- a/linux-x64/clang/include/lldb/Target/ObjCLanguageRuntime.h
+++ /dev/null
@@ -1,427 +0,0 @@
-//===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ObjCLanguageRuntime_h_
-#define liblldb_ObjCLanguageRuntime_h_
-
-#include <functional>
-#include <map>
-#include <memory>
-#include <unordered_set>
-
-#include "llvm/Support/Casting.h"
-
-#include "lldb/Breakpoint/BreakpointPrecondition.h"
-#include "lldb/Core/PluginInterface.h"
-#include "lldb/Core/ThreadSafeDenseMap.h"
-#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/Type.h"
-#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/lldb-private.h"
-
-class CommandObjectObjC_ClassTable_Dump;
-
-namespace lldb_private {
-
-class UtilityFunction;
-
-class ObjCLanguageRuntime : public LanguageRuntime {
-public:
- enum class ObjCRuntimeVersions {
- eObjC_VersionUnknown = 0,
- eAppleObjC_V1 = 1,
- eAppleObjC_V2 = 2
- };
-
- typedef lldb::addr_t ObjCISA;
-
- class ClassDescriptor;
- typedef std::shared_ptr<ClassDescriptor> ClassDescriptorSP;
-
- // the information that we want to support retrieving from an ObjC class this
- // needs to be pure virtual since there are at least 2 different
- // implementations of the runtime, and more might come
- class ClassDescriptor {
- public:
- ClassDescriptor()
- : m_is_kvo(eLazyBoolCalculate), m_is_cf(eLazyBoolCalculate),
- m_type_wp() {}
-
- virtual ~ClassDescriptor() = default;
-
- virtual ConstString GetClassName() = 0;
-
- virtual ClassDescriptorSP GetSuperclass() = 0;
-
- virtual ClassDescriptorSP GetMetaclass() const = 0;
-
- // virtual if any implementation has some other version-specific rules but
- // for the known v1/v2 this is all that needs to be done
- virtual bool IsKVO() {
- if (m_is_kvo == eLazyBoolCalculate) {
- const char *class_name = GetClassName().AsCString();
- if (class_name && *class_name)
- m_is_kvo =
- (LazyBool)(strstr(class_name, "NSKVONotifying_") == class_name);
- }
- return (m_is_kvo == eLazyBoolYes);
- }
-
- // virtual if any implementation has some other version-specific rules but
- // for the known v1/v2 this is all that needs to be done
- virtual bool IsCFType() {
- if (m_is_cf == eLazyBoolCalculate) {
- const char *class_name = GetClassName().AsCString();
- if (class_name && *class_name)
- m_is_cf = (LazyBool)(strcmp(class_name, "__NSCFType") == 0 ||
- strcmp(class_name, "NSCFType") == 0);
- }
- return (m_is_cf == eLazyBoolYes);
- }
-
- virtual bool IsValid() = 0;
-
- virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
- uint64_t *value_bits = nullptr,
- uint64_t *payload = nullptr) = 0;
-
- virtual uint64_t GetInstanceSize() = 0;
-
- // use to implement version-specific additional constraints on pointers
- virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const {
- return true;
- }
-
- virtual ObjCISA GetISA() = 0;
-
- // This should return true iff the interface could be completed
- virtual bool
- Describe(std::function<void(ObjCISA)> const &superclass_func,
- std::function<bool(const char *, const char *)> const
- &instance_method_func,
- std::function<bool(const char *, const char *)> const
- &class_method_func,
- std::function<bool(const char *, const char *, lldb::addr_t,
- uint64_t)> const &ivar_func) const {
- return false;
- }
-
- lldb::TypeSP GetType() { return m_type_wp.lock(); }
-
- void SetType(const lldb::TypeSP &type_sp) { m_type_wp = type_sp; }
-
- struct iVarDescriptor {
- ConstString m_name;
- CompilerType m_type;
- uint64_t m_size;
- int32_t m_offset;
- };
-
- virtual size_t GetNumIVars() { return 0; }
-
- virtual iVarDescriptor GetIVarAtIndex(size_t idx) {
- return iVarDescriptor();
- }
-
- protected:
- bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size,
- bool allow_NULLs = false, bool allow_tagged = false,
- bool check_version_specific = false) const;
-
- private:
- LazyBool m_is_kvo;
- LazyBool m_is_cf;
- lldb::TypeWP m_type_wp;
- };
-
- class EncodingToType {
- public:
- virtual ~EncodingToType();
-
- virtual CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name,
- bool for_expression);
- virtual CompilerType RealizeType(const char *name, bool for_expression);
-
- virtual CompilerType RealizeType(clang::ASTContext &ast_ctx,
- const char *name, bool for_expression) = 0;
-
- protected:
- std::unique_ptr<ClangASTContext> m_scratch_ast_ctx_up;
- };
-
- class ObjCExceptionPrecondition : public BreakpointPrecondition {
- public:
- ObjCExceptionPrecondition();
-
- ~ObjCExceptionPrecondition() override = default;
-
- bool EvaluatePrecondition(StoppointCallbackContext &context) override;
- void GetDescription(Stream &stream, lldb::DescriptionLevel level) override;
- Status ConfigurePrecondition(Args &args) override;
-
- protected:
- void AddClassName(const char *class_name);
-
- private:
- std::unordered_set<std::string> m_class_names;
- };
-
- static lldb::BreakpointPreconditionSP
- GetBreakpointExceptionPrecondition(lldb::LanguageType language,
- bool throw_bp);
-
- class TaggedPointerVendor {
- public:
- virtual ~TaggedPointerVendor() = default;
-
- virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr) = 0;
-
- virtual ObjCLanguageRuntime::ClassDescriptorSP
- GetClassDescriptor(lldb::addr_t ptr) = 0;
-
- protected:
- TaggedPointerVendor() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
- };
-
- ~ObjCLanguageRuntime() override;
-
- static char ID;
-
- bool isA(const void *ClassID) const override {
- return ClassID == &ID || LanguageRuntime::isA(ClassID);
- }
-
- static bool classof(const LanguageRuntime *runtime) {
- return runtime->isA(&ID);
- }
-
- static ObjCLanguageRuntime *Get(Process &process) {
- return llvm::cast_or_null<ObjCLanguageRuntime>(
- process.GetLanguageRuntime(lldb::eLanguageTypeObjC));
- }
-
- virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; }
-
- typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
-
- virtual EncodingToTypeSP GetEncodingToType();
-
- virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value);
-
- ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value);
-
- virtual ClassDescriptorSP
- GetClassDescriptorFromClassName(ConstString class_name);
-
- virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa);
-
- ClassDescriptorSP GetNonKVOClassDescriptor(ObjCISA isa);
-
- lldb::LanguageType GetLanguageType() const override {
- return lldb::eLanguageTypeObjC;
- }
-
- virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
-
- virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) = 0;
-
- virtual bool HasReadObjCLibrary() = 0;
-
- lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
-
- void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
- lldb::addr_t impl_addr);
-
- TypeAndOrName LookupInClassNameCache(lldb::addr_t class_addr);
-
- void AddToClassNameCache(lldb::addr_t class_addr, const char *name,
- lldb::TypeSP type_sp);
-
- void AddToClassNameCache(lldb::addr_t class_addr,
- const TypeAndOrName &class_or_type_name);
-
- lldb::TypeSP LookupInCompleteClassCache(ConstString &name);
-
- virtual UtilityFunction *CreateObjectChecker(const char *) = 0;
-
- virtual ObjCRuntimeVersions GetRuntimeVersion() const {
- return ObjCRuntimeVersions::eObjC_VersionUnknown;
- }
-
- bool IsValidISA(ObjCISA isa) {
- UpdateISAToDescriptorMap();
- return m_isa_to_descriptor.count(isa) > 0;
- }
-
- virtual void UpdateISAToDescriptorMapIfNeeded() = 0;
-
- void UpdateISAToDescriptorMap() {
- if (m_process && m_process->GetStopID() != m_isa_to_descriptor_stop_id) {
- UpdateISAToDescriptorMapIfNeeded();
- }
- }
-
- virtual ObjCISA GetISA(ConstString name);
-
- virtual ConstString GetActualTypeName(ObjCISA isa);
-
- virtual ObjCISA GetParentClass(ObjCISA isa);
-
- // Finds the byte offset of the child_type ivar in parent_type. If it can't
- // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
-
- virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type,
- const char *ivar_name);
-
- bool HasNewLiteralsAndIndexing() {
- if (m_has_new_literals_and_indexing == eLazyBoolCalculate) {
- if (CalculateHasNewLiteralsAndIndexing())
- m_has_new_literals_and_indexing = eLazyBoolYes;
- else
- m_has_new_literals_and_indexing = eLazyBoolNo;
- }
-
- return (m_has_new_literals_and_indexing == eLazyBoolYes);
- }
-
- void SymbolsDidLoad(const ModuleList &module_list) override {
- m_negative_complete_class_cache.clear();
- }
-
- bool GetTypeBitSize(const CompilerType &compiler_type,
- uint64_t &size) override;
-
- /// Check whether the name is "self" or "_cmd" and should show up in
- /// "frame variable".
- bool IsWhitelistedRuntimeValue(ConstString name) override;
-
-protected:
- // Classes that inherit from ObjCLanguageRuntime can see and modify these
- ObjCLanguageRuntime(Process *process);
-
- virtual bool CalculateHasNewLiteralsAndIndexing() { return false; }
-
- bool ISAIsCached(ObjCISA isa) const {
- return m_isa_to_descriptor.find(isa) != m_isa_to_descriptor.end();
- }
-
- bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp) {
- if (isa != 0) {
- m_isa_to_descriptor[isa] = descriptor_sp;
- return true;
- }
- return false;
- }
-
- bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
- const char *class_name);
-
- bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp,
- uint32_t class_name_hash) {
- if (isa != 0) {
- m_isa_to_descriptor[isa] = descriptor_sp;
- m_hash_to_isa_map.insert(std::make_pair(class_name_hash, isa));
- return true;
- }
- return false;
- }
-
-private:
- // We keep a map of <Class,Selector>->Implementation so we don't have to call
- // the resolver function over and over.
-
- // FIXME: We need to watch for the loading of Protocols, and flush the cache
- // for any
- // class that we see so changed.
-
- struct ClassAndSel {
- ClassAndSel() {
- sel_addr = LLDB_INVALID_ADDRESS;
- class_addr = LLDB_INVALID_ADDRESS;
- }
-
- ClassAndSel(lldb::addr_t in_sel_addr, lldb::addr_t in_class_addr)
- : class_addr(in_class_addr), sel_addr(in_sel_addr) {}
-
- bool operator==(const ClassAndSel &rhs) {
- if (class_addr == rhs.class_addr && sel_addr == rhs.sel_addr)
- return true;
- else
- return false;
- }
-
- bool operator<(const ClassAndSel &rhs) const {
- if (class_addr < rhs.class_addr)
- return true;
- else if (class_addr > rhs.class_addr)
- return false;
- else {
- if (sel_addr < rhs.sel_addr)
- return true;
- else
- return false;
- }
- }
-
- lldb::addr_t class_addr;
- lldb::addr_t sel_addr;
- };
-
- typedef std::map<ClassAndSel, lldb::addr_t> MsgImplMap;
- typedef std::map<ObjCISA, ClassDescriptorSP> ISAToDescriptorMap;
- typedef std::multimap<uint32_t, ObjCISA> HashToISAMap;
- typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
- typedef HashToISAMap::iterator HashToISAIterator;
- typedef ThreadSafeDenseMap<void *, uint64_t> TypeSizeCache;
-
- MsgImplMap m_impl_cache;
- LazyBool m_has_new_literals_and_indexing;
- ISAToDescriptorMap m_isa_to_descriptor;
- HashToISAMap m_hash_to_isa_map;
- TypeSizeCache m_type_size_cache;
-
-protected:
- uint32_t m_isa_to_descriptor_stop_id;
-
- typedef std::map<ConstString, lldb::TypeWP> CompleteClassMap;
- CompleteClassMap m_complete_class_cache;
-
- struct ConstStringSetHelpers {
- size_t operator()(ConstString arg) const // for hashing
- {
- return (size_t)arg.GetCString();
- }
- bool operator()(ConstString arg1,
- ConstString arg2) const // for equality
- {
- return arg1.operator==(arg2);
- }
- };
- typedef std::unordered_set<ConstString, ConstStringSetHelpers,
- ConstStringSetHelpers>
- CompleteClassSet;
- CompleteClassSet m_negative_complete_class_cache;
-
- ISAToDescriptorIterator GetDescriptorIterator(ConstString name);
-
- friend class ::CommandObjectObjC_ClassTable_Dump;
-
- std::pair<ISAToDescriptorIterator, ISAToDescriptorIterator>
- GetDescriptorIteratorPair(bool update_if_needed = true);
-
- void ReadObjCLibraryIfNeeded(const ModuleList &module_list);
-
- DISALLOW_COPY_AND_ASSIGN(ObjCLanguageRuntime);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ObjCLanguageRuntime_h_
diff --git a/linux-x64/clang/include/lldb/Target/OperatingSystem.h b/linux-x64/clang/include/lldb/Target/OperatingSystem.h
index c75d1ca..ceeddce 100644
--- a/linux-x64/clang/include/lldb/Target/OperatingSystem.h
+++ b/linux-x64/clang/include/lldb/Target/OperatingSystem.h
@@ -7,9 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_OperatingSystem_h_
-#define liblldb_OperatingSystem_h_
-
+#ifndef LLDB_TARGET_OPERATINGSYSTEM_H
+#define LLDB_TARGET_OPERATINGSYSTEM_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/lldb-private.h"
@@ -41,11 +40,8 @@
/// should be used. If NULL, pick the best plug-in.
static OperatingSystem *FindPlugin(Process *process, const char *plugin_name);
- // Class Methods
OperatingSystem(Process *process);
- ~OperatingSystem() override;
-
// Plug-in Methods
virtual bool UpdateThreadList(ThreadList &old_thread_list,
ThreadList &real_thread_list,
@@ -69,10 +65,8 @@
// Member variables.
Process
*m_process; ///< The process that this dynamic loader plug-in is tracking.
-private:
- DISALLOW_COPY_AND_ASSIGN(OperatingSystem);
};
} // namespace lldb_private
-#endif // liblldb_OperatingSystem_h_
+#endif // LLDB_TARGET_OPERATINGSYSTEM_H
diff --git a/linux-x64/clang/include/lldb/Target/PathMappingList.h b/linux-x64/clang/include/lldb/Target/PathMappingList.h
index d175966..9e1e6eb 100644
--- a/linux-x64/clang/include/lldb/Target/PathMappingList.h
+++ b/linux-x64/clang/include/lldb/Target/PathMappingList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_PathMappingList_h_
-#define liblldb_PathMappingList_h_
+#ifndef LLDB_TARGET_PATHMAPPINGLIST_H
+#define LLDB_TARGET_PATHMAPPINGLIST_H
#include <map>
#include <vector>
@@ -125,4 +125,4 @@
} // namespace lldb_private
-#endif // liblldb_PathMappingList_h_
+#endif // LLDB_TARGET_PATHMAPPINGLIST_H
diff --git a/linux-x64/clang/include/lldb/Target/Platform.h b/linux-x64/clang/include/lldb/Target/Platform.h
index 3ba58c0..df46466 100644
--- a/linux-x64/clang/include/lldb/Target/Platform.h
+++ b/linux-x64/clang/include/lldb/Target/Platform.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Platform_h_
-#define liblldb_Platform_h_
+#ifndef LLDB_TARGET_PLATFORM_H
+#define LLDB_TARGET_PLATFORM_H
#include <functional>
#include <map>
@@ -18,10 +18,12 @@
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Host/File.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/Timeout.h"
#include "lldb/Utility/UserIDResolver.h"
#include "lldb/lldb-private-forward.h"
@@ -31,8 +33,8 @@
namespace lldb_private {
class ProcessInstanceInfo;
-class ProcessInstanceInfoList;
class ProcessInstanceInfoMatch;
+typedef std::vector<ProcessInstanceInfo> ProcessInstanceInfoList;
class ModuleCache;
enum MmapFlags { eMmapFlagsPrivate = 1, eMmapFlagsAnon = 2 };
@@ -48,6 +50,9 @@
FileSpec GetModuleCacheDirectory() const;
bool SetModuleCacheDirectory(const FileSpec &dir_spec);
+
+private:
+ void SetDefaultModuleCacheDirectory(const FileSpec &dir_spec);
};
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
@@ -257,19 +262,6 @@
virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir);
- /// Retrieve the system include directories on this platform for the
- /// given language.
- ///
- /// \param[in] lang
- /// The language for which the include directories should be queried.
- ///
- /// \param[out] directories
- /// The include directories for this system.
- virtual std::vector<std::string>
- GetSystemIncludeDirectories(lldb::LanguageType lang) {
- return {};
- }
-
virtual UserIDResolver &GetUserIDResolver() = 0;
/// Locate a file for a platform.
@@ -309,11 +301,10 @@
LocateExecutableScriptingResources(Target *target, Module &module,
Stream *feedback_stream);
- virtual Status GetSharedModule(const ModuleSpec &module_spec,
- Process *process, lldb::ModuleSP &module_sp,
- const FileSpecList *module_search_paths_ptr,
- lldb::ModuleSP *old_module_sp_ptr,
- bool *did_create_ptr);
+ virtual Status GetSharedModule(
+ const ModuleSpec &module_spec, Process *process,
+ lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr,
+ llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);
virtual bool GetModuleSpec(const FileSpec &module_file_spec,
const ArchSpec &arch, ModuleSpec &module_spec);
@@ -380,9 +371,13 @@
virtual lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
llvm::StringRef plugin_name,
- lldb_private::Debugger &debugger,
- lldb_private::Target *target,
- lldb_private::Status &error);
+ Debugger &debugger, Target *target,
+ Status &error);
+
+ virtual lldb::ProcessSP
+ ConnectProcessSynchronous(llvm::StringRef connect_url,
+ llvm::StringRef plugin_name, Debugger &debugger,
+ Stream &stream, Target *target, Status &error);
/// Attach to an existing process using a process ID.
///
@@ -392,9 +387,6 @@
/// attached to the process, or an empty shared pointer with an appropriate
/// error.
///
- /// \param[in] pid
- /// The process ID that we should attempt to attach to.
- ///
/// \return
/// An appropriate ProcessSP containing a valid shared pointer
/// to the default Process subclass for the platform that is
@@ -518,8 +510,9 @@
virtual Status SetFilePermissions(const FileSpec &file_spec,
uint32_t file_permissions);
- virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
- uint32_t mode, Status &error) {
+ virtual lldb::user_id_t OpenFile(const FileSpec &file_spec,
+ File::OpenOptions flags, uint32_t mode,
+ Status &error) {
return UINT64_MAX;
}
@@ -529,6 +522,9 @@
return UINT64_MAX;
}
+ virtual void AutoCompleteDiskFileOrDirectory(CompletionRequest &request,
+ bool only_dir) {}
+
virtual uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
uint64_t dst_len, Status &error) {
error.SetErrorStringWithFormat(
@@ -624,7 +620,18 @@
}
virtual lldb_private::Status RunShellCommand(
- const char *command, // Shouldn't be nullptr
+ llvm::StringRef command,
+ const FileSpec &working_dir, // Pass empty FileSpec to use the current
+ // working directory
+ int *status_ptr, // Pass nullptr if you don't want the process exit status
+ int *signo_ptr, // Pass nullptr if you don't want the signal that caused
+ // the process to exit
+ std::string
+ *command_output, // Pass nullptr if you don't want the command output
+ const Timeout<std::micro> &timeout);
+
+ virtual lldb_private::Status RunShellCommand(
+ llvm::StringRef shell, llvm::StringRef command,
const FileSpec &working_dir, // Pass empty FileSpec to use the current
// working directory
int *status_ptr, // Pass nullptr if you don't want the process exit status
@@ -643,7 +650,7 @@
virtual bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
uint64_t &high);
- virtual int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) {
+ virtual uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) {
return 1;
}
@@ -788,7 +795,7 @@
/// given an install name and a set (e.g. DYLD_LIBRARY_PATH provided) of
/// alternate paths.
///
- /// \param[in] path_list
+ /// \param[in] paths
/// The list of paths to use to search for the library. First
/// match wins.
///
@@ -799,7 +806,7 @@
/// \param[out] loaded_path
/// If non-null, the path to the dylib that was successfully loaded
/// is stored in this path.
- ///
+ ///
/// \return
/// A token that represents the shared library which can be
/// passed to UnloadImage. A value of
@@ -837,7 +844,33 @@
virtual size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
lldb_private::Status &error);
+ /// Gather all of crash informations into a structured data dictionary.
+ ///
+ /// If the platform have a crashed process with crash information entries,
+ /// gather all the entries into an structured data dictionary or return a
+ /// nullptr. This dictionary is generic and extensible, as it contains an
+ /// array for each different type of crash information.
+ ///
+ /// \param[in] process
+ /// The crashed process.
+ ///
+ /// \return
+ /// A structured data dictionary containing at each entry, the crash
+ /// information type as the entry key and the matching an array as the
+ /// entry value. \b nullptr if not implemented or if the process has no
+ /// crash information entry. \b error if an error occured.
+ virtual llvm::Expected<StructuredData::DictionarySP>
+ FetchExtendedCrashInformation(lldb_private::Process &process) {
+ return nullptr;
+ }
+
protected:
+ /// Private implementation of connecting to a process. If the stream is set
+ /// we connect synchronously.
+ lldb::ProcessSP DoConnectProcess(llvm::StringRef connect_url,
+ llvm::StringRef plugin_name,
+ Debugger &debugger, Stream *stream,
+ Target *target, Status &error);
bool m_is_host;
// Set to true when we are able to actually set the OS version while being
// connected. For remote platforms, we might set the version ahead of time
@@ -917,8 +950,6 @@
Platform &remote_platform);
FileSpec GetModuleCacheRoot();
-
- DISALLOW_COPY_AND_ASSIGN(Platform);
};
class PlatformList {
@@ -985,7 +1016,8 @@
lldb::PlatformSP m_selected_platform_sp;
private:
- DISALLOW_COPY_AND_ASSIGN(PlatformList);
+ PlatformList(const PlatformList &) = delete;
+ const PlatformList &operator=(const PlatformList &) = delete;
};
class OptionGroupPlatformRSync : public lldb_private::OptionGroup {
@@ -1010,7 +1042,9 @@
bool m_ignores_remote_hostname;
private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformRSync);
+ OptionGroupPlatformRSync(const OptionGroupPlatformRSync &) = delete;
+ const OptionGroupPlatformRSync &
+ operator=(const OptionGroupPlatformRSync &) = delete;
};
class OptionGroupPlatformSSH : public lldb_private::OptionGroup {
@@ -1033,7 +1067,9 @@
std::string m_ssh_opts;
private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformSSH);
+ OptionGroupPlatformSSH(const OptionGroupPlatformSSH &) = delete;
+ const OptionGroupPlatformSSH &
+ operator=(const OptionGroupPlatformSSH &) = delete;
};
class OptionGroupPlatformCaching : public lldb_private::OptionGroup {
@@ -1055,9 +1091,11 @@
std::string m_cache_dir;
private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformCaching);
+ OptionGroupPlatformCaching(const OptionGroupPlatformCaching &) = delete;
+ const OptionGroupPlatformCaching &
+ operator=(const OptionGroupPlatformCaching &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Platform_h_
+#endif // LLDB_TARGET_PLATFORM_H
diff --git a/linux-x64/clang/include/lldb/Target/PostMortemProcess.h b/linux-x64/clang/include/lldb/Target/PostMortemProcess.h
new file mode 100644
index 0000000..353bfc0
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/PostMortemProcess.h
@@ -0,0 +1,32 @@
+//===-- PostMortemProcess.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_POSTMORTEMPROCESS_H
+#define LLDB_TARGET_POSTMORTEMPROCESS_H
+
+#include "lldb/Target/Process.h"
+
+namespace lldb_private {
+
+/// \class PostMortemProcess
+/// Base class for all processes that don't represent a live process, such as
+/// coredumps or processes traced in the past.
+///
+/// \a lldb_private::Process virtual functions overrides that are common
+/// between these kinds of processes can have default implementations in this
+/// class.
+class PostMortemProcess : public Process {
+public:
+ using Process::Process;
+
+ bool IsLiveDebugSession() const override { return false; }
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_POSTMORTEMPROCESS_H
diff --git a/linux-x64/clang/include/lldb/Target/Process.h b/linux-x64/clang/include/lldb/Target/Process.h
index f85069e..6f30787 100644
--- a/linux-x64/clang/include/lldb/Target/Process.h
+++ b/linux-x64/clang/include/lldb/Target/Process.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Process_h_
-#define liblldb_Process_h_
+#ifndef LLDB_TARGET_PROCESS_H
+#define LLDB_TARGET_PROCESS_H
#include "lldb/Host/Config.h"
@@ -37,6 +37,8 @@
#include "lldb/Target/Memory.h"
#include "lldb/Target/QueueList.h"
#include "lldb/Target/ThreadList.h"
+#include "lldb/Target/ThreadPlanStack.h"
+#include "lldb/Target/Trace.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Broadcaster.h"
#include "lldb/Utility/Event.h"
@@ -46,17 +48,23 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/TraceOptions.h"
+#include "lldb/Utility/UnimplementedError.h"
#include "lldb/Utility/UserIDResolver.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Threading.h"
#include "llvm/Support/VersionTuple.h"
namespace lldb_private {
template <typename B, typename S> struct Range;
-// ProcessProperties
+class ProcessExperimentalProperties : public Properties {
+public:
+ ProcessExperimentalProperties();
+};
+
class ProcessProperties : public Properties {
public:
// Pass nullptr for "process" if the ProcessProperties are to be the global
@@ -80,14 +88,16 @@
bool GetDetachKeepsStopped() const;
void SetDetachKeepsStopped(bool keep_stopped);
bool GetWarningsOptimization() const;
+ bool GetWarningsUnsupportedLanguage() const;
bool GetStopOnExec() const;
std::chrono::seconds GetUtilityExpressionTimeout() const;
+ bool GetOSPluginReportsAllThreads() const;
+ void SetOSPluginReportsAllThreads(bool does_report);
+ bool GetSteppingRunsAllThreads() const;
protected:
- static void OptionValueChangedCallback(void *baton,
- OptionValue *option_value);
-
Process *m_process; // Can be nullptr for global ProcessProperties
+ std::unique_ptr<ProcessExperimentalProperties> m_experimental_properties_up;
};
typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
@@ -141,7 +151,9 @@
return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
}
- void SetProcessPluginName(llvm::StringRef plugin) { m_plugin_name = plugin; }
+ void SetProcessPluginName(llvm::StringRef plugin) {
+ m_plugin_name = std::string(plugin);
+ }
void Clear() {
ProcessInstanceInfo::Clear();
@@ -317,7 +329,7 @@
}
void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) {
- m_last_natural_stop_event = event_sp;
+ m_last_natural_stop_event = std::move(event_sp);
}
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
@@ -352,7 +364,6 @@
/// A plug-in interface definition class for debugging a process.
class Process : public std::enable_shared_from_this<Process>,
public ProcessProperties,
- public UserID,
public Broadcaster,
public ExecutionContextScope,
public PluginInterface {
@@ -382,7 +393,7 @@
};
/// Process warning types.
- enum Warnings { eWarningsOptimization = 1 };
+ enum Warnings { eWarningsOptimization = 1, eWarningsUnsupportedLanguage = 2 };
typedef Range<lldb::addr_t, lldb::addr_t> LoadRange;
// We use a read/write lock to allow on or more clients to access the process
@@ -443,6 +454,8 @@
void Dump(Stream *s) const override;
+ virtual bool ShouldStop(Event *event_ptr, bool &found_valid_stopinfo);
+
void DoOnRemoval(Event *event_ptr) override;
static const Process::ProcessEventData *
@@ -488,7 +501,8 @@
int m_update_state;
bool m_interrupted;
- DISALLOW_COPY_AND_ASSIGN(ProcessEventData);
+ ProcessEventData(const ProcessEventData &) = delete;
+ const ProcessEventData &operator=(const ProcessEventData &) = delete;
};
/// Construct with a shared pointer to a target, and the Process listener.
@@ -519,19 +533,12 @@
/// Process plug-in interface and returns the first instance that can debug
/// the file.
///
- /// \param[in] module_sp
- /// The module shared pointer that this process will debug.
- ///
- /// \param[in] plugin_name
- /// If nullptr, select the best plug-in for the binary. If non-nullptr
- /// then look for a plugin whose PluginInfo's name matches
- /// this string.
- ///
/// \see Process::CanDebug ()
static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp,
llvm::StringRef plugin_name,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path,
+ bool can_connect);
/// Static function that can be used with the \b host function
/// Host::StartMonitoringChildProcess ().
@@ -553,6 +560,15 @@
uint32_t GetAddressByteSize() const;
+ /// Sets the stored pid.
+ ///
+ /// This does not change the pid of underlying process.
+ lldb::pid_t GetID() const { return m_pid; }
+
+ /// Returns the pid of the process or LLDB_INVALID_PROCESS_ID if there is
+ /// no known pid.
+ void SetID(lldb::pid_t new_pid) { m_pid = new_pid; }
+
uint32_t GetUniqueID() const { return m_process_unique_id; }
/// Check if a plug-in instance can debug the file in \a module.
@@ -578,7 +594,7 @@
/// \return
/// Returns \b true if this Process has not been finalized
/// and \b false otherwise.
- bool IsValid() const { return !m_finalize_called; }
+ bool IsValid() const { return !m_finalizing; }
/// Return a multi-word command object that can be used to expose plug-in
/// specific commands.
@@ -680,10 +696,19 @@
/// shared library load state.
///
/// \return
- /// The number of shared libraries that were loaded
- virtual size_t LoadModules() { return 0; }
+ /// A status object indicating if the operation was sucessful or not.
+ virtual llvm::Error LoadModules() {
+ return llvm::make_error<llvm::StringError>("Not implemented.",
+ llvm::inconvertibleErrorCode());
+ }
- virtual size_t LoadModules(LoadedModuleInfoList &) { return 0; }
+ /// Query remote GDBServer for a detailed loaded library list
+ /// \return
+ /// The list of modules currently loaded by the process, or an error.
+ virtual llvm::Expected<LoadedModuleInfoList> GetLoadedModuleList() {
+ return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Not implemented");
+ }
protected:
virtual JITLoaderList &GetJITLoaders();
@@ -704,8 +729,8 @@
/// char *) will be called to actually do the attach. If DoAttach returns \b
/// true, then Process::DidAttach() will be called.
///
- /// \param[in] pid
- /// The process ID that we should attempt to attach to.
+ /// \param[in] attach_info
+ /// The process attach info.
///
/// \return
/// Returns \a pid if attaching was successful, or
@@ -714,22 +739,23 @@
/// Attach to a remote system via a URL
///
- /// \param[in] strm
- /// A stream where output intended for the user
- /// (if the driver has a way to display that) generated during
- /// the connection. This may be nullptr if no output is needed.A
- ///
/// \param[in] remote_url
/// The URL format that we are connecting to.
///
/// \return
/// Returns an error object.
- virtual Status ConnectRemote(Stream *strm, llvm::StringRef remote_url);
+ virtual Status ConnectRemote(llvm::StringRef remote_url);
bool GetShouldDetach() const { return m_should_detach; }
void SetShouldDetach(bool b) { m_should_detach = b; }
+ /// Get the image vector for the current process.
+ ///
+ /// \return
+ /// The constant reference to the member m_image_tokens.
+ const std::vector<lldb::addr_t>& GetImageTokens() { return m_image_tokens; }
+
/// Get the image information address for the current process.
///
/// Some runtimes have system functions that can help dynamic loaders locate
@@ -902,17 +928,12 @@
/// Attach to a remote system via a URL
///
- /// \param[in] strm
- /// A stream where output intended for the user
- /// (if the driver has a way to display that) generated during
- /// the connection. This may be nullptr if no output is needed.A
- ///
/// \param[in] remote_url
/// The URL format that we are connecting to.
///
/// \return
/// Returns an error object.
- virtual Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) {
+ virtual Status DoConnectRemote(llvm::StringRef remote_url) {
Status error;
error.SetErrorString("remote connections are not supported");
return error;
@@ -1186,6 +1207,9 @@
/// VersionTuple is returner.
virtual llvm::VersionTuple GetHostOSVersion() { return llvm::VersionTuple(); }
+ /// \return the macCatalyst version of the host OS.
+ virtual llvm::VersionTuple GetHostMacCatalystVersion() { return {}; }
+
/// Get the target object pointer for this module.
///
/// \return
@@ -1263,7 +1287,7 @@
/// LLDB_INVALID_ADDRESS.
///
/// \return
- /// A StructureDataSP object which, if non-empty, will contain the
+ /// A StructuredDataSP object which, if non-empty, will contain the
/// information the DynamicLoader needs to get the initial scan of
/// solibs resolved.
virtual lldb_private::StructuredData::ObjectSP
@@ -1307,9 +1331,14 @@
/// pre-computed.
void PrintWarningOptimization(const SymbolContext &sc);
+ /// Print a user-visible warning about a function written in a
+ /// language that this version of LLDB doesn't support.
+ ///
+ /// \see PrintWarningOptimization
+ void PrintWarningUnsupportedLanguage(const SymbolContext &sc);
+
virtual bool GetProcessInfo(ProcessInstanceInfo &info);
-public:
/// Get the exit status for a process.
///
/// \return
@@ -1372,6 +1401,8 @@
/// otherwise.
virtual bool IsAlive();
+ virtual bool IsLiveDebugSession() const { return true; };
+
/// Before lldb detaches from a process, it warns the user that they are
/// about to lose their debug session. In some cases, this warning doesn't
/// need to be emitted -- for instance, with core file debugging where the
@@ -1379,38 +1410,10 @@
/// the core file.
///
/// \return
- // true if the user should be warned about detaching from this process.
+ /// Returns \b true if the user should be warned about detaching from
+ /// this process.
virtual bool WarnBeforeDetach() const { return true; }
- /// Actually do the reading of memory from a process.
- ///
- /// Subclasses must override this function and can return fewer bytes than
- /// requested when memory requests are too large. This class will break up
- /// the memory requests and keep advancing the arguments along as needed.
- ///
- /// \param[in] vm_addr
- /// A virtual load address that indicates where to start reading
- /// memory from.
- ///
- /// \param[in] size
- /// The number of bytes to read.
- ///
- /// \param[out] buf
- /// A byte buffer that is at least \a size bytes long that
- /// will receive the memory bytes.
- ///
- /// \param[out] error
- /// An error that indicates the success or failure of this
- /// operation. If error indicates success (error.Success()),
- /// then the value returned can be trusted, otherwise zero
- /// will be returned.
- ///
- /// \return
- /// The number of bytes that were actually read into \a buf.
- /// Zero is returned in the case of an error.
- virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
- Status &error) = 0;
-
/// Read of memory from a process.
///
/// This function will read memory from the current process's address space
@@ -1709,8 +1712,9 @@
/// lldb,
/// just not by the process itself.
///
- /// \param[in/out] error
+ /// \param[in,out] error
/// An error object to fill in if things go wrong.
+ ///
/// \return
/// The address of the allocated buffer in the process, or
/// LLDB_INVALID_ADDRESS if the allocation failed.
@@ -2140,7 +2144,7 @@
public:
ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
: m_process(process) {
- m_process.HijackProcessEvents(listener_sp);
+ m_process.HijackProcessEvents(std::move(listener_sp));
}
~ProcessEventHijacker() { m_process.RestoreProcessEvents(); }
@@ -2158,7 +2162,7 @@
/// WaitFor* calls above. Be sure to call RestoreProcessEvents when you are
/// done.
///
- /// \param[in] listener
+ /// \param[in] listener_sp
/// This is the new listener to whom all process events will be delivered.
///
/// \return
@@ -2178,11 +2182,9 @@
OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
- std::vector<LanguageRuntime *>
- GetLanguageRuntimes(bool retry_if_null = true);
+ std::vector<LanguageRuntime *> GetLanguageRuntimes();
- LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
- bool retry_if_null = true);
+ LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language);
bool IsPossibleDynamicValue(ValueObject &in_value);
@@ -2194,6 +2196,75 @@
void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers);
+/// Prune ThreadPlanStacks for unreported threads.
+///
+/// \param[in] tid
+/// The tid whose Plan Stack we are seeking to prune.
+///
+/// \return
+/// \b true if the TID is found or \b false if not.
+bool PruneThreadPlansForTID(lldb::tid_t tid);
+
+/// Prune ThreadPlanStacks for all unreported threads.
+void PruneThreadPlans();
+
+ /// Find the thread plan stack associated with thread with \a tid.
+ ///
+ /// \param[in] tid
+ /// The tid whose Plan Stack we are seeking.
+ ///
+ /// \return
+ /// Returns a ThreadPlan if the TID is found or nullptr if not.
+ ThreadPlanStack *FindThreadPlans(lldb::tid_t tid);
+
+ /// Dump the thread plans associated with thread with \a tid.
+ ///
+ /// \param[in,out] strm
+ /// The stream to which to dump the output
+ ///
+ /// \param[in] tid
+ /// The tid whose Plan Stack we are dumping
+ ///
+ /// \param[in] desc_level
+ /// How much detail to dump
+ ///
+ /// \param[in] internal
+ /// If \b true dump all plans, if false only user initiated plans
+ ///
+ /// \param[in] condense_trivial
+ /// If true, only dump a header if the plan stack is just the base plan.
+ ///
+ /// \param[in] skip_unreported_plans
+ /// If true, only dump a plan if it is currently backed by an
+ /// lldb_private::Thread *.
+ ///
+ /// \return
+ /// Returns \b true if TID was found, \b false otherwise
+ bool DumpThreadPlansForTID(Stream &strm, lldb::tid_t tid,
+ lldb::DescriptionLevel desc_level, bool internal,
+ bool condense_trivial, bool skip_unreported_plans);
+
+ /// Dump all the thread plans for this process.
+ ///
+ /// \param[in,out] strm
+ /// The stream to which to dump the output
+ ///
+ /// \param[in] desc_level
+ /// How much detail to dump
+ ///
+ /// \param[in] internal
+ /// If \b true dump all plans, if false only user initiated plans
+ ///
+ /// \param[in] condense_trivial
+ /// If true, only dump a header if the plan stack is just the base plan.
+ ///
+ /// \param[in] skip_unreported_plans
+ /// If true, skip printing all thread plan stacks that don't currently
+ /// have a backing lldb_private::Thread *.
+ void DumpThreadPlans(Stream &strm, lldb::DescriptionLevel desc_level,
+ bool internal, bool condense_trivial,
+ bool skip_unreported_plans);
+
/// Call this to set the lldb in the mode where it breaks on new thread
/// creations, and then auto-restarts. This is useful when you are trying
/// to run only one thread, but either that thread or the kernel is creating
@@ -2260,6 +2331,8 @@
ProcessRunLock &GetRunLock();
+ bool CurrentThreadIsPrivateStateThread();
+
virtual Status SendEventData(const char *data) {
Status return_error("Sending an event is not supported for this process.");
return return_error;
@@ -2357,7 +2430,7 @@
/// The StructuredData type name as previously discovered by
/// the Process-derived instance.
///
- /// \param[in] config
+ /// \param[in] config_sp
/// Configuration data for the feature being enabled. This config
/// data, which may be null, will be passed along to the feature
/// to process. The feature will dictate whether this is a dictionary,
@@ -2453,7 +2526,50 @@
return Status("Not implemented");
}
+ /// Get the processor tracing type supported for this process.
+ /// Responses might be different depending on the architecture and
+ /// capabilities of the underlying OS.
+ ///
+ /// \return
+ /// The supported trace type or an \a llvm::Error if tracing is
+ /// not supported for the inferior.
+ virtual llvm::Expected<TraceTypeInfo> GetSupportedTraceType();
+
+ // This calls a function of the form "void * (*)(void)".
+ bool CallVoidArgVoidPtrReturn(const Address *address,
+ lldb::addr_t &returned_func,
+ bool trap_exceptions = false);
+
protected:
+ /// Actually do the reading of memory from a process.
+ ///
+ /// Subclasses must override this function and can return fewer bytes than
+ /// requested when memory requests are too large. This class will break up
+ /// the memory requests and keep advancing the arguments along as needed.
+ ///
+ /// \param[in] vm_addr
+ /// A virtual load address that indicates where to start reading
+ /// memory from.
+ ///
+ /// \param[in] size
+ /// The number of bytes to read.
+ ///
+ /// \param[out] buf
+ /// A byte buffer that is at least \a size bytes long that
+ /// will receive the memory bytes.
+ ///
+ /// \param[out] error
+ /// An error that indicates the success or failure of this
+ /// operation. If error indicates success (error.Success()),
+ /// then the value returned can be trusted, otherwise zero
+ /// will be returned.
+ ///
+ /// \return
+ /// The number of bytes that were actually read into \a buf.
+ /// Zero is returned in the case of an error.
+ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+ Status &error) = 0;
+
void SetState(lldb::EventSP &event_sp);
lldb::StateType GetPrivateState();
@@ -2623,6 +2739,7 @@
// Member variables
std::weak_ptr<Target> m_target_wp; ///< The target that owns this process.
+ lldb::pid_t m_pid = LLDB_INVALID_PROCESS_ID;
ThreadSafeValue<lldb::StateType> m_public_state;
ThreadSafeValue<lldb::StateType>
m_private_state; // The actual state of our process
@@ -2656,6 +2773,10 @@
///see them. This is usually the same as
///< m_thread_list_real, but might be different if there is an OS plug-in
///creating memory threads
+ ThreadPlanStackMap m_thread_plans; ///< This is the list of thread plans for
+ /// threads in m_thread_list, as well as
+ /// threads we knew existed, but haven't
+ /// determined that they have died yet.
ThreadList m_extended_thread_list; ///< Owner for extended threads that may be
///generated, cleared on natural stops
uint32_t m_extended_thread_stop_id; ///< The natural stop id when
@@ -2710,10 +2831,11 @@
// m_currently_handling_do_on_removals are true,
// Resume will only request a resume, using this
// flag to check.
- bool m_finalizing; // This is set at the beginning of Process::Finalize() to
- // stop functions from looking up or creating things
- // during a finalize call
- bool m_finalize_called; // This is set at the end of Process::Finalize()
+
+ /// This is set at the beginning of Process::Finalize() to stop functions
+ /// from looking up or creating things during or after a finalize call.
+ std::atomic<bool> m_finalizing;
+
bool m_clear_thread_plans_on_stop;
bool m_force_next_event_delivery;
lldb::StateType m_last_broadcast_state; /// This helps with the Public event
@@ -2730,9 +2852,9 @@
StructuredDataPluginMap m_structured_data_plugin_map;
enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit;
-
+
std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up;
- std::once_flag m_dlopen_utility_func_flag_once;
+ llvm::once_flag m_dlopen_utility_func_flag_once;
size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size,
uint8_t *buf) const;
@@ -2817,6 +2939,8 @@
void LoadOperatingSystemPlugin(bool flush);
private:
+ Status DestroyImpl(bool force_kill);
+
/// This is the part of the event handling that for a process event. It
/// decides what to do with the event and returns true if the event needs to
/// be propagated to the user, and false otherwise. If the event is not
@@ -2834,10 +2958,11 @@
void ControlPrivateStateThread(uint32_t signal);
- DISALLOW_COPY_AND_ASSIGN(Process);
+ Process(const Process &) = delete;
+ const Process &operator=(const Process &) = delete;
};
-/// RAII guard that should be aquired when an utility function is called within
+/// RAII guard that should be acquired when an utility function is called within
/// a given process.
class UtilityFunctionScope {
Process *m_process;
@@ -2855,4 +2980,4 @@
} // namespace lldb_private
-#endif // liblldb_Process_h_
+#endif // LLDB_TARGET_PROCESS_H
diff --git a/linux-x64/clang/include/lldb/Target/ProcessStructReader.h b/linux-x64/clang/include/lldb/Target/ProcessStructReader.h
index ade29c0..0a91bef 100644
--- a/linux-x64/clang/include/lldb/Target/ProcessStructReader.h
+++ b/linux-x64/clang/include/lldb/Target/ProcessStructReader.h
@@ -101,4 +101,4 @@
};
}
-#endif // utility_ProcessStructReader_h_
+#endif // LLDB_TARGET_PROCESSSTRUCTREADER_H
diff --git a/linux-x64/clang/include/lldb/Target/ProcessTrace.h b/linux-x64/clang/include/lldb/Target/ProcessTrace.h
new file mode 100644
index 0000000..53b3e70
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ProcessTrace.h
@@ -0,0 +1,86 @@
+//===-- ProcessTrace.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_PROCESSTRACE_H
+#define LLDB_TARGET_PROCESSTRACE_H
+
+#include "lldb/Target/PostMortemProcess.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Status.h"
+
+namespace lldb_private {
+
+class ProcessTrace : public PostMortemProcess {
+public:
+ static void Initialize();
+
+ static void Terminate();
+
+ static ConstString GetPluginNameStatic();
+
+ static const char *GetPluginDescriptionStatic();
+
+ ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
+
+ ~ProcessTrace() override;
+
+ bool CanDebug(lldb::TargetSP target_sp,
+ bool plugin_specified_by_name) override;
+
+ void DidAttach(ArchSpec &process_arch) override;
+
+ DynamicLoader *GetDynamicLoader() override { return nullptr; }
+
+ SystemRuntime *GetSystemRuntime() override { return nullptr; }
+
+ ConstString GetPluginName() override;
+
+ uint32_t GetPluginVersion() override;
+
+ Status DoDestroy() override;
+
+ void RefreshStateAfterStop() override;
+
+ Status WillResume() override {
+ Status error;
+ error.SetErrorStringWithFormat(
+ "error: %s does not support resuming processes",
+ GetPluginName().GetCString());
+ return error;
+ }
+
+ bool IsAlive() override;
+
+ bool WarnBeforeDetach() const override { return false; }
+
+ size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
+ Status &error) override;
+
+ size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
+ Status &error) override;
+
+ ArchSpec GetArchitecture();
+
+ bool GetProcessInfo(ProcessInstanceInfo &info) override;
+
+protected:
+ void Clear();
+
+ bool UpdateThreadList(ThreadList &old_thread_list,
+ ThreadList &new_thread_list) override;
+
+private:
+ static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
+ lldb::ListenerSP listener_sp,
+ const FileSpec *crash_file_path,
+ bool can_connect);
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_PROCESSTRACE_H
diff --git a/linux-x64/clang/include/lldb/Target/Queue.h b/linux-x64/clang/include/lldb/Target/Queue.h
index 01e8994..058d46a 100644
--- a/linux-x64/clang/include/lldb/Target/Queue.h
+++ b/linux-x64/clang/include/lldb/Target/Queue.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Queue_h_
-#define liblldb_Queue_h_
+#ifndef LLDB_TARGET_QUEUE_H
+#define LLDB_TARGET_QUEUE_H
#include <string>
#include <vector>
@@ -126,10 +126,7 @@
m_pending_items.push_back(item);
}
- /// Return the kind (serial, concurrent) of this queue
- ///
- /// \return
- // Whether this is a serial or a concurrent queue
+ /// Return the kind (serial, concurrent) of this queue.
lldb::QueueKind GetKind();
void SetKind(lldb::QueueKind kind);
@@ -147,9 +144,10 @@
// dispatch_queue_t for this Queue
lldb::QueueKind m_kind;
- DISALLOW_COPY_AND_ASSIGN(Queue);
+ Queue(const Queue &) = delete;
+ const Queue &operator=(const Queue &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Queue_h_
+#endif // LLDB_TARGET_QUEUE_H
diff --git a/linux-x64/clang/include/lldb/Target/QueueItem.h b/linux-x64/clang/include/lldb/Target/QueueItem.h
index dfae3b8..64d3d23 100644
--- a/linux-x64/clang/include/lldb/Target/QueueItem.h
+++ b/linux-x64/clang/include/lldb/Target/QueueItem.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_QueueItem_h_
-#define liblldb_QueueItem_h_
+#ifndef LLDB_TARGET_QUEUEITEM_H
+#define LLDB_TARGET_QUEUEITEM_H
#include <memory>
#include <string>
@@ -159,9 +159,10 @@
std::string m_target_queue_label;
private:
- DISALLOW_COPY_AND_ASSIGN(QueueItem);
+ QueueItem(const QueueItem &) = delete;
+ const QueueItem &operator=(const QueueItem &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_QueueItem_h_
+#endif // LLDB_TARGET_QUEUEITEM_H
diff --git a/linux-x64/clang/include/lldb/Target/QueueList.h b/linux-x64/clang/include/lldb/Target/QueueList.h
index 761107e..7c74a6a 100644
--- a/linux-x64/clang/include/lldb/Target/QueueList.h
+++ b/linux-x64/clang/include/lldb/Target/QueueList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_QueueList_h_
-#define liblldb_QueueList_h_
+#ifndef LLDB_TARGET_QUEUELIST_H
+#define LLDB_TARGET_QUEUELIST_H
#include <mutex>
#include <vector>
@@ -107,4 +107,4 @@
} // namespace lldb_private
-#endif // liblldb_QueueList_h_
+#endif // LLDB_TARGET_QUEUELIST_H
diff --git a/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h b/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h
index 4f9654f..d2bcc61 100644
--- a/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h
+++ b/linux-x64/clang/include/lldb/Target/RegisterCheckpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RegisterCheckpoint_h_
-#define liblldb_RegisterCheckpoint_h_
+#ifndef LLDB_TARGET_REGISTERCHECKPOINT_H
+#define LLDB_TARGET_REGISTERCHECKPOINT_H
#include "lldb/Target/StackID.h"
#include "lldb/Utility/UserID.h"
@@ -45,9 +45,10 @@
Reason m_reason;
// Make RegisterCheckpointSP if you wish to share the data in this class.
- DISALLOW_COPY_AND_ASSIGN(RegisterCheckpoint);
+ RegisterCheckpoint(const RegisterCheckpoint &) = delete;
+ const RegisterCheckpoint &operator=(const RegisterCheckpoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_RegisterCheckpoint_h_
+#endif // LLDB_TARGET_REGISTERCHECKPOINT_H
diff --git a/linux-x64/clang/include/lldb/Target/RegisterContext.h b/linux-x64/clang/include/lldb/Target/RegisterContext.h
index d6212dd..5e795e5 100644
--- a/linux-x64/clang/include/lldb/Target/RegisterContext.h
+++ b/linux-x64/clang/include/lldb/Target/RegisterContext.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RegisterContext_h_
-#define liblldb_RegisterContext_h_
+#ifndef LLDB_TARGET_REGISTERCONTEXT_H
+#define LLDB_TARGET_REGISTERCONTEXT_H
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/lldb-private.h"
@@ -39,6 +39,8 @@
virtual const RegisterSet *GetRegisterSet(size_t reg_set) = 0;
+ virtual lldb::ByteOrder GetByteOrder();
+
virtual bool ReadRegister(const RegisterInfo *reg_info,
RegisterValue ®_value) = 0;
@@ -105,7 +107,7 @@
/// The equivalent register number in the eRegisterKindLLDB
/// numbering scheme, if possible, else LLDB_INVALID_REGNUM.
virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
- uint32_t num) = 0;
+ uint32_t num);
// Subclasses can override these functions if desired
virtual uint32_t NumSupportedHardwareBreakpoints();
@@ -201,9 +203,10 @@
uint32_t m_stop_id; // The stop ID that any data in this context is valid for
private:
// For RegisterContext only
- DISALLOW_COPY_AND_ASSIGN(RegisterContext);
+ RegisterContext(const RegisterContext &) = delete;
+ const RegisterContext &operator=(const RegisterContext &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_RegisterContext_h_
+#endif // LLDB_TARGET_REGISTERCONTEXT_H
diff --git a/linux-x64/clang/include/lldb/Target/RegisterContextUnwind.h b/linux-x64/clang/include/lldb/Target/RegisterContextUnwind.h
new file mode 100644
index 0000000..fa96c3e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/RegisterContextUnwind.h
@@ -0,0 +1,259 @@
+//===-- RegisterContextUnwind.h ---------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_REGISTERCONTEXTUNWIND_H
+#define LLDB_TARGET_REGISTERCONTEXTUNWIND_H
+
+#include <vector>
+
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/RegisterNumber.h"
+#include "lldb/Target/UnwindLLDB.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+class UnwindLLDB;
+
+class RegisterContextUnwind : public lldb_private::RegisterContext {
+public:
+ typedef std::shared_ptr<RegisterContextUnwind> SharedPtr;
+
+ RegisterContextUnwind(lldb_private::Thread &thread,
+ const SharedPtr &next_frame,
+ lldb_private::SymbolContext &sym_ctx,
+ uint32_t frame_number,
+ lldb_private::UnwindLLDB &unwind_lldb);
+
+ ~RegisterContextUnwind() override = default;
+
+ void InvalidateAllRegisters() override;
+
+ size_t GetRegisterCount() override;
+
+ const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
+
+ size_t GetRegisterSetCount() override;
+
+ const lldb_private::RegisterSet *GetRegisterSet(size_t reg_set) override;
+
+ bool ReadRegister(const lldb_private::RegisterInfo *reg_info,
+ lldb_private::RegisterValue &value) override;
+
+ bool WriteRegister(const lldb_private::RegisterInfo *reg_info,
+ const lldb_private::RegisterValue &value) override;
+
+ bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
+
+ bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
+
+ uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
+ uint32_t num) override;
+
+ bool IsValid() const;
+
+ bool IsTrapHandlerFrame() const;
+
+ bool GetCFA(lldb::addr_t &cfa);
+
+ bool GetStartPC(lldb::addr_t &start_pc);
+
+ bool ReadPC(lldb::addr_t &start_pc);
+
+private:
+ enum FrameType {
+ eNormalFrame,
+ eTrapHandlerFrame,
+ eDebuggerFrame, // a debugger inferior function call frame; we get caller's
+ // registers from debugger
+ eSkipFrame, // The unwind resulted in a bogus frame but may get back on
+ // track so we don't want to give up yet
+ eNotAValidFrame // this frame is invalid for some reason - most likely it is
+ // past the top (end) of the stack
+ };
+
+ // UnwindLLDB needs to pass around references to RegisterLocations
+ friend class UnwindLLDB;
+
+ // Returns true if we have an unwind loop -- the same stack frame unwinding
+ // multiple times.
+ bool CheckIfLoopingStack();
+
+ // Indicates whether this frame is frame zero -- the currently
+ // executing frame -- or not.
+ bool IsFrameZero() const;
+
+ void InitializeZerothFrame();
+
+ void InitializeNonZerothFrame();
+
+ SharedPtr GetNextFrame() const;
+
+ SharedPtr GetPrevFrame() const;
+
+ // A SkipFrame occurs when the unwind out of frame 0 didn't go right -- we've
+ // got one bogus frame at frame #1.
+ // There is a good chance we'll get back on track if we follow the frame
+ // pointer chain (or whatever is appropriate
+ // on this ABI) so we allow one invalid frame to be in the stack. Ideally
+ // we'll mark this frame specially at some
+ // point and indicate to the user that the unwinder had a hiccup. Often when
+ // this happens we will miss a frame of
+ // the program's actual stack in the unwind and we want to flag that for the
+ // user somehow.
+ bool IsSkipFrame() const;
+
+ /// Determines if a SymbolContext is a trap handler or not
+ ///
+ /// Given a SymbolContext, determines if this is a trap handler function
+ /// aka asynchronous signal handler.
+ ///
+ /// \return
+ /// Returns true if the SymbolContext is a trap handler.
+ bool IsTrapHandlerSymbol(lldb_private::Process *process,
+ const lldb_private::SymbolContext &m_sym_ctx) const;
+
+ /// Check if the given unwind plan indicates a signal trap handler, and
+ /// update frame type and symbol context if so.
+ void PropagateTrapHandlerFlagFromUnwindPlan(lldb::UnwindPlanSP unwind_plan);
+
+ // Provide a location for where THIS function saved the CALLER's register
+ // value
+ // Or a frame "below" this one saved it, i.e. a function called by this one,
+ // preserved a register that this
+ // function didn't modify/use.
+ //
+ // The RegisterLocation type may be set to eRegisterNotAvailable -- this will
+ // happen for a volatile register
+ // being queried mid-stack. Instead of floating frame 0's contents of that
+ // register up the stack (which may
+ // or may not be the value of that reg when the function was executing), we
+ // won't return any value.
+ //
+ // If a non-volatile register (a "preserved" register) is requested mid-stack
+ // and no frames "below" the requested
+ // stack have saved the register anywhere, it is safe to assume that frame 0's
+ // register values are still the same
+ // as the requesting frame's.
+ lldb_private::UnwindLLDB::RegisterSearchResult
+ SavedLocationForRegister(uint32_t lldb_regnum,
+ lldb_private::UnwindLLDB::RegisterLocation ®loc);
+
+ bool ReadRegisterValueFromRegisterLocation(
+ lldb_private::UnwindLLDB::RegisterLocation regloc,
+ const lldb_private::RegisterInfo *reg_info,
+ lldb_private::RegisterValue &value);
+
+ bool WriteRegisterValueToRegisterLocation(
+ lldb_private::UnwindLLDB::RegisterLocation regloc,
+ const lldb_private::RegisterInfo *reg_info,
+ const lldb_private::RegisterValue &value);
+
+ /// If the unwind has to the caller frame has failed, try something else
+ ///
+ /// If lldb is using an assembly language based UnwindPlan for a frame and
+ /// the unwind to the caller frame fails, try falling back to a generic
+ /// UnwindPlan (architecture default unwindplan) to see if that might work
+ /// better. This is mostly helping to work around problems where the
+ /// assembly language inspection fails on hand-written assembly code.
+ ///
+ /// \return
+ /// Returns true if a fallback unwindplan was found & was installed.
+ bool TryFallbackUnwindPlan();
+
+ /// Switch to the fallback unwind plan unconditionally without any safety
+ /// checks that it is providing better results than the normal unwind plan.
+ ///
+ /// The only time it is valid to call this method is if the full unwindplan is
+ /// found to be fundamentally incorrect/impossible.
+ ///
+ /// Returns true if it was able to install the fallback unwind plan.
+ bool ForceSwitchToFallbackUnwindPlan();
+
+ // Get the contents of a general purpose (address-size) register for this
+ // frame
+ // (usually retrieved from the next frame)
+ bool ReadGPRValue(lldb::RegisterKind register_kind, uint32_t regnum,
+ lldb::addr_t &value);
+
+ bool ReadGPRValue(const RegisterNumber ®_num, lldb::addr_t &value);
+
+ // Get the Frame Address register for a given frame.
+ bool ReadFrameAddress(lldb::RegisterKind register_kind,
+ UnwindPlan::Row::FAValue &fa, lldb::addr_t &address);
+
+ lldb::UnwindPlanSP GetFastUnwindPlanForFrame();
+
+ lldb::UnwindPlanSP GetFullUnwindPlanForFrame();
+
+ void UnwindLogMsg(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+
+ void UnwindLogMsgVerbose(const char *fmt, ...)
+ __attribute__((format(printf, 2, 3)));
+
+ bool IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp,
+ int &valid_pc_offset);
+
+ lldb::addr_t GetReturnAddressHint(int32_t plan_offset);
+
+ lldb_private::Thread &m_thread;
+
+ ///
+ // The following tell us how to retrieve the CALLER's register values (ie the
+ // "previous" frame, aka the frame above)
+ // i.e. where THIS frame saved them
+ ///
+
+ lldb::UnwindPlanSP m_fast_unwind_plan_sp; // may be NULL
+ lldb::UnwindPlanSP m_full_unwind_plan_sp;
+ lldb::UnwindPlanSP m_fallback_unwind_plan_sp; // may be NULL
+
+ bool m_all_registers_available; // Can we retrieve all regs or just
+ // nonvolatile regs?
+ int m_frame_type; // enum FrameType
+
+ lldb::addr_t m_cfa;
+ lldb::addr_t m_afa;
+ lldb_private::Address m_start_pc;
+ lldb_private::Address m_current_pc;
+
+ int m_current_offset; // how far into the function we've executed; -1 if
+ // unknown
+ // 0 if no instructions have been executed yet.
+
+ int m_current_offset_backed_up_one; // how far into the function we've
+ // executed; -1 if unknown
+ // 0 if no instructions have been executed yet.
+ // On architectures where the return address on the stack points
+ // to the instruction after the CALL, this value will have 1
+ // subtracted from it. Else a function that ends in a CALL will
+ // have an offset pointing into the next function's address range.
+ // m_current_pc has the actual address of the "current" pc.
+
+ lldb_private::SymbolContext &m_sym_ctx;
+ bool m_sym_ctx_valid; // if ResolveSymbolContextForAddress fails, don't try to
+ // use m_sym_ctx
+
+ uint32_t m_frame_number; // What stack frame this RegisterContext is
+
+ std::map<uint32_t, lldb_private::UnwindLLDB::RegisterLocation>
+ m_registers; // where to find reg values for this frame
+
+ lldb_private::UnwindLLDB &m_parent_unwind; // The UnwindLLDB that is creating
+ // this RegisterContextUnwind
+
+ RegisterContextUnwind(const RegisterContextUnwind &) = delete;
+ const RegisterContextUnwind &
+ operator=(const RegisterContextUnwind &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_REGISTERCONTEXTUNWIND_H
diff --git a/linux-x64/clang/include/lldb/Target/RegisterNumber.h b/linux-x64/clang/include/lldb/Target/RegisterNumber.h
index 0bef0c1..362812b 100644
--- a/linux-x64/clang/include/lldb/Target/RegisterNumber.h
+++ b/linux-x64/clang/include/lldb/Target/RegisterNumber.h
@@ -56,4 +56,4 @@
const char *m_name;
};
-#endif // liblldb_RegisterNumber_h
+#endif // LLDB_TARGET_REGISTERNUMBER_H
diff --git a/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h b/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h
index 524332f..6d6ac99 100644
--- a/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h
+++ b/linux-x64/clang/include/lldb/Target/RemoteAwarePlatform.h
@@ -22,7 +22,11 @@
bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
ModuleSpec &module_spec) override;
- lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
+ Status
+ ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
+ const FileSpecList *module_search_paths_ptr) override;
+
+ lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
uint32_t mode, Status &error) override;
bool CloseFile(lldb::user_id_t fd, Status &error) override;
@@ -64,11 +68,16 @@
bool GetRemoteOSKernelDescription(std::string &s) override;
ArchSpec GetRemoteSystemArchitecture() override;
- Status RunShellCommand(const char *command, const FileSpec &working_dir,
+ Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir,
int *status_ptr, int *signo_ptr,
std::string *command_output,
const Timeout<std::micro> &timeout) override;
+ Status RunShellCommand(llvm::StringRef interpreter, llvm::StringRef command,
+ const FileSpec &working_dir, int *status_ptr,
+ int *signo_ptr, std::string *command_output,
+ const Timeout<std::micro> &timeout) override;
+
const char *GetHostname() override;
UserIDResolver &GetUserIDResolver() override;
lldb_private::Environment GetEnvironment() override;
diff --git a/linux-x64/clang/include/lldb/Target/Runtime.h b/linux-x64/clang/include/lldb/Target/Runtime.h
new file mode 100644
index 0000000..06f0b61
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Runtime.h
@@ -0,0 +1,33 @@
+//===-- Runtime.h -----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_RUNTIME_H
+#define LLDB_TARGET_RUNTIME_H
+
+#include "lldb/Target/Process.h"
+
+namespace lldb_private {
+class Runtime {
+public:
+ Runtime(Process *process) : m_process(process) {}
+ virtual ~Runtime() = default;
+ Runtime(const Runtime &) = delete;
+ const Runtime &operator=(const Runtime &) = delete;
+
+ Process *GetProcess() { return m_process; }
+ Target &GetTargetRef() { return m_process->GetTarget(); }
+
+ /// Called when modules have been loaded in the process.
+ virtual void ModulesDidLoad(const ModuleList &module_list) = 0;
+
+protected:
+ Process *m_process;
+};
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_RUNTIME_H
diff --git a/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h b/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h
index 71b5d0c..dd02430 100644
--- a/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h
+++ b/linux-x64/clang/include/lldb/Target/SectionLoadHistory.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SectionLoadHistory_h_
-#define liblldb_SectionLoadHistory_h_
+#ifndef LLDB_TARGET_SECTIONLOADHISTORY_H
+#define LLDB_TARGET_SECTIONLOADHISTORY_H
#include <map>
#include <mutex>
@@ -75,9 +75,10 @@
mutable std::recursive_mutex m_mutex;
private:
- DISALLOW_COPY_AND_ASSIGN(SectionLoadHistory);
+ SectionLoadHistory(const SectionLoadHistory &) = delete;
+ const SectionLoadHistory &operator=(const SectionLoadHistory &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_SectionLoadHistory_h_
+#endif // LLDB_TARGET_SECTIONLOADHISTORY_H
diff --git a/linux-x64/clang/include/lldb/Target/SectionLoadList.h b/linux-x64/clang/include/lldb/Target/SectionLoadList.h
index caefa00..e8535e7 100644
--- a/linux-x64/clang/include/lldb/Target/SectionLoadList.h
+++ b/linux-x64/clang/include/lldb/Target/SectionLoadList.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SectionLoadList_h_
-#define liblldb_SectionLoadList_h_
+#ifndef LLDB_TARGET_SECTIONLOADLIST_H
+#define LLDB_TARGET_SECTIONLOADLIST_H
#include <map>
#include <mutex>
@@ -70,4 +70,4 @@
} // namespace lldb_private
-#endif // liblldb_SectionLoadList_h_
+#endif // LLDB_TARGET_SECTIONLOADLIST_H
diff --git a/linux-x64/clang/include/lldb/Target/StackFrame.h b/linux-x64/clang/include/lldb/Target/StackFrame.h
index 4e6e79b..905c56c 100644
--- a/linux-x64/clang/include/lldb/Target/StackFrame.h
+++ b/linux-x64/clang/include/lldb/Target/StackFrame.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StackFrame_h_
-#define liblldb_StackFrame_h_
+#ifndef LLDB_TARGET_STACKFRAME_H
+#define LLDB_TARGET_STACKFRAME_H
#include <memory>
#include <mutex>
@@ -99,8 +99,6 @@
/// \param [in] pc
/// The current pc value of this stack frame.
///
- /// \param [in] frame_kind
- ///
/// \param [in] sc_ptr
/// Optionally seed the StackFrame with the SymbolContext information that
/// has
@@ -108,17 +106,19 @@
StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa,
bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind,
+ bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr);
+
+ StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
+ lldb::user_id_t concrete_frame_idx,
+ const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa,
+ lldb::addr_t pc, bool behaves_like_zeroth_frame,
const SymbolContext *sc_ptr);
StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
lldb::user_id_t concrete_frame_idx,
const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa,
- lldb::addr_t pc, const SymbolContext *sc_ptr);
-
- StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
- lldb::user_id_t concrete_frame_idx,
- const lldb::RegisterContextSP ®_context_sp, lldb::addr_t cfa,
- const Address &pc, const SymbolContext *sc_ptr);
+ const Address &pc, bool behaves_like_zeroth_frame,
+ const SymbolContext *sc_ptr);
~StackFrame() override;
@@ -287,18 +287,18 @@
llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
uint32_t options, lldb::VariableSP &var_sp, Status &error);
- /// Determine whether this StackFrame has debug information available or not
+ /// Determine whether this StackFrame has debug information available or not.
///
/// \return
- // true if debug information is available for this frame (function,
- // compilation unit, block, etc.)
+ /// true if debug information is available for this frame (function,
+ /// compilation unit, block, etc.)
bool HasDebugInformation();
/// Return the disassembly for the instructions of this StackFrame's
/// function as a single C string.
///
/// \return
- // C string with the assembly instructions for this function.
+ /// C string with the assembly instructions for this function.
const char *Disassemble();
/// Print a description for this frame using the frame-format formatter
@@ -399,7 +399,7 @@
/// is sufficient. One of the DynamicValueType enumerated values.
///
/// \return
- // A ValueObject for this variable.
+ /// A ValueObject for this variable.
lldb::ValueObjectSP
GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp,
lldb::DynamicValueType use_dynamic);
@@ -416,7 +416,7 @@
/// is sufficient. One of the DynamicValueType enumerated values.
///
/// \return
- // A ValueObject for this variable.
+ /// A ValueObject for this variable.
lldb::ValueObjectSP TrackGlobalVariable(const lldb::VariableSP &variable_sp,
lldb::DynamicValueType use_dynamic);
@@ -511,6 +511,12 @@
bool m_cfa_is_valid; // Does this frame have a CFA? Different from CFA ==
// LLDB_INVALID_ADDRESS
Kind m_stack_frame_kind;
+
+ // Whether this frame behaves like the zeroth frame, in the sense
+ // that its pc value might not immediately follow a call (and thus might
+ // be the first address of its function). True for actual frame zero as
+ // well as any other frame with the same trait.
+ bool m_behaves_like_zeroth_frame;
lldb::VariableListSP m_variable_list_sp;
ValueObjectList m_variable_list_value_objects; // Value objects for each
// variable in
@@ -519,9 +525,10 @@
StreamString m_disassembly;
std::recursive_mutex m_mutex;
- DISALLOW_COPY_AND_ASSIGN(StackFrame);
+ StackFrame(const StackFrame &) = delete;
+ const StackFrame &operator=(const StackFrame &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_StackFrame_h_
+#endif // LLDB_TARGET_STACKFRAME_H
diff --git a/linux-x64/clang/include/lldb/Target/StackFrameList.h b/linux-x64/clang/include/lldb/Target/StackFrameList.h
index 5eb7919..1b0b986 100644
--- a/linux-x64/clang/include/lldb/Target/StackFrameList.h
+++ b/linux-x64/clang/include/lldb/Target/StackFrameList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StackFrameList_h_
-#define liblldb_StackFrameList_h_
+#ifndef LLDB_TARGET_STACKFRAMELIST_H
+#define LLDB_TARGET_STACKFRAMELIST_H
#include <memory>
#include <mutex>
@@ -94,7 +94,7 @@
void GetFramesUpTo(uint32_t end_idx);
- void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind *unwinder);
+ void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind &unwinder);
void SynthesizeTailCallFrames(StackFrame &next_frame);
@@ -155,9 +155,10 @@
const bool m_show_inlined_frames;
private:
- DISALLOW_COPY_AND_ASSIGN(StackFrameList);
+ StackFrameList(const StackFrameList &) = delete;
+ const StackFrameList &operator=(const StackFrameList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_StackFrameList_h_
+#endif // LLDB_TARGET_STACKFRAMELIST_H
diff --git a/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h b/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h
index 2021ac5..baffc89 100644
--- a/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h
+++ b/linux-x64/clang/include/lldb/Target/StackFrameRecognizer.h
@@ -6,16 +6,19 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StackFrameRecognizer_h_
-#define liblldb_StackFrameRecognizer_h_
+#ifndef LLDB_TARGET_STACKFRAMERECOGNIZER_H
+#define LLDB_TARGET_STACKFRAMERECOGNIZER_H
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/StopInfo.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"
+#include <vector>
+
namespace lldb_private {
/// \class RecognizedStackFrame
@@ -33,10 +36,14 @@
virtual lldb::ValueObjectSP GetExceptionObject() {
return lldb::ValueObjectSP();
}
+ virtual lldb::StackFrameSP GetMostRelevantFrame() { return nullptr; };
virtual ~RecognizedStackFrame(){};
+ std::string GetStopDescription() { return m_stop_desc; }
+
protected:
lldb::ValueObjectListSP m_arguments;
+ std::string m_stop_desc;
};
/// \class StackFrameRecognizer
@@ -85,39 +92,49 @@
lldb::StackFrameSP frame) override;
private:
- DISALLOW_COPY_AND_ASSIGN(ScriptedStackFrameRecognizer);
+ ScriptedStackFrameRecognizer(const ScriptedStackFrameRecognizer &) = delete;
+ const ScriptedStackFrameRecognizer &
+ operator=(const ScriptedStackFrameRecognizer &) = delete;
};
-/// \class StackFrameRecognizerManager
-///
-/// Static class that provides a registry of known stack frame recognizers.
-/// Has static methods to add, enumerate, remove, query and invoke recognizers.
-
+/// Class that provides a registry of known stack frame recognizers.
class StackFrameRecognizerManager {
public:
- static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
- ConstString module,
- ConstString symbol,
- bool first_instruction_only = true);
+ void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
+ ConstString module, llvm::ArrayRef<ConstString> symbols,
+ bool first_instruction_only = true);
- static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
- lldb::RegularExpressionSP module,
- lldb::RegularExpressionSP symbol,
- bool first_instruction_only = true);
+ void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
+ lldb::RegularExpressionSP module,
+ lldb::RegularExpressionSP symbol,
+ bool first_instruction_only = true);
- static void ForEach(
- std::function<void(uint32_t recognizer_id, std::string recognizer_name,
- std::string module, std::string symbol,
- bool regexp)> const &callback);
+ void ForEach(std::function<
+ void(uint32_t recognizer_id, std::string recognizer_name,
+ std::string module, llvm::ArrayRef<ConstString> symbols,
+ bool regexp)> const &callback);
- static bool RemoveRecognizerWithID(uint32_t recognizer_id);
+ bool RemoveRecognizerWithID(uint32_t recognizer_id);
- static void RemoveAllRecognizers();
+ void RemoveAllRecognizers();
- static lldb::StackFrameRecognizerSP GetRecognizerForFrame(
- lldb::StackFrameSP frame);
+ lldb::StackFrameRecognizerSP GetRecognizerForFrame(lldb::StackFrameSP frame);
- static lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame);
+ lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame);
+
+private:
+ struct RegisteredEntry {
+ uint32_t recognizer_id;
+ lldb::StackFrameRecognizerSP recognizer;
+ bool is_regexp;
+ ConstString module;
+ lldb::RegularExpressionSP module_regexp;
+ std::vector<ConstString> symbols;
+ lldb::RegularExpressionSP symbol_regexp;
+ bool first_instruction_only;
+ };
+
+ std::deque<RegisteredEntry> m_recognizers;
};
/// \class ValueObjectRecognizerSynthesizedValue
@@ -137,7 +154,9 @@
SetName(parent.GetName());
}
- uint64_t GetByteSize() override { return m_parent->GetByteSize(); }
+ llvm::Optional<uint64_t> GetByteSize() override {
+ return m_parent->GetByteSize();
+ }
lldb::ValueType GetValueType() const override { return m_type; }
bool UpdateValue() override {
if (!m_parent->UpdateValueIfNeeded()) return false;
@@ -158,4 +177,4 @@
} // namespace lldb_private
-#endif // liblldb_StackFrameRecognizer_h_
+#endif // LLDB_TARGET_STACKFRAMERECOGNIZER_H
diff --git a/linux-x64/clang/include/lldb/Target/StackID.h b/linux-x64/clang/include/lldb/Target/StackID.h
index a649a4f..827ed1b 100644
--- a/linux-x64/clang/include/lldb/Target/StackID.h
+++ b/linux-x64/clang/include/lldb/Target/StackID.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StackID_h_
-#define liblldb_StackID_h_
+#ifndef LLDB_TARGET_STACKID_H
+#define LLDB_TARGET_STACKID_H
#include "lldb/Core/AddressRange.h"
#include "lldb/lldb-private.h"
@@ -96,4 +96,4 @@
} // namespace lldb_private
-#endif // liblldb_StackID_h_
+#endif // LLDB_TARGET_STACKID_H
diff --git a/linux-x64/clang/include/lldb/Target/StopInfo.h b/linux-x64/clang/include/lldb/Target/StopInfo.h
index 59033b1..4378d2d 100644
--- a/linux-x64/clang/include/lldb/Target/StopInfo.h
+++ b/linux-x64/clang/include/lldb/Target/StopInfo.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StopInfo_h_
-#define liblldb_StopInfo_h_
+#ifndef LLDB_TARGET_STOPINFO_H
+#define LLDB_TARGET_STOPINFO_H
#include <string>
@@ -33,10 +33,13 @@
lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); }
- // The value of the StopInfo depends on the StopReason. StopReason
- // Meaning ----------------------------------------------
- // eStopReasonBreakpoint BreakpointSiteID eStopReasonSignal
- // Signal number eStopReasonWatchpoint WatchpointLocationID
+ // The value of the StopInfo depends on the StopReason.
+ //
+ // StopReason Meaning
+ // ------------------------------------------------
+ // eStopReasonBreakpoint BreakpointSiteID
+ // eStopReasonSignal Signal number
+ // eStopReasonWatchpoint WatchpointLocationID
// eStopReasonPlanComplete No significance
uint64_t GetValue() const { return m_value; }
@@ -180,9 +183,10 @@
private:
friend class Thread;
- DISALLOW_COPY_AND_ASSIGN(StopInfo);
+ StopInfo(const StopInfo &) = delete;
+ const StopInfo &operator=(const StopInfo &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_StopInfo_h_
+#endif // LLDB_TARGET_STOPINFO_H
diff --git a/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h b/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h
index b20bdb3..09241d5 100644
--- a/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h
+++ b/linux-x64/clang/include/lldb/Target/StructuredDataPlugin.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef StructuredDataPlugin_h
-#define StructuredDataPlugin_h
+#ifndef LLDB_TARGET_STRUCTUREDDATAPLUGIN_H
+#define LLDB_TARGET_STRUCTUREDDATAPLUGIN_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/Utility/StructuredData.h"
@@ -162,7 +162,8 @@
private:
lldb::ProcessWP m_process_wp;
- DISALLOW_COPY_AND_ASSIGN(StructuredDataPlugin);
+ StructuredDataPlugin(const StructuredDataPlugin &) = delete;
+ const StructuredDataPlugin &operator=(const StructuredDataPlugin &) = delete;
};
}
diff --git a/linux-x64/clang/include/lldb/Target/SystemRuntime.h b/linux-x64/clang/include/lldb/Target/SystemRuntime.h
index b45f882..0ec0793 100644
--- a/linux-x64/clang/include/lldb/Target/SystemRuntime.h
+++ b/linux-x64/clang/include/lldb/Target/SystemRuntime.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SystemRuntime_h_
-#define liblldb_SystemRuntime_h_
+#ifndef LLDB_TARGET_SYSTEMRUNTIME_H
+#define LLDB_TARGET_SYSTEMRUNTIME_H
#include <vector>
@@ -15,6 +15,7 @@
#include "lldb/Core/PluginInterface.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/QueueList.h"
+#include "lldb/Target/Runtime.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
@@ -39,7 +40,7 @@
/// can be asked to provide that information.
///
-class SystemRuntime : public PluginInterface {
+class SystemRuntime : public Runtime, public PluginInterface {
public:
/// Find a system runtime plugin for a given process.
///
@@ -52,7 +53,7 @@
static SystemRuntime *FindPlugin(Process *process);
/// Construct with a process.
- SystemRuntime(lldb_private::Process *process);
+ SystemRuntime(Process *process);
/// Destructor.
///
@@ -76,7 +77,7 @@
///
/// Allow the SystemRuntime plugin to enable logging features in the system
/// runtime libraries.
- virtual void ModulesDidLoad(lldb_private::ModuleList &module_list);
+ virtual void ModulesDidLoad(const ModuleList &module_list) override;
/// Called before detaching from a process.
///
@@ -294,15 +295,13 @@
}
protected:
- // Member variables.
- Process *m_process;
-
std::vector<ConstString> m_types;
private:
- DISALLOW_COPY_AND_ASSIGN(SystemRuntime);
+ SystemRuntime(const SystemRuntime &) = delete;
+ const SystemRuntime &operator=(const SystemRuntime &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_SystemRuntime_h_
+#endif // LLDB_TARGET_SYSTEMRUNTIME_H
diff --git a/linux-x64/clang/include/lldb/Target/Target.h b/linux-x64/clang/include/lldb/Target/Target.h
index 875a8b1..69baefb 100644
--- a/linux-x64/clang/include/lldb/Target/Target.h
+++ b/linux-x64/clang/include/lldb/Target/Target.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Target_h_
-#define liblldb_Target_h_
+#ifndef LLDB_TARGET_TARGET_H
+#define LLDB_TARGET_TARGET_H
#include <list>
#include <map>
@@ -28,6 +28,7 @@
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/SectionLoadHistory.h"
+#include "lldb/Target/ThreadSpec.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Broadcaster.h"
#include "lldb/Utility/LLDBAssert.h"
@@ -36,6 +37,8 @@
namespace lldb_private {
+class ClangModulesDeclVendor;
+
OptionEnumValues GetDynamicValueTypes();
enum InlineStrategy {
@@ -62,7 +65,12 @@
eLoadDependentsNo,
};
-// TargetProperties
+enum ImportStdModule {
+ eImportStdModuleFalse,
+ eImportStdModuleFallback,
+ eImportStdModuleTrue,
+};
+
class TargetExperimentalProperties : public Properties {
public:
TargetExperimentalProperties();
@@ -92,6 +100,10 @@
void SetDisableASLR(bool b);
+ bool GetInheritTCC() const;
+
+ void SetInheritTCC(bool b);
+
bool GetDetachOnError() const;
void SetDetachOnError(bool b);
@@ -121,7 +133,7 @@
FileSpecList GetExecutableSearchPaths();
- void AppendExecutableSearchPaths(const FileSpec&);
+ void AppendExecutableSearchPaths(const FileSpec &);
FileSpecList GetDebugFileSearchPaths();
@@ -129,16 +141,20 @@
bool GetEnableAutoImportClangModules() const;
- bool GetEnableImportStdModule() const;
+ ImportStdModule GetImportStdModule() const;
bool GetEnableAutoApplyFixIts() const;
+ uint64_t GetNumberOfRetriesWithFixits() const;
+
bool GetEnableNotifyAboutFixIts() const;
bool GetEnableSaveObjects() const;
bool GetEnableSyntheticValue() const;
+ uint32_t GetMaxZeroPaddingInFloatFormat() const;
+
uint32_t GetMaximumNumberOfChildrenToDisplay() const;
uint32_t GetMaximumSizeOfStringSummary() const;
@@ -163,6 +179,8 @@
llvm::StringRef GetExpressionPrefixContents();
+ uint64_t GetExprErrorLimit() const;
+
bool GetUseHexImmediates() const;
bool GetUseFastStepping() const;
@@ -201,38 +219,33 @@
void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
- bool GetUseModernTypeLookup() const;
-
void SetRequireHardwareBreakpoints(bool b);
bool GetRequireHardwareBreakpoints() const;
+ bool GetAutoInstallMainExecutable() const;
+
+ void UpdateLaunchInfoFromProperties();
+
private:
// Callbacks for m_launch_info.
- static void Arg0ValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void RunArgsValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void EnvVarsValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void InheritEnvValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void InputPathValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void OutputPathValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void ErrorPathValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void DetachOnErrorValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void DisableASLRValueChangedCallback(void *target_property_ptr,
- OptionValue *);
- static void DisableSTDIOValueChangedCallback(void *target_property_ptr,
- OptionValue *);
+ void Arg0ValueChangedCallback();
+ void RunArgsValueChangedCallback();
+ void EnvVarsValueChangedCallback();
+ void InputPathValueChangedCallback();
+ void OutputPathValueChangedCallback();
+ void ErrorPathValueChangedCallback();
+ void DetachOnErrorValueChangedCallback();
+ void DisableASLRValueChangedCallback();
+ void InheritTCCValueChangedCallback();
+ void DisableSTDIOValueChangedCallback();
+
+ Environment ComputeEnvironment() const;
// Member variables.
ProcessLaunchInfo m_launch_info;
std::unique_ptr<TargetExperimentalProperties> m_experimental_properties_up;
+ Target *m_target;
};
class EvaluateExpressionOptions {
@@ -382,6 +395,12 @@
bool GetAutoApplyFixIts() const { return m_auto_apply_fixits; }
+ void SetRetriesWithFixIts(uint64_t number_of_retries) {
+ m_retries_with_fixits = number_of_retries;
+ }
+
+ uint64_t GetRetriesWithFixIts() const { return m_retries_with_fixits; }
+
bool IsForUtilityExpr() const { return m_running_utility_expression; }
void SetIsForUtilityExpr(bool b) { m_running_utility_expression = b; }
@@ -403,6 +422,7 @@
bool m_ansi_color_errors = false;
bool m_result_is_internal = false;
bool m_auto_apply_fixits = true;
+ uint64_t m_retries_with_fixits = 1;
/// True if the executed code should be treated as utility code that is only
/// used by LLDB internally.
bool m_running_utility_expression = false;
@@ -427,6 +447,7 @@
public ModuleList::Notifier {
public:
friend class TargetList;
+ friend class Debugger;
/// Broadcaster event bits definitions.
enum {
@@ -478,7 +499,8 @@
lldb::TargetSP m_target_sp;
ModuleList m_module_list;
- DISALLOW_COPY_AND_ASSIGN(TargetEventData);
+ TargetEventData(const TargetEventData &) = delete;
+ const TargetEventData &operator=(const TargetEventData &) = delete;
};
~Target() override;
@@ -491,13 +513,13 @@
static FileSpecList GetDefaultDebugFileSearchPaths();
- static FileSpecList GetDefaultClangModuleSearchPaths();
-
static ArchSpec GetDefaultArchitecture();
static void SetDefaultArchitecture(const ArchSpec &arch);
- /// Find a binary on the system and return its Module,
+ bool IsDummyTarget() const { return m_is_dummy_target; }
+
+ /// Find a binary on the system and return its Module,
/// or return an existing Module that is already in the Target.
///
/// Given a ModuleSpec, find a binary satisifying that specification,
@@ -509,34 +531,33 @@
/// e.g. UUID, architecture, file path.
///
/// \param[in] notify
- /// If notify is true, and the Module is new to this Target,
- /// Target::ModulesDidLoad will be called.
- /// If notify is false, it is assumed that the caller is adding
- /// multiple Modules and will call ModulesDidLoad with the
+ /// If notify is true, and the Module is new to this Target,
+ /// Target::ModulesDidLoad will be called.
+ /// If notify is false, it is assumed that the caller is adding
+ /// multiple Modules and will call ModulesDidLoad with the
/// full list at the end.
/// ModulesDidLoad must be called when a Module/Modules have
/// been added to the target, one way or the other.
///
/// \param[out] error_ptr
- /// Optional argument, pointing to a Status object to fill in
+ /// Optional argument, pointing to a Status object to fill in
/// with any results / messages while attempting to find/load
/// this binary. Many callers will be internal functions that
/// will handle / summarize the failures in a custom way and
/// don't use these messages.
///
- /// \return
+ /// \return
/// An empty ModuleSP will be returned if no matching file
/// was found. If error_ptr was non-nullptr, an error message
/// will likely be provided.
- lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec,
- bool notify,
+ lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
Status *error_ptr = nullptr);
// Settings accessors
static const lldb::TargetPropertiesSP &GetGlobalProperties();
- std::recursive_mutex &GetAPIMutex() { return m_mutex; }
+ std::recursive_mutex &GetAPIMutex();
void DeleteCurrentProcess();
@@ -558,7 +579,8 @@
// used.
const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp,
llvm::StringRef plugin_name,
- const FileSpec *crash_file);
+ const FileSpec *crash_file,
+ bool can_connect);
const lldb::ProcessSP &GetProcessSP() const;
@@ -601,7 +623,7 @@
const FileSpecList *containingModules,
const FileSpecList *source_file_list,
const std::unordered_set<std::string> &function_names,
- RegularExpression &source_regex, bool internal, bool request_hardware,
+ RegularExpression source_regex, bool internal, bool request_hardware,
LazyBool move_to_nearest_code);
// Use this to create a breakpoint from a load address
@@ -624,7 +646,7 @@
// target setting, else we use the values passed in
lldb::BreakpointSP CreateFuncRegexBreakpoint(
const FileSpecList *containingModules,
- const FileSpecList *containingSourceFiles, RegularExpression &func_regexp,
+ const FileSpecList *containingSourceFiles, RegularExpression func_regexp,
lldb::LanguageType requested_language, LazyBool skip_prologue,
bool internal, bool request_hardware);
@@ -646,14 +668,11 @@
Args *additional_args = nullptr,
Status *additional_args_error = nullptr);
- lldb::BreakpointSP
- CreateScriptedBreakpoint(const llvm::StringRef class_name,
- const FileSpecList *containingModules,
- const FileSpecList *containingSourceFiles,
- bool internal,
- bool request_hardware,
- StructuredData::ObjectSP extra_args_sp,
- Status *creation_error = nullptr);
+ lldb::BreakpointSP CreateScriptedBreakpoint(
+ const llvm::StringRef class_name, const FileSpecList *containingModules,
+ const FileSpecList *containingSourceFiles, bool internal,
+ bool request_hardware, StructuredData::ObjectSP extra_args_sp,
+ Status *creation_error = nullptr);
// This is the same as the func_name breakpoint except that you can specify a
// vector of names. This is cheaper than a regular expression breakpoint in
@@ -692,43 +711,42 @@
}
WatchpointList &GetWatchpointList() { return m_watchpoint_list; }
-
+
// Manages breakpoint names:
void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
-
- void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
+
+ void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
Status &error);
-
- void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
- ConstString name);
-
- BreakpointName *FindBreakpointName(ConstString name, bool can_create,
+
+ void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name);
+
+ BreakpointName *FindBreakpointName(ConstString name, bool can_create,
Status &error);
-
+
void DeleteBreakpointName(ConstString name);
-
+
void ConfigureBreakpointName(BreakpointName &bp_name,
const BreakpointOptions &options,
const BreakpointName::Permissions &permissions);
- void ApplyNameToBreakpoints(BreakpointName &bp_name);
-
+ void ApplyNameToBreakpoints(BreakpointName &bp_name);
+
// This takes ownership of the name obj passed in.
void AddBreakpointName(BreakpointName *bp_name);
-
+
void GetBreakpointNames(std::vector<std::string> &names);
-
- //This call removes ALL breakpoints regardless of permission.
+
+ // This call removes ALL breakpoints regardless of permission.
void RemoveAllBreakpoints(bool internal_also = false);
-
+
// This removes all the breakpoints, but obeys the ePermDelete on them.
void RemoveAllowedBreakpoints();
void DisableAllBreakpoints(bool internal_also = false);
-
+
void DisableAllowedBreakpoints();
void EnableAllBreakpoints(bool internal_also = false);
-
+
void EnableAllowedBreakpoints();
bool DisableBreakpointByID(lldb::break_id_t break_id);
@@ -911,8 +929,8 @@
/// The target call at present just consults the Platform's call of the
/// same name.
///
- /// \param[in] module_sp
- /// A shared pointer reference to the module that checked.
+ /// \param[in] module_spec
+ /// Path to the module.
///
/// \return \b true if the module should be excluded, \b false otherwise.
bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec);
@@ -958,7 +976,7 @@
///
/// \param[in] set_platform
/// If \b true, then the platform will be adjusted if the currently
- /// selected platform is not compatible with the archicture being set.
+ /// selected platform is not compatible with the architecture being set.
/// If \b false, then just the architecture will be set even if the
/// currently selected platform isn't compatible (in case it might be
/// manually set following this function call).
@@ -1029,9 +1047,11 @@
PathMappingList &GetImageSearchPathList();
- TypeSystem *GetScratchTypeSystemForLanguage(Status *error,
- lldb::LanguageType language,
- bool create_on_demand = true);
+ llvm::Expected<TypeSystem &>
+ GetScratchTypeSystemForLanguage(lldb::LanguageType language,
+ bool create_on_demand = true);
+
+ std::vector<TypeSystem *> GetScratchTypeSystems(bool create_on_demand = true);
PersistentExpressionState *
GetPersistentExpressionStateForLanguage(lldb::LanguageType language);
@@ -1040,11 +1060,12 @@
// parameters have the same meaning as for the UserExpression constructor.
// Returns a new-ed object which the caller owns.
- UserExpression *GetUserExpressionForLanguage(
- llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
- Expression::ResultType desired_type,
- const EvaluateExpressionOptions &options,
- ValueObject *ctx_obj, Status &error);
+ UserExpression *
+ GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ ValueObject *ctx_obj, Status &error);
// Creates a FunctionCaller for the given language, the rest of the
// parameters have the same meaning as for the FunctionCaller constructor.
@@ -1060,18 +1081,10 @@
const ValueList &arg_value_list,
const char *name, Status &error);
- // Creates a UtilityFunction for the given language, the rest of the
- // parameters have the same meaning as for the UtilityFunction constructor.
- // Returns a new-ed object which the caller owns.
-
- UtilityFunction *GetUtilityFunctionForLanguage(const char *expr,
- lldb::LanguageType language,
- const char *name,
- Status &error);
-
- ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true);
-
- lldb::ClangASTImporterSP GetClangASTImporter();
+ /// Creates and installs a UtilityFunction for the given language.
+ llvm::Expected<std::unique_ptr<UtilityFunction>>
+ CreateUtilityFunction(std::string expression, std::string name,
+ lldb::LanguageType language, ExecutionContext &exe_ctx);
// Install any files through the platform that need be to installed prior to
// launching or attaching.
@@ -1097,6 +1110,20 @@
void ClearAllLoadedSections();
+ /// Set the \a Trace object containing processor trace information of this
+ /// target.
+ ///
+ /// \param[in] trace_sp
+ /// The trace object.
+ void SetTrace(const lldb::TraceSP &trace_sp);
+
+ /// Get the \a Trace object containing processor trace information of this
+ /// target.
+ ///
+ /// \return
+ /// The trace object. It might be undefined.
+ const lldb::TraceSP &GetTrace();
+
// Since expressions results can persist beyond the lifetime of a process,
// and the const expression results are available after a process is gone, we
// provide a way for expressions to be evaluated from the Target itself. If
@@ -1106,39 +1133,60 @@
llvm::StringRef expression, ExecutionContextScope *exe_scope,
lldb::ValueObjectSP &result_valobj_sp,
const EvaluateExpressionOptions &options = EvaluateExpressionOptions(),
- std::string *fixed_expression = nullptr,
- ValueObject *ctx_obj = nullptr);
+ std::string *fixed_expression = nullptr, ValueObject *ctx_obj = nullptr);
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name);
- /// Return the next available number for numbered persistent variables.
- unsigned GetNextPersistentVariableIndex() {
- return m_next_persistent_variable_index++;
- }
-
lldb::addr_t GetPersistentSymbol(ConstString name);
+ /// This method will return the address of the starting function for
+ /// this binary, e.g. main() or its equivalent. This can be used as
+ /// an address of a function that is not called once a binary has
+ /// started running - e.g. as a return address for inferior function
+ /// calls that are unambiguous completion of the function call, not
+ /// called during the course of the inferior function code running.
+ ///
+ /// If no entry point can be found, an invalid address is returned.
+ ///
+ /// \param [out] err
+ /// This object will be set to failure if no entry address could
+ /// be found, and may contain a helpful error message.
+ //
+ /// \return
+ /// Returns the entry address for this program, or an error
+ /// if none can be found.
+ llvm::Expected<lldb_private::Address> GetEntryPointAddress();
+
// Target Stop Hooks
class StopHook : public UserID {
public:
StopHook(const StopHook &rhs);
+ virtual ~StopHook() = default;
- ~StopHook();
-
- StringList *GetCommandPointer() { return &m_commands; }
-
- const StringList &GetCommands() { return m_commands; }
+ enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
+ enum class StopHookResult : uint32_t {
+ KeepStopped = 0,
+ RequestContinue,
+ AlreadyContinued
+ };
lldb::TargetSP &GetTarget() { return m_target_sp; }
- void SetCommands(StringList &in_commands) { m_commands = in_commands; }
-
// Set the specifier. The stop hook will own the specifier, and is
// responsible for deleting it when we're done.
void SetSpecifier(SymbolContextSpecifier *specifier);
SymbolContextSpecifier *GetSpecifier() { return m_specifier_sp.get(); }
+ bool ExecutionContextPasses(const ExecutionContext &exe_ctx);
+
+ // Called on stop, this gets passed the ExecutionContext for each "stop
+ // with a reason" thread. It should add to the stream whatever text it
+ // wants to show the user, and return False to indicate it wants the target
+ // not to stop.
+ virtual StopHookResult HandleStop(ExecutionContext &exe_ctx,
+ lldb::StreamSP output) = 0;
+
// Set the Thread Specifier. The stop hook will own the thread specifier,
// and is responsible for deleting it when we're done.
void SetThreadSpecifier(ThreadSpec *specifier);
@@ -1149,33 +1197,91 @@
void SetIsActive(bool is_active) { m_active = is_active; }
- void SetAutoContinue(bool auto_continue) {m_auto_continue = auto_continue;}
+ void SetAutoContinue(bool auto_continue) {
+ m_auto_continue = auto_continue;
+ }
bool GetAutoContinue() const { return m_auto_continue; }
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+ virtual void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const = 0;
- private:
+ protected:
lldb::TargetSP m_target_sp;
- StringList m_commands;
lldb::SymbolContextSpecifierSP m_specifier_sp;
std::unique_ptr<ThreadSpec> m_thread_spec_up;
bool m_active = true;
bool m_auto_continue = false;
+ StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
+ };
+
+ class StopHookCommandLine : public StopHook {
+ public:
+ virtual ~StopHookCommandLine() = default;
+
+ StringList &GetCommands() { return m_commands; }
+ void SetActionFromString(const std::string &strings);
+ void SetActionFromStrings(const std::vector<std::string> &strings);
+
+ StopHookResult HandleStop(ExecutionContext &exc_ctx,
+ lldb::StreamSP output_sp) override;
+ void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const override;
+
+ private:
+ StringList m_commands;
// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
// and fill it with commands, and SetSpecifier to set the specifier shared
// pointer (can be null, that will match anything.)
- StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid);
+ StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid)
+ : StopHook(target_sp, uid) {}
friend class Target;
};
+
+ class StopHookScripted : public StopHook {
+ public:
+ virtual ~StopHookScripted() = default;
+ StopHookResult HandleStop(ExecutionContext &exc_ctx,
+ lldb::StreamSP output) override;
+
+ Status SetScriptCallback(std::string class_name,
+ StructuredData::ObjectSP extra_args_sp);
+
+ void GetSubclassDescription(Stream *s,
+ lldb::DescriptionLevel level) const override;
+
+ private:
+ std::string m_class_name;
+ /// This holds the dictionary of keys & values that can be used to
+ /// parametrize any given callback's behavior.
+ StructuredDataImpl *m_extra_args; // We own this structured data,
+ // but the SD itself manages the UP.
+ /// This holds the python callback object.
+ StructuredData::GenericSP m_implementation_sp;
+
+ /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer
+ /// and fill it with commands, and SetSpecifier to set the specifier shared
+ /// pointer (can be null, that will match anything.)
+ StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid)
+ : StopHook(target_sp, uid) {}
+ friend class Target;
+ };
+
typedef std::shared_ptr<StopHook> StopHookSP;
- // Add an empty stop hook to the Target's stop hook list, and returns a
- // shared pointer to it in new_hook. Returns the id of the new hook.
- StopHookSP CreateStopHook();
+ /// Add an empty stop hook to the Target's stop hook list, and returns a
+ /// shared pointer to it in new_hook. Returns the id of the new hook.
+ StopHookSP CreateStopHook(StopHook::StopHookKind kind);
- void RunStopHooks();
+ /// If you tried to create a stop hook, and that failed, call this to
+ /// remove the stop hook, as it will also reset the stop hook counter.
+ void UndoCreateStopHook(lldb::user_id_t uid);
+
+ // Runs the stop hooks that have been registered for this target.
+ // Returns true if the stop hooks cause the target to resume.
+ bool RunStopHooks();
size_t GetStopHookSize();
@@ -1237,6 +1343,10 @@
void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp);
+ StackFrameRecognizerManager &GetFrameRecognizerManager() {
+ return *m_frame_recognizer_manager_up;
+ }
+
protected:
/// Implementing of ModuleList::Notifier.
@@ -1244,7 +1354,7 @@
const lldb::ModuleSP &module_sp) override;
void NotifyModuleRemoved(const ModuleList &module_list,
- const lldb::ModuleSP &module_sp) override;
+ const lldb::ModuleSP &module_sp) override;
void NotifyModuleUpdated(const ModuleList &module_list,
const lldb::ModuleSP &old_module_sp,
@@ -1271,6 +1381,12 @@
lldb::PlatformSP m_platform_sp; ///< The platform for this target.
std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
/// classes make the SB interface thread safe
+ /// When the private state thread calls SB API's - usually because it is
+ /// running OS plugin or Python ThreadPlan code - it should not block on the
+ /// API mutex that is held by the code that kicked off the sequence of events
+ /// that led us to run the code. We hand out this mutex instead when we
+ /// detect that code is running on the private state thread.
+ std::recursive_mutex m_private_mutex;
Arch m_arch;
ModuleList m_images; ///< The list of images for this process (shared
/// libraries and anything dynamically loaded).
@@ -1279,7 +1395,7 @@
BreakpointList m_internal_breakpoint_list;
using BreakpointNameList = std::map<ConstString, BreakpointName *>;
BreakpointNameList m_breakpoint_names;
-
+
lldb::BreakpointSP m_last_created_breakpoint;
WatchpointList m_watchpoint_list;
lldb::WatchpointSP m_last_created_watchpoint;
@@ -1294,8 +1410,7 @@
typedef std::map<lldb::LanguageType, lldb::REPLSP> REPLMap;
REPLMap m_repl_map;
- lldb::ClangASTImporterSP m_ast_importer_sp;
- lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_up;
+ std::unique_ptr<ClangModulesDeclVendor> m_clang_modules_decl_vendor_up;
lldb::SourceManagerUP m_source_manager_up;
@@ -1306,6 +1421,11 @@
bool m_suppress_stop_hooks;
bool m_is_dummy_target;
unsigned m_next_persistent_variable_index = 0;
+ /// An optional \a lldb_private::Trace object containing processor trace
+ /// information of this target.
+ lldb::TraceSP m_trace_sp;
+ /// Stores the frame recognizers of this target.
+ lldb::StackFrameRecognizerManagerUP m_frame_recognizer_manager_up;
static void ImageSearchPathsChanged(const PathMappingList &path_list,
void *baton);
@@ -1345,15 +1465,16 @@
bool ProcessIsValid();
// Copy breakpoints, stop hooks and so forth from the dummy target:
- void PrimeFromDummyTarget(Target *dummy_target);
+ void PrimeFromDummyTarget(Target &target);
void AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
void FinalizeFileActions(ProcessLaunchInfo &info);
- DISALLOW_COPY_AND_ASSIGN(Target);
+ Target(const Target &) = delete;
+ const Target &operator=(const Target &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Target_h_
+#endif // LLDB_TARGET_TARGET_H
diff --git a/linux-x64/clang/include/lldb/Target/TargetList.h b/linux-x64/clang/include/lldb/Target/TargetList.h
index ece0705..903ca4b 100644
--- a/linux-x64/clang/include/lldb/Target/TargetList.h
+++ b/linux-x64/clang/include/lldb/Target/TargetList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TargetList_h_
-#define liblldb_TargetList_h_
+#ifndef LLDB_TARGET_TARGETLIST_H
+#define LLDB_TARGET_TARGETLIST_H
#include <mutex>
#include <vector>
@@ -42,8 +42,6 @@
return GetStaticBroadcasterClass();
}
- ~TargetList() override;
-
/// Create a new Target.
///
/// Clients must use this function to create a Target. This allows
@@ -55,12 +53,12 @@
/// \param[in] debugger
/// The debugger to associate this target with
///
- /// \param[in] file_spec
+ /// \param[in] user_exe_path
/// The main executable file for a debug target. This value
- /// can be nullptr and the file can be set later using:
+ /// can be empty and the file can be set later using:
/// Target::SetExecutableModule (ModuleSP&)
///
- /// \param[in] triple_cstr
+ /// \param[in] triple_str
/// A target triple string to be used for the target. This can
/// be nullptr if the triple is not known or when attaching to a
/// process.
@@ -175,7 +173,9 @@
uint32_t SignalIfRunning(lldb::pid_t pid, int signo);
- uint32_t SetSelectedTarget(Target *target);
+ void SetSelectedTarget(uint32_t index);
+
+ void SetSelectedTarget(const lldb::TargetSP &target);
lldb::TargetSP GetSelectedTarget();
@@ -183,32 +183,30 @@
typedef std::vector<lldb::TargetSP> collection;
// Member variables.
collection m_target_list;
- lldb::TargetSP m_dummy_target_sp;
mutable std::recursive_mutex m_target_list_mutex;
uint32_t m_selected_target_idx;
private:
- lldb::TargetSP GetDummyTarget(lldb_private::Debugger &debugger);
+ static Status CreateTargetInternal(
+ Debugger &debugger, llvm::StringRef user_exe_path,
+ llvm::StringRef triple_str, LoadDependentFiles load_dependent_files,
+ const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp);
- Status CreateDummyTarget(Debugger &debugger,
- llvm::StringRef specified_arch_name,
- lldb::TargetSP &target_sp);
+ static Status CreateTargetInternal(Debugger &debugger,
+ llvm::StringRef user_exe_path,
+ const ArchSpec &arch,
+ LoadDependentFiles get_dependent_modules,
+ lldb::PlatformSP &platform_sp,
+ lldb::TargetSP &target_sp);
- Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
- llvm::StringRef triple_str,
- LoadDependentFiles load_dependent_files,
- const OptionGroupPlatform *platform_options,
- lldb::TargetSP &target_sp, bool is_dummy_target);
+ void AddTargetInternal(lldb::TargetSP target_sp, bool do_select);
- Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
- const ArchSpec &arch,
- LoadDependentFiles get_dependent_modules,
- lldb::PlatformSP &platform_sp,
- lldb::TargetSP &target_sp, bool is_dummy_target);
+ void SetSelectedTargetInternal(uint32_t index);
- DISALLOW_COPY_AND_ASSIGN(TargetList);
+ TargetList(const TargetList &) = delete;
+ const TargetList &operator=(const TargetList &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_TargetList_h_
+#endif // LLDB_TARGET_TARGETLIST_H
diff --git a/linux-x64/clang/include/lldb/Target/Thread.h b/linux-x64/clang/include/lldb/Target/Thread.h
index 7aeaece..4b14806 100644
--- a/linux-x64/clang/include/lldb/Target/Thread.h
+++ b/linux-x64/clang/include/lldb/Target/Thread.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Thread_h_
-#define liblldb_Thread_h_
+#ifndef LLDB_TARGET_THREAD_H
+#define LLDB_TARGET_THREAD_H
#include <memory>
#include <mutex>
@@ -19,6 +19,7 @@
#include "lldb/Target/RegisterCheckpoint.h"
#include "lldb/Target/StackFrameList.h"
#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/Event.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UserID.h"
@@ -28,6 +29,8 @@
namespace lldb_private {
+class ThreadPlanStack;
+
class ThreadProperties : public Properties {
public:
ThreadProperties(bool is_global);
@@ -111,7 +114,8 @@
lldb::ThreadSP m_thread_sp;
StackID m_stack_id;
- DISALLOW_COPY_AND_ASSIGN(ThreadEventData);
+ ThreadEventData(const ThreadEventData &) = delete;
+ const ThreadEventData &operator=(const ThreadEventData &) = delete;
};
struct ThreadStateCheckpoint {
@@ -119,7 +123,7 @@
// bit of data.
lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you
// might continue with the wrong signals.
- std::vector<lldb::ThreadPlanSP> m_completed_plan_stack;
+ size_t m_completed_plan_checkpoint;
lldb::RegisterCheckpointSP
register_backup_sp; // You need to restore the registers, of course...
uint32_t current_inlined_depth;
@@ -128,10 +132,6 @@
/// Constructor
///
- /// \param [in] process
- ///
- /// \param [in] tid
- ///
/// \param [in] use_invalid_index_id
/// Optional parameter, defaults to false. The only subclass that
/// is likely to set use_invalid_index_id == true is the HistoryThread
@@ -181,8 +181,6 @@
/// to force the thread to run (e.g. the "thread continue" command, or are
/// resetting the state
/// (e.g. in SBThread::Resume()), then pass true to override_suspend.
- /// \return
- /// The User resume state for this thread.
void SetResumeState(lldb::StateType state, bool override_suspend = false) {
if (m_resume_state == lldb::eStateSuspended && !override_suspend)
return;
@@ -220,6 +218,12 @@
virtual void RefreshStateAfterStop() = 0;
+ void SelectMostRelevantFrame();
+
+ std::string GetStopDescription();
+
+ std::string GetStopDescriptionRaw();
+
void WillStop();
bool ShouldStop(Event *event_ptr);
@@ -250,9 +254,9 @@
bool ThreadStoppedForAReason();
- static const char *RunModeAsCString(lldb::RunMode mode);
+ static std::string RunModeAsString(lldb::RunMode mode);
- static const char *StopReasonAsCString(lldb::StopReason reason);
+ static std::string StopReasonAsString(lldb::StopReason reason);
virtual const char *GetInfo() { return nullptr; }
@@ -465,6 +469,24 @@
// the backing thread for all memory threads each time we stop.
}
+ /// Dump \a count instructions of the thread's \a Trace starting at the \a
+ /// start_position position in reverse order.
+ ///
+ /// The instructions are indexed in reverse order, which means that the \a
+ /// start_position 0 represents the last instruction of the trace
+ /// chronologically.
+ ///
+ /// \param[in] s
+ /// The stream object where the instructions are printed.
+ ///
+ /// \param[in] count
+ /// The number of instructions to print.
+ ///
+ /// \param[in] start_position
+ /// The position of the first instruction to print.
+ void DumpTraceInstructions(Stream &s, size_t count,
+ size_t start_position = 0) const;
+
// If stop_format is true, this will be the form used when we print stop
// info. If false, it will be the form we use for thread list and co.
void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx,
@@ -760,6 +782,8 @@
/// \b true if we will stop other threads while we single step this one.
///
/// \param[in] stop_vote
+ /// See standard meanings for the stop & run votes in ThreadPlan.h.
+ ///
/// \param[in] run_vote
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
@@ -807,11 +831,13 @@
/// \b true if we will stop other threads while we single step this one.
///
/// \param[in] stop_vote
+ /// See standard meanings for the stop & run votes in ThreadPlan.h.
///
/// \param[in] run_vote
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
/// \param[in] frame_idx
+ /// The fame index.
///
/// \param[out] status
/// A status with an error if queuing failed.
@@ -899,15 +925,22 @@
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name,
+ StructuredData::ObjectSP extra_args_sp,
bool stop_other_threads, Status &status);
// Thread Plan accessors:
+ /// Format the thread plan information for auto completion.
+ ///
+ /// \param[in] request
+ /// The reference to the completion handler.
+ void AutoCompleteThreadPlans(CompletionRequest &request) const;
+
/// Gets the plan which will execute next on the plan stack.
///
/// \return
/// A pointer to the next executed plan.
- ThreadPlan *GetCurrentPlan();
+ ThreadPlan *GetCurrentPlan() const;
/// Unwinds the thread stack for the innermost expression plan currently
/// on the thread plan stack.
@@ -922,14 +955,14 @@
///
/// \return
/// A pointer to the last completed plan.
- lldb::ThreadPlanSP GetCompletedPlan();
+ lldb::ThreadPlanSP GetCompletedPlan() const;
/// Gets the outer-most return value from the completed plans
///
/// \return
/// A ValueObjectSP, either empty if there is no return value,
/// or containing the return value.
- lldb::ValueObjectSP GetReturnValueObject();
+ lldb::ValueObjectSP GetReturnValueObject() const;
/// Gets the outer-most expression variable from the completed plans
///
@@ -937,7 +970,7 @@
/// A ExpressionVariableSP, either empty if there is no
/// plan completed an expression during the current stop
/// or the expression variable that was made for the completed expression.
- lldb::ExpressionVariableSP GetExpressionVariable();
+ lldb::ExpressionVariableSP GetExpressionVariable() const;
/// Checks whether the given plan is in the completed plans for this
/// stop.
@@ -948,7 +981,7 @@
/// \return
/// Returns true if the input plan is in the completed plan stack,
/// false otherwise.
- bool IsThreadPlanDone(ThreadPlan *plan);
+ bool IsThreadPlanDone(ThreadPlan *plan) const;
/// Checks whether the given plan is in the discarded plans for this
/// stop.
@@ -959,14 +992,14 @@
/// \return
/// Returns true if the input plan is in the discarded plan stack,
/// false otherwise.
- bool WasThreadPlanDiscarded(ThreadPlan *plan);
+ bool WasThreadPlanDiscarded(ThreadPlan *plan) const;
/// Check if we have completed plan to override breakpoint stop reason
///
/// \return
/// Returns true if completed plan stack is not empty
/// false otherwise.
- bool CompletedPlanOverridesBreakpoint();
+ bool CompletedPlanOverridesBreakpoint() const;
/// Queues a generic thread plan.
///
@@ -1003,7 +1036,7 @@
/// including the plan in that matches \a thread_index counting only
/// the non-Private plans.
///
- /// \param[in] up_to_plan_sp
+ /// \param[in] thread_index
/// Discard all plans up to and including this user plan given by this
/// index.
///
@@ -1012,16 +1045,6 @@
/// otherwise.
bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index);
- /// Prints the current plan stack.
- ///
- /// \param[in] s
- /// The stream to which to dump the plan stack info.
- ///
- void DumpThreadPlans(
- Stream *s,
- lldb::DescriptionLevel desc_level = lldb::eDescriptionLevelVerbose,
- bool include_internal = true, bool ignore_boring = false) const;
-
virtual bool CheckpointThreadState(ThreadStateCheckpoint &saved_state);
virtual bool
@@ -1102,6 +1125,17 @@
// with what you might have calculated.
virtual lldb::StopInfoSP GetPrivateStopInfo();
+ // Calculate the stop info that will be shown to lldb clients. For instance,
+ // a "step out" is implemented by running to a breakpoint on the function
+ // return PC, so the process plugin initially sets the stop info to a
+ // StopInfoBreakpoint. But once we've run the ShouldStop machinery, we
+ // discover that there's a completed ThreadPlanStepOut, and that's really
+ // the StopInfo we want to show. That will happen naturally the next
+ // time GetStopInfo is called, but if you want to force the replacement,
+ // you can call this.
+
+ void CalculatePublicStopInfo();
+
// Ask the thread subclass to set its stop info.
//
// Thread subclasses should call Thread::SetStopInfo(...) with the reason the
@@ -1139,7 +1173,7 @@
/// Some Thread subclasses may maintain a token to help with providing
/// an extended backtrace. The SystemRuntime plugin will set/request this.
///
- /// \param [in] token
+ /// \param [in] token The extended backtrace token.
virtual void SetExtendedBacktraceToken(uint64_t token) {}
/// Gets the extended backtrace token for this thread
@@ -1169,17 +1203,17 @@
// be called by classes that derive from Thread in their destructor.
virtual void DestroyThread();
- void PushPlan(lldb::ThreadPlanSP &plan_sp);
+ ThreadPlanStack &GetPlans() const;
+
+ void PushPlan(lldb::ThreadPlanSP plan_sp);
void PopPlan();
void DiscardPlan();
- ThreadPlan *GetPreviousPlan(ThreadPlan *plan);
+ ThreadPlan *GetPreviousPlan(ThreadPlan *plan) const;
- typedef std::vector<lldb::ThreadPlanSP> plan_stack;
-
- virtual lldb_private::Unwind *GetUnwinder();
+ virtual Unwind &GetUnwinder();
// Check to see whether the thread is still at the last breakpoint hit that
// stopped it.
@@ -1203,7 +1237,7 @@
m_temporary_resume_state = new_state;
}
- void FunctionOptimizationWarning(lldb_private::StackFrame *frame);
+ void FrameSelectedCallback(lldb_private::StackFrame *frame);
// Classes that inherit from Process can see and modify these
lldb::ProcessWP m_process_wp; ///< The process that owns this thread.
@@ -1222,13 +1256,6 @@
lldb::StateType m_state; ///< The state of our process.
mutable std::recursive_mutex
m_state_mutex; ///< Multithreaded protection for m_state.
- plan_stack m_plan_stack; ///< The stack of plans this thread is executing.
- plan_stack m_completed_plan_stack; ///< Plans that have been completed by this
- ///stop. They get deleted when the thread
- ///resumes.
- plan_stack m_discarded_plan_stack; ///< Plans that have been discarded by this
- ///stop. They get deleted when the thread
- ///resumes.
mutable std::recursive_mutex
m_frame_mutex; ///< Multithreaded protection for m_state.
lldb::StackFrameListSP m_curr_frames_sp; ///< The stack frames that get lazily
@@ -1249,20 +1276,19 @@
bool m_destroy_called; // This is used internally to make sure derived Thread
// classes call DestroyThread.
LazyBool m_override_should_notify;
+ mutable std::unique_ptr<ThreadPlanStack> m_null_plan_stack_up;
private:
bool m_extended_info_fetched; // Have we tried to retrieve the m_extended_info
// for this thread?
StructuredData::ObjectSP m_extended_info; // The extended info for this thread
-private:
- bool PlanIsBasePlan(ThreadPlan *plan_ptr);
-
void BroadcastSelectedFrameChange(StackID &new_frame_id);
- DISALLOW_COPY_AND_ASSIGN(Thread);
+ Thread(const Thread &) = delete;
+ const Thread &operator=(const Thread &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Thread_h_
+#endif // LLDB_TARGET_THREAD_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadCollection.h b/linux-x64/clang/include/lldb/Target/ThreadCollection.h
index 29ea827..40dc938 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadCollection.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadCollection.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadCollection_h_
-#define liblldb_ThreadCollection_h_
+#ifndef LLDB_TARGET_THREADCOLLECTION_H
+#define LLDB_TARGET_THREADCOLLECTION_H
#include <mutex>
#include <vector>
@@ -56,4 +56,4 @@
} // namespace lldb_private
-#endif // liblldb_ThreadCollection_h_
+#endif // LLDB_TARGET_THREADCOLLECTION_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadList.h b/linux-x64/clang/include/lldb/Target/ThreadList.h
index 64ddf5a..6af04f8 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadList.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadList_h_
-#define liblldb_ThreadList_h_
+#ifndef LLDB_TARGET_THREADLIST_H
+#define LLDB_TARGET_THREADLIST_H
#include <mutex>
#include <vector>
@@ -156,4 +156,4 @@
} // namespace lldb_private
-#endif // liblldb_ThreadList_h_
+#endif // LLDB_TARGET_THREADLIST_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlan.h b/linux-x64/clang/include/lldb/Target/ThreadPlan.h
index ff87ed2..f4cd2b1 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlan.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlan.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlan_h_
-#define liblldb_ThreadPlan_h_
+#ifndef LLDB_TARGET_THREADPLAN_H
+#define LLDB_TARGET_THREADPLAN_H
#include <mutex>
#include <string>
@@ -23,310 +23,260 @@
namespace lldb_private {
// ThreadPlan:
+//
// This is the pure virtual base class for thread plans.
//
-// The thread plans provide the "atoms" of behavior that
-// all the logical process control, either directly from commands or through
-// more complex composite plans will rely on.
+// The thread plans provide the "atoms" of behavior that all the logical
+// process control, either directly from commands or through more complex
+// composite plans will rely on.
//
// Plan Stack:
//
-// The thread maintaining a thread plan stack, and you program the actions of a
-// particular thread
-// by pushing plans onto the plan stack.
-// There is always a "Current" plan, which is the top of the plan stack,
-// though in some cases
+// The thread maintaining a thread plan stack, and you program the actions of
+// a particular thread by pushing plans onto the plan stack. There is always
+// a "Current" plan, which is the top of the plan stack, though in some cases
// a plan may defer to plans higher in the stack for some piece of information
// (let us define that the plan stack grows downwards).
//
// The plan stack is never empty, there is always a Base Plan which persists
-// through the life
-// of the running process.
+// through the life of the running process.
//
//
// Creating Plans:
//
-// The thread plan is generally created and added to the plan stack through the
-// QueueThreadPlanFor... API
-// in lldb::Thread. Those API's will return the plan that performs the named
-// operation in a manner
-// appropriate for the current process. The plans in lldb/source/Target are
-// generic
+// The thread plan is generally created and added to the plan stack through
+// the QueueThreadPlanFor... API in lldb::Thread. Those API's will return the
+// plan that performs the named operation in a manner appropriate for the
+// current process. The plans in lldb/source/Target are generic
// implementations, but a Process plugin can override them.
//
// ValidatePlan is then called. If it returns false, the plan is unshipped.
-// This is a little
-// convenience which keeps us from having to error out of the constructor.
+// This is a little convenience which keeps us from having to error out of the
+// constructor.
//
// Then the plan is added to the plan stack. When the plan is added to the
-// plan stack its DidPush
-// will get called. This is useful if a plan wants to push any additional
-// plans as it is constructed,
-// since you need to make sure you're already on the stack before you push
-// additional plans.
+// plan stack its DidPush will get called. This is useful if a plan wants to
+// push any additional plans as it is constructed, since you need to make sure
+// you're already on the stack before you push additional plans.
//
// Completed Plans:
//
-// When the target process stops the plans are queried, among other things, for
-// whether their job is done.
-// If it is they are moved from the plan stack to the Completed Plan stack in
-// reverse order from their position
-// on the plan stack (since multiple plans may be done at a given stop.) This
-// is used primarily so that
-// the lldb::Thread::StopInfo for the thread can be set properly. If one plan
-// pushes another to achieve part of
-// its job, but it doesn't want that sub-plan to be the one that sets the
-// StopInfo, then call SetPrivate on the
-// sub-plan when you create it, and the Thread will pass over that plan in
-// reporting the reason for the stop.
+// When the target process stops the plans are queried, among other things,
+// for whether their job is done. If it is they are moved from the plan stack
+// to the Completed Plan stack in reverse order from their position on the
+// plan stack (since multiple plans may be done at a given stop.) This is
+// used primarily so that the lldb::Thread::StopInfo for the thread can be set
+// properly. If one plan pushes another to achieve part of its job, but it
+// doesn't want that sub-plan to be the one that sets the StopInfo, then call
+// SetPrivate on the sub-plan when you create it, and the Thread will pass
+// over that plan in reporting the reason for the stop.
//
// Discarded plans:
//
// Your plan may also get discarded, i.e. moved from the plan stack to the
-// "discarded plan stack". This can
-// happen, for instance, if the plan is calling a function and the function
-// call crashes and you want
-// to unwind the attempt to call. So don't assume that your plan will always
-// successfully stop. Which leads to:
+// "discarded plan stack". This can happen, for instance, if the plan is
+// calling a function and the function call crashes and you want to unwind the
+// attempt to call. So don't assume that your plan will always successfully
+// stop. Which leads to:
//
// Cleaning up after your plans:
//
// When the plan is moved from the plan stack its WillPop method is always
-// called, no matter why. Once it is
-// moved off the plan stack it is done, and won't get a chance to run again.
-// So you should
-// undo anything that affects target state in this method. But be sure to
-// leave the plan able to correctly
-// fill the StopInfo, however.
-// N.B. Don't wait to do clean up target state till the destructor, since that
-// will usually get called when
+// called, no matter why. Once it is moved off the plan stack it is done, and
+// won't get a chance to run again. So you should undo anything that affects
+// target state in this method. But be sure to leave the plan able to
+// correctly fill the StopInfo, however. N.B. Don't wait to do clean up
+// target state till the destructor, since that will usually get called when
// the target resumes, and you want to leave the target state correct for new
-// plans in the time between when
-// your plan gets unshipped and the next resume.
+// plans in the time between when your plan gets unshipped and the next
+// resume.
//
// Thread State Checkpoint:
//
-// Note that calling functions on target process (ThreadPlanCallFunction) changes
-// current thread state. The function can be called either by direct user demand or
-// internally, for example lldb allocates memory on device to calculate breakpoint
-// condition expression - on Linux it is performed by calling mmap on device.
-// ThreadStateCheckpoint saves Thread state (stop info and completed
-// plan stack) to restore it after completing function call.
+// Note that calling functions on target process (ThreadPlanCallFunction)
+// changes current thread state. The function can be called either by direct
+// user demand or internally, for example lldb allocates memory on device to
+// calculate breakpoint condition expression - on Linux it is performed by
+// calling mmap on device. ThreadStateCheckpoint saves Thread state (stop
+// info and completed plan stack) to restore it after completing function
+// call.
//
// Over the lifetime of the plan, various methods of the ThreadPlan are then
-// called in response to changes of state in
-// the process we are debugging as follows:
+// called in response to changes of state in the process we are debugging as
+// follows:
//
// Resuming:
//
// When the target process is about to be restarted, the plan's WillResume
-// method is called,
-// giving the plan a chance to prepare for the run. If WillResume returns
-// false, then the
-// process is not restarted. Be sure to set an appropriate error value in the
-// Process if
-// you have to do this. Note, ThreadPlans actually implement DoWillResume,
-// WillResume wraps that call.
+// method is called, giving the plan a chance to prepare for the run. If
+// WillResume returns false, then the process is not restarted. Be sure to
+// set an appropriate error value in the Process if you have to do this.
+// Note, ThreadPlans actually implement DoWillResume, WillResume wraps that
+// call.
//
// Next the "StopOthers" method of all the threads are polled, and if one
-// thread's Current plan
-// returns "true" then only that thread gets to run. If more than one returns
-// "true" the threads that want to run solo
-// get run one by one round robin fashion. Otherwise all are let to run.
+// thread's Current plan returns "true" then only that thread gets to run. If
+// more than one returns "true" the threads that want to run solo get run one
+// by one round robin fashion. Otherwise all are let to run.
//
// Note, the way StopOthers is implemented, the base class implementation just
-// asks the previous plan. So if your plan
-// has no opinion about whether it should run stopping others or not, just
-// don't implement StopOthers, and the parent
-// will be asked.
+// asks the previous plan. So if your plan has no opinion about whether it
+// should run stopping others or not, just don't implement StopOthers, and the
+// parent will be asked.
//
// Finally, for each thread that is running, it run state is set to the return
-// of RunState from the
-// thread's Current plan.
+// of RunState from the thread's Current plan.
//
// Responding to a stop:
//
// When the target process stops, the plan is called in the following stages:
//
-// First the thread asks the Current Plan if it can handle this stop by calling
-// PlanExplainsStop.
-// If the Current plan answers "true" then it is asked if the stop should
-// percolate all the way to the
-// user by calling the ShouldStop method. If the current plan doesn't explain
-// the stop, then we query up
-// the plan stack for a plan that does explain the stop. The plan that does
-// explain the stop then needs to
-// figure out what to do about the plans below it in the stack. If the stop is
-// recoverable, then the plan that
-// understands it can just do what it needs to set up to restart, and then
-// continue.
-// Otherwise, the plan that understood the stop should call DiscardPlanStack to
-// clean up the stack below it.
-// Note, plans actually implement DoPlanExplainsStop, the result is cached in
-// PlanExplainsStop so the DoPlanExplainsStop
-// itself will only get called once per stop.
+// First the thread asks the Current Plan if it can handle this stop by
+// calling PlanExplainsStop. If the Current plan answers "true" then it is
+// asked if the stop should percolate all the way to the user by calling the
+// ShouldStop method. If the current plan doesn't explain the stop, then we
+// query up the plan stack for a plan that does explain the stop. The plan
+// that does explain the stop then needs to figure out what to do about the
+// plans below it in the stack. If the stop is recoverable, then the plan
+// that understands it can just do what it needs to set up to restart, and
+// then continue. Otherwise, the plan that understood the stop should call
+// DiscardPlanStack to clean up the stack below it. Note, plans actually
+// implement DoPlanExplainsStop, the result is cached in PlanExplainsStop so
+// the DoPlanExplainsStop itself will only get called once per stop.
//
// Master plans:
//
-// In the normal case, when we decide to stop, we will collapse the plan stack
-// up to the point of the plan that understood
-// the stop reason. However, if a plan wishes to stay on the stack after an
-// event it didn't directly handle
-// it can designate itself a "Master" plan by responding true to IsMasterPlan,
-// and then if it wants not to be
-// discarded, it can return false to OkayToDiscard, and it and all its dependent
-// plans will be preserved when
-// we resume execution.
+// In the normal case, when we decide to stop, we will collapse the plan
+// stack up to the point of the plan that understood the stop reason.
+// However, if a plan wishes to stay on the stack after an event it didn't
+// directly handle it can designate itself a "Master" plan by responding true
+// to IsMasterPlan, and then if it wants not to be discarded, it can return
+// false to OkayToDiscard, and it and all its dependent plans will be
+// preserved when we resume execution.
//
-// The other effect of being a master plan is that when the Master plan is done
-// , if it has set "OkayToDiscard" to false,
-// then it will be popped & execution will stop and return to the user.
-// Remember that if OkayToDiscard is false, the
-// plan will be popped and control will be given to the next plan above it on
-// the stack So setting OkayToDiscard to
-// false means the user will regain control when the MasterPlan is completed.
+// The other effect of being a master plan is that when the Master plan is
+// done , if it has set "OkayToDiscard" to false, then it will be popped &
+// execution will stop and return to the user. Remember that if OkayToDiscard
+// is false, the plan will be popped and control will be given to the next
+// plan above it on the stack So setting OkayToDiscard to false means the
+// user will regain control when the MasterPlan is completed.
//
-// Between these two controls this allows things like: a MasterPlan/DontDiscard
-// Step Over to hit a breakpoint, stop and
-// return control to the user, but then when the user continues, the step out
-// succeeds.
-// Even more tricky, when the breakpoint is hit, the user can continue to step
-// in/step over/etc, and finally when they
-// continue, they will finish up the Step Over.
+// Between these two controls this allows things like: a
+// MasterPlan/DontDiscard Step Over to hit a breakpoint, stop and return
+// control to the user, but then when the user continues, the step out
+// succeeds. Even more tricky, when the breakpoint is hit, the user can
+// continue to step in/step over/etc, and finally when they continue, they
+// will finish up the Step Over.
//
// FIXME: MasterPlan & OkayToDiscard aren't really orthogonal. MasterPlan
-// designation means that this plan controls
-// it's fate and the fate of plans below it. OkayToDiscard tells whether the
-// MasterPlan wants to stay on the stack. I
-// originally thought "MasterPlan-ness" would need to be a fixed characteristic
-// of a ThreadPlan, in which case you needed
-// the extra control. But that doesn't seem to be true. So we should be able
-// to convert to only MasterPlan status to mean
-// the current "MasterPlan/DontDiscard". Then no plans would be MasterPlans by
-// default, and you would set the ones you
+// designation means that this plan controls it's fate and the fate of plans
+// below it. OkayToDiscard tells whether the MasterPlan wants to stay on the
+// stack. I originally thought "MasterPlan-ness" would need to be a fixed
+// characteristic of a ThreadPlan, in which case you needed the extra control.
+// But that doesn't seem to be true. So we should be able to convert to only
+// MasterPlan status to mean the current "MasterPlan/DontDiscard". Then no
+// plans would be MasterPlans by default, and you would set the ones you
// wanted to be "user level" in this way.
//
//
// Actually Stopping:
//
// If a plan says responds "true" to ShouldStop, then it is asked if it's job
-// is complete by calling
-// MischiefManaged. If that returns true, the plan is popped from the plan
-// stack and added to the
-// Completed Plan Stack. Then the next plan in the stack is asked if it
-// ShouldStop, and it returns "true",
-// it is asked if it is done, and if yes popped, and so on till we reach a plan
-// that is not done.
+// is complete by calling MischiefManaged. If that returns true, the plan is
+// popped from the plan stack and added to the Completed Plan Stack. Then the
+// next plan in the stack is asked if it ShouldStop, and it returns "true",
+// it is asked if it is done, and if yes popped, and so on till we reach a
+// plan that is not done.
//
-// Since you often know in the ShouldStop method whether your plan is complete,
-// as a convenience you can call
-// SetPlanComplete and the ThreadPlan implementation of MischiefManaged will
-// return "true", without your having
-// to redo the calculation when your sub-classes MischiefManaged is called. If
-// you call SetPlanComplete, you can
-// later use IsPlanComplete to determine whether the plan is complete. This is
-// only a convenience for sub-classes,
+// Since you often know in the ShouldStop method whether your plan is
+// complete, as a convenience you can call SetPlanComplete and the ThreadPlan
+// implementation of MischiefManaged will return "true", without your having
+// to redo the calculation when your sub-classes MischiefManaged is called.
+// If you call SetPlanComplete, you can later use IsPlanComplete to determine
+// whether the plan is complete. This is only a convenience for sub-classes,
// the logic in lldb::Thread will only call MischiefManaged.
//
-// One slightly tricky point is you have to be careful using SetPlanComplete in
-// PlanExplainsStop because you
-// are not guaranteed that PlanExplainsStop for a plan will get called before
-// ShouldStop gets called. If your sub-plan
+// One slightly tricky point is you have to be careful using SetPlanComplete
+// in PlanExplainsStop because you are not guaranteed that PlanExplainsStop
+// for a plan will get called before ShouldStop gets called. If your sub-plan
// explained the stop and then popped itself, only your ShouldStop will get
// called.
//
-// If ShouldStop for any thread returns "true", then the WillStop method of the
-// Current plan of
-// all threads will be called, the stop event is placed on the Process's public
-// broadcaster, and
-// control returns to the upper layers of the debugger.
+// If ShouldStop for any thread returns "true", then the WillStop method of
+// the Current plan of all threads will be called, the stop event is placed on
+// the Process's public broadcaster, and control returns to the upper layers
+// of the debugger.
//
// Reporting the stop:
//
// When the process stops, the thread is given a StopReason, in the form of a
-// StopInfo object. If there is a completed
-// plan corresponding to the stop, then the "actual" stop reason can be
-// suppressed, and instead a StopInfoThreadPlan
-// object will be cons'ed up from the top completed plan in the stack.
-// However, if the plan doesn't want to be
-// the stop reason, then it can call SetPlanComplete and pass in "false" for
-// the "success" parameter. In that case,
-// the real stop reason will be used instead. One exapmle of this is the
-// "StepRangeStepIn" thread plan. If it stops
-// because of a crash or breakpoint hit, it wants to unship itself, because it
-// isn't so useful to have step in keep going
-// after a breakpoint hit. But it can't be the reason for the stop or no-one
-// would see that they had hit a breakpoint.
+// StopInfo object. If there is a completed plan corresponding to the stop,
+// then the "actual" stop reason can be suppressed, and instead a
+// StopInfoThreadPlan object will be cons'ed up from the top completed plan in
+// the stack. However, if the plan doesn't want to be the stop reason, then
+// it can call SetPlanComplete and pass in "false" for the "success"
+// parameter. In that case, the real stop reason will be used instead. One
+// example of this is the "StepRangeStepIn" thread plan. If it stops because
+// of a crash or breakpoint hit, it wants to unship itself, because it isn't
+// so useful to have step in keep going after a breakpoint hit. But it can't
+// be the reason for the stop or no-one would see that they had hit a
+// breakpoint.
//
// Cleaning up the plan stack:
//
// One of the complications of MasterPlans is that you may get past the limits
-// of a plan without triggering it to clean
-// itself up. For instance, if you are doing a MasterPlan StepOver, and hit a
-// breakpoint in a called function, then
-// step over enough times to step out of the initial StepOver range, each of
-// the step overs will explain the stop &
-// take themselves off the stack, but control would never be returned to the
-// original StepOver. Eventually, the user
-// will continue, and when that continue stops, the old stale StepOver plan
-// that was left on the stack will get woken
-// up and notice it is done. But that can leave junk on the stack for a while.
-// To avoid that, the plans implement a
-// "IsPlanStale" method, that can check whether it is relevant anymore. On
-// stop, after the regular plan negotiation,
-// the remaining plan stack is consulted and if any plan says it is stale, it
-// and the plans below it are discarded from
-// the stack.
+// of a plan without triggering it to clean itself up. For instance, if you
+// are doing a MasterPlan StepOver, and hit a breakpoint in a called function,
+// then step over enough times to step out of the initial StepOver range, each
+// of the step overs will explain the stop & take themselves off the stack,
+// but control would never be returned to the original StepOver. Eventually,
+// the user will continue, and when that continue stops, the old stale
+// StepOver plan that was left on the stack will get woken up and notice it is
+// done. But that can leave junk on the stack for a while. To avoid that, the
+// plans implement a "IsPlanStale" method, that can check whether it is
+// relevant anymore. On stop, after the regular plan negotiation, the
+// remaining plan stack is consulted and if any plan says it is stale, it and
+// the plans below it are discarded from the stack.
//
// Automatically Resuming:
//
// If ShouldStop for all threads returns "false", then the target process will
-// resume. This then cycles back to
-// Resuming above.
+// resume. This then cycles back to Resuming above.
//
// Reporting eStateStopped events when the target is restarted:
//
// If a plan decides to auto-continue the target by returning "false" from
-// ShouldStop, then it will be asked
-// whether the Stopped event should still be reported. For instance, if you
-// hit a breakpoint that is a User set
-// breakpoint, but the breakpoint callback said to continue the target process,
-// you might still want to inform
-// the upper layers of lldb that the stop had happened.
-// The way this works is every thread gets to vote on whether to report the
-// stop. If all votes are eVoteNoOpinion,
-// then the thread list will decide what to do (at present it will pretty much
-// always suppress these stopped events.)
-// If there is an eVoteYes, then the event will be reported regardless of the
-// other votes. If there is an eVoteNo
-// and no eVoteYes's, then the event won't be reported.
+// ShouldStop, then it will be asked whether the Stopped event should still be
+// reported. For instance, if you hit a breakpoint that is a User set
+// breakpoint, but the breakpoint callback said to continue the target
+// process, you might still want to inform the upper layers of lldb that the
+// stop had happened. The way this works is every thread gets to vote on
+// whether to report the stop. If all votes are eVoteNoOpinion, then the
+// thread list will decide what to do (at present it will pretty much always
+// suppress these stopped events.) If there is an eVoteYes, then the event
+// will be reported regardless of the other votes. If there is an eVoteNo and
+// no eVoteYes's, then the event won't be reported.
//
// One other little detail here, sometimes a plan will push another plan onto
-// the plan stack to do some part of
-// the first plan's job, and it would be convenient to tell that plan how it
-// should respond to ShouldReportStop.
+// the plan stack to do some part of the first plan's job, and it would be
+// convenient to tell that plan how it should respond to ShouldReportStop.
// You can do that by setting the stop_vote in the child plan when you create
// it.
//
// Suppressing the initial eStateRunning event:
//
// The private process running thread will take care of ensuring that only one
-// "eStateRunning" event will be
-// delivered to the public Process broadcaster per public eStateStopped event.
-// However there are some cases
-// where the public state of this process is eStateStopped, but a thread plan
-// needs to restart the target, but
-// doesn't want the running event to be publicly broadcast. The obvious
-// example of this is running functions
-// by hand as part of expression evaluation. To suppress the running event
-// return eVoteNo from ShouldReportStop,
-// to force a running event to be reported return eVoteYes, in general though
-// you should return eVoteNoOpinion
-// which will allow the ThreadList to figure out the right thing to do.
-// The run_vote argument to the constructor works like stop_vote, and is a way
-// for a plan to instruct a sub-plan
-// on how to respond to ShouldReportStop.
-//
+// "eStateRunning" event will be delivered to the public Process broadcaster
+// per public eStateStopped event. However there are some cases where the
+// public state of this process is eStateStopped, but a thread plan needs to
+// restart the target, but doesn't want the running event to be publicly
+// broadcast. The obvious example of this is running functions by hand as
+// part of expression evaluation. To suppress the running event return
+// eVoteNo from ShouldReportStop, to force a running event to be reported
+// return eVoteYes, in general though you should return eVoteNoOpinion which
+// will allow the ThreadList to figure out the right thing to do. The
+// run_vote argument to the constructor works like stop_vote, and is a way for
+// a plan to instruct a sub-plan on how to respond to ShouldReportStop.
class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
public UserID {
@@ -369,16 +319,16 @@
///
/// \return
/// A pointer to the thread plan's owning thread.
- Thread &GetThread() { return m_thread; }
+ Thread &GetThread();
- const Thread &GetThread() const { return m_thread; }
+ Target &GetTarget();
- Target &GetTarget() { return m_thread.GetProcess()->GetTarget(); }
-
- const Target &GetTarget() const { return m_thread.GetProcess()->GetTarget(); }
+ const Target &GetTarget() const;
/// Print a description of this thread to the stream \a s.
- /// \a thread.
+ /// \a thread. Don't expect that the result of GetThread is valid in
+ /// the description method. This might get called when the underlying
+ /// Thread has not been reported, so we only know the TID and not the thread.
///
/// \param[in] s
/// The stream to which to print the description.
@@ -461,8 +411,12 @@
virtual void WillPop();
// This pushes a plan onto the plan stack of the current plan's thread.
+ // Also sets the plans to private and not master plans. A plan pushed by
+ // another thread plan is never either of the above.
void PushPlan(lldb::ThreadPlanSP &thread_plan_sp) {
- m_thread.PushPlan(thread_plan_sp);
+ GetThread().PushPlan(thread_plan_sp);
+ thread_plan_sp->SetPrivate(false);
+ thread_plan_sp->SetIsMasterPlan(false);
}
ThreadPlanKind GetKind() const { return m_kind; }
@@ -493,7 +447,9 @@
// original stop reason so that stopping and calling a few functions won't
// lose the history of the run. This call can be implemented to get you back
// to the real stop info.
- virtual lldb::StopInfoSP GetRealStopInfo() { return m_thread.GetStopInfo(); }
+ virtual lldb::StopInfoSP GetRealStopInfo() {
+ return GetThread().GetStopInfo();
+ }
// If the completion of the thread plan stepped out of a function, the return
// value of the function might have been captured by the thread plan
@@ -556,17 +512,17 @@
// This is mostly a formal requirement, it allows us to make the Thread's
// GetPreviousPlan protected, but only friend ThreadPlan to thread.
- ThreadPlan *GetPreviousPlan() { return m_thread.GetPreviousPlan(this); }
+ ThreadPlan *GetPreviousPlan() { return GetThread().GetPreviousPlan(this); }
// This forwards the private Thread::GetPrivateStopInfo which is generally
// what ThreadPlan's need to know.
lldb::StopInfoSP GetPrivateStopInfo() {
- return m_thread.GetPrivateStopInfo();
+ return GetThread().GetPrivateStopInfo();
}
void SetStopInfo(lldb::StopInfoSP stop_reason_sp) {
- m_thread.SetStopInfo(stop_reason_sp);
+ GetThread().SetStopInfo(stop_reason_sp);
}
void CachePlanExplainsStop(bool does_explain) {
@@ -582,7 +538,8 @@
bool IsUsuallyUnexplainedStopReason(lldb::StopReason);
Status m_status;
- Thread &m_thread;
+ Process &m_process;
+ lldb::tid_t m_tid;
Vote m_stop_vote;
Vote m_run_vote;
bool m_takes_iteration_count;
@@ -593,6 +550,9 @@
// For ThreadPlan only
static lldb::user_id_t GetNextID();
+ Thread *m_thread; // Stores a cached value of the thread, which is set to
+ // nullptr when the thread resumes. Don't use this anywhere
+ // but ThreadPlan::GetThread().
ThreadPlanKind m_kind;
std::string m_name;
std::recursive_mutex m_plan_complete_mutex;
@@ -605,8 +565,8 @@
lldb::ThreadPlanTracerSP m_tracer_sp;
-private:
- DISALLOW_COPY_AND_ASSIGN(ThreadPlan);
+ ThreadPlan(const ThreadPlan &) = delete;
+ const ThreadPlan &operator=(const ThreadPlan &) = delete;
};
// ThreadPlanNull:
@@ -641,9 +601,10 @@
lldb::StateType GetPlanRunState() override;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanNull);
+ ThreadPlanNull(const ThreadPlanNull &) = delete;
+ const ThreadPlanNull &operator=(const ThreadPlanNull &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_h_
+#endif // LLDB_TARGET_THREADPLAN_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h b/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h
index bc92a06..48058a9 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanBase.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanFundamental_h_
-#define liblldb_ThreadPlanFundamental_h_
+#ifndef LLDB_TARGET_THREADPLANBASE_H
+#define LLDB_TARGET_THREADPLANBASE_H
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
@@ -47,9 +47,10 @@
friend lldb::ThreadPlanSP
Thread::QueueFundamentalPlan(bool abort_other_plans);
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanBase);
+ ThreadPlanBase(const ThreadPlanBase &) = delete;
+ const ThreadPlanBase &operator=(const ThreadPlanBase &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanFundamental_h_
+#endif // LLDB_TARGET_THREADPLANBASE_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h
index 685160a..5b432e5 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunction.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanCallFunction_h_
-#define liblldb_ThreadPlanCallFunction_h_
+#ifndef LLDB_TARGET_THREADPLANCALLFUNCTION_H
+#define LLDB_TARGET_THREADPLANCALLFUNCTION_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -146,9 +146,11 @@
private:
CompilerType m_return_type;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallFunction);
+ ThreadPlanCallFunction(const ThreadPlanCallFunction &) = delete;
+ const ThreadPlanCallFunction &
+ operator=(const ThreadPlanCallFunction &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunction_h_
+#endif // LLDB_TARGET_THREADPLANCALLFUNCTION_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
index c21e4d3..af343d8 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanCallFunctionUsingABI_h_
-#define liblldb_ThreadPlanCallFunctionUsingABI_h_
+#ifndef LLDB_TARGET_THREADPLANCALLFUNCTIONUSINGABI_H
+#define LLDB_TARGET_THREADPLANCALLFUNCTIONUSINGABI_H
#include "lldb/Target/ABI.h"
#include "lldb/Target/Thread.h"
@@ -44,9 +44,12 @@
private:
llvm::Type &m_return_type;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallFunctionUsingABI);
+ ThreadPlanCallFunctionUsingABI(const ThreadPlanCallFunctionUsingABI &) =
+ delete;
+ const ThreadPlanCallFunctionUsingABI &
+ operator=(const ThreadPlanCallFunctionUsingABI &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
+#endif // LLDB_TARGET_THREADPLANCALLFUNCTIONUSINGABI_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
index ad3ee6e..1dd6a04 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallOnFunctionExit.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef ThreadPlanCallOnFunctionExit_h
-#define ThreadPlanCallOnFunctionExit_h
+#ifndef LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
+#define LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
#include "lldb/Target/ThreadPlan.h"
@@ -50,4 +50,4 @@
};
}
-#endif /* ThreadPlanCallOnFunctionExit_h */
+#endif // LLDB_TARGET_THREADPLANCALLONFUNCTIONEXIT_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h b/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h
index 6372155..adaea6c 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanCallUserExpression_h_
-#define liblldb_ThreadPlanCallUserExpression_h_
+#ifndef LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H
+#define LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -56,9 +56,11 @@
m_result_var_sp; // If we are left to manage the materialization,
// then stuff the result expression variable here.
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanCallUserExpression);
+ ThreadPlanCallUserExpression(const ThreadPlanCallUserExpression &) = delete;
+ const ThreadPlanCallUserExpression &
+ operator=(const ThreadPlanCallUserExpression &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallUserExpression_h_
+#endif // LLDB_TARGET_THREADPLANCALLUSEREXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h b/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h
index 3825bf6..7b37b2b 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanPython.h
@@ -7,11 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlan_Python_h_
-#define liblldb_ThreadPlan_Python_h_
+#ifndef LLDB_TARGET_THREADPLANPYTHON_H
+#define LLDB_TARGET_THREADPLANPYTHON_H
#include <string>
+#include "lldb/lldb-forward.h"
+
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
@@ -29,7 +31,8 @@
class ThreadPlanPython : public ThreadPlan {
public:
- ThreadPlanPython(Thread &thread, const char *class_name);
+ ThreadPlanPython(Thread &thread, const char *class_name,
+ StructuredDataImpl *args_data);
~ThreadPlanPython() override;
void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
@@ -42,7 +45,9 @@
bool WillStop() override;
- bool StopOthers() override;
+ bool StopOthers() override { return m_stop_others; }
+
+ void SetStopOthers(bool new_value) override { m_stop_others = new_value; }
void DidPush() override;
@@ -52,15 +57,24 @@
bool DoPlanExplainsStop(Event *event_ptr) override;
lldb::StateType GetPlanRunState() override;
+
+ ScriptInterpreter *GetScriptInterpreter();
private:
std::string m_class_name;
+ StructuredDataImpl *m_args_data; // We own this, but the implementation
+ // has to manage the UP (since that is
+ // how it gets stored in the
+ // SBStructuredData).
+ std::string m_error_str;
StructuredData::ObjectSP m_implementation_sp;
bool m_did_push;
+ bool m_stop_others;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
+ ThreadPlanPython(const ThreadPlanPython &) = delete;
+ const ThreadPlanPython &operator=(const ThreadPlanPython &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_Python_h_
+#endif // LLDB_TARGET_THREADPLANPYTHON_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h b/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h
index d82a9fa..10b8ec6 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanRunToAddress_h_
-#define liblldb_ThreadPlanRunToAddress_h_
+#ifndef LLDB_TARGET_THREADPLANRUNTOADDRESS_H
+#define LLDB_TARGET_THREADPLANRUNTOADDRESS_H
#include <vector>
@@ -59,9 +59,11 @@
std::vector<lldb::break_id_t> m_break_ids; // This is the breakpoint we are
// using to stop us at m_address.
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanRunToAddress);
+ ThreadPlanRunToAddress(const ThreadPlanRunToAddress &) = delete;
+ const ThreadPlanRunToAddress &
+ operator=(const ThreadPlanRunToAddress &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanRunToAddress_h_
+#endif // LLDB_TARGET_THREADPLANRUNTOADDRESS_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h b/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h
index dfcbbb3..54b3029 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanShouldStopHere_h_
-#define liblldb_ThreadPlanShouldStopHere_h_
+#ifndef LLDB_TARGET_THREADPLANSHOULDSTOPHERE_H
+#define LLDB_TARGET_THREADPLANSHOULDSTOPHERE_H
#include "lldb/Target/ThreadPlan.h"
@@ -130,9 +130,11 @@
lldb_private::Flags m_flags;
private:
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanShouldStopHere);
+ ThreadPlanShouldStopHere(const ThreadPlanShouldStopHere &) = delete;
+ const ThreadPlanShouldStopHere &
+ operator=(const ThreadPlanShouldStopHere &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanShouldStopHere_h_
+#endif // LLDB_TARGET_THREADPLANSHOULDSTOPHERE_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStack.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStack.h
new file mode 100644
index 0000000..f187413
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStack.h
@@ -0,0 +1,173 @@
+//===-- ThreadPlanStack.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_THREADPLANSTACK_H
+#define LLDB_TARGET_THREADPLANSTACK_H
+
+#include <mutex>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+// The ThreadPlans have a thread for use when they are asked all the ThreadPlan
+// state machine questions, but they should never cache any pointers from their
+// owning lldb_private::Thread. That's because we want to be able to detach
+// them from an owning thread, then reattach them by TID.
+// The ThreadPlanStack holds the ThreadPlans for a given TID. All its methods
+// are private, and it should only be accessed through the owning thread. When
+// it is detached from a thread, all you can do is reattach it or delete it.
+class ThreadPlanStack {
+ friend class lldb_private::Thread;
+
+public:
+ ThreadPlanStack(const Thread &thread, bool make_empty = false);
+ ~ThreadPlanStack() {}
+
+ enum StackKind { ePlans, eCompletedPlans, eDiscardedPlans };
+
+ using PlanStack = std::vector<lldb::ThreadPlanSP>;
+
+ void DumpThreadPlans(Stream &s, lldb::DescriptionLevel desc_level,
+ bool include_internal) const;
+
+ size_t CheckpointCompletedPlans();
+
+ void RestoreCompletedPlanCheckpoint(size_t checkpoint);
+
+ void DiscardCompletedPlanCheckpoint(size_t checkpoint);
+
+ void ThreadDestroyed(Thread *thread);
+
+ void EnableTracer(bool value, bool single_stepping);
+
+ void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp);
+
+ void PushPlan(lldb::ThreadPlanSP new_plan_sp);
+
+ lldb::ThreadPlanSP PopPlan();
+
+ lldb::ThreadPlanSP DiscardPlan();
+
+ // If the input plan is nullptr, discard all plans. Otherwise make sure this
+ // plan is in the stack, and if so discard up to and including it.
+ void DiscardPlansUpToPlan(ThreadPlan *up_to_plan_ptr);
+
+ void DiscardAllPlans();
+
+ void DiscardConsultingMasterPlans();
+
+ lldb::ThreadPlanSP GetCurrentPlan() const;
+
+ lldb::ThreadPlanSP GetCompletedPlan(bool skip_private = true) const;
+
+ lldb::ThreadPlanSP GetPlanByIndex(uint32_t plan_idx,
+ bool skip_private = true) const;
+
+ lldb::ValueObjectSP GetReturnValueObject() const;
+
+ lldb::ExpressionVariableSP GetExpressionVariable() const;
+
+ bool AnyPlans() const;
+
+ bool AnyCompletedPlans() const;
+
+ bool AnyDiscardedPlans() const;
+
+ bool IsPlanDone(ThreadPlan *plan) const;
+
+ bool WasPlanDiscarded(ThreadPlan *plan) const;
+
+ ThreadPlan *GetPreviousPlan(ThreadPlan *current_plan) const;
+
+ ThreadPlan *GetInnermostExpression() const;
+
+ void WillResume();
+
+private:
+ const PlanStack &GetStackOfKind(ThreadPlanStack::StackKind kind) const;
+
+ void PrintOneStack(Stream &s, llvm::StringRef stack_name,
+ const PlanStack &stack, lldb::DescriptionLevel desc_level,
+ bool include_internal) const;
+
+ PlanStack m_plans; ///< The stack of plans this thread is executing.
+ PlanStack m_completed_plans; ///< Plans that have been completed by this
+ /// stop. They get deleted when the thread
+ /// resumes.
+ PlanStack m_discarded_plans; ///< Plans that have been discarded by this
+ /// stop. They get deleted when the thread
+ /// resumes.
+ size_t m_completed_plan_checkpoint = 0; // Monotonically increasing token for
+ // completed plan checkpoints.
+ std::unordered_map<size_t, PlanStack> m_completed_plan_store;
+};
+
+class ThreadPlanStackMap {
+public:
+ ThreadPlanStackMap(Process &process) : m_process(process) {}
+ ~ThreadPlanStackMap() {}
+
+ // Prune the map using the current_threads list.
+ void Update(ThreadList ¤t_threads, bool delete_missing,
+ bool check_for_new = true);
+
+ void AddThread(Thread &thread) {
+ lldb::tid_t tid = thread.GetID();
+ m_plans_list.emplace(tid, thread);
+ }
+
+ bool RemoveTID(lldb::tid_t tid) {
+ auto result = m_plans_list.find(tid);
+ if (result == m_plans_list.end())
+ return false;
+ result->second.ThreadDestroyed(nullptr);
+ m_plans_list.erase(result);
+ return true;
+ }
+
+ ThreadPlanStack *Find(lldb::tid_t tid) {
+ auto result = m_plans_list.find(tid);
+ if (result == m_plans_list.end())
+ return nullptr;
+ else
+ return &result->second;
+ }
+
+ void Clear() {
+ for (auto plan : m_plans_list)
+ plan.second.ThreadDestroyed(nullptr);
+ m_plans_list.clear();
+ }
+
+ // Implements Process::DumpThreadPlans
+ void DumpPlans(Stream &strm, lldb::DescriptionLevel desc_level, bool internal,
+ bool ignore_boring, bool skip_unreported);
+
+ // Implements Process::DumpThreadPlansForTID
+ bool DumpPlansForTID(Stream &strm, lldb::tid_t tid,
+ lldb::DescriptionLevel desc_level, bool internal,
+ bool ignore_boring, bool skip_unreported);
+
+ bool PrunePlansForTID(lldb::tid_t tid);
+
+private:
+ Process &m_process;
+ using PlansList = std::unordered_map<lldb::tid_t, ThreadPlanStack>;
+ PlansList m_plans_list;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_THREADPLANSTACK_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h
index a120c98..a26b0fb 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInRange.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepInRange_h_
-#define liblldb_ThreadPlanStepInRange_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPINRANGE_H
+#define LLDB_TARGET_THREADPLANSTEPINRANGE_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Target/StackID.h"
@@ -26,13 +26,6 @@
LazyBool step_in_avoids_code_without_debug_info,
LazyBool step_out_avoids_code_without_debug_info);
- ThreadPlanStepInRange(Thread &thread, const AddressRange &range,
- const SymbolContext &addr_context,
- const char *step_into_function_name,
- lldb::RunMode stop_others,
- LazyBool step_in_avoids_code_without_debug_info,
- LazyBool step_out_avoids_code_without_debug_info);
-
~ThreadPlanStepInRange() override;
void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
@@ -49,6 +42,12 @@
bool IsVirtualStep() override;
+ // Plans that are implementing parts of a step in might need to follow the
+ // behavior of this plan w.r.t. StepThrough. They can get that from here.
+ static uint32_t GetDefaultFlagsValue() {
+ return s_default_flag_values;
+ }
+
protected:
static bool DefaultShouldStopHereCallback(ThreadPlan *current_plan,
Flags &flags,
@@ -72,17 +71,6 @@
bool FrameMatchesAvoidCriteria();
private:
- friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOverRange(
- bool abort_other_plans, const AddressRange &range,
- const SymbolContext &addr_context, lldb::RunMode stop_others,
- Status &status, LazyBool avoid_code_without_debug_info);
- friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepInRange(
- bool abort_other_plans, const AddressRange &range,
- const SymbolContext &addr_context, const char *step_in_target,
- lldb::RunMode stop_others, Status &status,
- LazyBool step_in_avoids_code_without_debug_info,
- LazyBool step_out_avoids_code_without_debug_info);
-
void SetupAvoidNoDebug(LazyBool step_in_avoids_code_without_debug_info,
LazyBool step_out_avoids_code_without_debug_info);
// Need an appropriate marker for the current stack so we can tell step out
@@ -99,9 +87,11 @@
bool m_virtual_step; // true if we've just done a "virtual step", i.e. just
// moved the inline stack depth.
ConstString m_step_into_target;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInRange);
+ ThreadPlanStepInRange(const ThreadPlanStepInRange &) = delete;
+ const ThreadPlanStepInRange &
+ operator=(const ThreadPlanStepInRange &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInRange_h_
+#endif // LLDB_TARGET_THREADPLANSTEPINRANGE_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h
index 127de41..760bc48 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepInstruction_h_
-#define liblldb_ThreadPlanStepInstruction_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPINSTRUCTION_H
+#define LLDB_TARGET_THREADPLANSTEPINSTRUCTION_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -49,9 +49,11 @@
StackID m_stack_id;
StackID m_parent_frame_id;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepInstruction);
+ ThreadPlanStepInstruction(const ThreadPlanStepInstruction &) = delete;
+ const ThreadPlanStepInstruction &
+ operator=(const ThreadPlanStepInstruction &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInstruction_h_
+#endif // LLDB_TARGET_THREADPLANSTEPINSTRUCTION_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h
index 00984db..5c39232 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOut.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepOut_h_
-#define liblldb_ThreadPlanStepOut_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPOUT_H
+#define LLDB_TARGET_THREADPLANSTEPOUT_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -72,6 +72,7 @@
std::vector<lldb::StackFrameSP> m_stepped_past_frames;
lldb::ValueObjectSP m_return_valobj_sp;
bool m_calculate_return_value;
+ StreamString m_constructor_errors;
friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut(
bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
@@ -84,9 +85,10 @@
void CalculateReturnValue();
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOut);
+ ThreadPlanStepOut(const ThreadPlanStepOut &) = delete;
+ const ThreadPlanStepOut &operator=(const ThreadPlanStepOut &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOut_h_
+#endif // LLDB_TARGET_THREADPLANSTEPOUT_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
index 7df7049..86f7798 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepOverBreakpoint_h_
-#define liblldb_ThreadPlanStepOverBreakpoint_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPOVERBREAKPOINT_H
+#define LLDB_TARGET_THREADPLANSTEPOVERBREAKPOINT_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -47,9 +47,11 @@
bool m_auto_continue;
bool m_reenabled_breakpoint_site;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOverBreakpoint);
+ ThreadPlanStepOverBreakpoint(const ThreadPlanStepOverBreakpoint &) = delete;
+ const ThreadPlanStepOverBreakpoint &
+ operator=(const ThreadPlanStepOverBreakpoint &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
+#endif // LLDB_TARGET_THREADPLANSTEPOVERBREAKPOINT_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h
index 30763e3..8585ac6 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepOverRange_h_
-#define liblldb_ThreadPlanStepOverRange_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPOVERRANGE_H
+#define LLDB_TARGET_THREADPLANSTEPOVERRANGE_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Target/StackID.h"
@@ -45,9 +45,11 @@
bool m_first_resume;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepOverRange);
+ ThreadPlanStepOverRange(const ThreadPlanStepOverRange &) = delete;
+ const ThreadPlanStepOverRange &
+ operator=(const ThreadPlanStepOverRange &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverRange_h_
+#endif // LLDB_TARGET_THREADPLANSTEPOVERRANGE_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h
index 93d54ad..2fe8852 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepRange.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepRange_h_
-#define liblldb_ThreadPlanStepRange_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPRANGE_H
+#define LLDB_TARGET_THREADPLANSTEPRANGE_H
#include "lldb/Core/AddressRange.h"
#include "lldb/Target/StackID.h"
@@ -76,13 +76,20 @@
lldb::BreakpointSP m_next_branch_bp_sp;
bool m_use_fast_step;
bool m_given_ranges_only;
+ bool m_found_calls = false; // When we set the next branch breakpoint for
+ // step over, we now extend them past call insns
+ // that directly return. But if we do that we
+ // need to run all threads, or we might cause
+ // deadlocks. This tells us whether we found
+ // any calls in setting the next branch breakpoint.
private:
std::vector<lldb::DisassemblerSP> m_instruction_ranges;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepRange);
+ ThreadPlanStepRange(const ThreadPlanStepRange &) = delete;
+ const ThreadPlanStepRange &operator=(const ThreadPlanStepRange &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepRange_h_
+#endif // LLDB_TARGET_THREADPLANSTEPRANGE_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h
index 0d06212..8926225 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepThrough.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepThrough_h_
-#define liblldb_ThreadPlanStepThrough_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPTHROUGH_H
+#define LLDB_TARGET_THREADPLANSTEPTHROUGH_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -53,9 +53,11 @@
StackID m_return_stack_id;
bool m_stop_others;
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepThrough);
+ ThreadPlanStepThrough(const ThreadPlanStepThrough &) = delete;
+ const ThreadPlanStepThrough &
+ operator=(const ThreadPlanStepThrough &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepThrough_h_
+#endif // LLDB_TARGET_THREADPLANSTEPTHROUGH_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h b/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h
index 9a5934a..27e1f85 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanStepUntil.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanStepUntil_h_
-#define liblldb_ThreadPlanStepUntil_h_
+#ifndef LLDB_TARGET_THREADPLANSTEPUNTIL_H
+#define LLDB_TARGET_THREADPLANSTEPUNTIL_H
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
@@ -59,9 +59,10 @@
// Need an appropriate marker for the current stack so we can tell step out
// from step in.
- DISALLOW_COPY_AND_ASSIGN(ThreadPlanStepUntil);
+ ThreadPlanStepUntil(const ThreadPlanStepUntil &) = delete;
+ const ThreadPlanStepUntil &operator=(const ThreadPlanStepUntil &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepUntil_h_
+#endif // LLDB_TARGET_THREADPLANSTEPUNTIL_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h b/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h
index 80b0807..677a2c0 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadPlanTracer.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadPlanTracer_h_
-#define liblldb_ThreadPlanTracer_h_
+#ifndef LLDB_TARGET_THREADPLANTRACER_H
+#define LLDB_TARGET_THREADPLANTRACER_H
#include "lldb/Symbol/TaggedASTType.h"
#include "lldb/Target/Thread.h"
@@ -57,9 +57,12 @@
}
bool SingleStepEnabled() { return m_single_step; }
+
+ Thread &GetThread();
protected:
- Thread &m_thread;
+ Process &m_process;
+ lldb::tid_t m_tid;
Stream *GetLogStream();
@@ -71,6 +74,7 @@
bool m_single_step;
bool m_enabled;
lldb::StreamSP m_stream_sp;
+ Thread *m_thread;
};
class ThreadPlanAssemblyTracer : public ThreadPlanTracer {
@@ -96,4 +100,4 @@
} // namespace lldb_private
-#endif // liblldb_ThreadPlanTracer_h_
+#endif // LLDB_TARGET_THREADPLANTRACER_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadSpec.h b/linux-x64/clang/include/lldb/Target/ThreadSpec.h
index 05e7dcd..8c22d53 100644
--- a/linux-x64/clang/include/lldb/Target/ThreadSpec.h
+++ b/linux-x64/clang/include/lldb/Target/ThreadSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ThreadSpec_h_
-#define liblldb_ThreadSpec_h_
+#ifndef LLDB_TARGET_THREADSPEC_H
+#define LLDB_TARGET_THREADSPEC_H
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
@@ -46,9 +46,11 @@
void SetTID(lldb::tid_t tid) { m_tid = tid; }
- void SetName(llvm::StringRef name) { m_name = name; }
+ void SetName(llvm::StringRef name) { m_name = std::string(name); }
- void SetQueueName(llvm::StringRef queue_name) { m_queue_name = queue_name; }
+ void SetQueueName(llvm::StringRef queue_name) {
+ m_queue_name = std::string(queue_name);
+ }
uint32_t GetIndex() const { return m_index; }
@@ -126,4 +128,4 @@
} // namespace lldb_private
-#endif // liblldb_ThreadSpec_h_
+#endif // LLDB_TARGET_THREADSPEC_H
diff --git a/linux-x64/clang/include/lldb/Target/ThreadTrace.h b/linux-x64/clang/include/lldb/Target/ThreadTrace.h
new file mode 100644
index 0000000..a32b338
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/ThreadTrace.h
@@ -0,0 +1,61 @@
+//===-- ThreadTrace.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_THREADTRACE_H
+#define LLDB_TARGET_THREADTRACE_H
+
+#include "lldb/Target/Thread.h"
+
+namespace lldb_private {
+
+/// \class ThreadTrace ThreadTrace.h
+///
+/// Thread implementation used for representing threads gotten from trace
+/// session files, which are similar to threads from core files.
+///
+/// See \a TraceSessionFileParser for more information regarding trace session
+/// files.
+class ThreadTrace : public Thread {
+public:
+ /// \param[in] process
+ /// The process who owns this thread.
+ ///
+ /// \param[in] tid
+ /// The tid of this thread.
+ ///
+ /// \param[in] trace_file.
+ /// The file that contains the list of instructions that were traced when
+ /// this thread was being executed.
+ ThreadTrace(Process &process, lldb::tid_t tid, const FileSpec &trace_file)
+ : Thread(process, tid), m_trace_file(trace_file) {}
+
+ void RefreshStateAfterStop() override;
+
+ lldb::RegisterContextSP GetRegisterContext() override;
+
+ lldb::RegisterContextSP
+ CreateRegisterContextForFrame(StackFrame *frame) override;
+
+ /// \return
+ /// The trace file of this thread.
+ const FileSpec &GetTraceFile() const;
+
+protected:
+ bool CalculateStopInfo() override;
+
+ lldb::RegisterContextSP m_thread_reg_ctx_sp;
+
+private:
+ FileSpec m_trace_file;
+};
+
+typedef std::shared_ptr<ThreadTrace> ThreadTraceSP;
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_THREADTRACE_H
diff --git a/linux-x64/clang/include/lldb/Target/Trace.h b/linux-x64/clang/include/lldb/Target/Trace.h
new file mode 100644
index 0000000..3b12791
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/Trace.h
@@ -0,0 +1,203 @@
+//===-- Trace.h -------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_TRACE_H
+#define LLDB_TARGET_TRACE_H
+
+#include "llvm/Support/JSON.h"
+
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/UnimplementedError.h"
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// \class Trace Trace.h "lldb/Target/Trace.h"
+/// A plug-in interface definition class for trace information.
+///
+/// Trace plug-ins allow processor trace information to be loaded into LLDB so
+/// that the data can be dumped, used for reverse and forward stepping to allow
+/// introspection into the reason your process crashed or found its way to its
+/// current state.
+///
+/// Trace information can be loaded into a target without a process to allow
+/// introspection of the trace information during post mortem analysis, such as
+/// when loading core files.
+///
+/// Processor trace information can also be fetched through the process
+/// interfaces during a live debug session if your process supports gathering
+/// this information.
+///
+/// In order to support live tracing, the name of the plug-in should match the
+/// name of the tracing type returned by the gdb-remote packet
+/// \a jLLDBTraceSupportedType.
+class Trace : public PluginInterface,
+ public std::enable_shared_from_this<Trace> {
+public:
+ enum class TraceDirection {
+ Forwards = 0,
+ Backwards,
+ };
+
+ /// Dump the trace data that this plug-in has access to.
+ ///
+ /// This function will dump all of the trace data for all threads in a user
+ /// readable format. Options for dumping can be added as this API is iterated
+ /// on.
+ ///
+ /// \param[in] s
+ /// A stream object to dump the information to.
+ virtual void Dump(Stream *s) const = 0;
+
+ /// Find a trace plug-in using JSON data.
+ ///
+ /// When loading trace data from disk, the information for the trace data
+ /// can be contained in multiple files and require plug-in specific
+ /// information about the CPU. Using data like JSON provides an
+ /// easy way to specify all of the settings and information that we will need
+ /// to load trace data into LLDB. This structured data can include:
+ /// - The plug-in name (this allows a specific plug-in to be selected)
+ /// - Architecture or target triple
+ /// - one or more paths to the trace data file on disk
+ /// - core trace data
+ /// - thread events or related information
+ /// - shared library load information to use for this trace data that
+ /// allows a target to be created so the trace information can be
+ /// symbolicated so that the trace information can be displayed to the
+ /// user
+ /// - shared library path
+ /// - load address
+ /// - information on how to fetch the shared library
+ /// - path to locally cached file on disk
+ /// - URL to download the file
+ /// - Any information needed to load the trace file
+ /// - CPU information
+ /// - Custom plug-in information needed to decode the trace information
+ /// correctly.
+ ///
+ /// \param[in] debugger
+ /// The debugger instance where new Targets will be created as part of the
+ /// JSON data parsing.
+ ///
+ /// \param[in] trace_session_file
+ /// The contents of the trace session file describing the trace session.
+ /// See \a TraceSessionFileParser::BuildSchema for more information about
+ /// the schema of this JSON file.
+ ///
+ /// \param[in] session_file_dir
+ /// The path to the directory that contains the session file. It's used to
+ /// resolved relative paths in the session file.
+ static llvm::Expected<lldb::TraceSP>
+ FindPlugin(Debugger &debugger, const llvm::json::Value &trace_session_file,
+ llvm::StringRef session_file_dir);
+
+ /// Get the schema of a Trace plug-in given its name.
+ ///
+ /// \param[in] plugin_name
+ /// Name of the trace plugin.
+ static llvm::Expected<llvm::StringRef>
+ FindPluginSchema(llvm::StringRef plugin_name);
+
+ /// \return
+ /// The JSON schema of this Trace plug-in.
+ virtual llvm::StringRef GetSchema() = 0;
+
+ /// Each decoded thread contains a cursor to the current position the user is
+ /// stopped at. When reverse debugging, each operation like reverse-next or
+ /// reverse-continue will move this cursor, which is then picked by any
+ /// subsequent dump or reverse operation.
+ ///
+ /// The initial position for this cursor is the last element of the thread,
+ /// which is the most recent chronologically.
+ ///
+ /// \return
+ /// The current position of the thread's trace or \b 0 if empty.
+ virtual size_t GetCursorPosition(const Thread &thread) = 0;
+
+ /// Dump \a count instructions of the given thread's trace ending at the
+ /// given \a end_position position.
+ ///
+ /// The instructions are printed along with their indices or positions, which
+ /// are increasing chronologically. This means that the \a index 0 represents
+ /// the oldest instruction of the trace chronologically.
+ ///
+ /// \param[in] thread
+ /// The thread whose trace will be dumped.
+ ///
+ /// \param[in] s
+ /// The stream object where the instructions are printed.
+ ///
+ /// \param[in] count
+ /// The number of instructions to print.
+ ///
+ /// \param[in] end_position
+ /// The position of the last instruction to print.
+ ///
+ /// \param[in] raw
+ /// Dump only instruction addresses without disassembly nor symbol
+ /// information.
+ void DumpTraceInstructions(Thread &thread, Stream &s, size_t count,
+ size_t end_position, bool raw);
+
+ /// Run the provided callback on the instructions of the trace of the given
+ /// thread.
+ ///
+ /// The instructions will be traversed starting at the given \a position
+ /// sequentially until the callback returns \b false, in which case no more
+ /// instructions are inspected.
+ ///
+ /// The purpose of this method is to allow inspecting traced instructions
+ /// without exposing the internal representation of how they are stored on
+ /// memory.
+ ///
+ /// \param[in] thread
+ /// The thread whose trace will be traversed.
+ ///
+ /// \param[in] position
+ /// The instruction position to start iterating on.
+ ///
+ /// \param[in] direction
+ /// If \b TraceDirection::Forwards, then then instructions will be
+ /// traversed forwards chronologically, i.e. with incrementing indices. If
+ /// \b TraceDirection::Backwards, the traversal is done backwards
+ /// chronologically, i.e. with decrementing indices.
+ ///
+ /// \param[in] callback
+ /// The callback to execute on each instruction. If it returns \b false,
+ /// the iteration stops.
+ virtual void TraverseInstructions(
+ const Thread &thread, size_t position, TraceDirection direction,
+ std::function<bool(size_t index, llvm::Expected<lldb::addr_t> load_addr)>
+ callback) = 0;
+
+ /// Stop tracing a live thread
+ ///
+ /// \param[in] thread
+ /// The thread object to stop tracing.
+ ///
+ /// \return
+ /// An \a llvm::Error if stopping tracing failed, or \b
+ /// llvm::Error::success() otherwise.
+ virtual llvm::Error StopTracingThread(const Thread &thread) {
+ return llvm::make_error<UnimplementedError>();
+ }
+
+ /// Get the number of available instructions in the trace of the given thread.
+ ///
+ /// \param[in] thread
+ /// The thread whose trace will be inspected.
+ ///
+ /// \return
+ /// The total number of instructions in the trace.
+ virtual size_t GetInstructionCount(const Thread &thread) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_TRACE_H
diff --git a/linux-x64/clang/include/lldb/Target/TraceSessionFileParser.h b/linux-x64/clang/include/lldb/Target/TraceSessionFileParser.h
new file mode 100644
index 0000000..52cc27c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/TraceSessionFileParser.h
@@ -0,0 +1,179 @@
+//===-- TraceSessionFileParser.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_TRACESESSIONPARSER_H
+#define LLDB_TARGET_TRACESESSIONPARSER_H
+
+#include "llvm/Support/JSON.h"
+
+#include "lldb/Target/ThreadTrace.h"
+
+namespace lldb_private {
+
+/// \class TraceSessionFileParser TraceSessionFileParser.h
+///
+/// Base class for parsing the common information of JSON trace session files.
+/// Contains the basic C++ structs that represent the JSON data, which include
+/// \a JSONTraceSession as the root object.
+///
+/// See \a Trace::FindPlugin for more information regarding these JSON files.
+class TraceSessionFileParser {
+public:
+ /// C++ structs representing the JSON trace session.
+ /// \{
+ struct JSONAddress {
+ lldb::addr_t value;
+ };
+
+ struct JSONModule {
+ std::string system_path;
+ llvm::Optional<std::string> file;
+ JSONAddress load_address;
+ llvm::Optional<std::string> uuid;
+ };
+
+ struct JSONThread {
+ int64_t tid;
+ std::string trace_file;
+ };
+
+ struct JSONProcess {
+ int64_t pid;
+ std::string triple;
+ std::vector<JSONThread> threads;
+ std::vector<JSONModule> modules;
+ };
+
+ struct JSONTracePluginSettings {
+ std::string type;
+ };
+
+ struct JSONTraceSessionBase {
+ std::vector<JSONProcess> processes;
+ };
+
+ /// The trace plug-in implementation should provide its own TPluginSettings,
+ /// which corresponds to the "trace" section of the schema.
+ template <class TPluginSettings>
+ struct JSONTraceSession : JSONTraceSessionBase {
+ TPluginSettings trace;
+ };
+ /// \}
+
+ /// Helper struct holding the objects created when parsing a process
+ struct ParsedProcess {
+ lldb::TargetSP target_sp;
+ std::vector<ThreadTraceSP> threads;
+ };
+
+ TraceSessionFileParser(Debugger &debugger, llvm::StringRef session_file_dir,
+ llvm::StringRef schema)
+ : m_debugger(debugger), m_session_file_dir(session_file_dir),
+ m_schema(schema) {}
+
+ /// Build the full schema for a Trace plug-in.
+ ///
+ /// \param[in] plugin_schema
+ /// The subschema that corresponds to the "trace" section of the schema.
+ ///
+ /// \return
+ /// The full schema containing the common attributes and the plug-in
+ /// specific attributes.
+ static std::string BuildSchema(llvm::StringRef plugin_schema);
+
+ /// Parse the fields common to all trace session schemas.
+ ///
+ /// \param[in] session
+ /// The session json objects already deserialized.
+ ///
+ /// \return
+ /// A list of \a ParsedProcess containing all threads and targets created
+ /// during the parsing, or an error in case of failures. In case of
+ /// errors, no side effects are produced.
+ llvm::Expected<std::vector<ParsedProcess>>
+ ParseCommonSessionFile(const JSONTraceSessionBase &session);
+
+protected:
+ /// Resolve non-absolute paths relative to the session file folder. It
+ /// modifies the given file_spec.
+ void NormalizePath(lldb_private::FileSpec &file_spec);
+
+ ThreadTraceSP ParseThread(lldb::ProcessSP &process_sp,
+ const JSONThread &thread);
+
+ llvm::Expected<ParsedProcess> ParseProcess(const JSONProcess &process);
+
+ llvm::Error ParseModule(lldb::TargetSP &target_sp, const JSONModule &module);
+
+ /// Create a user-friendly error message upon a JSON-parsing failure using the
+ /// \a json::ObjectMapper functionality.
+ ///
+ /// \param[in] root
+ /// The \a llvm::json::Path::Root used to parse the JSON \a value.
+ ///
+ /// \param[in] value
+ /// The json value that failed to parse.
+ ///
+ /// \return
+ /// An \a llvm::Error containing the user-friendly error message.
+ llvm::Error CreateJSONError(llvm::json::Path::Root &root,
+ const llvm::json::Value &value);
+
+ Debugger &m_debugger;
+ std::string m_session_file_dir;
+ llvm::StringRef m_schema;
+};
+} // namespace lldb_private
+
+namespace llvm {
+namespace json {
+
+bool fromJSON(const Value &value,
+ lldb_private::TraceSessionFileParser::JSONAddress &address,
+ Path path);
+
+bool fromJSON(const Value &value,
+ lldb_private::TraceSessionFileParser::JSONModule &module,
+ Path path);
+
+bool fromJSON(const Value &value,
+ lldb_private::TraceSessionFileParser::JSONThread &thread,
+ Path path);
+
+bool fromJSON(const Value &value,
+ lldb_private::TraceSessionFileParser::JSONProcess &process,
+ Path path);
+
+bool fromJSON(const Value &value,
+ lldb_private::TraceSessionFileParser::JSONTracePluginSettings
+ &plugin_settings,
+ Path path);
+
+bool fromJSON(
+ const Value &value,
+ lldb_private::TraceSessionFileParser::JSONTraceSessionBase &session,
+ Path path);
+
+template <class TPluginSettings>
+bool fromJSON(
+ const Value &value,
+ lldb_private::TraceSessionFileParser::JSONTraceSession<TPluginSettings>
+ &session,
+ Path path) {
+ ObjectMapper o(value, path);
+ return o && o.map("trace", session.trace) &&
+ fromJSON(value,
+ (lldb_private::TraceSessionFileParser::JSONTraceSessionBase &)
+ session,
+ path);
+}
+
+} // namespace json
+} // namespace llvm
+
+#endif // LLDB_TARGET_TRACESESSIONPARSER_H
diff --git a/linux-x64/clang/include/lldb/Target/UnixSignals.h b/linux-x64/clang/include/lldb/Target/UnixSignals.h
index 120ffdd..cc24b76 100644
--- a/linux-x64/clang/include/lldb/Target/UnixSignals.h
+++ b/linux-x64/clang/include/lldb/Target/UnixSignals.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_UnixSignals_h_
-#define lldb_UnixSignals_h_
+#ifndef LLDB_TARGET_UNIXSIGNALS_H
+#define LLDB_TARGET_UNIXSIGNALS_H
#include <map>
#include <string>
@@ -126,4 +126,4 @@
};
} // Namespace lldb
-#endif // lldb_UnixSignals_h_
+#endif // LLDB_TARGET_UNIXSIGNALS_H
diff --git a/linux-x64/clang/include/lldb/Target/Unwind.h b/linux-x64/clang/include/lldb/Target/Unwind.h
index a648e06..783b710 100644
--- a/linux-x64/clang/include/lldb/Target/Unwind.h
+++ b/linux-x64/clang/include/lldb/Target/Unwind.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Unwind_h_
-#define liblldb_Unwind_h_
+#ifndef LLDB_TARGET_UNWIND_H
+#define LLDB_TARGET_UNWIND_H
#include <mutex>
@@ -37,9 +37,10 @@
lldb::addr_t cfa;
lldb::addr_t pc;
uint32_t idx;
+ bool behaves_like_zeroth_frame = (end_idx == 0);
for (idx = 0; idx < end_idx; idx++) {
- if (!DoGetFrameInfoAtIndex(idx, cfa, pc)) {
+ if (!DoGetFrameInfoAtIndex(idx, cfa, pc, behaves_like_zeroth_frame)) {
break;
}
}
@@ -47,9 +48,9 @@
}
bool GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
- lldb::addr_t &pc) {
+ lldb::addr_t &pc, bool &behaves_like_zeroth_frame) {
std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
- return DoGetFrameInfoAtIndex(frame_idx, cfa, pc);
+ return DoGetFrameInfoAtIndex(frame_idx, cfa, pc, behaves_like_zeroth_frame);
}
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) {
@@ -66,7 +67,8 @@
virtual uint32_t DoGetFrameCount() = 0;
virtual bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
- lldb::addr_t &pc) = 0;
+ lldb::addr_t &pc,
+ bool &behaves_like_zeroth_frame) = 0;
virtual lldb::RegisterContextSP
DoCreateRegisterContextForFrame(StackFrame *frame) = 0;
@@ -75,9 +77,10 @@
std::recursive_mutex m_unwind_mutex;
private:
- DISALLOW_COPY_AND_ASSIGN(Unwind);
+ Unwind(const Unwind &) = delete;
+ const Unwind &operator=(const Unwind &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Unwind_h_
+#endif // LLDB_TARGET_UNWIND_H
diff --git a/linux-x64/clang/include/lldb/Target/UnwindAssembly.h b/linux-x64/clang/include/lldb/Target/UnwindAssembly.h
index a70aef6..d20aa52 100644
--- a/linux-x64/clang/include/lldb/Target/UnwindAssembly.h
+++ b/linux-x64/clang/include/lldb/Target/UnwindAssembly.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_UnwindAssembly_h_
-#define utility_UnwindAssembly_h_
+#ifndef LLDB_TARGET_UNWINDASSEMBLY_H
+#define LLDB_TARGET_UNWINDASSEMBLY_H
#include "lldb/Core/PluginInterface.h"
#include "lldb/Utility/ArchSpec.h"
@@ -20,8 +20,6 @@
public:
static lldb::UnwindAssemblySP FindPlugin(const ArchSpec &arch);
- ~UnwindAssembly() override;
-
virtual bool
GetNonCallSiteUnwindPlanFromAssembly(AddressRange &func, Thread &thread,
UnwindPlan &unwind_plan) = 0;
@@ -42,12 +40,8 @@
protected:
UnwindAssembly(const ArchSpec &arch);
ArchSpec m_arch;
-
-private:
- UnwindAssembly() = delete;
- DISALLOW_COPY_AND_ASSIGN(UnwindAssembly);
};
} // namespace lldb_private
-#endif // utility_UnwindAssembly_h_
+#endif // LLDB_TARGET_UNWINDASSEMBLY_H
diff --git a/linux-x64/clang/include/lldb/Target/UnwindLLDB.h b/linux-x64/clang/include/lldb/Target/UnwindLLDB.h
new file mode 100644
index 0000000..c7c9cfb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Target/UnwindLLDB.h
@@ -0,0 +1,159 @@
+//===-- UnwindLLDB.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_UNWINDLLDB_H
+#define LLDB_TARGET_UNWINDLLDB_H
+
+#include <vector>
+
+#include "lldb/Symbol/FuncUnwinders.h"
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/Unwind.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class RegisterContextUnwind;
+
+class UnwindLLDB : public lldb_private::Unwind {
+public:
+ UnwindLLDB(lldb_private::Thread &thread);
+
+ ~UnwindLLDB() override = default;
+
+ enum RegisterSearchResult {
+ eRegisterFound = 0,
+ eRegisterNotFound,
+ eRegisterIsVolatile
+ };
+
+protected:
+ friend class lldb_private::RegisterContextUnwind;
+
+ struct RegisterLocation {
+ enum RegisterLocationTypes {
+ eRegisterNotSaved = 0, // register was not preserved by callee. If
+ // volatile reg, is unavailable
+ eRegisterSavedAtMemoryLocation, // register is saved at a specific word of
+ // target mem (target_memory_location)
+ eRegisterInRegister, // register is available in a (possible other)
+ // register (register_number)
+ eRegisterSavedAtHostMemoryLocation, // register is saved at a word in
+ // lldb's address space
+ eRegisterValueInferred, // register val was computed (and is in
+ // inferred_value)
+ eRegisterInLiveRegisterContext // register value is in a live (stack frame
+ // #0) register
+ };
+ int type;
+ union {
+ lldb::addr_t target_memory_location;
+ uint32_t
+ register_number; // in eRegisterKindLLDB register numbering system
+ void *host_memory_location;
+ uint64_t inferred_value; // eRegisterValueInferred - e.g. stack pointer ==
+ // cfa + offset
+ } location;
+ };
+
+ void DoClear() override {
+ m_frames.clear();
+ m_candidate_frame.reset();
+ m_unwind_complete = false;
+ }
+
+ uint32_t DoGetFrameCount() override;
+
+ bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa,
+ lldb::addr_t &start_pc,
+ bool &behaves_like_zeroth_frame) override;
+
+ lldb::RegisterContextSP
+ DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) override;
+
+ typedef std::shared_ptr<RegisterContextUnwind> RegisterContextLLDBSP;
+
+ // Needed to retrieve the "next" frame (e.g. frame 2 needs to retrieve frame
+ // 1's RegisterContextUnwind)
+ // The RegisterContext for frame_num must already exist or this returns an
+ // empty shared pointer.
+ RegisterContextLLDBSP GetRegisterContextForFrameNum(uint32_t frame_num);
+
+ // Iterate over the RegisterContextUnwind's in our m_frames vector, look for
+ // the first one that has a saved location for this reg.
+ bool SearchForSavedLocationForRegister(
+ uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc,
+ uint32_t starting_frame_num, bool pc_register);
+
+ /// Provide the list of user-specified trap handler functions
+ ///
+ /// The Platform is one source of trap handler function names; that
+ /// may be augmented via a setting. The setting needs to be converted
+ /// into an array of ConstStrings before it can be used - we only want
+ /// to do that once per thread so it's here in the UnwindLLDB object.
+ ///
+ /// \return
+ /// Vector of ConstStrings of trap handler function names. May be
+ /// empty.
+ const std::vector<ConstString> &GetUserSpecifiedTrapHandlerFunctionNames() {
+ return m_user_supplied_trap_handler_functions;
+ }
+
+private:
+ struct Cursor {
+ lldb::addr_t start_pc; // The start address of the function/symbol for this
+ // frame - current pc if unknown
+ lldb::addr_t cfa; // The canonical frame address for this stack frame
+ lldb_private::SymbolContext sctx; // A symbol context we'll contribute to &
+ // provide to the StackFrame creation
+ RegisterContextLLDBSP
+ reg_ctx_lldb_sp; // These are all RegisterContextUnwind's
+
+ Cursor()
+ : start_pc(LLDB_INVALID_ADDRESS), cfa(LLDB_INVALID_ADDRESS), sctx(),
+ reg_ctx_lldb_sp() {}
+
+ private:
+ Cursor(const Cursor &) = delete;
+ const Cursor &operator=(const Cursor &) = delete;
+ };
+
+ typedef std::shared_ptr<Cursor> CursorSP;
+ std::vector<CursorSP> m_frames;
+ CursorSP m_candidate_frame;
+ bool m_unwind_complete; // If this is true, we've enumerated all the frames in
+ // the stack, and m_frames.size() is the
+ // number of frames, etc. Otherwise we've only gone as far as directly asked,
+ // and m_frames.size()
+ // is how far we've currently gone.
+
+ std::vector<ConstString> m_user_supplied_trap_handler_functions;
+
+ // Check if Full UnwindPlan of First frame is valid or not.
+ // If not then try Fallback UnwindPlan of the frame. If Fallback
+ // UnwindPlan succeeds then update the Full UnwindPlan with the
+ // Fallback UnwindPlan.
+ void UpdateUnwindPlanForFirstFrameIfInvalid(ABI *abi);
+
+ CursorSP GetOneMoreFrame(ABI *abi);
+
+ bool AddOneMoreFrame(ABI *abi);
+
+ bool AddFirstFrame();
+
+ // For UnwindLLDB only
+ UnwindLLDB(const UnwindLLDB &) = delete;
+ const UnwindLLDB &operator=(const UnwindLLDB &) = delete;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_UNWINDLLDB_H
diff --git a/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h b/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h
index 1473c60..c391adb 100644
--- a/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h
+++ b/linux-x64/clang/include/lldb/Utility/AnsiTerminal.h
@@ -1,3 +1,7 @@
+#ifndef LLDB_UTILITY_ANSITERMINAL_H
+
+#define LLDB_UTILITY_ANSITERMINAL_H
+
//===---------------------AnsiTerminal.h ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -55,7 +59,7 @@
#include <string>
-namespace lldb_utility {
+namespace lldb_private {
namespace ansi {
@@ -111,7 +115,7 @@
llvm::StringRef left, right;
std::tie(left, right) = format.split(tok_hdr);
- fmt.append(left);
+ fmt += left;
if (left == format && right.empty()) {
// The header was not found. Just exit.
@@ -137,4 +141,6 @@
return fmt;
}
}
-}
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/Utility/ArchSpec.h b/linux-x64/clang/include/lldb/Utility/ArchSpec.h
index 7a32556..b35766d 100644
--- a/linux-x64/clang/include/lldb/Utility/ArchSpec.h
+++ b/linux-x64/clang/include/lldb/Utility/ArchSpec.h
@@ -16,6 +16,7 @@
#include "lldb/lldb-private-enumerations.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/Support/YAMLTraits.h"
#include <cstddef>
#include <cstdint>
#include <string>
@@ -91,6 +92,12 @@
eARM_abi_hard_float = 0x00000400
};
+ enum RISCVSubType {
+ eRISCVSubType_unknown,
+ eRISCVSubType_riscv32,
+ eRISCVSubType_riscv64,
+ };
+
enum Core {
eCore_arm_generic,
eCore_arm_armv4,
@@ -101,6 +108,7 @@
eCore_arm_armv6,
eCore_arm_armv6m,
eCore_arm_armv7,
+ eCore_arm_armv7l,
eCore_arm_armv7f,
eCore_arm_armv7s,
eCore_arm_armv7k,
@@ -122,6 +130,8 @@
eCore_thumbv7em,
eCore_arm_arm64,
eCore_arm_armv8,
+ eCore_arm_armv8l,
+ eCore_arm_arm64_32,
eCore_arm_aarch64,
eCore_mips32,
@@ -180,9 +190,18 @@
eCore_hexagon_hexagonv4,
eCore_hexagon_hexagonv5,
+ eCore_riscv32,
+ eCore_riscv64,
+
eCore_uknownMach32,
eCore_uknownMach64,
+ eCore_arc, // little endian ARC
+
+ eCore_avr,
+
+ eCore_wasm32,
+
kNumCores,
kCore_invalid,
@@ -255,20 +274,13 @@
/// Destructor.
~ArchSpec();
- /// Assignment operator.
- ///
- /// \param[in] rhs another ArchSpec object to copy.
- ///
- /// \return A const reference to this object.
- const ArchSpec &operator=(const ArchSpec &rhs);
-
/// Returns true if the OS, vendor and environment fields of the triple are
/// unset. The triple is expected to be normalized
/// (llvm::Triple::normalize).
static bool ContainsOnlyArch(const llvm::Triple &normalized_triple);
static void ListSupportedArchNames(StringList &list);
- static size_t AutoComplete(CompletionRequest &request);
+ static void AutoComplete(CompletionRequest &request);
/// Returns a static string representing the current architecture.
///
@@ -435,7 +447,7 @@
/// \return A triple describing this ArchSpec.
const llvm::Triple &GetTriple() const { return m_triple; }
- void DumpTriple(Stream &s) const;
+ void DumpTriple(llvm::raw_ostream &s) const;
/// Architecture triple setter.
///
@@ -502,7 +514,7 @@
void SetFlags(uint32_t flags) { m_flags = flags; }
- void SetFlags(std::string elf_abi);
+ void SetFlags(const std::string &elf_abi);
protected:
bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const;
@@ -539,4 +551,16 @@
} // namespace lldb_private
-#endif // #ifndef LLDB_UTILITY_ARCHSPEC_H
+namespace llvm {
+namespace yaml {
+template <> struct ScalarTraits<lldb_private::ArchSpec> {
+ static void output(const lldb_private::ArchSpec &, void *, raw_ostream &);
+ static StringRef input(StringRef, void *, lldb_private::ArchSpec &);
+ static QuotingType mustQuote(StringRef S) { return QuotingType::Double; }
+};
+} // namespace yaml
+} // namespace llvm
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::ArchSpec)
+
+#endif // LLDB_UTILITY_ARCHSPEC_H
diff --git a/linux-x64/clang/include/lldb/Utility/Args.h b/linux-x64/clang/include/lldb/Utility/Args.h
index 6f25849..b93677b 100644
--- a/linux-x64/clang/include/lldb/Utility/Args.h
+++ b/linux-x64/clang/include/lldb/Utility/Args.h
@@ -14,6 +14,7 @@
#include "lldb/lldb-types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/YAMLTraits.h"
#include <string>
#include <utility>
#include <vector>
@@ -34,7 +35,11 @@
struct ArgEntry {
private:
friend class Args;
+ friend struct llvm::yaml::MappingTraits<Args>;
+ friend struct llvm::yaml::MappingTraits<Args::ArgEntry>;
+
std::unique_ptr<char[]> ptr;
+ char quote;
char *data() { return ptr.get(); }
@@ -42,12 +47,12 @@
ArgEntry() = default;
ArgEntry(llvm::StringRef str, char quote);
- llvm::StringRef ref;
- char quote;
+ llvm::StringRef ref() const { return c_str(); }
const char *c_str() const { return ptr.get(); }
/// Returns true if this argument was quoted in any way.
bool IsQuoted() const { return quote != '\0'; }
+ char GetQuoteChar() const { return quote; }
};
/// Construct with an option command string.
@@ -61,6 +66,7 @@
Args(const Args &rhs);
explicit Args(const StringList &list);
+ explicit Args(llvm::ArrayRef<llvm::StringRef> args);
Args &operator=(const Args &rhs);
@@ -121,7 +127,6 @@
const char *GetArgumentAtIndex(size_t idx) const;
llvm::ArrayRef<ArgEntry> entries() const { return m_entries; }
- char GetArgumentQuoteCharAtIndex(size_t idx) const;
using const_iterator = std::vector<ArgEntry>::const_iterator;
@@ -168,8 +173,8 @@
/// Appends a new argument to the end of the list argument list.
///
- /// \param[in] arg_cstr
- /// The new argument as a NULL terminated C string.
+ /// \param[in] arg_str
+ /// The new argument.
///
/// \param[in] quote_char
/// If the argument was originally quoted, put in the quote char here.
@@ -179,30 +184,27 @@
void AppendArguments(const char **argv);
- /// Insert the argument value at index \a idx to \a arg_cstr.
+ /// Insert the argument value at index \a idx to \a arg_str.
///
/// \param[in] idx
/// The index of where to insert the argument.
///
- /// \param[in] arg_cstr
- /// The new argument as a NULL terminated C string.
+ /// \param[in] arg_str
+ /// The new argument.
///
/// \param[in] quote_char
/// If the argument was originally quoted, put in the quote char here.
- ///
- /// \return
- /// The NULL terminated C string of the copy of \a arg_cstr.
void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str,
char quote_char = '\0');
- /// Replaces the argument value at index \a idx to \a arg_cstr if \a idx is
+ /// Replaces the argument value at index \a idx to \a arg_str if \a idx is
/// a valid argument index.
///
/// \param[in] idx
/// The index of the argument that will have its value replaced.
///
- /// \param[in] arg_cstr
- /// The new argument as a NULL terminated C string.
+ /// \param[in] arg_str
+ /// The new argument.
///
/// \param[in] quote_char
/// If the argument was originally quoted, put in the quote char here.
@@ -238,12 +240,12 @@
/// \see Args::GetArgumentAtIndex (size_t) const
void Shift();
- /// Inserts a class owned copy of \a arg_cstr at the beginning of the
+ /// Inserts a class owned copy of \a arg_str at the beginning of the
/// argument vector.
///
- /// A copy \a arg_cstr will be made.
+ /// A copy \a arg_str will be made.
///
- /// \param[in] arg_cstr
+ /// \param[in] arg_str
/// The argument to push on the front of the argument stack.
///
/// \param[in] quote_char
@@ -255,48 +257,14 @@
// For re-setting or blanking out the list of arguments.
void Clear();
- static const char *StripSpaces(std::string &s, bool leading = true,
- bool trailing = true,
- bool return_null_if_empty = true);
-
- static bool UInt64ValueIsValidForByteSize(uint64_t uval64,
- size_t total_byte_size) {
- if (total_byte_size > 8)
- return false;
-
- if (total_byte_size == 8)
- return true;
-
- const uint64_t max = (static_cast<uint64_t>(1)
- << static_cast<uint64_t>(total_byte_size * 8)) -
- 1;
- return uval64 <= max;
- }
-
- static bool SInt64ValueIsValidForByteSize(int64_t sval64,
- size_t total_byte_size) {
- if (total_byte_size > 8)
- return false;
-
- if (total_byte_size == 8)
- return true;
-
- const int64_t max = (static_cast<int64_t>(1)
- << static_cast<uint64_t>(total_byte_size * 8 - 1)) -
- 1;
- const int64_t min = ~(max);
- return min <= sval64 && sval64 <= max;
- }
-
static lldb::Encoding
StringToEncoding(llvm::StringRef s,
lldb::Encoding fail_value = lldb::eEncodingInvalid);
static uint32_t StringToGenericRegister(llvm::StringRef s);
- static const char *GetShellSafeArgument(const FileSpec &shell,
- const char *unsafe_arg,
- std::string &safe_arg);
+ static std::string GetShellSafeArgument(const FileSpec &shell,
+ llvm::StringRef unsafe_arg);
// EncodeEscapeSequences will change the textual representation of common
// escape sequences like "\n" (two characters) into a single '\n'. It does
@@ -319,6 +287,8 @@
char quote_char);
private:
+ friend struct llvm::yaml::MappingTraits<Args>;
+
std::vector<ArgEntry> m_entries;
std::vector<char *> m_argv;
};
@@ -409,4 +379,28 @@
} // namespace lldb_private
+namespace llvm {
+namespace yaml {
+template <> struct MappingTraits<lldb_private::Args::ArgEntry> {
+ class NormalizedArgEntry {
+ public:
+ NormalizedArgEntry(IO &) {}
+ NormalizedArgEntry(IO &, lldb_private::Args::ArgEntry &entry)
+ : value(entry.ref()), quote(entry.quote) {}
+ lldb_private::Args::ArgEntry denormalize(IO &) {
+ return lldb_private::Args::ArgEntry(value, quote);
+ }
+ StringRef value;
+ uint8_t quote;
+ };
+ static void mapping(IO &io, lldb_private::Args::ArgEntry &v);
+};
+template <> struct MappingTraits<lldb_private::Args> {
+ static void mapping(IO &io, lldb_private::Args &v);
+};
+} // namespace yaml
+} // namespace llvm
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::Args::ArgEntry)
+
#endif // LLDB_UTILITY_ARGS_H
diff --git a/linux-x64/clang/include/lldb/Utility/Baton.h b/linux-x64/clang/include/lldb/Utility/Baton.h
index 4050f2a..010f8da 100644
--- a/linux-x64/clang/include/lldb/Utility/Baton.h
+++ b/linux-x64/clang/include/lldb/Utility/Baton.h
@@ -6,12 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_Baton_h_
-#define lldb_Baton_h_
+#ifndef LLDB_UTILITY_BATON_H
+#define LLDB_UTILITY_BATON_H
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-public.h"
+#include "llvm/Support/raw_ostream.h"
+
#include <memory>
namespace lldb_private {
@@ -37,8 +39,9 @@
virtual void *data() = 0;
- virtual void GetDescription(Stream *s,
- lldb::DescriptionLevel level) const = 0;
+ virtual void GetDescription(llvm::raw_ostream &s,
+ lldb::DescriptionLevel level,
+ unsigned indentation) const = 0;
};
class UntypedBaton : public Baton {
@@ -50,7 +53,8 @@
}
void *data() override { return m_data; }
- void GetDescription(Stream *s, lldb::DescriptionLevel level) const override;
+ void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level,
+ unsigned indentation) const override;
void *m_data; // Leave baton public for easy access
};
@@ -63,7 +67,8 @@
const T *getItem() const { return Item.get(); }
void *data() override { return Item.get(); }
- void GetDescription(Stream *s, lldb::DescriptionLevel level) const override {}
+ void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level,
+ unsigned indentation) const override {}
protected:
std::unique_ptr<T> Item;
@@ -71,4 +76,4 @@
} // namespace lldb_private
-#endif // lldb_Baton_h_
+#endif // LLDB_UTILITY_BATON_H
diff --git a/linux-x64/clang/include/lldb/Utility/Broadcaster.h b/linux-x64/clang/include/lldb/Utility/Broadcaster.h
index fe4d1ca..9c025a7 100644
--- a/linux-x64/clang/include/lldb/Utility/Broadcaster.h
+++ b/linux-x64/clang/include/lldb/Utility/Broadcaster.h
@@ -39,7 +39,7 @@
/// Debugger maintains a list of BroadcastEventSpec's and when it is made
class BroadcastEventSpec {
public:
- BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits)
+ BroadcastEventSpec(const ConstString &broadcaster_class, uint32_t event_bits)
: m_broadcaster_class(broadcaster_class), m_event_bits(event_bits) {}
~BroadcastEventSpec() = default;
@@ -65,7 +65,6 @@
}
bool operator<(const BroadcastEventSpec &rhs) const;
- BroadcastEventSpec &operator=(const BroadcastEventSpec &rhs);
private:
ConstString m_broadcaster_class;
@@ -118,7 +117,7 @@
class BroadcasterClassMatches {
public:
- BroadcasterClassMatches(ConstString broadcaster_class)
+ BroadcasterClassMatches(const ConstString &broadcaster_class)
: m_broadcaster_class(broadcaster_class) {}
~BroadcasterClassMatches() = default;
@@ -260,19 +259,6 @@
void CheckInWithManager();
/// Broadcast an event which has no associated data.
- ///
- /// \param[in] event_type
- /// The element from the enum defining this broadcaster's events
- /// that is being broadcast.
- ///
- /// \param[in] event_data
- /// User event data that will be owned by the lldb::Event that
- /// is created internally.
- ///
- /// \param[in] unique
- /// If true, then only add an event of this type if there isn't
- /// one already in the queue.
- ///
void BroadcastEvent(lldb::EventSP &event_sp) {
m_broadcaster_sp->BroadcastEvent(event_sp);
}
@@ -309,7 +295,7 @@
/// different from what is requested in \a event_mask, and to track this the
/// actual event bits that are acquired get returned.
///
- /// \param[in] listener
+ /// \param[in] listener_sp
/// The Listener object that wants to monitor the events that
/// get broadcast by this object.
///
@@ -348,9 +334,6 @@
/// \param[in] event_mask
/// A bit mask that indicates which events the listener is
/// asking to monitor.
- ///
- /// \return
- /// The NULL terminated C string name of this Broadcaster.
void SetEventName(uint32_t event_mask, const char *name) {
m_broadcaster_sp->SetEventName(event_mask, name);
}
@@ -368,7 +351,7 @@
/// (assuming \a listener was listening to this object) for other listener
/// objects to use.
///
- /// \param[in] listener
+ /// \param[in] listener_sp
/// A Listener object that previously called AddListener.
///
/// \param[in] event_mask
@@ -390,7 +373,7 @@
/// now go to the hijacking listener. Only one hijack can occur at a time.
/// If we need more than this we will have to implement a Listener stack.
///
- /// \param[in] listener
+ /// \param[in] listener_sp
/// A Listener object. You do not need to call StartListeningForEvents
/// for this broadcaster (that would fail anyway since the event bits
/// would most likely be taken by the listener(s) you are usurping.
@@ -531,7 +514,8 @@
std::vector<uint32_t> m_hijacking_masks;
private:
- DISALLOW_COPY_AND_ASSIGN(BroadcasterImpl);
+ BroadcasterImpl(const BroadcasterImpl &) = delete;
+ const BroadcasterImpl &operator=(const BroadcasterImpl &) = delete;
};
typedef std::shared_ptr<BroadcasterImpl> BroadcasterImplSP;
@@ -550,7 +534,8 @@
/// The name of this broadcaster object.
const ConstString m_broadcaster_name;
- DISALLOW_COPY_AND_ASSIGN(Broadcaster);
+ Broadcaster(const Broadcaster &) = delete;
+ const Broadcaster &operator=(const Broadcaster &) = delete;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Utility/CleanUp.h b/linux-x64/clang/include/lldb/Utility/CleanUp.h
deleted file mode 100644
index 6cd5f33..0000000
--- a/linux-x64/clang/include/lldb/Utility/CleanUp.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//===-- CleanUp.h -----------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CleanUp_h_
-#define liblldb_CleanUp_h_
-
-#include "lldb/lldb-public.h"
-#include <functional>
-
-namespace lldb_private {
-
-/// Run a cleanup function on scope exit unless it's explicitly disabled.
-class CleanUp {
- std::function<void()> Clean;
-
-public:
- /// Register a cleanup function which applies \p Func to a list of arguments.
- /// Use caution with arguments which are references: they will be copied.
- template <typename F, typename... Args>
- CleanUp(F &&Func, Args &&... args)
- : Clean(std::bind(std::forward<F>(Func), std::forward<Args>(args)...)) {}
-
- ~CleanUp() {
- if (Clean)
- Clean();
- }
-
- /// Disable the cleanup.
- void disable() { Clean = nullptr; }
-
- // Prevent cleanups from being run more than once.
- DISALLOW_COPY_AND_ASSIGN(CleanUp);
-};
-
-} // namespace lldb_private
-
-#endif // #ifndef liblldb_CleanUp_h_
diff --git a/linux-x64/clang/include/lldb/Utility/CompletionRequest.h b/linux-x64/clang/include/lldb/Utility/CompletionRequest.h
index f5ccb01..1fbc969 100644
--- a/linux-x64/clang/include/lldb/Utility/CompletionRequest.h
+++ b/linux-x64/clang/include/lldb/Utility/CompletionRequest.h
@@ -16,25 +16,66 @@
#include "llvm/ADT/StringSet.h"
namespace lldb_private {
-class CompletionResult {
- /// A single completion and all associated data.
- struct Completion {
- Completion(llvm::StringRef completion, llvm::StringRef description)
- : m_completion(completion.str()), m_descripton(description.str()) {}
+enum class CompletionMode {
+ /// The current token has been completed. The client should indicate this
+ /// to the user (usually this is done by adding a trailing space behind the
+ /// token).
+ /// Example: "command sub" -> "command subcommand " (note the trailing space).
+ Normal,
+ /// The current token has been partially completed. This means that we found
+ /// a completion, but that the token is still incomplete. Examples
+ /// for this are file paths, where we want to complete "/bi" to "/bin/", but
+ /// the file path token is still incomplete after the completion. Clients
+ /// should not indicate to the user that this is a full completion (e.g. by
+ /// not inserting the usual trailing space after a successful completion).
+ /// Example: "file /us" -> "file /usr/" (note the missing trailing space).
+ Partial,
+ /// The full line has been rewritten by the completion.
+ /// Example: "alias name" -> "other_command full_name".
+ RewriteLine,
+};
+class CompletionResult {
+public:
+ /// A single completion and all associated data.
+ class Completion {
+
+ /// The actual text that should be completed. The meaning of this text
+ /// is defined by the CompletionMode.
+ /// \see m_mode
std::string m_completion;
+ /// The description that should be displayed to the user alongside the
+ /// completion text.
std::string m_descripton;
+ CompletionMode m_mode;
+
+ public:
+ Completion(llvm::StringRef completion, llvm::StringRef description,
+ CompletionMode mode)
+ : m_completion(completion.str()), m_descripton(description.str()),
+ m_mode(mode) {}
+ const std::string &GetCompletion() const { return m_completion; }
+ const std::string &GetDescription() const { return m_descripton; }
+ CompletionMode GetMode() const { return m_mode; }
/// Generates a string that uniquely identifies this completion result.
std::string GetUniqueKey() const;
};
+
+private:
+ /// List of found completions.
std::vector<Completion> m_results;
- /// List of added completions so far. Used to filter out duplicates.
+ /// A set of the unique keys of all found completions so far. Used to filter
+ /// out duplicates.
+ /// \see CompletionResult::Completion::GetUniqueKey
llvm::StringSet<> m_added_values;
public:
- void AddResult(llvm::StringRef completion, llvm::StringRef description);
+ void AddResult(llvm::StringRef completion, llvm::StringRef description,
+ CompletionMode mode);
+
+ llvm::ArrayRef<Completion> GetResults() const { return m_results; }
/// Adds all collected completion matches to the given list.
/// The list will be cleared before the results are added. The number of
@@ -68,21 +109,25 @@
/// the cursor is at the start of the line. The completion starts from
/// this cursor position.
///
- /// \param [in] match_start_point
- /// \param [in] max_return_elements
- /// If there is a match that is expensive to compute, these are here to
- /// allow you to compute the completions in batches. Start the
- /// completion from match_start_point, and return match_return_elements
- /// elements.
- ///
/// \param [out] result
/// The CompletionResult that will be filled with the results after this
/// request has been handled.
CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos,
- int match_start_point, int max_return_elements,
CompletionResult &result);
- llvm::StringRef GetRawLine() const { return m_command; }
+ /// Returns the raw user input used to create this CompletionRequest cut off
+ /// at the cursor position. The cursor will be at the end of the raw line.
+ llvm::StringRef GetRawLine() const {
+ return m_command.substr(0, GetRawCursorPos());
+ }
+
+ /// Returns the full raw user input used to create this CompletionRequest.
+ /// This string is not cut off at the cursor position and will include
+ /// characters behind the cursor position.
+ ///
+ /// You should most likely *not* use this function unless the characters
+ /// behind the cursor position influence the completion.
+ llvm::StringRef GetRawLineWithUnusedSuffix() const { return m_command; }
unsigned GetRawCursorPos() const { return m_raw_cursor_pos; }
@@ -90,33 +135,57 @@
Args &GetParsedLine() { return m_parsed_line; }
- const Args &GetPartialParsedLine() const { return m_partial_parsed_line; }
+ const Args::ArgEntry &GetParsedArg() {
+ return GetParsedLine()[GetCursorIndex()];
+ }
- void SetCursorIndex(int i) { m_cursor_index = i; }
- int GetCursorIndex() const { return m_cursor_index; }
+ /// Drops the first argument from the argument list.
+ void ShiftArguments() {
+ m_cursor_index--;
+ m_parsed_line.Shift();
+ }
- void SetCursorCharPosition(int pos) { m_cursor_char_position = pos; }
- int GetCursorCharPosition() const { return m_cursor_char_position; }
+ /// Adds an empty argument at the end of the argument list and moves
+ /// the cursor to this new argument.
+ void AppendEmptyArgument() {
+ m_parsed_line.AppendArgument(llvm::StringRef());
+ m_cursor_index++;
+ m_cursor_char_position = 0;
+ }
- int GetMatchStartPoint() const { return m_match_start_point; }
-
- int GetMaxReturnElements() const { return m_max_return_elements; }
-
- bool GetWordComplete() { return m_word_complete; }
-
- void SetWordComplete(bool v) { m_word_complete = v; }
+ size_t GetCursorIndex() const { return m_cursor_index; }
/// Adds a possible completion string. If the completion was already
/// suggested before, it will not be added to the list of results. A copy of
/// the suggested completion is stored, so the given string can be free'd
/// afterwards.
///
- /// \param match The suggested completion.
- /// \param match An optional description of the completion string. The
+ /// \param completion The suggested completion.
+ /// \param description An optional description of the completion string. The
/// description will be displayed to the user alongside the completion.
+ /// \param mode The CompletionMode for this completion.
void AddCompletion(llvm::StringRef completion,
- llvm::StringRef description = "") {
- m_result.AddResult(completion, description);
+ llvm::StringRef description = "",
+ CompletionMode mode = CompletionMode::Normal) {
+ m_result.AddResult(completion, description, mode);
+ }
+
+ /// Adds a possible completion string if the completion would complete the
+ /// current argument.
+ ///
+ /// \param completion The suggested completion.
+ /// \param description An optional description of the completion string. The
+ /// description will be displayed to the user alongside the completion.
+ template <CompletionMode M = CompletionMode::Normal>
+ void TryCompleteCurrentArg(llvm::StringRef completion,
+ llvm::StringRef description = "") {
+ // Trying to rewrite the whole line while checking for the current
+ // argument never makes sense. Completion modes are always hardcoded, so
+ // this can be a static_assert.
+ static_assert(M != CompletionMode::RewriteLine,
+ "Shouldn't rewrite line with this function");
+ if (completion.startswith(GetCursorArgumentPrefix()))
+ AddCompletion(completion, description, M);
}
/// Adds multiple possible completion strings.
@@ -125,8 +194,8 @@
///
/// \see AddCompletion
void AddCompletions(const StringList &completions) {
- for (std::size_t i = 0; i < completions.GetSize(); ++i)
- AddCompletion(completions.GetStringAtIndex(i));
+ for (const std::string &completion : completions)
+ AddCompletion(completion);
}
/// Adds multiple possible completion strings alongside their descriptions.
@@ -134,7 +203,7 @@
/// The number of completions and descriptions must be identical.
///
/// \param completions The list of completions.
- /// \param completions The list of descriptions.
+ /// \param descriptions The list of descriptions.
///
/// \see AddCompletion
void AddCompletions(const StringList &completions,
@@ -145,16 +214,8 @@
descriptions.GetStringAtIndex(i));
}
- std::size_t GetNumberOfMatches() const {
- return m_result.GetNumberOfResults();
- }
-
- llvm::StringRef GetCursorArgument() const {
- return GetParsedLine().GetArgumentAtIndex(GetCursorIndex());
- }
-
llvm::StringRef GetCursorArgumentPrefix() const {
- return GetCursorArgument().substr(0, GetCursorCharPosition());
+ return GetParsedLine().GetArgumentAtIndex(GetCursorIndex());
}
private:
@@ -164,22 +225,10 @@
unsigned m_raw_cursor_pos;
/// The command line parsed as arguments.
Args m_parsed_line;
- /// The command line until the cursor position parsed as arguments.
- Args m_partial_parsed_line;
/// The index of the argument in which the completion cursor is.
- int m_cursor_index;
+ size_t m_cursor_index;
/// The cursor position in the argument indexed by m_cursor_index.
- int m_cursor_char_position;
- /// If there is a match that is expensive
- /// to compute, these are here to allow you to compute the completions in
- /// batches. Start the completion from \amatch_start_point, and return
- /// \amatch_return_elements elements.
- // FIXME: These two values are not implemented.
- int m_match_start_point;
- int m_max_return_elements;
- /// \btrue if this is a complete option value (a space will be inserted
- /// after the completion.) \bfalse otherwise.
- bool m_word_complete = false;
+ size_t m_cursor_char_position;
/// The result this request is supposed to fill out.
/// We keep this object private to ensure that no backend can in any way
diff --git a/linux-x64/clang/include/lldb/Utility/Connection.h b/linux-x64/clang/include/lldb/Utility/Connection.h
index 77f3ef4..39e6e40 100644
--- a/linux-x64/clang/include/lldb/Utility/Connection.h
+++ b/linux-x64/clang/include/lldb/Utility/Connection.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Connection_h_
-#define liblldb_Connection_h_
+#ifndef LLDB_UTILITY_CONNECTION_H
+#define LLDB_UTILITY_CONNECTION_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
@@ -125,7 +125,7 @@
/// Subclasses must override this function.
///
/// \param[in] dst
- /// A desination buffer that must be at least \a dst_len bytes
+ /// A destination buffer that must be at least \a dst_len bytes
/// long.
///
/// \param[in] dst_len
@@ -171,13 +171,14 @@
///
/// \return
/// The underlying IOObject used for reading.
- virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
+ virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); };
private:
// For Connection only
- DISALLOW_COPY_AND_ASSIGN(Connection);
+ Connection(const Connection &) = delete;
+ const Connection &operator=(const Connection &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Connection_h_
+#endif // LLDB_UTILITY_CONNECTION_H
diff --git a/linux-x64/clang/include/lldb/Utility/ConstString.h b/linux-x64/clang/include/lldb/Utility/ConstString.h
index 8576c18..8a67faf 100644
--- a/linux-x64/clang/include/lldb/Utility/ConstString.h
+++ b/linux-x64/clang/include/lldb/Utility/ConstString.h
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_ConstString_h_
-#define liblldb_ConstString_h_
+#ifndef LLDB_UTILITY_CONSTSTRING_H
+#define LLDB_UTILITY_CONSTSTRING_H
+#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/YAMLTraits.h"
#include <stddef.h>
@@ -40,15 +42,7 @@
/// Default constructor
///
/// Initializes the string to an empty string.
- ConstString() : m_string(nullptr) {}
-
- /// Copy constructor
- ///
- /// Copies the string value in \a rhs into this object.
- ///
- /// \param[in] rhs
- /// Another string object to copy.
- ConstString(const ConstString &rhs) : m_string(rhs.m_string) {}
+ ConstString() = default;
explicit ConstString(const llvm::StringRef &s);
@@ -84,12 +78,6 @@
/// from \a cstr.
explicit ConstString(const char *cstr, size_t max_cstr_len);
- /// Destructor
- ///
- /// Since constant string values are currently not reference counted, there
- /// isn't much to do here.
- ~ConstString() = default;
-
/// C string equality binary predicate function object for ConstString
/// objects.
struct StringIsEqual {
@@ -122,20 +110,6 @@
/// false otherwise.
explicit operator bool() const { return !IsEmpty(); }
- /// Assignment operator
- ///
- /// Assigns the string in this object with the value from \a rhs.
- ///
- /// \param[in] rhs
- /// Another string object to copy into this object.
- ///
- /// \return
- /// A const reference to this object.
- ConstString operator=(ConstString rhs) {
- m_string = rhs.m_string;
- return *this;
- }
-
/// Equal to operator
///
/// Returns true if this string is equal to the string in \a rhs. This
@@ -146,8 +120,8 @@
/// Another string object to compare this object to.
///
/// \return
- /// \li \b true if this object is equal to \a rhs.
- /// \li \b false if this object is not equal to \a rhs.
+ /// true if this object is equal to \a rhs.
+ /// false if this object is not equal to \a rhs.
bool operator==(ConstString rhs) const {
// We can do a pointer compare to compare these strings since they must
// come from the same pool in order to be equal.
@@ -165,8 +139,8 @@
/// Another string object to compare this object to.
///
/// \return
- /// \li \b true if this object is equal to \a rhs.
- /// \li \b false if this object is not equal to \a rhs.
+ /// \b true if this object is equal to \a rhs.
+ /// \b false if this object is not equal to \a rhs.
bool operator==(const char *rhs) const {
// ConstString differentiates between empty strings and nullptr strings, but
// StringRef doesn't. Therefore we have to do this check manually now.
@@ -188,11 +162,9 @@
/// Another string object to compare this object to.
///
/// \return
- /// \li \b true if this object is not equal to \a rhs.
- /// \li \b false if this object is equal to \a rhs.
- bool operator!=(ConstString rhs) const {
- return m_string != rhs.m_string;
- }
+ /// \b true if this object is not equal to \a rhs.
+ /// \b false if this object is equal to \a rhs.
+ bool operator!=(ConstString rhs) const { return m_string != rhs.m_string; }
/// Not equal to operator against a non-ConstString value.
///
@@ -204,9 +176,7 @@
/// \param[in] rhs
/// Another string object to compare this object to.
///
- /// \return
- /// \li \b true if this object is not equal to \a rhs.
- /// \li \b false if this object is equal to \a rhs.
+ /// \return \b true if this object is not equal to \a rhs, false otherwise.
bool operator!=(const char *rhs) const { return !(*this == rhs); }
bool operator<(ConstString rhs) const;
@@ -218,8 +188,7 @@
///
/// If \a value_if_empty is nullptr, then nullptr will be returned.
///
- /// \return
- /// Returns \a value_if_empty if the string is empty, otherwise
+ /// \return Returns \a value_if_empty if the string is empty, otherwise
/// the C string value contained in this object.
const char *AsCString(const char *value_if_empty = nullptr) const {
return (IsEmpty() ? value_if_empty : m_string);
@@ -269,7 +238,7 @@
/// in a pointer comparison since all strings are in a uniqued in a global
/// string pool.
///
- /// \param[in] rhs
+ /// \param[in] lhs
/// The Left Hand Side const ConstString object reference.
///
/// \param[in] rhs
@@ -279,9 +248,7 @@
/// Case sensitivity. If true, case sensitive equality
/// will be tested, otherwise character case will be ignored
///
- /// \return
- /// \li \b true if this object is equal to \a rhs.
- /// \li \b false if this object is not equal to \a rhs.
+ /// \return \b true if this object is equal to \a rhs, \b false otherwise.
static bool Equals(ConstString lhs, ConstString rhs,
const bool case_sensitive = true);
@@ -305,10 +272,7 @@
/// Case sensitivity of compare. If true, case sensitive compare
/// will be performed, otherwise character case will be ignored
///
- /// \return
- /// \li -1 if lhs < rhs
- /// \li 0 if lhs == rhs
- /// \li 1 if lhs > rhs
+ /// \return -1 if lhs < rhs, 0 if lhs == rhs, 1 if lhs > rhs
static int Compare(ConstString lhs, ConstString rhs,
const bool case_sensitive = true);
@@ -335,15 +299,15 @@
/// Test for empty string.
///
/// \return
- /// \li \b true if the contained string is empty.
- /// \li \b false if the contained string is not empty.
+ /// \b true if the contained string is empty.
+ /// \b false if the contained string is not empty.
bool IsEmpty() const { return m_string == nullptr || m_string[0] == '\0'; }
/// Test for null string.
///
/// \return
- /// \li \b true if there is no string associated with this instance.
- /// \li \b false if there is a string associated with this instance.
+ /// \b true if there is no string associated with this instance.
+ /// \b false if there is a string associated with this instance.
bool IsNull() const { return m_string == nullptr; }
/// Set the C string value.
@@ -445,8 +409,15 @@
static size_t StaticMemorySize();
protected:
- // Member variables
- const char *m_string;
+ template <typename T> friend struct ::llvm::DenseMapInfo;
+ /// Only used by DenseMapInfo.
+ static ConstString FromStringPoolPointer(const char *ptr) {
+ ConstString s;
+ s.m_string = ptr;
+ return s;
+ };
+
+ const char *m_string = nullptr;
};
/// Stream the string value \a str to the stream \a s
@@ -459,6 +430,42 @@
static void format(const lldb_private::ConstString &CS, llvm::raw_ostream &OS,
llvm::StringRef Options);
};
-}
-#endif // liblldb_ConstString_h_
+/// DenseMapInfo implementation.
+/// \{
+template <> struct DenseMapInfo<lldb_private::ConstString> {
+ static inline lldb_private::ConstString getEmptyKey() {
+ return lldb_private::ConstString::FromStringPoolPointer(
+ DenseMapInfo<const char *>::getEmptyKey());
+ }
+ static inline lldb_private::ConstString getTombstoneKey() {
+ return lldb_private::ConstString::FromStringPoolPointer(
+ DenseMapInfo<const char *>::getTombstoneKey());
+ }
+ static unsigned getHashValue(lldb_private::ConstString val) {
+ return DenseMapInfo<const char *>::getHashValue(val.m_string);
+ }
+ static bool isEqual(lldb_private::ConstString LHS,
+ lldb_private::ConstString RHS) {
+ return LHS == RHS;
+ }
+};
+/// \}
+
+namespace yaml {
+template <> struct ScalarTraits<lldb_private::ConstString> {
+ static void output(const lldb_private::ConstString &, void *, raw_ostream &);
+ static StringRef input(StringRef, void *, lldb_private::ConstString &);
+ static QuotingType mustQuote(StringRef S) { return QuotingType::Double; }
+};
+} // namespace yaml
+
+inline raw_ostream &operator<<(raw_ostream &os, lldb_private::ConstString s) {
+ os << s.GetStringRef();
+ return os;
+}
+} // namespace llvm
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::ConstString)
+
+#endif // LLDB_UTILITY_CONSTSTRING_H
diff --git a/linux-x64/clang/include/lldb/Utility/DataBuffer.h b/linux-x64/clang/include/lldb/Utility/DataBuffer.h
index 5235693..302b133 100644
--- a/linux-x64/clang/include/lldb/Utility/DataBuffer.h
+++ b/linux-x64/clang/include/lldb/Utility/DataBuffer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DataBuffer_h_
-#define liblldb_DataBuffer_h_
+#ifndef LLDB_UTILITY_DATABUFFER_H
+#define LLDB_UTILITY_DATABUFFER_H
#if defined(__cplusplus)
#include <stdint.h>
@@ -79,7 +79,21 @@
}
};
+class DataBufferUnowned : public DataBuffer {
+public:
+ DataBufferUnowned(uint8_t *bytes, lldb::offset_t size)
+ : m_bytes(bytes), m_size(size) {}
+
+ uint8_t *GetBytes() override { return m_bytes; }
+ const uint8_t *GetBytes() const override { return m_bytes; }
+ lldb::offset_t GetByteSize() const override { return m_size; }
+
+private:
+ uint8_t *m_bytes;
+ lldb::offset_t m_size;
+};
+
} // namespace lldb_private
#endif /// #if defined(__cplusplus)
-#endif /// lldb_DataBuffer_h_
+#endif // LLDB_UTILITY_DATABUFFER_H
diff --git a/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h b/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h
index 2a64694..ace526b 100644
--- a/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h
+++ b/linux-x64/clang/include/lldb/Utility/DataBufferHeap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DataBufferHeap_h_
-#define liblldb_DataBufferHeap_h_
+#ifndef LLDB_UTILITY_DATABUFFERHEAP_H
+#define LLDB_UTILITY_DATABUFFERHEAP_H
#include "lldb/Utility/DataBuffer.h"
#include "lldb/lldb-types.h"
@@ -109,4 +109,4 @@
} // namespace lldb_private
-#endif // liblldb_DataBufferHeap_h_
+#endif // LLDB_UTILITY_DATABUFFERHEAP_H
diff --git a/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h b/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h
index d4c1107..4dc800c 100644
--- a/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h
+++ b/linux-x64/clang/include/lldb/Utility/DataBufferLLVM.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_CORE_DATABUFFERLLVM_H
-#define LLDB_CORE_DATABUFFERLLVM_H
+#ifndef LLDB_UTILITY_DATABUFFERLLVM_H
+#define LLDB_UTILITY_DATABUFFERLLVM_H
#include "lldb/Utility/DataBuffer.h"
#include "lldb/lldb-types.h"
diff --git a/linux-x64/clang/include/lldb/Utility/DataEncoder.h b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
index 19b7cef..8edec54 100644
--- a/linux-x64/clang/include/lldb/Utility/DataEncoder.h
+++ b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DataEncoder_h_
-#define liblldb_DataEncoder_h_
+#ifndef LLDB_UTILITY_DATAENCODER_H
+#define LLDB_UTILITY_DATAENCODER_H
#if defined(__cplusplus)
@@ -21,8 +21,9 @@
namespace lldb_private {
-/// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data
-/// encoding class.
+/// \class DataEncoder
+///
+/// An binary data encoding class.
///
/// DataEncoder is a class that can encode binary data (swapping if needed) to
/// a data buffer. The data buffer can be caller owned, or can be shared data
@@ -86,74 +87,6 @@
/// any references to shared data that this object may contain.
void Clear();
- /// Get the current address size.
- ///
- /// Return the size in bytes of any address values this object will extract.
- ///
- /// \return
- /// The size in bytes of address values that will be extracted.
- uint8_t GetAddressByteSize() const { return m_addr_size; }
-
- /// Get the number of bytes contained in this object.
- ///
- /// \return
- /// The total number of bytes of data this object refers to.
- size_t GetByteSize() const { return m_end - m_start; }
-
- /// Get the data end pointer.
- ///
- /// \return
- /// Returns a pointer to the next byte contained in this
- /// object's data, or NULL of there is no data in this object.
- uint8_t *GetDataEnd() { return m_end; }
-
- const uint8_t *GetDataEnd() const { return m_end; }
-
- /// Get the shared data offset.
- ///
- /// Get the offset of the first byte of data in the shared data (if any).
- ///
- /// \return
- /// If this object contains shared data, this function returns
- /// the offset in bytes into that shared data, zero otherwise.
- size_t GetSharedDataOffset() const;
-
- /// Get the current byte order value.
- ///
- /// \return
- /// The current byte order value from this object's internal
- /// state.
- lldb::ByteOrder GetByteOrder() const { return m_byte_order; }
-
- /// Get the data start pointer.
- ///
- /// \return
- /// Returns a pointer to the first byte contained in this
- /// object's data, or NULL of there is no data in this object.
- uint8_t *GetDataStart() { return m_start; }
-
- const uint8_t *GetDataStart() const { return m_start; }
-
- /// Encode unsigned integer values into the data at \a offset.
- ///
- /// \param[in] offset
- /// The offset within the contained data at which to put the
- /// data.
- ///
- /// \param[in] value
- /// The value to encode into the data.
- ///
- /// \return
- /// The next offset in the bytes of this data if the data
- /// was successfully encoded, UINT32_MAX if the encoding failed.
- uint32_t PutU8(uint32_t offset, uint8_t value);
-
- uint32_t PutU16(uint32_t offset, uint16_t value);
-
- uint32_t PutU32(uint32_t offset, uint32_t value);
-
- uint32_t PutU64(uint32_t offset, uint64_t value);
-
/// Encode an unsigned integer of size \a byte_size to \a offset.
///
/// Encode a single integer value at \a offset and return the offset that
@@ -176,7 +109,7 @@
/// \return
/// The next offset in the bytes of this data if the integer
/// was successfully encoded, UINT32_MAX if the encoding failed.
- uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value);
+ uint32_t PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value);
/// Encode an arbitrary number of bytes.
///
@@ -204,12 +137,11 @@
/// m_addr_size member variable and should be set correctly prior to
/// extracting any address values.
///
- /// \param[in,out] offset_ptr
- /// A pointer to an offset within the data that will be advanced
- /// by the appropriate number of bytes if the value is extracted
- /// correctly. If the offset is out of bounds or there are not
- /// enough bytes to extract this value, the offset will be left
- /// unmodified.
+ /// \param[in] offset
+ /// The offset where to encode the address.
+ ///
+ /// \param[in] addr
+ /// The address to encode.
///
/// \return
/// The next valid offset within data if the put operation
@@ -220,50 +152,40 @@
///
/// Encodes a C string into the existing data including the terminating
///
- /// \param[in,out] offset_ptr
- /// A pointer to an offset within the data that will be advanced
- /// by the appropriate number of bytes if the value is extracted
- /// correctly. If the offset is out of bounds or there are not
- /// enough bytes to extract this value, the offset will be left
- /// unmodified.
+ /// \param[in] offset
+ /// The offset where to encode the string.
+ ///
+ /// \param[in] cstr
+ /// The string to encode.
///
/// \return
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the C string is out of bounds,
/// NULL will be returned.
- uint32_t PutCString(uint32_t offset_ptr, const char *cstr);
+ uint32_t PutCString(uint32_t offset, const char *cstr);
- lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; }
+private:
+ uint32_t PutU8(uint32_t offset, uint8_t value);
+ uint32_t PutU16(uint32_t offset, uint16_t value);
+ uint32_t PutU32(uint32_t offset, uint32_t value);
+ uint32_t PutU64(uint32_t offset, uint64_t value);
- /// Set the address byte size.
- ///
- /// Set the size in bytes that will be used when extracting any address and
- /// pointer values from data contained in this object.
- ///
- /// \param[in] addr_size
- /// The size in bytes to use when extracting addresses.
- void SetAddressByteSize(uint8_t addr_size) { m_addr_size = addr_size; }
+ uint32_t BytesLeft(uint32_t offset) const {
+ const uint32_t size = GetByteSize();
+ if (size > offset)
+ return size - offset;
+ return 0;
+ }
- /// Set data with a buffer that is caller owned.
- ///
- /// Use data that is owned by the caller when extracting values. The data
- /// must stay around as long as this object, or any object that copies a
- /// subset of this object's data, is valid. If \a bytes is NULL, or \a
- /// length is zero, this object will contain no data.
- ///
- /// \param[in] bytes
- /// A pointer to caller owned data.
- ///
- /// \param[in] length
- /// The length in bytes of \a bytes.
- ///
- /// \param[in] byte_order
- /// A byte order of the data that we are extracting from.
+ /// Test the availability of \a length bytes of data from \a offset.
///
/// \return
- /// The number of bytes that this object now contains.
- uint32_t SetData(void *bytes, uint32_t length, lldb::ByteOrder byte_order);
+ /// \b true if \a offset is a valid offset and there are \a
+ /// length bytes available at that offset, \b false otherwise.
+ bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
+ return length <= BytesLeft(offset);
+ }
/// Adopt a subset of shared data in \a data_sp.
///
@@ -290,15 +212,6 @@
uint32_t SetData(const lldb::DataBufferSP &data_sp, uint32_t offset = 0,
uint32_t length = UINT32_MAX);
- /// Set the byte_order value.
- ///
- /// Sets the byte order of the data to extract. Extracted values will be
- /// swapped if necessary when decoding.
- ///
- /// \param[in] byte_order
- /// The byte order value to use when extracting data.
- void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
-
/// Test the validity of \a offset.
///
/// \return
@@ -306,38 +219,34 @@
/// object, \b false otherwise.
bool ValidOffset(uint32_t offset) const { return offset < GetByteSize(); }
- /// Test the availability of \a length bytes of data from \a offset.
+ /// Get the number of bytes contained in this object.
///
/// \return
- /// \b true if \a offset is a valid offset and there are \a
- /// length bytes available at that offset, \b false otherwise.
- bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
- return length <= BytesLeft(offset);
- }
+ /// The total number of bytes of data this object refers to.
+ size_t GetByteSize() const { return m_end - m_start; }
- uint32_t BytesLeft(uint32_t offset) const {
- const uint32_t size = GetByteSize();
- if (size > offset)
- return size - offset;
- return 0;
- }
+ /// A pointer to the first byte of data.
+ uint8_t *m_start;
-protected:
- // Member variables
- uint8_t *m_start; ///< A pointer to the first byte of data.
- uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
- lldb::ByteOrder
- m_byte_order; ///< The byte order of the data we are extracting from.
- uint8_t m_addr_size; ///< The address size to use when extracting pointers or
- /// addresses
- mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can
- /// be shared among multiple instances
+ /// A pointer to the byte that is past the end of the data.
+ uint8_t *m_end;
-private:
- DISALLOW_COPY_AND_ASSIGN(DataEncoder);
+ /// The byte order of the data we are extracting from.
+ lldb::ByteOrder m_byte_order;
+
+ /// The address size to use when extracting pointers or
+ /// addresses
+ uint8_t m_addr_size;
+
+ /// The shared pointer to data that can
+ /// be shared among multiple instances
+ mutable lldb::DataBufferSP m_data_sp;
+
+ DataEncoder(const DataEncoder &) = delete;
+ const DataEncoder &operator=(const DataEncoder &) = delete;
};
} // namespace lldb_private
#endif // #if defined (__cplusplus)
-#endif // #ifndef liblldb_DataEncoder_h_
+#endif // LLDB_UTILITY_DATAENCODER_H
diff --git a/linux-x64/clang/include/lldb/Utility/DataExtractor.h b/linux-x64/clang/include/lldb/Utility/DataExtractor.h
index 74174b3..0210af5 100644
--- a/linux-x64/clang/include/lldb/Utility/DataExtractor.h
+++ b/linux-x64/clang/include/lldb/Utility/DataExtractor.h
@@ -9,11 +9,14 @@
#ifndef LLDB_UTILITY_DATAEXTRACTOR_H
#define LLDB_UTILITY_DATAEXTRACTOR_H
+#include "lldb/Utility/Endian.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/SwapByteOrder.h"
#include <cassert>
#include <stdint.h>
@@ -167,9 +170,8 @@
/// the beginning of each line and can be offset by base address \a
/// base_addr. \a num_per_line objects will be displayed on each line.
///
- /// \param[in] s
- /// The stream to dump the output to. If nullptr the output will
- /// be dumped to Log().
+ /// \param[in] log
+ /// The log to dump the output to.
///
/// \param[in] offset
/// The offset into the data at which to start dumping.
@@ -188,16 +190,11 @@
/// The type of objects to use when dumping data from this
/// object. See DataExtractor::Type.
///
- /// \param[in] type_format
- /// The optional format to use for the \a type objects. If this
- /// is nullptr, the default format for the \a type will be used.
- ///
/// \return
/// The offset at which dumping ended.
lldb::offset_t PutToLog(Log *log, lldb::offset_t offset,
lldb::offset_t length, uint64_t base_addr,
- uint32_t num_per_line, Type type,
- const char *type_format = nullptr) const;
+ uint32_t num_per_line, Type type) const;
/// Extract an arbitrary number of bytes in the specified byte order.
///
@@ -362,30 +359,29 @@
/// when say copying a partial data value into a register.
///
/// \param[in] src_offset
- /// The offset into this data from which to start copying an
- /// endian entity
+ /// The offset into this data from which to start copying an endian
+ /// entity
///
/// \param[in] src_len
- /// The length of the endian data to copy from this object
- /// into the \a dst object
+ /// The length of the endian data to copy from this object into the \a
+ /// dst object
///
/// \param[out] dst
- /// The buffer where to place the endian data. The data might
- /// need to be byte swapped (and appropriately padded with
- /// zeroes if \a src_len != \a dst_len) if \a dst_byte_order
- /// does not match the byte order in this object.
+ /// The buffer where to place the endian data. The data might need to be
+ /// byte swapped (and appropriately padded with zeroes if \a src_len !=
+ /// \a dst_len) if \a dst_byte_order does not match the byte order in
+ /// this object.
///
/// \param[in] dst_len
- /// The length number of bytes that the endian value will
- /// occupy is \a dst.
+ /// The length number of bytes that the endian value will occupy is \a
+ /// dst.
///
- /// \param[in] byte_order
- /// The byte order that the endian value should be in the \a dst
- /// buffer.
+ /// \param[in] dst_byte_order
+ /// The byte order that the endian value should be in the \a dst buffer.
///
/// \return
- /// Returns the number of bytes that were copied, or zero if
- /// anything goes wrong.
+ /// Returns the number of bytes that were copied, or zero if anything
+ /// goes wrong.
lldb::offset_t CopyByteOrderedData(lldb::offset_t src_offset,
lldb::offset_t src_len, void *dst,
lldb::offset_t dst_len,
@@ -520,7 +516,7 @@
/// enough bytes to extract this value, the offset will be left
/// unmodified.
///
- /// \param[in] byte_size
+ /// \param[in] size
/// The size in byte of the integer to extract.
///
/// \param[in] bitfield_bit_size
@@ -541,13 +537,13 @@
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset) const;
- /// Extract an signed integer of size \a byte_size from \a *offset_ptr, then
- /// extract and signe extend the bitfield from this value if \a
+ /// Extract an signed integer of size \a size from \a *offset_ptr, then
+ /// extract and sign-extend the bitfield from this value if \a
/// bitfield_bit_size is non-zero.
///
- /// Extract a single signed integer value (sign extending if required) and
+ /// Extract a single signed integer value (sign-extending if required) and
/// update the offset pointed to by \a offset_ptr. The size of the extracted
- /// integer is specified by the \a byte_size argument. \a byte_size must
+ /// integer is specified by the \a size argument. \a size must
/// have a value greater than or equal to one and less than or equal to
/// eight since the return value is 64 bits wide.
///
@@ -558,7 +554,7 @@
/// enough bytes to extract this value, the offset will be left
/// unmodified.
///
- /// \param[in] byte_size
+ /// \param[in] size
/// The size in bytes of the integer to extract.
///
/// \param[in] bitfield_bit_size
@@ -579,24 +575,6 @@
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset) const;
- /// Extract an pointer from \a *offset_ptr.
- ///
- /// Extract a single pointer from the data and update the offset pointed to
- /// by \a offset_ptr. The size of the extracted pointer comes from the \a
- /// m_addr_size member variable and should be set correctly prior to
- /// extracting any pointer values.
- ///
- /// \param[in,out] offset_ptr
- /// A pointer to an offset within the data that will be advanced
- /// by the appropriate number of bytes if the value is extracted
- /// correctly. If the offset is out of bounds or there are not
- /// enough bytes to extract this value, the offset will be left
- /// unmodified.
- ///
- /// \return
- /// The extracted pointer value as a 64 integer.
- uint64_t GetPointer(lldb::offset_t *offset_ptr) const;
-
/// Get the current byte order value.
///
/// \return
@@ -956,14 +934,14 @@
/// unmodified.
///
/// \return
- // The number of bytes consumed during the extraction.
+ /// The number of bytes consumed during the extraction.
uint32_t Skip_LEB128(lldb::offset_t *offset_ptr) const;
/// Test the validity of \a offset.
///
/// \return
- /// \b true if \a offset is a valid offset into the data in this
- /// object, \b false otherwise.
+ /// true if \a offset is a valid offset into the data in this object,
+ /// false otherwise.
bool ValidOffset(lldb::offset_t offset) const {
return offset < GetByteSize();
}
@@ -971,8 +949,8 @@
/// Test the availability of \a length bytes of data from \a offset.
///
/// \return
- /// \b true if \a offset is a valid offset and there are \a
- /// length bytes available at that offset, \b false otherwise.
+ /// true if \a offset is a valid offset and there are \a
+ /// length bytes available at that offset, false otherwise.
bool ValidOffsetForDataOfSize(lldb::offset_t offset,
lldb::offset_t length) const {
return length <= BytesLeft(offset);
@@ -997,20 +975,39 @@
return {GetDataStart(), size_t(GetByteSize())};
}
+ llvm::DataExtractor GetAsLLVM() const {
+ return {GetData(), GetByteOrder() == lldb::eByteOrderLittle,
+ uint8_t(GetAddressByteSize())};
+ }
+
protected:
+ template <typename T> T Get(lldb::offset_t *offset_ptr, T fail_value) const {
+ constexpr size_t src_size = sizeof(T);
+ T val = fail_value;
+
+ const T *src = static_cast<const T *>(GetData(offset_ptr, src_size));
+ if (!src)
+ return val;
+
+ memcpy(&val, src, src_size);
+ if (m_byte_order != endian::InlHostByteOrder())
+ llvm::sys::swapByteOrder(val);
+
+ return val;
+ }
+
// Member variables
const uint8_t *m_start; ///< A pointer to the first byte of data.
const uint8_t
*m_end; ///< A pointer to the byte that is past the end of the data.
lldb::ByteOrder
m_byte_order; ///< The byte order of the data we are extracting from.
- uint32_t m_addr_size; ///< The address size to use when extracting pointers or
- /// addresses
- mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can
- /// be shared among multiple instances
+ uint32_t m_addr_size; ///< The address size to use when extracting addresses.
+ /// The shared pointer to data that can be shared among multiple instances
+ lldb::DataBufferSP m_data_sp;
const uint32_t m_target_byte_size;
};
} // namespace lldb_private
-#endif // liblldb_DataExtractor_h_
+#endif // LLDB_UTILITY_DATAEXTRACTOR_H
diff --git a/linux-x64/clang/include/lldb/Utility/Endian.h b/linux-x64/clang/include/lldb/Utility/Endian.h
index cead5f8..1d1f8fa 100644
--- a/linux-x64/clang/include/lldb/Utility/Endian.h
+++ b/linux-x64/clang/include/lldb/Utility/Endian.h
@@ -30,4 +30,4 @@
}
}
-#endif // liblldb_host_endian_h_
+#endif // LLDB_UTILITY_ENDIAN_H
diff --git a/linux-x64/clang/include/lldb/Utility/Environment.h b/linux-x64/clang/include/lldb/Utility/Environment.h
index 398b3ba..e2af2eb 100644
--- a/linux-x64/clang/include/lldb/Utility/Environment.h
+++ b/linux-x64/clang/include/lldb/Utility/Environment.h
@@ -50,6 +50,7 @@
using Base::erase;
using Base::find;
using Base::insert;
+ using Base::insert_or_assign;
using Base::lookup;
using Base::size;
using Base::try_emplace;
@@ -68,7 +69,8 @@
}
std::pair<iterator, bool> insert(llvm::StringRef KeyEqValue) {
- return insert(KeyEqValue.split('='));
+ auto Split = KeyEqValue.split('=');
+ return insert(std::make_pair(Split.first, std::string(Split.second)));
}
void insert(const_iterator first, const_iterator last);
@@ -92,4 +94,4 @@
};
} // namespace llvm
-#endif // #ifndef LLDB_UTILITY_ENVIRONMENT_H
+#endif // LLDB_UTILITY_ENVIRONMENT_H
diff --git a/linux-x64/clang/include/lldb/Utility/Event.h b/linux-x64/clang/include/lldb/Utility/Event.h
index dd5d080..06c0262 100644
--- a/linux-x64/clang/include/lldb/Utility/Event.h
+++ b/linux-x64/clang/include/lldb/Utility/Event.h
@@ -48,7 +48,8 @@
private:
virtual void DoOnRemoval(Event *event_ptr) {}
- DISALLOW_COPY_AND_ASSIGN(EventData);
+ EventData(const EventData &) = delete;
+ const EventData &operator=(const EventData &) = delete;
};
// lldb::EventDataBytes
@@ -92,7 +93,8 @@
private:
std::string m_bytes;
- DISALLOW_COPY_AND_ASSIGN(EventDataBytes);
+ EventDataBytes(const EventDataBytes &) = delete;
+ const EventDataBytes &operator=(const EventDataBytes &) = delete;
};
class EventDataReceipt : public EventData {
@@ -169,7 +171,9 @@
StructuredData::ObjectSP m_object_sp;
lldb::StructuredDataPluginSP m_plugin_sp;
- DISALLOW_COPY_AND_ASSIGN(EventDataStructuredData);
+ EventDataStructuredData(const EventDataStructuredData &) = delete;
+ const EventDataStructuredData &
+ operator=(const EventDataStructuredData &) = delete;
};
// lldb::Event
@@ -242,7 +246,8 @@
uint32_t m_type; // The bit describing this event
lldb::EventDataSP m_data_sp; // User specific data for this event
- DISALLOW_COPY_AND_ASSIGN(Event);
+ Event(const Event &) = delete;
+ const Event &operator=(const Event &) = delete;
Event() = delete;
};
diff --git a/linux-x64/clang/include/lldb/Utility/FileCollector.h b/linux-x64/clang/include/lldb/Utility/FileCollector.h
deleted file mode 100644
index a892067..0000000
--- a/linux-x64/clang/include/lldb/Utility/FileCollector.h
+++ /dev/null
@@ -1,77 +0,0 @@
-//===-- FileCollector.h -----------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLDB_UTILITY_FILE_COLLECTOR_H
-#define LLDB_UTILITY_FILE_COLLECTOR_H
-
-#include "lldb/Utility/FileSpec.h"
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/VirtualFileSystem.h"
-
-#include <mutex>
-
-namespace lldb_private {
-
-/// Collects files into a directory and generates a mapping that can be used by
-/// the VFS.
-class FileCollector {
-public:
- FileCollector(const FileSpec &root, const FileSpec &overlay);
-
- void AddFile(const llvm::Twine &file);
- void AddFile(const FileSpec &file) { return AddFile(file.GetPath()); }
-
- /// Write the yaml mapping (for the VFS) to the given file.
- std::error_code WriteMapping(const FileSpec &mapping_file);
-
- /// Copy the files into the root directory.
- ///
- /// When stop_on_error is true (the default) we abort as soon as one file
- /// cannot be copied. This is relatively common, for example when a file was
- /// removed after it was added to the mapping.
- std::error_code CopyFiles(bool stop_on_error = true);
-
-protected:
- void AddFileImpl(llvm::StringRef src_path);
-
- bool MarkAsSeen(llvm::StringRef path) { return m_seen.insert(path).second; }
-
- bool GetRealPath(llvm::StringRef src_path,
- llvm::SmallVectorImpl<char> &result);
-
- void AddFileToMapping(llvm::StringRef virtual_path,
- llvm::StringRef real_path) {
- m_vfs_writer.addFileMapping(virtual_path, real_path);
- }
-
- /// Synchronizes adding files.
- std::mutex m_mutex;
-
- /// The root directory where files are copied.
- FileSpec m_root;
-
- /// The root directory where the VFS overlay lives.
- FileSpec m_overlay_root;
-
- /// Tracks already seen files so they can be skipped.
- llvm::StringSet<> m_seen;
-
- /// The yaml mapping writer.
- llvm::vfs::YAMLVFSWriter m_vfs_writer;
-
- /// Caches real_path calls when resolving symlinks.
- llvm::StringMap<std::string> m_symlink_map;
-};
-
-} // namespace lldb_private
-
-#endif // LLDB_UTILITY_FILE_COLLECTOR_H
diff --git a/linux-x64/clang/include/lldb/Utility/FileSpec.h b/linux-x64/clang/include/lldb/Utility/FileSpec.h
index f0bc5c8..f7cbeb2 100644
--- a/linux-x64/clang/include/lldb/Utility/FileSpec.h
+++ b/linux-x64/clang/include/lldb/Utility/FileSpec.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_FileSpec_h_
-#define liblldb_FileSpec_h_
+#ifndef LLDB_UTILITY_FILESPEC_H
+#define LLDB_UTILITY_FILESPEC_H
#include <functional>
#include <string>
@@ -18,6 +18,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/YAMLTraits.h"
#include <stddef.h>
#include <stdint.h>
@@ -73,35 +74,12 @@
/// \see FileSpec::SetFile (const char *path)
explicit FileSpec(llvm::StringRef path, Style style = Style::native);
- explicit FileSpec(llvm::StringRef path, const llvm::Triple &Triple);
-
- /// Copy constructor
- ///
- /// Makes a copy of the uniqued directory and filename strings from \a rhs
- /// if it is not nullptr.
- ///
- /// \param[in] rhs
- /// A const FileSpec object pointer to copy if non-nullptr.
- FileSpec(const FileSpec *rhs);
-
- /// Destructor.
- ~FileSpec();
+ explicit FileSpec(llvm::StringRef path, const llvm::Triple &triple);
bool DirectoryEquals(const FileSpec &other) const;
bool FileEquals(const FileSpec &other) const;
- /// Assignment operator.
- ///
- /// Makes a copy of the uniqued directory and filename strings from \a rhs.
- ///
- /// \param[in] rhs
- /// A const FileSpec object reference to assign to this object.
- ///
- /// \return
- /// A const reference to this object.
- const FileSpec &operator=(const FileSpec &rhs);
-
/// Equal to operator
///
/// Tests if this object is equal to \a rhs.
@@ -200,14 +178,18 @@
/// only the filename will be compared, else a full comparison
/// is done.
///
- /// \return
- /// \li -1 if \a lhs is less than \a rhs
- /// \li 0 if \a lhs is equal to \a rhs
- /// \li 1 if \a lhs is greater than \a rhs
+ /// \return -1 if \a lhs is less than \a rhs, 0 if \a lhs is equal to \a rhs,
+ /// 1 if \a lhs is greater than \a rhs
static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full);
static bool Equal(const FileSpec &a, const FileSpec &b, bool full);
+ /// Match FileSpec \a pattern against FileSpec \a file. If \a pattern has a
+ /// directory component, then the \a file must have the same directory
+ /// component. Otherwise, just it matches just the filename. An empty \a
+ /// pattern matches everything.
+ static bool Match(const FileSpec &pattern, const FileSpec &file);
+
/// Attempt to guess path style for a given path string. It returns a style,
/// if it was able to make a reasonable guess, or None if it wasn't. The guess
/// will be correct if the input path was a valid absolute path on the system
@@ -230,7 +212,7 @@
///
/// \param[in] s
/// The stream to which to dump the object description.
- void Dump(Stream *s) const;
+ void Dump(llvm::raw_ostream &s) const;
Style GetPathStyle() const;
@@ -322,10 +304,6 @@
/// Extract the full path to the file.
///
/// Extract the directory and path into an llvm::SmallVectorImpl<>
- ///
- /// \return
- /// Returns a std::string with the directory and filename
- /// concatenated.
void GetPath(llvm::SmallVectorImpl<char> &path,
bool denormalize = true) const;
@@ -336,8 +314,7 @@
/// filename has no extension, ConstString(nullptr) is returned. The dot
/// ('.') character is not returned as part of the extension
///
- /// \return
- /// Returns the extension of the file as a ConstString object.
+ /// \return Returns the extension of the file as a ConstString object.
ConstString GetFileNameExtension() const;
/// Return the filename without the extension part
@@ -346,9 +323,7 @@
/// without the extension part (e.g. for a file named "foo.bar", "foo" is
/// returned)
///
- /// \return
- /// Returns the filename without extension
- /// as a ConstString object.
+ /// \return Returns the filename without extension as a ConstString object.
ConstString GetFileNameStrippingExtension() const;
/// Get the memory cost of this object.
@@ -372,12 +347,22 @@
/// \param[in] path
/// A full, partial, or relative path to a file.
///
- /// \param[in] resolve_path
- /// If \b true, then we will try to resolve links the path using
- /// the static FileSpec::Resolve.
+ /// \param[in] style
+ /// The style for the given path.
void SetFile(llvm::StringRef path, Style style);
- void SetFile(llvm::StringRef path, const llvm::Triple &Triple);
+ /// Change the file specified with a new path.
+ ///
+ /// Update the contents of this object with a new path. The path will be
+ /// split up into a directory and filename and stored as uniqued string
+ /// values for quick comparison and efficient memory usage.
+ ///
+ /// \param[in] path
+ /// A full, partial, or relative path to a file.
+ ///
+ /// \param[in] triple
+ /// The triple which is used to set the Path style.
+ void SetFile(llvm::StringRef path, const llvm::Triple &triple);
bool IsResolved() const { return m_is_resolved; }
@@ -413,6 +398,8 @@
ConstString GetLastPathComponent() const;
protected:
+ friend struct llvm::yaml::MappingTraits<FileSpec>;
+
// Convenience method for setting the file without changing the style.
void SetFile(llvm::StringRef path);
@@ -426,6 +413,8 @@
/// Dump a FileSpec object to a stream
Stream &operator<<(Stream &s, const FileSpec &f);
+/// Prevent ODR violations with traits for llvm::sys::path::Style.
+LLVM_YAML_STRONG_TYPEDEF(FileSpec::Style, FileSpecStyle)
} // namespace lldb_private
namespace llvm {
@@ -452,6 +441,16 @@
static void format(const lldb_private::FileSpec &F, llvm::raw_ostream &Stream,
StringRef Style);
};
+
+namespace yaml {
+template <> struct ScalarEnumerationTraits<lldb_private::FileSpecStyle> {
+ static void enumeration(IO &io, lldb_private::FileSpecStyle &style);
+};
+
+template <> struct MappingTraits<lldb_private::FileSpec> {
+ static void mapping(IO &io, lldb_private::FileSpec &f);
+};
+} // namespace yaml
} // namespace llvm
-#endif // liblldb_FileSpec_h_
+#endif // LLDB_UTILITY_FILESPEC_H
diff --git a/linux-x64/clang/include/lldb/Utility/Flags.h b/linux-x64/clang/include/lldb/Utility/Flags.h
index 48b14e7..19f7506 100644
--- a/linux-x64/clang/include/lldb/Utility/Flags.h
+++ b/linux-x64/clang/include/lldb/Utility/Flags.h
@@ -29,21 +29,10 @@
/// Constructs this object with \a mask as the initial value for all of the
/// flags.
///
- /// \param[in] mask
+ /// \param[in] flags
/// The initial value for all flags.
Flags(ValueType flags = 0) : m_flags(flags) {}
- /// Copy constructor.
- ///
- /// Construct and copy the flags from \a rhs.
- ///
- /// \param[in] rhs
- /// A const Flags object reference to copy.
- Flags(const Flags &rhs) : m_flags(rhs.m_flags) {}
-
- /// Destructor.
- ~Flags() {}
-
/// Get accessor for all flags.
///
/// \return
@@ -121,36 +110,10 @@
/// \b true if \a bit is 0, \b false otherwise.
bool IsClear(ValueType bit) const { return (m_flags & bit) == 0; }
- /// Get the number of zero bits in \a m_flags.
- ///
- /// \return
- /// The number of bits that are set to 0 in the current flags.
- size_t ClearCount() const {
- size_t count = 0;
- for (ValueType shift = 0; shift < sizeof(ValueType) * 8; ++shift) {
- if ((m_flags & (1u << shift)) == 0)
- ++count;
- }
- return count;
- }
-
- /// Get the number of one bits in \a m_flags.
- ///
- /// \return
- /// The number of bits that are set to 1 in the current flags.
- size_t SetCount() const {
- size_t count = 0;
- for (ValueType mask = m_flags; mask; mask >>= 1) {
- if (mask & 1u)
- ++count;
- }
- return count;
- }
-
protected:
ValueType m_flags; ///< The flags.
};
} // namespace lldb_private
-#endif // liblldb_Flags_h_
+#endif // LLDB_UTILITY_FLAGS_H
diff --git a/linux-x64/clang/include/lldb/Utility/GDBRemote.h b/linux-x64/clang/include/lldb/Utility/GDBRemote.h
new file mode 100644
index 0000000..2ee706e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/GDBRemote.h
@@ -0,0 +1,158 @@
+//===-- GDBRemote.h ----------------------------------------------*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_GDBREMOTE_H
+#define LLDB_UTILITY_GDBREMOTE_H
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/ReproducerProvider.h"
+#include "lldb/Utility/StreamString.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+#include "llvm/Support/YAMLTraits.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+namespace lldb_private {
+
+class StreamGDBRemote : public StreamString {
+public:
+ StreamGDBRemote();
+
+ StreamGDBRemote(uint32_t flags, uint32_t addr_size,
+ lldb::ByteOrder byte_order);
+
+ ~StreamGDBRemote() override;
+
+ /// Output a block of data to the stream performing GDB-remote escaping.
+ ///
+ /// \param[in] s
+ /// A block of data.
+ ///
+ /// \param[in] src_len
+ /// The amount of data to write.
+ ///
+ /// \return
+ /// Number of bytes written.
+ // TODO: Convert this function to take ArrayRef<uint8_t>
+ int PutEscapedBytes(const void *s, size_t src_len);
+};
+
+/// GDB remote packet as used by the reproducer and the GDB remote
+/// communication history. Packets can be serialized to file.
+struct GDBRemotePacket {
+
+ friend llvm::yaml::MappingTraits<GDBRemotePacket>;
+
+ enum Type { ePacketTypeInvalid = 0, ePacketTypeSend, ePacketTypeRecv };
+
+ GDBRemotePacket()
+ : packet(), type(ePacketTypeInvalid), bytes_transmitted(0), packet_idx(0),
+ tid(LLDB_INVALID_THREAD_ID) {}
+
+ void Clear() {
+ packet.data.clear();
+ type = ePacketTypeInvalid;
+ bytes_transmitted = 0;
+ packet_idx = 0;
+ tid = LLDB_INVALID_THREAD_ID;
+ }
+
+ struct BinaryData {
+ std::string data;
+ };
+
+ void Dump(Stream &strm) const;
+
+ BinaryData packet;
+ Type type;
+ uint32_t bytes_transmitted;
+ uint32_t packet_idx;
+ lldb::tid_t tid;
+
+private:
+ llvm::StringRef GetTypeStr() const;
+};
+
+namespace repro {
+class PacketRecorder : public AbstractRecorder {
+public:
+ PacketRecorder(const FileSpec &filename, std::error_code &ec)
+ : AbstractRecorder(filename, ec) {}
+
+ static llvm::Expected<std::unique_ptr<PacketRecorder>>
+ Create(const FileSpec &filename);
+
+ void Record(const GDBRemotePacket &packet);
+};
+
+class GDBRemoteProvider : public repro::Provider<GDBRemoteProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ GDBRemoteProvider(const FileSpec &directory) : Provider(directory) {}
+
+ llvm::raw_ostream *GetHistoryStream();
+ PacketRecorder *GetNewPacketRecorder();
+
+ void SetCallback(std::function<void()> callback) {
+ m_callback = std::move(callback);
+ }
+
+ void Keep() override;
+ void Discard() override;
+
+ static char ID;
+
+private:
+ std::function<void()> m_callback;
+ std::unique_ptr<llvm::raw_fd_ostream> m_stream_up;
+ std::vector<std::unique_ptr<PacketRecorder>> m_packet_recorders;
+};
+
+} // namespace repro
+} // namespace lldb_private
+
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(lldb_private::GDBRemotePacket)
+LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(std::vector<lldb_private::GDBRemotePacket>)
+
+namespace llvm {
+namespace yaml {
+
+template <>
+struct ScalarEnumerationTraits<lldb_private::GDBRemotePacket::Type> {
+ static void enumeration(IO &io, lldb_private::GDBRemotePacket::Type &value);
+};
+
+template <> struct ScalarTraits<lldb_private::GDBRemotePacket::BinaryData> {
+ static void output(const lldb_private::GDBRemotePacket::BinaryData &, void *,
+ raw_ostream &);
+
+ static StringRef input(StringRef, void *,
+ lldb_private::GDBRemotePacket::BinaryData &);
+
+ static QuotingType mustQuote(StringRef S) { return QuotingType::None; }
+};
+
+template <> struct MappingTraits<lldb_private::GDBRemotePacket> {
+ static void mapping(IO &io, lldb_private::GDBRemotePacket &Packet);
+
+ static StringRef validate(IO &io, lldb_private::GDBRemotePacket &);
+};
+
+} // namespace yaml
+} // namespace llvm
+
+#endif // LLDB_UTILITY_GDBREMOTE_H
diff --git a/linux-x64/clang/include/lldb/Utility/IOObject.h b/linux-x64/clang/include/lldb/Utility/IOObject.h
index 1640200..9b2b9cf 100644
--- a/linux-x64/clang/include/lldb/Utility/IOObject.h
+++ b/linux-x64/clang/include/lldb/Utility/IOObject.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Host_Common_IOObject_h_
-#define liblldb_Host_Common_IOObject_h_
+#ifndef LLDB_UTILITY_IOOBJECT_H
+#define LLDB_UTILITY_IOOBJECT_H
#include <stdarg.h>
#include <stdio.h>
@@ -29,8 +29,7 @@
typedef int WaitableHandle;
static const WaitableHandle kInvalidHandleValue;
- IOObject(FDType type, bool should_close)
- : m_fd_type(type), m_should_close_fd(should_close) {}
+ IOObject(FDType type) : m_fd_type(type) {}
virtual ~IOObject();
virtual Status Read(void *buf, size_t &num_bytes) = 0;
@@ -44,11 +43,10 @@
protected:
FDType m_fd_type;
- bool m_should_close_fd; // True if this class should close the file descriptor
- // when it goes away.
private:
- DISALLOW_COPY_AND_ASSIGN(IOObject);
+ IOObject(const IOObject &) = delete;
+ const IOObject &operator=(const IOObject &) = delete;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Utility/Iterable.h b/linux-x64/clang/include/lldb/Utility/Iterable.h
index d9c61aa..5c38e46 100644
--- a/linux-x64/clang/include/lldb/Utility/Iterable.h
+++ b/linux-x64/clang/include/lldb/Utility/Iterable.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Iterable_h_
-#define liblldb_Iterable_h_
+#ifndef LLDB_UTILITY_ITERABLE_H
+#define LLDB_UTILITY_ITERABLE_H
#include <utility>
@@ -170,7 +170,7 @@
typename MutexType>
class LockingAdaptedIterable : public AdaptedIterable<C, E, A> {
public:
- LockingAdaptedIterable(C &container, MutexType &mutex)
+ LockingAdaptedIterable(const C &container, MutexType &mutex)
: AdaptedIterable<C, E, A>(container), m_mutex(&mutex) {
m_mutex->lock();
}
@@ -194,4 +194,4 @@
} // namespace lldb_private
-#endif // liblldb_Iterable_h_
+#endif // LLDB_UTILITY_ITERABLE_H
diff --git a/linux-x64/clang/include/lldb/Utility/JSON.h b/linux-x64/clang/include/lldb/Utility/JSON.h
deleted file mode 100644
index 172f77a..0000000
--- a/linux-x64/clang/include/lldb/Utility/JSON.h
+++ /dev/null
@@ -1,283 +0,0 @@
-//===---------------------JSON.h --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_JSON_h_
-#define utility_JSON_h_
-
-#include "lldb/Utility/StringExtractor.h"
-
-#include <map>
-#include <memory>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include <stdint.h>
-
-namespace lldb_private {
-class Stream;
-
-class JSONValue {
-public:
- virtual void Write(Stream &s) = 0;
-
- typedef std::shared_ptr<JSONValue> SP;
-
- enum class Kind { String, Number, True, False, Null, Object, Array };
-
- JSONValue(Kind k) : m_kind(k) {}
-
- Kind GetKind() const { return m_kind; }
-
- virtual ~JSONValue() = default;
-
-private:
- const Kind m_kind;
-};
-
-class JSONString : public JSONValue {
-public:
- JSONString();
- JSONString(const char *s);
- JSONString(const std::string &s);
-
- JSONString(const JSONString &s) = delete;
- JSONString &operator=(const JSONString &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONString> SP;
-
- std::string GetData() { return m_data; }
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::String;
- }
-
- ~JSONString() override = default;
-
-private:
- static std::string json_string_quote_metachars(const std::string &);
-
- std::string m_data;
-};
-
-class JSONNumber : public JSONValue {
-public:
- typedef std::shared_ptr<JSONNumber> SP;
-
- // We cretae a constructor for all integer and floating point type with using
- // templates and
- // SFINAE to avoid having ambiguous overloads because of the implicit type
- // promotion. If we
- // would have constructors only with int64_t, uint64_t and double types then
- // constructing a JSONNumber from an int32_t (or any other similar type)
- // would fail to compile.
-
- template <typename T, typename std::enable_if<
- std::is_integral<T>::value &&
- std::is_unsigned<T>::value>::type * = nullptr>
- explicit JSONNumber(T u)
- : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Unsigned) {
- m_data.m_unsigned = u;
- }
-
- template <typename T,
- typename std::enable_if<std::is_integral<T>::value &&
- std::is_signed<T>::value>::type * = nullptr>
- explicit JSONNumber(T s)
- : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Signed) {
- m_data.m_signed = s;
- }
-
- template <typename T, typename std::enable_if<
- std::is_floating_point<T>::value>::type * = nullptr>
- explicit JSONNumber(T d)
- : JSONValue(JSONValue::Kind::Number), m_data_type(DataType::Double) {
- m_data.m_double = d;
- }
-
- ~JSONNumber() override = default;
-
- JSONNumber(const JSONNumber &s) = delete;
- JSONNumber &operator=(const JSONNumber &s) = delete;
-
- void Write(Stream &s) override;
-
- uint64_t GetAsUnsigned() const;
-
- int64_t GetAsSigned() const;
-
- double GetAsDouble() const;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::Number;
- }
-
-private:
- enum class DataType : uint8_t { Unsigned, Signed, Double } m_data_type;
-
- union {
- uint64_t m_unsigned;
- int64_t m_signed;
- double m_double;
- } m_data;
-};
-
-class JSONTrue : public JSONValue {
-public:
- JSONTrue();
-
- JSONTrue(const JSONTrue &s) = delete;
- JSONTrue &operator=(const JSONTrue &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONTrue> SP;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::True;
- }
-
- ~JSONTrue() override = default;
-};
-
-class JSONFalse : public JSONValue {
-public:
- JSONFalse();
-
- JSONFalse(const JSONFalse &s) = delete;
- JSONFalse &operator=(const JSONFalse &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONFalse> SP;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::False;
- }
-
- ~JSONFalse() override = default;
-};
-
-class JSONNull : public JSONValue {
-public:
- JSONNull();
-
- JSONNull(const JSONNull &s) = delete;
- JSONNull &operator=(const JSONNull &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONNull> SP;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::Null;
- }
-
- ~JSONNull() override = default;
-};
-
-class JSONObject : public JSONValue {
-public:
- JSONObject();
-
- JSONObject(const JSONObject &s) = delete;
- JSONObject &operator=(const JSONObject &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONObject> SP;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::Object;
- }
-
- bool SetObject(const std::string &key, JSONValue::SP value);
-
- JSONValue::SP GetObject(const std::string &key);
-
- ~JSONObject() override = default;
-
-private:
- typedef std::map<std::string, JSONValue::SP> Map;
- typedef Map::iterator Iterator;
- Map m_elements;
-};
-
-class JSONArray : public JSONValue {
-public:
- JSONArray();
-
- JSONArray(const JSONArray &s) = delete;
- JSONArray &operator=(const JSONArray &s) = delete;
-
- void Write(Stream &s) override;
-
- typedef std::shared_ptr<JSONArray> SP;
-
- static bool classof(const JSONValue *V) {
- return V->GetKind() == JSONValue::Kind::Array;
- }
-
-private:
- typedef std::vector<JSONValue::SP> Vector;
- typedef Vector::iterator Iterator;
- typedef Vector::size_type Index;
- typedef Vector::size_type Size;
-
-public:
- bool SetObject(Index i, JSONValue::SP value);
-
- bool AppendObject(JSONValue::SP value);
-
- JSONValue::SP GetObject(Index i);
-
- Size GetNumElements();
-
- ~JSONArray() override = default;
-
- Vector m_elements;
-};
-
-class JSONParser : public StringExtractor {
-public:
- enum Token {
- Invalid,
- Status,
- ObjectStart,
- ObjectEnd,
- ArrayStart,
- ArrayEnd,
- Comma,
- Colon,
- String,
- Integer,
- Float,
- True,
- False,
- Null,
- EndOfFile
- };
-
- JSONParser(llvm::StringRef data);
-
- int GetEscapedChar(bool &was_escaped);
-
- Token GetToken(std::string &value);
-
- JSONValue::SP ParseJSONValue();
-
-protected:
- JSONValue::SP ParseJSONObject();
-
- JSONValue::SP ParseJSONArray();
-};
-} // namespace lldb_private
-
-#endif // utility_JSON_h_
diff --git a/linux-x64/clang/include/lldb/Utility/LLDBAssert.h b/linux-x64/clang/include/lldb/Utility/LLDBAssert.h
index 7008dd8..845af1d 100644
--- a/linux-x64/clang/include/lldb/Utility/LLDBAssert.h
+++ b/linux-x64/clang/include/lldb/Utility/LLDBAssert.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_LLDBAssert_h_
-#define utility_LLDBAssert_h_
+#ifndef LLDB_UTILITY_LLDBASSERT_H
+#define LLDB_UTILITY_LLDBASSERT_H
#ifdef LLDB_CONFIGURATION_DEBUG
#define lldbassert(x) assert(x)
@@ -22,4 +22,4 @@
const char *file, unsigned int line);
}
-#endif // utility_LLDBAssert_h_
+#endif // LLDB_UTILITY_LLDBASSERT_H
diff --git a/linux-x64/clang/include/lldb/Utility/Listener.h b/linux-x64/clang/include/lldb/Utility/Listener.h
index 17fc478..9d96e36 100644
--- a/linux-x64/clang/include/lldb/Utility/Listener.h
+++ b/linux-x64/clang/include/lldb/Utility/Listener.h
@@ -145,7 +145,8 @@
// bool exact);
// For Listener only
- DISALLOW_COPY_AND_ASSIGN(Listener);
+ Listener(const Listener &) = delete;
+ const Listener &operator=(const Listener &) = delete;
};
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Utility/Log.h b/linux-x64/clang/include/lldb/Utility/Log.h
index 949de69..01edec0 100644
--- a/linux-x64/clang/include/lldb/Utility/Log.h
+++ b/linux-x64/clang/include/lldb/Utility/Log.h
@@ -14,6 +14,7 @@
#include "lldb/lldb-defines.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
@@ -112,6 +113,14 @@
static bool ListChannelCategories(llvm::StringRef channel,
llvm::raw_ostream &stream);
+ /// Returns the list of log channels.
+ static std::vector<llvm::StringRef> ListChannels();
+ /// Calls the given lambda for every category in the given channel.
+ /// If no channel with the given name exists, lambda is never called.
+ static void ForEachChannelCategory(
+ llvm::StringRef channel,
+ llvm::function_ref<void(llvm::StringRef, llvm::StringRef)> lambda);
+
static void DisableAllLogChannels();
static void ListAllLogChannels(llvm::raw_ostream &stream);
@@ -142,14 +151,11 @@
std::forward<Args>(args)...));
}
+ /// Prefer using LLDB_LOGF whenever possible.
void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
- void VAPrintf(const char *format, va_list args);
-
void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
- void VAError(const char *format, va_list args);
-
void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
@@ -160,6 +166,9 @@
bool GetVerbose() const;
+ void VAPrintf(const char *format, va_list args);
+ void VAError(const char *format, va_list args);
+
private:
Channel &m_channel;
@@ -193,6 +202,10 @@
typedef llvm::StringMap<Log> ChannelMap;
static llvm::ManagedStatic<ChannelMap> g_channel_map;
+ static void ForEachCategory(
+ const Log::ChannelMap::value_type &entry,
+ llvm::function_ref<void(llvm::StringRef, llvm::StringRef)> lambda);
+
static void ListCategories(llvm::raw_ostream &stream,
const ChannelMap::value_type &entry);
static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry,
@@ -206,6 +219,26 @@
} // namespace lldb_private
+/// The LLDB_LOG* macros defined below are the way to emit log messages.
+///
+/// Note that the macros surround the arguments in a check for the log
+/// being on, so you can freely call methods in arguments without affecting
+/// the non-log execution flow.
+///
+/// If you need to do more complex computations to prepare the log message
+/// be sure to add your own if (log) check, since we don't want logging to
+/// have any effect when not on.
+///
+/// However, the LLDB_LOG macro uses the llvm::formatv system (see the
+/// ProgrammersManual page in the llvm docs for more details). This allows
+/// the use of "format_providers" to auto-format datatypes, and there are
+/// already formatters for some of the llvm and lldb datatypes.
+///
+/// So if you need to do non-trivial formatting of one of these types, be
+/// sure to grep the lldb and llvm sources for "format_provider" to see if
+/// there is already a formatter before doing in situ formatting, and if
+/// possible add a provider if one does not already exist.
+
#define LLDB_LOG(log, ...) \
do { \
::lldb_private::Log *log_private = (log); \
@@ -213,6 +246,13 @@
log_private->Format(__FILE__, __func__, __VA_ARGS__); \
} while (0)
+#define LLDB_LOGF(log, ...) \
+ do { \
+ ::lldb_private::Log *log_private = (log); \
+ if (log_private) \
+ log_private->Printf(__VA_ARGS__); \
+ } while (0)
+
#define LLDB_LOGV(log, ...) \
do { \
::lldb_private::Log *log_private = (log); \
diff --git a/linux-x64/clang/include/lldb/Utility/Logging.h b/linux-x64/clang/include/lldb/Utility/Logging.h
index 41086fe..1a8a102 100644
--- a/linux-x64/clang/include/lldb/Utility/Logging.h
+++ b/linux-x64/clang/include/lldb/Utility/Logging.h
@@ -54,8 +54,6 @@
class Log;
-void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...);
-
Log *GetLogIfAllCategoriesSet(uint32_t mask);
Log *GetLogIfAnyCategoriesSet(uint32_t mask);
diff --git a/linux-x64/clang/include/lldb/Utility/OptionDefinition.h b/linux-x64/clang/include/lldb/Utility/OptionDefinition.h
new file mode 100644
index 0000000..725e090
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/OptionDefinition.h
@@ -0,0 +1,55 @@
+//===-- OptionDefinition.h --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_OPTIONDEFINITION_H
+#define LLDB_UTILITY_OPTIONDEFINITION_H
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-types.h"
+#include "llvm/ADT/StringExtras.h"
+#include <cstdint>
+
+namespace lldb_private {
+struct OptionDefinition {
+ /// Used to mark options that can be used together. If
+ /// `(1 << n & usage_mask) != 0` then this option belongs to option set n.
+ uint32_t usage_mask;
+ /// This option is required (in the current usage level).
+ bool required;
+ /// Full name for this option.
+ const char *long_option;
+ /// Single character for this option. If the option doesn't use a short
+ /// option character, this has to be a integer value that is not a printable
+ /// ASCII code point and also unique in the used set of options.
+ /// @see OptionDefinition::HasShortOption
+ int short_option;
+ /// no_argument, required_argument or optional_argument
+ int option_has_arg;
+ /// If non-NULL, option is valid iff |validator->IsValid()|, otherwise
+ /// always valid.
+ OptionValidator *validator;
+ /// If not empty, an array of enum values.
+ OptionEnumValues enum_values;
+ /// The kind of completion for this option.
+ /// Contains values of the CommandCompletions::CommonCompletionTypes enum.
+ uint32_t completion_type;
+ /// Type of argument this option takes.
+ lldb::CommandArgumentType argument_type;
+ /// Full text explaining what this options does and what (if any) argument to
+ /// pass it.
+ const char *usage_text;
+
+ /// Whether this has a short option character.
+ bool HasShortOption() const {
+ // See the short_option documentation for more.
+ return llvm::isPrint(short_option);
+ }
+};
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_OPTIONDEFINITION_H
diff --git a/linux-x64/clang/include/lldb/Utility/Predicate.h b/linux-x64/clang/include/lldb/Utility/Predicate.h
index f1539b5..a17ac05 100644
--- a/linux-x64/clang/include/lldb/Utility/Predicate.h
+++ b/linux-x64/clang/include/lldb/Utility/Predicate.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Predicate_h_
-#define liblldb_Predicate_h_
+#ifndef LLDB_UTILITY_PREDICATE_H
+#define LLDB_UTILITY_PREDICATE_H
#include <stdint.h>
#include <time.h>
@@ -117,8 +117,7 @@
/// How long to wait for the condition to hold.
///
/// \return
- /// \li m_value if Cond(m_value) is true.
- /// \li None otherwise (timeout occurred).
+ /// m_value if Cond(m_value) is true, None otherwise (timeout occurred).
template <typename C>
llvm::Optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
std::unique_lock<std::mutex> lock(m_mutex);
@@ -151,8 +150,8 @@
/// How long to wait for the condition to hold.
///
/// \return
- /// \li \b true if the \a m_value is equal to \a value
- /// \li \b false otherwise (timeout occurred)
+ /// true if the \a m_value is equal to \a value, false otherwise (timeout
+ /// occurred).
bool WaitForValueEqualTo(T value,
const Timeout<std::micro> &timeout = llvm::None) {
return WaitFor([&value](T current) { return value == current; }, timeout) !=
@@ -179,8 +178,7 @@
/// How long to wait for the condition to hold.
///
/// \return
- /// \li m_value if m_value != value
- /// \li None otherwise (timeout occurred).
+ /// m_value if m_value != value, None otherwise (timeout occurred).
llvm::Optional<T>
WaitForValueNotEqualTo(T value,
const Timeout<std::micro> &timeout = llvm::None) {
@@ -223,9 +221,10 @@
m_condition.notify_all();
}
- DISALLOW_COPY_AND_ASSIGN(Predicate);
+ Predicate(const Predicate &) = delete;
+ const Predicate &operator=(const Predicate &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Predicate_h_
+#endif // LLDB_UTILITY_PREDICATE_H
diff --git a/linux-x64/clang/include/lldb/Utility/ProcessInfo.h b/linux-x64/clang/include/lldb/Utility/ProcessInfo.h
index a25c06c..8f5a5f6 100644
--- a/linux-x64/clang/include/lldb/Utility/ProcessInfo.h
+++ b/linux-x64/clang/include/lldb/Utility/ProcessInfo.h
@@ -9,13 +9,12 @@
#ifndef LLDB_UTILITY_PROCESSINFO_H
#define LLDB_UTILITY_PROCESSINFO_H
-// LLDB headers
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/Environment.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/NameMatches.h"
-
+#include "llvm/Support/YAMLTraits.h"
#include <vector>
namespace lldb_private {
@@ -38,7 +37,7 @@
const char *GetName() const;
- size_t GetNameLength() const;
+ llvm::StringRef GetNameAsStringRef() const;
FileSpec &GetExecutableFile() { return m_executable; }
@@ -89,6 +88,7 @@
const Environment &GetEnvironment() const { return m_environment; }
protected:
+ template <class T> friend struct llvm::yaml::MappingTraits;
FileSpec m_executable;
std::string m_arg0; // argv[0] if supported. If empty, then use m_executable.
// Not all process plug-ins support specifying an argv[0] that differs from
@@ -150,50 +150,13 @@
bool verbose) const;
protected:
+ friend struct llvm::yaml::MappingTraits<ProcessInstanceInfo>;
uint32_t m_euid;
uint32_t m_egid;
lldb::pid_t m_parent_pid;
};
-class ProcessInstanceInfoList {
-public:
- ProcessInstanceInfoList() = default;
-
- void Clear() { m_infos.clear(); }
-
- size_t GetSize() { return m_infos.size(); }
-
- void Append(const ProcessInstanceInfo &info) { m_infos.push_back(info); }
-
- const char *GetProcessNameAtIndex(size_t idx) {
- return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr);
- }
-
- size_t GetProcessNameLengthAtIndex(size_t idx) {
- return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0);
- }
-
- lldb::pid_t GetProcessIDAtIndex(size_t idx) {
- return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0);
- }
-
- bool GetInfoAtIndex(size_t idx, ProcessInstanceInfo &info) {
- if (idx < m_infos.size()) {
- info = m_infos[idx];
- return true;
- }
- return false;
- }
-
- // You must ensure "idx" is valid before calling this function
- const ProcessInstanceInfo &GetProcessInfoAtIndex(size_t idx) const {
- assert(idx < m_infos.size());
- return m_infos[idx];
- }
-
-protected:
- std::vector<ProcessInstanceInfo> m_infos;
-};
+typedef std::vector<ProcessInstanceInfo> ProcessInstanceInfoList;
// ProcessInstanceInfoMatch
//
@@ -227,8 +190,20 @@
m_name_match_type = name_match_type;
}
+ /// Return true iff the architecture in this object matches arch_spec.
+ bool ArchitectureMatches(const ArchSpec &arch_spec) const;
+
+ /// Return true iff the process name in this object matches process_name.
bool NameMatches(const char *process_name) const;
+ /// Return true iff the process ID and parent process IDs in this object match
+ /// the ones in proc_info.
+ bool ProcessIDsMatch(const ProcessInstanceInfo &proc_info) const;
+
+ /// Return true iff the (both effective and real) user and group IDs in this
+ /// object match the ones in proc_info.
+ bool UserIDsMatch(const ProcessInstanceInfo &proc_info) const;
+
bool Matches(const ProcessInstanceInfo &proc_info) const;
bool MatchAllProcesses() const;
@@ -240,6 +215,19 @@
bool m_match_all_users;
};
+namespace repro {
+llvm::Optional<ProcessInstanceInfoList> GetReplayProcessInstanceInfoList();
+} // namespace repro
} // namespace lldb_private
-#endif // #ifndef LLDB_UTILITY_PROCESSINFO_H
+LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::ProcessInstanceInfo)
+
+namespace llvm {
+namespace yaml {
+template <> struct MappingTraits<lldb_private::ProcessInstanceInfo> {
+ static void mapping(IO &io, lldb_private::ProcessInstanceInfo &PII);
+};
+} // namespace yaml
+} // namespace llvm
+
+#endif // LLDB_UTILITY_PROCESSINFO_H
diff --git a/linux-x64/clang/include/lldb/Utility/RangeMap.h b/linux-x64/clang/include/lldb/Utility/RangeMap.h
index 36401f5..118fdfd 100644
--- a/linux-x64/clang/include/lldb/Utility/RangeMap.h
+++ b/linux-x64/clang/include/lldb/Utility/RangeMap.h
@@ -122,220 +122,13 @@
}
};
-// A range array class where you get to define the type of the ranges
-// that the collection contains.
-
-template <typename B, typename S, unsigned N> class RangeArray {
+template <typename B, typename S, unsigned N = 0> class RangeVector {
public:
typedef B BaseType;
typedef S SizeType;
typedef Range<B, S> Entry;
typedef llvm::SmallVector<Entry, N> Collection;
- RangeArray() = default;
-
- ~RangeArray() = default;
-
- void Append(const Entry &entry) { m_entries.push_back(entry); }
-
- void Append(B base, S size) { m_entries.emplace_back(base, size); }
-
- bool RemoveEntrtAtIndex(uint32_t idx) {
- if (idx < m_entries.size()) {
- m_entries.erase(m_entries.begin() + idx);
- return true;
- }
- return false;
- }
-
- void Sort() {
- if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
- }
-
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- bool IsSorted() const {
- typename Collection::const_iterator pos, end, prev;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && *pos < *prev)
- return false;
- }
- return true;
- }
-#endif
-
- void CombineConsecutiveRanges() {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- // Can't combine if ranges if we have zero or one range
- if (m_entries.size() > 1) {
- // The list should be sorted prior to calling this function
- typename Collection::iterator pos;
- typename Collection::iterator end;
- typename Collection::iterator prev;
- bool can_combine = false;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
- can_combine = true;
- break;
- }
- }
-
- // We we can combine at least one entry, then we make a new collection
- // and populate it accordingly, and then swap it into place.
- if (can_combine) {
- Collection minimal_ranges;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
- minimal_ranges.back().SetRangeEnd(
- std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
- else
- minimal_ranges.push_back(*pos);
- }
- // Use the swap technique in case our new vector is much smaller. We
- // must swap when using the STL because std::vector objects never
- // release or reduce the memory once it has been allocated/reserved.
- m_entries.swap(minimal_ranges);
- }
- }
- }
-
- BaseType GetMinRangeBase(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the first
- // range's base
- return m_entries.front().GetRangeBase();
- }
-
- BaseType GetMaxRangeEnd(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the last
- // range's end
- return m_entries.back().GetRangeEnd();
- }
-
- void Slide(BaseType slide) {
- typename Collection::iterator pos, end;
- for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
- pos->Slide(slide);
- }
-
- void Clear() { m_entries.clear(); }
-
- bool IsEmpty() const { return m_entries.empty(); }
-
- size_t GetSize() const { return m_entries.size(); }
-
- const Entry *GetEntryAtIndex(size_t i) const {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- // Clients must ensure that "i" is a valid index prior to calling this
- // function
- const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
-
- Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
-
- const Entry *Back() const {
- return (m_entries.empty() ? nullptr : &m_entries.back());
- }
-
- static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
- return lhs.GetRangeBase() < rhs.GetRangeBase();
- }
-
- uint32_t FindEntryIndexThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return std::distance(begin, pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr))
- return std::distance(begin, pos);
- }
- }
- return UINT32_MAX;
- }
-
- const Entry *FindEntryThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
- const Entry *FindEntryThatContains(const Entry &range) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, range, BaseLessThan);
-
- if (pos != end && pos->Contains(range)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(range)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
-protected:
- Collection m_entries;
-};
-
-template <typename B, typename S> class RangeVector {
-public:
- typedef B BaseType;
- typedef S SizeType;
- typedef Range<B, S> Entry;
- typedef std::vector<Entry> Collection;
-
RangeVector() = default;
~RangeVector() = default;
@@ -401,41 +194,25 @@
#ifdef ASSERT_RANGEMAP_ARE_SORTED
assert(IsSorted());
#endif
- // Can't combine if ranges if we have zero or one range
- if (m_entries.size() > 1) {
- // The list should be sorted prior to calling this function
- typename Collection::iterator pos;
- typename Collection::iterator end;
- typename Collection::iterator prev;
- bool can_combine = false;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
- can_combine = true;
- break;
- }
- }
+ auto first_intersect = std::adjacent_find(
+ m_entries.begin(), m_entries.end(), [](const Entry &a, const Entry &b) {
+ return a.DoesAdjoinOrIntersect(b);
+ });
+ if (first_intersect == m_entries.end())
+ return;
- // We we can combine at least one entry, then we make a new collection
- // and populate it accordingly, and then swap it into place.
- if (can_combine) {
- Collection minimal_ranges;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
- minimal_ranges.back().SetRangeEnd(
- std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
- else
- minimal_ranges.push_back(*pos);
- }
- // Use the swap technique in case our new vector is much smaller. We
- // must swap when using the STL because std::vector objects never
- // release or reduce the memory once it has been allocated/reserved.
- m_entries.swap(minimal_ranges);
- }
+ // We we can combine at least one entry, then we make a new collection and
+ // populate it accordingly, and then swap it into place.
+ auto pos = std::next(first_intersect);
+ Collection minimal_ranges(m_entries.begin(), pos);
+ for (; pos != m_entries.end(); ++pos) {
+ Entry &back = minimal_ranges.back();
+ if (back.DoesAdjoinOrIntersect(*pos))
+ back.SetRangeEnd(std::max(back.GetRangeEnd(), pos->GetRangeEnd()));
+ else
+ minimal_ranges.push_back(*pos);
}
+ m_entries.swap(minimal_ranges);
}
BaseType GetMinRangeBase(BaseType fail_value) const {
@@ -560,6 +337,10 @@
return nullptr;
}
+ using const_iterator = typename Collection::const_iterator;
+ const_iterator begin() const { return m_entries.begin(); }
+ const_iterator end() const { return m_entries.end(); }
+
protected:
void CombinePrevAndNext(typename Collection::iterator pos) {
// Check if the prev or next entries in case they need to be unioned with
@@ -599,51 +380,51 @@
RangeData(B base, S size) : Range<B, S>(base, size), data() {}
RangeData(B base, S size, DataType d) : Range<B, S>(base, size), data(d) {}
-
- bool operator<(const RangeData &rhs) const {
- if (this->base == rhs.base) {
- if (this->size == rhs.size)
- return this->data < rhs.data;
- else
- return this->size < rhs.size;
- }
- return this->base < rhs.base;
- }
-
- bool operator==(const RangeData &rhs) const {
- return this->GetRangeBase() == rhs.GetRangeBase() &&
- this->GetByteSize() == rhs.GetByteSize() && this->data == rhs.data;
- }
-
- bool operator!=(const RangeData &rhs) const {
- return this->GetRangeBase() != rhs.GetRangeBase() ||
- this->GetByteSize() != rhs.GetByteSize() || this->data != rhs.data;
- }
};
-template <typename B, typename S, typename T, unsigned N = 0>
+// We can treat the vector as a flattened Binary Search Tree, augmenting it
+// with upper bounds (max of range endpoints) for every index allows us to
+// query for range containment quicker.
+template <typename B, typename S, typename T>
+struct AugmentedRangeData : public RangeData<B, S, T> {
+ B upper_bound;
+
+ AugmentedRangeData(const RangeData<B, S, T> &rd)
+ : RangeData<B, S, T>(rd), upper_bound() {}
+};
+
+template <typename B, typename S, typename T, unsigned N = 0,
+ class Compare = std::less<T>>
class RangeDataVector {
public:
typedef lldb_private::Range<B, S> Range;
typedef RangeData<B, S, T> Entry;
- typedef llvm::SmallVector<Entry, N> Collection;
+ typedef AugmentedRangeData<B, S, T> AugmentedEntry;
+ typedef llvm::SmallVector<AugmentedEntry, N> Collection;
- RangeDataVector() = default;
+ RangeDataVector(Compare compare = Compare()) : m_compare(compare) {}
~RangeDataVector() = default;
- void Append(const Entry &entry) { m_entries.push_back(entry); }
+ void Append(const Entry &entry) { m_entries.emplace_back(entry); }
void Sort() {
if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
+ std::stable_sort(m_entries.begin(), m_entries.end(),
+ [&compare = m_compare](const Entry &a, const Entry &b) {
+ if (a.base != b.base)
+ return a.base < b.base;
+ if (a.size != b.size)
+ return a.size < b.size;
+ return compare(a.data, b.data);
+ });
+ if (!m_entries.empty())
+ ComputeUpperBounds(0, m_entries.size());
}
#ifdef ASSERT_RANGEMAP_ARE_SORTED
bool IsSorted() const {
typename Collection::const_iterator pos, end, prev;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
prev = pos++) {
if (prev != end && *pos < *prev)
@@ -713,24 +494,20 @@
}
uint32_t FindEntryIndexThatContains(B addr) const {
- const Entry *entry = FindEntryThatContains(addr);
+ const AugmentedEntry *entry =
+ static_cast<const AugmentedEntry *>(FindEntryThatContains(addr));
if (entry)
return std::distance(m_entries.begin(), entry);
return UINT32_MAX;
}
- uint32_t FindEntryIndexesThatContain(B addr,
- std::vector<uint32_t> &indexes) const {
+ uint32_t FindEntryIndexesThatContain(B addr, std::vector<uint32_t> &indexes) {
#ifdef ASSERT_RANGEMAP_ARE_SORTED
assert(IsSorted());
#endif
+ if (!m_entries.empty())
+ FindEntryIndexesThatContain(addr, 0, m_entries.size(), indexes);
- if (!m_entries.empty()) {
- for (const auto &entry : m_entries) {
- if (entry.Contains(addr))
- indexes.push_back(entry.data);
- }
- }
return indexes.size();
}
@@ -815,6 +592,55 @@
protected:
Collection m_entries;
+ Compare m_compare;
+
+private:
+ // Compute extra information needed for search
+ B ComputeUpperBounds(size_t lo, size_t hi) {
+ size_t mid = (lo + hi) / 2;
+ AugmentedEntry &entry = m_entries[mid];
+
+ entry.upper_bound = entry.base + entry.size;
+
+ if (lo < mid)
+ entry.upper_bound =
+ std::max(entry.upper_bound, ComputeUpperBounds(lo, mid));
+
+ if (mid + 1 < hi)
+ entry.upper_bound =
+ std::max(entry.upper_bound, ComputeUpperBounds(mid + 1, hi));
+
+ return entry.upper_bound;
+ }
+
+ // This is based on the augmented tree implementation found at
+ // https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree
+ void FindEntryIndexesThatContain(B addr, size_t lo, size_t hi,
+ std::vector<uint32_t> &indexes) {
+ size_t mid = (lo + hi) / 2;
+ const AugmentedEntry &entry = m_entries[mid];
+
+ // addr is greater than the rightmost point of any interval below mid
+ // so there are cannot be any matches.
+ if (addr > entry.upper_bound)
+ return;
+
+ // Recursively search left subtree
+ if (lo < mid)
+ FindEntryIndexesThatContain(addr, lo, mid, indexes);
+
+ // If addr is smaller than the start of the current interval it
+ // cannot contain it nor can any of its right subtree.
+ if (addr < entry.base)
+ return;
+
+ if (entry.Contains(addr))
+ indexes.push_back(entry.data);
+
+ // Recursively search right subtree
+ if (mid + 1 < hi)
+ FindEntryIndexesThatContain(addr, mid + 1, hi, indexes);
+ }
};
// A simple range with data class where you get to define the type of
diff --git a/linux-x64/clang/include/lldb/Utility/RegisterValue.h b/linux-x64/clang/include/lldb/Utility/RegisterValue.h
index eeb3ce5..4211b0a 100644
--- a/linux-x64/clang/include/lldb/Utility/RegisterValue.h
+++ b/linux-x64/clang/include/lldb/Utility/RegisterValue.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/StringRef.h"
#include <cstdint>
#include <cstring>
+#include <utility>
namespace lldb_private {
class DataExtractor;
@@ -26,7 +27,8 @@
class RegisterValue {
public:
- enum { kMaxRegisterByteSize = 64u };
+ // big enough to support up to 256 byte AArch64 SVE
+ enum { kMaxRegisterByteSize = 256u };
enum Type {
eTypeInvalid,
@@ -59,7 +61,7 @@
}
explicit RegisterValue(llvm::APInt inst) : m_type(eTypeUInt128) {
- m_scalar = llvm::APInt(inst);
+ m_scalar = llvm::APInt(std::move(inst));
}
explicit RegisterValue(float value) : m_type(eTypeFloat) { m_scalar = value; }
@@ -72,9 +74,9 @@
m_scalar = value;
}
- explicit RegisterValue(uint8_t *bytes, size_t length,
+ explicit RegisterValue(llvm::ArrayRef<uint8_t> bytes,
lldb::ByteOrder byte_order) {
- SetBytes(bytes, length, byte_order);
+ SetBytes(bytes.data(), bytes.size(), byte_order);
}
RegisterValue::Type GetType() const { return m_type; }
@@ -168,7 +170,7 @@
void operator=(llvm::APInt uint) {
m_type = eTypeUInt128;
- m_scalar = llvm::APInt(uint);
+ m_scalar = llvm::APInt(std::move(uint));
}
void operator=(float f) {
@@ -208,7 +210,7 @@
void SetUInt128(llvm::APInt uint) {
m_type = eTypeUInt128;
- m_scalar = uint;
+ m_scalar = std::move(uint);
}
bool SetUInt(uint64_t uint, uint32_t byte_size);
@@ -259,9 +261,10 @@
Scalar m_scalar;
struct {
- uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any
- // register for any supported target.
- uint8_t length;
+ mutable uint8_t
+ bytes[kMaxRegisterByteSize]; // This must be big enough to hold any
+ // register for any supported target.
+ uint16_t length;
lldb::ByteOrder byte_order;
} buffer;
};
diff --git a/linux-x64/clang/include/lldb/Utility/RegularExpression.h b/linux-x64/clang/include/lldb/Utility/RegularExpression.h
index 54f3dd8..415f1b5 100644
--- a/linux-x64/clang/include/lldb/Utility/RegularExpression.h
+++ b/linux-x64/clang/include/lldb/Utility/RegularExpression.h
@@ -6,194 +6,89 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RegularExpression_h_
-#define liblldb_RegularExpression_h_
+#ifndef LLDB_UTILITY_REGULAREXPRESSION_H
+#define LLDB_UTILITY_REGULAREXPRESSION_H
-#ifdef _WIN32
-#include "../lib/Support/regex_impl.h"
-
-typedef llvm_regmatch_t regmatch_t;
-typedef llvm_regex_t regex_t;
-
-inline int regcomp(llvm_regex_t *a, const char *b, int c) {
- return llvm_regcomp(a, b, c);
-}
-
-inline size_t regerror(int a, const llvm_regex_t *b, char *c, size_t d) {
- return llvm_regerror(a, b, c, d);
-}
-
-inline int regexec(const llvm_regex_t *a, const char *b, size_t c,
- llvm_regmatch_t d[], int e) {
- return llvm_regexec(a, b, c, d, e);
-}
-
-inline void regfree(llvm_regex_t *a) { llvm_regfree(a); }
-#else
-#ifdef __ANDROID__
-#include <regex>
-#endif
-#include <regex.h>
-#endif
-
-#include <string>
-#include <vector>
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace llvm {
-class StringRef;
-} // namespace llvm
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/Regex.h"
namespace lldb_private {
-/// \class RegularExpression RegularExpression.h
-/// "lldb/Utility/RegularExpression.h"
-/// A C++ wrapper class for regex.
-///
-/// This regular expression class wraps the posix regex functions \c
-/// regcomp(), \c regerror(), \c regexec(), and \c regfree() from the header
-/// file in \c /usr/include/regex\.h.
class RegularExpression {
public:
- class Match {
- public:
- Match(uint32_t max_matches) : m_matches() {
- if (max_matches > 0)
- m_matches.resize(max_matches + 1);
- }
-
- void Clear() {
- const size_t num_matches = m_matches.size();
- regmatch_t invalid_match = {-1, -1};
- for (size_t i = 0; i < num_matches; ++i)
- m_matches[i] = invalid_match;
- }
-
- size_t GetSize() const { return m_matches.size(); }
-
- regmatch_t *GetData() {
- return (m_matches.empty() ? nullptr : m_matches.data());
- }
-
- bool GetMatchAtIndex(llvm::StringRef s, uint32_t idx,
- std::string &match_str) const;
-
- bool GetMatchAtIndex(llvm::StringRef s, uint32_t idx,
- llvm::StringRef &match_str) const;
-
- bool GetMatchSpanningIndices(llvm::StringRef s, uint32_t idx1,
- uint32_t idx2,
- llvm::StringRef &match_str) const;
-
- protected:
- std::vector<regmatch_t>
- m_matches; ///< Where parenthesized subexpressions results are stored
- };
-
- /// Default constructor.
- ///
/// The default constructor that initializes the object state such that it
/// contains no compiled regular expression.
- RegularExpression();
+ RegularExpression() = default;
- explicit RegularExpression(llvm::StringRef string);
-
- /// Destructor.
- ///
- /// Any previously compiled regular expression contained in this object will
- /// be freed.
- ~RegularExpression();
-
- RegularExpression(const RegularExpression &rhs);
-
- const RegularExpression &operator=(const RegularExpression &rhs);
-
- /// Compile a regular expression.
+ /// Constructor for a regular expression.
///
/// Compile a regular expression using the supplied regular expression text.
/// The compiled regular expression lives in this object so that it can be
/// readily used for regular expression matches. Execute() can be called
- /// after the regular expression is compiled. Any previously compiled
- /// regular expression contained in this object will be freed.
+ /// after the regular expression is compiled.
///
- /// \param[in] re
- /// A NULL terminated C string that represents the regular
- /// expression to compile.
- ///
- /// \return
- /// \b true if the regular expression compiles successfully,
- /// \b false otherwise.
- bool Compile(llvm::StringRef string);
- bool Compile(const char *) = delete;
+ /// \param[in] string
+ /// An llvm::StringRef that represents the regular expression to compile.
+ // String is not referenced anymore after the object is constructed.
+ explicit RegularExpression(llvm::StringRef string);
- /// Executes a regular expression.
- ///
+ ~RegularExpression() = default;
+
+ RegularExpression(const RegularExpression &rhs);
+ RegularExpression(RegularExpression &&rhs) = default;
+
+ RegularExpression &operator=(RegularExpression &&rhs) = default;
+ RegularExpression &operator=(const RegularExpression &rhs) = default;
+
/// Execute a regular expression match using the compiled regular expression
- /// that is already in this object against the match string \a s. If any
- /// parens are used for regular expression matches \a match_count should
- /// indicate the number of regmatch_t values that are present in \a
- /// match_ptr.
+ /// that is already in this object against the given \a string. If any parens
+ /// are used for regular expression matches.
///
/// \param[in] string
/// The string to match against the compile regular expression.
///
- /// \param[in] match
- /// A pointer to a RegularExpression::Match structure that was
- /// properly initialized with the desired number of maximum
- /// matches, or nullptr if no parenthesized matching is needed.
+ /// \param[out] matches
+ /// A pointer to a SmallVector to hold the matches.
///
/// \return
- /// \b true if \a string matches the compiled regular
- /// expression, \b false otherwise.
- bool Execute(llvm::StringRef string, Match *match = nullptr) const;
- bool Execute(const char *, Match * = nullptr) = delete;
-
- size_t GetErrorAsCString(char *err_str, size_t err_str_max_len) const;
-
- /// Free the compiled regular expression.
- ///
- /// If this object contains a valid compiled regular expression, this
- /// function will free any resources it was consuming.
- void Free();
+ /// true if \a string matches the compiled regular expression, false
+ /// otherwise incl. the case regular exression failed to compile.
+ bool Execute(llvm::StringRef string,
+ llvm::SmallVectorImpl<llvm::StringRef> *matches = nullptr) const;
/// Access the regular expression text.
///
- /// Returns the text that was used to compile the current regular
- /// expression.
- ///
/// \return
/// The NULL terminated C string that was used to compile the
/// current regular expression
llvm::StringRef GetText() const;
- /// Test if valid.
- ///
/// Test if this object contains a valid regular expression.
///
/// \return
- /// \b true if the regular expression compiled and is ready
- /// for execution, \b false otherwise.
+ /// true if the regular expression compiled and is ready for execution,
+ /// false otherwise.
bool IsValid() const;
- void Clear() {
- Free();
- m_re.clear();
- m_comp_err = 1;
+ /// Return an error if the regular expression failed to compile.
+ ///
+ /// \return
+ /// A string error if the regular expression failed to compile, success
+ /// otherwise.
+ llvm::Error GetError() const;
+
+ bool operator==(const RegularExpression &rhs) const {
+ return GetText() == rhs.GetText();
}
- int GetErrorCode() const { return m_comp_err; }
-
- bool operator<(const RegularExpression &rhs) const;
-
private:
- // Member variables
- std::string m_re; ///< A copy of the original regular expression text
- int m_comp_err; ///< Status code for the regular expression compilation
- regex_t m_preg; ///< The compiled regular expression
+ /// A copy of the original regular expression text.
+ std::string m_regex_text;
+ /// The compiled regular expression.
+ mutable llvm::Regex m_regex;
};
} // namespace lldb_private
-#endif // liblldb_RegularExpression_h_
+#endif // LLDB_UTILITY_REGULAREXPRESSION_H
diff --git a/linux-x64/clang/include/lldb/Utility/Reproducer.h b/linux-x64/clang/include/lldb/Utility/Reproducer.h
index 670041d..4659254 100644
--- a/linux-x64/clang/include/lldb/Utility/Reproducer.h
+++ b/linux-x64/clang/include/lldb/Utility/Reproducer.h
@@ -9,18 +9,20 @@
#ifndef LLDB_UTILITY_REPRODUCER_H
#define LLDB_UTILITY_REPRODUCER_H
-#include "lldb/Utility/FileCollector.h"
#include "lldb/Utility/FileSpec.h"
-
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/YAMLTraits.h"
#include <mutex>
#include <string>
+#include <utility>
#include <vector>
namespace lldb_private {
+class UUID;
namespace repro {
class Reproducer;
@@ -28,6 +30,7 @@
enum class ReproducerMode {
Capture,
Replay,
+ PassiveReplay,
Off,
};
@@ -82,111 +85,13 @@
using ProviderBase::ProviderBase; // Inherit constructor.
};
-class FileProvider : public Provider<FileProvider> {
-public:
- struct Info {
- static const char *name;
- static const char *file;
- };
-
- FileProvider(const FileSpec &directory)
- : Provider(directory),
- m_collector(directory.CopyByAppendingPathComponent("root"), directory) {
- }
-
- FileCollector &GetFileCollector() { return m_collector; }
-
- void Keep() override {
- auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file);
- // Temporary files that are removed during execution can cause copy errors.
- if (auto ec = m_collector.CopyFiles(/*stop_on_error=*/false))
- return;
- m_collector.WriteMapping(mapping);
- }
-
- static char ID;
-
-private:
- FileCollector m_collector;
-};
-
-/// Provider for the LLDB version number.
-///
-/// When the reproducer is kept, it writes the lldb version to a file named
-/// version.txt in the reproducer root.
-class VersionProvider : public Provider<VersionProvider> {
-public:
- VersionProvider(const FileSpec &directory) : Provider(directory) {}
- struct Info {
- static const char *name;
- static const char *file;
- };
- void SetVersion(std::string version) {
- assert(m_version.empty());
- m_version = std::move(version);
- }
- void Keep() override;
- std::string m_version;
- static char ID;
-};
-
-class DataRecorder {
-public:
- DataRecorder(const FileSpec &filename, std::error_code &ec)
- : m_filename(filename.GetFilename().GetStringRef()),
- m_os(filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) {}
-
- static llvm::Expected<std::unique_ptr<DataRecorder>>
- Create(const FileSpec &filename);
-
- template <typename T> void Record(const T &t, bool newline = false) {
- if (!m_record)
- return;
- m_os << t;
- if (newline)
- m_os << '\n';
- m_os.flush();
- }
-
- const FileSpec &GetFilename() { return m_filename; }
-
- void Stop() {
- assert(m_record);
- m_record = false;
- }
-
-private:
- FileSpec m_filename;
- llvm::raw_fd_ostream m_os;
- bool m_record;
-};
-
-class CommandProvider : public Provider<CommandProvider> {
-public:
- struct Info {
- static const char *name;
- static const char *file;
- };
-
- CommandProvider(const FileSpec &directory) : Provider(directory) {}
-
- DataRecorder *GetNewDataRecorder();
-
- void Keep() override;
- void Discard() override;
-
- static char ID;
-
-private:
- std::vector<std::unique_ptr<DataRecorder>> m_data_recorders;
-};
-
/// The generator is responsible for the logic needed to generate a
/// reproducer. For doing so it relies on providers, who serialize data that
/// is necessary for reproducing a failure.
class Generator final {
+
public:
- Generator(const FileSpec &root);
+ Generator(FileSpec root);
~Generator();
/// Method to indicate we want to keep the reproducer. If reproducer
@@ -198,9 +103,15 @@
/// might need to clean up files already written to disk.
void Discard();
+ /// Enable or disable auto generate.
+ void SetAutoGenerate(bool b);
+
+ /// Return whether auto generate is enabled.
+ bool IsAutoGenerate() const;
+
/// Create and register a new provider.
template <typename T> T *Create() {
- std::unique_ptr<ProviderBase> provider = llvm::make_unique<T>(m_root);
+ std::unique_ptr<ProviderBase> provider = std::make_unique<T>(m_root);
return static_cast<T *>(Register(std::move(provider)));
}
@@ -238,12 +149,15 @@
FileSpec m_root;
/// Flag to ensure that we never call both keep and discard.
- bool m_done;
+ bool m_done = false;
+
+ /// Flag to auto generate a reproducer when it would otherwise be discarded.
+ bool m_auto_generate = false;
};
class Loader final {
public:
- Loader(const FileSpec &root);
+ Loader(FileSpec root, bool passive = false);
template <typename T> FileSpec GetFile() {
if (!HasFile(T::file))
@@ -252,16 +166,28 @@
return GetRoot().CopyByAppendingPathComponent(T::file);
}
+ template <typename T> llvm::Expected<std::string> LoadBuffer() {
+ FileSpec file = GetFile<typename T::Info>();
+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer =
+ llvm::vfs::getRealFileSystem()->getBufferForFile(file.GetPath());
+ if (!buffer)
+ return llvm::errorCodeToError(buffer.getError());
+ return (*buffer)->getBuffer().str();
+ }
+
llvm::Error LoadIndex();
const FileSpec &GetRoot() const { return m_root; }
+ bool IsPassiveReplay() const { return m_passive_replay; }
+
private:
bool HasFile(llvm::StringRef file);
FileSpec m_root;
std::vector<std::string> m_files;
bool m_loaded;
+ bool m_passive_replay;
};
/// The reproducer enables clients to obtain access to the Generator and
@@ -271,6 +197,7 @@
static Reproducer &Instance();
static llvm::Error Initialize(ReproducerMode mode,
llvm::Optional<FileSpec> root);
+ static void Initialize();
static bool Initialized();
static void Terminate();
@@ -284,9 +211,12 @@
FileSpec GetReproducerPath() const;
+ bool IsCapturing() { return static_cast<bool>(m_generator); };
+ bool IsReplaying() { return static_cast<bool>(m_loader); };
+
protected:
llvm::Error SetCapture(llvm::Optional<FileSpec> root);
- llvm::Error SetReplay(llvm::Optional<FileSpec> root);
+ llvm::Error SetReplay(llvm::Optional<FileSpec> root, bool passive = false);
private:
static llvm::Optional<Reproducer> &InstanceImpl();
@@ -297,6 +227,25 @@
mutable std::mutex m_mutex;
};
+class Verifier {
+public:
+ Verifier(Loader *loader) : m_loader(loader) {}
+ void Verify(llvm::function_ref<void(llvm::StringRef)> error_callback,
+ llvm::function_ref<void(llvm::StringRef)> warning_callback,
+ llvm::function_ref<void(llvm::StringRef)> note_callback) const;
+
+private:
+ Loader *m_loader;
+};
+
+struct ReplayOptions {
+ bool verify = true;
+ bool check_version = true;
+};
+
+llvm::Error Finalize(Loader *loader);
+llvm::Error Finalize(const FileSpec &root);
+
} // namespace repro
} // namespace lldb_private
diff --git a/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h b/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h
index f90ce4b..c8a98ad 100644
--- a/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h
+++ b/linux-x64/clang/include/lldb/Utility/ReproducerInstrumentation.h
@@ -5,8 +5,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
-#define LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
+#ifndef LLDB_UTILITY_REPRODUCERINSTRUMENTATION_H
+#define LLDB_UTILITY_REPRODUCERINSTRUMENTATION_H
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
@@ -16,8 +16,8 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
-#include <iostream>
#include <map>
+#include <thread>
#include <type_traits>
template <typename T,
@@ -33,6 +33,11 @@
}
template <typename T>
+inline void stringify_append(llvm::raw_string_ostream &ss, T *t) {
+ ss << reinterpret_cast<void *>(t);
+}
+
+template <typename T>
inline void stringify_append(llvm::raw_string_ostream &ss, const T *t) {
ss << reinterpret_cast<const void *>(t);
}
@@ -40,7 +45,13 @@
template <>
inline void stringify_append<char>(llvm::raw_string_ostream &ss,
const char *t) {
- ss << t;
+ ss << '\"' << t << '\"';
+}
+
+template <>
+inline void stringify_append<std::nullptr_t>(llvm::raw_string_ostream &ss,
+ const std::nullptr_t &t) {
+ ss << "\"nullptr\"";
}
template <typename Head>
@@ -68,117 +79,154 @@
// is initialized or enabled.
// #define LLDB_REPRO_INSTR_TRACE
+#ifdef LLDB_REPRO_INSTR_TRACE
+inline llvm::raw_ostream &this_thread_id() {
+ size_t tid = std::hash<std::thread::id>{}(std::this_thread::get_id());
+ return llvm::errs().write_hex(tid) << " :: ";
+}
+#endif
+
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature) \
- R.Register<Class * Signature>(&construct<Class Signature>::doit, "", #Class, \
- #Class, #Signature)
+ R.Register<Class * Signature>(&construct<Class Signature>::record, "", \
+ #Class, #Class, #Signature)
+
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature) \
R.Register( \
- &invoke<Result(Class::*) Signature>::method<(&Class::Method)>::doit, \
+ &invoke<Result(Class::*) Signature>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, #Signature)
+
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature) \
- R.Register(&invoke<Result(Class::*) Signature const>::method_const<( \
- &Class::Method)>::doit, \
+ R.Register(&invoke<Result(Class::*) \
+ Signature const>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, #Signature)
+
#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature) \
- R.Register<Result Signature>( \
- static_cast<Result(*) Signature>(&Class::Method), #Result, #Class, \
- #Method, #Signature)
+ R.Register(&invoke<Result(*) Signature>::method<(&Class::Method)>::record, \
+ #Result, #Class, #Method, #Signature)
+
+#define LLDB_REGISTER_CHAR_PTR_METHOD_STATIC(Result, Class, Method) \
+ R.Register( \
+ &invoke<Result (*)(char *, size_t)>::method<(&Class::Method)>::record, \
+ &invoke_char_ptr<Result (*)(char *, \
+ size_t)>::method<(&Class::Method)>::record, \
+ #Result, #Class, #Method, "(char*, size_t");
+
+#define LLDB_REGISTER_CHAR_PTR_METHOD(Result, Class, Method) \
+ R.Register(&invoke<Result (Class::*)(char *, size_t)>::method<( \
+ &Class::Method)>::record, \
+ &invoke_char_ptr<Result (Class::*)(char *, size_t)>::method<( \
+ &Class::Method)>::record, \
+ #Result, #Class, #Method, "(char*, size_t");
+
+#define LLDB_REGISTER_CHAR_PTR_METHOD_CONST(Result, Class, Method) \
+ R.Register(&invoke<Result (Class::*)(char *, size_t) \
+ const>::method<(&Class::Method)>::record, \
+ &invoke_char_ptr<Result (Class::*)(char *, size_t) \
+ const>::method<(&Class::Method)>::record, \
+ #Result, #Class, #Method, "(char*, size_t");
+
+#define LLDB_CONSTRUCT_(T, Class, ...) \
+ lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION); \
+ lldb_private::repro::construct<T>::handle(LLDB_GET_INSTRUMENTATION_DATA(), \
+ _recorder, Class, __VA_ARGS__);
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature, ...) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
- stringify_args(__VA_ARGS__)); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::construct<Class Signature>::doit, \
- __VA_ARGS__); \
- sb_recorder.RecordResult(this); \
- }
+ LLDB_CONSTRUCT_(Class Signature, this, __VA_ARGS__)
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
- if (lldb_private::repro::InstrumentationData data = \
+ LLDB_CONSTRUCT_(Class(), this, lldb_private::repro::EmptyArg())
+
+#define LLDB_RECORD_(T1, T2, ...) \
+ lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData _data = \
LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::construct<Class()>::doit); \
- sb_recorder.RecordResult(this); \
+ if (lldb_private::repro::Serializer *_serializer = \
+ _data.GetSerializer()) { \
+ _recorder.Record(*_serializer, _data.GetRegistry(), \
+ &lldb_private::repro::invoke<T1>::method<T2>::record, \
+ __VA_ARGS__); \
+ } else if (lldb_private::repro::Deserializer *_deserializer = \
+ _data.GetDeserializer()) { \
+ if (_recorder.ShouldCapture()) { \
+ return lldb_private::repro::invoke<T1>::method<T2>::replay( \
+ _recorder, *_deserializer, _data.GetRegistry()); \
+ } \
+ } \
}
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
- stringify_args(__VA_ARGS__)); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record( \
- data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::invoke<Result(Class::*) Signature>::method<( \
- &Class::Method)>::doit, \
- this, __VA_ARGS__); \
- }
+ LLDB_RECORD_(Result(Class::*) Signature, (&Class::Method), this, __VA_ARGS__)
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
- stringify_args(__VA_ARGS__)); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record( \
- data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::invoke<Result( \
- Class::*) Signature const>::method_const<(&Class::Method)>::doit, \
- this, __VA_ARGS__); \
- }
+ LLDB_RECORD_(Result(Class::*) Signature const, (&Class::Method), this, \
+ __VA_ARGS__)
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::invoke<Result ( \
- Class::*)()>::method<(&Class::Method)>::doit, \
- this); \
- }
+ LLDB_RECORD_(Result (Class::*)(), (&Class::Method), this)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record( \
- data.GetSerializer(), data.GetRegistry(), \
- &lldb_private::repro::invoke<Result ( \
- Class::*)() const>::method_const<(&Class::Method)>::doit, \
- this); \
- }
+ LLDB_RECORD_(Result (Class::*)() const, (&Class::Method), this)
#define LLDB_RECORD_STATIC_METHOD(Result, Class, Method, Signature, ...) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
- stringify_args(__VA_ARGS__)); \
- if (lldb_private::repro::InstrumentationData data = \
- LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
- static_cast<Result(*) Signature>(&Class::Method), \
- __VA_ARGS__); \
- }
+ LLDB_RECORD_(Result(*) Signature, (&Class::Method), __VA_ARGS__)
#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION); \
- if (lldb_private::repro::InstrumentationData data = \
+ LLDB_RECORD_(Result (*)(), (&Class::Method), lldb_private::repro::EmptyArg())
+
+#define LLDB_RECORD_CHAR_PTR_(T1, T2, StrOut, ...) \
+ lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION, \
+ stringify_args(__VA_ARGS__)); \
+ if (lldb_private::repro::InstrumentationData _data = \
LLDB_GET_INSTRUMENTATION_DATA()) { \
- sb_recorder.Record(data.GetSerializer(), data.GetRegistry(), \
- static_cast<Result (*)()>(&Class::Method)); \
+ if (lldb_private::repro::Serializer *_serializer = \
+ _data.GetSerializer()) { \
+ _recorder.Record(*_serializer, _data.GetRegistry(), \
+ &lldb_private::repro::invoke<T1>::method<(T2)>::record, \
+ __VA_ARGS__); \
+ } else if (lldb_private::repro::Deserializer *_deserializer = \
+ _data.GetDeserializer()) { \
+ if (_recorder.ShouldCapture()) { \
+ return lldb_private::repro::invoke_char_ptr<T1>::method<T2>::replay( \
+ _recorder, *_deserializer, _data.GetRegistry(), StrOut); \
+ } \
+ } \
}
-#define LLDB_RECORD_RESULT(Result) sb_recorder.RecordResult(Result);
+#define LLDB_RECORD_CHAR_PTR_METHOD(Result, Class, Method, Signature, StrOut, \
+ ...) \
+ LLDB_RECORD_CHAR_PTR_(Result(Class::*) Signature, (&Class::Method), StrOut, \
+ this, __VA_ARGS__)
+
+#define LLDB_RECORD_CHAR_PTR_METHOD_CONST(Result, Class, Method, Signature, \
+ StrOut, ...) \
+ LLDB_RECORD_CHAR_PTR_(Result(Class::*) Signature const, (&Class::Method), \
+ StrOut, this, __VA_ARGS__)
+
+#define LLDB_RECORD_CHAR_PTR_STATIC_METHOD(Result, Class, Method, Signature, \
+ StrOut, ...) \
+ LLDB_RECORD_CHAR_PTR_(Result(*) Signature, (&Class::Method), StrOut, \
+ __VA_ARGS__)
+
+#define LLDB_RECORD_RESULT(Result) _recorder.RecordResult(Result, true);
/// The LLDB_RECORD_DUMMY macro is special because it doesn't actually record
/// anything. It's used to track API boundaries when we cannot record for
/// technical reasons.
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...) \
- lldb_private::repro::Recorder sb_recorder(LLVM_PRETTY_FUNCTION, \
- stringify_args(__VA_ARGS__));
+ lldb_private::repro::Recorder _recorder;
+
+#define LLDB_RECORD_DUMMY_NO_ARGS(Result, Class, Method) \
+ lldb_private::repro::Recorder _recorder;
namespace lldb_private {
namespace repro {
+template <class T>
+struct is_trivially_serializable
+ : std::integral_constant<bool, std::is_fundamental<T>::value ||
+ std::is_enum<T>::value> {};
+
/// Mapping between serialized indices and their corresponding objects.
///
/// This class is used during replay to map indices back to in-memory objects.
@@ -201,19 +249,24 @@
}
/// Adds a pointer to an object to the mapping for the given index.
- template <typename T> void AddObjectForIndex(unsigned idx, T *object) {
+ template <typename T> T *AddObjectForIndex(unsigned idx, T *object) {
AddObjectForIndexImpl(
idx, static_cast<void *>(
const_cast<typename std::remove_const<T>::type *>(object)));
+ return object;
}
/// Adds a reference to an object to the mapping for the given index.
- template <typename T> void AddObjectForIndex(unsigned idx, T &object) {
+ template <typename T> T &AddObjectForIndex(unsigned idx, T &object) {
AddObjectForIndexImpl(
idx, static_cast<void *>(
const_cast<typename std::remove_const<T>::type *>(&object)));
+ return object;
}
+ /// Get all objects sorted by their index.
+ std::vector<void *> GetAllObjects() const;
+
private:
/// Helper method that does the actual lookup. The void* result is later cast
/// by the caller.
@@ -236,7 +289,10 @@
struct FundamentalReferenceTag {};
/// Return the deserialization tag for the given type T.
-template <class T> struct serializer_tag { typedef ValueTag type; };
+template <class T> struct serializer_tag {
+ typedef typename std::conditional<std::is_trivially_copyable<T>::value,
+ ValueTag, ReferenceTag>::type type;
+};
template <class T> struct serializer_tag<T *> {
typedef
typename std::conditional<std::is_fundamental<T>::value,
@@ -268,37 +324,59 @@
/// Deserialize and interpret value as T.
template <typename T> T Deserialize() {
+ T t = Read<T>(typename serializer_tag<T>::type());
#ifdef LLDB_REPRO_INSTR_TRACE
- llvm::errs() << "Deserializing with " << LLVM_PRETTY_FUNCTION << "\n";
+ llvm::errs() << "Deserializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
#endif
- return Read<T>(typename serializer_tag<T>::type());
+ return t;
}
- /// Store the returned value in the index-to-object mapping.
- template <typename T> void HandleReplayResult(const T &t) {
+ template <typename T> const T &HandleReplayResult(const T &t) {
+ CheckSequence(Deserialize<unsigned>());
unsigned result = Deserialize<unsigned>();
- if (std::is_fundamental<T>::value)
- return;
+ if (is_trivially_serializable<T>::value)
+ return t;
// We need to make a copy as the original object might go out of scope.
- m_index_to_object.AddObjectForIndex(result, new T(t));
+ return *m_index_to_object.AddObjectForIndex(result, new T(t));
}
/// Store the returned value in the index-to-object mapping.
- template <typename T> void HandleReplayResult(T *t) {
+ template <typename T> T &HandleReplayResult(T &t) {
+ CheckSequence(Deserialize<unsigned>());
unsigned result = Deserialize<unsigned>();
- if (std::is_fundamental<T>::value)
- return;
- m_index_to_object.AddObjectForIndex(result, t);
+ if (is_trivially_serializable<T>::value)
+ return t;
+ // We need to make a copy as the original object might go out of scope.
+ return *m_index_to_object.AddObjectForIndex(result, new T(t));
+ }
+
+ /// Store the returned value in the index-to-object mapping.
+ template <typename T> T *HandleReplayResult(T *t) {
+ CheckSequence(Deserialize<unsigned>());
+ unsigned result = Deserialize<unsigned>();
+ if (is_trivially_serializable<T>::value)
+ return t;
+ return m_index_to_object.AddObjectForIndex(result, t);
}
/// All returned types are recorded, even when the function returns a void.
/// The latter requires special handling.
void HandleReplayResultVoid() {
+ CheckSequence(Deserialize<unsigned>());
unsigned result = Deserialize<unsigned>();
assert(result == 0);
(void)result;
}
+ std::vector<void *> GetAllObjects() const {
+ return m_index_to_object.GetAllObjects();
+ }
+
+ void SetExpectedSequence(unsigned sequence) {
+ m_expected_sequence = sequence;
+ }
+
private:
template <typename T> T Read(ValueTag) {
assert(HasData(sizeof(T)));
@@ -340,17 +418,27 @@
return *(new UnderlyingT(Deserialize<UnderlyingT>()));
}
+ /// Verify that the given sequence number matches what we expect.
+ void CheckSequence(unsigned sequence);
+
/// Mapping of indices to objects.
IndexToObject m_index_to_object;
/// Buffer containing the serialized data.
llvm::StringRef m_buffer;
+
+ /// The result's expected sequence number.
+ llvm::Optional<unsigned> m_expected_sequence;
};
/// Partial specialization for C-style strings. We read the string value
/// instead of treating it as pointer.
template <> const char *Deserializer::Deserialize<const char *>();
+template <> const char **Deserializer::Deserialize<const char **>();
+template <> const uint8_t *Deserializer::Deserialize<const uint8_t *>();
+template <> const void *Deserializer::Deserialize<const void *>();
template <> char *Deserializer::Deserialize<char *>();
+template <> void *Deserializer::Deserialize<void *>();
/// Helpers to auto-synthesize function replay code. It deserializes the replay
/// function's arguments one by one and finally calls the corresponding
@@ -392,7 +480,11 @@
DefaultReplayer(Result (*f)(Args...)) : Replayer(), f(f) {}
void operator()(Deserializer &deserializer) const override {
- deserializer.HandleReplayResult(
+ Replay(deserializer);
+ }
+
+ Result Replay(Deserializer &deserializer) const {
+ return deserializer.HandleReplayResult(
DeserializationHelper<Args...>::template deserialized<Result>::doit(
deserializer, f));
}
@@ -407,6 +499,10 @@
DefaultReplayer(void (*f)(Args...)) : Replayer(), f(f) {}
void operator()(Deserializer &deserializer) const override {
+ Replay(deserializer);
+ }
+
+ void Replay(Deserializer &deserializer) const {
DeserializationHelper<Args...>::template deserialized<void>::doit(
deserializer, f);
deserializer.HandleReplayResultVoid();
@@ -442,7 +538,7 @@
void Register(Signature *f, llvm::StringRef result = {},
llvm::StringRef scope = {}, llvm::StringRef name = {},
llvm::StringRef args = {}) {
- DoRegister(uintptr_t(f), llvm::make_unique<DefaultReplayer<Signature>>(f),
+ DoRegister(uintptr_t(f), std::make_unique<DefaultReplayer<Signature>>(f),
SignatureStr(result, scope, name, args));
}
@@ -452,7 +548,7 @@
void Register(Signature *f, Signature *g, llvm::StringRef result = {},
llvm::StringRef scope = {}, llvm::StringRef name = {},
llvm::StringRef args = {}) {
- DoRegister(uintptr_t(f), llvm::make_unique<DefaultReplayer<Signature>>(g),
+ DoRegister(uintptr_t(f), std::make_unique<DefaultReplayer<Signature>>(g),
SignatureStr(result, scope, name, args));
}
@@ -462,18 +558,25 @@
/// Replay functions from a buffer.
bool Replay(llvm::StringRef buffer);
+ /// Replay functions from a deserializer.
+ bool Replay(Deserializer &deserializer);
+
/// Returns the ID for a given function address.
unsigned GetID(uintptr_t addr);
+ /// Get the replayer matching the given ID.
+ Replayer *GetReplayer(unsigned id);
+
+ std::string GetSignature(unsigned id);
+
+ void CheckID(unsigned expected, unsigned actual);
+
protected:
/// Register the given replayer for a function (and the ID mapping).
void DoRegister(uintptr_t RunID, std::unique_ptr<Replayer> replayer,
SignatureStr signature);
private:
- std::string GetSignature(unsigned id);
- Replayer *GetReplayer(unsigned id);
-
/// Mapping of function addresses to replayers and their ID.
std::map<uintptr_t, std::pair<std::unique_ptr<Replayer>, unsigned>>
m_replayers;
@@ -482,37 +585,6 @@
std::map<unsigned, std::pair<Replayer *, SignatureStr>> m_ids;
};
-/// To be used as the "Runtime ID" of a constructor. It also invokes the
-/// constructor when called.
-template <typename Signature> struct construct;
-template <typename Class, typename... Args> struct construct<Class(Args...)> {
- static Class *doit(Args... args) { return new Class(args...); }
-};
-
-/// To be used as the "Runtime ID" of a member function. It also invokes the
-/// member function when called.
-template <typename Signature> struct invoke;
-template <typename Result, typename Class, typename... Args>
-struct invoke<Result (Class::*)(Args...)> {
- template <Result (Class::*m)(Args...)> struct method {
- static Result doit(Class *c, Args... args) { return (c->*m)(args...); }
- };
-};
-
-template <typename Result, typename Class, typename... Args>
-struct invoke<Result (Class::*)(Args...) const> {
- template <Result (Class::*m)(Args...) const> struct method_const {
- static Result doit(Class *c, Args... args) { return (c->*m)(args...); }
- };
-};
-
-template <typename Class, typename... Args>
-struct invoke<void (Class::*)(Args...)> {
- template <void (Class::*m)(Args...)> struct method {
- static void doit(Class *c, Args... args) { (c->*m)(args...); }
- };
-};
-
/// Maps an object to an index for serialization. Indices are unique and
/// incremented for every new object.
///
@@ -542,15 +614,17 @@
SerializeAll(tail...);
}
- void SerializeAll() {
- m_stream.flush();
- }
+ void SerializeAll() { m_stream.flush(); }
private:
/// Serialize pointers. We need to differentiate between pointers to
/// fundamental types (in which case we serialize its value) and pointer to
/// objects (in which case we serialize their index).
template <typename T> void Serialize(T *t) {
+#ifdef LLDB_REPRO_INSTR_TRACE
+ this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
+#endif
if (std::is_fundamental<T>::value) {
Serialize(*t);
} else {
@@ -563,7 +637,11 @@
/// fundamental types (in which case we serialize its value) and references
/// to objects (in which case we serialize their index).
template <typename T> void Serialize(T &t) {
- if (std::is_fundamental<T>::value) {
+#ifdef LLDB_REPRO_INSTR_TRACE
+ this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
+#endif
+ if (is_trivially_serializable<T>::value) {
m_stream.write(reinterpret_cast<const char *>(&t), sizeof(T));
} else {
unsigned idx = m_tracker.GetIndexForObject(&t);
@@ -571,14 +649,43 @@
}
}
+ void Serialize(const void *v) {
+ // FIXME: Support void*
+ }
+
void Serialize(void *v) {
// FIXME: Support void*
- llvm_unreachable("void* is currently unsupported.");
}
void Serialize(const char *t) {
- m_stream << t;
- m_stream.write(0x0);
+#ifdef LLDB_REPRO_INSTR_TRACE
+ this_thread_id() << "Serializing with " << LLVM_PRETTY_FUNCTION << " -> "
+ << stringify_args(t) << "\n";
+#endif
+ const size_t size = t ? strlen(t) : std::numeric_limits<size_t>::max();
+ Serialize(size);
+ if (t) {
+ m_stream << t;
+ m_stream.write(0x0);
+ }
+ }
+
+ void Serialize(const char **t) {
+ size_t size = 0;
+ if (!t) {
+ Serialize(size);
+ return;
+ }
+
+ // Compute the size of the array.
+ const char *const *temp = t;
+ while (*temp++)
+ size++;
+ Serialize(size);
+
+ // Serialize the content of the array.
+ while (*t)
+ Serialize(*t++);
}
/// Serialization stream.
@@ -586,24 +693,46 @@
/// Mapping of objects to indices.
ObjectToIndex m_tracker;
-};
+}; // namespace repro
class InstrumentationData {
public:
- InstrumentationData() : m_serializer(nullptr), m_registry(nullptr){};
- InstrumentationData(Serializer &serializer, Registry ®istry)
- : m_serializer(&serializer), m_registry(®istry){};
-
- Serializer &GetSerializer() { return *m_serializer; }
+ Serializer *GetSerializer() { return m_serializer; }
+ Deserializer *GetDeserializer() { return m_deserializer; }
Registry &GetRegistry() { return *m_registry; }
- operator bool() { return m_serializer != nullptr && m_registry != nullptr; }
+ operator bool() {
+ return (m_serializer != nullptr || m_deserializer != nullptr) &&
+ m_registry != nullptr;
+ }
+
+ static void Initialize(Serializer &serializer, Registry ®istry);
+ static void Initialize(Deserializer &serializer, Registry ®istry);
+ static InstrumentationData &Instance();
+
+protected:
+ friend llvm::optional_detail::OptionalStorage<InstrumentationData, true>;
+ friend llvm::Optional<InstrumentationData>;
+
+ InstrumentationData()
+ : m_serializer(nullptr), m_deserializer(nullptr), m_registry(nullptr) {}
+ InstrumentationData(Serializer &serializer, Registry ®istry)
+ : m_serializer(&serializer), m_deserializer(nullptr),
+ m_registry(®istry) {}
+ InstrumentationData(Deserializer &deserializer, Registry ®istry)
+ : m_serializer(nullptr), m_deserializer(&deserializer),
+ m_registry(®istry) {}
private:
+ static llvm::Optional<InstrumentationData> &InstanceImpl();
+
Serializer *m_serializer;
+ Deserializer *m_deserializer;
Registry *m_registry;
};
+struct EmptyArg {};
+
/// RAII object that records function invocations and their return value.
///
/// API calls are only captured when the API boundary is crossed. Once we're in
@@ -618,7 +747,8 @@
/// this class is also used for logging.
class Recorder {
public:
- Recorder(llvm::StringRef pretty_func = {}, std::string &&pretty_args = {});
+ Recorder();
+ Recorder(llvm::StringRef pretty_func, std::string &&pretty_args = {});
~Recorder();
/// Records a single function call.
@@ -629,12 +759,15 @@
if (!ShouldCapture())
return;
+ std::lock_guard<std::mutex> lock(g_mutex);
+ unsigned sequence = GetSequenceNumber();
unsigned id = registry.GetID(uintptr_t(f));
#ifdef LLDB_REPRO_INSTR_TRACE
Log(id);
#endif
+ serializer.SerializeAll(sequence);
serializer.SerializeAll(id);
serializer.SerializeAll(args...);
@@ -642,6 +775,7 @@
typename std::remove_reference<Result>::type>::type>::value) {
m_result_recorded = false;
} else {
+ serializer.SerializeAll(sequence);
serializer.SerializeAll(0);
m_result_recorded = true;
}
@@ -655,43 +789,102 @@
if (!ShouldCapture())
return;
+ std::lock_guard<std::mutex> lock(g_mutex);
+ unsigned sequence = GetSequenceNumber();
unsigned id = registry.GetID(uintptr_t(f));
#ifdef LLDB_REPRO_INSTR_TRACE
Log(id);
#endif
+ serializer.SerializeAll(sequence);
serializer.SerializeAll(id);
serializer.SerializeAll(args...);
// Record result.
+ serializer.SerializeAll(sequence);
serializer.SerializeAll(0);
m_result_recorded = true;
}
+ /// Specializations for the no-argument methods. These are passed an empty
+ /// dummy argument so the same variadic macro can be used. These methods
+ /// strip the arguments before forwarding them.
+ template <typename Result>
+ void Record(Serializer &serializer, Registry ®istry, Result (*f)(),
+ const EmptyArg &arg) {
+ Record(serializer, registry, f);
+ }
+
/// Record the result of a function call.
- template <typename Result> Result RecordResult(Result &&r) {
- UpdateBoundary();
+ template <typename Result>
+ Result RecordResult(Result &&r, bool update_boundary) {
+ // When recording the result from the LLDB_RECORD_RESULT macro, we need to
+ // update the boundary so we capture the copy constructor. However, when
+ // called to record the this pointer of the (copy) constructor, the
+ // boundary should not be toggled, because it is called from the
+ // LLDB_RECORD_CONSTRUCTOR macro, which might be followed by other API
+ // calls.
+ if (update_boundary)
+ UpdateBoundary();
if (m_serializer && ShouldCapture()) {
+ std::lock_guard<std::mutex> lock(g_mutex);
assert(!m_result_recorded);
+ m_serializer->SerializeAll(GetSequenceNumber());
m_serializer->SerializeAll(r);
m_result_recorded = true;
}
return std::forward<Result>(r);
}
+ template <typename Result, typename T>
+ Result Replay(Deserializer &deserializer, Registry ®istry, uintptr_t addr,
+ bool update_boundary) {
+ deserializer.SetExpectedSequence(deserializer.Deserialize<unsigned>());
+ unsigned actual_id = registry.GetID(addr);
+ unsigned id = deserializer.Deserialize<unsigned>();
+ registry.CheckID(id, actual_id);
+ return ReplayResult<Result>(
+ static_cast<DefaultReplayer<T> *>(registry.GetReplayer(id))
+ ->Replay(deserializer),
+ update_boundary);
+ }
+
+ void Replay(Deserializer &deserializer, Registry ®istry, uintptr_t addr) {
+ deserializer.SetExpectedSequence(deserializer.Deserialize<unsigned>());
+ unsigned actual_id = registry.GetID(addr);
+ unsigned id = deserializer.Deserialize<unsigned>();
+ registry.CheckID(id, actual_id);
+ registry.GetReplayer(id)->operator()(deserializer);
+ }
+
+ template <typename Result>
+ Result ReplayResult(Result &&r, bool update_boundary) {
+ if (update_boundary)
+ UpdateBoundary();
+ return std::forward<Result>(r);
+ }
+
+ bool ShouldCapture() { return m_local_boundary; }
+
+ /// Mark the current thread as a private thread and pretend that everything
+ /// on this thread is behind happening behind the API boundary.
+ static void PrivateThread() { g_global_boundary = true; }
+
private:
+ static unsigned GetNextSequenceNumber() { return g_sequence++; }
+ unsigned GetSequenceNumber() const;
+
+ template <typename T> friend struct replay;
void UpdateBoundary() {
if (m_local_boundary)
g_global_boundary = false;
}
- bool ShouldCapture() { return m_local_boundary; }
-
#ifdef LLDB_REPRO_INSTR_TRACE
void Log(unsigned id) {
- llvm::errs() << "Recording " << id << ": " << m_pretty_func << " ("
- << m_pretty_args << ")\n";
+ this_thread_id() << "Recording " << id << ": " << m_pretty_func << " ("
+ << m_pretty_args << ")\n";
}
#endif
@@ -707,11 +900,213 @@
/// Whether the return value was recorded explicitly.
bool m_result_recorded;
+ /// The sequence number for this pair of function and result.
+ unsigned m_sequence;
+
/// Whether we're currently across the API boundary.
- static bool g_global_boundary;
+ static thread_local bool g_global_boundary;
+
+ /// Global mutex to protect concurrent access.
+ static std::mutex g_mutex;
+
+ /// Unique, monotonically increasing sequence number.
+ static std::atomic<unsigned> g_sequence;
};
+/// To be used as the "Runtime ID" of a constructor. It also invokes the
+/// constructor when called.
+template <typename Signature> struct construct;
+template <typename Class, typename... Args> struct construct<Class(Args...)> {
+ static Class *handle(lldb_private::repro::InstrumentationData data,
+ lldb_private::repro::Recorder &recorder, Class *c,
+ const EmptyArg &) {
+ return handle(data, recorder, c);
+ }
+
+ static Class *handle(lldb_private::repro::InstrumentationData data,
+ lldb_private::repro::Recorder &recorder, Class *c,
+ Args... args) {
+ if (!data)
+ return nullptr;
+
+ if (Serializer *serializer = data.GetSerializer()) {
+ recorder.Record(*serializer, data.GetRegistry(), &record, args...);
+ recorder.RecordResult(c, false);
+ } else if (Deserializer *deserializer = data.GetDeserializer()) {
+ if (recorder.ShouldCapture()) {
+ replay(recorder, *deserializer, data.GetRegistry());
+ }
+ }
+
+ return nullptr;
+ }
+
+ static Class *record(Args... args) { return new Class(args...); }
+
+ static Class *replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ return recorder.Replay<Class *, Class *(Args...)>(
+ deserializer, registry, uintptr_t(&record), false);
+ }
+};
+
+/// To be used as the "Runtime ID" of a member function. It also invokes the
+/// member function when called.
+template <typename Signature> struct invoke;
+template <typename Result, typename Class, typename... Args>
+struct invoke<Result (Class::*)(Args...)> {
+ template <Result (Class::*m)(Args...)> struct method {
+ static Result record(Class *c, Args... args) { return (c->*m)(args...); }
+
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ return recorder.Replay<Result, Result(Class *, Args...)>(
+ deserializer, registry, uintptr_t(&record), true);
+ }
+ };
+};
+
+template <typename Class, typename... Args>
+struct invoke<void (Class::*)(Args...)> {
+ template <void (Class::*m)(Args...)> struct method {
+ static void record(Class *c, Args... args) { (c->*m)(args...); }
+ static void replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ recorder.Replay(deserializer, registry, uintptr_t(&record));
+ }
+ };
+};
+
+template <typename Result, typename Class, typename... Args>
+struct invoke<Result (Class::*)(Args...) const> {
+ template <Result (Class::*m)(Args...) const> struct method {
+ static Result record(Class *c, Args... args) { return (c->*m)(args...); }
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ return recorder.Replay<Result, Result(Class *, Args...)>(
+ deserializer, registry, uintptr_t(&record), true);
+ }
+ };
+};
+
+template <typename Class, typename... Args>
+struct invoke<void (Class::*)(Args...) const> {
+ template <void (Class::*m)(Args...) const> struct method {
+ static void record(Class *c, Args... args) { return (c->*m)(args...); }
+ static void replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ recorder.Replay(deserializer, registry, uintptr_t(&record));
+ }
+ };
+};
+
+template <typename Signature> struct replay;
+
+template <typename Result, typename Class, typename... Args>
+struct replay<Result (Class::*)(Args...)> {
+ template <Result (Class::*m)(Args...)> struct method {};
+};
+
+template <typename Result, typename... Args>
+struct invoke<Result (*)(Args...)> {
+ template <Result (*m)(Args...)> struct method {
+ static Result record(Args... args) { return (*m)(args...); }
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ return recorder.Replay<Result, Result(Args...)>(deserializer, registry,
+ uintptr_t(&record), true);
+ }
+ };
+};
+
+template <typename... Args> struct invoke<void (*)(Args...)> {
+ template <void (*m)(Args...)> struct method {
+ static void record(Args... args) { return (*m)(args...); }
+ static void replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry) {
+ recorder.Replay(deserializer, registry, uintptr_t(&record));
+ }
+ };
+};
+
+/// Special handling for functions returning strings as (char*, size_t).
+/// {
+
+/// For inline replay, we ignore the arguments and use the ones from the
+/// serializer instead. This doesn't work for methods that use a char* and a
+/// size to return a string. For one these functions have a custom replayer to
+/// prevent override the input buffer. Furthermore, the template-generated
+/// deserialization is not easy to hook into.
+///
+/// The specializations below hand-implement the serialization logic for the
+/// inline replay. Instead of using the function from the registry, it uses the
+/// one passed into the macro.
+template <typename Signature> struct invoke_char_ptr;
+template <typename Result, typename Class, typename... Args>
+struct invoke_char_ptr<Result (Class::*)(Args...) const> {
+ template <Result (Class::*m)(Args...) const> struct method {
+ static Result record(Class *c, char *s, size_t l) {
+ char *buffer = reinterpret_cast<char *>(calloc(l, sizeof(char)));
+ return (c->*m)(buffer, l);
+ }
+
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry, char *str) {
+ deserializer.SetExpectedSequence(deserializer.Deserialize<unsigned>());
+ deserializer.Deserialize<unsigned>();
+ Class *c = deserializer.Deserialize<Class *>();
+ deserializer.Deserialize<const char *>();
+ size_t l = deserializer.Deserialize<size_t>();
+ return recorder.ReplayResult(
+ std::move(deserializer.HandleReplayResult((c->*m)(str, l))), true);
+ }
+ };
+};
+
+template <typename Signature> struct invoke_char_ptr;
+template <typename Result, typename Class, typename... Args>
+struct invoke_char_ptr<Result (Class::*)(Args...)> {
+ template <Result (Class::*m)(Args...)> struct method {
+ static Result record(Class *c, char *s, size_t l) {
+ char *buffer = reinterpret_cast<char *>(calloc(l, sizeof(char)));
+ return (c->*m)(buffer, l);
+ }
+
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry, char *str) {
+ deserializer.SetExpectedSequence(deserializer.Deserialize<unsigned>());
+ deserializer.Deserialize<unsigned>();
+ Class *c = deserializer.Deserialize<Class *>();
+ deserializer.Deserialize<const char *>();
+ size_t l = deserializer.Deserialize<size_t>();
+ return recorder.ReplayResult(
+ std::move(deserializer.HandleReplayResult((c->*m)(str, l))), true);
+ }
+ };
+};
+
+template <typename Result, typename... Args>
+struct invoke_char_ptr<Result (*)(Args...)> {
+ template <Result (*m)(Args...)> struct method {
+ static Result record(char *s, size_t l) {
+ char *buffer = reinterpret_cast<char *>(calloc(l, sizeof(char)));
+ return (*m)(buffer, l);
+ }
+
+ static Result replay(Recorder &recorder, Deserializer &deserializer,
+ Registry ®istry, char *str) {
+ deserializer.SetExpectedSequence(deserializer.Deserialize<unsigned>());
+ deserializer.Deserialize<unsigned>();
+ deserializer.Deserialize<const char *>();
+ size_t l = deserializer.Deserialize<size_t>();
+ return recorder.ReplayResult(
+ std::move(deserializer.HandleReplayResult((*m)(str, l))), true);
+ }
+ };
+};
+/// }
+
} // namespace repro
} // namespace lldb_private
-#endif // LLDB_UTILITY_REPRODUCER_INSTRUMENTATION_H
+#endif // LLDB_UTILITY_REPRODUCERINSTRUMENTATION_H
diff --git a/linux-x64/clang/include/lldb/Utility/ReproducerProvider.h b/linux-x64/clang/include/lldb/Utility/ReproducerProvider.h
new file mode 100644
index 0000000..221c0eb
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/ReproducerProvider.h
@@ -0,0 +1,434 @@
+//===-- Reproducer.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_REPRODUCER_PROVIDER_H
+#define LLDB_UTILITY_REPRODUCER_PROVIDER_H
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/ProcessInfo.h"
+#include "lldb/Utility/Reproducer.h"
+#include "lldb/Utility/UUID.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/FileCollector.h"
+#include "llvm/Support/YAMLTraits.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace lldb_private {
+namespace repro {
+
+/// The recorder is a small object handed out by a provider to record data. It
+/// is commonly used in combination with a MultiProvider which is meant to
+/// record information for multiple instances of the same source of data.
+class AbstractRecorder {
+protected:
+ AbstractRecorder(const FileSpec &filename, std::error_code &ec)
+ : m_filename(filename.GetFilename().GetStringRef()),
+ m_os(filename.GetPath(), ec, llvm::sys::fs::OF_Text), m_record(true) {}
+
+public:
+ const FileSpec &GetFilename() { return m_filename; }
+
+ void Stop() {
+ assert(m_record);
+ m_record = false;
+ }
+
+private:
+ FileSpec m_filename;
+
+protected:
+ llvm::raw_fd_ostream m_os;
+ bool m_record;
+};
+
+/// Recorder that records its data as text to a file.
+class DataRecorder : public AbstractRecorder {
+public:
+ DataRecorder(const FileSpec &filename, std::error_code &ec)
+ : AbstractRecorder(filename, ec) {}
+
+ static llvm::Expected<std::unique_ptr<DataRecorder>>
+ Create(const FileSpec &filename);
+
+ template <typename T> void Record(const T &t, bool newline = false) {
+ if (!m_record)
+ return;
+ m_os << t;
+ if (newline)
+ m_os << '\n';
+ m_os.flush();
+ }
+};
+
+/// Recorder that records its data as YAML to a file.
+class YamlRecorder : public AbstractRecorder {
+public:
+ YamlRecorder(const FileSpec &filename, std::error_code &ec)
+ : AbstractRecorder(filename, ec) {}
+
+ static llvm::Expected<std::unique_ptr<YamlRecorder>>
+ Create(const FileSpec &filename);
+
+ template <typename T> void Record(const T &t) {
+ if (!m_record)
+ return;
+ llvm::yaml::Output yout(m_os);
+ // The YAML traits are defined as non-const because they are used for
+ // serialization and deserialization. The cast is safe because
+ // serialization doesn't modify the object.
+ yout << const_cast<T &>(t);
+ m_os.flush();
+ }
+};
+
+class FlushingFileCollector : public llvm::FileCollectorBase {
+public:
+ FlushingFileCollector(llvm::StringRef files_path, llvm::StringRef dirs_path,
+ std::error_code &ec);
+
+protected:
+ void addFileImpl(llvm::StringRef file) override;
+
+ llvm::vfs::directory_iterator
+ addDirectoryImpl(const llvm::Twine &dir,
+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs,
+ std::error_code &dir_ec) override;
+
+ llvm::Optional<llvm::raw_fd_ostream> m_files_os;
+ llvm::Optional<llvm::raw_fd_ostream> m_dirs_os;
+};
+
+class FileProvider : public Provider<FileProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ FileProvider(const FileSpec &directory) : Provider(directory) {
+ std::error_code ec;
+ m_collector = std::make_shared<FlushingFileCollector>(
+ directory.CopyByAppendingPathComponent("files.txt").GetPath(),
+ directory.CopyByAppendingPathComponent("dirs.txt").GetPath(), ec);
+ if (ec)
+ m_collector.reset();
+ }
+
+ std::shared_ptr<llvm::FileCollectorBase> GetFileCollector() {
+ return m_collector;
+ }
+
+ void RecordInterestingDirectory(const llvm::Twine &dir);
+ void RecordInterestingDirectoryRecursive(const llvm::Twine &dir);
+
+ static char ID;
+
+private:
+ std::shared_ptr<FlushingFileCollector> m_collector;
+};
+
+/// Provider for the LLDB version number.
+///
+/// When the reproducer is kept, it writes the lldb version to a file named
+/// version.txt in the reproducer root.
+class VersionProvider : public Provider<VersionProvider> {
+public:
+ VersionProvider(const FileSpec &directory) : Provider(directory) {}
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ void SetVersion(std::string version) {
+ assert(m_version.empty());
+ m_version = std::move(version);
+ }
+ void Keep() override;
+ std::string m_version;
+ static char ID;
+};
+
+/// Abstract provider to storing directory paths.
+template <typename T> class DirectoryProvider : public repro::Provider<T> {
+public:
+ DirectoryProvider(const FileSpec &root) : Provider<T>(root) {}
+ void SetDirectory(std::string directory) {
+ m_directory = std::move(directory);
+ }
+ llvm::StringRef GetDirectory() { return m_directory; }
+
+ void Keep() override {
+ FileSpec file = this->GetRoot().CopyByAppendingPathComponent(T::Info::file);
+ std::error_code ec;
+ llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text);
+ if (ec)
+ return;
+ os << m_directory << "\n";
+ }
+
+protected:
+ std::string m_directory;
+};
+
+/// Provider for the current working directory.
+///
+/// When the reproducer is kept, it writes lldb's current working directory to
+/// a file named cwd.txt in the reproducer root.
+class WorkingDirectoryProvider
+ : public DirectoryProvider<WorkingDirectoryProvider> {
+public:
+ WorkingDirectoryProvider(const FileSpec &directory)
+ : DirectoryProvider(directory) {
+ llvm::SmallString<128> cwd;
+ if (std::error_code EC = llvm::sys::fs::current_path(cwd))
+ return;
+ SetDirectory(std::string(cwd));
+ }
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ static char ID;
+};
+
+/// Provider for the home directory.
+///
+/// When the reproducer is kept, it writes the user's home directory to a file
+/// a file named home.txt in the reproducer root.
+class HomeDirectoryProvider : public DirectoryProvider<HomeDirectoryProvider> {
+public:
+ HomeDirectoryProvider(const FileSpec &directory)
+ : DirectoryProvider(directory) {
+ llvm::SmallString<128> home_dir;
+ llvm::sys::path::home_directory(home_dir);
+ SetDirectory(std::string(home_dir));
+ }
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ static char ID;
+};
+
+/// Provider for mapping UUIDs to symbol and executable files.
+class SymbolFileProvider : public Provider<SymbolFileProvider> {
+public:
+ SymbolFileProvider(const FileSpec &directory)
+ : Provider(directory), m_symbol_files() {}
+
+ void AddSymbolFile(const UUID *uuid, const FileSpec &module_path,
+ const FileSpec &symbol_path);
+ void Keep() override;
+
+ struct Entry {
+ Entry() = default;
+ Entry(std::string uuid) : uuid(std::move(uuid)) {}
+ Entry(std::string uuid, std::string module_path, std::string symbol_path)
+ : uuid(std::move(uuid)), module_path(std::move(module_path)),
+ symbol_path(std::move(symbol_path)) {}
+
+ bool operator==(const Entry &rhs) const { return uuid == rhs.uuid; }
+ bool operator<(const Entry &rhs) const { return uuid < rhs.uuid; }
+
+ std::string uuid;
+ std::string module_path;
+ std::string symbol_path;
+ };
+
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+ static char ID;
+
+private:
+ std::vector<Entry> m_symbol_files;
+};
+
+/// The MultiProvider is a provider that hands out recorder which can be used
+/// to capture data for different instances of the same object. The recorders
+/// can be passed around or stored as an instance member.
+///
+/// The Info::file for the MultiProvider contains an index of files for every
+/// recorder. Use the MultiLoader to read the index and get the individual
+/// files.
+template <typename T, typename V>
+class MultiProvider : public repro::Provider<V> {
+public:
+ MultiProvider(const FileSpec &directory) : Provider<V>(directory) {}
+
+ T *GetNewRecorder() {
+ std::size_t i = m_recorders.size() + 1;
+ std::string filename = (llvm::Twine(V::Info::name) + llvm::Twine("-") +
+ llvm::Twine(i) + llvm::Twine(".yaml"))
+ .str();
+ auto recorder_or_error =
+ T::Create(this->GetRoot().CopyByAppendingPathComponent(filename));
+ if (!recorder_or_error) {
+ llvm::consumeError(recorder_or_error.takeError());
+ return nullptr;
+ }
+
+ m_recorders.push_back(std::move(*recorder_or_error));
+ return m_recorders.back().get();
+ }
+
+ void Keep() override {
+ std::vector<std::string> files;
+ for (auto &recorder : m_recorders) {
+ recorder->Stop();
+ files.push_back(recorder->GetFilename().GetPath());
+ }
+
+ FileSpec file = this->GetRoot().CopyByAppendingPathComponent(V::Info::file);
+ std::error_code ec;
+ llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text);
+ if (ec)
+ return;
+ llvm::yaml::Output yout(os);
+ yout << files;
+ }
+
+ void Discard() override { m_recorders.clear(); }
+
+private:
+ std::vector<std::unique_ptr<T>> m_recorders;
+};
+
+class CommandProvider : public MultiProvider<DataRecorder, CommandProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ CommandProvider(const FileSpec &directory)
+ : MultiProvider<DataRecorder, CommandProvider>(directory) {}
+
+ static char ID;
+};
+
+class ProcessInfoRecorder : public AbstractRecorder {
+public:
+ ProcessInfoRecorder(const FileSpec &filename, std::error_code &ec)
+ : AbstractRecorder(filename, ec) {}
+
+ static llvm::Expected<std::unique_ptr<ProcessInfoRecorder>>
+ Create(const FileSpec &filename);
+
+ void Record(const ProcessInstanceInfoList &process_infos);
+};
+
+class ProcessInfoProvider : public repro::Provider<ProcessInfoProvider> {
+public:
+ struct Info {
+ static const char *name;
+ static const char *file;
+ };
+
+ ProcessInfoProvider(const FileSpec &directory) : Provider(directory) {}
+
+ ProcessInfoRecorder *GetNewProcessInfoRecorder();
+
+ void Keep() override;
+ void Discard() override;
+
+ static char ID;
+
+private:
+ std::unique_ptr<llvm::raw_fd_ostream> m_stream_up;
+ std::vector<std::unique_ptr<ProcessInfoRecorder>> m_process_info_recorders;
+};
+
+/// Loader for data captured with the MultiProvider. It will read the index and
+/// return the path to the files in the index.
+template <typename T> class MultiLoader {
+public:
+ MultiLoader(std::vector<std::string> files) : m_files(std::move(files)) {}
+
+ static std::unique_ptr<MultiLoader> Create(Loader *loader) {
+ if (!loader)
+ return {};
+
+ FileSpec file = loader->GetFile<typename T::Info>();
+ if (!file)
+ return {};
+
+ auto error_or_file = llvm::MemoryBuffer::getFile(file.GetPath());
+ if (auto err = error_or_file.getError())
+ return {};
+
+ std::vector<std::string> files;
+ llvm::yaml::Input yin((*error_or_file)->getBuffer());
+ yin >> files;
+
+ if (auto err = yin.error())
+ return {};
+
+ for (auto &file : files) {
+ FileSpec absolute_path =
+ loader->GetRoot().CopyByAppendingPathComponent(file);
+ file = absolute_path.GetPath();
+ }
+
+ return std::make_unique<MultiLoader<T>>(std::move(files));
+ }
+
+ llvm::Optional<std::string> GetNextFile() {
+ if (m_index >= m_files.size())
+ return {};
+ return m_files[m_index++];
+ }
+
+private:
+ std::vector<std::string> m_files;
+ unsigned m_index = 0;
+};
+
+class SymbolFileLoader {
+public:
+ SymbolFileLoader(Loader *loader);
+ std::pair<FileSpec, FileSpec> GetPaths(const UUID *uuid) const;
+
+private:
+ // Sorted list of UUID to path mappings.
+ std::vector<SymbolFileProvider::Entry> m_symbol_files;
+};
+
+/// Helper to read directories written by the DirectoryProvider.
+template <typename T>
+llvm::Expected<std::string> GetDirectoryFrom(repro::Loader *loader) {
+ llvm::Expected<std::string> dir = loader->LoadBuffer<T>();
+ if (!dir)
+ return dir.takeError();
+ return std::string(llvm::StringRef(*dir).rtrim());
+}
+
+} // namespace repro
+} // namespace lldb_private
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::repro::SymbolFileProvider::Entry)
+
+namespace llvm {
+namespace yaml {
+template <>
+struct MappingTraits<lldb_private::repro::SymbolFileProvider::Entry> {
+ static void mapping(IO &io,
+ lldb_private::repro::SymbolFileProvider::Entry &entry) {
+ io.mapRequired("uuid", entry.uuid);
+ io.mapRequired("module-path", entry.module_path);
+ io.mapRequired("symbol-path", entry.symbol_path);
+ }
+};
+} // namespace yaml
+} // namespace llvm
+
+#endif // LLDB_UTILITY_REPRODUCER_PROVIDER_H
diff --git a/linux-x64/clang/include/lldb/Utility/Scalar.h b/linux-x64/clang/include/lldb/Utility/Scalar.h
index 62ee9f6..f797aaf 100644
--- a/linux-x64/clang/include/lldb/Utility/Scalar.h
+++ b/linux-x64/clang/include/lldb/Utility/Scalar.h
@@ -9,118 +9,68 @@
#ifndef LLDB_UTILITY_SCALAR_H
#define LLDB_UTILITY_SCALAR_H
+#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Status.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private-types.h"
-#include "lldb/Utility/LLDBAssert.h"
#include "llvm/ADT/APFloat.h"
-#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/APSInt.h"
#include <cstddef>
#include <cstdint>
+#include <utility>
namespace lldb_private {
+
class DataExtractor;
class Stream;
-} // namespace lldb_private
#define NUM_OF_WORDS_INT128 2
#define BITWIDTH_INT128 128
-#define NUM_OF_WORDS_INT256 4
-#define BITWIDTH_INT256 256
-#define NUM_OF_WORDS_INT512 8
-#define BITWIDTH_INT512 512
-
-namespace lldb_private {
// A class designed to hold onto values and their corresponding types.
// Operators are defined and Scalar objects will correctly promote their types
// and values before performing these operations. Type promotion currently
// follows the ANSI C type promotion rules.
class Scalar {
+ template<typename T>
+ static llvm::APSInt MakeAPSInt(T v) {
+ static_assert(std::is_integral<T>::value, "");
+ static_assert(sizeof(T) <= sizeof(uint64_t), "Conversion loses precision!");
+ return llvm::APSInt(
+ llvm::APInt(sizeof(T) * 8, uint64_t(v), std::is_signed<T>::value),
+ std::is_unsigned<T>::value);
+ }
+
public:
enum Type {
e_void = 0,
- e_sint,
- e_uint,
- e_slong,
- e_ulong,
- e_slonglong,
- e_ulonglong,
- e_sint128,
- e_uint128,
- e_sint256,
- e_uint256,
- e_sint512,
- e_uint512,
+ e_int,
e_float,
- e_double,
- e_long_double
};
// Constructors and Destructors
- Scalar();
- Scalar(int v) : m_type(e_sint), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(int) * 8, v, true);
- }
- Scalar(unsigned int v) : m_type(e_uint), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(int) * 8, v);
- }
- Scalar(long v) : m_type(e_slong), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(long) * 8, v, true);
- }
- Scalar(unsigned long v) : m_type(e_ulong), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(long) * 8, v);
- }
- Scalar(long long v) : m_type(e_slonglong), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(long long) * 8, v, true);
- }
+ Scalar() : m_type(e_void), m_float(0.0f) {}
+ Scalar(int v) : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
+ Scalar(unsigned int v)
+ : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
+ Scalar(long v) : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
+ Scalar(unsigned long v)
+ : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
+ Scalar(long long v)
+ : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
Scalar(unsigned long long v)
- : m_type(e_ulonglong), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(sizeof(long long) * 8, v);
+ : m_type(e_int), m_integer(MakeAPSInt(v)), m_float(0.0f) {}
+ Scalar(float v) : m_type(e_float), m_float(v) {}
+ Scalar(double v) : m_type(e_float), m_float(v) {}
+ Scalar(long double v) : m_type(e_float), m_float(double(v)) {
+ bool ignore;
+ m_float.convert(llvm::APFloat::x87DoubleExtended(),
+ llvm::APFloat::rmNearestTiesToEven, &ignore);
}
- Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); }
- Scalar(double v) : m_type(e_double), m_float(v) {
- m_float = llvm::APFloat(v);
- }
- Scalar(long double v, bool ieee_quad)
- : m_type(e_long_double), m_float(static_cast<float>(0)),
- m_ieee_quad(ieee_quad) {
- if (ieee_quad)
- m_float =
- llvm::APFloat(llvm::APFloat::IEEEquad(),
- llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
- (reinterpret_cast<type128 *>(&v))->x));
- else
- m_float =
- llvm::APFloat(llvm::APFloat::x87DoubleExtended(),
- llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128,
- (reinterpret_cast<type128 *>(&v))->x));
- }
- Scalar(llvm::APInt v) : m_type(), m_float(static_cast<float>(0)) {
- m_integer = llvm::APInt(v);
- switch (m_integer.getBitWidth()) {
- case 8:
- case 16:
- case 32:
- m_type = e_sint;
- return;
- case 64:
- m_type = e_slonglong;
- return;
- case 128:
- m_type = e_sint128;
- return;
- case 256:
- m_type = e_sint256;
- return;
- case 512:
- m_type = e_sint512;
- return;
- }
- lldbassert(false && "unsupported bitwidth");
- }
- // Scalar(const RegisterValue& reg_value);
- virtual ~Scalar();
+ Scalar(llvm::APInt v)
+ : m_type(e_int), m_integer(std::move(v), false), m_float(0.0f) {}
+ Scalar(llvm::APSInt v)
+ : m_type(e_int), m_integer(std::move(v)), m_float(0.0f) {}
bool SignExtend(uint32_t bit_pos);
@@ -130,7 +80,10 @@
bool ClearBit(uint32_t bit);
- const void *GetBytes() const;
+ /// Store the binary representation of this value into the given storage.
+ /// Exactly GetByteSize() bytes will be stored, and the buffer must be large
+ /// enough to hold this data.
+ void GetBytes(llvm::MutableArrayRef<uint8_t> storage) const;
size_t GetByteSize() const;
@@ -146,46 +99,30 @@
m_integer.clearAllBits();
}
- const char *GetTypeAsCString() const;
+ const char *GetTypeAsCString() const { return GetValueTypeAsCString(m_type); }
void GetValue(Stream *s, bool show_type) const;
- bool IsValid() const {
- return (m_type >= e_sint) && (m_type <= e_long_double);
- }
+ bool IsValid() const { return (m_type >= e_int) && (m_type <= e_float); }
- bool Promote(Scalar::Type type);
+ /// Convert to an integer with \p bits and the given signedness.
+ void TruncOrExtendTo(uint16_t bits, bool sign);
+ bool IntegralPromote(uint16_t bits, bool sign);
+ bool FloatPromote(const llvm::fltSemantics &semantics);
+
+ bool IsSigned() const;
bool MakeSigned();
bool MakeUnsigned();
static const char *GetValueTypeAsCString(Scalar::Type value_type);
- static Scalar::Type
- GetValueTypeForSignedIntegerWithByteSize(size_t byte_size);
-
- static Scalar::Type
- GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size);
-
- static Scalar::Type GetValueTypeForFloatWithByteSize(size_t byte_size);
-
// All operators can benefits from the implicit conversions that will happen
// automagically by the compiler, so no temporary objects will need to be
// created. As a result, we currently don't need a variety of overloaded set
// value accessors.
- Scalar &operator=(const int i);
- Scalar &operator=(unsigned int v);
- Scalar &operator=(long v);
- Scalar &operator=(unsigned long v);
- Scalar &operator=(long long v);
- Scalar &operator=(unsigned long long v);
- Scalar &operator=(float v);
- Scalar &operator=(double v);
- Scalar &operator=(long double v);
- Scalar &operator=(llvm::APInt v);
- Scalar &operator=(const Scalar &rhs); // Assignment operator
- Scalar &operator+=(const Scalar &rhs);
+ Scalar &operator+=(Scalar rhs);
Scalar &operator<<=(const Scalar &rhs); // Shift left
Scalar &operator>>=(const Scalar &rhs); // Shift right (arithmetic)
Scalar &operator&=(const Scalar &rhs);
@@ -217,7 +154,7 @@
unsigned char UChar(unsigned char fail_value = 0) const;
- signed char SChar(char fail_value = 0) const;
+ signed char SChar(signed char fail_value = 0) const;
unsigned short UShort(unsigned short fail_value = 0) const;
@@ -233,7 +170,7 @@
unsigned long long ULongLong(unsigned long long fail_value = 0) const;
- llvm::APInt SInt128(llvm::APInt &fail_value) const;
+ llvm::APInt SInt128(const llvm::APInt &fail_value) const;
llvm::APInt UInt128(const llvm::APInt &fail_value) const;
@@ -246,71 +183,37 @@
Status SetValueFromCString(const char *s, lldb::Encoding encoding,
size_t byte_size);
- Status SetValueFromData(DataExtractor &data, lldb::Encoding encoding,
+ Status SetValueFromData(const DataExtractor &data, lldb::Encoding encoding,
size_t byte_size);
- static bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) {
- if (total_byte_size > 8)
- return false;
-
- if (total_byte_size == 8)
- return true;
-
- const uint64_t max = (static_cast<uint64_t>(1)
- << static_cast<uint64_t>(total_byte_size * 8)) -
- 1;
- return uval64 <= max;
- }
-
- static bool SIntValueIsValidForSize(int64_t sval64, size_t total_byte_size) {
- if (total_byte_size > 8)
- return false;
-
- if (total_byte_size == 8)
- return true;
-
- const int64_t max = (static_cast<int64_t>(1)
- << static_cast<uint64_t>(total_byte_size * 8 - 1)) -
- 1;
- const int64_t min = ~(max);
- return min <= sval64 && sval64 <= max;
- }
-
protected:
- typedef char schar_t;
- typedef unsigned char uchar_t;
- typedef short sshort_t;
- typedef unsigned short ushort_t;
- typedef int sint_t;
- typedef unsigned int uint_t;
- typedef long slong_t;
- typedef unsigned long ulong_t;
- typedef long long slonglong_t;
- typedef unsigned long long ulonglong_t;
- typedef float float_t;
- typedef double double_t;
- typedef long double long_double_t;
-
- // Classes that inherit from Scalar can see and modify these
Scalar::Type m_type;
- llvm::APInt m_integer;
+ llvm::APSInt m_integer;
llvm::APFloat m_float;
- bool m_ieee_quad = false;
+
+ template <typename T> T GetAs(T fail_value) const;
+
+ static Type PromoteToMaxType(Scalar &lhs, Scalar &rhs);
+
+ using PromotionKey = std::tuple<Type, unsigned, bool>;
+ PromotionKey GetPromoKey() const;
+
+ static PromotionKey GetFloatPromoKey(const llvm::fltSemantics &semantics);
private:
friend const Scalar operator+(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator-(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator/(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator*(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator&(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator|(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator%(const Scalar &lhs, const Scalar &rhs);
- friend const Scalar operator^(const Scalar &lhs, const Scalar &rhs);
+ friend const Scalar operator-(Scalar lhs, Scalar rhs);
+ friend const Scalar operator/(Scalar lhs, Scalar rhs);
+ friend const Scalar operator*(Scalar lhs, Scalar rhs);
+ friend const Scalar operator&(Scalar lhs, Scalar rhs);
+ friend const Scalar operator|(Scalar lhs, Scalar rhs);
+ friend const Scalar operator%(Scalar lhs, Scalar rhs);
+ friend const Scalar operator^(Scalar lhs, Scalar rhs);
friend const Scalar operator<<(const Scalar &lhs, const Scalar &rhs);
friend const Scalar operator>>(const Scalar &lhs, const Scalar &rhs);
- friend bool operator==(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator==(Scalar lhs, Scalar rhs);
friend bool operator!=(const Scalar &lhs, const Scalar &rhs);
- friend bool operator<(const Scalar &lhs, const Scalar &rhs);
+ friend bool operator<(Scalar lhs, Scalar rhs);
friend bool operator<=(const Scalar &lhs, const Scalar &rhs);
friend bool operator>(const Scalar &lhs, const Scalar &rhs);
friend bool operator>=(const Scalar &lhs, const Scalar &rhs);
@@ -330,18 +233,18 @@
// Differentiate among members functions, non-member functions, and
// friend functions
const Scalar operator+(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator-(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator/(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator*(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator&(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator|(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator%(const Scalar &lhs, const Scalar &rhs);
-const Scalar operator^(const Scalar &lhs, const Scalar &rhs);
+const Scalar operator-(Scalar lhs, Scalar rhs);
+const Scalar operator/(Scalar lhs, Scalar rhs);
+const Scalar operator*(Scalar lhs, Scalar rhs);
+const Scalar operator&(Scalar lhs, Scalar rhs);
+const Scalar operator|(Scalar lhs, Scalar rhs);
+const Scalar operator%(Scalar lhs, Scalar rhs);
+const Scalar operator^(Scalar lhs, Scalar rhs);
const Scalar operator<<(const Scalar &lhs, const Scalar &rhs);
const Scalar operator>>(const Scalar &lhs, const Scalar &rhs);
-bool operator==(const Scalar &lhs, const Scalar &rhs);
+bool operator==(Scalar lhs, Scalar rhs);
bool operator!=(const Scalar &lhs, const Scalar &rhs);
-bool operator<(const Scalar &lhs, const Scalar &rhs);
+bool operator<(Scalar lhs, Scalar rhs);
bool operator<=(const Scalar &lhs, const Scalar &rhs);
bool operator>(const Scalar &lhs, const Scalar &rhs);
bool operator>=(const Scalar &lhs, const Scalar &rhs);
diff --git a/linux-x64/clang/include/lldb/Utility/SelectHelper.h b/linux-x64/clang/include/lldb/Utility/SelectHelper.h
index ec37f19..63f1fe6 100644
--- a/linux-x64/clang/include/lldb/Utility/SelectHelper.h
+++ b/linux-x64/clang/include/lldb/Utility/SelectHelper.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_SelectHelper_h_
-#define liblldb_SelectHelper_h_
+#ifndef LLDB_UTILITY_SELECTHELPER_H
+#define LLDB_UTILITY_SELECTHELPER_H
#include "lldb/Utility/Status.h"
#include "lldb/lldb-types.h"
@@ -68,4 +68,4 @@
llvm::Optional<std::chrono::steady_clock::time_point> m_end_time;
};
-#endif // liblldb_SelectHelper_h_
+#endif // LLDB_UTILITY_SELECTHELPER_H
diff --git a/linux-x64/clang/include/lldb/Utility/SharedCluster.h b/linux-x64/clang/include/lldb/Utility/SharedCluster.h
index 71bbb33..375c1c1 100644
--- a/linux-x64/clang/include/lldb/Utility/SharedCluster.h
+++ b/linux-x64/clang/include/lldb/Utility/SharedCluster.h
@@ -6,90 +6,54 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_SharedCluster_h_
-#define utility_SharedCluster_h_
+#ifndef LLDB_UTILITY_SHAREDCLUSTER_H
+#define LLDB_UTILITY_SHAREDCLUSTER_H
#include "lldb/Utility/LLDBAssert.h"
-#include "lldb/Utility/SharingPtr.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/SmallPtrSet.h"
-
+#include <memory>
#include <mutex>
namespace lldb_private {
-namespace imp {
-template <typename T>
-class shared_ptr_refcount : public lldb_private::imp::shared_count {
+template <class T>
+class ClusterManager : public std::enable_shared_from_this<ClusterManager<T>> {
public:
- template <class Y>
- shared_ptr_refcount(Y *in) : shared_count(0), manager(in) {}
-
- shared_ptr_refcount() : shared_count(0) {}
-
- ~shared_ptr_refcount() override {}
-
- void on_zero_shared() override { manager->DecrementRefCount(); }
-
-private:
- T *manager;
-};
-
-} // namespace imp
-
-template <class T> class ClusterManager {
-public:
- ClusterManager() : m_objects(), m_external_ref(0), m_mutex() {}
+ static std::shared_ptr<ClusterManager> Create() {
+ return std::shared_ptr<ClusterManager>(new ClusterManager());
+ }
~ClusterManager() {
- for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(),
- end = m_objects.end();
- pos != end; ++pos) {
- T *object = *pos;
- delete object;
- }
-
- // Decrement refcount should have been called on this ClusterManager, and
- // it should have locked the mutex, now we will unlock it before we destroy
- // it...
- m_mutex.unlock();
+ for (T *obj : m_objects)
+ delete obj;
}
void ManageObject(T *new_object) {
std::lock_guard<std::mutex> guard(m_mutex);
- m_objects.insert(new_object);
+ assert(!llvm::is_contained(m_objects, new_object) &&
+ "ManageObject called twice for the same object?");
+ m_objects.push_back(new_object);
}
- typename lldb_private::SharingPtr<T> GetSharedPointer(T *desired_object) {
- {
- std::lock_guard<std::mutex> guard(m_mutex);
- m_external_ref++;
- if (0 == m_objects.count(desired_object)) {
- lldbassert(false && "object not found in shared cluster when expected");
- desired_object = nullptr;
- }
+ std::shared_ptr<T> GetSharedPointer(T *desired_object) {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ auto this_sp = this->shared_from_this();
+ if (!llvm::is_contained(m_objects, desired_object)) {
+ lldbassert(false && "object not found in shared cluster when expected");
+ desired_object = nullptr;
}
- return typename lldb_private::SharingPtr<T>(
- desired_object, new imp::shared_ptr_refcount<ClusterManager>(this));
+ return {std::move(this_sp), desired_object};
}
private:
- void DecrementRefCount() {
- m_mutex.lock();
- m_external_ref--;
- if (m_external_ref == 0)
- delete this;
- else
- m_mutex.unlock();
- }
+ ClusterManager() : m_objects(), m_mutex() {}
- friend class imp::shared_ptr_refcount<ClusterManager>;
-
- llvm::SmallPtrSet<T *, 16> m_objects;
- int m_external_ref;
+ llvm::SmallVector<T *, 16> m_objects;
std::mutex m_mutex;
};
} // namespace lldb_private
-#endif // utility_SharedCluster_h_
+#endif // LLDB_UTILITY_SHAREDCLUSTER_H
diff --git a/linux-x64/clang/include/lldb/Utility/SharingPtr.h b/linux-x64/clang/include/lldb/Utility/SharingPtr.h
deleted file mode 100644
index e4ab3d2..0000000
--- a/linux-x64/clang/include/lldb/Utility/SharingPtr.h
+++ /dev/null
@@ -1,609 +0,0 @@
-//===---------------------SharingPtr.h --------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_SharingPtr_h_
-#define utility_SharingPtr_h_
-
-#include <memory>
-
-// Microsoft Visual C++ currently does not enable std::atomic to work in CLR
-// mode - as such we need to "hack around it" for MSVC++ builds only using
-// Windows specific intrinsics instead of the C++11 atomic support
-#ifdef _MSC_VER
-#include <intrin.h>
-#else
-#include <atomic>
-#endif
-
-#include <stddef.h>
-
-
-//#define ENABLE_SP_LOGGING 1 // DON'T CHECK THIS LINE IN UNLESS COMMENTED OUT
-#if defined(ENABLE_SP_LOGGING)
-
-extern "C" void track_sp(void *sp_this, void *ptr, long count);
-
-#endif
-
-namespace lldb_private {
-
-namespace imp {
-
-class shared_count {
- shared_count(const shared_count &) = delete;
- shared_count &operator=(const shared_count &) = delete;
-
-public:
- explicit shared_count(long refs = 0) : shared_owners_(refs) {}
-
- void add_shared();
- void release_shared();
- long use_count() const { return shared_owners_ + 1; }
-
-protected:
-#ifdef _MSC_VER
- long shared_owners_;
-#else
- std::atomic<long> shared_owners_;
-#endif
- virtual ~shared_count();
-
-private:
- virtual void on_zero_shared() = 0;
-};
-
-template <class T> class shared_ptr_pointer : public shared_count {
- T data_;
-
-public:
- shared_ptr_pointer(T p) : data_(p) {}
-
-private:
- void on_zero_shared() override;
-
- shared_ptr_pointer(const shared_ptr_pointer &) = delete;
- shared_ptr_pointer &operator=(const shared_ptr_pointer &) = delete;
-};
-
-template <class T> void shared_ptr_pointer<T>::on_zero_shared() {
- delete data_;
-}
-
-template <class T> class shared_ptr_emplace : public shared_count {
- T data_;
-
-public:
- shared_ptr_emplace() : data_() {}
-
- template <class A0> shared_ptr_emplace(A0 &a0) : data_(a0) {}
-
- template <class A0, class A1>
- shared_ptr_emplace(A0 &a0, A1 &a1) : data_(a0, a1) {}
-
- template <class A0, class A1, class A2>
- shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2) : data_(a0, a1, a2) {}
-
- template <class A0, class A1, class A2, class A3>
- shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2, A3 &a3) : data_(a0, a1, a2, a3) {}
-
- template <class A0, class A1, class A2, class A3, class A4>
- shared_ptr_emplace(A0 &a0, A1 &a1, A2 &a2, A3 &a3, A4 &a4)
- : data_(a0, a1, a2, a3, a4) {}
-
-private:
- void on_zero_shared() override;
-
-public:
- T *get() { return &data_; }
-};
-
-template <class T> void shared_ptr_emplace<T>::on_zero_shared() {}
-
-} // namespace imp
-
-template <class T> class SharingPtr {
-public:
- typedef T element_type;
-
-private:
- element_type *ptr_;
- imp::shared_count *cntrl_;
-
- struct nat {
- int for_bool_;
- };
-
-public:
- SharingPtr();
- SharingPtr(std::nullptr_t);
- template <class Y> explicit SharingPtr(Y *p);
- template <class Y> explicit SharingPtr(Y *p, imp::shared_count *ctrl_block);
- template <class Y> SharingPtr(const SharingPtr<Y> &r, element_type *p);
- SharingPtr(const SharingPtr &r);
- template <class Y> SharingPtr(const SharingPtr<Y> &r);
-
- ~SharingPtr();
-
- SharingPtr &operator=(const SharingPtr &r);
- template <class Y> SharingPtr &operator=(const SharingPtr<Y> &r);
-
- void swap(SharingPtr &r);
- void reset();
- template <class Y> void reset(Y *p);
- void reset(std::nullptr_t);
-
- element_type *get() const { return ptr_; }
- element_type &operator*() const { return *ptr_; }
- element_type *operator->() const { return ptr_; }
- long use_count() const { return cntrl_ ? cntrl_->use_count() : 0; }
- bool unique() const { return use_count() == 1; }
- bool empty() const { return cntrl_ == nullptr; }
- operator nat *() const { return (nat *)get(); }
-
- static SharingPtr<T> make_shared();
-
- template <class A0> static SharingPtr<T> make_shared(A0 &);
-
- template <class A0, class A1> static SharingPtr<T> make_shared(A0 &, A1 &);
-
- template <class A0, class A1, class A2>
- static SharingPtr<T> make_shared(A0 &, A1 &, A2 &);
-
- template <class A0, class A1, class A2, class A3>
- static SharingPtr<T> make_shared(A0 &, A1 &, A2 &, A3 &);
-
- template <class A0, class A1, class A2, class A3, class A4>
- static SharingPtr<T> make_shared(A0 &, A1 &, A2 &, A3 &, A4 &);
-
-private:
- template <class U> friend class SharingPtr;
-};
-
-template <class T>
-inline SharingPtr<T>::SharingPtr() : ptr_(nullptr), cntrl_(nullptr) {}
-
-template <class T>
-inline SharingPtr<T>::SharingPtr(std::nullptr_t)
- : ptr_(nullptr), cntrl_(nullptr) {}
-
-template <class T>
-template <class Y>
-SharingPtr<T>::SharingPtr(Y *p) : ptr_(p), cntrl_(nullptr) {
- std::unique_ptr<Y> hold(p);
- typedef imp::shared_ptr_pointer<Y *> _CntrlBlk;
- cntrl_ = new _CntrlBlk(p);
- hold.release();
-}
-
-template <class T>
-template <class Y>
-SharingPtr<T>::SharingPtr(Y *p, imp::shared_count *cntrl_block)
- : ptr_(p), cntrl_(cntrl_block) {}
-
-template <class T>
-template <class Y>
-inline SharingPtr<T>::SharingPtr(const SharingPtr<Y> &r, element_type *p)
- : ptr_(p), cntrl_(r.cntrl_) {
- if (cntrl_)
- cntrl_->add_shared();
-}
-
-template <class T>
-inline SharingPtr<T>::SharingPtr(const SharingPtr &r)
- : ptr_(r.ptr_), cntrl_(r.cntrl_) {
- if (cntrl_)
- cntrl_->add_shared();
-}
-
-template <class T>
-template <class Y>
-inline SharingPtr<T>::SharingPtr(const SharingPtr<Y> &r)
- : ptr_(r.ptr_), cntrl_(r.cntrl_) {
- if (cntrl_)
- cntrl_->add_shared();
-}
-
-template <class T> SharingPtr<T>::~SharingPtr() {
- if (cntrl_)
- cntrl_->release_shared();
-}
-
-template <class T>
-inline SharingPtr<T> &SharingPtr<T>::operator=(const SharingPtr &r) {
- SharingPtr(r).swap(*this);
- return *this;
-}
-
-template <class T>
-template <class Y>
-inline SharingPtr<T> &SharingPtr<T>::operator=(const SharingPtr<Y> &r) {
- SharingPtr(r).swap(*this);
- return *this;
-}
-
-template <class T> inline void SharingPtr<T>::swap(SharingPtr &r) {
- std::swap(ptr_, r.ptr_);
- std::swap(cntrl_, r.cntrl_);
-}
-
-template <class T> inline void SharingPtr<T>::reset() {
- SharingPtr().swap(*this);
-}
-
-template <class T> inline void SharingPtr<T>::reset(std::nullptr_t p) {
- reset();
-}
-
-template <class T> template <class Y> inline void SharingPtr<T>::reset(Y *p) {
- SharingPtr(p).swap(*this);
-}
-
-template <class T> SharingPtr<T> SharingPtr<T>::make_shared() {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk();
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T>
-template <class A0>
-SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0) {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk(a0);
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T>
-template <class A0, class A1>
-SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1) {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk(a0, a1);
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T>
-template <class A0, class A1, class A2>
-SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2) {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk(a0, a1, a2);
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T>
-template <class A0, class A1, class A2, class A3>
-SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3) {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk(a0, a1, a2, a3);
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T>
-template <class A0, class A1, class A2, class A3, class A4>
-SharingPtr<T> SharingPtr<T>::make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3,
- A4 &a4) {
- typedef imp::shared_ptr_emplace<T> CntrlBlk;
- SharingPtr<T> r;
- r.cntrl_ = new CntrlBlk(a0, a1, a2, a3, a4);
- r.ptr_ = static_cast<CntrlBlk *>(r.cntrl_)->get();
- return r;
-}
-
-template <class T> inline SharingPtr<T> make_shared() {
- return SharingPtr<T>::make_shared();
-}
-
-template <class T, class A0> inline SharingPtr<T> make_shared(A0 &a0) {
- return SharingPtr<T>::make_shared(a0);
-}
-
-template <class T, class A0, class A1>
-inline SharingPtr<T> make_shared(A0 &a0, A1 &a1) {
- return SharingPtr<T>::make_shared(a0, a1);
-}
-
-template <class T, class A0, class A1, class A2>
-inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2) {
- return SharingPtr<T>::make_shared(a0, a1, a2);
-}
-
-template <class T, class A0, class A1, class A2, class A3>
-inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3) {
- return SharingPtr<T>::make_shared(a0, a1, a2, a3);
-}
-
-template <class T, class A0, class A1, class A2, class A3, class A4>
-inline SharingPtr<T> make_shared(A0 &a0, A1 &a1, A2 &a2, A3 &a3, A4 &a4) {
- return SharingPtr<T>::make_shared(a0, a1, a2, a3, a4);
-}
-
-template <class T, class U>
-inline bool operator==(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
- return __x.get() == __y.get();
-}
-
-template <class T, class U>
-inline bool operator!=(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
- return !(__x == __y);
-}
-
-template <class T, class U>
-inline bool operator<(const SharingPtr<T> &__x, const SharingPtr<U> &__y) {
- return __x.get() < __y.get();
-}
-
-template <class T> inline void swap(SharingPtr<T> &__x, SharingPtr<T> &__y) {
- __x.swap(__y);
-}
-
-template <class T, class U>
-inline SharingPtr<T> static_pointer_cast(const SharingPtr<U> &r) {
- return SharingPtr<T>(r, static_cast<T *>(r.get()));
-}
-
-template <class T, class U>
-SharingPtr<T> const_pointer_cast(const SharingPtr<U> &r) {
- return SharingPtr<T>(r, const_cast<T *>(r.get()));
-}
-
-template <class T> class LoggingSharingPtr : public SharingPtr<T> {
- typedef SharingPtr<T> base;
-
-public:
- typedef void (*Callback)(void *, const LoggingSharingPtr &, bool action);
- // action: false means increment just happened
- // true means decrement is about to happen
-
- LoggingSharingPtr() : cb_(0), baton_(nullptr) {}
-
- LoggingSharingPtr(Callback cb, void *baton) : cb_(cb), baton_(baton) {
- if (cb_)
- cb_(baton_, *this, false);
- }
-
- template <class Y>
- LoggingSharingPtr(Y *p) : base(p), cb_(0), baton_(nullptr) {}
-
- template <class Y>
- LoggingSharingPtr(Y *p, Callback cb, void *baton)
- : base(p), cb_(cb), baton_(baton) {
- if (cb_)
- cb_(baton_, *this, false);
- }
-
- ~LoggingSharingPtr() {
- if (cb_)
- cb_(baton_, *this, true);
- }
-
- LoggingSharingPtr(const LoggingSharingPtr &p)
- : base(p), cb_(p.cb_), baton_(p.baton_) {
- if (cb_)
- cb_(baton_, *this, false);
- }
-
- LoggingSharingPtr &operator=(const LoggingSharingPtr &p) {
- if (cb_)
- cb_(baton_, *this, true);
- base::operator=(p);
- cb_ = p.cb_;
- baton_ = p.baton_;
- if (cb_)
- cb_(baton_, *this, false);
- return *this;
- }
-
- void reset() {
- if (cb_)
- cb_(baton_, *this, true);
- base::reset();
- }
-
- template <class Y> void reset(Y *p) {
- if (cb_)
- cb_(baton_, *this, true);
- base::reset(p);
- if (cb_)
- cb_(baton_, *this, false);
- }
-
- void SetCallback(Callback cb, void *baton) {
- cb_ = cb;
- baton_ = baton;
- }
-
- void ClearCallback() {
- cb_ = 0;
- baton_ = 0;
- }
-
-private:
- Callback cb_;
- void *baton_;
-};
-
-template <class T> class IntrusiveSharingPtr;
-
-template <class T> class ReferenceCountedBase {
-public:
- explicit ReferenceCountedBase() : shared_owners_(-1) {}
-
- void add_shared();
-
- void release_shared();
-
- long use_count() const { return shared_owners_ + 1; }
-
-protected:
- long shared_owners_;
-
- friend class IntrusiveSharingPtr<T>;
-
-private:
- ReferenceCountedBase(const ReferenceCountedBase &) = delete;
- ReferenceCountedBase &operator=(const ReferenceCountedBase &) = delete;
-};
-
-template <class T> void lldb_private::ReferenceCountedBase<T>::add_shared() {
-#ifdef _MSC_VER
- _InterlockedIncrement(&shared_owners_);
-#else
- ++shared_owners_;
-#endif
-}
-
-template <class T>
-void lldb_private::ReferenceCountedBase<T>::release_shared() {
-#ifdef _MSC_VER
- if (_InterlockedDecrement(&shared_owners_) == -1)
-#else
- if (--shared_owners_ == -1)
-#endif
- delete static_cast<T *>(this);
-}
-
-template <class T>
-class ReferenceCountedBaseVirtual : public imp::shared_count {
-public:
- explicit ReferenceCountedBaseVirtual() : imp::shared_count(-1) {}
-
- ~ReferenceCountedBaseVirtual() override = default;
-
- void on_zero_shared() override;
-};
-
-template <class T> void ReferenceCountedBaseVirtual<T>::on_zero_shared() {}
-
-template <typename T> class IntrusiveSharingPtr {
-public:
- typedef T element_type;
-
- explicit IntrusiveSharingPtr() : ptr_(0) {}
-
- explicit IntrusiveSharingPtr(T *ptr) : ptr_(ptr) { add_shared(); }
-
- IntrusiveSharingPtr(const IntrusiveSharingPtr &rhs) : ptr_(rhs.ptr_) {
- add_shared();
- }
-
- template <class X>
- IntrusiveSharingPtr(const IntrusiveSharingPtr<X> &rhs) : ptr_(rhs.get()) {
- add_shared();
- }
-
- IntrusiveSharingPtr &operator=(const IntrusiveSharingPtr &rhs) {
- reset(rhs.get());
- return *this;
- }
-
- template <class X>
- IntrusiveSharingPtr &operator=(const IntrusiveSharingPtr<X> &rhs) {
- reset(rhs.get());
- return *this;
- }
-
- IntrusiveSharingPtr &operator=(T *ptr) {
- reset(ptr);
- return *this;
- }
-
- ~IntrusiveSharingPtr() {
- release_shared();
- ptr_ = nullptr;
- }
-
- T &operator*() const { return *ptr_; }
-
- T *operator->() const { return ptr_; }
-
- T *get() const { return ptr_; }
-
- explicit operator bool() const { return ptr_ != 0; }
-
- void swap(IntrusiveSharingPtr &rhs) {
- std::swap(ptr_, rhs.ptr_);
-#if defined(ENABLE_SP_LOGGING)
- track_sp(this, ptr_, use_count());
- track_sp(&rhs, rhs.ptr_, rhs.use_count());
-#endif
- }
-
- void reset(T *ptr = nullptr) { IntrusiveSharingPtr(ptr).swap(*this); }
-
- long use_count() const {
- if (ptr_)
- return ptr_->use_count();
- return 0;
- }
-
- bool unique() const { return use_count() == 1; }
-
-private:
- element_type *ptr_;
-
- void add_shared() {
- if (ptr_) {
- ptr_->add_shared();
-#if defined(ENABLE_SP_LOGGING)
- track_sp(this, ptr_, ptr_->use_count());
-#endif
- }
- }
- void release_shared() {
- if (ptr_) {
-#if defined(ENABLE_SP_LOGGING)
- track_sp(this, nullptr, ptr_->use_count() - 1);
-#endif
- ptr_->release_shared();
- }
- }
-};
-
-template <class T, class U>
-inline bool operator==(const IntrusiveSharingPtr<T> &lhs,
- const IntrusiveSharingPtr<U> &rhs) {
- return lhs.get() == rhs.get();
-}
-
-template <class T, class U>
-inline bool operator!=(const IntrusiveSharingPtr<T> &lhs,
- const IntrusiveSharingPtr<U> &rhs) {
- return lhs.get() != rhs.get();
-}
-
-template <class T, class U>
-inline bool operator==(const IntrusiveSharingPtr<T> &lhs, U *rhs) {
- return lhs.get() == rhs;
-}
-
-template <class T, class U>
-inline bool operator!=(const IntrusiveSharingPtr<T> &lhs, U *rhs) {
- return lhs.get() != rhs;
-}
-
-template <class T, class U>
-inline bool operator==(T *lhs, const IntrusiveSharingPtr<U> &rhs) {
- return lhs == rhs.get();
-}
-
-template <class T, class U>
-inline bool operator!=(T *lhs, const IntrusiveSharingPtr<U> &rhs) {
- return lhs != rhs.get();
-}
-
-} // namespace lldb_private
-
-#endif // utility_SharingPtr_h_
diff --git a/linux-x64/clang/include/lldb/Utility/Status.h b/linux-x64/clang/include/lldb/Utility/Status.h
index ae730b9..9babad1 100644
--- a/linux-x64/clang/include/lldb/Utility/Status.h
+++ b/linux-x64/clang/include/lldb/Utility/Status.h
@@ -47,8 +47,8 @@
/// into ValueType.
typedef uint32_t ValueType;
- /// Default constructor.
- ///
+ Status();
+
/// Initialize the error object with a generic success value.
///
/// \param[in] err
@@ -56,25 +56,14 @@
///
/// \param[in] type
/// The type for \a err.
- Status();
-
explicit Status(ValueType err,
lldb::ErrorType type = lldb::eErrorTypeGeneric);
- /* implicit */ Status(std::error_code EC);
+ Status(std::error_code EC);
explicit Status(const char *format, ...)
__attribute__((format(printf, 2, 3)));
- /// Assignment operator.
- ///
- /// \param[in] err
- /// An error code.
- ///
- /// \return
- /// A const reference to this object.
- const Status &operator=(const Status &rhs);
-
~Status();
// llvm::Error support
@@ -122,7 +111,7 @@
/// Set accessor from a kern_return_t.
///
- /// Set accesssor for the error value to \a err and the error type to \c
+ /// Set accessor for the error value to \a err and the error type to \c
/// MachKernel.
///
/// \param[in] err
@@ -134,9 +123,9 @@
int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,
...) __attribute__((format(printf, 3, 4)));
- /// Set accesssor with an error value and type.
+ /// Set accessor with an error value and type.
///
- /// Set accesssor for the error value to \a err and the error type to \a
+ /// Set accessor for the error value to \a err and the error type to \a
/// type.
///
/// \param[in] err
@@ -221,4 +210,11 @@
};
}
-#endif // #ifndef LLDB_UTILITY_STATUS_H
+#define LLDB_ERRORF(status, fmt, ...) \
+ do { \
+ if (status) { \
+ (status)->SetErrorStringWithFormat((fmt), __VA_ARGS__); \
+ } \
+ } while (0);
+
+#endif // LLDB_UTILITY_STATUS_H
diff --git a/linux-x64/clang/include/lldb/Utility/Stream.h b/linux-x64/clang/include/lldb/Utility/Stream.h
index b24d4e4..e7f065a 100644
--- a/linux-x64/clang/include/lldb/Utility/Stream.h
+++ b/linux-x64/clang/include/lldb/Utility/Stream.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Stream_h_
-#define liblldb_Stream_h_
+#ifndef LLDB_UTILITY_STREAM_H
+#define LLDB_UTILITY_STREAM_H
#include "lldb/Utility/Flags.h"
#include "lldb/lldb-defines.h"
@@ -35,11 +35,11 @@
/// Utility class for counting the bytes that were written to a stream in a
/// certain time span.
+ ///
/// \example
/// ByteDelta delta(*this);
/// WriteDataToStream("foo");
/// return *delta;
- /// \endcode
class ByteDelta {
Stream *m_stream;
/// Bytes we have written so far when ByteDelta was created.
@@ -56,12 +56,13 @@
///
/// Construct with dump flags \a flags and the default address size. \a
/// flags can be any of the above enumeration logical OR'ed together.
- Stream(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
+ Stream(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order,
+ bool colors = false);
/// Construct a default Stream, not binary, host byte order and host addr
/// size.
///
- Stream();
+ Stream(bool colors = false);
// FIXME: Streams should not be copyable.
Stream(const Stream &other) : m_forwarder(*this) { (*this) = other; }
@@ -213,126 +214,14 @@
/// in one statement.
Stream &operator<<(char ch);
- /// Output a uint8_t \a uval to the stream \a s.
- ///
- /// \param[in] uval
- /// A uint8_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(uint8_t uval);
-
- /// Output a uint16_t \a uval to the stream \a s.
- ///
- /// \param[in] uval
- /// A uint16_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(uint16_t uval);
-
- /// Output a uint32_t \a uval to the stream \a s.
- ///
- /// \param[in] uval
- /// A uint32_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(uint32_t uval);
-
- /// Output a uint64_t \a uval to the stream \a s.
- ///
- /// \param[in] uval
- /// A uint64_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(uint64_t uval);
-
- /// Output a int8_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int8_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int8_t sval);
-
- /// Output a int16_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int16_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int16_t sval);
-
- /// Output a int32_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int32_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int32_t sval);
-
- /// Output a int64_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int64_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int64_t sval);
-
- /// Output an address value to this stream.
- ///
- /// Put an address \a addr out to the stream with optional \a prefix and \a
- /// suffix strings.
- ///
- /// \param[in] addr
- /// An address value.
- ///
- /// \param[in] addr_size
- /// Size in bytes of the address, used for formatting.
- ///
- /// \param[in] prefix
- /// A prefix C string. If nullptr, no prefix will be output.
- ///
- /// \param[in] suffix
- /// A suffix C string. If nullptr, no suffix will be output.
- void Address(uint64_t addr, uint32_t addr_size, const char *prefix = nullptr,
- const char *suffix = nullptr);
-
- /// Output an address range to this stream.
- ///
- /// Put an address range \a lo_addr - \a hi_addr out to the stream with
- /// optional \a prefix and \a suffix strings.
- ///
- /// \param[in] lo_addr
- /// The start address of the address range.
- ///
- /// \param[in] hi_addr
- /// The end address of the address range.
- ///
- /// \param[in] addr_size
- /// Size in bytes of the address, used for formatting.
- ///
- /// \param[in] prefix
- /// A prefix C string. If nullptr, no prefix will be output.
- ///
- /// \param[in] suffix
- /// A suffix C string. If nullptr, no suffix will be output.
- void AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size,
- const char *prefix = nullptr, const char *suffix = nullptr);
+ Stream &operator<<(uint8_t uval) = delete;
+ Stream &operator<<(uint16_t uval) = delete;
+ Stream &operator<<(uint32_t uval) = delete;
+ Stream &operator<<(uint64_t uval) = delete;
+ Stream &operator<<(int8_t sval) = delete;
+ Stream &operator<<(int16_t sval) = delete;
+ Stream &operator<<(int32_t sval) = delete;
+ Stream &operator<<(int64_t sval) = delete;
/// Output a C string to the stream.
///
@@ -373,8 +262,8 @@
/// Get the current indentation level.
///
/// \return
- /// The current indentation level as an integer.
- int GetIndentLevel() const;
+ /// The current indentation level.
+ unsigned GetIndentLevel() const;
/// Indent the current line in the stream.
///
@@ -382,16 +271,14 @@
/// optional string following the indentation spaces.
///
/// \param[in] s
- /// A C string to print following the indentation. If nullptr, just
- /// output the indentation characters.
- size_t Indent(const char *s = nullptr);
- size_t Indent(llvm::StringRef s);
+ /// A string to print following the indentation.
+ size_t Indent(llvm::StringRef s = "");
/// Decrement the current indentation level.
- void IndentLess(int amount = 2);
+ void IndentLess(unsigned amount = 2);
/// Increment the current indentation level.
- void IndentMore(int amount = 2);
+ void IndentMore(unsigned amount = 2);
/// Output an offset value.
///
@@ -446,7 +333,7 @@
///
/// \param[in] level
/// The new indentation level.
- void SetIndentLevel(int level);
+ void SetIndentLevel(unsigned level);
/// Output a SLEB128 number to the stream.
///
@@ -477,7 +364,7 @@
uint32_t m_addr_size; ///< Size of an address in bytes.
lldb::ByteOrder
m_byte_order; ///< Byte order to use when encoding scalar types.
- int m_indent_level; ///< Indention level.
+ unsigned m_indent_level; ///< Indention level.
std::size_t m_bytes_written = 0; ///< Number of bytes written so far.
void _PutHex8(uint8_t uvalue, bool add_prefix);
@@ -517,12 +404,62 @@
}
public:
- RawOstreamForward(Stream &target)
- : llvm::raw_ostream(/*unbuffered*/ true), m_target(target) {}
+ RawOstreamForward(Stream &target, bool colors = false)
+ : llvm::raw_ostream(/*unbuffered*/ true), m_target(target) {
+ enable_colors(colors);
+ }
};
RawOstreamForward m_forwarder;
};
+/// Output an address value to this stream.
+///
+/// Put an address \a addr out to the stream with optional \a prefix and \a
+/// suffix strings.
+///
+/// \param[in] s
+/// The output stream.
+///
+/// \param[in] addr
+/// An address value.
+///
+/// \param[in] addr_size
+/// Size in bytes of the address, used for formatting.
+///
+/// \param[in] prefix
+/// A prefix C string. If nullptr, no prefix will be output.
+///
+/// \param[in] suffix
+/// A suffix C string. If nullptr, no suffix will be output.
+void DumpAddress(llvm::raw_ostream &s, uint64_t addr, uint32_t addr_size,
+ const char *prefix = nullptr, const char *suffix = nullptr);
+
+/// Output an address range to this stream.
+///
+/// Put an address range \a lo_addr - \a hi_addr out to the stream with
+/// optional \a prefix and \a suffix strings.
+///
+/// \param[in] s
+/// The output stream.
+///
+/// \param[in] lo_addr
+/// The start address of the address range.
+///
+/// \param[in] hi_addr
+/// The end address of the address range.
+///
+/// \param[in] addr_size
+/// Size in bytes of the address, used for formatting.
+///
+/// \param[in] prefix
+/// A prefix C string. If nullptr, no prefix will be output.
+///
+/// \param[in] suffix
+/// A suffix C string. If nullptr, no suffix will be output.
+void DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, uint64_t hi_addr,
+ uint32_t addr_size, const char *prefix = nullptr,
+ const char *suffix = nullptr);
+
} // namespace lldb_private
-#endif // liblldb_Stream_h_
+#endif // LLDB_UTILITY_STREAM_H
diff --git a/linux-x64/clang/include/lldb/Utility/StreamCallback.h b/linux-x64/clang/include/lldb/Utility/StreamCallback.h
index 6dbee67..d6d74fb 100644
--- a/linux-x64/clang/include/lldb/Utility/StreamCallback.h
+++ b/linux-x64/clang/include/lldb/Utility/StreamCallback.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamCallback_h_
-#define liblldb_StreamCallback_h_
+#ifndef LLDB_UTILITY_STREAMCALLBACK_H
+#define LLDB_UTILITY_STREAMCALLBACK_H
#include "lldb/lldb-types.h"
#include "llvm/Support/raw_ostream.h"
@@ -32,4 +32,4 @@
} // namespace lldb_private
-#endif // liblldb_StreamCallback_h
+#endif // LLDB_UTILITY_STREAMCALLBACK_H
diff --git a/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h b/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h
deleted file mode 100644
index dd0ea31..0000000
--- a/linux-x64/clang/include/lldb/Utility/StreamGDBRemote.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//===-- StreamGDBRemote.h ----------------------------------------*- C++-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_StreamGDBRemote_h_
-#define liblldb_StreamGDBRemote_h_
-
-#include "lldb/Utility/StreamString.h"
-#include "lldb/lldb-enumerations.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace lldb_private {
-
-class StreamGDBRemote : public StreamString {
-public:
- StreamGDBRemote();
-
- StreamGDBRemote(uint32_t flags, uint32_t addr_size,
- lldb::ByteOrder byte_order);
-
- ~StreamGDBRemote() override;
-
- /// Output a block of data to the stream performing GDB-remote escaping.
- ///
- /// \param[in] s
- /// A block of data.
- ///
- /// \param[in] src_len
- /// The amount of data to write.
- ///
- /// \return
- /// Number of bytes written.
- // TODO: Convert this function to take ArrayRef<uint8_t>
- int PutEscapedBytes(const void *s, size_t src_len);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_StreamGDBRemote_h_
diff --git a/linux-x64/clang/include/lldb/Utility/StreamString.h b/linux-x64/clang/include/lldb/Utility/StreamString.h
index 581e102..b0be0f7 100644
--- a/linux-x64/clang/include/lldb/Utility/StreamString.h
+++ b/linux-x64/clang/include/lldb/Utility/StreamString.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamString_h_
-#define liblldb_StreamString_h_
+#ifndef LLDB_UTILITY_STREAMSTRING_H
+#define LLDB_UTILITY_STREAMSTRING_H
#include "lldb/Utility/Stream.h"
#include "lldb/lldb-enumerations.h"
@@ -51,4 +51,4 @@
} // namespace lldb_private
-#endif // liblldb_StreamString_h_
+#endif // LLDB_UTILITY_STREAMSTRING_H
diff --git a/linux-x64/clang/include/lldb/Utility/StreamTee.h b/linux-x64/clang/include/lldb/Utility/StreamTee.h
index 92e94d4..2995bc0 100644
--- a/linux-x64/clang/include/lldb/Utility/StreamTee.h
+++ b/linux-x64/clang/include/lldb/Utility/StreamTee.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StreamTee_h_
-#define liblldb_StreamTee_h_
+#ifndef LLDB_UTILITY_STREAMTEE_H
+#define LLDB_UTILITY_STREAMTEE_H
#include <limits.h>
@@ -19,7 +19,8 @@
class StreamTee : public Stream {
public:
- StreamTee() : Stream(), m_streams_mutex(), m_streams() {}
+ StreamTee(bool colors = false)
+ : Stream(colors), m_streams_mutex(), m_streams() {}
StreamTee(lldb::StreamSP &stream_sp)
: Stream(), m_streams_mutex(), m_streams() {
@@ -137,4 +138,4 @@
} // namespace lldb_private
-#endif // liblldb_StreamTee_h_
+#endif // LLDB_UTILITY_STREAMTEE_H
diff --git a/linux-x64/clang/include/lldb/Utility/StringExtractor.h b/linux-x64/clang/include/lldb/Utility/StringExtractor.h
index f20ec92..6a5bb24 100644
--- a/linux-x64/clang/include/lldb/Utility/StringExtractor.h
+++ b/linux-x64/clang/include/lldb/Utility/StringExtractor.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_StringExtractor_h_
-#define utility_StringExtractor_h_
+#ifndef LLDB_UTILITY_STRINGEXTRACTOR_H
+#define LLDB_UTILITY_STRINGEXTRACTOR_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
@@ -26,7 +26,7 @@
virtual ~StringExtractor();
void Reset(llvm::StringRef str) {
- m_packet = str;
+ m_packet = std::string(str);
m_index = 0;
}
@@ -45,9 +45,7 @@
void SkipSpaces();
- std::string &GetStringRef() { return m_packet; }
-
- const std::string &GetStringRef() const { return m_packet; }
+ llvm::StringRef GetStringRef() const { return m_packet; }
bool Empty() { return m_packet.empty(); }
@@ -91,9 +89,6 @@
size_t GetHexBytesAvail(llvm::MutableArrayRef<uint8_t> dest);
- uint64_t GetHexWithFixedSize(uint32_t byte_size, bool little_endian,
- uint64_t fail_value);
-
size_t GetHexByteString(std::string &str);
size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length);
@@ -113,12 +108,14 @@
m_index = UINT64_MAX;
return false;
}
- // For StringExtractor only
- std::string m_packet; // The string in which to extract data.
- uint64_t m_index; // When extracting data from a packet, this index
- // will march along as things get extracted. If set to
- // UINT64_MAX the end of the packet data was reached
- // when decoding information
+
+ /// The string in which to extract data.
+ std::string m_packet;
+
+ /// When extracting data from a packet, this index will march along as things
+ /// get extracted. If set to UINT64_MAX the end of the packet data was
+ /// reached when decoding information.
+ uint64_t m_index;
};
-#endif // utility_StringExtractor_h_
+#endif // LLDB_UTILITY_STRINGEXTRACTOR_H
diff --git a/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h b/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h
index cbf6e0c..3b6ed80 100644
--- a/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h
+++ b/linux-x64/clang/include/lldb/Utility/StringExtractorGDBRemote.h
@@ -31,11 +31,6 @@
StringExtractorGDBRemote(const char *cstr)
: StringExtractor(cstr), m_validator(nullptr) {}
- StringExtractorGDBRemote(const StringExtractorGDBRemote &rhs)
- : StringExtractor(rhs), m_validator(rhs.m_validator) {}
-
- ~StringExtractorGDBRemote() override {}
-
bool ValidateResponse() const;
void CopyResponseValidator(const StringExtractorGDBRemote &rhs);
@@ -81,6 +76,7 @@
eServerPacketType_QSetSTDERR,
eServerPacketType_QSetWorkingDir,
eServerPacketType_QStartNoAckMode,
+ eServerPacketType_qPathComplete,
eServerPacketType_qPlatform_shell,
eServerPacketType_qPlatform_mkdir,
eServerPacketType_qPlatform_chmod,
@@ -166,11 +162,13 @@
eServerPacketType__m,
eServerPacketType_notify, // '%' notification
- eServerPacketType_jTraceStart,
- eServerPacketType_jTraceBufferRead,
- eServerPacketType_jTraceMetaRead,
- eServerPacketType_jTraceStop,
- eServerPacketType_jTraceConfigRead,
+ eServerPacketType_jTraceStart, // deprecated
+ eServerPacketType_jTraceBufferRead, // deprecated
+ eServerPacketType_jTraceMetaRead, // deprecated
+ eServerPacketType_jTraceStop, // deprecated
+ eServerPacketType_jTraceConfigRead, // deprecated
+
+ eServerPacketType_jLLDBTraceSupportedType,
};
ServerPacketType GetServerPacketType() const;
diff --git a/linux-x64/clang/include/lldb/Utility/StringLexer.h b/linux-x64/clang/include/lldb/Utility/StringLexer.h
index d9806c1..52f98e8 100644
--- a/linux-x64/clang/include/lldb/Utility/StringLexer.h
+++ b/linux-x64/clang/include/lldb/Utility/StringLexer.h
@@ -1,4 +1,4 @@
-//===--------------------- StringLexer.h ------------------------*- C++ -*-===//
+//===-- StringLexer.h -------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,14 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_StringLexer_h_
-#define utility_StringLexer_h_
+#ifndef LLDB_UTILITY_STRINGLEXER_H
+#define LLDB_UTILITY_STRINGLEXER_H
#include <initializer_list>
#include <string>
#include <utility>
-namespace lldb_utility {
+namespace lldb_private {
class StringLexer {
public:
@@ -53,4 +53,4 @@
} // namespace lldb_private
-#endif // #ifndef utility_StringLexer_h_
+#endif // LLDB_UTILITY_STRINGLEXER_H
diff --git a/linux-x64/clang/include/lldb/Utility/StringList.h b/linux-x64/clang/include/lldb/Utility/StringList.h
index 68c1f87..34930ab 100644
--- a/linux-x64/clang/include/lldb/Utility/StringList.h
+++ b/linux-x64/clang/include/lldb/Utility/StringList.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StringList_h_
-#define liblldb_StringList_h_
+#ifndef LLDB_UTILITY_STRINGLIST_H
+#define LLDB_UTILITY_STRINGLIST_H
#include "llvm/ADT/StringRef.h"
@@ -23,6 +23,8 @@
namespace lldb_private {
class StringList {
+ typedef std::vector<std::string> collection;
+
public:
StringList();
@@ -52,6 +54,14 @@
size_t GetMaxStringLength() const;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+
+ iterator begin() { return m_strings.begin(); }
+ iterator end() { return m_strings.end(); }
+ const_iterator begin() const { return m_strings.begin(); }
+ const_iterator end() const { return m_strings.end(); }
+
std::string &operator[](size_t idx) {
// No bounds checking, verify "idx" is good prior to calling this function
return m_strings[idx];
@@ -69,7 +79,7 @@
void Clear();
- void LongestCommonPrefix(std::string &common_prefix);
+ std::string LongestCommonPrefix();
void InsertStringAtIndex(size_t idx, const std::string &str);
@@ -92,19 +102,11 @@
StringList &operator<<(const std::string &s);
- StringList &operator<<(StringList strings);
+ StringList &operator<<(const StringList &strings);
// Copy assignment for a vector of strings
StringList &operator=(const std::vector<std::string> &rhs);
- // This string list contains a list of valid auto completion strings, and the
- // "s" is passed in. "matches" is filled in with zero or more string values
- // that start with "s", and the first string to exactly match one of the
- // string values in this collection, will have "exact_matches_idx" filled in
- // to match the index, or "exact_matches_idx" will have SIZE_MAX
- size_t AutoComplete(llvm::StringRef s, StringList &matches,
- size_t &exact_matches_idx) const;
-
// Dump the StringList to the given lldb_private::Log, `log`, one item per
// line. If given, `name` will be used to identify the start and end of the
// list in the output.
@@ -125,9 +127,9 @@
}
private:
- std::vector<std::string> m_strings;
+ collection m_strings;
};
} // namespace lldb_private
-#endif // liblldb_StringList_h_
+#endif // LLDB_UTILITY_STRINGLIST_H
diff --git a/linux-x64/clang/include/lldb/Utility/StructuredData.h b/linux-x64/clang/include/lldb/Utility/StructuredData.h
index 75eb2f7..4d03af1 100644
--- a/linux-x64/clang/include/lldb/Utility/StructuredData.h
+++ b/linux-x64/clang/include/lldb/Utility/StructuredData.h
@@ -6,13 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StructuredData_h_
-#define liblldb_StructuredData_h_
+#ifndef LLDB_UTILITY_STRUCTUREDDATA_H
+#define LLDB_UTILITY_STRUCTUREDDATA_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/lldb-enumerations.h"
#include <cassert>
@@ -28,7 +30,6 @@
namespace lldb_private {
class Status;
-class Stream;
}
namespace lldb_private {
@@ -150,7 +151,12 @@
void DumpToStdout(bool pretty_print = true) const;
- virtual void Dump(Stream &s, bool pretty_print = true) const = 0;
+ virtual void Serialize(llvm::json::OStream &s) const = 0;
+
+ void Dump(lldb_private::Stream &s, bool pretty_print = true) const {
+ llvm::json::OStream jso(s.AsRawOstream(), pretty_print ? 2 : 0);
+ Serialize(jso);
+ }
private:
lldb::StructuredDataType m_type;
@@ -265,11 +271,11 @@
return false;
}
- void Push(ObjectSP item) { m_items.push_back(item); }
+ void Push(const ObjectSP &item) { m_items.push_back(item); }
- void AddItem(ObjectSP item) { m_items.push_back(item); }
+ void AddItem(const ObjectSP &item) { m_items.push_back(item); }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
typedef std::vector<ObjectSP> collection;
@@ -287,7 +293,7 @@
uint64_t GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
uint64_t m_value;
@@ -304,7 +310,7 @@
double GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
double m_value;
@@ -321,7 +327,7 @@
bool GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
bool m_value;
@@ -333,11 +339,11 @@
explicit String(llvm::StringRef S)
: Object(lldb::eStructuredDataTypeString), m_value(S) {}
- void SetValue(llvm::StringRef S) { m_value = S; }
+ void SetValue(llvm::StringRef S) { m_value = std::string(S); }
llvm::StringRef GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
std::string m_value;
@@ -487,7 +493,7 @@
void AddItem(llvm::StringRef key, ObjectSP value_sp) {
ConstString key_cs(key);
- m_dict[key_cs] = value_sp;
+ m_dict[key_cs] = std::move(value_sp);
}
void AddIntegerItem(llvm::StringRef key, uint64_t value) {
@@ -506,7 +512,7 @@
AddItem(key, std::make_shared<Boolean>(value));
}
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
typedef std::map<ConstString, ObjectSP> collection;
@@ -521,7 +527,7 @@
bool IsValid() const override { return false; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
};
class Generic : public Object {
@@ -535,17 +541,16 @@
bool IsValid() const override { return m_object != nullptr; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
private:
void *m_object;
};
- static ObjectSP ParseJSON(std::string json_text);
-
+ static ObjectSP ParseJSON(const std::string &json_text);
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error);
};
} // namespace lldb_private
-#endif // liblldb_StructuredData_h_
+#endif // LLDB_UTILITY_STRUCTUREDDATA_H
diff --git a/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h b/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h
index 196fdfc..3253767 100644
--- a/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h
+++ b/linux-x64/clang/include/lldb/Utility/TildeExpressionResolver.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H
-#define LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H
+#ifndef LLDB_UTILITY_TILDEEXPRESSIONRESOLVER_H
+#define LLDB_UTILITY_TILDEEXPRESSIONRESOLVER_H
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
@@ -61,4 +61,4 @@
};
}
-#endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H
+#endif // LLDB_UTILITY_TILDEEXPRESSIONRESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Utility/Timeout.h b/linux-x64/clang/include/lldb/Utility/Timeout.h
index 202b747..80e2015 100644
--- a/linux-x64/clang/include/lldb/Utility/Timeout.h
+++ b/linux-x64/clang/include/lldb/Utility/Timeout.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Timeout_h_
-#define liblldb_Timeout_h_
+#ifndef LLDB_UTILITY_TIMEOUT_H
+#define LLDB_UTILITY_TIMEOUT_H
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Chrono.h"
@@ -67,4 +67,4 @@
};
}
-#endif // liblldb_Timeout_h_
+#endif // LLDB_UTILITY_TIMEOUT_H
diff --git a/linux-x64/clang/include/lldb/Utility/Timer.h b/linux-x64/clang/include/lldb/Utility/Timer.h
index ad9421a..edc064b 100644
--- a/linux-x64/clang/include/lldb/Utility/Timer.h
+++ b/linux-x64/clang/include/lldb/Utility/Timer.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_Timer_h_
-#define liblldb_Timer_h_
+#ifndef LLDB_UTILITY_TIMER_H
+#define LLDB_UTILITY_TIMER_H
#include "lldb/lldb-defines.h"
#include "llvm/Support/Chrono.h"
@@ -25,6 +25,7 @@
class Category {
public:
explicit Category(const char *category_name);
+ llvm::StringRef GetName() { return m_name; }
private:
friend class Timer;
@@ -34,7 +35,8 @@
std::atomic<uint64_t> m_count;
std::atomic<Category *> m_next;
- DISALLOW_COPY_AND_ASSIGN(Category);
+ Category(const Category &) = delete;
+ const Category &operator=(const Category &) = delete;
};
/// Default constructor.
@@ -66,9 +68,17 @@
static std::atomic<unsigned> g_display_depth;
private:
- DISALLOW_COPY_AND_ASSIGN(Timer);
+ Timer(const Timer &) = delete;
+ const Timer &operator=(const Timer &) = delete;
};
} // namespace lldb_private
-#endif // liblldb_Timer_h_
+#define LLDB_SCOPED_TIMER() \
+ static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \
+ ::lldb_private::Timer _scoped_timer(_cat, LLVM_PRETTY_FUNCTION)
+#define LLDB_SCOPED_TIMERF(...) \
+ static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \
+ ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
+
+#endif // LLDB_UTILITY_TIMER_H
diff --git a/linux-x64/clang/include/lldb/Utility/TraceOptions.h b/linux-x64/clang/include/lldb/Utility/TraceOptions.h
index d5e21cc..c9a8d12 100644
--- a/linux-x64/clang/include/lldb/Utility/TraceOptions.h
+++ b/linux-x64/clang/include/lldb/Utility/TraceOptions.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_TraceOptions_h_
-#define liblldb_TraceOptions_h_
+#ifndef LLDB_UTILITY_TRACEOPTIONS_H
+#define LLDB_UTILITY_TRACEOPTIONS_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
@@ -15,6 +15,19 @@
#include "lldb/Utility/StructuredData.h"
namespace lldb_private {
+
+/// This struct represents a tracing technology.
+struct TraceTypeInfo {
+ /// The name of the technology, e.g. intel-pt or arm-coresight.
+ ///
+ /// In order for a Trace plug-in (see \a lldb_private::Trace.h) to support the
+ /// trace technology given by this struct, it should match its name with this
+ /// field.
+ std::string name;
+ /// A description for the technology.
+ std::string description;
+};
+
class TraceOptions {
public:
TraceOptions() : m_trace_params(new StructuredData::Dictionary()) {}
@@ -57,4 +70,12 @@
};
}
-#endif // liblldb_TraceOptions_h_
+namespace llvm {
+namespace json {
+
+bool fromJSON(const Value &value, lldb_private::TraceTypeInfo &info, Path path);
+
+} // namespace json
+} // namespace llvm
+
+#endif // LLDB_UTILITY_TRACEOPTIONS_H
diff --git a/linux-x64/clang/include/lldb/Utility/UUID.h b/linux-x64/clang/include/lldb/Utility/UUID.h
index dbeb9db..f2107d9 100644
--- a/linux-x64/clang/include/lldb/Utility/UUID.h
+++ b/linux-x64/clang/include/lldb/Utility/UUID.h
@@ -9,14 +9,12 @@
#ifndef LLDB_UTILITY_UUID_H
#define LLDB_UTILITY_UUID_H
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Endian.h"
#include <stddef.h>
#include <stdint.h>
#include <string>
-#include "llvm/ADT/ArrayRef.h"
-
-namespace llvm {
- class StringRef;
-}
namespace lldb_private {
@@ -26,6 +24,22 @@
public:
UUID() = default;
+ // Reference:
+ // https://crashpad.chromium.org/doxygen/structcrashpad_1_1CodeViewRecordPDB70.html
+ struct CvRecordPdb70 {
+ struct {
+ llvm::support::ulittle32_t Data1;
+ llvm::support::ulittle16_t Data2;
+ llvm::support::ulittle16_t Data3;
+ uint8_t Data4[8];
+ } Uuid;
+ llvm::support::ulittle32_t Age;
+ // char PDBFileName[];
+ };
+
+ /// Create a UUID from CvRecordPdb70.
+ static UUID fromCvRecord(CvRecordPdb70 debug_info);
+
/// Creates a UUID from the data pointed to by the bytes argument. No special
/// significance is attached to any of the values.
static UUID fromData(const void *bytes, uint32_t num_bytes) {
@@ -66,34 +80,27 @@
std::string GetAsString(llvm::StringRef separator = "-") const;
- size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16);
-
- // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set the
- // UUID to invalid.
- size_t SetFromOptionalStringRef(llvm::StringRef str,
- uint32_t num_uuid_bytes = 16);
+ bool SetFromStringRef(llvm::StringRef str);
- // Decode as many UUID bytes (up to 16) as possible from the C string "cstr"
- // This is used for auto completion where a partial UUID might have been
- // typed in. It
- /// Decode as many UUID bytes (up to 16) as possible from the C
- /// string \a cstr.
+ // Same as SetFromStringRef, but if the resultant UUID is all 0 bytes, set the
+ // UUID to invalid.
+ bool SetFromOptionalStringRef(llvm::StringRef str);
+
+ /// Decode as many UUID bytes as possible from the C string \a cstr.
///
- /// \param[in] cstr
- /// A NULL terminate C string that points at a UUID string value
- /// (no leading spaces). The string must contain only hex
- /// characters and optionally can contain the '-' sepearators.
+ /// \param[in] str
+ /// An llvm::StringRef that points at a UUID string value (no leading
+ /// spaces). The string must contain only hex characters and optionally
+ /// can contain the '-' sepearators.
///
/// \param[in] uuid_bytes
- /// A buffer of bytes that will contain a full or patially
- /// decoded UUID.
+ /// A buffer of bytes that will contain a full or partially decoded UUID.
///
/// \return
/// The original string, with all decoded bytes removed.
static llvm::StringRef
DecodeUUIDBytesFromString(llvm::StringRef str,
- llvm::SmallVectorImpl<uint8_t> &uuid_bytes,
- uint32_t num_uuid_bytes = 16);
+ llvm::SmallVectorImpl<uint8_t> &uuid_bytes);
private:
UUID(llvm::ArrayRef<uint8_t> bytes) : m_bytes(bytes.begin(), bytes.end()) {}
diff --git a/linux-x64/clang/include/lldb/Utility/UnimplementedError.h b/linux-x64/clang/include/lldb/Utility/UnimplementedError.h
new file mode 100644
index 0000000..c6fab0a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/UnimplementedError.h
@@ -0,0 +1,28 @@
+//===-- UnimplementedError.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_UNIMPLEMENTEDERROR_H
+#define LLDB_UTILITY_UNIMPLEMENTEDERROR_H
+
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
+
+namespace lldb_private {
+class UnimplementedError : public llvm::ErrorInfo<UnimplementedError> {
+public:
+ static char ID;
+
+ void log(llvm::raw_ostream &OS) const override { OS << "Not implemented"; }
+
+ std::error_code convertToErrorCode() const override {
+ return llvm::errc::not_supported;
+ };
+};
+} // namespace lldb_private
+
+#endif // LLDB_UTILITY_UNIMPLEMENTEDERROR_H
diff --git a/linux-x64/clang/include/lldb/Utility/UriParser.h b/linux-x64/clang/include/lldb/Utility/UriParser.h
index 4a3f012..6a64c3d 100644
--- a/linux-x64/clang/include/lldb/Utility/UriParser.h
+++ b/linux-x64/clang/include/lldb/Utility/UriParser.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef utility_UriParser_h_
-#define utility_UriParser_h_
+#ifndef LLDB_UTILITY_URIPARSER_H
+#define LLDB_UTILITY_URIPARSER_H
#include "llvm/ADT/StringRef.h"
@@ -28,4 +28,4 @@
};
}
-#endif // utility_UriParser_h_
+#endif // LLDB_UTILITY_URIPARSER_H
diff --git a/linux-x64/clang/include/lldb/Utility/UserID.h b/linux-x64/clang/include/lldb/Utility/UserID.h
index 2dc5cdb..9fc6985 100644
--- a/linux-x64/clang/include/lldb/Utility/UserID.h
+++ b/linux-x64/clang/include/lldb/Utility/UserID.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_UserID_h_
-#define liblldb_UserID_h_
+#ifndef LLDB_UTILITY_USERID_H
+#define LLDB_UTILITY_USERID_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
@@ -90,4 +90,4 @@
} // namespace lldb_private
-#endif // liblldb_UserID_h_
+#endif // LLDB_UTILITY_USERID_H
diff --git a/linux-x64/clang/include/lldb/Utility/UserIDResolver.h b/linux-x64/clang/include/lldb/Utility/UserIDResolver.h
index bca82a1..e0f7b69 100644
--- a/linux-x64/clang/include/lldb/Utility/UserIDResolver.h
+++ b/linux-x64/clang/include/lldb/Utility/UserIDResolver.h
@@ -53,4 +53,4 @@
} // namespace lldb_private
-#endif // #ifndef LLDB_HOST_USERIDRESOLVER_H
+#endif // LLDB_UTILITY_USERIDRESOLVER_H
diff --git a/linux-x64/clang/include/lldb/Utility/VASPrintf.h b/linux-x64/clang/include/lldb/Utility/VASPrintf.h
index 582645f..a4b5f7d 100644
--- a/linux-x64/clang/include/lldb/Utility/VASPrintf.h
+++ b/linux-x64/clang/include/lldb/Utility/VASPrintf.h
@@ -17,4 +17,4 @@
bool VASprintf(llvm::SmallVectorImpl<char> &buf, const char *fmt, va_list args);
}
-#endif // #ifdef LLDB_UTILITY_VASPRINTF_H
+#endif // LLDB_UTILITY_VASPRINTF_H
diff --git a/linux-x64/clang/include/lldb/Utility/VMRange.h b/linux-x64/clang/include/lldb/Utility/VMRange.h
index 9c2f9d0..4b01cd8 100644
--- a/linux-x64/clang/include/lldb/Utility/VMRange.h
+++ b/linux-x64/clang/include/lldb/Utility/VMRange.h
@@ -6,20 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_VMRange_h_
-#define liblldb_VMRange_h_
+#ifndef LLDB_UTILITY_VMRANGE_H
+#define LLDB_UTILITY_VMRANGE_H
#include "lldb/lldb-types.h"
+#include "llvm/Support/raw_ostream.h"
#include <stddef.h>
#include <stdint.h>
#include <vector>
namespace lldb_private {
-class Stream;
-}
-
-namespace lldb_private {
// A vm address range. These can represent offsets ranges or actual
// addresses.
@@ -81,7 +78,7 @@
return false;
}
- void Dump(Stream *s, lldb::addr_t base_addr = 0,
+ void Dump(llvm::raw_ostream &s, lldb::addr_t base_addr = 0,
uint32_t addr_width = 8) const;
static bool ContainsValue(const VMRange::collection &coll,
@@ -104,4 +101,4 @@
} // namespace lldb_private
-#endif // liblldb_VMRange_h_
+#endif // LLDB_UTILITY_VMRANGE_H
diff --git a/linux-x64/clang/include/lldb/Utility/XcodeSDK.h b/linux-x64/clang/include/lldb/Utility/XcodeSDK.h
new file mode 100644
index 0000000..878b131
--- /dev/null
+++ b/linux-x64/clang/include/lldb/Utility/XcodeSDK.h
@@ -0,0 +1,96 @@
+//===-- XcodeSDK.h ----------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_UTILITY_SDK_H
+#define LLDB_UTILITY_SDK_H
+
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
+#include <tuple>
+
+namespace llvm {
+class Triple;
+}
+
+namespace lldb_private {
+
+/// An abstraction for Xcode-style SDKs that works like \ref ArchSpec.
+class XcodeSDK {
+ std::string m_name;
+
+public:
+ /// Different types of Xcode SDKs.
+ enum Type : int {
+ MacOSX = 0,
+ iPhoneSimulator,
+ iPhoneOS,
+ AppleTVSimulator,
+ AppleTVOS,
+ WatchSimulator,
+ watchOS,
+ bridgeOS,
+ Linux,
+ unknown = -1
+ };
+ static constexpr int numSDKTypes = Linux + 1;
+
+ /// A parsed SDK directory name.
+ struct Info {
+ Type type = unknown;
+ llvm::VersionTuple version;
+ bool internal = false;
+
+ Info() = default;
+ bool operator<(const Info &other) const;
+ bool operator==(const Info &other) const;
+ };
+
+
+ /// Default constructor, constructs an empty string.
+ XcodeSDK() = default;
+ /// Construct an XcodeSDK object from a specification.
+ XcodeSDK(Info info);
+ /// Initialize an XcodeSDK object with an SDK name. The SDK name is the last
+ /// directory component of a path one would pass to clang's -isysroot
+ /// parameter. For example, "MacOSX.10.14.sdk".
+ XcodeSDK(std::string &&name) : m_name(std::move(name)) {}
+ static XcodeSDK GetAnyMacOS() { return XcodeSDK("MacOSX.sdk"); }
+
+ /// The merge function follows a strict order to maintain monotonicity:
+ /// 1. SDK with the higher SDKType wins.
+ /// 2. The newer SDK wins.
+ void Merge(const XcodeSDK &other);
+
+ XcodeSDK &operator=(const XcodeSDK &other);
+ XcodeSDK(const XcodeSDK&) = default;
+ bool operator==(const XcodeSDK &other);
+
+ /// Return parsed SDK type and version number.
+ Info Parse() const;
+ bool IsAppleInternalSDK() const;
+ llvm::VersionTuple GetVersion() const;
+ Type GetType() const;
+ llvm::StringRef GetString() const;
+ /// Whether this Xcode SDK supports Swift.
+ bool SupportsSwift() const;
+
+ /// Whether LLDB feels confident importing Clang modules from this SDK.
+ static bool SDKSupportsModules(Type type, llvm::VersionTuple version);
+ static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path);
+ /// Return the canonical SDK name, such as "macosx" for the macOS SDK.
+ static std::string GetCanonicalName(Info info);
+ /// Return the best-matching SDK type for a specific triple.
+ static XcodeSDK::Type GetSDKTypeForTriple(const llvm::Triple &triple);
+
+ static std::string FindXcodeContentsDirectoryInPath(llvm::StringRef path);
+};
+
+} // namespace lldb_private
+
+#endif
diff --git a/linux-x64/clang/include/lldb/lldb-defines.h b/linux-x64/clang/include/lldb/lldb-defines.h
index b879644..487cd0b 100644
--- a/linux-x64/clang/include/lldb/lldb-defines.h
+++ b/linux-x64/clang/include/lldb/lldb-defines.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_defines_h_
-#define LLDB_lldb_defines_h_
+#ifndef LLDB_LLDB_DEFINES_H
+#define LLDB_LLDB_DEFINES_H
#include "lldb/lldb-types.h"
@@ -95,6 +95,7 @@
#define LLDB_INVALID_SIGNAL_NUMBER INT32_MAX
#define LLDB_INVALID_OFFSET UINT64_MAX // Must match max of lldb::offset_t
#define LLDB_INVALID_LINE_NUMBER UINT32_MAX
+#define LLDB_INVALID_COLUMN_NUMBER 0
#define LLDB_INVALID_QUEUE_ID 0
/// CPU Type definitions
@@ -119,6 +120,7 @@
#define LLDB_OPT_SET_9 (1U << 8)
#define LLDB_OPT_SET_10 (1U << 9)
#define LLDB_OPT_SET_11 (1U << 10)
+#define LLDB_OPT_SET_12 (1U << 11)
#define LLDB_OPT_SET_FROM_TO(A, B) \
(((1U << (B)) - 1) ^ (((1U << (A)) - 1) >> 1))
@@ -133,15 +135,4 @@
#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))
-#if defined(__cplusplus)
-
-/// \def DISALLOW_COPY_AND_ASSIGN(TypeName)
-/// Macro definition for easily disallowing copy constructor and
-/// assignment operators in C++ classes.
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName &) = delete; \
- const TypeName &operator=(const TypeName &) = delete
-
-#endif // #if defined(__cplusplus)
-
-#endif // LLDB_lldb_defines_h_
+#endif // LLDB_LLDB_DEFINES_H
diff --git a/linux-x64/clang/include/lldb/lldb-enumerations.h b/linux-x64/clang/include/lldb/lldb-enumerations.h
index f9830c0..2679ee5 100644
--- a/linux-x64/clang/include/lldb/lldb-enumerations.h
+++ b/linux-x64/clang/include/lldb/lldb-enumerations.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_enumerations_h_
-#define LLDB_lldb_enumerations_h_
+#ifndef LLDB_LLDB_ENUMERATIONS_H
+#define LLDB_LLDB_ENUMERATIONS_H
#include <type_traits>
@@ -69,21 +69,22 @@
namespace lldb {
-// Process and Thread States
+/// Process and Thread States.
enum StateType {
eStateInvalid = 0,
eStateUnloaded, ///< Process is object is valid, but not currently loaded
eStateConnected, ///< Process is connected to remote debug services, but not
- ///launched or attached to anything yet
+ /// launched or attached to anything yet
eStateAttaching, ///< Process is currently trying to attach
eStateLaunching, ///< Process is in the process of launching
- // The state changes eStateAttaching and eStateLaunching are both sent while the
- // private state thread is either not yet started or paused. For that reason, they
- // should only be signaled as public state changes, and not private state changes.
+ // The state changes eStateAttaching and eStateLaunching are both sent while
+ // the private state thread is either not yet started or paused. For that
+ // reason, they should only be signaled as public state changes, and not
+ // private state changes.
eStateStopped, ///< Process or thread is stopped and can be examined.
eStateRunning, ///< Process or thread is running and can't be examined.
eStateStepping, ///< Process or thread is in the process of stepping and can
- ///not be examined.
+ /// not be examined.
eStateCrashed, ///< Process or thread has crashed and can be examined.
eStateDetached, ///< Process has been detached and can't be examined.
eStateExited, ///< Process has exited and can't be examined.
@@ -93,16 +94,17 @@
kLastStateType = eStateSuspended
};
-// Launch Flags
+/// Launch Flags.
FLAGS_ENUM(LaunchFlags){
eLaunchFlagNone = 0u,
eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling
- ///process into a new process
+ /// process into a new process
eLaunchFlagDebug = (1u << 1), ///< Stop as soon as the process launches to
- ///allow the process to be debugged
- eLaunchFlagStopAtEntry = (1u << 2), ///< Stop at the program entry point
- ///instead of auto-continuing when
- ///launching or attaching at entry point
+ /// allow the process to be debugged
+ eLaunchFlagStopAtEntry = (1u
+ << 2), ///< Stop at the program entry point
+ /// instead of auto-continuing when
+ /// launching or attaching at entry point
eLaunchFlagDisableASLR =
(1u << 3), ///< Disable Address Space Layout Randomization
eLaunchFlagDisableSTDIO =
@@ -113,23 +115,26 @@
(1u << 6), ///< Launch the process inside a shell to get shell expansion
eLaunchFlagLaunchInSeparateProcessGroup =
(1u << 7), ///< Launch the process in a separate process group
- eLaunchFlagDontSetExitStatus = (1u << 8), ///< If you are going to hand the
- ///process off (e.g. to
- ///debugserver)
+ ///< If you are going to hand the process off (e.g. to
+ ///< debugserver)
+ eLaunchFlagDontSetExitStatus = (1u << 8),
///< set this flag so lldb & the handee don't race to set its exit status.
eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub
- ///should detach rather than killing
- ///the debugee
+ ///< should detach rather than killing
+ ///< the debugee
///< if it loses connection with lldb.
eLaunchFlagShellExpandArguments =
(1u << 10), ///< Perform shell-style argument expansion
eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit
+ eLaunchFlagInheritTCCFromParent =
+ (1u << 12), ///< Don't make the inferior responsible for its own TCC
+ ///< permissions but instead inherit them from its parent.
};
-// Thread Run Modes
+/// Thread Run Modes.
enum RunMode { eOnlyThisThread, eAllThreads, eOnlyDuringStepping };
-// Byte ordering definitions
+/// Byte ordering definitions.
enum ByteOrder {
eByteOrderInvalid = 0,
eByteOrderBig = 1,
@@ -137,16 +142,16 @@
eByteOrderLittle = 4
};
-// Register encoding definitions
+/// Register encoding definitions.
enum Encoding {
eEncodingInvalid = 0,
- eEncodingUint, // unsigned integer
- eEncodingSint, // signed integer
- eEncodingIEEE754, // float
- eEncodingVector // vector registers
+ eEncodingUint, ///< unsigned integer
+ eEncodingSint, ///< signed integer
+ eEncodingIEEE754, ///< float
+ eEncodingVector ///< vector registers
};
-// Display format definitions
+/// Display format definitions.
enum Format {
eFormatDefault = 0,
eFormatInvalid = 0,
@@ -155,18 +160,18 @@
eFormatBytes,
eFormatBytesWithASCII,
eFormatChar,
- eFormatCharPrintable, // Only printable characters, space if not printable
- eFormatComplex, // Floating point complex type
+ eFormatCharPrintable, ///< Only printable characters, space if not printable
+ eFormatComplex, ///< Floating point complex type
eFormatComplexFloat = eFormatComplex,
- eFormatCString, // NULL terminated C strings
+ eFormatCString, ///< NULL terminated C strings
eFormatDecimal,
eFormatEnum,
eFormatHex,
eFormatHexUppercase,
eFormatFloat,
eFormatOctal,
- eFormatOSType, // OS character codes encoded into an integer 'PICT' 'text'
- // etc...
+ eFormatOSType, ///< OS character codes encoded into an integer 'PICT' 'text'
+ ///< etc...
eFormatUnicode16,
eFormatUnicode32,
eFormatUnsigned,
@@ -184,20 +189,21 @@
eFormatVectorOfFloat32,
eFormatVectorOfFloat64,
eFormatVectorOfUInt128,
- eFormatComplexInteger, // Integer complex type
- eFormatCharArray, // Print characters with no single quotes, used for
- // character arrays that can contain non printable
- // characters
- eFormatAddressInfo, // Describe what an address points to (func + offset with
- // file/line, symbol + offset, data, etc)
- eFormatHexFloat, // ISO C99 hex float string
- eFormatInstruction, // Disassemble an opcode
- eFormatVoid, // Do not print this
+ eFormatComplexInteger, ///< Integer complex type
+ eFormatCharArray, ///< Print characters with no single quotes, used for
+ ///< character arrays that can contain non printable
+ ///< characters
+ eFormatAddressInfo, ///< Describe what an address points to (func + offset
+ ///< with file/line, symbol + offset, data, etc)
+ eFormatHexFloat, ///< ISO C99 hex float string
+ eFormatInstruction, ///< Disassemble an opcode
+ eFormatVoid, ///< Do not print this
+ eFormatUnicode8,
kNumFormats
};
-// Description levels for "void GetDescription(Stream *, DescriptionLevel)"
-// calls
+/// Description levels for "void GetDescription(Stream *, DescriptionLevel)"
+/// calls.
enum DescriptionLevel {
eDescriptionLevelBrief = 0,
eDescriptionLevelFull,
@@ -206,29 +212,30 @@
kNumDescriptionLevels
};
-// Script interpreter types
+/// Script interpreter types.
enum ScriptLanguage {
- eScriptLanguageNone,
+ eScriptLanguageNone = 0,
eScriptLanguagePython,
- eScriptLanguageDefault = eScriptLanguagePython,
- eScriptLanguageUnknown
+ eScriptLanguageLua,
+ eScriptLanguageUnknown,
+ eScriptLanguageDefault = eScriptLanguagePython
};
-// Register numbering types
+/// Register numbering types.
// See RegisterContext::ConvertRegisterKindToRegisterNumber to convert any of
// these to the lldb internal register numbering scheme (eRegisterKindLLDB).
enum RegisterKind {
- eRegisterKindEHFrame = 0, // the register numbers seen in eh_frame
- eRegisterKindDWARF, // the register numbers seen DWARF
- eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any
- // particular target
- eRegisterKindProcessPlugin, // num used by the process plugin - e.g. by the
- // remote gdb-protocol stub program
- eRegisterKindLLDB, // lldb's internal register numbers
+ eRegisterKindEHFrame = 0, ///< the register numbers seen in eh_frame
+ eRegisterKindDWARF, ///< the register numbers seen DWARF
+ eRegisterKindGeneric, ///< insn ptr reg, stack ptr reg, etc not specific to
+ ///< any particular target
+ eRegisterKindProcessPlugin, ///< num used by the process plugin - e.g. by the
+ ///< remote gdb-protocol stub program
+ eRegisterKindLLDB, ///< lldb's internal register numbers
kNumRegisterKinds
};
-// Thread stop reasons
+/// Thread stop reasons.
enum StopReason {
eStopReasonInvalid = 0,
eStopReasonNone,
@@ -237,13 +244,13 @@
eStopReasonWatchpoint,
eStopReasonSignal,
eStopReasonException,
- eStopReasonExec, // Program was re-exec'ed
+ eStopReasonExec, ///< Program was re-exec'ed
eStopReasonPlanComplete,
eStopReasonThreadExiting,
eStopReasonInstrumentation
};
-// Command Return Status Types
+/// Command Return Status Types.
enum ReturnStatus {
eReturnStatusInvalid,
eReturnStatusSuccessFinishNoResult,
@@ -255,7 +262,7 @@
eReturnStatusQuit
};
-// The results of expression evaluation:
+/// The results of expression evaluation.
enum ExpressionResults {
eExpressionCompleted = 0,
eExpressionSetupError,
@@ -265,30 +272,31 @@
eExpressionHitBreakpoint,
eExpressionTimedOut,
eExpressionResultUnavailable,
- eExpressionStoppedForDebug
+ eExpressionStoppedForDebug,
+ eExpressionThreadVanished
};
enum SearchDepth {
- eSearchDepthInvalid = 0,
- eSearchDepthTarget,
- eSearchDepthModule,
- eSearchDepthCompUnit,
- eSearchDepthFunction,
- eSearchDepthBlock,
- eSearchDepthAddress,
- kLastSearchDepthKind = eSearchDepthAddress
+ eSearchDepthInvalid = 0,
+ eSearchDepthTarget,
+ eSearchDepthModule,
+ eSearchDepthCompUnit,
+ eSearchDepthFunction,
+ eSearchDepthBlock,
+ eSearchDepthAddress,
+ kLastSearchDepthKind = eSearchDepthAddress
};
-// Connection Status Types
+/// Connection Status Types.
enum ConnectionStatus {
- eConnectionStatusSuccess, // Success
- eConnectionStatusEndOfFile, // End-of-file encountered
- eConnectionStatusError, // Check GetError() for details
- eConnectionStatusTimedOut, // Request timed out
- eConnectionStatusNoConnection, // No connection
- eConnectionStatusLostConnection, // Lost connection while connected to a valid
- // connection
- eConnectionStatusInterrupted // Interrupted read
+ eConnectionStatusSuccess, ///< Success
+ eConnectionStatusEndOfFile, ///< End-of-file encountered
+ eConnectionStatusError, ///< Check GetError() for details
+ eConnectionStatusTimedOut, ///< Request timed out
+ eConnectionStatusNoConnection, ///< No connection
+ eConnectionStatusLostConnection, ///< Lost connection while connected to a
+ ///< valid connection
+ eConnectionStatusInterrupted ///< Interrupted read
};
enum ErrorType {
@@ -302,17 +310,17 @@
enum ValueType {
eValueTypeInvalid = 0,
- eValueTypeVariableGlobal = 1, // globals variable
- eValueTypeVariableStatic = 2, // static variable
- eValueTypeVariableArgument = 3, // function argument variables
- eValueTypeVariableLocal = 4, // function local variables
- eValueTypeRegister = 5, // stack frame register value
- eValueTypeRegisterSet = 6, // A collection of stack frame register values
- eValueTypeConstResult = 7, // constant result variables
- eValueTypeVariableThreadLocal = 8 // thread local storage variable
+ eValueTypeVariableGlobal = 1, ///< globals variable
+ eValueTypeVariableStatic = 2, ///< static variable
+ eValueTypeVariableArgument = 3, ///< function argument variables
+ eValueTypeVariableLocal = 4, ///< function local variables
+ eValueTypeRegister = 5, ///< stack frame register value
+ eValueTypeRegisterSet = 6, ///< A collection of stack frame register values
+ eValueTypeConstResult = 7, ///< constant result variables
+ eValueTypeVariableThreadLocal = 8 ///< thread local storage variable
};
-// Token size/granularities for Input Readers
+/// Token size/granularities for Input Readers.
enum InputReaderGranularity {
eInputReaderGranularityInvalid = 0,
@@ -331,39 +339,37 @@
/// in this class, and requests that that item be resolved, or
/// indicates that the member did get resolved.
FLAGS_ENUM(SymbolContextItem){
- eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from
- /// a query, or was located in query
- /// results
- eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from
- /// a query, or was located in query
- /// results
- eSymbolContextCompUnit = (1u << 2), ///< Set when \a comp_unit is requested
- /// from a query, or was located in
- /// query results
- eSymbolContextFunction = (1u << 3), ///< Set when \a function is requested
- /// from a query, or was located in
- /// query results
- eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is
- /// requested from a query, or was located
- /// in query results
- eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is
- /// requested from a query, or was
- /// located in query results
- eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from
- /// a query, or was located in query
- /// results
- eSymbolContextEverything = ((eSymbolContextSymbol << 1) -
- 1u), ///< Indicates to try and lookup everything
- /// up during a routine symbol context
- /// query.
- eSymbolContextVariable = (1u << 7), ///< Set when \a global or static
- /// variable is requested from a query,
- /// or was located in query results.
- ///< eSymbolContextVariable is potentially expensive to lookup so it isn't
- /// included in
- ///< eSymbolContextEverything which stops it from being used during frame PC
- /// lookups and
- ///< many other potential address to symbol context lookups.
+ /// Set when \a target is requested from a query, or was located
+ /// in query results
+ eSymbolContextTarget = (1u << 0),
+ /// Set when \a module is requested from a query, or was located
+ /// in query results
+ eSymbolContextModule = (1u << 1),
+ /// Set when \a comp_unit is requested from a query, or was
+ /// located in query results
+ eSymbolContextCompUnit = (1u << 2),
+ /// Set when \a function is requested from a query, or was located
+ /// in query results
+ eSymbolContextFunction = (1u << 3),
+ /// Set when the deepest \a block is requested from a query, or
+ /// was located in query results
+ eSymbolContextBlock = (1u << 4),
+ /// Set when \a line_entry is requested from a query, or was
+ /// located in query results
+ eSymbolContextLineEntry = (1u << 5),
+ /// Set when \a symbol is requested from a query, or was located
+ /// in query results
+ eSymbolContextSymbol = (1u << 6),
+ /// Indicates to try and lookup everything up during a routine
+ /// symbol context query.
+ eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u),
+ /// Set when \a global or static variable is requested from a
+ /// query, or was located in query results.
+ /// eSymbolContextVariable is potentially expensive to lookup so
+ /// it isn't included in eSymbolContextEverything which stops it
+ /// from being used during frame PC lookups and many other
+ /// potential address to symbol context lookups.
+ eSymbolContextVariable = (1u << 7),
};
LLDB_MARK_AS_BITMASK_ENUM(SymbolContextItem)
@@ -373,27 +379,28 @@
LLDB_MARK_AS_BITMASK_ENUM(Permissions)
enum InputReaderAction {
- eInputReaderActivate, // reader is newly pushed onto the reader stack
- eInputReaderAsynchronousOutputWritten, // an async output event occurred; the
- // reader may want to do something
- eInputReaderReactivate, // reader is on top of the stack again after another
- // reader was popped off
- eInputReaderDeactivate, // another reader was pushed on the stack
- eInputReaderGotToken, // reader got one of its tokens (granularity)
- eInputReaderInterrupt, // reader received an interrupt signal (probably from a
- // control-c)
- eInputReaderEndOfFile, // reader received an EOF char (probably from a
- // control-d)
- eInputReaderDone // reader was just popped off the stack and is done
+ eInputReaderActivate, ///< reader is newly pushed onto the reader stack
+ eInputReaderAsynchronousOutputWritten, ///< an async output event occurred;
+ ///< the reader may want to do
+ ///< something
+ eInputReaderReactivate, ///< reader is on top of the stack again after another
+ ///< reader was popped off
+ eInputReaderDeactivate, ///< another reader was pushed on the stack
+ eInputReaderGotToken, ///< reader got one of its tokens (granularity)
+ eInputReaderInterrupt, ///< reader received an interrupt signal (probably from
+ ///< a control-c)
+ eInputReaderEndOfFile, ///< reader received an EOF char (probably from a
+ ///< control-d)
+ eInputReaderDone ///< reader was just popped off the stack and is done
};
FLAGS_ENUM(BreakpointEventType){
eBreakpointEventTypeInvalidType = (1u << 0),
eBreakpointEventTypeAdded = (1u << 1),
eBreakpointEventTypeRemoved = (1u << 2),
- eBreakpointEventTypeLocationsAdded = (1u << 3), // Locations added doesn't
- // get sent when the
- // breakpoint is created
+ eBreakpointEventTypeLocationsAdded = (1u << 3), ///< Locations added doesn't
+ ///< get sent when the
+ ///< breakpoint is created
eBreakpointEventTypeLocationsRemoved = (1u << 4),
eBreakpointEventTypeLocationsResolved = (1u << 5),
eBreakpointEventTypeEnabled = (1u << 6),
@@ -522,6 +529,7 @@
eArgTypeExpression,
eArgTypeExpressionPath,
eArgTypeExprFormat,
+ eArgTypeFileLineColumn,
eArgTypeFilename,
eArgTypeFormat,
eArgTypeFrameIndex,
@@ -587,12 +595,14 @@
eArgTypeWatchType,
eArgRawInput,
eArgTypeCommand,
+ eArgTypeColumnNum,
+ eArgTypeModuleUUID,
eArgTypeLastArg // Always keep this entry as the last entry in this
// enumeration!!
};
-// Symbol types
-// Symbol holds the SymbolType in a 6-bit field (m_type), so if you get over 63
+/// Symbol types.
+// Symbol holds the SymbolType in a 6-bit field (m_type), so if you get over 63
// entries you will have to resize that field.
enum SymbolType {
eSymbolTypeAny = 0,
@@ -617,8 +627,8 @@
eSymbolTypeLineHeader,
eSymbolTypeScopeBegin,
eSymbolTypeScopeEnd,
- eSymbolTypeAdditional, // When symbols take more than one entry, the extra
- // entries get this type
+ eSymbolTypeAdditional, ///< When symbols take more than one entry, the extra
+ ///< entries get this type
eSymbolTypeCompiler,
eSymbolTypeInstrumentation,
eSymbolTypeUndefined,
@@ -631,19 +641,20 @@
enum SectionType {
eSectionTypeInvalid,
eSectionTypeCode,
- eSectionTypeContainer, // The section contains child sections
+ eSectionTypeContainer, ///< The section contains child sections
eSectionTypeData,
- eSectionTypeDataCString, // Inlined C string data
- eSectionTypeDataCStringPointers, // Pointers to C string data
- eSectionTypeDataSymbolAddress, // Address of a symbol in the symbol table
+ eSectionTypeDataCString, ///< Inlined C string data
+ eSectionTypeDataCStringPointers, ///< Pointers to C string data
+ eSectionTypeDataSymbolAddress, ///< Address of a symbol in the symbol table
eSectionTypeData4,
eSectionTypeData8,
eSectionTypeData16,
eSectionTypeDataPointers,
eSectionTypeDebug,
eSectionTypeZeroFill,
- eSectionTypeDataObjCMessageRefs, // Pointer to function pointer + selector
- eSectionTypeDataObjCCFStrings, // Objective-C const CFString/NSString objects
+ eSectionTypeDataObjCMessageRefs, ///< Pointer to function pointer + selector
+ eSectionTypeDataObjCCFStrings, ///< Objective-C const CFString/NSString
+ ///< objects
eSectionTypeDWARFDebugAbbrev,
eSectionTypeDWARFDebugAddr,
eSectionTypeDWARFDebugAranges,
@@ -663,30 +674,34 @@
eSectionTypeDWARFAppleTypes,
eSectionTypeDWARFAppleNamespaces,
eSectionTypeDWARFAppleObjC,
- eSectionTypeELFSymbolTable, // Elf SHT_SYMTAB section
- eSectionTypeELFDynamicSymbols, // Elf SHT_DYNSYM section
- eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section
- eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section
+ eSectionTypeELFSymbolTable, ///< Elf SHT_SYMTAB section
+ eSectionTypeELFDynamicSymbols, ///< Elf SHT_DYNSYM section
+ eSectionTypeELFRelocationEntries, ///< Elf SHT_REL or SHT_REL section
+ eSectionTypeELFDynamicLinkInfo, ///< Elf SHT_DYNAMIC section
eSectionTypeEHFrame,
eSectionTypeARMexidx,
eSectionTypeARMextab,
- eSectionTypeCompactUnwind, // compact unwind section in Mach-O,
- // __TEXT,__unwind_info
+ eSectionTypeCompactUnwind, ///< compact unwind section in Mach-O,
+ ///< __TEXT,__unwind_info
eSectionTypeGoSymtab,
- eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
- // address
+ eSectionTypeAbsoluteAddress, ///< Dummy section for symbols with absolute
+ ///< address
eSectionTypeDWARFGNUDebugAltLink,
- eSectionTypeDWARFDebugTypes, // DWARF .debug_types section
- eSectionTypeDWARFDebugNames, // DWARF v5 .debug_names
+ eSectionTypeDWARFDebugTypes, ///< DWARF .debug_types section
+ eSectionTypeDWARFDebugNames, ///< DWARF v5 .debug_names
eSectionTypeOther,
- eSectionTypeDWARFDebugLineStr, // DWARF v5 .debug_line_str
- eSectionTypeDWARFDebugRngLists, // DWARF v5 .debug_rnglists
- eSectionTypeDWARFDebugLocLists, // DWARF v5 .debug_loclists
+ eSectionTypeDWARFDebugLineStr, ///< DWARF v5 .debug_line_str
+ eSectionTypeDWARFDebugRngLists, ///< DWARF v5 .debug_rnglists
+ eSectionTypeDWARFDebugLocLists, ///< DWARF v5 .debug_loclists
eSectionTypeDWARFDebugAbbrevDwo,
eSectionTypeDWARFDebugInfoDwo,
eSectionTypeDWARFDebugStrDwo,
eSectionTypeDWARFDebugStrOffsetsDwo,
eSectionTypeDWARFDebugTypesDwo,
+ eSectionTypeDWARFDebugRngListsDwo,
+ eSectionTypeDWARFDebugLocDwo,
+ eSectionTypeDWARFDebugLocListsDwo,
+ eSectionTypeDWARFDebugTuIndex,
};
FLAGS_ENUM(EmulateInstructionOptions){
@@ -697,26 +712,27 @@
FLAGS_ENUM(FunctionNameType){
eFunctionNameTypeNone = 0u,
eFunctionNameTypeAuto =
- (1u << 1), // Automatically figure out which FunctionNameType
- // bits to set based on the function name.
- eFunctionNameTypeFull = (1u << 2), // The function name.
- // For C this is the same as just the name of the function For C++ this is
- // the mangled or demangled version of the mangled name. For ObjC this is
- // the full function signature with the + or - and the square brackets and
- // the class and selector
- eFunctionNameTypeBase = (1u << 3), // The function name only, no namespaces
- // or arguments and no class
- // methods or selectors will be searched.
- eFunctionNameTypeMethod = (1u << 4), // Find function by method name (C++)
- // with no namespace or arguments
+ (1u << 1), ///< Automatically figure out which FunctionNameType
+ ///< bits to set based on the function name.
+ eFunctionNameTypeFull = (1u << 2), ///< The function name.
+ ///< For C this is the same as just the name of the function For C++ this is
+ ///< the mangled or demangled version of the mangled name. For ObjC this is
+ ///< the full function signature with the + or - and the square brackets and
+ ///< the class and selector
+ eFunctionNameTypeBase = (1u
+ << 3), ///< The function name only, no namespaces
+ ///< or arguments and no class
+ ///< methods or selectors will be searched.
+ eFunctionNameTypeMethod = (1u << 4), ///< Find function by method name (C++)
+ ///< with no namespace or arguments
eFunctionNameTypeSelector =
- (1u << 5), // Find function by selector name (ObjC) names
+ (1u << 5), ///< Find function by selector name (ObjC) names
eFunctionNameTypeAny =
- eFunctionNameTypeAuto // DEPRECATED: use eFunctionNameTypeAuto
+ eFunctionNameTypeAuto ///< DEPRECATED: use eFunctionNameTypeAuto
};
LLDB_MARK_AS_BITMASK_ENUM(FunctionNameType)
-// Basic types enumeration for the public API SBType::GetBasicType()
+/// Basic types enumeration for the public API SBType::GetBasicType().
enum BasicType {
eBasicTypeInvalid = 0,
eBasicTypeVoid = 1,
@@ -753,10 +769,11 @@
eBasicTypeOther
};
+/// Deprecated
enum TraceType {
eTraceTypeNone = 0,
- // Hardware Trace generated by the processor.
+ /// Intel Processor Trace
eTraceTypeProcessorTrace
};
@@ -801,8 +818,8 @@
eTemplateArgumentKindNullPtr,
};
-// Options that can be set for a formatter to alter its behavior Not all of
-// these are applicable to all formatter types
+/// Options that can be set for a formatter to alter its behavior. Not
+/// all of these are applicable to all formatter types.
FLAGS_ENUM(TypeOptions){eTypeOptionNone = (0u),
eTypeOptionCascade = (1u << 0),
eTypeOptionSkipPointers = (1u << 1),
@@ -813,20 +830,28 @@
eTypeOptionHideNames = (1u << 6),
eTypeOptionNonCacheable = (1u << 7),
eTypeOptionHideEmptyAggregates = (1u << 8),
- eTypeOptionFrontEndWantsDereference = (1u << 9)
-};
+ eTypeOptionFrontEndWantsDereference = (1u << 9)};
-// This is the return value for frame comparisons. If you are comparing frame
-// A to frame B the following cases arise: 1) When frame A pushes frame B (or a
-// frame that ends up pushing B) A is Older than B. 2) When frame A pushed
-// frame B (or if frame A is on the stack but B is not) A is Younger than B 3)
-// When frame A and frame B have the same StackID, they are Equal. 4) When
-// frame A and frame B have the same immediate parent frame, but are not equal,
-// the comparison yields
-// SameParent.
-// 5) If the two frames are on different threads or processes the comparison is
-// Invalid 6) If for some reason we can't figure out what went on, we return
-// Unknown.
+/// This is the return value for frame comparisons. If you are comparing frame
+/// A to frame B the following cases arise:
+///
+/// 1) When frame A pushes frame B (or a frame that ends up pushing
+/// B) A is Older than B.
+///
+/// 2) When frame A pushed frame B (or if frameA is on the stack
+/// but B is not) A is Younger than B.
+///
+/// 3) When frame A and frame B have the same StackID, they are
+/// Equal.
+///
+/// 4) When frame A and frame B have the same immediate parent
+/// frame, but are not equal, the comparison yields SameParent.
+///
+/// 5) If the two frames are on different threads or processes the
+/// comparison is Invalid.
+///
+/// 6) If for some reason we can't figure out what went on, we
+/// return Unknown.
enum FrameComparison {
eFrameCompareInvalid,
eFrameCompareUnknown,
@@ -836,12 +861,13 @@
eFrameCompareOlder
};
-// File Permissions
-//
-// Designed to mimic the unix file permission bits so they can be used with
-// functions that set 'mode_t' to certain values for permissions.
+/// File Permissions.
+///
+/// Designed to mimic the unix file permission bits so they can be used with
+/// functions that set 'mode_t' to certain values for permissions.
FLAGS_ENUM(FilePermissions){
- eFilePermissionsUserRead = (1u << 8), eFilePermissionsUserWrite = (1u << 7),
+ eFilePermissionsUserRead = (1u << 8),
+ eFilePermissionsUserWrite = (1u << 7),
eFilePermissionsUserExecute = (1u << 6),
eFilePermissionsGroupRead = (1u << 5),
eFilePermissionsGroupWrite = (1u << 4),
@@ -895,29 +921,32 @@
eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX,
};
-// Queue work item types
-//
-// The different types of work that can be enqueued on a libdispatch aka Grand
-// Central Dispatch (GCD) queue.
+/// Queue work item types.
+///
+/// The different types of work that can be enqueued on a libdispatch aka Grand
+/// Central Dispatch (GCD) queue.
enum QueueItemKind {
eQueueItemKindUnknown = 0,
eQueueItemKindFunction,
eQueueItemKindBlock
};
-// Queue type
-// libdispatch aka Grand Central Dispatch (GCD) queues can be either serial
-// (executing on one thread) or concurrent (executing on multiple threads).
+/// Queue type.
+///
+/// libdispatch aka Grand Central Dispatch (GCD) queues can be either
+/// serial (executing on one thread) or concurrent (executing on
+/// multiple threads).
enum QueueKind {
eQueueKindUnknown = 0,
eQueueKindSerial,
eQueueKindConcurrent
};
-// Expression Evaluation Stages
-// These are the cancellable stages of expression evaluation, passed to the
-// expression evaluation callback, so that you can interrupt expression
-// evaluation at the various points in its lifecycle.
+/// Expression Evaluation Stages.
+///
+/// These are the cancellable stages of expression evaluation, passed
+/// to the expression evaluation callback, so that you can interrupt
+/// expression evaluation at the various points in its lifecycle.
enum ExpressionEvaluationPhase {
eExpressionEvaluationParse = 0,
eExpressionEvaluationIRGen,
@@ -925,9 +954,10 @@
eExpressionEvaluationComplete
};
-// Watchpoint Kind
-// Indicates what types of events cause the watchpoint to fire. Used by Native
-// *Protocol-related classes.
+/// Watchpoint Kind.
+///
+/// Indicates what types of events cause the watchpoint to fire. Used by Native
+/// *Protocol-related classes.
FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0),
eWatchpointKindRead = (1u << 1)};
@@ -940,42 +970,44 @@
eGdbSignalBreakpoint = 0x96
};
-// Used with SBHost::GetPath (lldb::PathType) to find files that are related to
-// LLDB on the current host machine. Most files are relative to LLDB or are in
-// known locations.
+/// Used with SBHost::GetPath (lldb::PathType) to find files that are
+/// related to LLDB on the current host machine. Most files are
+/// relative to LLDB or are in known locations.
enum PathType {
- ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB
- // mach-o file in LLDB.framework (MacOSX) exists
- ePathTypeSupportExecutableDir, // Find LLDB support executable directory
- // (debugserver, etc)
- ePathTypeHeaderDir, // Find LLDB header file directory
- ePathTypePythonDir, // Find Python modules (PYTHONPATH) directory
- ePathTypeLLDBSystemPlugins, // System plug-ins directory
- ePathTypeLLDBUserPlugins, // User plug-ins directory
- ePathTypeLLDBTempSystemDir, // The LLDB temp directory for this system that
- // will be cleaned up on exit
- ePathTypeGlobalLLDBTempSystemDir, // The LLDB temp directory for this system,
- // NOT cleaned up on a process exit.
- ePathTypeClangDir // Find path to Clang builtin headers
+ ePathTypeLLDBShlibDir, ///< The directory where the lldb.so (unix) or LLDB
+ ///< mach-o file in LLDB.framework (MacOSX) exists
+ ePathTypeSupportExecutableDir, ///< Find LLDB support executable directory
+ ///< (debugserver, etc)
+ ePathTypeHeaderDir, ///< Find LLDB header file directory
+ ePathTypePythonDir, ///< Find Python modules (PYTHONPATH) directory
+ ePathTypeLLDBSystemPlugins, ///< System plug-ins directory
+ ePathTypeLLDBUserPlugins, ///< User plug-ins directory
+ ePathTypeLLDBTempSystemDir, ///< The LLDB temp directory for this system that
+ ///< will be cleaned up on exit
+ ePathTypeGlobalLLDBTempSystemDir, ///< The LLDB temp directory for this
+ ///< system, NOT cleaned up on a process
+ ///< exit.
+ ePathTypeClangDir ///< Find path to Clang builtin headers
};
-// Kind of member function
-// Used by the type system
+/// Kind of member function.
+///
+/// Used by the type system.
enum MemberFunctionKind {
- eMemberFunctionKindUnknown = 0, // Not sure what the type of this is
- eMemberFunctionKindConstructor, // A function used to create instances
- eMemberFunctionKindDestructor, // A function used to tear down existing
- // instances
- eMemberFunctionKindInstanceMethod, // A function that applies to a specific
- // instance
- eMemberFunctionKindStaticMethod // A function that applies to a type rather
- // than any instance
+ eMemberFunctionKindUnknown = 0, ///< Not sure what the type of this is
+ eMemberFunctionKindConstructor, ///< A function used to create instances
+ eMemberFunctionKindDestructor, ///< A function used to tear down existing
+ ///< instances
+ eMemberFunctionKindInstanceMethod, ///< A function that applies to a specific
+ ///< instance
+ eMemberFunctionKindStaticMethod ///< A function that applies to a type rather
+ ///< than any instance
};
-// String matching algorithm used by SBTarget
+/// String matching algorithm used by SBTarget.
enum MatchType { eMatchTypeNormal, eMatchTypeRegex, eMatchTypeStartsWith };
-// Bitmask that describes details about a type
+/// Bitmask that describes details about a type.
FLAGS_ENUM(TypeFlags){
eTypeHasChildren = (1u << 0), eTypeHasValue = (1u << 1),
eTypeIsArray = (1u << 2), eTypeIsBlock = (1u << 3),
@@ -991,71 +1023,90 @@
eTypeInstanceIsPointer = (1u << 22)};
FLAGS_ENUM(CommandFlags){
- // eCommandRequiresTarget
- //
- // Ensures a valid target is contained in m_exe_ctx prior to executing the
- // command. If a target doesn't exist or is invalid, the command will fail
- // and CommandObject::GetInvalidTargetDescription() will be returned as the
- // error. CommandObject subclasses can override the virtual function for
- // GetInvalidTargetDescription() to provide custom strings when needed.
+ /// eCommandRequiresTarget
+ ///
+ /// Ensures a valid target is contained in m_exe_ctx prior to executing the
+ /// command. If a target doesn't exist or is invalid, the command will fail
+ /// and CommandObject::GetInvalidTargetDescription() will be returned as the
+ /// error. CommandObject subclasses can override the virtual function for
+ /// GetInvalidTargetDescription() to provide custom strings when needed.
eCommandRequiresTarget = (1u << 0),
- // eCommandRequiresProcess
- //
- // Ensures a valid process is contained in m_exe_ctx prior to executing the
- // command. If a process doesn't exist or is invalid, the command will fail
- // and CommandObject::GetInvalidProcessDescription() will be returned as
- // the error. CommandObject subclasses can override the virtual function
- // for GetInvalidProcessDescription() to provide custom strings when
- // needed.
+ /// eCommandRequiresProcess
+ ///
+ /// Ensures a valid process is contained in m_exe_ctx prior to executing the
+ /// command. If a process doesn't exist or is invalid, the command will fail
+ /// and CommandObject::GetInvalidProcessDescription() will be returned as
+ /// the error. CommandObject subclasses can override the virtual function
+ /// for GetInvalidProcessDescription() to provide custom strings when
+ /// needed.
eCommandRequiresProcess = (1u << 1),
- // eCommandRequiresThread
- //
- // Ensures a valid thread is contained in m_exe_ctx prior to executing the
- // command. If a thread doesn't exist or is invalid, the command will fail
- // and CommandObject::GetInvalidThreadDescription() will be returned as the
- // error. CommandObject subclasses can override the virtual function for
- // GetInvalidThreadDescription() to provide custom strings when needed.
+ /// eCommandRequiresThread
+ ///
+ /// Ensures a valid thread is contained in m_exe_ctx prior to executing the
+ /// command. If a thread doesn't exist or is invalid, the command will fail
+ /// and CommandObject::GetInvalidThreadDescription() will be returned as the
+ /// error. CommandObject subclasses can override the virtual function for
+ /// GetInvalidThreadDescription() to provide custom strings when needed.
eCommandRequiresThread = (1u << 2),
- // eCommandRequiresFrame
- //
- // Ensures a valid frame is contained in m_exe_ctx prior to executing the
- // command. If a frame doesn't exist or is invalid, the command will fail
- // and CommandObject::GetInvalidFrameDescription() will be returned as the
- // error. CommandObject subclasses can override the virtual function for
- // GetInvalidFrameDescription() to provide custom strings when needed.
+ /// eCommandRequiresFrame
+ ///
+ /// Ensures a valid frame is contained in m_exe_ctx prior to executing the
+ /// command. If a frame doesn't exist or is invalid, the command will fail
+ /// and CommandObject::GetInvalidFrameDescription() will be returned as the
+ /// error. CommandObject subclasses can override the virtual function for
+ /// GetInvalidFrameDescription() to provide custom strings when needed.
eCommandRequiresFrame = (1u << 3),
- // eCommandRequiresRegContext
- //
- // Ensures a valid register context (from the selected frame if there is a
- // frame in m_exe_ctx, or from the selected thread from m_exe_ctx) is
- // available from m_exe_ctx prior to executing the command. If a target
- // doesn't exist or is invalid, the command will fail and
- // CommandObject::GetInvalidRegContextDescription() will be returned as the
- // error. CommandObject subclasses can override the virtual function for
- // GetInvalidRegContextDescription() to provide custom strings when needed.
+ /// eCommandRequiresRegContext
+ ///
+ /// Ensures a valid register context (from the selected frame if there is a
+ /// frame in m_exe_ctx, or from the selected thread from m_exe_ctx) is
+ /// available from m_exe_ctx prior to executing the command. If a target
+ /// doesn't exist or is invalid, the command will fail and
+ /// CommandObject::GetInvalidRegContextDescription() will be returned as the
+ /// error. CommandObject subclasses can override the virtual function for
+ /// GetInvalidRegContextDescription() to provide custom strings when needed.
eCommandRequiresRegContext = (1u << 4),
- // eCommandTryTargetAPILock
- //
- // Attempts to acquire the target lock if a target is selected in the
- // command interpreter. If the command object fails to acquire the API
- // lock, the command will fail with an appropriate error message.
+ /// eCommandTryTargetAPILock
+ ///
+ /// Attempts to acquire the target lock if a target is selected in the
+ /// command interpreter. If the command object fails to acquire the API
+ /// lock, the command will fail with an appropriate error message.
eCommandTryTargetAPILock = (1u << 5),
- // eCommandProcessMustBeLaunched
- //
- // Verifies that there is a launched process in m_exe_ctx, if there isn't,
- // the command will fail with an appropriate error message.
+ /// eCommandProcessMustBeLaunched
+ ///
+ /// Verifies that there is a launched process in m_exe_ctx, if there isn't,
+ /// the command will fail with an appropriate error message.
eCommandProcessMustBeLaunched = (1u << 6),
- // eCommandProcessMustBePaused
- //
- // Verifies that there is a paused process in m_exe_ctx, if there isn't,
- // the command will fail with an appropriate error message.
- eCommandProcessMustBePaused = (1u << 7)};
+ /// eCommandProcessMustBePaused
+ ///
+ /// Verifies that there is a paused process in m_exe_ctx, if there isn't,
+ /// the command will fail with an appropriate error message.
+ eCommandProcessMustBePaused = (1u << 7),
+ /// eCommandProcessMustBeTraced
+ ///
+ /// Verifies that the process is being traced by a Trace plug-in, if it
+ /// isn't the command will fail with an appropriate error message.
+ eCommandProcessMustBeTraced = (1u << 8)};
-// Whether a summary should cap how much data it returns to users or not
+/// Whether a summary should cap how much data it returns to users or not.
enum TypeSummaryCapping {
eTypeSummaryCapped = true,
eTypeSummaryUncapped = false
};
+
+/// The result from a command interpreter run.
+enum CommandInterpreterResult {
+ /// Command interpreter finished successfully.
+ eCommandInterpreterResultSuccess,
+ /// Stopped because the corresponding option was set and the inferior
+ /// crashed.
+ eCommandInterpreterResultInferiorCrash,
+ /// Stopped because the corresponding option was set and a command returned
+ /// an error.
+ eCommandInterpreterResultCommandError,
+ /// Stopped because quit was requested.
+ eCommandInterpreterResultQuitRequested,
+};
} // namespace lldb
-#endif // LLDB_lldb_enumerations_h_
+#endif // LLDB_LLDB_ENUMERATIONS_H
diff --git a/linux-x64/clang/include/lldb/lldb-forward.h b/linux-x64/clang/include/lldb/lldb-forward.h
index 0cdaf1c..a297a92 100644
--- a/linux-x64/clang/include/lldb/lldb-forward.h
+++ b/linux-x64/clang/include/lldb/lldb-forward.h
@@ -6,25 +6,26 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_forward_h_
-#define LLDB_lldb_forward_h_
+#ifndef LLDB_LLDB_FORWARD_H
+#define LLDB_LLDB_FORWARD_H
#if defined(__cplusplus)
-#include "lldb/Utility/SharingPtr.h"
+#include <memory>
// lldb forward declarations
namespace lldb_private {
class ABI;
+class ASTResultSynthesizer;
+class ASTStructExtractor;
class Address;
class AddressRange;
class AddressResolver;
class ArchSpec;
-class ArmUnwindInfo;
+class Architecture;
class Args;
-class ASTResultSynthesizer;
-class ASTStructExtractor;
+class ArmUnwindInfo;
class Baton;
class Block;
class Breakpoint;
@@ -44,15 +45,8 @@
class BroadcastEventSpec;
class Broadcaster;
class BroadcasterManager;
-class ClangASTContext;
-class ClangASTImporter;
-class ClangASTMetadata;
-class ClangASTSource;
-class ClangExpressionDeclMap;
-class ClangExpressionParser;
-class ClangExpressionVariable;
-class ClangModulesDeclVendor;
-class ClangPersistentVariables;
+class CXXSyntheticChildren;
+class CallFrameInfo;
class CommandInterpreter;
class CommandInterpreterRunOptions;
class CommandObject;
@@ -60,15 +54,13 @@
class CommandReturnObject;
class Communication;
class CompactUnwindInfo;
-struct CompilerContext;
+class CompileUnit;
class CompilerDecl;
class CompilerDeclContext;
class CompilerType;
-class CompileUnit;
class Connection;
class ConnectionFileDescriptor;
class ConstString;
-class CXXSyntheticChildren;
class DWARFCallFrameInfo;
class DWARFDataExtractor;
class DWARFExpression;
@@ -84,7 +76,7 @@
class DynamicLoader;
class Editline;
class EmulateInstruction;
-class Status;
+class Environment;
class EvaluateExpressionOptions;
class Event;
class EventData;
@@ -93,26 +85,26 @@
class ExecutionContextRef;
class ExecutionContextScope;
class Expression;
+class ExpressionTypeSystemHelper;
class ExpressionVariable;
class ExpressionVariableList;
-class ExpressionTypeSystemHelper;
class File;
class FileSpec;
class FileSpecList;
class Flags;
-class TypeCategoryImpl;
class FormatManager;
class FormattersMatchCandidate;
class FuncUnwinders;
class Function;
+class FunctionCaller;
class FunctionInfo;
+class IOHandler;
+class IOObject;
+class IRExecutionUnit;
class InlineFunctionInfo;
class Instruction;
class InstructionList;
class InstrumentationRuntime;
-class IOHandler;
-class IOObject;
-class IRExecutionUnit;
class JITLoader;
class JITLoaderList;
class Language;
@@ -130,15 +122,13 @@
class ModuleList;
class ModuleSpec;
class ModuleSpecList;
-struct NameSearchContext;
class ObjectContainer;
-class OptionGroup;
-class OptionGroupOptions;
-class OptionGroupPlatform;
class ObjectFile;
class ObjectFileJITDelegate;
class OperatingSystem;
-class Options;
+class OptionGroup;
+class OptionGroupOptions;
+class OptionGroupPlatform;
class OptionValue;
class OptionValueArch;
class OptionValueArgs;
@@ -150,8 +140,8 @@
class OptionValueFileSpec;
class OptionValueFileSpecList;
class OptionValueFormat;
-class OptionValueLanguage;
class OptionValueFormatEntity;
+class OptionValueLanguage;
class OptionValuePathMappings;
class OptionValueProperties;
class OptionValueRegex;
@@ -159,31 +149,32 @@
class OptionValueString;
class OptionValueUInt64;
class OptionValueUUID;
+class Options;
class PathMappingList;
-class FunctionCaller;
class PersistentExpressionState;
class Platform;
class Process;
class ProcessAttachInfo;
-class ProcessModID;
class ProcessInfo;
class ProcessInstanceInfo;
-class ProcessInstanceInfoList;
class ProcessInstanceInfoMatch;
class ProcessLaunchInfo;
+class ProcessModID;
class Property;
-struct PropertyDefinition;
+class Queue;
+class QueueImpl;
+class QueueItem;
+class REPL;
class RecognizedStackFrame;
class RegisterCheckpoint;
class RegisterContext;
class RegisterValue;
class RegularExpression;
-class REPL;
class RichManglingContext;
class Scalar;
class ScriptInterpreter;
class ScriptInterpreterLocker;
-struct ScriptSummaryFormat;
+class ScriptedSyntheticChildren;
class SearchFilter;
class Section;
class SectionList;
@@ -197,21 +188,16 @@
class StackFrameRecognizer;
class StackFrameRecognizerManager;
class StackID;
+class Status;
class StopInfo;
class Stoppoint;
class StoppointCallbackContext;
-class StoppointLocation;
class Stream;
-template <unsigned N> class StreamBuffer;
class StreamFile;
class StreamString;
class StringList;
-struct StringSummaryFormat;
class StructuredDataImpl;
class StructuredDataPlugin;
-class SystemRuntime;
-class TypeSummaryImpl;
-class TypeSummaryOptions;
class Symbol;
class SymbolContext;
class SymbolContextList;
@@ -223,12 +209,7 @@
class Symtab;
class SyntheticChildren;
class SyntheticChildrenFrontEnd;
-class TypeFilterImpl;
-class TypeSystem;
-class ScriptedSyntheticChildren;
-class Queue;
-class QueueItem;
-class QueueImpl;
+class SystemRuntime;
class Target;
class TargetList;
class TargetProperties;
@@ -245,21 +226,28 @@
class ThreadPlanStepThrough;
class ThreadPlanTracer;
class ThreadSpec;
+class ThreadTrace;
+class Trace;
+class TraceSessionFileParser;
class TraceOptions;
class Type;
class TypeAndOrName;
+class TypeCategoryImpl;
class TypeCategoryMap;
-class TypeImpl;
-class TypeList;
-class TypeMap;
-class TypeListImpl;
-class TypeMemberImpl;
-class TypeMemberFunctionImpl;
class TypeEnumMemberImpl;
class TypeEnumMemberListImpl;
+class TypeFilterImpl;
class TypeFormatImpl;
+class TypeImpl;
+class TypeList;
+class TypeListImpl;
+class TypeMap;
+class TypeMemberFunctionImpl;
+class TypeMemberImpl;
class TypeNameSpecifierImpl;
-class TypeValidatorImpl;
+class TypeSummaryImpl;
+class TypeSummaryOptions;
+class TypeSystem;
class UUID;
class UnixSignals;
class Unwind;
@@ -283,7 +271,12 @@
class Watchpoint;
class WatchpointList;
class WatchpointOptions;
+struct CompilerContext;
struct LineEntry;
+struct PropertyDefinition;
+struct ScriptSummaryFormat;
+struct StringSummaryFormat;
+template <unsigned N> class StreamBuffer;
} // namespace lldb_private
@@ -299,17 +292,12 @@
typedef std::weak_ptr<lldb_private::BreakpointSite> BreakpointSiteWP;
typedef std::shared_ptr<lldb_private::BreakpointLocation> BreakpointLocationSP;
typedef std::weak_ptr<lldb_private::BreakpointLocation> BreakpointLocationWP;
-typedef std::shared_ptr<lldb_private::BreakpointPrecondition> BreakpointPreconditionSP;
+typedef std::shared_ptr<lldb_private::BreakpointPrecondition>
+ BreakpointPreconditionSP;
typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
typedef std::shared_ptr<lldb_private::BroadcasterManager> BroadcasterManagerSP;
typedef std::weak_ptr<lldb_private::BroadcasterManager> BroadcasterManagerWP;
-typedef std::unique_ptr<lldb_private::ClangASTContext> ClangASTContextUP;
-typedef std::shared_ptr<lldb_private::ClangASTImporter> ClangASTImporterSP;
-typedef std::unique_ptr<lldb_private::ClangModulesDeclVendor>
- ClangModulesDeclVendorUP;
-typedef std::unique_ptr<lldb_private::ClangPersistentVariables>
- ClangPersistentVariablesUP;
typedef std::shared_ptr<lldb_private::UserExpression> UserExpressionSP;
typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
@@ -331,6 +319,7 @@
typedef std::shared_ptr<lldb_private::ExecutionContextRef>
ExecutionContextRefSP;
typedef std::shared_ptr<lldb_private::ExpressionVariable> ExpressionVariableSP;
+typedef std::unique_ptr<lldb_private::File> FileUP;
typedef std::shared_ptr<lldb_private::File> FileSP;
typedef std::shared_ptr<lldb_private::Function> FunctionSP;
typedef std::shared_ptr<lldb_private::FunctionCaller> FunctionCallerSP;
@@ -415,8 +404,9 @@
typedef std::shared_ptr<lldb_private::StackFrameList> StackFrameListSP;
typedef std::shared_ptr<lldb_private::StackFrameRecognizer>
StackFrameRecognizerSP;
+typedef std::unique_ptr<lldb_private::StackFrameRecognizerManager>
+ StackFrameRecognizerManagerUP;
typedef std::shared_ptr<lldb_private::StopInfo> StopInfoSP;
-typedef std::shared_ptr<lldb_private::StoppointLocation> StoppointLocationSP;
typedef std::shared_ptr<lldb_private::Stream> StreamSP;
typedef std::weak_ptr<lldb_private::Stream> StreamWP;
typedef std::shared_ptr<lldb_private::StreamFile> StreamFileSP;
@@ -443,7 +433,9 @@
typedef std::weak_ptr<lldb_private::Thread> ThreadWP;
typedef std::shared_ptr<lldb_private::ThreadCollection> ThreadCollectionSP;
typedef std::shared_ptr<lldb_private::ThreadPlan> ThreadPlanSP;
+typedef std::weak_ptr<lldb_private::ThreadPlan> ThreadPlanWP;
typedef std::shared_ptr<lldb_private::ThreadPlanTracer> ThreadPlanTracerSP;
+typedef std::shared_ptr<lldb_private::Trace> TraceSP;
typedef std::shared_ptr<lldb_private::TraceOptions> TraceOptionsSP;
typedef std::shared_ptr<lldb_private::Type> TypeSP;
typedef std::weak_ptr<lldb_private::Type> TypeWP;
@@ -459,7 +451,6 @@
TypeNameSpecifierImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryOptions> TypeSummaryOptionsSP;
-typedef std::shared_ptr<lldb_private::TypeValidatorImpl> TypeValidatorImplSP;
typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren>
ScriptedSyntheticChildrenSP;
typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP;
@@ -467,7 +458,7 @@
typedef std::shared_ptr<lldb_private::UnwindAssembly> UnwindAssemblySP;
typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
typedef std::shared_ptr<lldb_private::UtilityFunction> UtilityFunctionSP;
-typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
+typedef std::shared_ptr<lldb_private::ValueObject> ValueObjectSP;
typedef std::shared_ptr<lldb_private::Value> ValueSP;
typedef std::shared_ptr<lldb_private::ValueList> ValueListSP;
typedef std::shared_ptr<lldb_private::Variable> VariableSP;
@@ -477,13 +468,5 @@
} // namespace lldb
-// llvm forward declarations
-namespace llvm {
-
-struct ItaniumPartialDemangler;
-class StringRef;
-
-} // namespace llvm
-
#endif // #if defined(__cplusplus)
-#endif // LLDB_lldb_forward_h_
+#endif // LLDB_LLDB_FORWARD_H
diff --git a/linux-x64/clang/include/lldb/lldb-private-defines.h b/linux-x64/clang/include/lldb/lldb-private-defines.h
index 737d9ef..d66e6ef 100644
--- a/linux-x64/clang/include/lldb/lldb-private-defines.h
+++ b/linux-x64/clang/include/lldb/lldb-private-defines.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_lldb_private_defines_h_
-#define liblldb_lldb_private_defines_h_
+#ifndef LLDB_LLDB_PRIVATE_DEFINES_H
+#define LLDB_LLDB_PRIVATE_DEFINES_H
#if defined(__cplusplus)
@@ -33,4 +33,4 @@
#endif // #if defined(__cplusplus)
-#endif // liblldb_lldb_private_defines_h_
+#endif // LLDB_LLDB_PRIVATE_DEFINES_H
diff --git a/linux-x64/clang/include/lldb/lldb-private-enumerations.h b/linux-x64/clang/include/lldb/lldb-private-enumerations.h
index 3d8b360..7009d1b 100644
--- a/linux-x64/clang/include/lldb/lldb-private-enumerations.h
+++ b/linux-x64/clang/include/lldb/lldb-private-enumerations.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_private_enumerations_h_
-#define LLDB_lldb_private_enumerations_h_
+#ifndef LLDB_LLDB_PRIVATE_ENUMERATIONS_H
+#define LLDB_LLDB_PRIVATE_ENUMERATIONS_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FormatProviders.h"
@@ -148,18 +148,6 @@
eExecutionPolicyTopLevel // used for top-level code
};
-// Ways that the FormatManager picks a particular format for a type
-enum FormatterChoiceCriterion {
- eFormatterChoiceCriterionDirectChoice = 0x00000000,
- eFormatterChoiceCriterionStrippedPointerReference = 0x00000001,
- eFormatterChoiceCriterionNavigatedTypedefs = 0x00000002,
- eFormatterChoiceCriterionRegularExpressionSummary = 0x00000004,
- eFormatterChoiceCriterionRegularExpressionFilter = 0x00000004,
- eFormatterChoiceCriterionLanguagePlugin = 0x00000008,
- eFormatterChoiceCriterionStrippedBitField = 0x00000010,
- eFormatterChoiceCriterionWentToStaticValue = 0x00000020
-};
-
// Synchronicity behavior of scripted commands
enum ScriptedCommandSynchronicity {
eScriptedCommandSynchronicitySynchronous,
@@ -198,18 +186,24 @@
enum class TypeValidatorResult : bool { Success = true, Failure = false };
// Enumerations that can be used to specify scopes types when looking up types.
-enum class CompilerContextKind {
+enum class CompilerContextKind : uint16_t {
Invalid = 0,
- TranslationUnit,
- Module,
- Namespace,
- Class,
- Structure,
- Union,
- Function,
- Variable,
- Enumeration,
- Typedef
+ TranslationUnit = 1,
+ Module = 1 << 1,
+ Namespace = 1 << 2,
+ Class = 1 << 3,
+ Struct = 1 << 4,
+ Union = 1 << 5,
+ Function = 1 << 6,
+ Variable = 1 << 7,
+ Enum = 1 << 8,
+ Typedef = 1 << 9,
+
+ Any = 1 << 15,
+ /// Match 0..n nested modules.
+ AnyModule = Any | Module,
+ /// Match any type.
+ AnyType = Any | Class | Struct | Union | Enum | Typedef
};
// Enumerations that can be used to specify the kind of metric we're looking at
@@ -261,4 +255,4 @@
};
}
-#endif // LLDB_lldb_private_enumerations_h_
+#endif // LLDB_LLDB_PRIVATE_ENUMERATIONS_H
diff --git a/linux-x64/clang/include/lldb/lldb-private-forward.h b/linux-x64/clang/include/lldb/lldb-private-forward.h
index 3300707..b5944cb 100644
--- a/linux-x64/clang/include/lldb/lldb-private-forward.h
+++ b/linux-x64/clang/include/lldb/lldb-private-forward.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_private_forward_h_
-#define LLDB_lldb_private_forward_h_
+#ifndef LLDB_LLDB_PRIVATE_FORWARD_H
+#define LLDB_LLDB_PRIVATE_FORWARD_H
namespace lldb_private {
// forward decls.
@@ -18,4 +18,4 @@
class UnixSignals;
}
-#endif // #ifndef LLDB_lldb_private_forward_h_
+#endif // LLDB_LLDB_PRIVATE_FORWARD_H
diff --git a/linux-x64/clang/include/lldb/lldb-private-interfaces.h b/linux-x64/clang/include/lldb/lldb-private-interfaces.h
index 3a9f78a..df33f8a 100644
--- a/linux-x64/clang/include/lldb/lldb-private-interfaces.h
+++ b/linux-x64/clang/include/lldb/lldb-private-interfaces.h
@@ -6,21 +6,30 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_lldb_private_interfaces_h_
-#define liblldb_lldb_private_interfaces_h_
+#ifndef LLDB_LLDB_PRIVATE_INTERFACES_H
+#define LLDB_LLDB_PRIVATE_INTERFACES_H
#if defined(__cplusplus)
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
-#include "lldb/lldb-types.h"
-
#include "lldb/lldb-private-enumerations.h"
-
+#include "lldb/lldb-types.h"
+#include <memory>
#include <set>
+namespace llvm {
+namespace json {
+class Object;
+class Value;
+}
+} // namespace llvm
+
namespace lldb_private {
-typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch);
+typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp,
+ const ArchSpec &arch);
+typedef std::unique_ptr<Architecture> (*ArchitectureCreateInstance)(
+ const ArchSpec &arch);
typedef Disassembler *(*DisassemblerCreateInstance)(const ArchSpec &arch,
const char *flavor);
typedef DynamicLoader *(*DynamicLoaderCreateInstance)(Process *process,
@@ -67,10 +76,10 @@
const ArchSpec *arch);
typedef lldb::ProcessSP (*ProcessCreateInstance)(
lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path, bool can_connect);
typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
Debugger &debugger);
-typedef SymbolFile *(*SymbolFileCreateInstance)(ObjectFile *obj_file);
+typedef SymbolFile *(*SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp);
typedef SymbolVendor *(*SymbolVendorCreateInstance)(
const lldb::ModuleSP &module_sp,
lldb_private::Stream
@@ -82,8 +91,6 @@
typedef bool (*WatchpointHitCallback)(void *baton,
StoppointCallbackContext *context,
lldb::user_id_t watch_id);
-typedef void (*OptionValueChangedCallback)(void *baton,
- OptionValue *option_value);
typedef bool (*ThreadPlanShouldStopHereCallback)(
ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation,
Status &status, void *baton);
@@ -102,16 +109,16 @@
lldb::LanguageType language,
Debugger *debugger, Target *target,
const char *repl_options);
-typedef void (*TypeSystemEnumerateSupportedLanguages)(
- std::set<lldb::LanguageType> &languages_for_types,
- std::set<lldb::LanguageType> &languages_for_expressions);
-typedef void (*REPLEnumerateSupportedLanguages)(
- std::set<lldb::LanguageType> &languages);
typedef int (*ComparisonFunction)(const void *, const void *);
typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
+typedef llvm::Expected<lldb::TraceSP> (*TraceCreateInstance)(
+ const llvm::json::Value &trace_session_file,
+ llvm::StringRef session_file_dir, lldb_private::Debugger &debugger);
+typedef lldb::CommandObjectSP (*TraceGetStartCommand)(
+ CommandInterpreter &interpreter);
} // namespace lldb_private
#endif // #if defined(__cplusplus)
-#endif // liblldb_lldb_private_interfaces_h_
+#endif // LLDB_LLDB_PRIVATE_INTERFACES_H
diff --git a/linux-x64/clang/include/lldb/lldb-private-types.h b/linux-x64/clang/include/lldb/lldb-private-types.h
index bff4711..c7e6526 100644
--- a/linux-x64/clang/include/lldb/lldb-private-types.h
+++ b/linux-x64/clang/include/lldb/lldb-private-types.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_lldb_private_types_h_
-#define liblldb_lldb_private_types_h_
+#ifndef LLDB_LLDB_PRIVATE_TYPES_H
+#define LLDB_LLDB_PRIVATE_TYPES_H
#if defined(__cplusplus)
@@ -28,38 +28,42 @@
typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)(
const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error);
-// Every register is described in detail including its name, alternate name
-// (optional), encoding, size in bytes and the default display format.
+/// Every register is described in detail including its name, alternate name
+/// (optional), encoding, size in bytes and the default display format.
struct RegisterInfo {
- const char *name; // Name of this register, can't be NULL
- const char *alt_name; // Alternate name of this register, can be NULL
- uint32_t byte_size; // Size in bytes of the register
- uint32_t byte_offset; // The byte offset in the register context data where
- // this register's value is found.
- // This is optional, and can be 0 if a particular RegisterContext does not
- // need to address its registers by byte offset.
- lldb::Encoding encoding; // Encoding of the register bits
- lldb::Format format; // Default display format
- uint32_t kinds[lldb::kNumRegisterKinds]; // Holds all of the various register
- // numbers for all register kinds
- uint32_t *value_regs; // List of registers (terminated with
- // LLDB_INVALID_REGNUM). If this value is not null,
- // all registers in this list will be read first, at
- // which point the value for this register will be
- // valid. For example, the value list for ah would be
- // eax (x86) or rax (x64).
- uint32_t *invalidate_regs; // List of registers (terminated with
- // LLDB_INVALID_REGNUM). If this value is not
- // null, all registers in this list will be
- // invalidated when the value of this register
- // changes. For example, the invalidate list for
- // eax would be rax ax, ah, and al.
- const uint8_t *dynamic_size_dwarf_expr_bytes; // A DWARF expression that when
- // evaluated gives
- // the byte size of this register.
- size_t dynamic_size_dwarf_len; // The length of the DWARF expression in bytes
- // in the dynamic_size_dwarf_expr_bytes
- // member.
+ /// Name of this register, can't be NULL.
+ const char *name;
+ /// Alternate name of this register, can be NULL.
+ const char *alt_name;
+ /// Size in bytes of the register.
+ uint32_t byte_size;
+ /// The byte offset in the register context data where this register's
+ /// value is found.
+ /// This is optional, and can be 0 if a particular RegisterContext does not
+ /// need to address its registers by byte offset.
+ uint32_t byte_offset;
+ /// Encoding of the register bits.
+ lldb::Encoding encoding;
+ /// Default display format.
+ lldb::Format format;
+ /// Holds all of the various register numbers for all register kinds.
+ uint32_t kinds[lldb::kNumRegisterKinds]; //
+ /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
+ /// not null, all registers in this list will be read first, at which point
+ /// the value for this register will be valid. For example, the value list
+ /// for ah would be eax (x86) or rax (x64).
+ uint32_t *value_regs; //
+ /// List of registers (terminated with LLDB_INVALID_REGNUM). If this value is
+ /// not null, all registers in this list will be invalidated when the value of
+ /// this register changes. For example, the invalidate list for eax would be
+ /// rax ax, ah, and al.
+ uint32_t *invalidate_regs;
+ /// A DWARF expression that when evaluated gives the byte size of this
+ /// register.
+ const uint8_t *dynamic_size_dwarf_expr_bytes;
+ /// The length of the DWARF expression in bytes in the
+ /// dynamic_size_dwarf_expr_bytes member.
+ size_t dynamic_size_dwarf_len;
llvm::ArrayRef<uint8_t> data(const uint8_t *context_base) const {
return llvm::ArrayRef<uint8_t>(context_base + byte_offset, byte_size);
@@ -71,17 +75,20 @@
}
};
-// Registers are grouped into register sets
+/// Registers are grouped into register sets
struct RegisterSet {
- const char *name; // Name of this register set
- const char *short_name; // A short name for this register set
- size_t num_registers; // The number of registers in REGISTERS array below
- const uint32_t *registers; // An array of register indices in this set. The
- // values in this array are
- // *indices* (not register numbers) into a particular RegisterContext's
- // register array. For example, if eax is defined at index 4 for a
- // particular RegisterContext, eax would be included in this RegisterSet by
- // adding the value 4. Not by adding the value lldb_eax_i386.
+ /// Name of this register set.
+ const char *name;
+ /// A short name for this register set.
+ const char *short_name;
+ /// The number of registers in REGISTERS array below.
+ size_t num_registers;
+ /// An array of register indices in this set. The values in this array are
+ /// *indices* (not register numbers) into a particular RegisterContext's
+ /// register array. For example, if eax is defined at index 4 for a
+ /// particular RegisterContext, eax would be included in this RegisterSet by
+ /// adding the value 4. Not by adding the value lldb_eax_i386.
+ const uint32_t *registers;
};
struct OptionEnumValueElement {
@@ -100,25 +107,6 @@
virtual const char *LongConditionString() const = 0;
};
-struct OptionDefinition {
- uint32_t usage_mask; // Used to mark options that can be used together. If (1
- // << n & usage_mask) != 0
- // then this option belongs to option set n.
- bool required; // This option is required (in the current usage level)
- const char *long_option; // Full name for this option.
- int short_option; // Single character for this option.
- int option_has_arg; // no_argument, required_argument or optional_argument
- OptionValidator *validator; // If non-NULL, option is valid iff
- // |validator->IsValid()|, otherwise always valid.
- OptionEnumValues enum_values; // If not empty, an array of enum values.
- uint32_t completion_type; // Cookie the option class can use to do define the
- // argument completion.
- lldb::CommandArgumentType argument_type; // Type of argument this option takes
- const char *usage_text; // Full text explaining what this options does and
- // what (if any) argument to
- // pass it.
-};
-
typedef struct type128 { uint64_t x[2]; } type128;
typedef struct type256 { uint64_t x[4]; } type256;
@@ -126,4 +114,4 @@
#endif // #if defined(__cplusplus)
-#endif // liblldb_lldb_private_types_h_
+#endif // LLDB_LLDB_PRIVATE_TYPES_H
diff --git a/linux-x64/clang/include/lldb/lldb-private.h b/linux-x64/clang/include/lldb/lldb-private.h
index 24954ad..d65773a 100644
--- a/linux-x64/clang/include/lldb/lldb-private.h
+++ b/linux-x64/clang/include/lldb/lldb-private.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef lldb_lldb_private_h_
-#define lldb_lldb_private_h_
+#ifndef LLDB_LLDB_PRIVATE_H
+#define LLDB_LLDB_PRIVATE_H
#if defined(__cplusplus)
@@ -25,4 +25,4 @@
#endif // defined(__cplusplus)
-#endif // lldb_lldb_private_h_
+#endif // LLDB_LLDB_PRIVATE_H
diff --git a/linux-x64/clang/include/lldb/lldb-public.h b/linux-x64/clang/include/lldb/lldb-public.h
index 449062f..840edc6 100644
--- a/linux-x64/clang/include/lldb/lldb-public.h
+++ b/linux-x64/clang/include/lldb/lldb-public.h
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_h_
-#define LLDB_lldb_h_
+#ifndef LLDB_LLDB_PUBLIC_H
+#define LLDB_LLDB_PUBLIC_H
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-types.h"
-#endif // LLDB_lldb_h_
+#endif // LLDB_LLDB_PUBLIC_H
diff --git a/linux-x64/clang/include/lldb/lldb-types.h b/linux-x64/clang/include/lldb/lldb-types.h
index 414a9f3..c3e2f07 100644
--- a/linux-x64/clang/include/lldb/lldb-types.h
+++ b/linux-x64/clang/include/lldb/lldb-types.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_types_h_
-#define LLDB_lldb_types_h_
+#ifndef LLDB_LLDB_TYPES_H
+#define LLDB_LLDB_TYPES_H
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
@@ -91,4 +91,4 @@
typedef uint64_t queue_id_t;
} // namespace lldb
-#endif // LLDB_lldb_types_h_
+#endif // LLDB_LLDB_TYPES_H
diff --git a/linux-x64/clang/include/lldb/lldb-versioning.h b/linux-x64/clang/include/lldb/lldb-versioning.h
index 702ebd1..d9a0e6b 100644
--- a/linux-x64/clang/include/lldb/lldb-versioning.h
+++ b/linux-x64/clang/include/lldb/lldb-versioning.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLDB_lldb_versioning_h_
-#define LLDB_lldb_versioning_h_
+#ifndef LLDB_LLDB_VERSIONING_H
+#define LLDB_LLDB_VERSIONING_H
// LLDB API version
#define LLDB_API_MAJOR_VERSION 1
@@ -1539,4 +1539,4 @@
// defined(LLDB_API_MINOR_VERSION_WANTED) && defined
// (LLDB_API_MAJOR_VERSION)
-#endif // LLDB_lldb_versioning_h_
+#endif // LLDB_LLDB_VERSIONING_H