[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 17:02:19 PDT 2023
mib added a comment.
In D151366#4370123 <https://reviews.llvm.org/D151366#4370123>, @aprantl wrote:
> 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!
@aprantl Do you know if we can detect the end of the scope ? I'm not sure it's possible currently ... But even if we could do it, that wouldn't cover the following case:
int main() {
int i = 0;
{
back_in_scope:
int val = 0;
i++;
// Break here
val++;
val++;
}
{
if (i == 1)
goto back_in_scope;
printf("assuming that other and val aliases");
}
return 0;
}
If we disable the `val` variable watchpoint at the end of the scope, if we get back into it (because of a `goto` or whatever), the watchpoint won't trigger because it will disabled (by leaving the scope).
I think in order to solve these kind of problem we should do proper static analysis to be able to answer those questions.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151366/new/
https://reviews.llvm.org/D151366
More information about the lldb-commits
mailing list