[all-commits] [llvm/llvm-project] c73a3f: [lldb] [mostly NFC] Large WP foundation: Watchpoin...
Jason Molenda via All-commits
all-commits at lists.llvm.org
Thu Nov 30 14:59:28 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c73a3f16f81aaa427c61f69020a82b5b09570ffb
https://github.com/llvm/llvm-project/commit/c73a3f16f81aaa427c61f69020a82b5b09570ffb
Author: Jason Molenda <jmolenda at apple.com>
Date: 2023-11-30 (Thu, 30 Nov 2023)
Changed paths:
M lldb/include/lldb/Breakpoint/BreakpointSite.h
R lldb/include/lldb/Breakpoint/BreakpointSiteList.h
A lldb/include/lldb/Breakpoint/StopPointSiteList.h
M lldb/include/lldb/Breakpoint/Watchpoint.h
A lldb/include/lldb/Breakpoint/WatchpointResource.h
A lldb/include/lldb/Breakpoint/WatchpointResourceList.h
M lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
M lldb/include/lldb/Target/Process.h
M lldb/include/lldb/lldb-defines.h
M lldb/include/lldb/lldb-forward.h
M lldb/include/lldb/lldb-types.h
M lldb/source/API/SBThread.cpp
M lldb/source/API/SBWatchpoint.cpp
M lldb/source/Breakpoint/BreakpointLocation.cpp
M lldb/source/Breakpoint/BreakpointSite.cpp
R lldb/source/Breakpoint/BreakpointSiteList.cpp
M lldb/source/Breakpoint/CMakeLists.txt
A lldb/source/Breakpoint/StopPointSiteList.cpp
M lldb/source/Breakpoint/Watchpoint.cpp
A lldb/source/Breakpoint/WatchpointResource.cpp
A lldb/source/Breakpoint/WatchpointResourceList.cpp
M lldb/source/Commands/CommandObjectProcess.cpp
M lldb/source/Commands/CommandObjectWatchpoint.cpp
M lldb/source/Interpreter/OptionGroupWatchpoint.cpp
M lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
M lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
M lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
M lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
M lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
M lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
M lldb/source/Target/Platform.cpp
M lldb/source/Target/Process.cpp
M lldb/source/Target/StackFrameList.cpp
M lldb/source/Target/StopInfo.cpp
M lldb/source/Target/Target.cpp
M lldb/source/Target/ThreadPlanCallFunction.cpp
M lldb/source/Target/ThreadPlanStepOut.cpp
M lldb/source/Target/ThreadPlanStepRange.cpp
M lldb/source/Target/ThreadPlanStepUntil.cpp
M lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
M lldb/test/Shell/Watchpoint/Inputs/val.c
M lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test
M lldb/test/Shell/Watchpoint/SetErrorCases.test
Log Message:
-----------
[lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)
This patch is rearranging code a bit to add WatchpointResources to
Process. A WatchpointResource is meant to represent a hardware
watchpoint register in the inferior process. It has an address, a size,
a type, and a list of Watchpoints that are using this
WatchpointResource.
This current patch doesn't add any of the features of
WatchpointResources that make them interesting -- a user asking to watch
a 24 byte object could watch this with three 8 byte WatchpointResources.
Or a Watchpoint on 1 byte at 0x1002 and a second watchpoint on 1 byte at
0x1003, these must both be served by a single WatchpointResource on that
doubleword at 0x1000 on a 64-bit target, if two hardware watchpoint
registers were used to track these separately, one of them may not be
hit. Or if you have one Watchpoint on a variable with a condition set,
and another Watchpoint on that same variable with a command defined or
different condition, or ignorecount, both of those Watchpoints need to
evaluate their criteria/commands when their WatchpointResource has been
hit.
There's a bit of code movement to rearrange things in the direction I'll
need for implementing this feature, so I want to start with reviewing &
landing this mostly NFC patch and we can focus on the algorithmic
choices about how WatchpointResources are shared and handled as they're
triggeed, separately.
This patch also stops printing "Watchpoint <n> hit: old value: <x>, new
vlaue: <y>" for Read watchpoints. I could make an argument for print
"Watchpoint <n> hit: current value <x>" but the current output doesn't
make any sense, and the user can print the value if they are
particularly interested. Read watchpoints are used primarily to
understand what code is reading a variable.
This patch adds more fallbacks for how to print the objects being
watched if we have types, instead of assuming they are all integral
values, so a struct will print its elements. As large watchpoints are
added, we'll be doing a lot more of those.
To track the WatchpointSP in the WatchpointResources, I changed the
internal API which took a WatchpointSP and devolved it to a Watchpoint*,
which meant touching several different Process files. I removed the
watchpoint code in ProcessKDP which only reported that watchpoints
aren't supported, the base class does that already.
I haven't yet changed how we receive a watchpoint to identify the
WatchpointResource responsible for the trigger, and identify all
Watchpoints that are using this Resource to evaluate their conditions
etc. This is the same work that a BreakpointSite needs to do when it has
been tiggered, where multiple Breakpoints may be at the same address.
There is not yet any printing of the Resources that a Watchpoint is
implemented in terms of ("watchpoint list", or
SBWatchpoint::GetDescription).
"watchpoint set var" and "watchpoint set expression" take a size
argument which was previously 1, 2, 4, or 8 (an enum). I've changed this
to an unsigned int. Most hardware implementations can only watch 1, 2,
4, 8 byte ranges, but with Resources we'll allow a user to ask for
different sized watchpoints and set them in hardware-expressble terms
soon.
I've annotated areas where I know there is work still needed with
LWP_TODO that I'll be working on once this is landed.
I've tested this on aarch64 macOS, aarch64 Linux, and Intel macOS.
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
(cherry picked from commit fc6b72523f3d73b921690a713e97a433c96066c6)
Commit: 162e4b8c494459ea7509f598d15addd6ffc3dc9c
https://github.com/llvm/llvm-project/commit/162e4b8c494459ea7509f598d15addd6ffc3dc9c
Author: Jason Molenda <jason at molenda.com>
Date: 2023-11-30 (Thu, 30 Nov 2023)
Changed paths:
M lldb/include/lldb/Breakpoint/WatchpointResource.h
Log Message:
-----------
Include <vector> in WatchpointResource.h
On macOS <vector> was already included via another
header file, but this failed on the CI bots. I'd
tested on linux earlier in this patch's life when
the headers were differently arranged.
(cherry picked from commit a0a1ff3ab40e347589b4e27d8fd350c600526735)
Commit: 22f72642fe6cd8f049bc905e0f0a69243b650f89
https://github.com/llvm/llvm-project/commit/22f72642fe6cd8f049bc905e0f0a69243b650f89
Author: Nico Weber <thakis at chromium.org>
Date: 2023-11-30 (Thu, 30 Nov 2023)
Changed paths:
M lldb/source/Breakpoint/WatchpointResource.cpp
Log Message:
-----------
[lldb] try to fix build on linux after fc6b72523f3d7
Tries to fix:
../../lldb/source/Breakpoint/WatchpointResource.cpp:59:12:
error: no member named 'find' in namespace 'std'; did you mean 'fill'?
std::find(m_constituents.begin(), m_constituents.end(), wp_sp);
~~~~~^~~~
fill
(cherry picked from commit a6c62bf1a4717accc852463b664cd1012237d334)
Commit: 9e77d666d88d407a7705caa623f7bfc8dc90287d
https://github.com/llvm/llvm-project/commit/9e77d666d88d407a7705caa623f7bfc8dc90287d
Author: Jason Molenda <jmolenda at apple.com>
Date: 2023-11-30 (Thu, 30 Nov 2023)
Changed paths:
M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Log Message:
-----------
Correctly disable hardware watchpoints after a fork event
Fix a failure on Linux system where follow-fork-mode
exists, which caused the large watchpoint NFC patch
to be reverted earlier this week.
Compare: https://github.com/llvm/llvm-project/compare/812dad536ed5...9e77d666d88d
More information about the All-commits
mailing list