aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Target
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
commite81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch)
tree9ed5e1a91f242e2cb5911577356e487a55c01b78 /include/lldb/Target
parent85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff)
downloadsrc-e81d9d49145e432d917eea3a70d2ae74dcad1d89.tar.gz
src-e81d9d49145e432d917eea3a70d2ae74dcad1d89.zip
Vendor import of stripped lldb trunk r256633:
Notes
Notes: svn path=/vendor/lldb/dist/; revision=292932
Diffstat (limited to 'include/lldb/Target')
-rw-r--r--include/lldb/Target/ABI.h12
-rw-r--r--include/lldb/Target/CPPLanguageRuntime.h130
-rw-r--r--include/lldb/Target/DynamicLoader.h21
-rw-r--r--include/lldb/Target/ExecutionContext.h111
-rw-r--r--include/lldb/Target/InstrumentationRuntimeStopInfo.h19
-rw-r--r--include/lldb/Target/JITLoader.h3
-rw-r--r--include/lldb/Target/Language.h206
-rw-r--r--include/lldb/Target/LanguageRuntime.h50
-rw-r--r--include/lldb/Target/ObjCLanguageRuntime.h269
-rw-r--r--include/lldb/Target/OperatingSystem.h6
-rw-r--r--include/lldb/Target/Platform.h280
-rw-r--r--include/lldb/Target/Process.h550
-rw-r--r--include/lldb/Target/QueueItem.h20
-rw-r--r--include/lldb/Target/RegisterContext.h28
-rw-r--r--include/lldb/Target/SectionLoadList.h1
-rw-r--r--include/lldb/Target/StackFrame.h58
-rw-r--r--include/lldb/Target/StackFrameList.h22
-rw-r--r--include/lldb/Target/StackID.h20
-rw-r--r--include/lldb/Target/StopInfo.h4
-rw-r--r--include/lldb/Target/SystemRuntime.h6
-rw-r--r--include/lldb/Target/Target.h351
-rw-r--r--include/lldb/Target/TargetList.h28
-rw-r--r--include/lldb/Target/Thread.h164
-rw-r--r--include/lldb/Target/ThreadList.h10
-rw-r--r--include/lldb/Target/ThreadPlan.h54
-rw-r--r--include/lldb/Target/ThreadPlanBase.h32
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h77
-rw-r--r--include/lldb/Target/ThreadPlanCallFunctionUsingABI.h5
-rw-r--r--include/lldb/Target/ThreadPlanCallUserExpression.h31
-rw-r--r--include/lldb/Target/ThreadPlanPython.h48
-rw-r--r--include/lldb/Target/ThreadPlanRunToAddress.h43
-rw-r--r--include/lldb/Target/ThreadPlanShouldStopHere.h16
-rw-r--r--include/lldb/Target/ThreadPlanStepInRange.h26
-rw-r--r--include/lldb/Target/ThreadPlanStepInstruction.h24
-rw-r--r--include/lldb/Target/ThreadPlanStepOut.h33
-rw-r--r--include/lldb/Target/ThreadPlanStepOverBreakpoint.h35
-rw-r--r--include/lldb/Target/ThreadPlanStepOverRange.h23
-rw-r--r--include/lldb/Target/ThreadPlanStepRange.h28
-rw-r--r--include/lldb/Target/ThreadPlanStepThrough.h26
-rw-r--r--include/lldb/Target/ThreadPlanStepUntil.h28
-rw-r--r--include/lldb/Target/ThreadPlanTracer.h23
-rw-r--r--include/lldb/Target/ThreadSpec.h14
-rw-r--r--include/lldb/Target/UnixSignals.h13
-rw-r--r--include/lldb/Target/UnwindAssembly.h7
44 files changed, 1607 insertions, 1348 deletions
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index 89d4f6bdba6c..94826d173500 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -44,8 +44,7 @@ public:
std::unique_ptr<uint8_t[]> data_ap; /* host data pointer */
};
- virtual
- ~ABI();
+ ~ABI() override;
virtual size_t
GetRedZoneSize () const = 0;
@@ -78,7 +77,7 @@ public:
lldb::ValueObjectSP
GetReturnValueObject (Thread &thread,
- ClangASTType &type,
+ CompilerType &type,
bool persistent = true) const;
// specialized to work with llvm IR types
@@ -95,7 +94,7 @@ protected:
// This is the method the ABI will call to actually calculate the return value.
// Don't put it in a persistent value object, that will be done by the ABI::GetReturnValueObject.
virtual lldb::ValueObjectSP
- GetReturnValueObjectImpl (Thread &thread, ClangASTType &ast_type) const = 0;
+ GetReturnValueObjectImpl (Thread &thread, CompilerType &ast_type) const = 0;
// specialized to work with llvm IR types
virtual lldb::ValueObjectSP
@@ -148,14 +147,17 @@ public:
FindPlugin (const ArchSpec &arch);
protected:
+
//------------------------------------------------------------------
// Classes that inherit from ABI can see and modify these
//------------------------------------------------------------------
ABI();
+
private:
+
DISALLOW_COPY_AND_ASSIGN (ABI);
};
} // namespace lldb_private
-#endif // liblldb_ABI_h_
+#endif // liblldb_ABI_h_
diff --git a/include/lldb/Target/CPPLanguageRuntime.h b/include/lldb/Target/CPPLanguageRuntime.h
index 3e51453566b3..ac537d0ad1e5 100644
--- a/include/lldb/Target/CPPLanguageRuntime.h
+++ b/include/lldb/Target/CPPLanguageRuntime.h
@@ -25,100 +25,10 @@ class CPPLanguageRuntime :
public LanguageRuntime
{
public:
+ ~CPPLanguageRuntime() override;
- class MethodName
- {
- public:
- enum Type
- {
- eTypeInvalid,
- eTypeUnknownMethod,
- eTypeClassMethod,
- eTypeInstanceMethod
- };
-
- MethodName () :
- m_full(),
- m_basename(),
- m_context(),
- m_arguments(),
- m_qualifiers(),
- m_type (eTypeInvalid),
- m_parsed (false),
- m_parse_error (false)
- {
- }
-
- MethodName (const ConstString &s) :
- m_full(s),
- m_basename(),
- m_context(),
- m_arguments(),
- m_qualifiers(),
- m_type (eTypeInvalid),
- m_parsed (false),
- m_parse_error (false)
- {
- }
-
- void
- Clear();
-
- bool
- IsValid ()
- {
- if (!m_parsed)
- Parse();
- if (m_parse_error)
- return false;
- if (m_type == eTypeInvalid)
- return false;
- return (bool)m_full;
- }
-
- Type
- GetType () const
- {
- return m_type;
- }
-
- const ConstString &
- GetFullName () const
- {
- return m_full;
- }
-
- llvm::StringRef
- GetBasename ();
-
- llvm::StringRef
- GetContext ();
-
- llvm::StringRef
- GetArguments ();
-
- llvm::StringRef
- GetQualifiers ();
-
- protected:
- void
- Parse();
-
- ConstString m_full; // Full name: "lldb::SBTarget::GetBreakpointAtIndex(unsigned int) const"
- llvm::StringRef m_basename; // Basename: "GetBreakpointAtIndex"
- llvm::StringRef m_context; // Decl context: "lldb::SBTarget"
- llvm::StringRef m_arguments; // Arguments: "(unsigned int)"
- llvm::StringRef m_qualifiers; // Qualifiers: "const"
- Type m_type;
- bool m_parsed;
- bool m_parse_error;
- };
-
- virtual
- ~CPPLanguageRuntime();
-
- virtual lldb::LanguageType
- GetLanguageType () const
+ lldb::LanguageType
+ GetLanguageType() const override
{
return lldb::eLanguageTypeC_plus_plus;
}
@@ -126,45 +36,27 @@ public:
virtual bool
IsVTableName (const char *name) = 0;
- virtual bool
- GetObjectDescription (Stream &str, ValueObject &object);
-
- virtual bool
- GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
+ bool
+ GetObjectDescription(Stream &str, ValueObject &object) override;
- static bool
- IsCPPMangledName(const char *name);
-
- // Extract C++ context and identifier from a string using heuristic matching (as opposed to
- // CPPLanguageRuntime::MethodName which has to have a fully qualified C++ name with parens and arguments.
- // If the name is a lone C identifier (e.g. C) or a qualified C identifier (e.g. A::B::C) it will return true,
- // and identifier will be the identifier (C and C respectively) and the context will be "" and "A::B::" respectively.
- // If the name fails the heuristic matching for a qualified or unqualified C/C++ identifier, then it will return false
- // and identifier and context will be unchanged.
-
- static bool
- ExtractContextAndIdentifier (const char *name, llvm::StringRef &context, llvm::StringRef &identifier);
+ bool
+ GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override;
- // in some cases, compilers will output different names for one same type. when that happens, it might be impossible
- // to construct SBType objects for a valid type, because the name that is available is not the same as the name that
- // can be used as a search key in FindTypes(). the equivalents map here is meant to return possible alternative names
- // for a type through which a search can be conducted. Currently, this is only enabled for C++ but can be extended
- // to ObjC or other languages if necessary
- static uint32_t
- FindEquivalentNames(ConstString type_name, std::vector<ConstString>& equivalents);
-
virtual size_t
GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates) = 0;
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_
+#endif // liblldb_CPPLanguageRuntime_h_
diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h
index 6652a5ec144f..5eada0342a21 100644
--- a/include/lldb/Target/DynamicLoader.h
+++ b/include/lldb/Target/DynamicLoader.h
@@ -71,8 +71,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~DynamicLoader ();
+ ~DynamicLoader() override;
//------------------------------------------------------------------
/// Called after attaching a process.
@@ -264,12 +263,14 @@ protected:
virtual void
UpdateLoadedSections(lldb::ModuleSP module,
lldb::addr_t link_map_addr,
- lldb::addr_t base_addr);
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
// Utility method so base classes can share implementation of UpdateLoadedSections
void
UpdateLoadedSectionsCommon(lldb::ModuleSP module,
- lldb::addr_t base_addr);
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
/// Removes the loaded sections from the target in @p module.
///
@@ -283,8 +284,11 @@ protected:
/// Locates or creates a module given by @p file and updates/loads the
/// resulting module at the virtual base address @p base_addr.
- lldb::ModuleSP
- LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr);
+ virtual lldb::ModuleSP
+ LoadModuleAtAddress(const lldb_private::FileSpec &file,
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset);
const lldb_private::SectionList *
GetSectionListFromModule(const lldb::ModuleSP module) const;
@@ -303,11 +307,12 @@ protected:
// Member variables.
//------------------------------------------------------------------
Process* m_process; ///< The process that this dynamic loader plug-in is tracking.
+
private:
- DISALLOW_COPY_AND_ASSIGN (DynamicLoader);
+ DISALLOW_COPY_AND_ASSIGN (DynamicLoader);
};
} // namespace lldb_private
-#endif // liblldb_DynamicLoader_h_
+#endif // liblldb_DynamicLoader_h_
diff --git a/include/lldb/Target/ExecutionContext.h b/include/lldb/Target/ExecutionContext.h
index 50f2beaf949b..cdf55e3b744c 100644
--- a/include/lldb/Target/ExecutionContext.h
+++ b/include/lldb/Target/ExecutionContext.h
@@ -6,6 +6,21 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ExecutionContext_h_
+#define liblldb_ExecutionContext_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Target/StackID.h"
+#include "lldb/Host/Mutex.h"
+
+namespace lldb_private {
+
+//===----------------------------------------------------------------------===//
/// Execution context objects refer to objects in the execution of the
/// program that is being debugged. The consist of one or more of the
/// following objects: target, process, thread, and frame. Many objects
@@ -30,17 +45,6 @@
/// to a wide variety of functions that require execution contexts.
//===----------------------------------------------------------------------===//
-
-
-#ifndef liblldb_ExecutionContext_h_
-#define liblldb_ExecutionContext_h_
-
-#include "lldb/lldb-private.h"
-#include "lldb/Target/StackID.h"
-#include "lldb/Host/Mutex.h"
-
-namespace lldb_private {
-
//----------------------------------------------------------------------
/// @class ExecutionContextRef ExecutionContext.h "lldb/Target/ExecutionContext.h"
/// @brief A class that holds a weak reference to an execution context.
@@ -86,7 +90,7 @@ public:
ExecutionContextRef (const ExecutionContextRef &rhs);
//------------------------------------------------------------------
- /// Construct using an ExecutionContext object that might be NULL.
+ /// Construct using an ExecutionContext object that might be nullptr.
///
/// If \a exe_ctx_ptr is valid, then make weak references to any
/// valid objects in the ExecutionContext, otherwise no weak
@@ -102,22 +106,6 @@ public:
ExecutionContextRef (const ExecutionContext &exe_ctx);
//------------------------------------------------------------------
- /// Assignment operator
- ///
- /// Copy all weak references in \a rhs.
- //------------------------------------------------------------------
- ExecutionContextRef &
- operator =(const ExecutionContextRef &rhs);
-
- //------------------------------------------------------------------
- /// Assignment operator from a ExecutionContext
- ///
- /// Make weak references to any strongly referenced objects in \a exe_ctx.
- //------------------------------------------------------------------
- ExecutionContextRef &
- operator =(const ExecutionContext &exe_ctx);
-
- //------------------------------------------------------------------
/// Construct using the target and all the selected items inside of it
/// (the process and its selected thread, and the thread's selected
/// frame). If there is no selected thread, default to the first thread
@@ -154,10 +142,27 @@ public:
ExecutionContextRef (ExecutionContextScope &exe_scope);
~ExecutionContextRef();
+
+ //------------------------------------------------------------------
+ /// Assignment operator
+ ///
+ /// Copy all weak references in \a rhs.
+ //------------------------------------------------------------------
+ ExecutionContextRef &
+ operator =(const ExecutionContextRef &rhs);
+
+ //------------------------------------------------------------------
+ /// Assignment operator from a ExecutionContext
+ ///
+ /// Make weak references to any strongly referenced objects in \a exe_ctx.
+ //------------------------------------------------------------------
+ ExecutionContextRef &
+ operator =(const ExecutionContext &exe_ctx);
+
//------------------------------------------------------------------
/// Clear the object's state.
///
- /// Sets the process and thread to NULL, and the frame index to an
+ /// Sets the process and thread to nullptr, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void
@@ -394,6 +399,7 @@ public:
ExecutionContext (const lldb::ProcessSP &process_sp);
ExecutionContext (const lldb::ThreadSP &thread_sp);
ExecutionContext (const lldb::StackFrameSP &frame_sp);
+
//------------------------------------------------------------------
// Create execution contexts from weak pointers
//------------------------------------------------------------------
@@ -413,16 +419,6 @@ public:
//------------------------------------------------------------------
ExecutionContext (ExecutionContextScope *exe_scope);
ExecutionContext (ExecutionContextScope &exe_scope);
-
-
- ExecutionContext &
- operator =(const ExecutionContext &rhs);
-
- bool
- operator ==(const ExecutionContext &rhs) const;
-
- bool
- operator !=(const ExecutionContext &rhs) const;
//------------------------------------------------------------------
/// Construct with process, thread, and frame index.
@@ -438,16 +434,26 @@ public:
/// @param[in] frame
/// The frame index for this execution context.
//------------------------------------------------------------------
- ExecutionContext (Process* process,
- Thread *thread = NULL,
- StackFrame * frame = NULL);
+ ExecutionContext(Process* process,
+ Thread *thread = nullptr,
+ StackFrame * frame = nullptr);
~ExecutionContext();
+
+ ExecutionContext &
+ operator =(const ExecutionContext &rhs);
+
+ bool
+ operator ==(const ExecutionContext &rhs) const;
+
+ bool
+ operator !=(const ExecutionContext &rhs) const;
+
//------------------------------------------------------------------
/// Clear the object's state.
///
- /// Sets the process and thread to NULL, and the frame index to an
+ /// Sets the process and thread to nullptr, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void
@@ -468,10 +474,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the target object.
///
- /// The returned pointer might be NULL. Calling HasTargetScope(),
+ /// The returned pointer might be nullptr. Calling HasTargetScope(),
/// HasProcessScope(), HasThreadScope(), or HasFrameScope()
/// can help to pre-validate this pointer so that this accessor can
- /// freely be used without having to check for NULL each time.
+ /// freely be used without having to check for nullptr each time.
///
/// @see ExecutionContext::HasTargetScope() const
/// @see ExecutionContext::HasProcessScope() const
@@ -484,10 +490,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the process object.
///
- /// The returned pointer might be NULL. Calling HasProcessScope(),
+ /// The returned pointer might be nullptr. Calling HasProcessScope(),
/// HasThreadScope(), or HasFrameScope() can help to pre-validate
/// this pointer so that this accessor can freely be used without
- /// having to check for NULL each time.
+ /// having to check for nullptr each time.
///
/// @see ExecutionContext::HasProcessScope() const
/// @see ExecutionContext::HasThreadScope() const
@@ -499,10 +505,10 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the thread object.
///
- /// The returned pointer might be NULL. Calling HasThreadScope() or
+ /// The returned pointer might be nullptr. Calling HasThreadScope() or
/// HasFrameScope() can help to pre-validate this pointer so that
/// this accessor can freely be used without having to check for
- /// NULL each time.
+ /// nullptr each time.
///
/// @see ExecutionContext::HasThreadScope() const
/// @see ExecutionContext::HasFrameScope() const
@@ -516,9 +522,9 @@ public:
//------------------------------------------------------------------
/// Returns a pointer to the frame object.
///
- /// The returned pointer might be NULL. Calling HasFrameScope(),
+ /// The returned pointer might be nullptr. Calling HasFrameScope(),
/// can help to pre-validate this pointer so that this accessor can
- /// freely be used without having to check for NULL each time.
+ /// freely be used without having to check for nullptr each time.
///
/// @see ExecutionContext::HasFrameScope() const
//------------------------------------------------------------------
@@ -776,6 +782,7 @@ protected:
lldb::ThreadSP m_thread_sp; ///< The thread that owns the frame
lldb::StackFrameSP m_frame_sp; ///< The stack frame in thread.
};
+
} // namespace lldb_private
-#endif // liblldb_ExecutionContext_h_
+#endif // liblldb_ExecutionContext_h_
diff --git a/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/include/lldb/Target/InstrumentationRuntimeStopInfo.h
index 624267ce8221..df1b937e6e26 100644
--- a/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+++ b/include/lldb/Target/InstrumentationRuntimeStopInfo.h
@@ -25,18 +25,24 @@ class InstrumentationRuntimeStopInfo : public StopInfo
{
public:
- virtual ~InstrumentationRuntimeStopInfo()
+ ~InstrumentationRuntimeStopInfo() override
{
}
- virtual lldb::StopReason
- GetStopReason () const
+ lldb::StopReason
+ GetStopReason() const override
{
return lldb::eStopReasonInstrumentation;
}
- virtual const char *
- GetDescription ();
+ const char *
+ GetDescription() override;
+
+ bool
+ DoShouldNotify(Event *event_ptr) override
+ {
+ return true;
+ }
static lldb::StopInfoSP
CreateStopReasonWithInstrumentationData (Thread &thread, std::string description, StructuredData::ObjectSP additional_data);
@@ -44,9 +50,8 @@ public:
private:
InstrumentationRuntimeStopInfo(Thread &thread, std::string description, StructuredData::ObjectSP additional_data);
-
};
} // namespace lldb_private
-#endif // liblldb_InstrumentationRuntimeStopInfo_h_
+#endif // liblldb_InstrumentationRuntimeStopInfo_h_
diff --git a/include/lldb/Target/JITLoader.h b/include/lldb/Target/JITLoader.h
index c15ae5a876f1..8a2d6828db2f 100644
--- a/include/lldb/Target/JITLoader.h
+++ b/include/lldb/Target/JITLoader.h
@@ -50,8 +50,7 @@ public:
//------------------------------------------------------------------
JITLoader (Process *process);
- virtual
- ~JITLoader ();
+ ~JITLoader() override;
//------------------------------------------------------------------
/// Called after attaching a process.
diff --git a/include/lldb/Target/Language.h b/include/lldb/Target/Language.h
new file mode 100644
index 000000000000..492425ec088b
--- /dev/null
+++ b/include/lldb/Target/Language.h
@@ -0,0 +1,206 @@
+//===-- Language.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_Language_h_
+#define liblldb_Language_h_
+
+// C Includes
+// C++ Includes
+#include <functional>
+#include <memory>
+#include <set>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-private.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+
+namespace lldb_private {
+
+class Language :
+public PluginInterface
+{
+public:
+ class TypeScavenger
+ {
+ public:
+ class Result
+ {
+ public:
+ virtual bool
+ IsValid () = 0;
+
+ virtual bool
+ DumpToStream (Stream& stream,
+ bool print_help_if_available) = 0;
+
+ virtual ~Result() = default;
+ };
+
+ typedef std::set<std::unique_ptr<Result>> ResultSet;
+
+ virtual ~TypeScavenger () = default;
+
+ size_t
+ Find (ExecutionContextScope *exe_scope,
+ const char *key,
+ ResultSet &results,
+ bool append = true);
+
+ protected:
+ TypeScavenger () = default;
+
+ virtual bool
+ Find_Impl (ExecutionContextScope *exe_scope,
+ const char *key,
+ ResultSet &results) = 0;
+ };
+
+ enum class FunctionNameRepresentation
+ {
+ eName,
+ eNameWithArgs,
+ eNameWithNoArgs
+ };
+
+ ~Language() override;
+
+ static Language*
+ FindPlugin (lldb::LanguageType language);
+
+ // return false from callback to stop iterating
+ static void
+ ForEach (std::function<bool(Language*)> callback);
+
+ virtual lldb::LanguageType
+ GetLanguageType () const = 0;
+
+ virtual bool
+ IsTopLevelFunction (Function& function);
+
+ virtual lldb::TypeCategoryImplSP
+ GetFormatters ();
+
+ virtual HardcodedFormatters::HardcodedFormatFinder
+ GetHardcodedFormats ();
+
+ virtual HardcodedFormatters::HardcodedSummaryFinder
+ GetHardcodedSummaries ();
+
+ 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 ();
+
+ // if an individual data formatter can apply to several types and cross a language boundary
+ // it makes sense for individual languages to want to customize the printing of values of that
+ // type by appending proper prefix/suffix information in language-specific ways
+ virtual bool
+ GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
+ std::string& prefix, std::string& suffix);
+
+ // if a language has a custom format for printing variable declarations that it wants LLDB to honor
+ // it should return an appropriate closure here
+ virtual DumpValueObjectOptions::DeclPrintingHelper
+ GetDeclPrintingHelper ();
+
+ virtual LazyBool
+ IsLogicalTrue (ValueObject& valobj,
+ Error& error);
+
+ // for a ValueObject of some "reference type", if the value points to the
+ // nil/null object, this method returns true
+ virtual bool
+ IsNilReference (ValueObject& valobj);
+
+ // 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 the reference has never been assigned
+ virtual bool
+ IsUninitializedReference (ValueObject& valobj);
+
+ virtual bool
+ GetFunctionDisplayName (const SymbolContext *sc,
+ const ExecutionContext *exe_ctx,
+ FunctionNameRepresentation representation,
+ Stream& s);
+
+ virtual void
+ GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s);
+
+ static void
+ GetDefaultExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s);
+
+ // These are accessors for general information about the Languages lldb knows about:
+
+ static lldb::LanguageType
+ GetLanguageTypeFromString (const char *string);
+
+ static const char *
+ GetNameForLanguageType (lldb::LanguageType language);
+
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
+ // return false from callback to stop iterating
+ static void
+ ForAllLanguages (std::function<bool(lldb::LanguageType)> callback);
+
+ static bool
+ LanguageIsCPlusPlus (lldb::LanguageType language);
+
+ static bool
+ LanguageIsObjC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsPascal (lldb::LanguageType language);
+
+ // return the primary language, so if LanguageIsC(l), return eLanguageTypeC, etc.
+ static lldb::LanguageType
+ GetPrimaryLanguage (lldb::LanguageType language);
+
+ static void
+ GetLanguagesSupportingTypeSystems (std::set<lldb::LanguageType> &languages,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void
+ GetLanguagesSupportingREPLs (std::set<lldb::LanguageType> &languages);
+
+protected:
+ //------------------------------------------------------------------
+ // Classes that inherit from Language can see and modify these
+ //------------------------------------------------------------------
+
+ Language();
+private:
+
+ DISALLOW_COPY_AND_ASSIGN (Language);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_Language_h_
diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h
index d8e5ada6c96f..686ec5ea3479 100644
--- a/include/lldb/Target/LanguageRuntime.h
+++ b/include/lldb/Target/LanguageRuntime.h
@@ -29,8 +29,8 @@ class LanguageRuntime :
public PluginInterface
{
public:
- virtual
- ~LanguageRuntime();
+
+ ~LanguageRuntime() override;
static LanguageRuntime*
FindPlugin (Process *process, lldb::LanguageType language);
@@ -52,12 +52,31 @@ public:
GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
- Address &address) = 0;
+ Address &address,
+ Value::ValueType &value_type) = 0;
+
+ // This call should return a CompilerType given a generic type name
+ // and an ExecutionContextScope in which one can actually fetch
+ // any specialization information required.
+ virtual CompilerType
+ GetConcreteType (ExecutionContextScope *exe_scope,
+ ConstString abstract_type_name)
+ {
+ return CompilerType();
+ }
// This should be a fast test to determine whether it is likely that this value would
// have a dynamic type.
virtual bool
CouldHaveDynamicValue (ValueObject &in_value) = 0;
+
+ // The contract for GetDynamicTypeAndAddress() is to return a "bare-bones" dynamic type
+ // For instance, given a Base* pointer, GetDynamicTypeAndAddress() will return the type of
+ // Derived, not Derived*. The job of this API is to correct this misalignment between the
+ // static type and the discovered dynamic type
+ virtual TypeAndOrName
+ FixUpDynamicType (const TypeAndOrName& type_and_or_name,
+ ValueObject& static_value) = 0;
virtual void
SetExceptionBreakpoints ()
@@ -92,24 +111,17 @@ public:
CreateExceptionPrecondition (lldb::LanguageType language,
bool catch_bp,
bool throw_bp);
-
- static lldb::LanguageType
- GetLanguageTypeFromString (const char *string);
-
- static const char *
- GetNameForLanguageType (lldb::LanguageType language);
-
- static void
- PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
-
- static bool
- LanguageIsCPlusPlus (lldb::LanguageType language);
-
Process *
GetProcess()
{
return m_process;
}
+
+ Target&
+ GetTargetRef()
+ {
+ return m_process->GetTarget();
+ }
virtual lldb::BreakpointResolverSP
CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
@@ -118,7 +130,7 @@ public:
CreateExceptionSearchFilter ();
virtual bool
- GetTypeBitSize (const ClangASTType& clang_type,
+ GetTypeBitSize (const CompilerType& compiler_type,
uint64_t &size)
{
return false;
@@ -133,7 +145,6 @@ public:
virtual void
ModulesDidLoad (const ModuleList &module_list)
{
- return;
}
protected:
@@ -144,9 +155,10 @@ protected:
LanguageRuntime(Process *process);
Process *m_process;
private:
+
DISALLOW_COPY_AND_ASSIGN (LanguageRuntime);
};
} // namespace lldb_private
-#endif // liblldb_LanguageRuntime_h_
+#endif // liblldb_LanguageRuntime_h_
diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h
index 88874c767a1b..75f096fdedfe 100644
--- a/include/lldb/Target/ObjCLanguageRuntime.h
+++ b/include/lldb/Target/ObjCLanguageRuntime.h
@@ -1,4 +1,4 @@
-//===-- ObjCLanguageRuntime.h ---------------------------------------------------*- C++ -*-===//
+//===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,14 +14,17 @@
// C++ Includes
#include <functional>
#include <map>
+#include <memory>
#include <unordered_set>
// Other libraries and framework includes
+#include "llvm/Support/Casting.h"
+
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/ThreadSafeDenseMap.h"
-#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/LanguageRuntime.h"
@@ -30,115 +33,19 @@ class CommandObjectObjC_ClassTable_Dump;
namespace lldb_private {
-class ClangUtilityFunction;
+class UtilityFunction;
class ObjCLanguageRuntime :
public LanguageRuntime
{
public:
- class MethodName
+ enum class ObjCRuntimeVersions
{
- public:
- enum Type
- {
- eTypeUnspecified,
- eTypeClassMethod,
- eTypeInstanceMethod
- };
-
- MethodName () :
- m_full(),
- m_class(),
- m_category(),
- m_selector(),
- m_type (eTypeUnspecified),
- m_category_is_valid (false)
- {
- }
-
- MethodName (const char *name, bool strict) :
- m_full(),
- m_class(),
- m_category(),
- m_selector(),
- m_type (eTypeUnspecified),
- m_category_is_valid (false)
- {
- SetName (name, strict);
- }
-
- void
- Clear();
-
- bool
- IsValid (bool strict) const
- {
- // If "strict" is true, the name must have everything specified including
- // the leading "+" or "-" on the method name
- if (strict && m_type == eTypeUnspecified)
- return false;
- // Other than that, m_full will only be filled in if the objective C
- // name is valid.
- return (bool)m_full;
- }
-
- bool
- HasCategory()
- {
- return (bool)GetCategory();
- }
-
- Type
- GetType () const
- {
- return m_type;
- }
-
- const ConstString &
- GetFullName () const
- {
- return m_full;
- }
-
- ConstString
- GetFullNameWithoutCategory (bool empty_if_no_category);
-
- bool
- SetName (const char *name, bool strict);
-
- const ConstString &
- GetClassName ();
-
- const ConstString &
- GetClassNameWithCategory ();
-
- const ConstString &
- GetCategory ();
-
- const ConstString &
- GetSelector ();
-
- // Get all possible names for a method. Examples:
- // If name is "+[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "+[NSString myStringWithCString:]"
- // If name is specified without the leading '+' or '-' like "[NSString(my_additions) myStringWithCString:]"
- // names[0] => "+[NSString(my_additions) myStringWithCString:]"
- // names[1] => "-[NSString(my_additions) myStringWithCString:]"
- // names[2] => "+[NSString myStringWithCString:]"
- // names[3] => "-[NSString myStringWithCString:]"
- size_t
- GetFullNames (std::vector<ConstString> &names, bool append);
- protected:
- ConstString m_full; // Full name: "+[NSString(my_additions) myStringWithCString:]"
- ConstString m_class; // Class name: "NSString"
- ConstString m_class_category; // Class with category: "NSString(my_additions)"
- ConstString m_category; // Category: "my_additions"
- ConstString m_selector; // Selector: "myStringWithCString:"
- Type m_type;
- bool m_category_is_valid;
-
+ eObjC_VersionUnknown = 0,
+ eAppleObjC_V1 = 1,
+ eAppleObjC_V2 = 2
};
+
typedef lldb::addr_t ObjCISA;
class ClassDescriptor;
@@ -150,7 +57,6 @@ public:
class ClassDescriptor
{
public:
-
ClassDescriptor() :
m_is_kvo (eLazyBoolCalculate),
m_is_cf (eLazyBoolCalculate),
@@ -159,10 +65,8 @@ public:
}
virtual
- ~ClassDescriptor ()
- {
- }
-
+ ~ClassDescriptor() = default;
+
virtual ConstString
GetClassName () = 0;
@@ -203,12 +107,12 @@ public:
virtual bool
IsValid () = 0;
-
+
virtual bool
- GetTaggedPointerInfo (uint64_t* info_bits = NULL,
- uint64_t* value_bits = NULL,
- uint64_t* payload = NULL) = 0;
-
+ GetTaggedPointerInfo(uint64_t* info_bits = nullptr,
+ uint64_t* value_bits = nullptr,
+ uint64_t* payload = nullptr) = 0;
+
virtual uint64_t
GetInstanceSize () = 0;
@@ -247,7 +151,7 @@ public:
struct iVarDescriptor {
ConstString m_name;
- ClangASTType m_type;
+ CompilerType m_type;
uint64_t m_size;
int32_t m_offset;
};
@@ -281,12 +185,12 @@ public:
class EncodingToType
{
public:
- virtual ClangASTType RealizeType (ClangASTContext& ast_ctx, const char* name, bool for_expression);
- virtual ClangASTType RealizeType (const char* name, bool for_expression);
-
- virtual ClangASTType RealizeType (clang::ASTContext& ast_ctx, const char* name, bool for_expression) = 0;
-
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_ap;
@@ -297,10 +201,10 @@ public:
public:
ObjCExceptionPrecondition();
- virtual ~ObjCExceptionPrecondition() {}
+ ~ObjCExceptionPrecondition() override = default;
bool EvaluatePrecondition(StoppointCallbackContext &context) override;
- void DescribePrecondition(Stream &stream, lldb::DescriptionLevel level) override;
+ void GetDescription(Stream &stream, lldb::DescriptionLevel level) override;
Error ConfigurePrecondition(Args &args) override;
protected:
@@ -313,21 +217,24 @@ public:
class TaggedPointerVendor
{
public:
+ virtual
+ ~TaggedPointerVendor() = default;
+
virtual bool
IsPossibleTaggedPointer (lldb::addr_t ptr) = 0;
virtual ObjCLanguageRuntime::ClassDescriptorSP
GetClassDescriptor (lldb::addr_t ptr) = 0;
-
- virtual
- ~TaggedPointerVendor () { }
+
protected:
- TaggedPointerVendor () = default;
+ TaggedPointerVendor() = default;
private:
DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor);
};
+ ~ObjCLanguageRuntime() override;
+
virtual TaggedPointerVendor*
GetTaggedPointerVendor ()
{
@@ -354,9 +261,6 @@ public:
ClassDescriptorSP
GetNonKVOClassDescriptor (ObjCISA isa);
- virtual
- ~ObjCLanguageRuntime();
-
lldb::LanguageType
GetLanguageType () const override
{
@@ -393,13 +297,13 @@ public:
lldb::TypeSP
LookupInCompleteClassCache (ConstString &name);
- virtual ClangUtilityFunction *
+ virtual UtilityFunction *
CreateObjectChecker (const char *) = 0;
virtual ObjCRuntimeVersions
- GetRuntimeVersion ()
+ GetRuntimeVersion () const
{
- return eObjC_VersionUnknown;
+ return ObjCRuntimeVersions::eObjC_VersionUnknown;
}
bool
@@ -433,14 +337,14 @@ public:
virtual DeclVendor *
GetDeclVendor()
{
- return NULL;
+ return nullptr;
}
// 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 (ClangASTType &parent_qual_type, const char *ivar_name);
+ GetByteOffsetForIvar (CompilerType &parent_qual_type, const char *ivar_name);
// Given the name of an Objective-C runtime symbol (e.g., ivar offset symbol),
// try to determine from the runtime what the value of that symbol would be.
@@ -451,94 +355,6 @@ public:
return LLDB_INVALID_ADDRESS;
}
- //------------------------------------------------------------------
- /// Chop up an objective C function prototype.
- ///
- /// Chop up an objective C function fullname and optionally fill in
- /// any non-NULL ConstString objects. If a ConstString * is NULL,
- /// then this name doesn't get filled in
- ///
- /// @param[in] name
- /// A fully specified objective C function name. The string might
- /// contain a category and it includes the leading "+" or "-" and
- /// the square brackets, no types for the arguments, just the plain
- /// selector. A few examples:
- /// "-[NSStringDrawingContext init]"
- /// "-[NSStringDrawingContext addString:inRect:]"
- /// "-[NSString(NSStringDrawing) sizeWithAttributes:]"
- /// "+[NSString(NSStringDrawing) usesFontLeading]"
- ///
- /// @param[out] class_name
- /// If non-NULL, this string will be filled in with the class
- /// name including the category. The examples above would return:
- /// "NSStringDrawingContext"
- /// "NSStringDrawingContext"
- /// "NSString(NSStringDrawing)"
- /// "NSString(NSStringDrawing)"
- ///
- /// @param[out] selector_name
- /// If non-NULL, this string will be filled in with the selector
- /// name. The examples above would return:
- /// "init"
- /// "addString:inRect:"
- /// "sizeWithAttributes:"
- /// "usesFontLeading"
- ///
- /// @param[out] name_sans_category
- /// If non-NULL, this string will be filled in with the class
- /// name _without_ the category. If there is no category, and empty
- /// string will be returned (as the result would be normally returned
- /// in the "class_name" argument). The examples above would return:
- /// <empty>
- /// <empty>
- /// "-[NSString sizeWithAttributes:]"
- /// "+[NSString usesFontLeading]"
- ///
- /// @param[out] class_name_sans_category
- /// If non-NULL, this string will be filled in with the prototype
- /// name _without_ the category. If there is no category, and empty
- /// string will be returned (as this is already the value that was
- /// passed in). The examples above would return:
- /// <empty>
- /// <empty>
- /// "NSString"
- /// "NSString"
- ///
- /// @return
- /// Returns the number of strings that were successfully filled
- /// in.
- //------------------------------------------------------------------
-// static uint32_t
-// ParseMethodName (const char *name,
-// ConstString *class_name, // Class name (with category if there is one)
-// ConstString *selector_name, // selector only
-// ConstString *name_sans_category, // full function name with no category (empty if no category)
-// ConstString *class_name_sans_category);// Class name without category (empty if no category)
-
- static bool
- IsPossibleObjCMethodName (const char *name)
- {
- if (!name)
- return false;
- bool starts_right = (name[0] == '+' || name[0] == '-') && name[1] == '[';
- bool ends_right = (name[strlen(name) - 1] == ']');
- return (starts_right && ends_right);
- }
-
- static bool
- IsPossibleObjCSelector (const char *name)
- {
- if (!name)
- return false;
-
- if (strchr(name, ':') == NULL)
- return true;
- else if (name[strlen(name) - 1] == ':')
- return true;
- else
- return false;
- }
-
bool
HasNewLiteralsAndIndexing ()
{
@@ -560,7 +376,7 @@ public:
}
bool
- GetTypeBitSize (const ClangASTType& clang_type,
+ GetTypeBitSize (const CompilerType& compiler_type,
uint64_t &size) override;
protected:
@@ -568,13 +384,12 @@ protected:
// Classes that inherit from ObjCLanguageRuntime can see and modify these
//------------------------------------------------------------------
ObjCLanguageRuntime(Process *process);
-
+
virtual bool CalculateHasNewLiteralsAndIndexing()
{
return false;
}
-
bool
ISAIsCached (ObjCISA isa) const
{
@@ -621,11 +436,13 @@ private:
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
@@ -702,4 +519,4 @@ protected:
} // namespace lldb_private
-#endif // liblldb_ObjCLanguageRuntime_h_
+#endif // liblldb_ObjCLanguageRuntime_h_
diff --git a/include/lldb/Target/OperatingSystem.h b/include/lldb/Target/OperatingSystem.h
index f1c0eb06026f..74de5645da5a 100644
--- a/include/lldb/Target/OperatingSystem.h
+++ b/include/lldb/Target/OperatingSystem.h
@@ -32,7 +32,6 @@ namespace lldb_private {
class OperatingSystem :
public PluginInterface
-
{
public:
//------------------------------------------------------------------
@@ -58,8 +57,7 @@ public:
//------------------------------------------------------------------
OperatingSystem (Process *process);
- virtual
- ~OperatingSystem();
+ ~OperatingSystem() override;
//------------------------------------------------------------------
// Plug-in Methods
@@ -98,4 +96,4 @@ private:
} // namespace lldb_private
-#endif // #ifndef liblldb_OperatingSystem_h_
+#endif // liblldb_OperatingSystem_h_
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index feaac57b128a..53c17a6a66cf 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -37,7 +37,6 @@
namespace lldb_private {
class ModuleCache;
-
enum MmapFlags {
eMmapFlagsPrivate = 1,
eMmapFlagsAnon = 2
@@ -46,11 +45,11 @@ class ModuleCache;
class PlatformProperties : public Properties
{
public:
+ PlatformProperties();
+
static ConstString
GetSettingName ();
- PlatformProperties();
-
bool
GetUseModuleCache () const;
bool
@@ -81,6 +80,19 @@ class ModuleCache;
public PluginInterface
{
public:
+ //------------------------------------------------------------------
+ /// Default Constructor
+ //------------------------------------------------------------------
+ Platform (bool is_host_platform);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited from by the plug-in instance.
+ //------------------------------------------------------------------
+ ~Platform() override;
+
static void
Initialize ();
@@ -131,20 +143,6 @@ class ModuleCache;
GetConnectedRemotePlatformAtIndex (uint32_t idx);
//------------------------------------------------------------------
- /// Default Constructor
- //------------------------------------------------------------------
- Platform (bool is_host_platform);
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be
- /// inherited from by the plug-in instance.
- //------------------------------------------------------------------
- virtual
- ~Platform();
-
- //------------------------------------------------------------------
/// Find a platform plugin for a given process.
///
/// Scans the installed Platform plug-ins and tries to find
@@ -156,7 +154,7 @@ class ModuleCache;
///
/// @param[in] plugin_name
/// An optional name of a specific platform plug-in that
- /// should be used. If NULL, pick the best plug-in.
+ /// should be used. If nullptr, pick the best plug-in.
//------------------------------------------------------------------
// static lldb::PlatformSP
// FindPlugin (Process *process, const ConstString &plugin_name);
@@ -185,7 +183,6 @@ class ModuleCache;
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr);
-
//------------------------------------------------------------------
/// Find a symbol file given a symbol file module specification.
///
@@ -247,10 +244,21 @@ class ModuleCache;
ResolveRemotePath (const FileSpec &platform_path,
FileSpec &resolved_platform_path);
- bool
+ //------------------------------------------------------------------
+ /// Get the OS version from a connected platform.
+ ///
+ /// Some platforms might not be connected to a remote platform, but
+ /// can figure out the OS version for a process. This is common for
+ /// simulator platforms that will run native programs on the current
+ /// host, but the simulator might be simulating a different OS. The
+ /// \a process parameter might be specified to help to determine
+ /// the OS version.
+ //------------------------------------------------------------------
+ virtual bool
GetOSVersion (uint32_t &major,
uint32_t &minor,
- uint32_t &update);
+ uint32_t &update,
+ Process *process = nullptr);
bool
SetOSVersion (uint32_t major,
@@ -269,6 +277,9 @@ class ModuleCache;
virtual const char *
GetHostname ();
+
+ virtual ConstString
+ GetFullNameForDylib (ConstString basename);
virtual const char *
GetDescription () = 0;
@@ -473,9 +484,16 @@ class ModuleCache;
virtual lldb::ProcessSP
DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
- Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
Error &error);
+ virtual lldb::ProcessSP
+ ConnectProcess (const char* connect_url,
+ const char* plugin_name,
+ lldb_private::Debugger &debugger,
+ lldb_private::Target *target,
+ lldb_private::Error &error);
+
//------------------------------------------------------------------
/// Attach to an existing process using a process ID.
///
@@ -497,7 +515,7 @@ class ModuleCache;
virtual lldb::ProcessSP
Attach (ProcessAttachInfo &attach_info,
Debugger &debugger,
- Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Target *target, // Can be nullptr, if nullptr create a new target, else use existing one
Error &error) = 0;
//------------------------------------------------------------------
@@ -593,6 +611,7 @@ class ModuleCache;
{
return m_max_uid_name_len;
}
+
// Used for column widths
size_t
GetMaxGroupIDNameLength() const
@@ -829,15 +848,15 @@ class ModuleCache;
virtual lldb_private::OptionGroupOptions *
GetConnectionOptions (CommandInterpreter& interpreter)
{
- return NULL;
+ return nullptr;
}
virtual lldb_private::Error
- RunShellCommand(const char *command, // Shouldn't be NULL
+ RunShellCommand(const char *command, // Shouldn't be nullptr
const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
- int *status_ptr, // Pass NULL if you don't want the process exit status
- int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
- std::string *command_output, // Pass NULL if you don't want the command output
+ 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
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
virtual void
@@ -945,9 +964,105 @@ class ModuleCache;
virtual const std::vector<ConstString> &
GetTrapHandlerSymbolNames ();
+ //------------------------------------------------------------------
+ /// Find a support executable that may not live within in the
+ /// standard locations related to LLDB.
+ ///
+ /// Executable might exist within the Platform SDK directories, or
+ /// in standard tool directories within the current IDE that is
+ /// running LLDB.
+ ///
+ /// @param[in] basename
+ /// The basename of the executable to locate in the current
+ /// platform.
+ ///
+ /// @return
+ /// A FileSpec pointing to the executable on disk, or an invalid
+ /// FileSpec if the executable cannot be found.
+ //------------------------------------------------------------------
+ virtual FileSpec
+ LocateExecutable (const char *basename)
+ {
+ return FileSpec();
+ }
+
+ //------------------------------------------------------------------
+ /// Allow the platform to set preferred memory cache line size. If non-zero (and the user
+ /// has not set cache line size explicitly), this value will be used as the cache line
+ /// size for memory reads.
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetDefaultMemoryCacheLineSize() { return 0; }
+
+ //------------------------------------------------------------------
+ /// Load a shared library into this process.
+ ///
+ /// Try and load a shared library into the current process. This
+ /// call might fail in the dynamic loader plug-in says it isn't safe
+ /// to try and load shared libraries at the moment.
+ ///
+ /// @param[in] process
+ /// The process to load the image.
+ ///
+ /// @param[in] local_file
+ /// The file spec that points to the shared library that you want
+ /// to load if the library is located on the host. The library will
+ /// be copied over to the location specified by remote_file or into
+ /// the current working directory with the same filename if the
+ /// remote_file isn't specified.
+ ///
+ /// @param[in] remote_file
+ /// If local_file is specified then the location where the library
+ /// should be copied over from the host. If local_file isn't
+ /// specified, then the path for the shared library on the target
+ /// what you want to load.
+ ///
+ /// @param[out] error
+ /// An error object that gets filled in with any errors that
+ /// might occur when trying to load the shared library.
+ ///
+ /// @return
+ /// A token that represents the shared library that can be
+ /// later used to unload the shared library. A value of
+ /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
+ /// library can't be opened.
+ //------------------------------------------------------------------
+ uint32_t
+ LoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& local_file,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error);
+
+ virtual uint32_t
+ DoLoadImage (lldb_private::Process* process,
+ const lldb_private::FileSpec& remote_file,
+ lldb_private::Error& error);
+
+ virtual Error
+ UnloadImage (lldb_private::Process* process, uint32_t image_token);
+
+ //------------------------------------------------------------------
+ /// Connect to all processes waiting for a debugger to attach
+ ///
+ /// If the platform have a list of processes waiting for a debugger
+ /// to connect to them then connect to all of these pending processes.
+ ///
+ /// @param[in] debugger
+ /// The debugger used for the connect.
+ ///
+ /// @param[out] error
+ /// If an error occurred during the connect then this object will
+ /// contain the error message.
+ ///
+ /// @return
+ /// The number of processes we are succesfully connected to.
+ //------------------------------------------------------------------
+ virtual size_t
+ ConnectToWaitingProcesses(lldb_private::Debugger& debugger, lldb_private::Error& error);
+
protected:
bool m_is_host;
- // Set to true when we are able to actually set the OS version while
+ // 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 before we actually connect and this version might change when
// we actually connect to a remote platform. For the host platform this
@@ -1000,16 +1115,12 @@ class ModuleCache;
GetCachedUserName (uint32_t uid)
{
Mutex::Locker locker (m_mutex);
- IDToNameMap::iterator pos = m_uid_map.find (uid);
- if (pos != m_uid_map.end())
- {
- // return the empty string if our string is NULL
- // so we can tell when things were in the negative
- // cached (didn't find a valid user name, don't keep
- // trying)
- return pos->second.AsCString("");
- }
- return NULL;
+ // return the empty string if our string is NULL
+ // so we can tell when things were in the negative
+ // cached (didn't find a valid user name, don't keep
+ // trying)
+ const auto pos = m_uid_map.find(uid);
+ return ((pos != m_uid_map.end()) ? pos->second.AsCString("") : nullptr);
}
const char *
@@ -1030,7 +1141,6 @@ class ModuleCache;
Mutex::Locker locker (m_mutex);
m_uid_map[uid] = ConstString();
}
-
void
ClearCachedUserNames ()
@@ -1043,16 +1153,12 @@ class ModuleCache;
GetCachedGroupName (uint32_t gid)
{
Mutex::Locker locker (m_mutex);
- IDToNameMap::iterator pos = m_gid_map.find (gid);
- if (pos != m_gid_map.end())
- {
- // return the empty string if our string is NULL
- // so we can tell when things were in the negative
- // cached (didn't find a valid group name, don't keep
- // trying)
- return pos->second.AsCString("");
- }
- return NULL;
+ // return the empty string if our string is NULL
+ // so we can tell when things were in the negative
+ // cached (didn't find a valid group name, don't keep
+ // trying)
+ const auto pos = m_gid_map.find(gid);
+ return ((pos != m_gid_map.end()) ? pos->second.AsCString("") : nullptr);
}
const char *
@@ -1092,6 +1198,10 @@ class ModuleCache;
const uint64_t src_offset,
const uint64_t src_size,
const FileSpec& dst_file_spec);
+
+ virtual Error
+ DownloadSymbolFile (const lldb::ModuleSP& module_sp,
+ const FileSpec& dst_file_spec);
virtual const char *
GetCacheHostname ();
@@ -1123,7 +1233,6 @@ class ModuleCache;
DISALLOW_COPY_AND_ASSIGN (Platform);
};
-
class PlatformList
{
public:
@@ -1133,11 +1242,9 @@ class ModuleCache;
m_selected_platform_sp()
{
}
-
- ~PlatformList()
- {
- }
-
+
+ ~PlatformList() = default;
+
void
Append (const lldb::PlatformSP &platform_sp, bool set_selected)
{
@@ -1220,22 +1327,21 @@ class ModuleCache;
public:
OptionGroupPlatformRSync ();
- virtual
- ~OptionGroupPlatformRSync ();
+ ~OptionGroupPlatformRSync() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1256,22 +1362,21 @@ class ModuleCache;
public:
OptionGroupPlatformSSH ();
- virtual
- ~OptionGroupPlatformSSH ();
+ ~OptionGroupPlatformSSH() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1283,7 +1388,6 @@ class ModuleCache;
std::string m_ssh_opts;
private:
-
DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformSSH);
};
@@ -1292,22 +1396,21 @@ class ModuleCache;
public:
OptionGroupPlatformCaching ();
- virtual
- ~OptionGroupPlatformCaching ();
+ ~OptionGroupPlatformCaching() override;
- virtual lldb_private::Error
- SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_value);
+ lldb_private::Error
+ SetOptionValue(CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_value) override;
void
- OptionParsingStarting (CommandInterpreter &interpreter);
+ OptionParsingStarting(CommandInterpreter &interpreter) override;
- virtual uint32_t
- GetNumDefinitions ();
+ uint32_t
+ GetNumDefinitions() override;
const lldb_private::OptionDefinition*
- GetDefinitions ();
+ GetDefinitions() override;
// Options table: Required for subclasses of Options.
@@ -1316,10 +1419,11 @@ class ModuleCache;
// Instance variables to hold the values for command options.
std::string m_cache_dir;
+
private:
DISALLOW_COPY_AND_ASSIGN(OptionGroupPlatformCaching);
};
} // namespace lldb_private
-#endif // liblldb_Platform_h_
+#endif // liblldb_Platform_h_
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index f75b3cd5683d..2e063c5bbccc 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -17,8 +17,10 @@
// C++ Includes
#include <list>
-#include <iosfwd>
+#include <memory>
+#include <string>
#include <vector>
+#include <unordered_set>
// Other libraries and framework includes
// Project includes
@@ -55,11 +57,10 @@ struct Range;
class ProcessProperties : public Properties
{
public:
- // Pass NULL for "process" if the ProcessProperties are to be the global copy
+ // Pass nullptr for "process" if the ProcessProperties are to be the global copy
ProcessProperties (lldb_private::Process *process);
- virtual
- ~ProcessProperties();
+ ~ProcessProperties() override;
bool
GetDisableMemoryCache() const;
@@ -103,12 +104,14 @@ public:
void
SetDetachKeepsStopped (bool keep_stopped);
-protected:
+ bool
+ GetWarningsOptimization () const;
+protected:
static void
OptionValueChangedCallback (void *baton, OptionValue *option_value);
- Process * m_process; // Can be NULL for global ProcessProperties
+ Process * m_process; // Can be nullptr for global ProcessProperties
};
typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP;
@@ -236,7 +239,8 @@ public:
m_wait_for_launch (false),
m_ignore_existing (true),
m_continue_once_attached (false),
- m_detach_on_error (true)
+ m_detach_on_error (true),
+ m_async (false)
{
}
@@ -249,7 +253,8 @@ public:
m_wait_for_launch (false),
m_ignore_existing (true),
m_continue_once_attached (false),
- m_detach_on_error(true)
+ m_detach_on_error (true),
+ m_async (false)
{
ProcessInfo::operator= (launch_info);
SetProcessPluginName (launch_info.GetProcessPluginName());
@@ -272,6 +277,18 @@ public:
}
bool
+ GetAsync () const
+ {
+ return m_async;
+ }
+
+ void
+ SetAsync (bool b)
+ {
+ m_async = b;
+ }
+
+ bool
GetIgnoreExisting () const
{
return m_ignore_existing;
@@ -310,9 +327,7 @@ public:
const char *
GetProcessPluginName () const
{
- if (m_plugin_name.empty())
- return NULL;
- return m_plugin_name.c_str();
+ return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str());
}
void
@@ -384,7 +399,6 @@ public:
m_listener_sp = listener_sp;
}
-
Listener &
GetListenerForProcess (Debugger &debugger);
@@ -397,35 +411,33 @@ protected:
bool m_ignore_existing;
bool m_continue_once_attached; // Supports the use-case scenario of immediately continuing the process once attached.
bool m_detach_on_error; // If we are debugging remotely, instruct the stub to detach rather than killing the target on error.
+ bool m_async; // Use an async attach where we start the attach and return immediately (used by GUI programs with --waitfor so they can call SBProcess::Stop() to cancel attach)
};
class ProcessLaunchCommandOptions : public Options
{
public:
-
ProcessLaunchCommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
}
-
- ~ProcessLaunchCommandOptions ()
- {
- }
-
+
+ ~ProcessLaunchCommandOptions() override = default;
+
Error
- SetOptionValue (uint32_t option_idx, const char *option_arg);
+ SetOptionValue (uint32_t option_idx, const char *option_arg) override;
void
- OptionParsingStarting ()
+ OptionParsingStarting() override
{
launch_info.Clear();
disable_aslr = eLazyBoolCalculate;
}
const OptionDefinition*
- GetDefinitions ()
+ GetDefinitions() override
{
return g_option_table;
}
@@ -521,11 +533,8 @@ protected:
class ProcessInstanceInfoList
{
public:
- ProcessInstanceInfoList () :
- m_infos()
- {
- }
-
+ ProcessInstanceInfoList() = default;
+
void
Clear()
{
@@ -547,25 +556,19 @@ public:
const char *
GetProcessNameAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetName();
- return NULL;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr);
}
size_t
GetProcessNameLengthAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetNameLength();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0);
}
lldb::pid_t
GetProcessIDAtIndex (size_t idx)
{
- if (idx < m_infos.size())
- return m_infos[idx].GetProcessID();
- return 0;
+ return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0);
}
bool
@@ -592,7 +595,6 @@ protected:
collection m_infos;
};
-
// This class tracks the Modification state of the process. Things that can currently modify
// the program are running the program (which will up the StopID) and writing memory (which
// will up the MemoryID.)
@@ -600,7 +602,7 @@ protected:
class ProcessModID
{
-friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
+ friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
public:
ProcessModID () :
m_stop_id (0),
@@ -626,7 +628,7 @@ public:
return *this;
}
- ~ProcessModID () {}
+ ~ProcessModID() = default;
void BumpStopID () {
m_stop_id++;
@@ -709,6 +711,7 @@ private:
uint32_t m_running_user_expression;
lldb::EventSP m_last_natural_stop_event;
};
+
inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
{
if (lhs.StopIDEqual (rhs)
@@ -720,11 +723,7 @@ inline bool operator== (const ProcessModID &lhs, const ProcessModID &rhs)
inline bool operator!= (const ProcessModID &lhs, const ProcessModID &rhs)
{
- if (!lhs.StopIDEqual (rhs)
- || !lhs.MemoryIDEqual (rhs))
- return true;
- else
- return false;
+ return (!lhs.StopIDEqual (rhs) || !lhs.MemoryIDEqual (rhs));
}
//----------------------------------------------------------------------
@@ -739,7 +738,7 @@ class Process :
public ExecutionContextScope,
public PluginInterface
{
- friend class ClangFunction; // For WaitForStateChangeEventsPrivate
+ friend class FunctionCaller; // For WaitForStateChangeEventsPrivate
friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
friend class ProcessEventData;
friend class StopInfo;
@@ -747,7 +746,6 @@ class Process :
friend class ThreadList;
public:
-
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -766,6 +764,14 @@ public:
eBroadcastInternalStateControlPause = (1<<1),
eBroadcastInternalStateControlResume = (1<<2)
};
+
+ //------------------------------------------------------------------
+ /// Process warning types.
+ //------------------------------------------------------------------
+ enum Warnings
+ {
+ eWarningsOptimization = 1
+ };
typedef Range<lldb::addr_t, lldb::addr_t> LoadRange;
// We use a read/write lock to allow on or more clients to
@@ -781,12 +787,11 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
-
//------------------------------------------------------------------
/// A notification structure that can be used by clients to listen
/// for changes in a process's lifetime.
@@ -811,13 +816,13 @@ public:
ProcessEventData ();
ProcessEventData (const lldb::ProcessSP &process, lldb::StateType state);
- virtual ~ProcessEventData();
+ ~ProcessEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const;
+ const ConstString &
+ GetFlavor() const override;
lldb::ProcessSP
GetProcessSP() const
@@ -845,10 +850,7 @@ public:
const char *
GetRestartedReasonAtIndex(size_t idx)
{
- if (idx > m_restarted_reasons.size())
- return NULL;
- else
- return m_restarted_reasons[idx].c_str();
+ return ((idx < m_restarted_reasons.size()) ? m_restarted_reasons[idx].c_str() : nullptr);
}
bool
@@ -857,11 +859,11 @@ public:
return m_interrupted;
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
- virtual void
- DoOnRemoval (Event *event_ptr);
+ void
+ DoOnRemoval(Event *event_ptr) override;
static const Process::ProcessEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -897,22 +899,24 @@ public:
SetUpdateStateOnRemoval (Event *event_ptr);
private:
-
void
SetUpdateStateOnRemoval()
{
m_update_state++;
}
+
void
SetRestarted (bool new_value)
{
m_restarted = new_value;
}
+
void
SetInterrupted (bool new_value)
{
m_interrupted = new_value;
}
+
void
AddRestartedReason (const char *reason)
{
@@ -925,32 +929,22 @@ public:
bool m_restarted; // For "eStateStopped" events, this is true if the target was automatically restarted.
int m_update_state;
bool m_interrupted;
- DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
+ DISALLOW_COPY_AND_ASSIGN (ProcessEventData);
};
-
-#endif
-
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ProcessPropertiesSP &
- GetGlobalProperties();
+#endif // SWIG
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, and the Process listener.
/// Uses the Host UnixSignalsSP by default.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener);
+ Process(lldb::TargetSP target_sp, Listener &listener);
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, the Process listener,
/// and the appropriate UnixSignalsSP for the process.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
+ Process(lldb::TargetSP target_sp, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
//------------------------------------------------------------------
/// Destructor.
@@ -958,8 +952,16 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited from by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~Process();
+ ~Process() override;
+
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ProcessPropertiesSP &
+ GetGlobalProperties();
//------------------------------------------------------------------
/// Find a Process plug-in that can debug \a module using the
@@ -973,20 +975,18 @@ public:
/// The module shared pointer that this process will debug.
///
/// @param[in] plugin_name
- /// If NULL, select the best plug-in for the binary. If non-NULL
+ /// 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 (Target &target,
+ FindPlugin (lldb::TargetSP target_sp,
const char *plugin_name,
Listener &listener,
const FileSpec *crash_file_path);
-
-
//------------------------------------------------------------------
/// Static function that can be used with the \b host function
/// Host::StartMonitoringChildProcess ().
@@ -997,16 +997,16 @@ public:
/// Subclasses should call Host::StartMonitoringChildProcess ()
/// with:
/// callback = Process::SetHostProcessExitStatus
- /// callback_baton = NULL
+ /// callback_baton = nullptr
/// pid = Process::GetID()
/// monitor_signals = false
//------------------------------------------------------------------
static bool
- SetProcessExitStatus (void *callback_baton, // The callback baton which should be set to NULL
- lldb::pid_t pid, // The process ID we want to monitor
- bool exited,
- int signo, // Zero for no signal
- int status); // Exit value of process if signal is zero
+ SetProcessExitStatus(void *callback_baton, // The callback baton which should be set to nullptr
+ lldb::pid_t pid, // The process ID we want to monitor
+ bool exited,
+ int signo, // Zero for no signal
+ int status); // Exit value of process if signal is zero
lldb::ByteOrder
GetByteOrder () const;
@@ -1019,6 +1019,7 @@ public:
{
return m_process_unique_id;
}
+
//------------------------------------------------------------------
/// Check if a plug-in instance can debug the file in \a module.
///
@@ -1031,10 +1032,9 @@ public:
/// debug the executable, \b false otherwise.
//------------------------------------------------------------------
virtual bool
- CanDebug (Target &target,
+ CanDebug (lldb::TargetSP target,
bool plugin_specified_by_name) = 0;
-
//------------------------------------------------------------------
/// This object is about to be destroyed, do any necessary cleanup.
///
@@ -1043,8 +1043,7 @@ public:
//------------------------------------------------------------------
virtual void
Finalize();
-
-
+
//------------------------------------------------------------------
/// Return whether this object is valid (i.e. has not been finalized.)
///
@@ -1075,7 +1074,7 @@ public:
virtual CommandObject *
GetPluginCommandObject()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -1163,7 +1162,7 @@ public:
///
/// @return
/// Returns a pointer to the SystemRuntime plugin for this Process
- /// if one is available. Else returns NULL.
+ /// if one is available. Else returns nullptr.
//------------------------------------------------------------------
virtual SystemRuntime *
GetSystemRuntime ();
@@ -1194,7 +1193,7 @@ public:
/// @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 NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1236,31 +1235,24 @@ public:
GetImageInfoAddress ();
//------------------------------------------------------------------
- /// Load a shared library into this process.
- ///
- /// Try and load a shared library into the current process. This
- /// call might fail in the dynamic loader plug-in says it isn't safe
- /// to try and load shared libraries at the moment.
- ///
- /// @param[in] image_spec
- /// The image file spec that points to the shared library that
- /// you want to load.
+ /// Called when the process is about to broadcast a public stop.
///
- /// @param[out] error
- /// An error object that gets filled in with any errors that
- /// might occur when trying to load the shared library.
- ///
- /// @return
- /// A token that represents the shared library that can be
- /// later used to unload the shared library. A value of
- /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
- /// library can't be opened.
+ /// There are public and private stops. Private stops are when the
+ /// process is doing things like stepping and the client doesn't
+ /// need to know about starts and stop that implement a thread plan.
+ /// Single stepping over a source line in code might end up being
+ /// implemented by one or more process starts and stops. Public stops
+ /// are when clients will be notified that the process is stopped.
+ /// These events typically trigger UI updates (thread stack frames to
+ /// be displayed, variables to be displayed, and more). This function
+ /// can be overriden and allows process subclasses to do something
+ /// before the eBroadcastBitStateChanged event is sent to public
+ /// clients.
//------------------------------------------------------------------
- virtual uint32_t
- LoadImage (const FileSpec &image_spec, Error &error);
-
- virtual Error
- UnloadImage (uint32_t image_token);
+ virtual void
+ WillPublicStop ()
+ {
+ }
//------------------------------------------------------------------
/// Register for process and thread notifications.
@@ -1278,6 +1270,7 @@ public:
void
RegisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//------------------------------------------------------------------
/// Unregister for process and thread notifications.
///
@@ -1298,6 +1291,7 @@ public:
bool
UnregisterNotificationCallbacks (const Process::Notifications& callbacks);
#endif
+
//==================================================================
// Built in Process Control functions
//==================================================================
@@ -1334,6 +1328,7 @@ public:
Error
ResumeSynchronous (Stream *stream);
+
//------------------------------------------------------------------
/// Halts a running process.
///
@@ -1346,12 +1341,15 @@ public:
/// @param[in] clear_thread_plans
/// If true, when the process stops, clear all thread plans.
///
+ /// @param[in] use_run_lock
+ /// Whether to release the run lock after the stop.
+ ///
/// @return
/// Returns an error object. If the error is empty, the process is halted.
/// otherwise the halt has failed.
//------------------------------------------------------------------
Error
- Halt (bool clear_thread_plans = false);
+ Halt (bool clear_thread_plans = false, bool use_run_lock = true);
//------------------------------------------------------------------
/// Detaches from a running or stopped process.
@@ -1402,7 +1400,7 @@ public:
Signal (int signal);
void
- SetUnixSignals(const lldb::UnixSignalsSP &signals_sp);
+ SetUnixSignals(lldb::UnixSignalsSP &&signals_sp);
const lldb::UnixSignalsSP &
GetUnixSignals();
@@ -1447,7 +1445,7 @@ public:
/// @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 NULL if no output is needed.A
+ /// the connection. This may be nullptr if no output is needed.A
///
/// @param[in] remote_url
/// The URL format that we are connecting to.
@@ -1525,7 +1523,6 @@ public:
process_arch.Clear();
}
-
//------------------------------------------------------------------
/// Called after a process re-execs itself.
///
@@ -1590,7 +1587,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after launching a process.
///
@@ -1600,8 +1596,6 @@ public:
virtual void
DidLaunch () {}
-
-
//------------------------------------------------------------------
/// Called before resuming to a process.
///
@@ -1639,7 +1633,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after resuming a process.
///
@@ -1649,7 +1642,6 @@ public:
virtual void
DidResume () {}
-
//------------------------------------------------------------------
/// Called before halting to a process.
///
@@ -1668,9 +1660,8 @@ public:
/// DoHalt must produce one and only one stop StateChanged event if it actually
/// stops the process. If the stop happens through some natural event (for
/// instance a SIGSTOP), then forwarding that event will do. Otherwise, you must
- /// generate the event manually. Note also, the private event thread is stopped when
- /// DoHalt is run to prevent the events generated while halting to trigger
- /// other state changes before the halt is complete.
+ /// generate the event manually. This function is called from the context of the
+ /// private state thread.
///
/// @param[out] caused_stop
/// If true, then this Halt caused the stop, otherwise, the
@@ -1688,7 +1679,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after halting a process.
///
@@ -1728,7 +1718,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// Called after detaching from a process.
///
@@ -1781,7 +1770,6 @@ public:
virtual bool
DestroyRequiresHalt() { return true; }
-
//------------------------------------------------------------------
/// Called after sending a signal to a process.
///
@@ -1808,6 +1796,41 @@ public:
RefreshStateAfterStop () = 0;
//------------------------------------------------------------------
+ /// Sometimes the connection to a process can detect the host OS
+ /// version that the process is running on. The current platform
+ /// should be checked first in case the platform is connected, but
+ /// clients can fall back onto this function if the platform fails
+ /// to identify the host OS version. The platform should be checked
+ /// first in case you are running a simulator platform that might
+ /// itself be running natively, but have different heuristics for
+ /// figuring out which OS is is emulating.
+ ///
+ /// @param[out] major
+ /// The major OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @param[out] minor
+ /// The minor OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @param[out] update
+ /// The update OS version, or UINT32_MAX if it can't be determined
+ ///
+ /// @return
+ /// Returns \b true if the host OS version info was filled in
+ /// and \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ GetHostOSVersion(uint32_t &major,
+ uint32_t &minor,
+ uint32_t &update)
+ {
+ major = UINT32_MAX;
+ minor = UINT32_MAX;
+ update = UINT32_MAX;
+ return false;
+ }
+
+
+ //------------------------------------------------------------------
/// Get the target object pointer for this module.
///
/// @return
@@ -1817,7 +1840,7 @@ public:
Target &
GetTarget ()
{
- return m_target;
+ return *m_target_sp.lock();
}
//------------------------------------------------------------------
@@ -1830,7 +1853,7 @@ public:
const Target &
GetTarget () const
{
- return m_target;
+ return *m_target_sp.lock();
}
//------------------------------------------------------------------
@@ -1888,7 +1911,6 @@ public:
virtual void
ModulesDidLoad (ModuleList &module_list);
-
//------------------------------------------------------------------
/// Retrieve the list of shared libraries that are loaded for this process
///
@@ -1919,30 +1941,20 @@ public:
return StructuredData::ObjectSP();
}
-protected:
-
- void
- SetState (lldb::EventSP &event_sp);
-
- lldb::StateType
- GetPrivateState ();
-
//------------------------------------------------------------------
- /// The "private" side of resuming a process. This doesn't alter the
- /// state of m_run_lock, but just causes the process to resume.
+ /// Print a user-visible warning about a module being built with optimization
///
- /// @return
- /// An Error object describing the success or failure of the resume.
- //------------------------------------------------------------------
- Error
- PrivateResume ();
-
- //------------------------------------------------------------------
- // Called internally
+ /// Prints a async warning message to the user one time per Module
+ /// where a function is found that was compiled with optimization, per
+ /// Process.
+ ///
+ /// @param [in] sc
+ /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule
+ /// pre-computed.
//------------------------------------------------------------------
void
- CompleteAttach ();
-
+ PrintWarningOptimization (const SymbolContext &sc);
+
public:
//------------------------------------------------------------------
/// Get the exit status for a process.
@@ -1958,13 +1970,12 @@ public:
/// Get a textual description of what the process exited.
///
/// @return
- /// The textual description of why the process exited, or NULL
+ /// The textual description of why the process exited, or nullptr
/// if there is no description available.
//------------------------------------------------------------------
const char *
GetExitDescription ();
-
virtual void
DidExit ()
{
@@ -2045,7 +2056,7 @@ public:
/// otherwise.
//------------------------------------------------------------------
virtual bool
- IsAlive () = 0;
+ IsAlive ();
//------------------------------------------------------------------
/// Before lldb detaches from a process, it warns the user that they are about to lose their debug session.
@@ -2255,7 +2266,6 @@ public:
return 0;
}
-
//------------------------------------------------------------------
/// Write all or part of a scalar value to memory.
///
@@ -2329,7 +2339,6 @@ public:
size_t
WriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error);
-
//------------------------------------------------------------------
/// Actually allocate memory in the process.
///
@@ -2352,7 +2361,6 @@ public:
return LLDB_INVALID_ADDRESS;
}
-
//------------------------------------------------------------------
/// The public interface to allocating memory in the process.
///
@@ -2369,16 +2377,41 @@ public:
/// that a block that isn't set writable can still be written on from 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.
//------------------------------------------------------------------
-
lldb::addr_t
AllocateMemory (size_t size, uint32_t permissions, Error &error);
+ //------------------------------------------------------------------
+ /// The public interface to allocating memory in the process, this also
+ /// clears the allocated memory.
+ ///
+ /// This function will allocate memory in the process's address
+ /// space. This can't rely on the generic function calling mechanism,
+ /// since that requires this function.
+ ///
+ /// @param[in] size
+ /// The size of the allocation requested.
+ ///
+ /// @param[in] permissions
+ /// Or together any of the lldb::Permissions bits. The permissions on
+ /// a given memory allocation can't be changed after allocation. Note
+ /// that a block that isn't set writable can still be written on from lldb,
+ /// just not by the process itself.
+ ///
+ /// @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.
+ //------------------------------------------------------------------
+
+ lldb::addr_t
+ CallocateMemory (size_t size, uint32_t permissions, Error &error);
//------------------------------------------------------------------
/// Resolve dynamically loaded indirect functions.
@@ -2393,7 +2426,6 @@ public:
/// The address of the resolved function.
/// LLDB_INVALID_ADDRESS if the resolution failed.
//------------------------------------------------------------------
-
virtual lldb::addr_t
ResolveIndirectFunction(const Address *address, Error &error);
@@ -2518,7 +2550,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
virtual Error
DoDeallocateMemory (lldb::addr_t ptr)
{
@@ -2527,7 +2558,6 @@ public:
return error;
}
-
//------------------------------------------------------------------
/// The public interface to deallocating memory in the process.
///
@@ -2541,7 +2571,6 @@ public:
/// @return
/// \btrue if the memory was deallocated, \bfalse otherwise.
//------------------------------------------------------------------
-
Error
DeallocateMemory (lldb::addr_t ptr);
@@ -2671,7 +2700,6 @@ public:
return error;
}
-
virtual Error
DisableBreakpointSite (BreakpointSite *bp_site)
{
@@ -2680,7 +2708,6 @@ public:
return error;
}
-
// This is implemented completely using the lldb::Process API. Subclasses
// don't need to implement this function unless the standard flow of
// read existing opcode, write breakpoint opcode, verify breakpoint opcode
@@ -2717,7 +2744,6 @@ public:
Error
EnableBreakpointSiteByID (lldb::user_id_t break_id);
-
// BreakpointLocations use RemoveOwnerFromBreakpointSite to remove
// themselves from the owner's list of this breakpoint sites.
void
@@ -2811,12 +2837,16 @@ public:
// Returns the process state when it is stopped. If specified, event_sp_ptr
// is set to the event which triggered the stop. If wait_always = false,
// and the process is already stopped, this function returns immediately.
+ // If the process is hijacked and use_run_lock is true (the default), then this
+ // function releases the run lock after the stop. Setting use_run_lock to false
+ // will avoid this behavior.
lldb::StateType
- WaitForProcessToStop (const TimeValue *timeout,
- lldb::EventSP *event_sp_ptr = NULL,
- bool wait_always = true,
- Listener *hijack_listener = NULL,
- Stream *stream = NULL);
+ WaitForProcessToStop(const TimeValue *timeout,
+ lldb::EventSP *event_sp_ptr = nullptr,
+ bool wait_always = true,
+ Listener *hijack_listener = nullptr,
+ Stream *stream = nullptr,
+ bool use_run_lock = true);
uint32_t
GetIOHandlerID () const
@@ -2838,9 +2868,9 @@ public:
SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);
lldb::StateType
- WaitForStateChangedEvents (const TimeValue *timeout,
- lldb::EventSP &event_sp,
- Listener *hijack_listener); // Pass NULL to use builtin listener
+ WaitForStateChangedEvents(const TimeValue *timeout,
+ lldb::EventSP &event_sp,
+ Listener *hijack_listener); // Pass nullptr to use builtin listener
//--------------------------------------------------------------------------------------
/// Centralize the code that handles and prints descriptions for process state changes.
@@ -2851,7 +2881,7 @@ public:
/// @param[in] stream
/// The output stream to get the state change description
///
- /// @param[inout] pop_process_io_handler
+ /// @param[in,out] pop_process_io_handler
/// If this value comes in set to \b true, then pop the Process IOHandler if needed.
/// Else this variable will be set to \b true or \b false to indicate if the process
/// needs to have its process IOHandler popped.
@@ -2863,9 +2893,9 @@ public:
HandleProcessStateChangedEvent (const lldb::EventSP &event_sp,
Stream *stream,
bool &pop_process_io_handler);
+
Event *
PeekAtStateChangedEvents ();
-
class
ProcessEventHijacker
@@ -2876,6 +2906,7 @@ public:
{
m_process.HijackProcessEvents (listener);
}
+
~ProcessEventHijacker ()
{
m_process.RestoreProcessEvents();
@@ -2884,6 +2915,7 @@ public:
private:
Process &m_process;
};
+
friend class ProcessEventHijacker;
friend class ProcessProperties;
//------------------------------------------------------------------
@@ -2910,27 +2942,6 @@ public:
void
RestoreProcessEvents ();
-private:
- //------------------------------------------------------------------
- /// 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 propagated, this call will most likely set
- /// the target to executing again.
- /// There is only one place where this call should be called, HandlePrivateEvent.
- /// Don't call it from anywhere else...
- ///
- /// @param[in] event_ptr
- /// This is the event we are handling.
- ///
- /// @return
- /// Returns \b true if the event should be reported to the
- /// user, \b false otherwise.
- //------------------------------------------------------------------
- bool
- ShouldBroadcastEvent (Event *event_ptr);
-
-public:
const lldb::ABISP &
GetABI ();
@@ -3004,29 +3015,29 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ()
+ lldb::ProcessSP
+ CalculateProcess() override
{
return shared_from_this();
}
- virtual lldb::ThreadSP
- CalculateThread ()
+ lldb::ThreadSP
+ CalculateThread() override
{
return lldb::ThreadSP();
}
- virtual lldb::StackFrameSP
- CalculateStackFrame ()
+ lldb::StackFrameSP
+ CalculateStackFrame() override
{
return lldb::StackFrameSP();
}
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
void
SetSTDIOFileDescriptor (int file_descriptor);
@@ -3129,9 +3140,70 @@ public:
return Error("Not supported");
}
+ size_t
+ AddImageToken(lldb::addr_t image_ptr);
+
+ lldb::addr_t
+ GetImagePtrFromToken(size_t token) const;
+
+ void
+ ResetImageToken(size_t token);
+
protected:
+ void
+ SetState (lldb::EventSP &event_sp);
+
+ lldb::StateType
+ GetPrivateState ();
+
+ //------------------------------------------------------------------
+ /// The "private" side of resuming a process. This doesn't alter the
+ /// state of m_run_lock, but just causes the process to resume.
+ ///
+ /// @return
+ /// An Error object describing the success or failure of the resume.
+ //------------------------------------------------------------------
+ Error
+ PrivateResume ();
//------------------------------------------------------------------
+ // Called internally
+ //------------------------------------------------------------------
+ void
+ CompleteAttach ();
+
+ //------------------------------------------------------------------
+ /// Print a user-visible warning one time per Process
+ ///
+ /// A facility for printing a warning to the user once per repeat_key.
+ ///
+ /// warning_type is from the Process::Warnings enums.
+ /// repeat_key is a pointer value that will be used to ensure that the
+ /// warning message is not printed multiple times. For instance, with a
+ /// warning about a function being optimized, you can pass the CompileUnit
+ /// pointer to have the warning issued for only the first function in a
+ /// CU, or the Function pointer to have it issued once for every function,
+ /// or a Module pointer to have it issued once per Module.
+ ///
+ /// Classes outside Process should call a specific PrintWarning method
+ /// so that the warning strings are all centralized in Process, instead of
+ /// calling PrintWarning() directly.
+ ///
+ /// @param [in] warning_type
+ /// One of the types defined in Process::Warnings.
+ ///
+ /// @param [in] repeat_key
+ /// A pointer value used to ensure that the warning is only printed once.
+ /// May be nullptr, indicating that the warning is printed unconditionally
+ /// every time.
+ ///
+ /// @param [in] fmt
+ /// printf style format string
+ //------------------------------------------------------------------
+ void
+ PrintWarning (uint64_t warning_type, const void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+
+ //------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
// event that is delivered to this process. There is currently only
// one next event action allowed in the process at one time. If a
@@ -3158,10 +3230,8 @@ protected:
}
virtual
- ~NextEventAction()
- {
- }
-
+ ~NextEventAction() = default;
+
virtual EventActionResult PerformAction (lldb::EventSP &event_sp) = 0;
virtual void HandleBeingUnshipped () {}
virtual EventActionResult HandleBeingInterrupted () = 0;
@@ -3170,6 +3240,7 @@ protected:
{
m_process->m_resume_requested = true;
}
+
protected:
Process *m_process;
};
@@ -3188,25 +3259,17 @@ protected:
public:
AttachCompletionHandler (Process *process, uint32_t exec_count);
- virtual
- ~AttachCompletionHandler()
- {
- }
-
- virtual EventActionResult PerformAction (lldb::EventSP &event_sp);
- virtual EventActionResult HandleBeingInterrupted ();
- virtual const char *GetExitString();
+ ~AttachCompletionHandler() override = default;
+
+ EventActionResult PerformAction(lldb::EventSP &event_sp) override;
+ EventActionResult HandleBeingInterrupted() override;
+ const char *GetExitString() override;
+
private:
uint32_t m_exec_count;
std::string m_exit_string;
};
- bool
- HijackPrivateProcessEvents (Listener *listener);
-
- void
- RestorePrivateProcessEvents ();
-
bool
PrivateStateThreadIsValid () const
{
@@ -3223,6 +3286,8 @@ protected:
// Type definitions
//------------------------------------------------------------------
typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection;
+ typedef std::unordered_set<const void *> WarningsPointerSet;
+ typedef std::map<uint64_t, WarningsPointerSet> WarningsCollection;
struct PreResumeCallbackAndBaton
{
@@ -3238,7 +3303,7 @@ protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
- Target & m_target; ///< The target that owns this process.
+ std::weak_ptr<Target> m_target_sp; ///< The target that owns this process.
ThreadSafeValue<lldb::StateType> m_public_state;
ThreadSafeValue<lldb::StateType> m_private_state; // The actual state of our process
Broadcaster m_private_state_broadcaster; // This broadcaster feeds state changed events into the private state thread's listener.
@@ -3290,7 +3355,6 @@ protected:
std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
ProcessRunLock m_public_run_lock;
ProcessRunLock m_private_run_lock;
- Predicate<bool> m_currently_handling_event; // This predicate is set in HandlePrivateEvent while all its business is being done.
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
@@ -3302,6 +3366,7 @@ protected:
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.
+ WarningsCollection m_warnings_issued; // A set of object pointers which have already had warnings printed
enum {
eCanJITDontKnow= 0,
@@ -3353,6 +3418,9 @@ protected:
void
HandlePrivateEvent (lldb::EventSP &event_sp);
+ Error
+ HaltPrivate();
+
lldb::StateType
WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp);
@@ -3401,23 +3469,39 @@ protected:
}
Error
- HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp);
+ StopForDestroyOrDetach(lldb::EventSP &exit_event_sp);
bool
StateChangedIsExternallyHijacked();
void
LoadOperatingSystemPlugin(bool flush);
+
private:
//------------------------------------------------------------------
- // For Process only
+ /// 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 propagated, this call will most likely set
+ /// the target to executing again.
+ /// There is only one place where this call should be called, HandlePrivateEvent.
+ /// Don't call it from anywhere else...
+ ///
+ /// @param[in] event_ptr
+ /// This is the event we are handling.
+ ///
+ /// @return
+ /// Returns \b true if the event should be reported to the
+ /// user, \b false otherwise.
//------------------------------------------------------------------
+ bool
+ ShouldBroadcastEvent (Event *event_ptr);
+
void ControlPrivateStateThread (uint32_t signal);
DISALLOW_COPY_AND_ASSIGN (Process);
-
};
} // namespace lldb_private
-#endif // liblldb_Process_h_
+#endif // liblldb_Process_h_
diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h
index c69c825a7976..aea506644c37 100644
--- a/include/lldb/Target/QueueItem.h
+++ b/include/lldb/Target/QueueItem.h
@@ -10,8 +10,14 @@
#ifndef liblldb_QueueItem_h_
#define liblldb_QueueItem_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
#include <vector>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
@@ -19,7 +25,6 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h"
-
namespace lldb_private {
//------------------------------------------------------------------
@@ -32,12 +37,10 @@ namespace lldb_private {
// execution of the item begins.
//------------------------------------------------------------------
-
class QueueItem :
public std::enable_shared_from_this<QueueItem>
{
public:
-
QueueItem (lldb::QueueSP queue_sp, lldb::ProcessSP process_sp, lldb::addr_t item_ref, lldb_private::Address address);
~QueueItem ();
@@ -98,7 +101,7 @@ public:
bool
IsValid ()
{
- return m_queue_wp.lock() != NULL;
+ return m_queue_wp.lock() != nullptr;
}
//------------------------------------------------------------------
@@ -200,7 +203,6 @@ protected:
void
FetchEntireItem ();
-
lldb::QueueWP m_queue_wp;
lldb::ProcessWP m_process_wp;
@@ -220,16 +222,10 @@ protected:
std::string m_queue_label;
std::string m_target_queue_label;
-
private:
- //------------------------------------------------------------------
- // For QueueItem only
- //------------------------------------------------------------------
-
DISALLOW_COPY_AND_ASSIGN (QueueItem);
-
};
} // namespace lldb_private
-#endif // liblldb_QueueItem_h_
+#endif // liblldb_QueueItem_h_
diff --git a/include/lldb/Target/RegisterContext.h b/include/lldb/Target/RegisterContext.h
index 9108d4575259..037c27adaf10 100644
--- a/include/lldb/Target/RegisterContext.h
+++ b/include/lldb/Target/RegisterContext.h
@@ -29,8 +29,7 @@ public:
//------------------------------------------------------------------
RegisterContext (Thread &thread, uint32_t concrete_frame_idx);
- virtual
- ~RegisterContext ();
+ ~RegisterContext() override;
void
InvalidateIfNeeded (bool force);
@@ -93,7 +92,7 @@ public:
///
/// There may be multiple ways to enumerate the registers for a given
/// architecture. ABI references will specify one to be used with
- /// DWARF, the register numberings from stabs (aka "gcc"), there may
+ /// DWARF, the register numberings from process plugin, there may
/// be a variation used for eh_frame unwind instructions (e.g. on Darwin),
/// and so on. Register 5 by itself is meaningless - RegisterKind
/// enumeration tells you what context that number should be translated as.
@@ -213,26 +212,27 @@ public:
bool
WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval);
+
bool
ConvertBetweenRegisterKinds (lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t& target_regnum);
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
uint32_t
GetStopID () const
@@ -262,4 +262,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_RegisterContext_h_
+#endif // liblldb_RegisterContext_h_
diff --git a/include/lldb/Target/SectionLoadList.h b/include/lldb/Target/SectionLoadList.h
index 6a9bbab93c98..5f5d39e2b24b 100644
--- a/include/lldb/Target/SectionLoadList.h
+++ b/include/lldb/Target/SectionLoadList.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/DenseMap.h"
// Project includes
#include "lldb/lldb-public.h"
+#include "lldb/Core/Section.h"
#include "lldb/Host/Mutex.h"
namespace lldb_private {
diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h
index 95e21445be04..b65b01810176 100644
--- a/include/lldb/Target/StackFrame.h
+++ b/include/lldb/Target/StackFrame.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <memory>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Error.h"
@@ -45,11 +47,12 @@ class StackFrame :
public:
enum ExpressionPathOption
{
- eExpressionPathOptionCheckPtrVsMember = (1u << 0),
- eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
- eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
- eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
- eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4)
+ eExpressionPathOptionCheckPtrVsMember = (1u << 0),
+ eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
+ eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
+ eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
+ eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4),
+ eExpressionPathOptionsInspectAnonymousUnions = (1u << 5)
};
//------------------------------------------------------------------
@@ -135,7 +138,7 @@ public:
const Address& pc,
const SymbolContext *sc_ptr);
- virtual ~StackFrame ();
+ ~StackFrame() override;
lldb::ThreadSP
GetThread () const
@@ -223,7 +226,7 @@ public:
/// executing.
///
/// @return
- /// A pointer to the current Block. NULL is returned if this can
+ /// A pointer to the current Block. nullptr is returned if this can
/// not be provided.
//------------------------------------------------------------------
Block *
@@ -351,7 +354,7 @@ public:
/// Optional string that will be prepended to the frame output description.
//------------------------------------------------------------------
void
- DumpUsingSettingsFormat (Stream *strm, const char *frame_marker = NULL);
+ DumpUsingSettingsFormat(Stream *strm, const char *frame_marker = nullptr);
//------------------------------------------------------------------
/// Print a description for this frame using a default format.
@@ -388,10 +391,10 @@ public:
/// Returns true if successful.
//------------------------------------------------------------------
bool
- GetStatus (Stream &strm,
- bool show_frame_info,
- bool show_source,
- const char *frame_marker = NULL);
+ GetStatus(Stream &strm,
+ bool show_frame_info,
+ bool show_source,
+ const char *frame_marker = nullptr);
//------------------------------------------------------------------
/// Query whether this frame is a concrete frame on the call stack,
@@ -466,22 +469,32 @@ public:
TrackGlobalVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic);
//------------------------------------------------------------------
+ /// Query this frame to determine what the default language should be
+ /// when parsing expressions given the execution context.
+ ///
+ /// @return
+ /// The language of the frame if known, else lldb::eLanguageTypeUnknown.
+ //------------------------------------------------------------------
+ lldb::LanguageType
+ GetLanguage ();
+
+ //------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
protected:
friend class StackFrameList;
@@ -520,9 +533,10 @@ private:
ValueObjectList m_variable_list_value_objects; // Value objects for each variable in m_variable_list_sp
StreamString m_disassembly;
Mutex m_mutex;
+
DISALLOW_COPY_AND_ASSIGN (StackFrame);
};
} // namespace lldb_private
-#endif // liblldb_StackFrame_h_
+#endif // liblldb_StackFrame_h_
diff --git a/include/lldb/Target/StackFrameList.h b/include/lldb/Target/StackFrameList.h
index 2680be3e5a68..50a656de9e69 100644
--- a/include/lldb/Target/StackFrameList.h
+++ b/include/lldb/Target/StackFrameList.h
@@ -12,6 +12,7 @@
// C Includes
// C++ Includes
+#include <memory>
#include <vector>
// Other libraries and framework includes
@@ -84,15 +85,14 @@ public:
GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr);
size_t
- GetStatus (Stream &strm,
- uint32_t first_frame,
- uint32_t num_frames,
- bool show_frame_info,
- uint32_t num_frames_with_source,
- const char *frame_marker = NULL);
+ GetStatus(Stream &strm,
+ uint32_t first_frame,
+ uint32_t num_frames,
+ bool show_frame_info,
+ uint32_t num_frames_with_source,
+ const char *frame_marker = nullptr);
protected:
-
friend class Thread;
bool
@@ -129,9 +129,6 @@ protected:
void
SetCurrentInlinedDepth (uint32_t new_depth);
- //------------------------------------------------------------------
- // Classes that inherit from StackFrameList can see and modify these
- //------------------------------------------------------------------
typedef std::vector<lldb::StackFrameSP> collection;
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
@@ -147,12 +144,9 @@ protected:
bool m_show_inlined_frames;
private:
- //------------------------------------------------------------------
- // For StackFrameList only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (StackFrameList);
};
} // namespace lldb_private
-#endif // liblldb_StackFrameList_h_
+#endif // liblldb_StackFrameList_h_
diff --git a/include/lldb/Target/StackID.h b/include/lldb/Target/StackID.h
index 75ad8ab38903..aad9d0cfc25c 100644
--- a/include/lldb/Target/StackID.h
+++ b/include/lldb/Target/StackID.h
@@ -28,7 +28,7 @@ public:
StackID () :
m_pc (LLDB_INVALID_ADDRESS),
m_cfa (LLDB_INVALID_ADDRESS),
- m_symbol_scope (NULL)
+ m_symbol_scope (nullptr)
{
}
@@ -47,9 +47,7 @@ public:
{
}
- ~StackID()
- {
- }
+ ~StackID() = default;
lldb::addr_t
GetPC() const
@@ -80,7 +78,7 @@ public:
{
m_pc = LLDB_INVALID_ADDRESS;
m_cfa = LLDB_INVALID_ADDRESS;
- m_symbol_scope = NULL;
+ m_symbol_scope = nullptr;
}
bool
@@ -108,7 +106,6 @@ public:
}
protected:
-
friend class StackFrame;
void
@@ -123,18 +120,15 @@ protected:
m_cfa = cfa;
}
- //------------------------------------------------------------------
- // Classes that inherit from StackID can see and modify these
- //------------------------------------------------------------------
lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will
- // only get used if the symbol scope is NULL (the code where we are
+ // only get used if the symbol scope is nullptr (the code where we are
// stopped is not represented by any function or symbol in any
// shared library).
lldb::addr_t m_cfa; // The call frame address (stack pointer) value
// at the beginning of the function that uniquely
// identifies this frame (along with m_symbol_scope below)
- SymbolContextScope *m_symbol_scope; // If NULL, there is no block or symbol for this frame.
- // If not NULL, this will either be the scope for the
+ SymbolContextScope *m_symbol_scope; // If nullptr, there is no block or symbol for this frame.
+ // If not nullptr, this will either be the scope for the
// lexical block for the frame, or the scope
// for the symbol. Symbol context scopes are
// always be unique pointers since the are part
@@ -151,4 +145,4 @@ bool operator< (const StackID& lhs, const StackID& rhs);
} // namespace lldb_private
-#endif // liblldb_StackID_h_
+#endif // liblldb_StackID_h_
diff --git a/include/lldb/Target/StopInfo.h b/include/lldb/Target/StopInfo.h
index 2553887fa3d9..dfc9860b604a 100644
--- a/include/lldb/Target/StopInfo.h
+++ b/include/lldb/Target/StopInfo.h
@@ -172,7 +172,7 @@ public:
static lldb::StopInfoSP
CreateStopReasonWithPlan (lldb::ThreadPlanSP &plan,
lldb::ValueObjectSP return_valobj_sp,
- lldb::ClangExpressionVariableSP expression_variable_sp);
+ lldb::ExpressionVariableSP expression_variable_sp);
static lldb::StopInfoSP
CreateStopReasonWithException (Thread &thread, const char *description);
@@ -183,7 +183,7 @@ public:
static lldb::ValueObjectSP
GetReturnValueObject (lldb::StopInfoSP &stop_info_sp);
- static lldb::ClangExpressionVariableSP
+ static lldb::ExpressionVariableSP
GetExpressionVariable (lldb::StopInfoSP &stop_info_sp);
protected:
diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h
index 18f38f79bdbd..54fde88c8d12 100644
--- a/include/lldb/Target/SystemRuntime.h
+++ b/include/lldb/Target/SystemRuntime.h
@@ -75,8 +75,7 @@ public:
/// The destructor is virtual since this class is designed to be
/// inherited by the plug-in instance.
//------------------------------------------------------------------
- virtual
- ~SystemRuntime();
+ ~SystemRuntime() override;
//------------------------------------------------------------------
/// Called after attaching to a process.
@@ -354,9 +353,10 @@ protected:
std::vector<ConstString> m_types;
private:
+
DISALLOW_COPY_AND_ASSIGN (SystemRuntime);
};
} // namespace lldb_private
-#endif // liblldb_SystemRuntime_h_
+#endif // liblldb_SystemRuntime_h_
diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h
index 427f68e4c5d4..0cdb248a9b44 100644
--- a/include/lldb/Target/Target.h
+++ b/include/lldb/Target/Target.h
@@ -13,6 +13,10 @@
// C Includes
// C++ Includes
#include <list>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
// Other libraries and framework includes
// Project includes
@@ -24,6 +28,8 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/UserSettingsController.h"
+#include "lldb/Expression/Expression.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/ProcessLaunchInfo.h"
@@ -55,8 +61,7 @@ class TargetProperties : public Properties
public:
TargetProperties(Target *target);
- virtual
- ~TargetProperties();
+ ~TargetProperties() override;
ArchSpec
GetDefaultArchitecture () const;
@@ -169,6 +174,9 @@ public:
bool
GetBreakpointsConsultPlatformAvoidList ();
+ lldb::LanguageType
+ GetLanguage () const;
+
const char *
GetExpressionPrefixContentsAsCString ();
@@ -229,7 +237,6 @@ private:
static void DisableASLRValueChangedCallback(void *target_property_ptr, OptionValue *);
static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *);
-private:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
@@ -295,9 +302,7 @@ public:
const char *
GetPrefix () const
{
- if (m_prefix.empty())
- return NULL;
- return m_prefix.c_str();
+ return (m_prefix.empty() ? nullptr : m_prefix.c_str());
}
void
@@ -438,6 +443,18 @@ public:
}
bool
+ GetColorizeErrors () const
+ {
+ return m_ansi_color_errors;
+ }
+
+ void
+ SetColorizeErrors (bool b)
+ {
+ m_ansi_color_errors = b;
+ }
+
+ bool
GetTrapExceptions() const
{
return m_trap_exceptions;
@@ -449,6 +466,18 @@ public:
m_trap_exceptions = b;
}
+ bool
+ GetREPLEnabled() const
+ {
+ return m_repl;
+ }
+
+ void
+ SetREPLEnabled (bool b)
+ {
+ m_repl = b;
+ }
+
void
SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
{
@@ -459,10 +488,36 @@ public:
bool
InvokeCancelCallback (lldb::ExpressionEvaluationPhase phase) const
{
- if (m_cancel_callback == nullptr)
- return false;
+ return ((m_cancel_callback != nullptr) ? m_cancel_callback(phase, m_cancel_callback_baton) : false);
+ }
+
+ // Allows the expression contents to be remapped to point to the specified file and line
+ // using #line directives.
+ void
+ SetPoundLine (const char *path, uint32_t line) const
+ {
+ if (path && path[0])
+ {
+ m_pound_line_file = path;
+ m_pound_line_line = line;
+ }
else
- return m_cancel_callback (phase, m_cancel_callback_baton);
+ {
+ m_pound_line_file.clear();
+ m_pound_line_line = 0;
+ }
+ }
+
+ const char *
+ GetPoundLineFilePath () const
+ {
+ return (m_pound_line_file.empty() ? nullptr : m_pound_line_file.c_str());
+ }
+
+ uint32_t
+ GetPoundLineLine () const
+ {
+ return m_pound_line_line;
}
void
@@ -489,13 +544,20 @@ private:
bool m_stop_others;
bool m_debug;
bool m_trap_exceptions;
+ bool m_repl;
bool m_generate_debug_info;
+ bool m_ansi_color_errors;
bool m_result_is_internal;
lldb::DynamicValueType m_use_dynamic;
uint32_t m_timeout_usec;
uint32_t m_one_thread_timeout_usec;
lldb::ExpressionCancelCallback m_cancel_callback;
void *m_cancel_callback_baton;
+ // If m_pound_line_file is not empty and m_pound_line_line is non-zero,
+ // use #line %u "%s" before the expression content to remap where the source
+ // originates
+ mutable std::string m_pound_line_file;
+ mutable uint32_t m_pound_line_line;
};
//----------------------------------------------------------------------
@@ -527,7 +589,7 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
@@ -540,20 +602,19 @@ public:
TargetEventData (const lldb::TargetSP &target_sp, const ModuleList &module_list);
- virtual
- ~TargetEventData();
+ ~TargetEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const
+ const ConstString &
+ GetFlavor() const override
{
return TargetEventData::GetFlavorString ();
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static const TargetEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -583,6 +644,8 @@ public:
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
+ ~Target() override;
+
static void
SettingsInitialize ();
@@ -608,8 +671,8 @@ public:
// UpdateInstanceName ();
lldb::ModuleSP
- GetSharedModule (const ModuleSpec &module_spec,
- Error *error_ptr = NULL);
+ GetSharedModule(const ModuleSpec &module_spec,
+ Error *error_ptr = nullptr);
//----------------------------------------------------------------------
// Settings accessors
@@ -618,36 +681,6 @@ public:
static const lldb::TargetPropertiesSP &
GetGlobalProperties();
-
-private:
- //------------------------------------------------------------------
- /// Construct with optional file and arch.
- ///
- /// This member is private. Clients must use
- /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- /// so all targets can be tracked from the central target list.
- ///
- /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
- //------------------------------------------------------------------
- Target (Debugger &debugger,
- const ArchSpec &target_arch,
- const lldb::PlatformSP &platform_sp,
- bool is_dummy_target);
-
- // Helper function.
- bool
- ProcessIsValid ();
-
- // Copy breakpoints, stop hooks and so forth from the dummy target:
- void
- PrimeFromDummyTarget(Target *dummy_target);
-
- void
- AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
-
-public:
- ~Target();
-
Mutex &
GetAPIMutex ()
{
@@ -659,6 +692,7 @@ public:
void
CleanupProcess ();
+
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
@@ -718,7 +752,7 @@ public:
lldb::BreakpointSP
GetBreakpointByID (lldb::break_id_t break_id);
- // Use this to create a file and line breakpoint to a given module or all module it is NULL
+ // Use this to create a file and line breakpoint to a given module or all module it is nullptr
lldb::BreakpointSP
CreateBreakpoint (const FileSpecList *containingModules,
const FileSpec &file,
@@ -744,24 +778,32 @@ public:
bool internal,
bool request_hardware);
+ // Use this to create a breakpoint from a load address and a module file spec
+ lldb::BreakpointSP
+ CreateAddressInModuleBreakpoint (lldb::addr_t file_addr,
+ bool internal,
+ const FileSpec *file_spec,
+ bool request_hardware);
+
// Use this to create Address breakpoints:
lldb::BreakpointSP
- CreateBreakpoint (Address &addr,
+ CreateBreakpoint (const Address &addr,
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is NULL
+ // Use this to create a function breakpoint by regexp in containingModule/containingSourceFiles, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in
lldb::BreakpointSP
CreateFuncRegexBreakpoint (const FileSpecList *containingModules,
const FileSpecList *containingSourceFiles,
RegularExpression &func_regexp,
+ lldb::LanguageType requested_language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
- // Use this to create a function breakpoint by name in containingModule, or all modules if it is NULL
+ // Use this to create a function breakpoint by name in containingModule, or all modules if it is nullptr
// When "skip_prologue is set to eLazyBoolCalculate, we use the current target
// setting, else we use the values passed in.
// func_name_type_mask is or'ed values from the FunctionNameType enum.
@@ -770,17 +812,18 @@ public:
const FileSpecList *containingSourceFiles,
const char *func_name,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
lldb::BreakpointSP
- CreateExceptionBreakpoint (enum lldb::LanguageType language,
- bool catch_bp,
- bool throw_bp,
- bool internal,
- Args *additional_args = nullptr,
- Error *additional_args_error = nullptr);
+ CreateExceptionBreakpoint(enum lldb::LanguageType language,
+ bool catch_bp,
+ bool throw_bp,
+ bool internal,
+ Args *additional_args = nullptr,
+ Error *additional_args_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 the case where you just want to set a breakpoint on a set of names
@@ -792,6 +835,7 @@ public:
const char *func_names[],
size_t num_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
@@ -801,11 +845,11 @@ public:
const FileSpecList *containingSourceFiles,
const std::vector<std::string> &func_names,
uint32_t func_name_type_mask,
+ lldb::LanguageType language,
LazyBool skip_prologue,
bool internal,
bool request_hardware);
-
// Use this to create a general breakpoint:
lldb::BreakpointSP
CreateBreakpoint (lldb::SearchFilterSP &filter_sp,
@@ -818,7 +862,7 @@ public:
lldb::WatchpointSP
CreateWatchpoint (lldb::addr_t addr,
size_t size,
- const ClangASTType *type,
+ const CompilerType *type,
uint32_t kind,
Error &error);
@@ -914,26 +958,14 @@ public:
lldb::addr_t
GetOpcodeLoadAddress (lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
-protected:
- //------------------------------------------------------------------
- /// Implementing of ModuleList::Notifier.
- //------------------------------------------------------------------
-
- virtual void
- ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
-
- virtual void
- ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
-
- virtual void
- ModuleUpdated (const ModuleList& module_list,
- const lldb::ModuleSP& old_module_sp,
- const lldb::ModuleSP& new_module_sp);
- virtual void
- WillClearList (const ModuleList& module_list);
+ // Get load_addr as breakable load address for this target.
+ // Take a addr and check if for any reason there is a better address than this to put a breakpoint on.
+ // If there is then return that address.
+ // For MIPS, if instruction at addr is a delay slot instruction then this method will find the address of its
+ // previous instruction and return that address.
+ lldb::addr_t
+ GetBreakableLoadAddress (lldb::addr_t addr);
-public:
-
void
ModulesDidLoad (ModuleList &module_list);
@@ -970,7 +1002,7 @@ public:
///
/// @return
/// The shared pointer to the executable module which can
- /// contains a NULL Module object if no executable has been
+ /// contains a nullptr Module object if no executable has been
/// set.
///
/// @see DynamicLoader
@@ -1014,9 +1046,9 @@ public:
SetExecutableModule (lldb::ModuleSP& module_sp, bool get_dependent_files);
bool
- LoadScriptingResources (std::list<Error>& errors,
- Stream* feedback_stream = NULL,
- bool continue_on_error = true)
+ LoadScriptingResources(std::list<Error>& errors,
+ Stream* feedback_stream = nullptr,
+ bool continue_on_error = true)
{
return m_images.LoadScriptingResourcesInTarget(this,errors,feedback_stream,continue_on_error);
}
@@ -1146,12 +1178,12 @@ public:
// 2 - if there is a valid process, try and read from its memory
// 3 - if (prefer_file_cache == false) then read from object file cache
size_t
- ReadMemory (const Address& addr,
- bool prefer_file_cache,
- void *dst,
- size_t dst_len,
- Error &error,
- lldb::addr_t *load_addr_ptr = NULL);
+ ReadMemory(const Address& addr,
+ bool prefer_file_cache,
+ void *dst,
+ size_t dst_len,
+ Error &error,
+ lldb::addr_t *load_addr_ptr = nullptr);
size_t
ReadCStringFromMemory (const Address& addr, std::string &out_str, Error &error);
@@ -1199,28 +1231,70 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
PathMappingList &
GetImageSearchPathList ();
+ TypeSystem *
+ GetScratchTypeSystemForLanguage (Error *error, lldb::LanguageType language, bool create_on_demand = true);
+
+ PersistentExpressionState *
+ GetPersistentExpressionStateForLanguage (lldb::LanguageType language);
+
+ // Creates a UserExpression for the given language, the rest of the parameters have the
+ // same meaning as for the UserExpression constructor.
+ // Returns a new-ed object which the caller owns.
+
+ UserExpression *
+ GetUserExpressionForLanguage(const char *expr,
+ const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options,
+ Error &error);
+
+ // Creates a FunctionCaller for the given language, the rest of the parameters have the
+ // same meaning as for the FunctionCaller constructor. Since a FunctionCaller can't be
+ // IR Interpreted, it makes no sense to call this with an ExecutionContextScope that lacks
+ // a Process.
+ // Returns a new-ed object which the caller owns.
+
+ FunctionCaller *
+ GetFunctionCallerForLanguage (lldb::LanguageType language,
+ const CompilerType &return_type,
+ const Address& function_address,
+ const ValueList &arg_value_list,
+ const char *name,
+ Error &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,
+ Error &error);
+
ClangASTContext *
GetScratchClangASTContext(bool create_on_demand=true);
- ClangASTImporter *
+ lldb::ClangASTImporterSP
GetClangASTImporter();
//----------------------------------------------------------------------
@@ -1266,23 +1340,26 @@ public:
// in in th execution context.
lldb::ExpressionResults
EvaluateExpression (const char *expression,
- StackFrame *frame,
+ ExecutionContextScope *exe_scope,
lldb::ValueObjectSP &result_valobj_sp,
const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
- ClangPersistentVariables &
- GetPersistentVariables();
-
+ lldb::ExpressionVariableSP
+ GetPersistentVariable(const ConstString &name);
+
+ lldb::addr_t
+ GetPersistentSymbol(const ConstString &name);
+
//------------------------------------------------------------------
// Target Stop Hooks
//------------------------------------------------------------------
class StopHook : public UserID
{
public:
- ~StopHook ();
-
StopHook (const StopHook &rhs);
-
+
+ ~StopHook ();
+
StringList *
GetCommandPointer ()
{
@@ -1448,9 +1525,32 @@ public:
lldb::SearchFilterSP
GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles);
+
+ lldb::REPLSP
+ GetREPL (Error &err, lldb::LanguageType language, const char *repl_options, bool can_create);
+
+ void
+ SetREPL (lldb::LanguageType language, lldb::REPLSP repl_sp);
protected:
//------------------------------------------------------------------
+ /// Implementing of ModuleList::Notifier.
+ //------------------------------------------------------------------
+
+ void
+ ModuleAdded(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleRemoved(const ModuleList& module_list, const lldb::ModuleSP& module_sp) override;
+
+ void
+ ModuleUpdated(const ModuleList& module_list,
+ const lldb::ModuleSP& old_module_sp,
+ const lldb::ModuleSP& new_module_sp) override;
+ void
+ WillClearList(const ModuleList& module_list) override;
+
+ //------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
Debugger & m_debugger;
@@ -1470,11 +1570,13 @@ protected:
lldb::ProcessSP m_process_sp;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
- lldb::ClangASTContextUP m_scratch_ast_context_ap;
- lldb::ClangASTSourceUP m_scratch_ast_source_ap;
- lldb::ClangASTImporterUP m_ast_importer_ap;
+ TypeSystemMap m_scratch_type_system_map;
+
+ 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_ap;
- lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
lldb::SourceManagerUP m_source_manager_ap;
@@ -1490,9 +1592,34 @@ protected:
void *baton);
private:
+ //------------------------------------------------------------------
+ /// Construct with optional file and arch.
+ ///
+ /// This member is private. Clients must use
+ /// TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ /// so all targets can be tracked from the central target list.
+ ///
+ /// @see TargetList::CreateTarget(const FileSpec*, const ArchSpec*)
+ //------------------------------------------------------------------
+ Target (Debugger &debugger,
+ const ArchSpec &target_arch,
+ const lldb::PlatformSP &platform_sp,
+ bool is_dummy_target);
+
+ // Helper function.
+ bool
+ ProcessIsValid ();
+
+ // Copy breakpoints, stop hooks and so forth from the dummy target:
+ void
+ PrimeFromDummyTarget(Target *dummy_target);
+
+ void
+ AddBreakpoint(lldb::BreakpointSP breakpoint_sp, bool internal);
+
DISALLOW_COPY_AND_ASSIGN (Target);
};
} // namespace lldb_private
-#endif // liblldb_Target_h_
+#endif // liblldb_Target_h_
diff --git a/include/lldb/Target/TargetList.h b/include/lldb/Target/TargetList.h
index 27e46ba81a70..fddb715b46f3 100644
--- a/include/lldb/Target/TargetList.h
+++ b/include/lldb/Target/TargetList.h
@@ -12,6 +12,8 @@
// C Includes
// C++ Includes
+#include <vector>
+
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Broadcaster.h"
@@ -37,7 +39,6 @@ private:
TargetList(Debugger &debugger);
public:
-
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -51,12 +52,12 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
- virtual ~TargetList();
+ ~TargetList() override;
//------------------------------------------------------------------
/// Create a new Target.
@@ -72,12 +73,12 @@ public:
///
/// @param[in] file_spec
/// The main executable file for a debug target. This value
- /// can be NULL and the file can be set later using:
+ /// can be nullptr and the file can be set later using:
/// Target::SetExecutableModule (ModuleSP&)
///
/// @param[in] triple_cstr
/// A target triple string to be used for the target. This can
- /// be NULL if the triple is not known or when attaching to a
+ /// be nullptr if the triple is not known or when attaching to a
/// process.
///
/// @param[in] get_dependent_modules
@@ -86,7 +87,7 @@ public:
///
/// @param[in] platform_options
/// A pointer to the platform options to use when creating this
- /// target. If this value is NULL, then the currently selected
+ /// target. If this value is nullptr, then the currently selected
/// platform will be used.
///
/// @param[out] target_sp
@@ -149,7 +150,7 @@ public:
//------------------------------------------------------------------
/// Find the target that contains has an executable whose path
/// matches \a exe_file_spec, and whose architecture matches
- /// \a arch_ptr if arch_ptr is not NULL.
+ /// \a arch_ptr if arch_ptr is not nullptr.
///
/// @param[in] exe_file_spec
/// A file spec containing a basename, or a full path (directory
@@ -160,18 +161,18 @@ public:
/// directory, then both must match.
///
/// @param[in] exe_arch_ptr
- /// If not NULL then the architecture also needs to match, else
+ /// If not nullptr then the architecture also needs to match, else
/// the architectures will be compared.
///
/// @return
/// A shared pointer to a target object. The returned shared
- /// pointer will contain NULL if no target objects have a
+ /// pointer will contain nullptr if no target objects have a
/// executable whose full or partial path matches
/// with a matching process ID.
//------------------------------------------------------------------
lldb::TargetSP
- FindTargetWithExecutableAndArchitecture (const FileSpec &exe_file_spec,
- const ArchSpec *exe_arch_ptr = NULL) const;
+ FindTargetWithExecutableAndArchitecture(const FileSpec &exe_file_spec,
+ const ArchSpec *exe_arch_ptr = nullptr) const;
//------------------------------------------------------------------
/// Find the target that contains a process with process ID \a
@@ -182,7 +183,7 @@ public:
///
/// @return
/// A shared pointer to a target object. The returned shared
- /// pointer will contain NULL if no target objects own a process
+ /// pointer will contain nullptr if no target objects own a process
/// with a matching process ID.
//------------------------------------------------------------------
lldb::TargetSP
@@ -230,6 +231,7 @@ protected:
lldb::TargetSP m_dummy_target_sp;
mutable Mutex m_target_list_mutex;
uint32_t m_selected_target_idx;
+
private:
lldb::TargetSP
GetDummyTarget (lldb_private::Debugger &debugger);
@@ -262,4 +264,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_TargetList_h_
+#endif // liblldb_TargetList_h_
diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h
index c6a3c8e9851a..7aff77bd16f4 100644
--- a/include/lldb/Target/Thread.h
+++ b/include/lldb/Target/Thread.h
@@ -10,6 +10,14 @@
#ifndef liblldb_Thread_h_
#define liblldb_Thread_h_
+// C Includes
+// C++ Includes
+#include <memory>
+#include <string>
+#include <vector>
+
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Core/Broadcaster.h"
@@ -30,8 +38,7 @@ class ThreadProperties : public Properties
public:
ThreadProperties(bool is_global);
- virtual
- ~ThreadProperties();
+ ~ThreadProperties() override;
//------------------------------------------------------------------
/// The regular expression returned determines symbols that this
@@ -39,7 +46,7 @@ public:
///
/// @return
/// A pointer to a regular expression to compare against symbols,
- /// or NULL if all symbols are allowed.
+ /// or nullptr if all symbols are allowed.
///
//------------------------------------------------------------------
const RegularExpression *
@@ -82,7 +89,7 @@ public:
static ConstString &GetStaticBroadcasterClass ();
- virtual ConstString &GetBroadcasterClass() const
+ ConstString &GetBroadcasterClass() const override
{
return GetStaticBroadcasterClass();
}
@@ -97,19 +104,19 @@ public:
ThreadEventData();
- virtual ~ThreadEventData();
+ ~ThreadEventData() override;
static const ConstString &
GetFlavorString ();
- virtual const ConstString &
- GetFlavor () const
+ const ConstString &
+ GetFlavor() const override
{
return ThreadEventData::GetFlavorString ();
}
- virtual void
- Dump (Stream *s) const;
+ void
+ Dump(Stream *s) const override;
static const ThreadEventData *
GetEventDataFromEvent (const Event *event_ptr);
@@ -138,9 +145,9 @@ public:
private:
lldb::ThreadSP m_thread_sp;
StackID m_stack_id;
- DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
+
+ DISALLOW_COPY_AND_ASSIGN (ThreadEventData);
};
-
struct ThreadStateCheckpoint
{
@@ -151,15 +158,6 @@ public:
lldb::addr_t current_inlined_pc;
};
- static void
- SettingsInitialize ();
-
- static void
- SettingsTerminate ();
-
- static const ThreadPropertiesSP &
- GetGlobalProperties();
-
//------------------------------------------------------------------
/// Constructor
///
@@ -179,7 +177,16 @@ public:
//------------------------------------------------------------------
Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
- virtual ~Thread();
+ ~Thread() override;
+
+ static void
+ SettingsInitialize ();
+
+ static void
+ SettingsTerminate ();
+
+ static const ThreadPropertiesSP &
+ GetGlobalProperties();
lldb::ProcessSP
GetProcess() const
@@ -303,6 +310,9 @@ public:
lldb::StopReason
GetStopReason();
+ bool
+ StopInfoIsUpToDate() const;
+
// This sets the stop reason to a "blank" stop reason, so you can call functions on the thread
// without having the called function run with whatever stop reason you stopped with.
void
@@ -320,7 +330,7 @@ public:
virtual const char *
GetInfo ()
{
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------
@@ -348,7 +358,7 @@ public:
virtual const char *
GetName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -390,12 +400,12 @@ public:
///
/// @return
/// The Queue name, if the Thread subclass implements this, else
- /// NULL.
+ /// nullptr.
//------------------------------------------------------------------
virtual const char *
GetQueueName ()
{
- return NULL;
+ return nullptr;
}
virtual void
@@ -475,7 +485,7 @@ public:
ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return_value_sp, bool broadcast = false);
Error
- JumpToLine (const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = NULL);
+ JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, std::string *warnings = nullptr);
virtual lldb::StackFrameSP
GetFrameWithStackID (const StackID &stack_id)
@@ -492,16 +502,11 @@ public:
}
lldb::StackFrameSP
- GetSelectedFrame ()
- {
- lldb::StackFrameListSP stack_frame_list_sp(GetStackFrameList());
- return stack_frame_list_sp->GetFrameAtIndex (stack_frame_list_sp->GetSelectedFrameIndex());
- }
+ GetSelectedFrame ();
uint32_t
SetSelectedFrame (lldb_private::StackFrame *frame, bool broadcast = false);
-
bool
SetSelectedFrameByIndex (uint32_t frame_idx, bool broadcast = false);
@@ -608,6 +613,7 @@ public:
//------------------------------------------------------------------
virtual Error
StepOut ();
+
//------------------------------------------------------------------
/// Retrieves the per-thread data area.
/// Most OSs maintain a per-thread pointer (e.g. the FS register on
@@ -684,7 +690,7 @@ public:
/// Otherwise this plan will go on the end of the plan stack.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueFundamentalPlan (bool abort_other_plans);
@@ -703,7 +709,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepSingleInstruction (bool step_over,
@@ -739,7 +745,7 @@ public:
/// If eLazyBoolCalculate, we will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOverRange (bool abort_other_plans,
@@ -748,6 +754,15 @@ public:
lldb::RunMode stop_other_threads,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+ // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple
+ // LineEntries of the same source line number to step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepOverRange (bool abort_other_plans,
+ const LineEntry &line_entry,
+ const SymbolContext &addr_context,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
//------------------------------------------------------------------
/// Queues the plan used to step through an address range, stepping into functions.
///
@@ -783,7 +798,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepInRange (bool abort_other_plans,
@@ -794,6 +809,17 @@ public:
LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+ // Helper function that takes a LineEntry to step, insted of an AddressRange. This may combine multiple
+ // LineEntries of the same source line number to step over a longer address range in a single operation.
+ virtual lldb::ThreadPlanSP
+ QueueThreadPlanForStepInRange (bool abort_other_plans,
+ const LineEntry &line_entry,
+ const SymbolContext &addr_context,
+ const char *step_in_target,
+ lldb::RunMode stop_other_threads,
+ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate,
+ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate);
+
//------------------------------------------------------------------
/// Queue the plan used to step out of the function at the current PC of
/// \a thread.
@@ -824,7 +850,7 @@ public:
/// If eLazyBoolCalculate, it will consult the default set in the thread.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOut (bool abort_other_plans,
@@ -863,7 +889,7 @@ public:
/// See standard meanings for the stop & run votes in ThreadPlan.h.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepOutNoShouldStop (bool abort_other_plans,
@@ -891,7 +917,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForStepThrough (StackID &return_stack_id,
@@ -914,7 +940,7 @@ public:
/// \b true if we will stop other threads while we single step this one.
///
/// @return
- /// A shared pointer to the newly queued thread plan, or NULL if the plan could not be queued.
+ /// A shared pointer to the newly queued thread plan, or nullptr if the plan could not be queued.
//------------------------------------------------------------------
virtual lldb::ThreadPlanSP
QueueThreadPlanForRunToAddress (bool abort_other_plans,
@@ -957,15 +983,6 @@ public:
Error
UnwindInnermostExpression();
-private:
- bool
- PlanIsBasePlan (ThreadPlan *plan_ptr);
-
- void
- BroadcastSelectedFrameChange(StackID &new_frame_id);
-
-public:
-
//------------------------------------------------------------------
/// Gets the outer-most plan that was popped off the plan stack in the
/// most recent stop. Useful for printing the stop reason accurately.
@@ -990,11 +1007,11 @@ public:
/// Gets the outer-most expression variable from the completed plans
///
/// @return
- /// A ClangExpressionVariableSP, either empty if there is no
+ /// 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::ClangExpressionVariableSP
+ lldb::ExpressionVariableSP
GetExpressionVariable ();
//------------------------------------------------------------------
@@ -1041,7 +1058,6 @@ public:
void
QueueThreadPlan (lldb::ThreadPlanSP &plan_sp, bool abort_other_plans);
-
//------------------------------------------------------------------
/// Discards the plans queued on the plan stack of the current thread. This is
/// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call.
@@ -1147,20 +1163,20 @@ public:
//------------------------------------------------------------------
// lldb::ExecutionContextScope pure virtual functions
//------------------------------------------------------------------
- virtual lldb::TargetSP
- CalculateTarget ();
+ lldb::TargetSP
+ CalculateTarget() override;
- virtual lldb::ProcessSP
- CalculateProcess ();
+ lldb::ProcessSP
+ CalculateProcess() override;
- virtual lldb::ThreadSP
- CalculateThread ();
+ lldb::ThreadSP
+ CalculateThread() override;
- virtual lldb::StackFrameSP
- CalculateStackFrame ();
+ lldb::StackFrameSP
+ CalculateStackFrame() override;
- virtual void
- CalculateExecutionContext (ExecutionContext &exe_ctx);
+ void
+ CalculateExecutionContext(ExecutionContext &exe_ctx) override;
lldb::StackFrameSP
GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr);
@@ -1271,7 +1287,6 @@ public:
}
protected:
-
friend class ThreadPlan;
friend class ThreadList;
friend class ThreadEventData;
@@ -1323,7 +1338,15 @@ protected:
lldb::StackFrameListSP
GetStackFrameList ();
-
+
+ void
+ SetTemporaryResumeState(lldb::StateType new_state)
+ {
+ m_temporary_resume_state = new_state;
+ }
+
+ void
+ FunctionOptimizationWarning (lldb_private::StackFrame *frame);
//------------------------------------------------------------------
// Classes that inherit from Process can see and modify these
@@ -1353,14 +1376,17 @@ protected:
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
- //------------------------------------------------------------------
- // For Thread only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (Thread);
+private:
+ bool
+ PlanIsBasePlan (ThreadPlan *plan_ptr);
+ void
+ BroadcastSelectedFrameChange(StackID &new_frame_id);
+
+ DISALLOW_COPY_AND_ASSIGN (Thread);
};
} // namespace lldb_private
-#endif // liblldb_Thread_h_
+#endif // liblldb_Thread_h_
diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h
index 12c430c9c8d8..e6489b25e558 100644
--- a/include/lldb/Target/ThreadList.h
+++ b/include/lldb/Target/ThreadList.h
@@ -32,8 +32,7 @@ public:
ThreadList (const ThreadList &rhs);
- virtual
- ~ThreadList ();
+ ~ThreadList() override;
const ThreadList&
operator = (const ThreadList& rhs);
@@ -128,8 +127,8 @@ public:
void
SetStopID (uint32_t stop_id);
- virtual Mutex &
- GetMutex ();
+ Mutex &
+ GetMutex() override;
void
Update (ThreadList &rhs);
@@ -150,9 +149,10 @@ protected:
lldb::tid_t m_selected_tid; ///< For targets that need the notion of a current thread.
private:
+
ThreadList ();
};
} // namespace lldb_private
-#endif // liblldb_ThreadList_h_
+#endif // liblldb_ThreadList_h_
diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h
index db2e79894057..e6f9aeb78dd6 100644
--- a/include/lldb/Target/ThreadPlan.h
+++ b/include/lldb/Target/ThreadPlan.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -518,10 +519,10 @@ public:
// the user regained control at that point) a subsequent process control command step/continue/etc. might
// complete the expression evaluations. If so, the result of the expression evaluation will show up here.
- virtual lldb::ClangExpressionVariableSP
+ virtual lldb::ExpressionVariableSP
GetExpressionVariable ()
{
- return lldb::ClangExpressionVariableSP();
+ return lldb::ExpressionVariableSP();
}
// If a thread plan stores the state before it was run, then you might
@@ -562,13 +563,14 @@ public:
else
return m_iteration_count;
}
+
protected:
//------------------------------------------------------------------
// Classes that inherit from ThreadPlan can see and modify these
//------------------------------------------------------------------
virtual bool
- DoWillResume (lldb::StateType resume_state, bool current_plan) { return true; };
+ DoWillResume (lldb::StateType resume_state, bool current_plan) { return true; }
virtual bool
DoPlanExplainsStop (Event *event_ptr) = 0;
@@ -613,6 +615,9 @@ protected:
virtual lldb::StateType
GetPlanRunState () = 0;
+ bool
+ IsUsuallyUnexplainedStopReason(lldb::StopReason);
+
Thread &m_thread;
Vote m_stop_vote;
Vote m_run_vote;
@@ -653,47 +658,46 @@ class ThreadPlanNull : public ThreadPlan
{
public:
ThreadPlanNull (Thread &thread);
- virtual ~ThreadPlanNull ();
+ ~ThreadPlanNull() override;
- virtual void
- GetDescription (Stream *s,
- lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- IsBasePlan()
+ bool
+ IsBasePlan() override
{
return true;
}
- virtual bool
- OkayToDiscard ()
+ bool
+ OkayToDiscard() override
{
return false;
}
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanNull);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_h_
+#endif // liblldb_ThreadPlan_h_
diff --git a/include/lldb/Target/ThreadPlanBase.h b/include/lldb/Target/ThreadPlanBase.h
index 69959e12f848..a0d30b5f0b67 100644
--- a/include/lldb/Target/ThreadPlanBase.h
+++ b/include/lldb/Target/ThreadPlanBase.h
@@ -31,31 +31,32 @@ class ThreadPlanBase : public ThreadPlan
{
friend class Process; // RunThreadPlan manages "stopper" base plans.
public:
- virtual ~ThreadPlanBase ();
+ ~ThreadPlanBase() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual Vote ShouldReportStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
- virtual bool OkayToDiscard()
+ bool
+ OkayToDiscard() override
{
return false;
}
- virtual bool
- IsBasePlan()
+ bool
+ IsBasePlan() override
{
return true;
}
protected:
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanBase (Thread &thread);
private:
@@ -65,7 +66,6 @@ private:
DISALLOW_COPY_AND_ASSIGN (ThreadPlanBase);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlanFundamental_h_
+#endif // liblldb_ThreadPlanFundamental_h_
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 36e4d6e71c79..47eee2808f1e 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -26,11 +26,11 @@ class ThreadPlanCallFunction : public ThreadPlan
{
// Create a thread plan to call a function at the address passed in the "function"
// argument. If you plan to call GetReturnValueObject, then pass in the
- // return type, otherwise just pass in an invalid ClangASTType.
+ // return type, otherwise just pass in an invalid CompilerType.
public:
ThreadPlanCallFunction (Thread &thread,
const Address &function,
- const ClangASTType &return_type,
+ const CompilerType &return_type,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options);
@@ -38,35 +38,34 @@ public:
const Address &function,
const EvaluateExpressionOptions &options);
- virtual
- ~ThreadPlanCallFunction ();
+ ~ThreadPlanCallFunction() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual Vote
- ShouldReportStop(Event *event_ptr);
+ Vote
+ ShouldReportStop(Event *event_ptr) override;
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
- virtual void
- DidPush ();
+ void
+ DidPush() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
// To get the return value from a function call you must create a
// lldb::ValueSP that contains a valid clang type in its context and call
@@ -77,8 +76,8 @@ public:
// plan is complete, you can call "GetReturnValue()" to retrieve the value
// that was extracted.
- virtual lldb::ValueObjectSP
- GetReturnValueObject ()
+ lldb::ValueObjectSP
+ GetReturnValueObject() override
{
return m_return_valobj_sp;
}
@@ -93,11 +92,11 @@ public:
return m_function_sp;
}
- // Classes that derive from ClangFunction, and implement
+ // Classes that derive from FunctionCaller, and implement
// their own WillPop methods should call this so that the
// thread state gets restored if the plan gets discarded.
- virtual void
- WillPop ();
+ void
+ WillPop() override;
// If the thread plan stops mid-course, this will be the stop reason that interrupted us.
// Once DoTakedown is called, this will be the real stop reason at the end of the function call.
@@ -105,8 +104,8 @@ public:
// This is needed because we want the CallFunction thread plans not to show up as the stop reason.
// But if something bad goes wrong, it is nice to be able to tell the user what really happened.
- virtual lldb::StopInfoSP
- GetRealStopInfo()
+ lldb::StopInfoSP
+ GetRealStopInfo() override
{
if (m_real_stop_info_sp)
return m_real_stop_info_sp;
@@ -120,23 +119,23 @@ public:
return m_stop_address;
}
- virtual bool
- RestoreThreadState();
+ bool
+ RestoreThreadState() override;
- virtual void
- ThreadDestroyed ()
+ void
+ ThreadDestroyed() override
{
m_takedown_done = true;
}
- virtual void
- SetStopOthers (bool new_value);
+ void
+ SetStopOthers(bool new_value) override;
protected:
void ReportRegisterState (const char *message);
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
virtual void
SetReturnValue();
@@ -184,10 +183,10 @@ protected:
lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown;
private:
- ClangASTType m_return_type;
+ CompilerType m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunction_h_
+#endif // liblldb_ThreadPlanCallFunction_h_
diff --git a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
index 83d78a5dca08..529057175287 100644
--- a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
+++ b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -38,7 +38,7 @@ public:
llvm::ArrayRef<ABI::CallArgument> args,
const EvaluateExpressionOptions &options);
- ~ThreadPlanCallFunctionUsingABI ();
+ ~ThreadPlanCallFunctionUsingABI() override;
void
GetDescription (Stream *s, lldb::DescriptionLevel level) override;
@@ -47,7 +47,6 @@ protected:
void
SetReturnValue () override;
-
private:
llvm::Type &m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunctionUsingABI);
@@ -55,4 +54,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
+#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
diff --git a/include/lldb/Target/ThreadPlanCallUserExpression.h b/include/lldb/Target/ThreadPlanCallUserExpression.h
index e40762c928b5..bb261d9c96b4 100644
--- a/include/lldb/Target/ThreadPlanCallUserExpression.h
+++ b/include/lldb/Target/ThreadPlanCallUserExpression.h
@@ -30,22 +30,21 @@ public:
Address &function,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options,
- lldb::ClangUserExpressionSP &user_expression_sp);
+ lldb::UserExpressionSP &user_expression_sp);
- virtual
- ~ThreadPlanCallUserExpression ();
+ ~ThreadPlanCallUserExpression() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual void
- WillPop ();
+ void
+ WillPop() override;
- virtual lldb::StopInfoSP
- GetRealStopInfo();
+ lldb::StopInfoSP
+ GetRealStopInfo() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
void
TransferExpressionOwnership ()
@@ -53,19 +52,19 @@ public:
m_manage_materialization = true;
}
- virtual lldb::ClangExpressionVariableSP
- GetExpressionVariable ()
+ lldb::ExpressionVariableSP
+ GetExpressionVariable() override
{
return m_result_var_sp;
}
protected:
private:
- lldb::ClangUserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
+ lldb::UserExpressionSP m_user_expression_sp; // This is currently just used to ensure the
// User expression the initiated this ThreadPlan
// lives as long as the thread plan does.
bool m_manage_materialization = false;
- lldb::ClangExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
+ lldb::ExpressionVariableSP m_result_var_sp; // If we are left to manage the materialization,
// then stuff the result expression variable here.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallUserExpression);
@@ -73,4 +72,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanCallUserExpression_h_
+#endif // liblldb_ThreadPlanCallUserExpression_h_
diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h
index ffcee018a5fb..ab3fbbdf6fb5 100644
--- a/include/lldb/Target/ThreadPlanPython.h
+++ b/include/lldb/Target/ThreadPlanPython.h
@@ -13,6 +13,7 @@
// C Includes
// C++ Includes
#include <string>
+
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@@ -37,45 +38,44 @@ class ThreadPlanPython : public ThreadPlan
{
public:
ThreadPlanPython (Thread &thread, const char *class_name);
- virtual ~ThreadPlanPython ();
+ ~ThreadPlanPython() override;
- virtual void
- GetDescription (Stream *s,
- lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s,
+ lldb::DescriptionLevel level) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual void
- DidPush ();
+ void
+ DidPush() override;
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
private:
- std::string m_class_name;
- StructuredData::ObjectSP m_implementation_sp;
+ std::string m_class_name;
+ StructuredData::ObjectSP m_implementation_sp;
DISALLOW_COPY_AND_ASSIGN(ThreadPlanPython);
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlan_Python_h_
+#endif // liblldb_ThreadPlan_Python_h_
diff --git a/include/lldb/Target/ThreadPlanRunToAddress.h b/include/lldb/Target/ThreadPlanRunToAddress.h
index d94820668017..a1b974605ffb 100644
--- a/include/lldb/Target/ThreadPlanRunToAddress.h
+++ b/include/lldb/Target/ThreadPlanRunToAddress.h
@@ -36,37 +36,35 @@ public:
const std::vector<lldb::addr_t> &addresses,
bool stop_others);
+ ~ThreadPlanRunToAddress() override;
- virtual
- ~ThreadPlanRunToAddress ();
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ bool
+ ValidatePlan(Stream *error) override;
- virtual bool
- ValidatePlan (Stream *error);
+ bool
+ ShouldStop(Event *event_ptr) override;
- virtual bool
- ShouldStop (Event *event_ptr);
-
- virtual bool
- StopOthers ();
+ bool
+ StopOthers() override;
- virtual void
- SetStopOthers (bool new_value);
+ void
+ SetStopOthers(bool new_value) override;
- virtual lldb::StateType
- GetPlanRunState ();
+ lldb::StateType
+ GetPlanRunState() override;
- virtual bool
- WillStop ();
+ bool
+ WillStop() override;
- virtual bool
- MischiefManaged ();
+ bool
+ MischiefManaged() override;
protected:
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
void SetInitialBreakpoints();
bool AtOurAddress();
@@ -77,9 +75,8 @@ private:
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);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanRunToAddress_h_
+#endif // liblldb_ThreadPlanRunToAddress_h_
diff --git a/include/lldb/Target/ThreadPlanShouldStopHere.h b/include/lldb/Target/ThreadPlanShouldStopHere.h
index 26e4a1ec4fe7..a52d9e42effd 100644
--- a/include/lldb/Target/ThreadPlanShouldStopHere.h
+++ b/include/lldb/Target/ThreadPlanShouldStopHere.h
@@ -74,9 +74,9 @@ public:
//------------------------------------------------------------------
ThreadPlanShouldStopHere (ThreadPlan *owner);
- ThreadPlanShouldStopHere (ThreadPlan *owner,
- const ThreadPlanShouldStopHereCallbacks *callbacks,
- void *baton = NULL);
+ ThreadPlanShouldStopHere(ThreadPlan *owner,
+ const ThreadPlanShouldStopHereCallbacks *callbacks,
+ void *baton = nullptr);
virtual
~ThreadPlanShouldStopHere();
@@ -139,23 +139,15 @@ protected:
// Implement this, and call it in the plan's constructor to set the default flags.
virtual void SetFlagsToDefault () = 0;
- //------------------------------------------------------------------
- // Classes that inherit from ThreadPlanShouldStopHere can see and modify these
- //------------------------------------------------------------------
ThreadPlanShouldStopHereCallbacks m_callbacks;
void * m_baton;
ThreadPlan *m_owner;
lldb_private::Flags m_flags;
private:
- //------------------------------------------------------------------
- // For ThreadPlanShouldStopHere only
- //------------------------------------------------------------------
-
DISALLOW_COPY_AND_ASSIGN (ThreadPlanShouldStopHere);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanShouldStopHere_h_
+#endif // liblldb_ThreadPlanShouldStopHere_h_
diff --git a/include/lldb/Target/ThreadPlanStepInRange.h b/include/lldb/Target/ThreadPlanStepInRange.h
index 3a22e97e30d0..b31d35508271 100644
--- a/include/lldb/Target/ThreadPlanStepInRange.h
+++ b/include/lldb/Target/ThreadPlanStepInRange.h
@@ -42,14 +42,13 @@ public:
LazyBool step_in_avoids_code_without_debug_info,
LazyBool step_out_avoids_code_without_debug_info);
- virtual
- ~ThreadPlanStepInRange ();
+ ~ThreadPlanStepInRange() override;
- virtual void
- GetDescription (Stream *s, lldb::DescriptionLevel level);
+ void
+ GetDescription(Stream *s, lldb::DescriptionLevel level) override;
- virtual bool
- ShouldStop (Event *event_ptr);
+ bool
+ ShouldStop(Event *event_ptr) override;
void SetAvoidRegexp(const char *name);
@@ -62,19 +61,19 @@ public:
SetDefaultFlagValue (uint32_t new_value);
bool
- IsVirtualStep();
+ IsVirtualStep() override;
protected:
static bool
DefaultShouldStopHereCallback (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
- virtual bool
- DoPlanExplainsStop (Event *event_ptr);
+ bool
+ DoPlanExplainsStop(Event *event_ptr) override;
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepInRange::s_default_flag_values);
}
@@ -119,9 +118,8 @@ private:
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);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInRange_h_
+#endif // liblldb_ThreadPlanStepInRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepInstruction.h b/include/lldb/Target/ThreadPlanStepInstruction.h
index 86069ffd9eb5..da83ecadcae6 100644
--- a/include/lldb/Target/ThreadPlanStepInstruction.h
+++ b/include/lldb/Target/ThreadPlanStepInstruction.h
@@ -23,19 +23,19 @@ namespace lldb_private {
class ThreadPlanStepInstruction : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepInstruction ();
+ ~ThreadPlanStepInstruction() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual bool IsPlanStale ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ bool IsPlanStale() override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanStepInstruction (Thread &thread,
bool step_over,
@@ -57,10 +57,8 @@ private:
StackID m_parent_frame_id;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepInstruction);
-
};
-
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepInstruction_h_
+#endif // liblldb_ThreadPlanStepInstruction_h_
diff --git a/include/lldb/Target/ThreadPlanStepOut.h b/include/lldb/Target/ThreadPlanStepOut.h
index 8c140dc9d95d..ac5696357e9b 100644
--- a/include/lldb/Target/ThreadPlanStepOut.h
+++ b/include/lldb/Target/ThreadPlanStepOut.h
@@ -33,32 +33,32 @@ public:
uint32_t frame_idx,
LazyBool step_out_avoids_code_without_debug_info);
- virtual ~ThreadPlanStepOut ();
+ ~ThreadPlanStepOut() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush();
- virtual bool IsPlanStale();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
- virtual lldb::ValueObjectSP GetReturnValueObject()
+ lldb::ValueObjectSP GetReturnValueObject() override
{
return m_return_valobj_sp;
}
protected:
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepOut::s_default_flag_values);
}
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop (Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
bool QueueInlinedStepPlan (bool queue_now);
private:
@@ -95,9 +95,8 @@ private:
CalculateReturnValue();
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOut);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOut_h_
+#endif // liblldb_ThreadPlanStepOut_h_
diff --git a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
index a4806056afb9..944f0e0455ee 100644
--- a/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
+++ b/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
@@ -22,29 +22,31 @@ namespace lldb_private {
class ThreadPlanStepOverBreakpoint : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepOverBreakpoint ();
-
ThreadPlanStepOverBreakpoint (Thread &thread);
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void ThreadDestroyed ();
- void SetAutoContinue (bool do_it);
- virtual bool ShouldAutoContinue(Event *event_ptr);
- virtual bool IsPlanStale();
+
+ ~ThreadPlanStepOverBreakpoint() override;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void ThreadDestroyed() override;
+ void SetAutoContinue(bool do_it);
+ bool ShouldAutoContinue(Event *event_ptr) override;
+ bool IsPlanStale() override;
lldb::addr_t
GetBreakpointLoadAddress() const
{
return m_breakpoint_addr;
}
+
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
void ReenableBreakpointSite ();
private:
@@ -55,9 +57,8 @@ private:
bool m_reenabled_breakpoint_site;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverBreakpoint);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
+#endif // liblldb_ThreadPlanStepOverBreakpoint_h_
diff --git a/include/lldb/Target/ThreadPlanStepOverRange.h b/include/lldb/Target/ThreadPlanStepOverRange.h
index d47c6c9429d5..7defaef7d07d 100644
--- a/include/lldb/Target/ThreadPlanStepOverRange.h
+++ b/include/lldb/Target/ThreadPlanStepOverRange.h
@@ -25,32 +25,28 @@ class ThreadPlanStepOverRange : public ThreadPlanStepRange,
ThreadPlanShouldStopHere
{
public:
-
ThreadPlanStepOverRange (Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
lldb::RunMode stop_others,
LazyBool step_out_avoids_no_debug);
- virtual ~ThreadPlanStepOverRange ();
+ ~ThreadPlanStepOverRange() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ShouldStop (Event *event_ptr);
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ShouldStop(Event *event_ptr) override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
- virtual void
- SetFlagsToDefault ()
+ void
+ SetFlagsToDefault() override
{
GetFlags().Set(ThreadPlanStepOverRange::s_default_flag_values);
}
-
-
-
-private:
+private:
static uint32_t s_default_flag_values;
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
@@ -59,9 +55,8 @@ private:
bool m_first_resume;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverRange);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepOverRange_h_
+#endif // liblldb_ThreadPlanStepOverRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepRange.h b/include/lldb/Target/ThreadPlanStepRange.h
index 43c55c2aa411..8f6685f82aab 100644
--- a/include/lldb/Target/ThreadPlanStepRange.h
+++ b/include/lldb/Target/ThreadPlanStepRange.h
@@ -33,24 +33,22 @@ public:
lldb::RunMode stop_others,
bool given_ranges_only = false);
- virtual ~ThreadPlanStepRange ();
-
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level) = 0;
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr) = 0;
- virtual Vote ShouldReportStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush ();
- virtual bool IsPlanStale ();
+ ~ThreadPlanStepRange() override;
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override = 0;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override = 0;
+ Vote ShouldReportStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
+ bool IsPlanStale() override;
void AddRange(const AddressRange &new_range);
protected:
-
bool InRange();
lldb::FrameComparison CompareCurrentFrameToStartFrame();
bool InSymbol();
@@ -88,10 +86,10 @@ protected:
private:
std::vector<lldb::DisassemblerSP> m_instruction_ranges;
- DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange);
+ DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepRange);
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepRange_h_
+#endif // liblldb_ThreadPlanStepRange_h_
diff --git a/include/lldb/Target/ThreadPlanStepThrough.h b/include/lldb/Target/ThreadPlanStepThrough.h
index 16979663eb1b..43af37c84a06 100644
--- a/include/lldb/Target/ThreadPlanStepThrough.h
+++ b/include/lldb/Target/ThreadPlanStepThrough.h
@@ -22,20 +22,20 @@ namespace lldb_private {
class ThreadPlanStepThrough : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepThrough ();
+ ~ThreadPlanStepThrough() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
+ void DidPush() override;
protected:
- virtual bool DoPlanExplainsStop (Event *event_ptr);
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
+ bool DoPlanExplainsStop(Event *event_ptr) override;
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
ThreadPlanStepThrough (Thread &thread,
StackID &return_stack_id,
@@ -49,6 +49,7 @@ protected:
private:
friend lldb::ThreadPlanSP
+
Thread::QueueThreadPlanForStepThrough (StackID &return_stack_id,
bool abort_other_plans,
bool stop_others);
@@ -63,9 +64,8 @@ private:
bool m_stop_others;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepThrough);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepThrough_h_
+#endif // liblldb_ThreadPlanStepThrough_h_
diff --git a/include/lldb/Target/ThreadPlanStepUntil.h b/include/lldb/Target/ThreadPlanStepUntil.h
index 5aa3876df53c..3c1bd8c6665d 100644
--- a/include/lldb/Target/ThreadPlanStepUntil.h
+++ b/include/lldb/Target/ThreadPlanStepUntil.h
@@ -19,33 +19,32 @@
namespace lldb_private {
-
class ThreadPlanStepUntil : public ThreadPlan
{
public:
- virtual ~ThreadPlanStepUntil ();
+ ~ThreadPlanStepUntil() override;
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool ShouldStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
+ bool ValidatePlan(Stream *error) override;
+ bool ShouldStop(Event *event_ptr) override;
+ bool StopOthers() override;
+ lldb::StateType GetPlanRunState() override;
+ bool WillStop() override;
+ bool MischiefManaged() override;
protected:
- virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
- virtual bool DoPlanExplainsStop (Event *event_ptr);
+ bool DoWillResume(lldb::StateType resume_state, bool current_plan) override;
+ bool DoPlanExplainsStop(Event *event_ptr) override;
ThreadPlanStepUntil (Thread &thread,
lldb::addr_t *address_list,
size_t num_addresses,
bool stop_others,
uint32_t frame_idx = 0);
- void AnalyzeStop(void);
-private:
+ void AnalyzeStop();
+private:
StackID m_stack_id;
lldb::addr_t m_step_from_insn;
lldb::break_id_t m_return_bp_id;
@@ -72,9 +71,8 @@ private:
// from step in.
DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepUntil);
-
};
} // namespace lldb_private
-#endif // liblldb_ThreadPlanStepUntil_h_
+#endif // liblldb_ThreadPlanStepUntil_h_
diff --git a/include/lldb/Target/ThreadPlanTracer.h b/include/lldb/Target/ThreadPlanTracer.h
index 4eb0c783e57d..6d064133fa91 100644
--- a/include/lldb/Target/ThreadPlanTracer.h
+++ b/include/lldb/Target/ThreadPlanTracer.h
@@ -26,7 +26,6 @@ class ThreadPlanTracer
friend class ThreadPlan;
public:
-
typedef enum ThreadPlanTracerStyle
{
eLocation = 0,
@@ -34,21 +33,18 @@ public:
eCheckFrames,
ePython
} ThreadPlanTracerStyle;
+
ThreadPlanTracer (Thread &thread, lldb::StreamSP &stream_sp);
ThreadPlanTracer (Thread &thread);
- virtual ~ThreadPlanTracer()
- {
- }
+ virtual ~ThreadPlanTracer() = default;
virtual void TracingStarted ()
{
-
}
virtual void TracingEnded ()
{
-
}
bool
@@ -90,8 +86,6 @@ protected:
Stream *
GetLogStream ();
-
-
virtual void Log();
private:
@@ -108,12 +102,13 @@ class ThreadPlanAssemblyTracer : public ThreadPlanTracer
public:
ThreadPlanAssemblyTracer (Thread &thread, lldb::StreamSP &stream_sp);
ThreadPlanAssemblyTracer (Thread &thread);
- virtual ~ThreadPlanAssemblyTracer ();
- virtual void TracingStarted ();
- virtual void TracingEnded ();
- virtual void Log();
+ ~ThreadPlanAssemblyTracer() override;
+
+ void TracingStarted() override;
+ void TracingEnded() override;
+ void Log() override;
+
private:
-
Disassembler *
GetDisassembler ();
@@ -128,4 +123,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadPlanTracer_h_
+#endif // liblldb_ThreadPlanTracer_h_
diff --git a/include/lldb/Target/ThreadSpec.h b/include/lldb/Target/ThreadSpec.h
index e0d30934f373..95f509a5cb9d 100644
--- a/include/lldb/Target/ThreadSpec.h
+++ b/include/lldb/Target/ThreadSpec.h
@@ -1,4 +1,4 @@
-//===-- ThreadSpec.h ------------------------------------------------*- C++ -*-===//
+//===-- ThreadSpec.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +10,12 @@
#ifndef liblldb_ThreadSpec_h_
#define liblldb_ThreadSpec_h_
-#include <map>
+// C Includes
+// C++ Includes
#include <string>
+// Other libraries and framework includes
+// Project includes
#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -110,7 +113,7 @@ public:
{
if (m_name.empty())
return true;
- else if (name == NULL)
+ else if (name == nullptr)
return false;
else
return m_name == name;
@@ -124,7 +127,7 @@ public:
{
if (m_queue_name.empty())
return true;
- else if (queue_name == NULL)
+ else if (queue_name == nullptr)
return false;
else
return m_queue_name == queue_name;
@@ -142,7 +145,6 @@ public:
void
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
-protected:
private:
uint32_t m_index;
lldb::tid_t m_tid;
@@ -152,4 +154,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_ThreadSpec_h_
+#endif // liblldb_ThreadSpec_h_
diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h
index 76955deabc78..7a02f557067b 100644
--- a/include/lldb/Target/UnixSignals.h
+++ b/include/lldb/Target/UnixSignals.h
@@ -98,6 +98,9 @@ public:
int32_t
GetSignalAtIndex(int32_t index) const;
+ ConstString
+ GetShortName(ConstString name) 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
@@ -106,11 +109,11 @@ public:
void
AddSignal (int signo,
const char *name,
- const char *short_name,
bool default_suppress,
bool default_stop,
bool default_notify,
- const char *description);
+ const char *description,
+ const char *alias = nullptr);
void
RemoveSignal (int signo);
@@ -123,18 +126,18 @@ protected:
struct Signal
{
ConstString m_name;
- ConstString m_short_name;
+ ConstString m_alias;
std::string m_description;
bool m_suppress:1,
m_stop:1,
m_notify:1;
Signal (const char *name,
- const char *short_name,
bool default_suppress,
bool default_stop,
bool default_notify,
- const char *description);
+ const char *description,
+ const char *alias);
~Signal () {}
};
diff --git a/include/lldb/Target/UnwindAssembly.h b/include/lldb/Target/UnwindAssembly.h
index 963949cf07d5..6f53e7e710f5 100644
--- a/include/lldb/Target/UnwindAssembly.h
+++ b/include/lldb/Target/UnwindAssembly.h
@@ -24,8 +24,7 @@ public:
static lldb::UnwindAssemblySP
FindPlugin (const ArchSpec &arch);
- virtual
- ~UnwindAssembly();
+ ~UnwindAssembly() override;
virtual bool
GetNonCallSiteUnwindPlanFromAssembly (AddressRange& func,
@@ -59,6 +58,4 @@ private:
} // namespace lldb_private
-#endif //utility_UnwindAssembly_h_
-
-
+#endif // utility_UnwindAssembly_h_