llvm-capstone/lldb/source
Michał Górny 7644d8ba4d [lldb] [Process/NetBSD] Fix handling concurrent watchpoint events
Fix handling concurrent watchpoint events so that they are reported
correctly in LLDB.

If multiple watchpoints are hit concurrently, the NetBSD kernel reports
them as series of SIGTRAPs with a thread specified, and the debugger
investigates DR6 in order to establish which watchpoint was hit.  This
is normally fine.

However, LLDB disables and reenables the watchpoint on all threads after
each hit, which results in the hit status from DR6 being wiped.
As a result, it can't establish which watchpoint was hit in successive
SIGTRAP processing.

In order to workaround this problem, clear DR6 only if the breakpoint
is overwritten with a new one.  More specifically, move cleaning DR6
from ClearHardwareWatchpoint() to SetHardwareWatchpointWithIndex(),
and do that only if the newly requested watchpoint is different
from the one being set previously.  This ensures that the disable-enable
logic of LLDB does not clear watchpoint hit status for the remaining
threads.

This also involves refactoring of watchpoint logic.  With the old logic,
clearing watchpoint involved wiping dr6 & dr7, and setting it setting
dr{0..3} & dr7.  With the new logic, only enable bit is cleared
from dr7, and the remaining bits are cleared/overwritten while setting
new watchpoint.

Differential Revision: https://reviews.llvm.org/D70025
2019-11-25 20:11:59 +01:00
..
API [lldb][NFC] Allow range-based for-loops on VariableList 2019-11-25 15:03:46 +01:00
Breakpoint Modernize the rest of the Find.* API (NFC) 2019-10-17 19:56:40 +00:00
Commands [lldb][NFC] Allow range-based for-loops on VariableList 2019-11-25 15:03:46 +01:00
Core [lldb][NFC] Allow range-based for-loops on VariableList 2019-11-25 15:03:46 +01:00
DataFormatters Simplify condition (NFC) 2019-10-01 17:08:38 +00:00
Expression [DWARF] Handle call sites with indirect call targets 2019-11-22 11:50:22 -08:00
Host [-gmodules] Let LLDB log a warning if the Clang module hash mismatches. 2019-11-15 11:52:13 -08:00
Initialization [Reproducer] Use ::rtrim() to remove trailing control characters. 2019-10-18 17:11:48 +00:00
Interpreter [lldb][NFC] Give some parameters in CommandInterpreter more descriptive names 2019-11-05 09:21:10 +01:00
Plugins [lldb] [Process/NetBSD] Fix handling concurrent watchpoint events 2019-11-25 20:11:59 +01:00
Symbol [lldb][NFC] Allow range-based for-loops on VariableList 2019-11-25 15:03:46 +01:00
Target [lldb][NFC] Allow range-based for-loops on VariableList 2019-11-25 15:03:46 +01:00
Utility [Utility] Remove a dead header [PPC64LE_ehframe_Registers.h] 2019-11-14 15:29:47 -08:00
CMakeLists.txt [CMake] Remove Apple-specific version logic. 2019-04-17 18:23:22 +00:00
lldb.cpp [CMake] Remove Apple-specific version logic. 2019-04-17 18:23:22 +00:00