summaryrefslogtreecommitdiffstats
path: root/lldb/include
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/Core/PluginManager.h18
-rw-r--r--lldb/include/lldb/Target/Process.h13
-rw-r--r--lldb/include/lldb/Target/SystemRuntime.h121
-rw-r--r--lldb/include/lldb/lldb-forward.h2
-rw-r--r--lldb/include/lldb/lldb-private-interfaces.h1
5 files changed, 154 insertions, 1 deletions
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index 91f8fbb997f..e02f43f4fa8 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -132,6 +132,24 @@ public:
//------------------------------------------------------------------
+ // SystemRuntime
+ //------------------------------------------------------------------
+ static bool
+ RegisterPlugin (const ConstString &name,
+ const char *description,
+ SystemRuntimeCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin (SystemRuntimeCreateInstance create_callback);
+
+ static SystemRuntimeCreateInstance
+ GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx);
+
+ static SystemRuntimeCreateInstance
+ GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name);
+
+
+ //------------------------------------------------------------------
// ObjectFile
//------------------------------------------------------------------
static bool
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 65c732851da..aa7b5edc5af 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1757,7 +1757,7 @@ public:
error.SetErrorStringWithFormat("error: %s does not support loading core files.", GetPluginName().GetCString());
return error;
}
-
+
//------------------------------------------------------------------
/// Get the dynamic loader plug-in for this process.
///
@@ -1771,6 +1771,16 @@ public:
GetDynamicLoader ();
//------------------------------------------------------------------
+ /// Get the system runtime plug-in for this process.
+ ///
+ /// @return
+ /// Returns a pointer to the SystemRuntime plugin for this Process
+ /// if one is available. Else returns NULL.
+ //------------------------------------------------------------------
+ virtual SystemRuntime *
+ GetSystemRuntime ();
+
+ //------------------------------------------------------------------
/// Attach to an existing process using the process attach info.
///
/// This function is not meant to be overridden by Process
@@ -3667,6 +3677,7 @@ protected:
std::unique_ptr<DynamicLoader> m_dyld_ap;
std::unique_ptr<DynamicCheckerFunctions> m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
std::unique_ptr<OperatingSystem> m_os_ap;
+ std::unique_ptr<SystemRuntime> m_system_runtime_ap;
UnixSignals m_unix_signals; /// This is the current signal set for this process.
lldb::ABISP m_abi_sp;
lldb::InputReaderSP m_process_input_reader;
diff --git a/lldb/include/lldb/Target/SystemRuntime.h b/lldb/include/lldb/Target/SystemRuntime.h
new file mode 100644
index 00000000000..7a7f1a721b1
--- /dev/null
+++ b/lldb/include/lldb/Target/SystemRuntime.h
@@ -0,0 +1,121 @@
+//===-- SystemRuntime.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_SystemRuntime_h_
+#define liblldb_SystemRuntime_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/PluginInterface.h"
+#include "lldb/lldb-private.h"
+
+
+namespace lldb_private {
+
+//----------------------------------------------------------------------
+/// @class SystemRuntime SystemRuntime.h "lldb/Target/SystemRuntime.h"
+/// @brief A plug-in interface definition class for system runtimes.
+///
+/// The system runtime plugins can collect information from the system
+/// libraries during a Process' lifetime and provide information about
+/// how objects/threads were originated.
+///
+/// For instance, a system runtime plugin use a breakpoint when threads
+/// are created to record the backtrace of where that thread was created.
+/// Later, when backtracing the created thread, it could extend the backtrace
+/// to show where it was originally created from.
+///
+/// The plugin will insert its own breakpoint when Created and start collecting
+/// information. Later when it comes time to augment a Thread, it can be
+/// asked to provide that information.
+///
+//----------------------------------------------------------------------
+
+class SystemRuntime :
+ public PluginInterface
+{
+public:
+ //------------------------------------------------------------------
+ /// Find a system runtime plugin for a given process.
+ ///
+ /// Scans the installed SystemRuntime plugins and tries to find
+ /// an instance that can be used to track image changes in \a
+ /// process.
+ ///
+ /// @param[in] process
+ /// The process for which to try and locate a system runtime
+ /// plugin instance.
+ //------------------------------------------------------------------
+ static SystemRuntime*
+ FindPlugin (Process *process);
+
+ //------------------------------------------------------------------
+ /// Construct with a process.
+ // -----------------------------------------------------------------
+ SystemRuntime(lldb_private::Process *process);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited by the plug-in instance.
+ //------------------------------------------------------------------
+ virtual
+ ~SystemRuntime();
+
+ //------------------------------------------------------------------
+ /// Called after attaching to a process.
+ ///
+ /// Allow the SystemRuntime plugin to execute some code after attaching
+ /// to a process.
+ //------------------------------------------------------------------
+ virtual void
+ DidAttach ();
+
+ //------------------------------------------------------------------
+ /// Called after launching a process.
+ ///
+ /// Allow the SystemRuntime plugin to execute some code after launching
+ /// a process.
+ //------------------------------------------------------------------
+ virtual void
+ DidLaunch();
+
+ //------------------------------------------------------------------
+ /// Called when modules have been loaded in the process.
+ ///
+ /// Allow the SystemRuntime plugin to enable logging features in the
+ /// system runtime libraries.
+ //------------------------------------------------------------------
+ virtual void
+ ModulesDidLoad(lldb_private::ModuleList &module_list);
+
+ //------------------------------------------------------------------
+ /// Call this method to print the backtrace of where this thread was
+ /// enqueued, if at all. Returns the number of frames printed.
+ //------------------------------------------------------------------
+ virtual uint32_t
+ GetStatus (lldb_private::Stream &strm, lldb_private::ExecutionContext &exe_ctx);
+
+protected:
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ Process *m_process;
+private:
+ DISALLOW_COPY_AND_ASSIGN (SystemRuntime);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_SystemRuntime_h_
diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index ee59e0e2892..cd8a5c2e813 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -106,6 +106,7 @@ class Instruction;
class InstructionList;
class IRExecutionUnit;
class LanguageRuntime;
+class SystemRuntime;
class LineTable;
class Listener;
class Log;
@@ -297,6 +298,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::InputReader> InputReaderSP;
typedef std::shared_ptr<lldb_private::Instruction> InstructionSP;
typedef std::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
+ typedef std::shared_ptr<lldb_private::SystemRuntime> SystemRuntimeSP;
typedef std::shared_ptr<lldb_private::LineTable> LineTableSP;
typedef std::shared_ptr<lldb_private::Listener> ListenerSP;
typedef std::shared_ptr<lldb_private::LogChannel> LogChannelSP;
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 949cafed98b..5a2da8989f3 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -27,6 +27,7 @@ namespace lldb_private
typedef EmulateInstruction * (*EmulateInstructionCreateInstance) (const ArchSpec &arch, InstructionType inst_type);
typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force);
typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
+ typedef SystemRuntime *(*SystemRuntimeCreateInstance) (Process *process);
typedef Platform* (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path);
typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);
OpenPOWER on IntegriCloud