diff options
5 files changed, 21 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp index 71ec18fa97f..b62c0c340b2 100644 --- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp +++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp @@ -245,7 +245,8 @@ StopInfoMachException::CreateStopReasonWithMachException uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, - uint64_t exc_sub_code + uint64_t exc_sub_code, + uint64_t exc_sub_sub_code ) { if (exc_type != 0) @@ -303,10 +304,17 @@ StopInfoMachException::CreateStopReasonWithMachException return StopInfo::CreateStopReasonToTrace(thread); // It's a watchpoint, then. + // The exc_sub_code indicates the data break address. lldb::WatchpointLocationSP wp_loc_sp = thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByAddress((lldb::addr_t)exc_sub_code); if (wp_loc_sp) + { + // Debugserver may piggyback the hardware index of the fired watchpoint in the exception data. + // Set the hardware index if that's the case. + if (exc_data_count >=3) + wp_loc_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_loc_sp->GetID()); + } } else if (exc_code == 2) // EXC_I386_BPT { diff --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.h b/lldb/source/Plugins/Process/Utility/StopInfoMachException.h index f9036a47169..9ddf7a530ce 100644 --- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.h +++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.h @@ -60,7 +60,8 @@ public: uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, - uint64_t exc_subcode); + uint64_t exc_sub_code, + uint64_t exc_sub_sub_code); protected: uint32_t m_exc_data_count; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 3bb551afd77..1fbcf5696aa 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1228,7 +1228,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet) exc_type, exc_data_size, exc_data_size >= 1 ? exc_data[0] : 0, - exc_data_size >= 2 ? exc_data[1] : 0)); + exc_data_size >= 2 ? exc_data[1] : 0, + exc_data_size >= 3 ? exc_data[2] : 0)); } else { diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp index 8333bb94291..5554b06908f 100644 --- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp +++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp @@ -645,7 +645,11 @@ DNBArchImplI386::NotifyException(MachException::Data& exc) nub_addr_t addr = 0; uint32_t hw_index = GetHardwareWatchpointHit(addr); if (hw_index != INVALID_NUB_HW_INDEX) + { exc.exc_data[1] = addr; + // Piggyback the hw_index in the exc.data. + exc.exc_data.push_back(hw_index); + } return true; } diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp index 2f00c0f10db..875ed9dde06 100644 --- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp @@ -574,7 +574,11 @@ DNBArchImplX86_64::NotifyException(MachException::Data& exc) nub_addr_t addr = 0; uint32_t hw_index = GetHardwareWatchpointHit(addr); if (hw_index != INVALID_NUB_HW_INDEX) + { exc.exc_data[1] = addr; + // Piggyback the hw_index in the exc.data. + exc.exc_data.push_back(hw_index); + } return true; } |