summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp63
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp16
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp17
3 files changed, 42 insertions, 54 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index d887b09dd3a..2dfbaa16978 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -1000,16 +1000,20 @@ ProcessMacOSX::EnableBreakpoint (BreakpointSite *bp_site)
if (bp_site->HardwarePreferred())
{
- ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get();
- if (thread)
- {
- bp_site->SetHardwareIndex (thread->SetHardwareBreakpoint(bp_site));
- if (bp_site->IsHardware())
- {
- bp_site->SetEnabled(true);
- return error;
- }
- }
+ // FIXME: This code doesn't make sense. Breakpoint sites don't really have single ThreadID's, since one site could be
+ // owned by a number of Locations, each with a different Thread ID. So either this should run over all the Locations and
+ // set it for all threads owned by those locations, or set it for all threads, and let the thread specific code sort it out.
+
+// ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get();
+// if (thread)
+// {
+// bp_site->SetHardwareIndex (thread->SetHardwareBreakpoint(bp_site));
+// if (bp_site->IsHardware())
+// {
+// bp_site->SetEnabled(true);
+// return error;
+// }
+// }
}
// Just let lldb::Process::EnableSoftwareBreakpoint() handle everything...
@@ -1030,17 +1034,6 @@ ProcessMacOSX::DisableBreakpoint (BreakpointSite *bp_site)
if (bp_site->IsHardware())
{
- ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get();
- if (thread)
- {
- if (thread->ClearHardwareBreakpoint(bp_site))
- {
- bp_site->SetEnabled(false);
- if (log)
- log->Printf ("ProcessMacOSX::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx -- SUCCESS (hardware)", site_id, (uint64_t)addr);
- return error;
- }
- }
error.SetErrorString("hardware breakpoints are no supported");
return error;
}
@@ -1068,20 +1061,8 @@ ProcessMacOSX::EnableWatchpoint (WatchpointLocation *wp)
}
else
{
- ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(wp->GetThreadID()).get();
- if (thread)
- {
- wp->SetHardwareIndex (thread->SetHardwareWatchpoint (wp));
- if (wp->IsHardware ())
- {
- wp->SetEnabled(true);
- return error;
- }
- }
- else
- {
- error.SetErrorString("Watchpoints currently only support thread specific watchpoints.");
- }
+ // Watchpoints aren't supported at present.
+ error.SetErrorString("Watchpoints aren't currently supported.");
}
}
return error;
@@ -1103,17 +1084,7 @@ ProcessMacOSX::DisableWatchpoint (WatchpointLocation *wp)
if (wp->IsHardware())
{
- ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(wp->GetThreadID()).get();
- if (thread)
- {
- if (thread->ClearHardwareWatchpoint (wp))
- {
- wp->SetEnabled(false);
- if (log)
- log->Printf ("ProcessMacOSX::Disablewatchpoint (watchID = %d) addr = 0x%8.8llx (hardware) => success", watchID, (uint64_t)addr);
- return error;
- }
- }
+ error.SetErrorString("Watchpoints aren't currently supported.");
}
// TODO: clear software watchpoints if we implement them
error.SetErrorToGenericError();
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
index 46d84a853d0..826407662ad 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp
@@ -81,11 +81,19 @@ ThreadMacOSX::GetRawStopReason (Thread::StopInfo *stop_info )
if (data_0 == MACH_SOFTWARE_BREAKPOINT_DATA_0)
{
lldb::addr_t pc = GetRegisterContext()->GetPC();
- lldb::user_id_t break_id = m_process.GetBreakpointSiteList().FindIDByAddress(pc);
- if (break_id != LLDB_INVALID_BREAK_ID)
+ lldb::BreakpointSiteSP bp_site_sp = m_process.GetBreakpointSiteList().FindByAddress(pc);
+ if (bp_site_sp)
{
- stop_info->Clear ();
- stop_info->SetStopReasonWithBreakpointSiteID (break_id);
+ if (bp_site_sp->ValidForThisThread (this))
+ {
+ stop_info->Clear ();
+ stop_info->SetStopReasonWithBreakpointSiteID (GetID());
+ }
+ else
+ {
+ stop_info->Clear ();
+ stop_info->SetStopReasonToNone();
+ }
return success;
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 81369c2368f..a528120915d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1034,8 +1034,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
else if (exc_type == EXC_BREAKPOINT && exc_data[0] == MACH_EXC_DATA0_SOFTWARE_BREAKPOINT)
{
addr_t pc = gdb_thread->GetRegisterContext()->GetPC();
- user_id_t break_id = GetBreakpointSiteList().FindIDByAddress(pc);
- if (break_id == LLDB_INVALID_BREAK_ID)
+ lldb::BreakpointSiteSP bp_site_sp = GetBreakpointSiteList().FindByAddress(pc);
+ if (!bp_site_sp)
{
//log->Printf("got EXC_BREAKPOINT at 0x%llx but didn't find a breakpoint site.\n", pc);
stop_info.SetStopReasonWithException(exc_type, exc_data.size());
@@ -1044,8 +1044,17 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
}
else
{
- stop_info.Clear ();
- stop_info.SetStopReasonWithBreakpointSiteID (break_id);
+ if (bp_site_sp->ValidForThisThread (thread_sp.get()))
+ {
+ stop_info.Clear ();
+ stop_info.SetStopReasonWithBreakpointSiteID (bp_site_sp->GetID());
+ }
+ else
+ {
+ stop_info.Clear ();
+ stop_info.SetStopReasonToNone();
+ }
+
}
}
#endif
OpenPOWER on IntegriCloud