-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[dexter] Correctly identify stop-reason while driving VisualStudio #94754
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
Conversation
Prior to this patch VisualStudio._get_step_info incorrectly identifies the reason the debugger has stopped. e.g., stepping through a program would be reported as a StopReason.Breakpoint rather than StopReason.Step. Fix. Not test added as there are no VisualStudio tests (tested locally).
✅ With the latest revision this PR passed the Python code formatter. |
@@ -307,6 +307,30 @@ def set_current_stack_frame(self, idx: int = 0): | |||
) | |||
) | |||
|
|||
def _translate_stop_reason(self, reason): | |||
# https://learn.microsoft.com/en-us/dotnet/api/envdte.dbgeventreason?view=visualstudiosdk-2022 | |||
if reason == 1: # dbgEventReasonNone |
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.
Can those magic values (1, 9, 8, ...) be replace for some named constants?
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 can't find a way to get them out of the DTE interface. I could name the constants myself, but I'm not sure that really adds anything over what I've got here since they're only used in this one place. wdyt?
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.
May be something like:
dbgEventReasonNone = 1
dbgEventReasonGo = 2
...
if reason == dbgEventReasonNone:
...
Basically is the same code, but I think it is easy to read.
Otherwise LGTM.
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 have strong opinions, but in general even if it's only going to be used once I think it's probably better to have something like class VSDebugEventReason(IntEnum):
with the correct values added to it.
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.
Changes LGTM
Prior to this patch VisualStudio._get_step_info incorrectly identifies the reason the debugger has stopped. e.g., stepping through a program would be reported as a StopReason.Breakpoint rather than StopReason.Step.
Fix. No test added as there are no VisualStudio tests (tested locally).