Skip to content

Fix attach to process debugging #1752

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

Conversation

SeeminglyScience
Copy link
Collaborator

@SeeminglyScience SeeminglyScience commented Apr 11, 2022

Fixes #1736

  • Add a new context frame for runspace entrance and REPL loops
  • Ensure runspace access is not attempted on a broken runspace
  • When a remote runspace hits a debugger stop, ensure that the origin pipeline thread does not run a REPL concurrently
  • Fix many race conditions

Keeping as draft for now as I have to fix probably a lot of merge conflicts Way less than I expected

Fixes PowerShell#1736

- Add a new context frame for runspace entrance and REPL loops
- Ensure runspace access is not attempted on a broken runspace
- When a remote runspace hits a debugger stop, ensure that the
  origin pipeline thread does not run a REPL concurrently
- Fix many race conditions
@ghost ghost added Area-Debugging Issue-Bug A bug to squash. labels Apr 11, 2022
@SeeminglyScience SeeminglyScience changed the title WIP: Fix attach to process Fix attach to process Apr 12, 2022
@SeeminglyScience SeeminglyScience marked this pull request as ready for review April 12, 2022 13:57
If multiple Write-Host's exist then this test will fail. FilterText
contains the module qualified name when dupes are present.
If the testing machine has a pester template installed the collection
will have an extra item.
&& (CurrentFrame.FrameType & PowerShellFrameType.Nested) is 0)
{
_shouldExit = false;
PopPowerShell();
Copy link
Member

Choose a reason for hiding this comment

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

Ok, we'll need to walk through the logic here and above together, it hurt my head 🤕

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It hurt my head to write it if it makes you feel any better 😁

For real though, a lot of what made PSES complicated before was controlling for scenarios like this. One runspace is pretty easy, multiple is a lot harder. It's also what made it prone to dead locks and slowness.

The difference this time though is I wrote it in a way where the extra complexity only really has an effect when it has to. So the normal everyday debugging loop should be completely unaffected but we still get reliable attach debugging. Thankfully Rob's work made it much easier to write in this way.

Copy link
Member

Choose a reason for hiding this comment

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

🥳

@andyleejordan
Copy link
Member

Sorrrry for merge conflicts.

@andyleejordan
Copy link
Member

I'm excited to get this in!

Copy link
Member

@andyleejordan andyleejordan left a comment

Choose a reason for hiding this comment

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

:shipit:

@andyleejordan andyleejordan changed the title Fix attach to process Fix attach to process debugging Apr 18, 2022
@andyleejordan andyleejordan merged commit 843d66d into PowerShell:master Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix attach to process debugging
2 participants