summaryrefslogtreecommitdiff
path: root/include/lldb/Host/common
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Host/common')
-rw-r--r--include/lldb/Host/common/NativeBreakpointList.h7
-rw-r--r--include/lldb/Host/common/NativeProcessProtocol.h123
-rw-r--r--include/lldb/Host/common/NativeRegisterContext.h19
-rw-r--r--include/lldb/Host/common/NativeThreadProtocol.h13
-rw-r--r--include/lldb/Host/common/NativeWatchpointList.h7
-rw-r--r--include/lldb/Host/common/TCPSocket.h9
-rw-r--r--include/lldb/Host/common/UDPSocket.h9
7 files changed, 59 insertions, 128 deletions
diff --git a/include/lldb/Host/common/NativeBreakpointList.h b/include/lldb/Host/common/NativeBreakpointList.h
index b57174e51564..c2725b2df959 100644
--- a/include/lldb/Host/common/NativeBreakpointList.h
+++ b/include/lldb/Host/common/NativeBreakpointList.h
@@ -1,9 +1,8 @@
//===-- NativeBreakpointList.h ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h
index cb3b18eb0a3d..f05b8d01a1c9 100644
--- a/include/lldb/Host/common/NativeProcessProtocol.h
+++ b/include/lldb/Host/common/NativeProcessProtocol.h
@@ -1,9 +1,8 @@
//===-- NativeProcessProtocol.h ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -33,9 +32,7 @@ namespace lldb_private {
class MemoryRegionInfo;
class ResumeActionList;
-//------------------------------------------------------------------
// NativeProcessProtocol
-//------------------------------------------------------------------
class NativeProcessProtocol {
public:
virtual ~NativeProcessProtocol() {}
@@ -46,37 +43,29 @@ public:
virtual Status Detach() = 0;
- //------------------------------------------------------------------
/// Sends a process a UNIX signal \a signal.
///
- /// @return
+ /// \return
/// Returns an error object.
- //------------------------------------------------------------------
virtual Status Signal(int signo) = 0;
- //------------------------------------------------------------------
/// Tells a process to interrupt all operations as if by a Ctrl-C.
///
/// The default implementation will send a local host's equivalent of
/// a SIGSTOP to the process via the NativeProcessProtocol::Signal()
/// operation.
///
- /// @return
+ /// \return
/// Returns an error object.
- //------------------------------------------------------------------
virtual Status Interrupt();
virtual Status Kill() = 0;
- //------------------------------------------------------------------
// Tells a process not to stop the inferior on given signals and just
// reinject them back.
- //------------------------------------------------------------------
virtual Status IgnoreSignals(llvm::ArrayRef<int> signals);
- //----------------------------------------------------------------------
// Memory and memory region functions
- //----------------------------------------------------------------------
virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr,
MemoryRegionInfo &range_info);
@@ -103,26 +92,20 @@ public:
virtual const ArchSpec &GetArchitecture() const = 0;
- //----------------------------------------------------------------------
// Breakpoint functions
- //----------------------------------------------------------------------
virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
bool hardware) = 0;
virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false);
- //----------------------------------------------------------------------
// Hardware Breakpoint functions
- //----------------------------------------------------------------------
virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const;
virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr);
- //----------------------------------------------------------------------
// Watchpoint functions
- //----------------------------------------------------------------------
virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const;
virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
@@ -133,9 +116,7 @@ public:
virtual Status RemoveWatchpoint(lldb::addr_t addr);
- //----------------------------------------------------------------------
// Accessors
- //----------------------------------------------------------------------
lldb::pid_t GetID() const { return m_pid; }
lldb::StateType GetState() const;
@@ -152,19 +133,19 @@ public:
return GetArchitecture().GetByteOrder();
}
+ uint32_t GetAddressByteSize() const {
+ return GetArchitecture().GetAddressByteSize();
+ }
+
virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
GetAuxvData() const = 0;
- //----------------------------------------------------------------------
// Exit Status
- //----------------------------------------------------------------------
virtual llvm::Optional<WaitStatus> GetExitStatus();
virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
- //----------------------------------------------------------------------
// Access to threads
- //----------------------------------------------------------------------
NativeThreadProtocol *GetThreadAtIndex(uint32_t idx);
NativeThreadProtocol *GetThreadByID(lldb::tid_t tid);
@@ -177,20 +158,14 @@ public:
return GetThreadByID(m_current_thread_id);
}
- //----------------------------------------------------------------------
// Access to inferior stdio
- //----------------------------------------------------------------------
virtual int GetTerminalFileDescriptor() { return m_terminal_fd; }
- //----------------------------------------------------------------------
// Stop id interface
- //----------------------------------------------------------------------
uint32_t GetStopID() const;
- // ---------------------------------------------------------------------
// Callbacks for low-level process state changes
- // ---------------------------------------------------------------------
class NativeDelegate {
public:
virtual ~NativeDelegate() {}
@@ -203,7 +178,6 @@ public:
virtual void DidExec(NativeProcessProtocol *process) = 0;
};
- //------------------------------------------------------------------
/// Register a native delegate.
///
/// Clients can register nofication callbacks by passing in a
@@ -212,29 +186,26 @@ public:
/// Note: it is required that the lifetime of the
/// native_delegate outlive the NativeProcessProtocol.
///
- /// @param[in] native_delegate
+ /// \param[in] native_delegate
/// A NativeDelegate impl to be called when certain events
/// happen within the NativeProcessProtocol or related threads.
///
- /// @return
+ /// \return
/// true if the delegate was registered successfully;
/// false if the delegate was already registered.
///
- /// @see NativeProcessProtocol::NativeDelegate.
- //------------------------------------------------------------------
+ /// \see NativeProcessProtocol::NativeDelegate.
bool RegisterNativeDelegate(NativeDelegate &native_delegate);
- //------------------------------------------------------------------
/// Unregister a native delegate previously registered.
///
- /// @param[in] native_delegate
+ /// \param[in] native_delegate
/// A NativeDelegate impl previously registered with this process.
///
- /// @return Returns \b true if the NativeDelegate was
+ /// \return Returns \b true if the NativeDelegate was
/// successfully removed from the process, \b false otherwise.
///
- /// @see NativeProcessProtocol::NativeDelegate
- //------------------------------------------------------------------
+ /// \see NativeProcessProtocol::NativeDelegate
bool UnregisterNativeDelegate(NativeDelegate &native_delegate);
virtual Status GetLoadedModuleFileSpec(const char *module_path,
@@ -246,153 +217,139 @@ public:
class Factory {
public:
virtual ~Factory();
- //------------------------------------------------------------------
/// Launch a process for debugging.
///
- /// @param[in] launch_info
+ /// \param[in] launch_info
/// Information required to launch the process.
///
- /// @param[in] native_delegate
+ /// \param[in] native_delegate
/// The delegate that will receive messages regarding the
/// inferior. Must outlive the NativeProcessProtocol
/// instance.
///
- /// @param[in] mainloop
+ /// \param[in] mainloop
/// The mainloop instance with which the process can register
/// callbacks. Must outlive the NativeProcessProtocol
/// instance.
///
- /// @return
+ /// \return
/// A NativeProcessProtocol shared pointer if the operation succeeded or
/// an error object if it failed.
- //------------------------------------------------------------------
virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate,
MainLoop &mainloop) const = 0;
- //------------------------------------------------------------------
/// Attach to an existing process.
///
- /// @param[in] pid
+ /// \param[in] pid
/// pid of the process locatable
///
- /// @param[in] native_delegate
+ /// \param[in] native_delegate
/// The delegate that will receive messages regarding the
/// inferior. Must outlive the NativeProcessProtocol
/// instance.
///
- /// @param[in] mainloop
+ /// \param[in] mainloop
/// The mainloop instance with which the process can register
/// callbacks. Must outlive the NativeProcessProtocol
/// instance.
///
- /// @return
+ /// \return
/// A NativeProcessProtocol shared pointer if the operation succeeded or
/// an error object if it failed.
- //------------------------------------------------------------------
virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
MainLoop &mainloop) const = 0;
};
- //------------------------------------------------------------------
/// StartTracing API for starting a tracing instance with the
/// TraceOptions on a specific thread or process.
///
- /// @param[in] config
+ /// \param[in] config
/// The configuration to use when starting tracing.
///
- /// @param[out] error
+ /// \param[out] error
/// Status indicates what went wrong.
///
- /// @return
+ /// \return
/// The API returns a user_id which can be used to get trace
/// data, trace configuration or stopping the trace instance.
/// The user_id is a key to identify and operate with a tracing
/// instance. It may refer to the complete process or a single
/// thread.
- //------------------------------------------------------------------
virtual lldb::user_id_t StartTrace(const TraceOptions &config,
Status &error) {
error.SetErrorString("Not implemented");
return LLDB_INVALID_UID;
}
- //------------------------------------------------------------------
/// StopTracing API as the name suggests stops a tracing instance.
///
- /// @param[in] traceid
+ /// \param[in] traceid
/// The user id of the trace intended to be stopped. Now a
/// user_id may map to multiple threads in which case this API
/// could be used to stop the tracing for a specific thread by
/// supplying its thread id.
///
- /// @param[in] thread
+ /// \param[in] thread
/// Thread is needed when the complete process is being traced
/// and the user wishes to stop tracing on a particular thread.
///
- /// @return
+ /// \return
/// Status indicating what went wrong.
- //------------------------------------------------------------------
virtual Status StopTrace(lldb::user_id_t traceid,
lldb::tid_t thread = LLDB_INVALID_THREAD_ID) {
return Status("Not implemented");
}
- //------------------------------------------------------------------
/// This API provides the trace data collected in the form of raw
/// data.
///
- /// @param[in] traceid thread
+ /// \param[in] traceid thread
/// The traceid and thread provide the context for the trace
/// instance.
///
- /// @param[in] buffer
+ /// \param[in] buffer
/// The buffer provides the destination buffer where the trace
/// data would be read to. The buffer should be truncated to the
/// filled length by this function.
///
- /// @param[in] offset
+ /// \param[in] offset
/// There is possibility to read partially the trace data from
/// a specified offset where in such cases the buffer provided
/// may be smaller than the internal trace collection container.
///
- /// @return
+ /// \return
/// The size of the data actually read.
- //------------------------------------------------------------------
virtual Status GetData(lldb::user_id_t traceid, lldb::tid_t thread,
llvm::MutableArrayRef<uint8_t> &buffer,
size_t offset = 0) {
return Status("Not implemented");
}
- //------------------------------------------------------------------
/// Similar API as above except it aims to provide any extra data
/// useful for decoding the actual trace data.
- //------------------------------------------------------------------
virtual Status GetMetaData(lldb::user_id_t traceid, lldb::tid_t thread,
llvm::MutableArrayRef<uint8_t> &buffer,
size_t offset = 0) {
return Status("Not implemented");
}
- //------------------------------------------------------------------
/// API to query the TraceOptions for a given user id
///
- /// @param[in] traceid
+ /// \param[in] traceid
/// The user id of the tracing instance.
///
- /// @param[in] config
+ /// \param[in] config
/// The thread id of the tracing instance, in case configuration
/// for a specific thread is needed should be specified in the
/// config.
///
- /// @param[out] error
+ /// \param[out] error
/// Status indicates what went wrong.
///
- /// @param[out] config
+ /// \param[out] config
/// The actual configuration being used for tracing.
- //------------------------------------------------------------------
virtual Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions &config) {
return Status("Not implemented");
}
@@ -434,9 +391,7 @@ protected:
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
NativeDelegate &delegate);
- // ----------------------------------------------------------- Internal
// interface for state handling
- // -----------------------------------------------------------
void SetState(lldb::StateType state, bool notify_delegates = true);
// Derived classes need not implement this. It can be used as a hook to
@@ -445,9 +400,7 @@ protected:
// Note this function is called with the state mutex obtained by the caller.
virtual void DoStopIDBumped(uint32_t newBumpId);
- // ----------------------------------------------------------- Internal
// interface for software breakpoints
- // -----------------------------------------------------------
Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint);
Status RemoveSoftwareBreakpoint(lldb::addr_t addr);
@@ -466,12 +419,10 @@ protected:
// resets it to point to the breakpoint itself.
void FixupBreakpointPCAsNeeded(NativeThreadProtocol &thread);
- // -----------------------------------------------------------
/// Notify the delegate that an exec occurred.
///
/// Provide a mechanism for a delegate to clear out any exec-
/// sensitive data.
- // -----------------------------------------------------------
void NotifyDidExec();
NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid);
diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h
index 268e0f2473fd..6bba8f2a5d29 100644
--- a/include/lldb/Host/common/NativeRegisterContext.h
+++ b/include/lldb/Host/common/NativeRegisterContext.h
@@ -1,9 +1,8 @@
//===-- NativeRegisterContext.h ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -20,9 +19,7 @@ class NativeThreadProtocol;
class NativeRegisterContext
: public std::enable_shared_from_this<NativeRegisterContext> {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
NativeRegisterContext(NativeThreadProtocol &thread);
virtual ~NativeRegisterContext();
@@ -30,9 +27,7 @@ public:
// void
// InvalidateIfNeeded (bool force);
- //------------------------------------------------------------------
// Subclasses must override these functions
- //------------------------------------------------------------------
// virtual void
// InvalidateAllRegisters () = 0;
@@ -61,9 +56,7 @@ public:
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind,
uint32_t num) const;
- //------------------------------------------------------------------
// Subclasses can override these functions if desired
- //------------------------------------------------------------------
virtual uint32_t NumSupportedHardwareBreakpoints();
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
@@ -116,9 +109,7 @@ public:
lldb::addr_t dst_addr, size_t dst_len,
const RegisterValue &reg_value);
- //------------------------------------------------------------------
// Subclasses should not override these
- //------------------------------------------------------------------
virtual lldb::tid_t GetThreadID() const;
virtual NativeThreadProtocol &GetThread() { return m_thread; }
@@ -171,18 +162,14 @@ public:
// }
protected:
- //------------------------------------------------------------------
// Classes that inherit from RegisterContext can see and modify these
- //------------------------------------------------------------------
NativeThreadProtocol
&m_thread; // The thread that this register context belongs to.
// uint32_t m_stop_id; // The stop ID that any data in this
// context is valid for
private:
- //------------------------------------------------------------------
// For RegisterContext only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(NativeRegisterContext);
};
diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h
index 6f4452c688e7..36ae67933f53 100644
--- a/include/lldb/Host/common/NativeThreadProtocol.h
+++ b/include/lldb/Host/common/NativeThreadProtocol.h
@@ -1,9 +1,8 @@
//===-- NativeThreadProtocol.h ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -17,9 +16,7 @@
#include "lldb/lldb-types.h"
namespace lldb_private {
-//------------------------------------------------------------------
// NativeThreadProtocol
-//------------------------------------------------------------------
class NativeThreadProtocol {
public:
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
@@ -39,17 +36,13 @@ public:
NativeProcessProtocol &GetProcess() { return m_process; }
- // ---------------------------------------------------------------------
// Thread-specific watchpoints
- // ---------------------------------------------------------------------
virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
uint32_t watch_flags, bool hardware) = 0;
virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0;
- // ---------------------------------------------------------------------
// Thread-specific Hardware Breakpoint routines
- // ---------------------------------------------------------------------
virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0;
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0;
diff --git a/include/lldb/Host/common/NativeWatchpointList.h b/include/lldb/Host/common/NativeWatchpointList.h
index 02920e6faacb..c83ba1eaadca 100644
--- a/include/lldb/Host/common/NativeWatchpointList.h
+++ b/include/lldb/Host/common/NativeWatchpointList.h
@@ -1,9 +1,8 @@
//===-- NativeWatchpointList.h ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Host/common/TCPSocket.h b/include/lldb/Host/common/TCPSocket.h
index 0d32a70fd381..faf3bb693c32 100644
--- a/include/lldb/Host/common/TCPSocket.h
+++ b/include/lldb/Host/common/TCPSocket.h
@@ -1,9 +1,8 @@
//===-- TCPSocket.h ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -47,6 +46,8 @@ public:
bool IsValid() const override;
+ std::string GetRemoteConnectionURI() const override;
+
private:
TCPSocket(NativeSocket socket, const TCPSocket &listen_socket);
diff --git a/include/lldb/Host/common/UDPSocket.h b/include/lldb/Host/common/UDPSocket.h
index 27b2d1dc9834..b7b6db67d10d 100644
--- a/include/lldb/Host/common/UDPSocket.h
+++ b/include/lldb/Host/common/UDPSocket.h
@@ -1,9 +1,8 @@
//===-- UDPSocket.h ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -20,6 +19,8 @@ public:
static Status Connect(llvm::StringRef name, bool child_processes_inherit,
Socket *&socket);
+ std::string GetRemoteConnectionURI() const override;
+
private:
UDPSocket(NativeSocket socket);