[lldb] [Process/FreeBSDRemote] Explicitly copy dbregs to new threads
authorMichał Górny <mgorny@moritz.systems>
Sun, 8 Nov 2020 15:40:49 +0000 (16:40 +0100)
committerMichał Górny <mgorny@moritz.systems>
Tue, 10 Nov 2020 13:18:03 +0000 (14:18 +0100)
commit4c54399b7eaa487e91c32a0d9c2537611c25aee7
tree65dd99eafa180c73a7cba60f20d1da7c16c9a6a8
parent194c5accb2be0dab75085f8f5c9c488d1cee7606
[lldb] [Process/FreeBSDRemote] Explicitly copy dbregs to new threads

Explicitly copy dbregs to new threads to ensure that watchpoints
are propagated properly.  Fixes the test failure due to apparent kernel
race between reporting a new thread and resuming main thread execution
that makes implicit inheritance of dbregs unreliable.  By copying them
explicitly, we ensure that the new thread correctly respects watchpoints
that were set after the thread was created but before it was reported.

The code is copied from the NetBSD plugin and modernized to use
llvm::Error.

Differential Revision: https://reviews.llvm.org/D91032
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD.h
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.cpp
lldb/source/Plugins/Process/FreeBSDRemote/NativeThreadFreeBSD.h
lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py