[Lldb-commits] [PATCH] D151366: [lldb] Disable variable watchpoints when going out of scope

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 24 12:51:33 PDT 2023


mib created this revision.
mib added reviewers: jingham, JDevlieghere, bulbazord, aprantl.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

If we use a variable watchpoint with a condition using a scope variable,
if we go out-of-scope, the watpoint remains active which can the
expression evaluator to fail to parse the watchpoint condition (because
of the missing varible bindings).

This was discovered after `watchpoint_callback.test` started failing on
the green dragon bot.

This patch should address that issue by setting an internal breakpoint
on the return addresss of the current frame when creating a variable
watchpoint. The breakpoint has a callback that will disable the watchpoint
if the the breakpoint execution context matches the watchpoint execution
context.

This is only enabled for local variables.

This patch also re-enables the failing test following e1086384e584 <https://reviews.llvm.org/rGe1086384e5841e861cd19d5d980394cfcf94ef98>.

rdar://109574319

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151366

Files:
  lldb/include/lldb/Breakpoint/Watchpoint.h
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/test/Shell/ScriptInterpreter/Lua/watchpoint_callback.test
  lldb/test/Shell/Watchpoint/Inputs/val.c
  lldb/test/Shell/Watchpoint/Inputs/watchpoint.in
  lldb/test/Shell/Watchpoint/LocalVariableWatchpointDisabler.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151366.525306.patch
Type: text/x-patch
Size: 8175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230524/259a75f6/attachment.bin>


More information about the lldb-commits mailing list