Index: source/Breakpoint/Watchpoint.cpp =================================================================== --- source/Breakpoint/Watchpoint.cpp +++ source/Breakpoint/Watchpoint.cpp @@ -154,6 +154,23 @@ } m_new_value_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(), watch_name.AsCString(), watch_address, m_type); m_new_value_sp = m_new_value_sp->CreateConstantValue(watch_name); + + // In MIPS while storing the address of watchpoint, last 3 bits are anded with watch flags,so its possible + // to get a false positive from processor for a variable with same address that of watched variable except + // last 3 bits. So to check such false positive we check if value of watched variable is actually changed. + // For now mips-lldb supports hardware watches with 'write' type only. + if (m_target.GetArchitecture().GetMachine() == llvm::Triple::mips || + m_target.GetArchitecture().GetMachine() == llvm::Triple::mipsel || + m_target.GetArchitecture().GetMachine() == llvm::Triple::mips64 || + m_target.GetArchitecture().GetMachine() == llvm::Triple::mips64el) + { + if (m_old_value_sp) + { + if (m_old_value_sp->GetValueAsSigned(NULL,NULL) == m_new_value_sp->GetValueAsSigned(NULL,NULL)) + return false; + } + } + if (m_new_value_sp && m_new_value_sp->GetError().Success()) return true; else Index: source/Target/StopInfo.cpp =================================================================== --- source/Target/StopInfo.cpp +++ source/Target/StopInfo.cpp @@ -830,13 +830,14 @@ // Finally, if we are going to stop, print out the new & old values: if (m_should_stop) { - wp_sp->CaptureWatchedValue(exe_ctx); - - Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger(); - StreamSP output_sp = debugger.GetAsyncOutputStream (); - wp_sp->DumpSnapshots(output_sp.get()); - output_sp->EOL(); - output_sp->Flush(); + if(wp_sp->CaptureWatchedValue(exe_ctx)) + { + Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger(); + StreamSP output_sp = debugger.GetAsyncOutputStream (); + wp_sp->DumpSnapshots(output_sp.get()); + output_sp->EOL(); + output_sp->Flush(); + } } }