[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 24 15:57:14 PDT 2023
aprantl added a comment.
Just so I understand the limitations:
This works for
int main() {
int val = 0;
// Break here
val++;
val++;
return 0;
}
but not for
int main() {
{
int val = 0;
// Break here
val++;
val++;
}
{
int other = 42;
printf("assuming that other and val aliases");
}
return 0;
}
?
To be clear, I think this is still useful!
================
Comment at: lldb/include/lldb/Breakpoint/Watchpoint.h:93
+ struct WatchpointVariableContext {
+ WatchpointVariableContext(lldb::watch_id_t watch_id,
----------------
Doxygen comment?
================
Comment at: lldb/include/lldb/Breakpoint/Watchpoint.h:109
+
+ /// Callback routine which disable the watchpoint set on a variable when it
+ /// goes out of scope.
----------------
s/which/to/
================
Comment at: lldb/source/Breakpoint/Watchpoint.cpp:86
+bool Watchpoint::SetupVariableWatchpointDisabler(StackFrameSP frame_sp) const {
+ ThreadSP thread_sp = frame_sp->GetThread();
----------------
bulbazord wrote:
> Should you also verify that the `frame_sp` you got isn't `nullptr`? If it'll never be null, consider passing a `StackFrame &` instead.
I subjectively feel like I've received a crash log for every single unchecked dereference in the LLDB code so far ;-)
================
Comment at: lldb/source/Commands/CommandObjectWatchpoint.cpp:973
} else {
result.AppendErrorWithFormat(
"Watchpoint creation failed (addr=0x%" PRIx64 ", size=%" PRIu64
----------------
Convert to early exit?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151366/new/
https://reviews.llvm.org/D151366
More information about the lldb-commits
mailing list