-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not match any characters after the dot in an expression #461
Conversation
@@ -745,8 +745,8 @@ def process_dap args | |||
break false | |||
end | |||
} and (message = "Error: Not defined global variable: #{expr.inspect}") | |||
when /\A[A-Z]/ | |||
unless result = search_const(b, expr) | |||
when /(\A[A-Z]\w*)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, why don't we use frame_eval
to evaluate the expr
directly but instead parsing them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frame_eval
sometimes changes the value(FYI: #395).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think after 756a2ed#diff-4208807b6db8555c61e42002b3e9c879003c5cfdb32d2b1a285a614b22fdf9d5 the changes made by frame_eval
doesn't affect the original program anymore. So in this case it won't reproduce the issue again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think after 756a2ed#diff-4208807b6db8555c61e42002b3e9c879003c5cfdb32d2b1a285a614b22fdf9d5 the changes made by frame_eval doesn't affect the original program anymore. So in this case it won't reproduce the issue again.
Oh, I see. I didn't know that.
However, we can't use frame_eval
for the following reasons:
frame_eval
uses current_frame, but we have to get a frame from request.- Even current_frame is the same as the target frame, we can't sometimes get the correct value such as instance of class. In the following case, showed value and value in backtrace information are not same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the example case. Are they different because they came from different frames? Or they're different but are evaluated from the same frame?
It looks like search_const
may not benefit much from using frame_eval
. But I think instance variables, global variables and normal expressions can be evaluated with frame_eval
. And making frame_eval
take arbitrary frame's binding shouldn't be an issue.
I also see that the CDP server uses a similar but slightly different implementation for evaluation. So if we can utilize it in both server implementation, we can largely simplify these parts and make sure we're aligned on features (such as special locals).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use eval
because expression can have side-effect.
Fixes #460.
The reason of this bug is that debugger matches characters after the dot when expressions are constant variables. That's why this PR ensure that debugger doesn't match any characters after the dot.