mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-15 04:41:52 +00:00

This will allow debugger plug-ins to make any instance of "lldb_private::StopInfo" that can completely describe any stop reason. It also provides a framework for doing intelligent things with the stop info at important times in the lifetime of the inferior. Examples include the signal stop info in StopInfoUnixSignal. It will check with the process to see that the current action is for the signal. These actions include wether to stop for the signal, wether the notify that the signal was hit, and wether to pass the signal along to the inferior process. The StopInfoUnixSignal class overrides the "ShouldStop()" method of StopInfo and this allows the stop info to determine if it should stop at the signal or continue the process. StopInfo subclasses must override the following functions: virtual lldb::StopReason GetStopReason () const = 0; virtual const char * GetDescription () = 0; StopInfo subclasses can override the following functions: // If the subclass returns "false", the inferior will resume. The default // version of this function returns "true" which means the default stop // info will stop the process. The breakpoint subclass will check if // the breakpoint wants us to stop by calling any installed callback on // the breakpoint, and also checking if the breakpoint is for the current // thread. Signals will check if they should stop based off of the // UnixSignal settings in the process. virtual bool ShouldStop (Event *event_ptr); // Sublasses can state if they want to notify the debugger when "ShouldStop" // returns false. This would be handy for breakpoints where you want to // log information and continue and is also used by the signal stop info // to notify that a signal was received (after it checks with the process // signal settings). virtual bool ShouldNotify (Event *event_ptr) { return false; } // Allow subclasses to do something intelligent right before we resume. // The signal class will figure out if the signal should be propagated // to the inferior process and pass that along to the debugger plug-ins. virtual void WillResume (lldb::StateType resume_state) { // By default, don't do anything } The support the Mach exceptions was moved into the lldb/source/Plugins/Process/Utility folder and now doesn't polute the lldb_private::Thread class with platform specific code. llvm-svn: 110184
142 lines
3.1 KiB
C++
142 lines
3.1 KiB
C++
//===-- ThreadGDBRemote.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_ThreadGDBRemote_h_
|
|
#define liblldb_ThreadGDBRemote_h_
|
|
|
|
#include <string>
|
|
|
|
#include "lldb/Target/Process.h"
|
|
#include "lldb/Target/Thread.h"
|
|
#include "libunwind/include/libunwind.h"
|
|
|
|
class StringExtractor;
|
|
class ProcessGDBRemote;
|
|
|
|
class ThreadGDBRemote : public lldb_private::Thread
|
|
{
|
|
public:
|
|
ThreadGDBRemote (ProcessGDBRemote &process, lldb::tid_t tid);
|
|
|
|
virtual
|
|
~ThreadGDBRemote ();
|
|
|
|
virtual bool
|
|
WillResume (lldb::StateType resume_state);
|
|
|
|
virtual void
|
|
RefreshStateAfterStop();
|
|
|
|
virtual const char *
|
|
GetInfo ();
|
|
|
|
virtual const char *
|
|
GetName ();
|
|
|
|
virtual const char *
|
|
GetQueueName ();
|
|
|
|
virtual lldb_private::RegisterContext *
|
|
GetRegisterContext ();
|
|
|
|
virtual lldb_private::RegisterContext *
|
|
CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
|
|
|
|
virtual bool
|
|
SaveFrameZeroState (RegisterCheckpoint &checkpoint);
|
|
|
|
virtual bool
|
|
RestoreSaveFrameZero (const RegisterCheckpoint &checkpoint);
|
|
|
|
virtual uint32_t
|
|
GetStackFrameCount();
|
|
|
|
virtual lldb::StackFrameSP
|
|
GetStackFrameAtIndex (uint32_t idx);
|
|
|
|
virtual void
|
|
ClearStackFrames ();
|
|
|
|
ProcessGDBRemote &
|
|
GetGDBProcess ()
|
|
{
|
|
return (ProcessGDBRemote &)m_process;
|
|
}
|
|
|
|
const ProcessGDBRemote &
|
|
GetGDBProcess () const
|
|
{
|
|
return (ProcessGDBRemote &)m_process;
|
|
}
|
|
|
|
void
|
|
Dump (lldb_private::Log *log, uint32_t index);
|
|
|
|
static bool
|
|
ThreadIDIsValid (lldb::tid_t thread);
|
|
|
|
bool
|
|
ShouldStop (bool &step_more);
|
|
|
|
const char *
|
|
GetBasicInfoAsString ();
|
|
|
|
void
|
|
SetStopInfo (const lldb::StopInfoSP &stop_info)
|
|
{
|
|
m_actual_stop_info_sp = stop_info;
|
|
}
|
|
|
|
void
|
|
SetName (const char *name)
|
|
{
|
|
if (name && name[0])
|
|
m_thread_name.assign (name);
|
|
else
|
|
m_thread_name.clear();
|
|
}
|
|
|
|
lldb::addr_t
|
|
GetThreadDispatchQAddr ()
|
|
{
|
|
return m_thread_dispatch_qaddr;
|
|
}
|
|
|
|
void
|
|
SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
|
|
{
|
|
m_thread_dispatch_qaddr = thread_dispatch_qaddr;
|
|
}
|
|
|
|
protected:
|
|
//------------------------------------------------------------------
|
|
// Member variables.
|
|
//------------------------------------------------------------------
|
|
std::string m_thread_name;
|
|
std::string m_dispatch_queue_name;
|
|
lldb::addr_t m_thread_dispatch_qaddr;
|
|
std::auto_ptr<lldb_private::Unwind> m_unwinder_ap;
|
|
//------------------------------------------------------------------
|
|
// Member variables.
|
|
//------------------------------------------------------------------
|
|
|
|
lldb_private::Unwind *
|
|
GetUnwinder ();
|
|
|
|
void
|
|
SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
|
|
|
|
virtual lldb::StopInfoSP
|
|
GetPrivateStopReason ();
|
|
|
|
|
|
};
|
|
|
|
#endif // liblldb_ThreadGDBRemote_h_
|