[Lldb-commits] [PATCH] D144688: [lldb] Fix {break, watch}point command function stopping behavior
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 24 15:41:04 PST 2023
bulbazord requested changes to this revision.
bulbazord added inline comments.
This revision now requires changes to proceed.
================
Comment at: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:1314-1324
+ if (line.startswith("return ")) {
+ llvm::StringRef return_val =
+ line.substr(llvm::StringRef("return ").size());
+ sstr.Printf(" __return_val = %s", return_val.data());
+ } else {
+ sstr.Printf(" %s", line.data());
+ }
----------------
I feel like this is subtly wrong. For example, given the user provided function:
```
def func(frame, bp_loc, internal_dict):
if frame.name == "main":
return True
return False
```
This will be transformed into:
```
def __user_callback():
nonlocal __return_val
if frame.name == "main":
__return_val = True
__return_val = False
```
Assume frame.name == "main": In the first one, we will return True. In the second one, `__return_val` will be False.
Maybe we can insert the input into `__user_callback` as-is and do `__return_val = __user_callback()`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144688/new/
https://reviews.llvm.org/D144688
More information about the lldb-commits
mailing list