Skip to content

[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

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

OCHyams
Copy link
Contributor

@OCHyams OCHyams commented Jun 7, 2024

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).

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).
Copy link

github-actions bot commented Jun 7, 2024

✅ 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
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

@CarlosAlbertoEnciso CarlosAlbertoEnciso Jun 7, 2024

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.

Copy link
Contributor

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.

Copy link
Contributor

@SLTozer SLTozer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM

@OCHyams OCHyams merged commit 832b91f into llvm:main Jun 10, 2024
5 checks passed
@HerrCai0907 HerrCai0907 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants