Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
Show All 33 Lines | |||||
/// @class NativeProcessLinux | /// @class NativeProcessLinux | ||||
/// @brief Manages communication with the inferior (debugee) process. | /// @brief Manages communication with the inferior (debugee) process. | ||||
/// | /// | ||||
/// Upon construction, this class prepares and launches an inferior process for | /// Upon construction, this class prepares and launches an inferior process for | ||||
/// debugging. | /// debugging. | ||||
/// | /// | ||||
/// Changes in the inferior process state are broadcasted. | /// Changes in the inferior process state are broadcasted. | ||||
class NativeProcessLinux : public NativeProcessProtocol { | class NativeProcessLinux : public NativeProcessProtocol { | ||||
friend Status NativeProcessProtocol::Launch( | |||||
ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, | |||||
MainLoop &mainloop, NativeProcessProtocolSP &process_sp); | |||||
friend Status NativeProcessProtocol::Attach( | |||||
lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, | |||||
MainLoop &mainloop, NativeProcessProtocolSP &process_sp); | |||||
public: | public: | ||||
class Factory : public NativeProcessProtocol::Factory { | |||||
public: | |||||
llvm::Expected<NativeProcessProtocolSP> | |||||
Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, | |||||
MainLoop &mainloop) const override; | |||||
llvm::Expected<NativeProcessProtocolSP> | |||||
Attach(lldb::pid_t pid, NativeDelegate &native_delegate, | |||||
MainLoop &mainloop) const override; | |||||
}; | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// NativeProcessProtocol Interface | // NativeProcessProtocol Interface | ||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
Status Resume(const ResumeActionList &resume_actions) override; | Status Resume(const ResumeActionList &resume_actions) override; | ||||
Status Halt() override; | Status Halt() override; | ||||
Status Detach() override; | Status Detach() override; | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | protected: | ||||
GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, | GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, | ||||
size_t &actual_opcode_size, | size_t &actual_opcode_size, | ||||
const uint8_t *&trap_opcode_bytes) override; | const uint8_t *&trap_opcode_bytes) override; | ||||
private: | private: | ||||
MainLoop::SignalHandleUP m_sigchld_handle; | MainLoop::SignalHandleUP m_sigchld_handle; | ||||
ArchSpec m_arch; | ArchSpec m_arch; | ||||
LazyBool m_supports_mem_region; | LazyBool m_supports_mem_region = eLazyBoolCalculate; | ||||
std::vector<std::pair<MemoryRegionInfo, FileSpec>> m_mem_region_cache; | std::vector<std::pair<MemoryRegionInfo, FileSpec>> m_mem_region_cache; | ||||
lldb::tid_t m_pending_notification_tid; | lldb::tid_t m_pending_notification_tid = LLDB_INVALID_THREAD_ID; | ||||
// List of thread ids stepping with a breakpoint with the address of | // List of thread ids stepping with a breakpoint with the address of | ||||
// the relevan breakpoint | // the relevan breakpoint | ||||
std::map<lldb::tid_t, lldb::addr_t> m_threads_stepping_with_breakpoint; | std::map<lldb::tid_t, lldb::addr_t> m_threads_stepping_with_breakpoint; | ||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
// Private Instance Methods | // Private Instance Methods | ||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
NativeProcessLinux(); | NativeProcessLinux(::pid_t pid, int terminal_fd, NativeDelegate &delegate, | ||||
const ArchSpec &arch, MainLoop &mainloop); | |||||
Status LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info); | |||||
/// Attaches to an existing process. Forms the | |||||
/// implementation of Process::DoAttach | |||||
void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error); | |||||
::pid_t Attach(lldb::pid_t pid, Status &error); | // Returns a list of process threads that we have attached to. | ||||
static llvm::Expected<std::vector<::pid_t>> Attach(::pid_t pid); | |||||
static Status SetDefaultPtraceOpts(const lldb::pid_t); | static Status SetDefaultPtraceOpts(const lldb::pid_t); | ||||
static void *MonitorThread(void *baton); | void InitializeThreads(llvm::ArrayRef<::pid_t> tids); | ||||
void MonitorCallback(lldb::pid_t pid, bool exited, WaitStatus status); | void MonitorCallback(lldb::pid_t pid, bool exited, WaitStatus status); | ||||
void WaitForNewThread(::pid_t tid); | void WaitForNewThread(::pid_t tid); | ||||
void MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread); | void MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread); | ||||
void MonitorTrace(NativeThreadLinux &thread); | void MonitorTrace(NativeThreadLinux &thread); | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | #endif | ||||
llvm::DenseMap<lldb::tid_t, ProcessorTraceMonitorUP> | llvm::DenseMap<lldb::tid_t, ProcessorTraceMonitorUP> | ||||
m_processor_trace_monitor; | m_processor_trace_monitor; | ||||
// Set for tracking threads being traced under | // Set for tracking threads being traced under | ||||
// same process user id. | // same process user id. | ||||
llvm::DenseSet<lldb::tid_t> m_pt_traced_thread_group; | llvm::DenseSet<lldb::tid_t> m_pt_traced_thread_group; | ||||
lldb::user_id_t m_pt_proces_trace_id; | lldb::user_id_t m_pt_proces_trace_id = LLDB_INVALID_UID; | ||||
TraceOptions m_pt_process_trace_config; | TraceOptions m_pt_process_trace_config; | ||||
}; | }; | ||||
} // namespace process_linux | } // namespace process_linux | ||||
} // namespace lldb_private | } // namespace lldb_private | ||||
#endif // #ifndef liblldb_NativeProcessLinux_H_ | #endif // #ifndef liblldb_NativeProcessLinux_H_ |