[lldb] Make print delegate to synthetic frames.#178602
[lldb] Make print delegate to synthetic frames.#178602bzcheeseman wants to merge 1 commit intomainfrom
print delegate to synthetic frames.#178602Conversation
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
67e37e2 to
f6f858b
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
|
@llvm/pr-subscribers-lldb Author: Aman LaChapelle (bzcheeseman) ChangesStacked PRs:
[lldb] Make
|
f6f858b to
596163d
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
596163d to
ea2ba05
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
ea2ba05 to
a2fbf87
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
9c57d52 to
d29da9f
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
d29da9f to
ef725a4
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
ef725a4 to
0cd04e7
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
|
This doesn't seem like the right way to do this to me. What should be happening fundamentally is that when anybody asks "can you find the variable foo" for a synthetic frame, the frame's synthetic provider's variable list should be queried, rather than (or along with depending on what policy we're going to choose for access to synthetic variables) the "native" variable list from the frame. You would want that to work not just in dwim-print but anywhere that variables get looked up in a frame. Once you've handed out the right root variable, the parsing of child nodes for an expression will happen naturally since that's just querying the root's type, so if you get the right root variable, you get the appropriate children. That shows that properly the task is "hand out the right variables from the frame when asked". The one thing that dwim-print and expr should probably do is warn or error out if the user tries to running expressions in a frame with synthetic variables. Even that wouldn't be necessary if we take the extra step of materializing the synthetic values into the inferior when the frame makes them. But that's probably going to be tricky and seems like a "version 2" kind of effort. In the case of StackFrame::EvaluateExpression and expr you should be able to do this at the top of the command (except But note, if you said So while we probably want to put some "can't run expressions that have to run in the target in a frame with synthesized variables" warning when in a frame with synthesized variables, the actual lookup into the synthesized variables list needs to happen at a lower layer in the lookup. |
0cd04e7 to
b6e6837
Compare
This patch is more of a proposal in that it's a pretty dramatic change to the way that `print` works. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails. For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier <blah>" or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met. stack-info: PR: #178602, branch: users/bzcheeseman/stack/7
b6e6837 to
a9894b2
Compare
Yes that does seem much more correct. I think the issue I was running into was understanding where that change should be made!
That makes sense. I hope that works with Values as well, since we can't produce variables at this point 😅 My reading of the code is that you're right, it should, but I'm not as confident as I'd like to be.
Do you mean in the context of something like "I have provided a synthetic variable from my interpreter, and now I want to run an expression on it"? Wouldn't you just have the interpreter itself run that expression? Or not, I guess, depending on the thing being interpreted.
Sorry what's the DIL here? That sounds promising, but I don't know enough to evaluate. The main blocker I encountered was finding things/methods that required VariableSP (hard to create) vs ValueObjectSP (easy to create).
Got it, makes sense. Do you have a sense for where something like that should be done? It kind of sounds like you're shooting for putting some of this stuff into the expression evaluation machinery? I'm happy to try and put some more time into it, I will just need your guidance :) I would also like to see if there's a good way for the plugin to propagate errors back up to the user through the print/expression evaluation. In the meantime I'll close this PR since it sounds like, and I agree, there's a better way to do the thing I'm trying to do. |
Stacked PRs:
printdelegate to synthetic frames. #178602[lldb] Make
printdelegate to synthetic frames.This patch is more of a proposal in that it's a pretty dramatic change to the way that
printworks. It completely delegates getting values to the frame if the frame is synthetic, and does not redirect at all if the frame fails.For this patch, the main goal was to allow the synthetic frame to bubble up its own errors in expression evaluation, rather than having errors come back with an extra "could not find identifier " or worse, simply get swallowed. If there's a better way to handle this, I'm more than happy to change this as long as the core goals of 'delegate variable/value extraction to the synthetic frame', and 'allow the synthetic frame to give back errors that are displayed to the user' can be met.