aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Target
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 14:32:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 14:32:30 +0000
commit027f1c9655391dcb2b0117f931f720211ac933db (patch)
tree94980f450aa3daec3e1fec217374704ad62cfe45 /include/lldb/Target
parent5e95aa85bb660d45e9905ef1d7180b2678280660 (diff)
Vendor import of (stripped) lldb trunk r242221:vendor/lldb/lldb-trunk-r242221
Notes
Notes: svn path=/vendor/lldb/dist/; revision=287503 svn path=/vendor/lldb/lldb-trunk-r242221/; revision=287504; tag=vendor/lldb/lldb-trunk-r242221
Diffstat (limited to 'include/lldb/Target')
-rw-r--r--include/lldb/Target/ABI.h9
-rw-r--r--include/lldb/Target/Platform.h65
-rw-r--r--include/lldb/Target/Process.h76
-rw-r--r--include/lldb/Target/ThreadPlanCallFunction.h12
-rw-r--r--include/lldb/Target/ThreadPlanCallFunctionUsingABI.h58
-rw-r--r--include/lldb/Target/UnixSignals.h17
6 files changed, 163 insertions, 74 deletions
diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h
index cfd214d28874..89d4f6bdba6c 100644
--- a/include/lldb/Target/ABI.h
+++ b/include/lldb/Target/ABI.h
@@ -39,10 +39,9 @@ public:
};
eType type; /* value of eType */
size_t size; /* size in bytes of this argument */
- union {
- lldb::addr_t value; /* literal value */
- uint8_t *data; /* host data pointer */
- };
+
+ lldb::addr_t value; /* literal value */
+ std::unique_ptr<uint8_t[]> data_ap; /* host data pointer */
};
virtual
@@ -58,7 +57,7 @@ public:
lldb::addr_t returnAddress,
llvm::ArrayRef<lldb::addr_t> args) const = 0;
- // Prepare trivial call used from ThreadPlanFunctionCallGDB
+ // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
// AD:
// . Because i don't want to change other ABI's this is not declared pure virtual.
// The dummy implementation will simply fail. Only HexagonABI will currently
diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h
index 8f89e9b3cf5f..feaac57b128a 100644
--- a/include/lldb/Target/Platform.h
+++ b/include/lldb/Target/Platform.h
@@ -863,6 +863,12 @@ class ModuleCache;
return 1;
}
+ virtual const lldb::UnixSignalsSP &
+ GetRemoteUnixSignals();
+
+ const lldb::UnixSignalsSP &
+ GetUnixSignals();
+
//------------------------------------------------------------------
/// Locate a queue name given a thread's qaddr
///
@@ -939,65 +945,6 @@ class ModuleCache;
virtual const std::vector<ConstString> &
GetTrapHandlerSymbolNames ();
- //------------------------------------------------------------------
- /// Launch a process for debugging.
- ///
- /// This differs from Launch in that it returns a NativeProcessProtocol.
- /// Currently used by lldb-gdbserver.
- ///
- /// @param[in] launch_info
- /// Information required to launch the process.
- ///
- /// @param[in] native_delegate
- /// The delegate that will receive messages regarding the
- /// inferior. Must outlive the NativeProcessProtocol
- /// instance.
- ///
- /// @param[out] process_sp
- /// On successful return from the method, this parameter
- /// contains the shared pointer to the
- /// NativeProcessProtocol that can be used to manipulate
- /// the native process.
- ///
- /// @return
- /// An error object indicating if the operation succeeded,
- /// and if not, what error occurred.
- //------------------------------------------------------------------
- virtual Error
- LaunchNativeProcess (
- ProcessLaunchInfo &launch_info,
- lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
- NativeProcessProtocolSP &process_sp);
-
- //------------------------------------------------------------------
- /// Attach to an existing process on the given platform.
- ///
- /// This method differs from Attach() in that it returns a
- /// NativeProcessProtocol. Currently this is used by lldb-gdbserver.
- ///
- /// @param[in] pid
- /// pid of the process locatable by the platform.
- ///
- /// @param[in] native_delegate
- /// The delegate that will receive messages regarding the
- /// inferior. Must outlive the NativeProcessProtocol
- /// instance.
- ///
- /// @param[out] process_sp
- /// On successful return from the method, this parameter
- /// contains the shared pointer to the
- /// NativeProcessProtocol that can be used to manipulate
- /// the native process.
- ///
- /// @return
- /// An error object indicating if the operation succeeded,
- /// and if not, what error occurred.
- //------------------------------------------------------------------
- virtual Error
- AttachNativeProcess (lldb::pid_t pid,
- lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
- NativeProcessProtocolSP &process_sp);
-
protected:
bool m_is_host;
// Set to true when we are able to actually set the OS version while
diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index db0f0cfa028b..f75b3cd5683d 100644
--- a/include/lldb/Target/Process.h
+++ b/include/lldb/Target/Process.h
@@ -30,6 +30,7 @@
#include "lldb/Core/Event.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Breakpoint/BreakpointSiteList.h"
#include "lldb/Host/HostThread.h"
@@ -949,7 +950,7 @@ public:
/// Construct with a shared pointer to a target, the Process listener,
/// and the appropriate UnixSignalsSP for the process.
//------------------------------------------------------------------
- Process(Target &target, Listener &listener, const UnixSignalsSP &unix_signals_sp);
+ Process(Target &target, Listener &listener, const lldb::UnixSignalsSP &unix_signals_sp);
//------------------------------------------------------------------
/// Destructor.
@@ -1401,10 +1402,10 @@ public:
Signal (int signal);
void
- SetUnixSignals (const UnixSignalsSP &signals_sp);
+ SetUnixSignals(const lldb::UnixSignalsSP &signals_sp);
- UnixSignals &
- GetUnixSignals ();
+ const lldb::UnixSignalsSP &
+ GetUnixSignals();
//==================================================================
// Plug-in Process Control Overrides
@@ -1887,6 +1888,37 @@ public:
virtual void
ModulesDidLoad (ModuleList &module_list);
+
+ //------------------------------------------------------------------
+ /// Retrieve the list of shared libraries that are loaded for this process
+ ///
+ /// For certain platforms, the time it takes for the DynamicLoader plugin to
+ /// read all of the shared libraries out of memory over a slow communication
+ /// channel may be too long. In that instance, the gdb-remote stub may be
+ /// able to retrieve the necessary information about the solibs out of memory
+ /// and return a concise summary sufficient for the DynamicLoader plugin.
+ ///
+ /// @param [in] image_list_address
+ /// The address where the table of shared libraries is stored in memory,
+ /// if that is appropriate for this platform. Else this may be
+ /// passed as LLDB_INVALID_ADDRESS.
+ ///
+ /// @param [in] image_count
+ /// The number of shared libraries that are present in this process, if
+ /// that is appropriate for this platofrm Else this may be passed as
+ /// LLDB_INVALID_ADDRESS.
+ ///
+ /// @return
+ /// A StructureDataSP object which, if non-empty, will contain the
+ /// information the DynamicLoader needs to get the initial scan of
+ /// solibs resolved.
+ //------------------------------------------------------------------
+ virtual lldb_private::StructuredData::ObjectSP
+ GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_address, lldb::addr_t image_count)
+ {
+ return StructuredData::ObjectSP();
+ }
+
protected:
void
@@ -2439,8 +2471,41 @@ public:
/// True if execution of JIT code is possible; false otherwise.
//------------------------------------------------------------------
void SetCanJIT (bool can_jit);
+
+ //------------------------------------------------------------------
+ /// Determines whether executing function calls using the interpreter
+ /// is possible for this process.
+ ///
+ /// @return
+ /// True if possible; false otherwise.
+ //------------------------------------------------------------------
+ bool CanInterpretFunctionCalls ()
+ {
+ return m_can_interpret_function_calls;
+ }
//------------------------------------------------------------------
+ /// Sets whether executing function calls using the interpreter
+ /// is possible for this process.
+ ///
+ /// @param[in] can_interpret_function_calls
+ /// True if possible; false otherwise.
+ //------------------------------------------------------------------
+ void SetCanInterpretFunctionCalls (bool can_interpret_function_calls)
+ {
+ m_can_interpret_function_calls = can_interpret_function_calls;
+ }
+
+ //------------------------------------------------------------------
+ /// Sets whether executing code in this process is possible.
+ /// This could be either through JIT or interpreting.
+ ///
+ /// @param[in] can_run_code
+ /// True if execution of code is possible; false otherwise.
+ //------------------------------------------------------------------
+ void SetCanRunCode (bool can_run_code);
+
+ //------------------------------------------------------------------
/// Actually deallocate memory in the process.
///
/// This function will deallocate memory in the process's address
@@ -3205,7 +3270,7 @@ protected:
lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_ap; ///< The functions used by the expression parser to validate data that expressions use.
lldb::OperatingSystemUP m_os_ap;
lldb::SystemRuntimeUP m_system_runtime_ap;
- UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
+ lldb::UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process.
lldb::ABISP m_abi_sp;
lldb::IOHandlerSP m_process_input_reader;
Communication m_stdio_communication;
@@ -3236,6 +3301,7 @@ protected:
lldb::StateType m_last_broadcast_state; /// This helps with the Public event coalescing in ShouldBroadcastEvent.
std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;
bool m_destroy_in_process;
+ bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, don't support the ability to modify the stack.
enum {
eCanJITDontKnow= 0,
diff --git a/include/lldb/Target/ThreadPlanCallFunction.h b/include/lldb/Target/ThreadPlanCallFunction.h
index 12200ab76553..36e4d6e71c79 100644
--- a/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/include/lldb/Target/ThreadPlanCallFunction.h
@@ -34,6 +34,10 @@ public:
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options);
+ ThreadPlanCallFunction(Thread &thread,
+ const Address &function,
+ const EvaluateExpressionOptions &options);
+
virtual
~ThreadPlanCallFunction ();
@@ -134,7 +138,8 @@ protected:
virtual bool
DoPlanExplainsStop (Event *event_ptr);
-private:
+ virtual void
+ SetReturnValue();
bool
ConstructorSetup (Thread &thread,
@@ -153,7 +158,7 @@ private:
bool
BreakpointsExplainStop ();
-
+
bool m_valid;
bool m_stop_other_threads;
bool m_unwind_on_error;
@@ -172,13 +177,14 @@ private:
// it's nice to know the real stop reason.
// This gets set in DoTakedown.
StreamString m_constructor_errors;
- ClangASTType m_return_type;
lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, use the ABI to extract values when complete
bool m_takedown_done; // We want to ensure we only do the takedown once. This ensures that.
bool m_should_clear_objc_exception_bp;
bool m_should_clear_cxx_exception_bp;
lldb::addr_t m_stop_address; // This is the address we stopped at. Also set in DoTakedown;
+private:
+ ClangASTType m_return_type;
DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunction);
};
diff --git a/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
new file mode 100644
index 000000000000..83d78a5dca08
--- /dev/null
+++ b/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h
@@ -0,0 +1,58 @@
+//===-- ThreadPlanCallFunctionUsingABI.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ThreadPlanCallFunctionUsingABI_h_
+#define liblldb_ThreadPlanCallFunctionUsingABI_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-private.h"
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Target/ThreadPlanCallFunction.h"
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/IR/Type.h"
+
+namespace lldb_private {
+
+class ThreadPlanCallFunctionUsingABI : public ThreadPlanCallFunction
+{
+ // Create a thread plan to call a function at the address passed in the "function"
+ // argument, this function is executed using register manipulation instead of JIT.
+ // Class derives from ThreadPlanCallFunction and differs by calling a alternative
+ // ABI interface ABI::PrepareTrivialCall() which provides more detailed information.
+public:
+ ThreadPlanCallFunctionUsingABI (Thread &thread,
+ const Address &function_address,
+ llvm::Type &function_prototype,
+ llvm::Type &return_type,
+ llvm::ArrayRef<ABI::CallArgument> args,
+ const EvaluateExpressionOptions &options);
+
+ ~ThreadPlanCallFunctionUsingABI ();
+
+ void
+ GetDescription (Stream *s, lldb::DescriptionLevel level) override;
+
+protected:
+ void
+ SetReturnValue () override;
+
+
+private:
+ llvm::Type &m_return_type;
+ DISALLOW_COPY_AND_ASSIGN (ThreadPlanCallFunctionUsingABI);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ThreadPlanCallFunctionUsingABI_h_
diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h
index f47a90bbf545..76955deabc78 100644
--- a/include/lldb/Target/UnixSignals.h
+++ b/include/lldb/Target/UnixSignals.h
@@ -26,6 +26,9 @@ namespace lldb_private
class UnixSignals
{
public:
+ static lldb::UnixSignalsSP
+ Create(const ArchSpec &arch);
+
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
@@ -89,6 +92,12 @@ public:
int32_t
GetNextSignalNumber (int32_t current_signal) const;
+ int32_t
+ GetNumSignals() const;
+
+ int32_t
+ GetSignalAtIndex(int32_t index) const;
+
// We assume that the elements of this object are constant once it is constructed,
// since a process should never need to add or remove symbols as it runs. So don't
// call these functions anywhere but the constructor of your subclass of UnixSignals or in
@@ -130,14 +139,18 @@ protected:
~Signal () {}
};
- void
+ virtual void
Reset ();
typedef std::map <int32_t, Signal> collection;
collection m_signals;
- DISALLOW_COPY_AND_ASSIGN (UnixSignals);
+ // GDBRemote signals need to be copyable.
+ UnixSignals(const UnixSignals &rhs);
+
+ const UnixSignals &
+ operator=(const UnixSignals &rhs) = delete;
};
} // Namespace lldb