From 831435042e887d35876eba411a07082eb6f6a246 Mon Sep 17 00:00:00 2001 From: Jaydeep Patil Date: Thu, 13 Aug 2015 03:44:09 +0000 Subject: [LLDB][MIPS] Handle false positives for MIPS hardware watchpoints SUMMARY: Last 3bits of the watchpoint address are masked by the kernel. For example, n is at 0x120010d00 and m is 0x120010d04. When a watchpoint is set at m, then watch exception is generated even when n is read/written. To handle this case, instruction at PC is emulated to find the base address of the load/store instruction. This address is then appended to the description of the stop-info packet. Client then reads this information to check whether the user has set a watchpoint on this address. Reviewers: jingham, clayborg Subscribers: nitesh.jain, mohit.bhakkad, sagar, bhushan and lldb-commits Differential Revision: http://reviews.llvm.org/D11672 llvm-svn: 244864 --- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index 481127a65b1e..18f0e6b29721 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -333,6 +333,16 @@ NativeThreadLinux::SetStoppedByWatchpoint (uint32_t wp_index) std::ostringstream ostr; ostr << GetRegisterContext()->GetWatchpointAddress(wp_index) << " "; ostr << wp_index; + + /* + * MIPS: Last 3bits of the watchpoint address are masked by the kernel. For example: + * 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at 'm', then + * watch exception is generated even when 'n' is read/written. To handle this case, + * find the base address of the load/store instruction and append it in the stop-info + * packet. + */ + ostr << " " << GetRegisterContext()->GetWatchpointHitAddress(wp_index); + m_stop_description = ostr.str(); m_stop_info.reason = StopReason::eStopReasonWatchpoint; -- cgit v1.2.3