summaryrefslogtreecommitdiff
path: root/include/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb')
-rw-r--r--include/lldb/API/SBFrame.h4
-rw-r--r--include/lldb/API/SBFunction.h3
-rw-r--r--include/lldb/API/SBPlatform.h3
-rw-r--r--include/lldb/API/SBSymbol.h3
-rw-r--r--include/lldb/API/SBTarget.h3
-rw-r--r--include/lldb/API/SBUnixSignals.h11
-rw-r--r--include/lldb/Core/Connection.h14
-rw-r--r--include/lldb/Core/Mangled.h21
-rw-r--r--include/lldb/Core/StructuredData.h5
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h1
-rw-r--r--include/lldb/DataFormatters/VectorType.h28
-rw-r--r--include/lldb/Expression/ClangUserExpression.h70
-rw-r--r--include/lldb/Expression/IRInterpreter.h6
-rw-r--r--include/lldb/Expression/IRMemoryMap.h2
-rw-r--r--include/lldb/Host/Host.h4
-rw-r--r--include/lldb/Host/MainLoop.h27
-rw-r--r--include/lldb/Host/MainLoopBase.h94
-rw-r--r--include/lldb/Host/StringConvert.h2
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h59
-rw-r--r--include/lldb/Host/posix/ConnectionFileDescriptorPosix.h7
-rw-r--r--include/lldb/Host/posix/MainLoopPosix.h100
-rw-r--r--include/lldb/Interpreter/CommandObject.h3
-rw-r--r--include/lldb/Symbol/Function.h26
-rw-r--r--include/lldb/Symbol/Symbol.h20
-rw-r--r--include/lldb/Symbol/Variable.h12
-rw-r--r--include/lldb/Target/ABI.h9
-rw-r--r--include/lldb/Target/Platform.h65
-rw-r--r--include/lldb/Target/Process.h76
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h12
-rw-r--r--include/lldb/Target/ThreadPlanCallFunctionUsingABI.h58
-rw-r--r--include/lldb/Target/UnixSignals.h17
-rw-r--r--include/lldb/Utility/JSON.h68
-rw-r--r--include/lldb/Utility/StringExtractor.h176
-rw-r--r--include/lldb/lldb-forward.h2
-rw-r--r--include/lldb/lldb-private-forward.h1
35 files changed, 849 insertions, 163 deletions
diff --git a/include/lldb/API/SBFrame.h b/include/lldb/API/SBFrame.h
index 2ca9e062490d..3177b0cc5a69 100644
--- a/include/lldb/API/SBFrame.h
+++ b/include/lldb/API/SBFrame.h
@@ -90,6 +90,10 @@ public:
/// See also IsInlined().
const char *
GetFunctionName();
+
+ // Get an appropriate function name for this frame that is suitable for display to a user
+ const char *
+ GetDisplayFunctionName ();
const char *
GetFunctionName() const;
diff --git a/include/lldb/API/SBFunction.h b/include/lldb/API/SBFunction.h
index 7d578393eb2c..86cfeb49bb58 100644
--- a/include/lldb/API/SBFunction.h
+++ b/include/lldb/API/SBFunction.h
@@ -36,6 +36,9 @@ public:
GetName() const;
const char *
+ GetDisplayName() const;
+
+ const char *
GetMangledName () const;
lldb::SBInstructionList
diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h
index db4a754103ca..80ad1c06e868 100644
--- a/include/lldb/API/SBPlatform.h
+++ b/include/lldb/API/SBPlatform.h
@@ -189,6 +189,9 @@ namespace lldb {
SBError
SetFilePermissions (const char *path, uint32_t file_permissions);
+ SBUnixSignals
+ GetUnixSignals() const;
+
protected:
friend class SBDebugger;
diff --git a/include/lldb/API/SBSymbol.h b/include/lldb/API/SBSymbol.h
index 3d259a2c20c6..5acebe975261 100644
--- a/include/lldb/API/SBSymbol.h
+++ b/include/lldb/API/SBSymbol.h
@@ -38,6 +38,9 @@ public:
GetName() const;
const char *
+ GetDisplayName() const;
+
+ const char *
GetMangledName () const;
lldb::SBInstructionList
diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h
index dcca4e7b3a19..2ca0b124ce0a 100644
--- a/include/lldb/API/SBTarget.h
+++ b/include/lldb/API/SBTarget.h
@@ -769,6 +769,9 @@ public:
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
lldb::SBValue
+ EvaluateExpression (const char *expr);
+
+ lldb::SBValue
EvaluateExpression (const char *expr, const SBExpressionOptions &options);
lldb::addr_t
diff --git a/include/lldb/API/SBUnixSignals.h b/include/lldb/API/SBUnixSignals.h
index 9eae30739bb8..ae48b63e1a2f 100644
--- a/include/lldb/API/SBUnixSignals.h
+++ b/include/lldb/API/SBUnixSignals.h
@@ -65,17 +65,20 @@ public:
protected:
friend class SBProcess;
+ friend class SBPlatform;
- SBUnixSignals (lldb::ProcessSP &process_sp);
+ SBUnixSignals(lldb::ProcessSP &process_sp);
- lldb::ProcessSP
+ SBUnixSignals(lldb::PlatformSP &platform_sp);
+
+ lldb::UnixSignalsSP
GetSP() const;
void
- SetSP (const lldb::ProcessSP &process_sp);
+ SetSP(const lldb::UnixSignalsSP &signals_sp);
private:
- lldb::ProcessWP m_opaque_wp;
+ lldb::UnixSignalsWP m_opaque_wp;
};
diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h
index c354519a222e..121395c0b23c 100644
--- a/include/lldb/Core/Connection.h
+++ b/include/lldb/Core/Connection.h
@@ -187,6 +187,20 @@ public:
virtual bool
InterruptRead() = 0;
+ //------------------------------------------------------------------
+ /// Returns the underlying IOObject used by the Connection.
+ ///
+ /// The IOObject can be used to wait for data to become available
+ /// on the connection. If the Connection does not use IOObjects (and
+ /// hence does not support waiting) this function should return a
+ /// null pointer.
+ ///
+ /// @return
+ /// The underlying IOObject used for reading.
+ //------------------------------------------------------------------
+ virtual lldb::IOObjectSP
+ GetReadObject() { return lldb::IOObjectSP(); }
+
private:
//------------------------------------------------------------------
// For Connection only
diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h
index a2a2b5591d0f..6d8d8c4a0da7 100644
--- a/include/lldb/Core/Mangled.h
+++ b/include/lldb/Core/Mangled.h
@@ -182,8 +182,17 @@ public:
/// A const reference to the demangled name string object.
//----------------------------------------------------------------------
const ConstString&
- GetDemangledName () const;
+ GetDemangledName (lldb::LanguageType language) const;
+ //----------------------------------------------------------------------
+ /// Display demangled name get accessor.
+ ///
+ /// @return
+ /// A const reference to the display demangled name string object.
+ //----------------------------------------------------------------------
+ ConstString
+ GetDisplayDemangledName (lldb::LanguageType language) const;
+
void
SetDemangledName (const ConstString &name)
{
@@ -231,8 +240,8 @@ public:
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
//----------------------------------------------------------------------
- const ConstString&
- GetName (NamePreference preference = ePreferDemangled) const;
+ ConstString
+ GetName (lldb::LanguageType language, NamePreference preference = ePreferDemangled) const;
//----------------------------------------------------------------------
/// Check if "name" matches either the mangled or demangled name.
@@ -244,15 +253,15 @@ public:
/// \b True if \a name matches either name, \b false otherwise.
//----------------------------------------------------------------------
bool
- NameMatches (const ConstString &name) const
+ NameMatches (const ConstString &name, lldb::LanguageType language) const
{
if (m_mangled == name)
return true;
- return GetDemangledName () == name;
+ return GetDemangledName (language) == name;
}
bool
- NameMatches (const RegularExpression& regex) const;
+ NameMatches (const RegularExpression& regex, lldb::LanguageType language) const;
//----------------------------------------------------------------------
/// Get the memory cost of this object.
diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h
index 8acfa310deac..7da29e48299d 100644
--- a/include/lldb/Core/StructuredData.h
+++ b/include/lldb/Core/StructuredData.h
@@ -238,14 +238,15 @@ public:
{
}
- void
+ bool
ForEach (std::function <bool(Object* object)> const &foreach_callback) const
{
for (const auto &object_sp : m_items)
{
if (foreach_callback(object_sp.get()) == false)
- break;
+ return false;
}
+ return true;
}
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
index 9b1a02ca0a5c..a175e1a4d164 100644
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ b/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -18,6 +18,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/DataFormatters/VectorType.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
diff --git a/include/lldb/DataFormatters/VectorType.h b/include/lldb/DataFormatters/VectorType.h
index e69de29bb2d1..56d0c6d90ecd 100644
--- a/include/lldb/DataFormatters/VectorType.h
+++ b/include/lldb/DataFormatters/VectorType.h
@@ -0,0 +1,28 @@
+//===-- VectorType.h ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorType_h_
+#define liblldb_VectorType_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+ namespace formatters
+ {
+ bool
+ VectorTypeSummaryProvider (ValueObject&,
+ Stream&,
+ const TypeSummaryOptions&);
+
+ SyntheticChildrenFrontEnd*
+ VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
+ } // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_VectorType_h_
diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h
index dbea48148e14..a549f5e8a547 100644
--- a/include/lldb/Expression/ClangUserExpression.h
+++ b/include/lldb/Expression/ClangUserExpression.h
@@ -30,7 +30,7 @@
#include "lldb/Symbol/TaggedASTType.h"
#include "lldb/Target/ExecutionContext.h"
-namespace lldb_private
+namespace lldb_private
{
//----------------------------------------------------------------------
@@ -45,7 +45,7 @@ namespace lldb_private
class ClangUserExpression : public ClangExpression
{
public:
-
+
enum { kDefaultTimeout = 500000u };
//------------------------------------------------------------------
/// Constructor
@@ -59,7 +59,7 @@ public:
///
/// @param[in] language
/// If not eLanguageTypeUnknown, a language to use when parsing
- /// the expression. Currently restricted to those languages
+ /// the expression. Currently restricted to those languages
/// supported by Clang.
///
/// @param[in] desired_type
@@ -70,13 +70,13 @@ public:
const char *expr_prefix,
lldb::LanguageType language,
ResultType desired_type);
-
+
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
- virtual
+ virtual
~ClangUserExpression ();
-
+
//------------------------------------------------------------------
/// Parse the expression
///
@@ -92,28 +92,28 @@ public:
/// Determines whether interpretation is possible or mandatory.
///
/// @param[in] keep_result_in_memory
- /// True if the resulting persistent variable should reside in
+ /// True if the resulting persistent variable should reside in
/// target memory, if applicable.
///
/// @return
/// True on success (no errors); false otherwise.
//------------------------------------------------------------------
bool
- Parse (Stream &error_stream,
+ Parse (Stream &error_stream,
ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory,
bool generate_debug_info);
-
+
bool
CanInterpret ()
{
return m_can_interpret;
}
-
+
bool
MatchesContext (ExecutionContext &exe_ctx);
-
+
//------------------------------------------------------------------
/// Execute the parsed expression
///
@@ -131,9 +131,9 @@ public:
/// This is a shared pointer to this ClangUserExpression. This is
/// needed because Execute can push a thread plan that will hold onto
/// the ClangUserExpression for an unbounded period of time. So you
- /// need to give the thread plan a reference to this object that can
+ /// need to give the thread plan a reference to this object that can
/// keep it alive.
- ///
+ ///
/// @param[in] result
/// A pointer to direct at the persistent variable in which the
/// expression's result is stored.
@@ -147,7 +147,7 @@ public:
const EvaluateExpressionOptions& options,
lldb::ClangUserExpressionSP &shared_ptr_to_me,
lldb::ClangExpressionVariableSP &result);
-
+
//------------------------------------------------------------------
/// Apply the side effects of the function to program state.
///
@@ -157,7 +157,7 @@ public:
/// @param[in] exe_ctx
/// The execution context to use when looking up entities that
/// are needed for parsing (locations of variables, etc.)
- ///
+ ///
/// @param[in] result
/// A pointer to direct at the persistent variable in which the
/// expression's result is stored.
@@ -177,7 +177,7 @@ public:
lldb::ClangExpressionVariableSP &result,
lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS);
-
+
//------------------------------------------------------------------
/// Return the string that the parser should parse. Must be a full
/// translation unit.
@@ -187,7 +187,7 @@ public:
{
return m_transformed_text.c_str();
}
-
+
//------------------------------------------------------------------
/// Return the string that the user typed.
//------------------------------------------------------------------
@@ -196,7 +196,7 @@ public:
{
return m_expr_text.c_str();
}
-
+
//------------------------------------------------------------------
/// Return the function name that should be used for executing the
/// expression. Text() should contain the definition of this
@@ -207,7 +207,7 @@ public:
{
return "$__lldb_expr";
}
-
+
//------------------------------------------------------------------
/// Return the language that should be used when parsing. To use
/// the default, return eLanguageTypeUnknown.
@@ -217,7 +217,7 @@ public:
{
return m_language;
}
-
+
//------------------------------------------------------------------
/// Return the object that the parser should use when resolving external
/// values. May be NULL if everything should be self-contained.
@@ -227,7 +227,7 @@ public:
{
return m_expr_decl_map.get();
}
-
+
//------------------------------------------------------------------
/// Return the object that the parser should allow to access ASTs.
/// May be NULL if the ASTs do not need to be transformed.
@@ -238,9 +238,9 @@ public:
//------------------------------------------------------------------
clang::ASTConsumer *
ASTTransformer (clang::ASTConsumer *passthrough);
-
+
//------------------------------------------------------------------
- /// Return the desired result type of the function, or
+ /// Return the desired result type of the function, or
/// eResultTypeAny if indifferent.
//------------------------------------------------------------------
virtual ResultType
@@ -248,7 +248,7 @@ public:
{
return m_desired_type;
}
-
+
//------------------------------------------------------------------
/// Return true if validation code should be inserted into the
/// expression.
@@ -258,7 +258,7 @@ public:
{
return true;
}
-
+
//------------------------------------------------------------------
/// Return true if external variables in the expression should be
/// resolved.
@@ -302,15 +302,15 @@ public:
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp,
Error &error);
-
+
static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
private:
//------------------------------------------------------------------
/// Populate m_in_cplusplus_method and m_in_objectivec_method based on the environment.
//------------------------------------------------------------------
-
+
void
- ScanContext (ExecutionContext &exe_ctx,
+ ScanContext (ExecutionContext &exe_ctx,
lldb_private::Error &err);
bool
@@ -319,21 +319,21 @@ private:
lldb::addr_t &struct_address,
lldb::addr_t &object_ptr,
lldb::addr_t &cmd_ptr);
-
+
void
InstallContext (ExecutionContext &exe_ctx);
-
+
bool
LockAndCheckContext (ExecutionContext &exe_ctx,
lldb::TargetSP &target_sp,
lldb::ProcessSP &process_sp,
lldb::StackFrameSP &frame_sp);
-
+
lldb::ProcessWP m_process_wp; ///< The process used as the context for the expression.
Address m_address; ///< The address the process is stopped in.
lldb::addr_t m_stack_frame_bottom; ///< The bottom of the allocated stack frame.
lldb::addr_t m_stack_frame_top; ///< The top of the allocated stack frame.
-
+
std::string m_expr_text; ///< The text of the expression, as typed by the user
std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user
lldb::LanguageType m_language; ///< The language to use when parsing (eLanguageTypeUnknown means use defaults)
@@ -341,7 +341,7 @@ private:
bool m_allow_objc; ///< True if the language allows Objective-C.
std::string m_transformed_text; ///< The text of the expression, as send to the parser
ResultType m_desired_type; ///< The type to coerce the expression's result to. If eResultTypeAny, inferred from the expression.
-
+
std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map; ///< The map to use when parsing the expression.
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; ///< The execution unit the expression is stored in.
std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use when running the expression.
@@ -354,12 +354,12 @@ private:
bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and passed in. False if the expression doesn't really use them and they can be NULL.
bool m_const_object; ///< True if "this" is const.
Target *m_target; ///< The target for storing persistent data like types and variables.
-
+
bool m_can_interpret; ///< True if the expression could be evaluated statically; false otherwise.
lldb::addr_t m_materialized_address; ///< The address at which the arguments to the expression have been materialized.
Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
};
-
+
} // namespace lldb_private
#endif // liblldb_ClangUserExpression_h_
diff --git a/include/lldb/Expression/IRInterpreter.h b/include/lldb/Expression/IRInterpreter.h
index 5defa8dd2026..c314bf1099ea 100644
--- a/include/lldb/Expression/IRInterpreter.h
+++ b/include/lldb/Expression/IRInterpreter.h
@@ -44,7 +44,8 @@ public:
static bool
CanInterpret (llvm::Module &module,
llvm::Function &function,
- lldb_private::Error &error);
+ lldb_private::Error &error,
+ const bool support_function_calls);
static bool
Interpret (llvm::Module &module,
@@ -53,7 +54,8 @@ public:
lldb_private::IRMemoryMap &memory_map,
lldb_private::Error &error,
lldb::addr_t stack_frame_bottom,
- lldb::addr_t stack_frame_top);
+ lldb::addr_t stack_frame_top,
+ lldb_private::ExecutionContext &exe_ctx);
private:
static bool
diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h
index 0da8384c8e63..80add46ef0da 100644
--- a/include/lldb/Expression/IRMemoryMap.h
+++ b/include/lldb/Expression/IRMemoryMap.h
@@ -60,7 +60,7 @@ public:
void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Error &error);
void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Error &error);
void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Error &error);
-
+ bool GetAllocSize(lldb::addr_t address, size_t &size);
void GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Error &error);
lldb::ByteOrder GetByteOrder();
diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h
index caf33634057d..235367a7cc5c 100644
--- a/include/lldb/Host/Host.h
+++ b/include/lldb/Host/Host.h
@@ -244,8 +244,8 @@ public:
#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
#endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined(__NetBSD__)
- static const lldb_private::UnixSignalsSP&
- GetUnixSignals ();
+ static const lldb::UnixSignalsSP &
+ GetUnixSignals();
static Error
LaunchProcess (ProcessLaunchInfo &launch_info);
diff --git a/include/lldb/Host/MainLoop.h b/include/lldb/Host/MainLoop.h
new file mode 100644
index 000000000000..276538a336b6
--- /dev/null
+++ b/include/lldb/Host/MainLoop.h
@@ -0,0 +1,27 @@
+//===-- MainLoop.h ----------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_MainLoop_h_
+#define lldb_Host_MainLoop_h_
+
+#ifdef _WIN32
+#include "lldb/Host/MainLoopBase.h"
+namespace lldb_private
+{
+typedef MainLoopBase MainLoop;
+}
+#else
+#include "lldb/Host/posix/MainLoopPosix.h"
+namespace lldb_private
+{
+typedef MainLoopPosix MainLoop;
+}
+#endif
+
+#endif // lldb_Host_MainLoop_h_
diff --git a/include/lldb/Host/MainLoopBase.h b/include/lldb/Host/MainLoopBase.h
new file mode 100644
index 000000000000..bff2ce78110d
--- /dev/null
+++ b/include/lldb/Host/MainLoopBase.h
@@ -0,0 +1,94 @@
+//===-- MainLoopBase.h ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_MainLoopBase_h_
+#define lldb_Host_posix_MainLoopBase_h_
+
+#include <functional>
+
+#include "llvm/Support/ErrorHandling.h"
+
+#include "lldb/Core/Error.h"
+#include "lldb/Host/IOObject.h"
+
+namespace lldb_private {
+
+// The purpose of this class is to enable multiplexed processing of data from different sources
+// without resorting to multi-threading. Clients can register IOObjects, which will be monitored
+// for readability, and when they become ready, the specified callback will be invoked.
+// Monitoring for writability is not supported, but can be easily added if needed.
+//
+// The RegisterReadObject function return a handle, which controls the duration of the monitoring. When
+// this handle is destroyed, the callback is deregistered.
+//
+// This class simply defines the interface common for all platforms, actual implementations are
+// platform-specific.
+class MainLoopBase
+{
+private:
+ class ReadHandle;
+
+public:
+ MainLoopBase() { }
+ virtual ~MainLoopBase() { }
+
+ typedef std::unique_ptr<ReadHandle> ReadHandleUP;
+
+ typedef std::function<void(MainLoopBase &)> Callback;
+
+ virtual ReadHandleUP
+ RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Error &error)
+ { llvm_unreachable("Not implemented"); }
+
+ // Waits for registered events and invoke the proper callbacks. Returns when all callbacks
+ // deregister themselves or when someone requests termination.
+ virtual Error
+ Run()
+ { llvm_unreachable("Not implemented"); }
+
+ // Requests the exit of the Run() function.
+ virtual void
+ RequestTermination()
+ { llvm_unreachable("Not implemented"); }
+
+protected:
+ ReadHandleUP
+ CreateReadHandle(const lldb::IOObjectSP &object_sp)
+ { return ReadHandleUP(new ReadHandle(*this, object_sp)); }
+
+ virtual void
+ UnregisterReadObject(const lldb::IOObjectSP &object_sp)
+ { llvm_unreachable("Not implemented"); }
+
+private:
+ class ReadHandle
+ {
+ public:
+ ~ReadHandle() { m_mainloop.UnregisterReadObject(m_object_sp); }
+
+ private:
+ ReadHandle(MainLoopBase &mainloop, const lldb::IOObjectSP &object_sp)
+ : m_mainloop(mainloop), m_object_sp(object_sp)
+ { }
+
+ MainLoopBase &m_mainloop;
+ lldb::IOObjectSP m_object_sp;
+
+ friend class MainLoopBase;
+ DISALLOW_COPY_AND_ASSIGN(ReadHandle);
+ };
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
+};
+
+} // namespace lldb_private
+
+
+#endif // lldb_Host_posix_MainLoopBase_h_
diff --git a/include/lldb/Host/StringConvert.h b/include/lldb/Host/StringConvert.h
index 3cc260cf2be1..af5c2a08db87 100644
--- a/include/lldb/Host/StringConvert.h
+++ b/include/lldb/Host/StringConvert.h
@@ -39,6 +39,8 @@ ToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr
uint64_t
ToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
+double
+ToDouble (const char *s, double fail_value = 0.0, bool *success_ptr = nullptr);
} // namespace StringConvert
} // namespace lldb_private
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index f6a685aae147..4f0f3a962d32 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -35,8 +35,6 @@ namespace lldb_private
friend class SoftwareBreakpoint;
public:
- static NativeProcessProtocol *
- CreateInstance (lldb::pid_t pid);
// lldb_private::Host calls should be used to launch a process for debugging, and
// then the process should be attached to. When attaching to a process
@@ -44,7 +42,6 @@ namespace lldb_private
// and then this function should be called.
NativeProcessProtocol (lldb::pid_t pid);
- public:
virtual ~NativeProcessProtocol ()
{
}
@@ -297,6 +294,62 @@ namespace lldb_private
virtual Error
GetFileLoadAddress(const llvm::StringRef& file_name, lldb::addr_t& load_addr) = 0;
+ //------------------------------------------------------------------
+ /// Launch a process for debugging. This method will create an concrete
+ /// instance of NativeProcessProtocol, based on the host platform.
+ /// (e.g. NativeProcessLinux on linux, etc.)
+ ///
+ /// @param[in] launch_info
+ /// Information required to launch the process.
+ ///
+ /// @param[in] native_delegate
+ /// The delegate that will receive messages regarding the
+ /// inferior. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
+ /// @param[out] process_sp
+ /// On successful return from the method, this parameter
+ /// contains the shared pointer to the
+ /// NativeProcessProtocol that can be used to manipulate
+ /// the native process.
+ ///
+ /// @return
+ /// An error object indicating if the operation succeeded,
+ /// and if not, what error occurred.
+ //------------------------------------------------------------------
+ static Error
+ Launch (ProcessLaunchInfo &launch_info,
+ NativeDelegate &native_delegate,
+ NativeProcessProtocolSP &process_sp);
+
+ //------------------------------------------------------------------
+ /// Attach to an existing process. This method will create an concrete
+ /// instance of NativeProcessProtocol, based on the host platform.
+ /// (e.g. NativeProcessLinux on linux, etc.)
+ ///
+ /// @param[in] pid
+ /// pid of the process locatable
+ ///
+ /// @param[in] native_delegate
+ /// The delegate that will receive messages regarding the
+ /// inferior. Must outlive the NativeProcessProtocol
+ /// instance.
+ ///
+ /// @param[out] process_sp
+ /// On successful return from the method, this parameter
+ /// contains the shared pointer to the
+ /// NativeProcessProtocol that can be used to manipulate
+ /// the native process.
+ ///
+ /// @return
+ /// An error object indicating if the operation succeeded,
+ /// and if not, what error occurred.
+ //------------------------------------------------------------------
+ static Error
+ Attach (lldb::pid_t pid,
+ NativeDelegate &native_delegate,
+ NativeProcessProtocolSP &process_sp);
+
protected:
lldb::pid_t m_pid;
diff --git a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
index bcbb6014b116..2e0fd705b2a8 100644
--- a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
+++ b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -59,12 +59,7 @@ class ConnectionFileDescriptor : public Connection
bool InterruptRead() override;
lldb::IOObjectSP
- GetReadObject()
- {
- return m_read_sp;
- }
- const lldb::IOObjectSP
- GetReadObject() const
+ GetReadObject() override
{
return m_read_sp;
}
diff --git a/include/lldb/Host/posix/MainLoopPosix.h b/include/lldb/Host/posix/MainLoopPosix.h
new file mode 100644
index 000000000000..9a665ded295e
--- /dev/null
+++ b/include/lldb/Host/posix/MainLoopPosix.h
@@ -0,0 +1,100 @@
+//===-- MainLoopPosix.h -----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Host_posix_MainLoopPosix_h_
+#define lldb_Host_posix_MainLoopPosix_h_
+
+#include "lldb/Host/MainLoopBase.h"
+
+#include "llvm/ADT/DenseMap.h"
+
+namespace lldb_private {
+
+// Posix implementation of the MainLoopBase class. It can monitor file descriptors for
+// readability using pselect. In addition to the common base, this class provides the ability to
+// invoke a given handler when a signal is received.
+//
+// Since this class is primarily intended to be used for single-threaded processing, it does not
+// attempt to perform any internal synchronisation and any concurrent accesses must be protected
+// externally. However, it is perfectly legitimate to have more than one instance of this class
+// running on separate threads, or even a single thread (with some limitations on signal
+// monitoring).
+// TODO: Add locking if this class is to be used in a multi-threaded context.
+class MainLoopPosix: public MainLoopBase
+{
+private:
+ class SignalHandle;
+
+public:
+ typedef std::unique_ptr<SignalHandle> SignalHandleUP;
+
+ ~MainLoopPosix() override;
+
+ ReadHandleUP
+ RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Error &error) override;
+
+ // Listening for signals from multiple MainLoopPosix instances is perfectly safe as long as they
+ // don't try to listen for the same signal. The callback function is invoked when the control
+ // returns to the Run() function, not when the hander is executed. This means that you can
+ // treat the callback as a normal function and perform things which would not be safe in a
+ // signal handler. However, since the callback is not invoked synchronously, you cannot use
+ // this mechanism to handle SIGSEGV and the like.
+ SignalHandleUP
+ RegisterSignal(int signo, const Callback &callback, Error &error);
+
+ Error
+ Run() override;
+
+ // This should only be performed from a callback. Do not attempt to terminate the processing
+ // from another thread.
+ // TODO: Add synchronization if we want to be terminated from another thread.
+ void
+ RequestTermination() override
+ { m_terminate_request = true; }
+
+protected:
+ void
+ UnregisterReadObject(const lldb::IOObjectSP &object_sp) override;
+
+ void
+ UnregisterSignal(int signo);
+
+private:
+ class SignalHandle
+ {
+ public:
+ ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); }
+
+ private:
+ SignalHandle(MainLoopPosix &mainloop, int signo) : m_mainloop(mainloop), m_signo(signo) { }
+
+ MainLoopPosix &m_mainloop;
+ int m_signo;
+
+ friend class MainLoopPosix;
+ DISALLOW_COPY_AND_ASSIGN(SignalHandle);
+ };
+
+ struct SignalInfo
+ {
+ Callback callback;
+ struct sigaction old_action;
+ bool was_blocked : 1;
+ };
+
+ llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds;
+ llvm::DenseMap<int, SignalInfo> m_signals;
+ bool m_terminate_request : 1;
+};
+
+} // namespace lldb_private
+
+
+#endif // lldb_Host_posix_MainLoopPosix_h_
+
diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h
index c0901d5e3032..023de29c7b6c 100644
--- a/include/lldb/Interpreter/CommandObject.h
+++ b/include/lldb/Interpreter/CommandObject.h
@@ -161,6 +161,9 @@ public:
}
void
+ FormatLongHelpText (Stream &output_strm, const char *long_help);
+
+ void
GenerateHelpText (CommandReturnObject &result);
virtual void
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index 5954cf520d70..30c8f168e5f1 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -123,7 +123,7 @@ public:
/// @return
/// A const reference to the method name object.
//------------------------------------------------------------------
- const ConstString&
+ ConstString
GetName () const;
//------------------------------------------------------------------
@@ -240,11 +240,14 @@ public:
Dump(Stream *s, bool show_fullpaths) const;
void
- DumpStopContext (Stream *s) const;
+ DumpStopContext (Stream *s, lldb::LanguageType language) const;
- const ConstString &
- GetName () const;
+ ConstString
+ GetName (lldb::LanguageType language) const;
+ ConstString
+ GetDisplayName (lldb::LanguageType language) const;
+
//------------------------------------------------------------------
/// Get accessor for the call site declaration information.
///
@@ -437,6 +440,8 @@ public:
return m_range;
}
+ lldb::LanguageType
+ GetLanguage() const;
//------------------------------------------------------------------
/// Find the file and line number of the source location of the start
/// of the function. This will use the declaration if present and fall
@@ -524,11 +529,14 @@ public:
return m_frame_base;
}
- const ConstString &
- GetName() const
- {
- return m_mangled.GetName();
- }
+ ConstString
+ GetName() const;
+
+ ConstString
+ GetNameNoArguments () const;
+
+ ConstString
+ GetDisplayName () const;
const Mangled &
GetMangled() const
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index ad11563634ea..f9438b006c4e 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -152,18 +152,28 @@ public:
lldb::addr_t
ResolveCallableAddress(Target &target) const;
- const ConstString &
- GetName () const
- {
- return m_mangled.GetName();
- }
+ ConstString
+ GetName () const;
+
+ ConstString
+ GetNameNoArguments () const;
+ ConstString
+ GetDisplayName () const;
+
uint32_t
GetID() const
{
return m_uid;
}
+ lldb::LanguageType
+ GetLanguage() const
+ {
+ // TODO: See if there is a way to determine the language for a symbol somehow, for now just return our best guess
+ return m_mangled.GuessLanguage();
+ }
+
void
SetID(uint32_t uid)
{
diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h
index a345bcb8c23a..8d413cac3d7d 100644
--- a/include/lldb/Symbol/Variable.h
+++ b/include/lldb/Symbol/Variable.h
@@ -55,7 +55,7 @@ public:
return m_declaration;
}
- const ConstString&
+ ConstString
GetName() const;
SymbolContextScope *
@@ -70,12 +70,7 @@ public:
// function that can be called by commands and expression parsers to make
// sure we match anything we come across.
bool
- NameMatches (const ConstString &name) const
- {
- if (m_name == name)
- return true;
- return m_mangled.NameMatches (name);
- }
+ NameMatches (const ConstString &name) const;
bool
NameMatches (const RegularExpression& regex) const;
@@ -83,6 +78,9 @@ public:
Type *
GetType();
+ lldb::LanguageType
+ GetLanguage () const;
+
lldb::ValueType
GetScope() const
{
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index cfd214d28874..89d4f6bdba6c 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -39,10 +39,9 @@ public:
};
eType type; /* value of eType */
size_t size; /* size in bytes of this argument */
- union {
- lldb::addr_t value; /* literal value */
- uint8_t *data; /* host data pointer */
- };
+
+ lldb::addr_t value; /* literal value */
+ std::unique_ptr<uint8_t[]> data_ap; /* host data pointer */
};
virtual
@@ -58,7 +57,7 @@ public:
lldb::addr_t returnAddress,
llvm::ArrayRef<lldb::addr_t> args) const = 0;
- // Prepare trivial call used from ThreadPlanFunctionCallGDB
+ // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
// AD:
// . Because i don't want to change other ABI's this is not declared pure virtual.
// The dummy implementation will simply fail. Only HexagonABI will currently
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index 8f89e9b3cf5f..feaac57b128a 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -863,6 +863,12 @@ class ModuleCache;
return 1;
}
+ virtual const lldb::UnixSignalsSP &
+ GetRemoteUnixSignals();
+
+ const lldb::UnixSignalsSP &
+ GetUnixSignals();
+
//------------------------------------------------------------------
/// Locate a queue name given a thread's qaddr
///
@@ -939,65 +945,6 @@ class ModuleCache;
virtual const std::vector<ConstString> &
GetTrapHandlerSymbolNames ();
- //------------------------------------------------------------------
- /// Launch a process for debugging.
- ///
- /// This differs from Launch in that it returns a NativeProcessProtocol.
- /// Currently used by lldb-gdbserver.
- ///
- /// @param[in] launch_info
- /// Information required to launch the process.
- ///
- /// @param[in] native_delegate
- /// The delegate that will receive messages regarding the
- /// inferior. Must outlive the NativeProcessProtocol
- /// instance.
- ///
- /// @param[out] process_sp
- /// On successful return from the method, this parameter
- /// contains the shared pointer to the
- /// NativeProcessProtocol that can be used to manipulate
- /// the native process.
- ///
- /// @return
- /// An error object indicating if the operation succeeded,
- /// and if not, what error occurred.
- //------------------------------------------------------------------
- virtual Error
- LaunchNativeProcess (
- ProcessLaunchInfo &launch_info,
- lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
- NativeProcessProtocolSP &process_sp);
-
- //------------------------------------------------------------------
- /// Attach to an existing process on the given platform.
- ///
- /// This method differs from Attach() in that it returns a
- /// NativeProcessProtocol. Currently this is used by lldb-gdbserver.
- ///
- /// @param[in] pid
- /// pid of the process locatable by the platform.
- ///
- /// @param[in] native_delegate
- /// The delegate that will receive messages regarding the
- /// inferior. Must outlive the NativeProcessProtocol
- /// instance.
- ///
- /// @param[out] process_sp
- /// On successful return from the method, this parameter
- /// contains the shared pointer to the
- /// NativeProcessProtocol that can be used to manipulate
- /// the native process.
- ///
- /// @return
- /// An error object indicating if the operation succeeded,
- /// and if not, what error occurred.
- //------------------------------------------------------------------
- virtual Error
- AttachNativeProcess (lldb::pid_t pid,
- lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
- NativeProcessProtocolSP &process_sp);
-
protected:
bool m_is_host;
// Set to true when we are able to actually set the OS version while
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index db0f0cfa028b..f75b3cd5683d 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -30,6 +30,7 @@
#include "lldb/Core/Event.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Breakpoint/BreakpointSiteList.h"
#include "lldb/Host/HostThread.h"
@@ -949,7 +950,7 @@ public:
/// Construct with a shared pointer to a target, the Process listener,
/// and the appropriate UnixSignalsSP for the process.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener, const UnixSignalsSP &unix_signals_sp);
+ Process(Target &target, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
//------------------------------------------------------------------
/// Destructor.
@@ -1401,10 +1402,10 @@ public:
Signal (int signal);
void
- SetUnixSignals (const UnixSignalsSP &signals_sp);
+ SetUnixSignals(const lldb::UnixSignalsSP &signals_sp);
- UnixSignals &
- GetUnixSignals ();
+ const lldb::UnixSignalsSP &
+ GetUnixSignals();
//==================================================================
// Plug-in Process Control Overrides
@@ -1887,6 +1888,37 @@ public:
virtual void
ModulesDidLoad (ModuleList &module_list);
+
+ //------------------------------------------------------------------
+ /// Retrieve the list of shared libraries that are loaded for this process
+ ///
+ /// For certain platforms, the time it takes for the DynamicLoader plugin to
+ /// read all of the shared libraries out of memory over a slow communication
+ /// channel may be too long. In that instance, the gdb-remote stub may be
+ /// able to retrieve the necessary information about the solibs out of memory
+ /// and return a concise summary sufficient for the DynamicLoader plugin.
+ ///
+ /// @param [in] image_list_address
+ /// The address where the table of shared libraries is stored in memory,
+ /// if that is appropriate for this platform. Else this may be
+ /// passed as LLDB_INVALID_ADDRESS.
+ ///
+ /// @param [in] image_count
+ /// The number of shared libraries that are present in this process, if
+ /// that is appropriate for this platofrm Else this may be passed as
+ /// LLDB_INVALID_ADDRESS.
+ ///
+ /// @return
+ /// A StructureDataSP object which, if non-empty, will contain the
+ /// information the DynamicLoader needs to get the initial scan of
+ /// solibs resolved.
+ //------------------------------------------------------------------
+ virtual lldb_private::StructuredData::ObjectSP
+ GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_address, lldb::addr_t image_count)
+ {
+ return StructuredData::ObjectSP();
+ }
+
protected:
void
@@ -2439,8 +2471,41 @@ public:
/// True if execution of JIT code is possible; false otherwise.
//------------------------------------------------------------------
void SetCanJIT (bool can_jit);
+
+ //------------------------------------------------------------------
+ /// Determines whether executing function calls using the interpreter
+ /// is possible for this process.
+ ///
+ /// @return
+ /// True if possible; false otherwise.
+ //------------------------------------------------------------------
+ bool CanInterpretFunctionCalls ()
+ {
+ return m_can_interpret_function_calls;
+ }
//------------------------------------------------------------------
+ /// Sets whether executing function calls using the interpreter
+ /// is possible for this process.
+ ///
+ /// @param[in] can_interpret_function_calls
+ /// True if possible; false otherwise.
+ //------------------------------------------------------------------
+ void SetCanInterpretFunctionCalls (bool can_interpret_function_calls)
+ {
+ m_can_interpret_function_calls = can_interpret_function_calls;
+ }
+
+ //------------------------------------------------------------------
+ /// Sets whether executing code in this process is possible.
+ /// This could be either through JIT or interpreting.
+ ///
+ /// @param[in] can_run_code
+ /// True if execution of code is possible; false otherwise.
+ //------------------------------------------------------------------
+ void SetCanRunCode (bool can_run_code);
+
+ //------------------------------------------------------------------
/// Actually deallocate memory in the process.
///
/// This function will deallocate memory in the process's address
@@ -3205,7 +3270,7 @@ protected:
lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
lldb::OperatingSystemUP m_os_ap;
lldb::SystemRuntimeUP m_system_runtime_ap;
- UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
+ lldb::UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
lldb::ABISP m_abi_sp;
lldb::IOHandlerSP m_process_input_reader;
Communication m_stdio_communication;
@@ -3236,6 +3301,7 @@ protected:
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;
bool m_destroy_in_process;
+ bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, don't support the ability to modify the stack.
enum {
eCanJITDontKnow= 0,
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 12200ab76553..36e4d6e71c79 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -34,6 +34,10 @@ public:
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options);
+ ThreadPlanCallFunction(Thread &thread,
+ const Address &function,
+ const EvaluateExpressionOptions &options);
+
virtual
~ThreadPlanCallFunction ();
@@ -134,7 +138,8 @@ protected:
virtual bool
DoPlanExplainsStop (Event *event_ptr);
-private:
+ virtual void
+ SetReturnValue();
bool
ConstructorSetup (Thread &thread,
@@ -153,7 +158,7 @@ private:
bool
BreakpointsExplainStop ();
-
+
bool m_valid;
bool m_stop_other_threads;
bool m_unwind_on_error;
@@ -172,13 +177,14 @@ private:
// it's nice to know the real stop reason.
// This gets set in DoTakedown.
StreamString m_constructor_errors;
- ClangASTType m_return_type;
lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, use the ABI to extract values when complete
bool m_takedown_done; // We want to ensure we only do the takedown once. This ensures that.
bool m_should_clear_objc_exception_bp;
bool m_should_clear_cxx_exception_bp;
lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown;
+private:
+ ClangASTType m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};
diff --git a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
new file mode 100644
index 000000000000..83d78a5dca08
--- /dev/null
+++ b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -0,0 +1,58 @@
+//===-- ThreadPlanCallFunctionUsingABI.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanCallFunctionUsingABI_h_
+#define liblldb_ThreadPlanCallFunctionUsingABI_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanCallFunction.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/IR/Type.h"
+
+namespace lldb_private {
+
+class ThreadPlanCallFunctionUsingABI : public ThreadPlanCallFunction
+{
+ // Create a thread plan to call a function at the address passed in the "function"
+ // argument, this function is executed using register manipulation instead of JIT.
+ // Class derives from ThreadPlanCallFunction and differs by calling a alternative
+ // ABI interface ABI::PrepareTrivialCall() which provides more detailed information.
+public:
+ ThreadPlanCallFunctionUsingABI (Thread &thread,
+ const Address &function_address,
+ llvm::Type &function_prototype,
+ llvm::Type &return_type,
+ llvm::ArrayRef<ABI::CallArgument> args,
+ const EvaluateExpressionOptions &options);
+
+ ~ThreadPlanCallFunctionUsingABI ();
+
+ void
+ GetDescription (Stream *s, lldb::DescriptionLevel level) override;
+
+protected:
+ void
+ SetReturnValue () override;
+
+
+private:
+ llvm::Type &m_return_type;
+ DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunctionUsingABI);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h
index f47a90bbf545..76955deabc78 100644
--- a/include/lldb/Target/UnixSignals.h
+++ b/include/lldb/Target/UnixSignals.h
@@ -26,6 +26,9 @@ namespace lldb_private
class UnixSignals
{
public:
+ static lldb::UnixSignalsSP
+ Create(const ArchSpec &arch);
+
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
@@ -89,6 +92,12 @@ public:
int32_t
GetNextSignalNumber (int32_t current_signal) const;
+ int32_t
+ GetNumSignals() const;
+
+ int32_t
+ GetSignalAtIndex(int32_t index) const;
+
// We assume that the elements of this object are constant once it is constructed,
// since a process should never need to add or remove symbols as it runs. So don't
// call these functions anywhere but the constructor of your subclass of UnixSignals or in
@@ -130,14 +139,18 @@ protected:
~Signal () {}
};
- void
+ virtual void
Reset ();
typedef std::map <int32_t, Signal> collection;
collection m_signals;
- DISALLOW_COPY_AND_ASSIGN (UnixSignals);
+ // GDBRemote signals need to be copyable.
+ UnixSignals(const UnixSignals &rhs);
+
+ const UnixSignals &
+ operator=(const UnixSignals &rhs) = delete;
};
} // Namespace lldb
diff --git a/include/lldb/Utility/JSON.h b/include/lldb/Utility/JSON.h
index 45ddb71b5e03..da5e26dbda28 100644
--- a/include/lldb/Utility/JSON.h
+++ b/include/lldb/Utility/JSON.h
@@ -11,6 +11,7 @@
#define utility_JSON_h_
#include "lldb/Core/Stream.h"
+#include "lldb/Utility/StringExtractor.h"
#include <inttypes.h>
#include <map>
@@ -22,6 +23,7 @@
#include "llvm/Support/Casting.h"
namespace lldb_private {
+
class JSONValue
{
public:
@@ -97,8 +99,9 @@ namespace lldb_private {
{
public:
JSONNumber ();
- JSONNumber (int64_t i);
-
+ explicit JSONNumber (uint64_t i);
+ explicit JSONNumber (double d);
+
JSONNumber (const JSONNumber& s) = delete;
JSONNumber&
operator = (const JSONNumber& s) = delete;
@@ -107,10 +110,19 @@ namespace lldb_private {
Write (Stream& s);
typedef std::shared_ptr<JSONNumber> SP;
-
- int64_t
+
+ uint64_t
GetData () { return m_data; }
-
+
+ double
+ GetAsDouble()
+ {
+ if (m_is_integer)
+ return (double)m_data;
+ else
+ return m_double;
+ }
+
static bool classof(const JSONValue *V)
{
return V->GetKind() == JSONValue::Kind::Number;
@@ -120,7 +132,9 @@ namespace lldb_private {
~JSONNumber () = default;
private:
- int64_t m_data;
+ bool m_is_integer;
+ uint64_t m_data;
+ double m_double;
};
class JSONTrue : public JSONValue
@@ -271,6 +285,48 @@ namespace lldb_private {
Vector m_elements;
};
+
+
+ class JSONParser : public StringExtractor
+ {
+ public:
+ enum Token
+ {
+ Invalid,
+ Error,
+ ObjectStart,
+ ObjectEnd,
+ ArrayStart,
+ ArrayEnd,
+ Comma,
+ Colon,
+ String,
+ Integer,
+ Float,
+ True,
+ False,
+ Null,
+ EndOfFile
+ };
+
+ JSONParser (const char *cstr);
+
+ int
+ GetEscapedChar (bool &was_escaped);
+
+ Token
+ GetToken (std::string &value);
+
+ JSONValue::SP
+ ParseJSONValue ();
+
+ protected:
+ JSONValue::SP
+ ParseJSONObject ();
+
+ JSONValue::SP
+ ParseJSONArray ();
+ };
}
#endif // utility_ProcessStructReader_h_
diff --git a/include/lldb/Utility/StringExtractor.h b/include/lldb/Utility/StringExtractor.h
new file mode 100644
index 000000000000..0f2dbb166be1
--- /dev/null
+++ b/include/lldb/Utility/StringExtractor.h
@@ -0,0 +1,176 @@
+//===-- StringExtractor.h ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef utility_StringExtractor_h_
+#define utility_StringExtractor_h_
+
+// C Includes
+// C++ Includes
+#include <string>
+#include <stdint.h>
+
+// Other libraries and framework includes
+// Project includes
+
+class StringExtractor
+{
+public:
+
+ enum {
+ BigEndian = 0,
+ LittleEndian = 1
+ };
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ StringExtractor();
+ StringExtractor(const char *packet_cstr);
+ StringExtractor(const StringExtractor& rhs);
+ virtual ~StringExtractor();
+
+ //------------------------------------------------------------------
+ // Operators
+ //------------------------------------------------------------------
+ const StringExtractor&
+ operator=(const StringExtractor& rhs);
+
+ // Returns true if the file position is still valid for the data
+ // contained in this string extractor object.
+ bool
+ IsGood() const
+ {
+ return m_index != UINT64_MAX;
+ }
+
+ uint64_t
+ GetFilePos () const
+ {
+ return m_index;
+ }
+
+ void
+ SetFilePos (uint32_t idx)
+ {
+ m_index = idx;
+ }
+
+ void
+ Clear ()
+ {
+ m_packet.clear();
+ m_index = 0;
+ }
+
+ void
+ SkipSpaces ();
+
+ std::string &
+ GetStringRef ()
+ {
+ return m_packet;
+ }
+
+ const std::string &
+ GetStringRef () const
+ {
+ return m_packet;
+ }
+
+ bool
+ Empty()
+ {
+ return m_packet.empty();
+ }
+
+ size_t
+ GetBytesLeft ()
+ {
+ if (m_index < m_packet.size())
+ return m_packet.size() - m_index;
+ return 0;
+ }
+
+ char
+ GetChar (char fail_value = '\0');
+
+ char
+ PeekChar (char fail_value = '\0')
+ {
+ const char *cstr = Peek();
+ if (cstr)
+ return cstr[0];
+ return fail_value;
+ }
+
+ int
+ DecodeHexU8();
+
+ uint8_t
+ GetHexU8 (uint8_t fail_value = 0, bool set_eof_on_fail = true);
+
+ bool
+ GetNameColonValue (std::string &name, std::string &value);
+
+ int32_t
+ GetS32 (int32_t fail_value, int base = 0);
+
+ uint32_t
+ GetU32 (uint32_t fail_value, int base = 0);
+
+ int64_t
+ GetS64 (int64_t fail_value, int base = 0);
+
+ uint64_t
+ GetU64 (uint64_t fail_value, int base = 0);
+
+ uint32_t
+ GetHexMaxU32 (bool little_endian, uint32_t fail_value);
+
+ uint64_t
+ GetHexMaxU64 (bool little_endian, uint64_t fail_value);
+
+ size_t
+ GetHexBytes (void *dst, size_t dst_len, uint8_t fail_fill_value);
+
+ size_t
+ GetHexBytesAvail (void *dst, size_t dst_len);
+
+ uint64_t
+ GetHexWithFixedSize (uint32_t byte_size, bool little_endian, uint64_t fail_value);
+
+ size_t
+ GetHexByteString (std::string &str);
+
+ size_t
+ GetHexByteStringFixedLength (std::string &str, uint32_t nibble_length);
+
+ size_t
+ GetHexByteStringTerminatedBy (std::string &str,
+ char terminator);
+
+ const char *
+ Peek ()
+ {
+ if (m_index < m_packet.size())
+ return m_packet.c_str() + m_index;
+ return nullptr;
+ }
+
+protected:
+ //------------------------------------------------------------------
+ // For StringExtractor only
+ //------------------------------------------------------------------
+ std::string m_packet; // The string in which to extract data.
+ uint64_t m_index; // When extracting data from a packet, this index
+ // will march along as things get extracted. If set
+ // to UINT64_MAX the end of the packet data was
+ // reached when decoding information
+};
+
+#endif // utility_StringExtractor_h_
diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h
index e0c2ae4b8b8d..da90ac4775ee 100644
--- a/include/lldb/lldb-forward.h
+++ b/include/lldb/lldb-forward.h
@@ -423,6 +423,8 @@ namespace lldb {
#ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren> ScriptedSyntheticChildrenSP;
#endif
+ typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP;
+ typedef std::weak_ptr<lldb_private::UnixSignals> UnixSignalsWP;
typedef std::shared_ptr<lldb_private::UnwindAssembly> UnwindAssemblySP;
typedef std::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
diff --git a/include/lldb/lldb-private-forward.h b/include/lldb/lldb-private-forward.h
index 424aa4cc53f4..bcfeb68b0b25 100644
--- a/include/lldb/lldb-private-forward.h
+++ b/include/lldb/lldb-private-forward.h
@@ -34,7 +34,6 @@ namespace lldb_private
typedef std::weak_ptr<lldb_private::NativeProcessProtocol> NativeProcessProtocolWP;
typedef std::shared_ptr<lldb_private::NativeRegisterContext> NativeRegisterContextSP;
typedef std::shared_ptr<lldb_private::NativeThreadProtocol> NativeThreadProtocolSP;
- typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP;
}
#endif // #if defined(__cplusplus)