diff options
author | Greg Clayton <gclayton@apple.com> | 2010-08-04 01:40:35 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-08-04 01:40:35 +0000 |
commit | f4b47e15799f16cef4baef4c3ee2519878b0f37a (patch) | |
tree | 44271b117f0b87f44f903c5eb471448dd17f5e93 /lldb/source/Target/Process.cpp | |
parent | 5cae10339208cdf484d67df5d65995a5338f097d (diff) | |
download | bcm5719-llvm-f4b47e15799f16cef4baef4c3ee2519878b0f37a.tar.gz bcm5719-llvm-f4b47e15799f16cef4baef4c3ee2519878b0f37a.zip |
Abtracted the old "lldb_private::Thread::StopInfo" into an abtract class.
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
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index f351c7115f2..9f5c42a73f6 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -21,6 +21,7 @@ #include "lldb/Host/Host.h" #include "lldb/Target/ABI.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/TargetList.h" #include "lldb/Target/Thread.h" @@ -1706,48 +1707,35 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr) { int num_threads = m_process_sp->GetThreadList().GetSize(); int idx; - + + int32_t should_stop_count = -1; + int32_t should_run_count = -1; for (idx = 0; idx < num_threads; ++idx) { lldb::ThreadSP thread_sp = m_process_sp->GetThreadList().GetThreadAtIndex(idx); - Thread::StopInfo stop_info; - if (thread_sp->GetStopInfo(&stop_info)) + StopInfo *stop_info = thread_sp->GetStopInfo (); + if (stop_info) { - StopReason reason = stop_info.GetStopReason(); - if (reason == eStopReasonBreakpoint) + if (stop_info->ShouldStop(event_ptr)) { - BreakpointSiteSP bp_site_sp; - // Look up the breakpoint site in the stop info, but the breakpoint - // might be a temporary one that's been deleted between the time we - // hit the breakpoint and now, if so there's nothing to do. - - bp_site_sp = m_process_sp->GetBreakpointSiteList().FindByID (stop_info.GetBreakpointSiteID()); - if (bp_site_sp) - { - size_t num_owners = bp_site_sp->GetNumberOfOwners(); - for (size_t j = 0; j < num_owners; j++) - { - lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j); - StoppointCallbackContext context (event_ptr, - m_process_sp.get(), - thread_sp.get(), - thread_sp->GetStackFrameAtIndex(0).get(), - false); - bp_loc_sp->InvokeCallback (&context); - } - } + if (should_stop_count < 0) + should_stop_count = 1; else - { - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS); - - if (log) - log->Printf ("Process::%s could not find breakpoint site id: %d...", __FUNCTION__, stop_info.GetBreakpointSiteID()); - } - + should_stop_count++; + } + else + { + if (should_run_count < 0) + should_run_count = 1; + else + should_run_count++; } } } + + // Are we secretly watching the private state here? Should we look at the + // should_run_count or the "should_stop_count" and the "should_run_count"??? if (m_process_sp->GetPrivateState() == eStateRunning) SetRestarted(true); } |