Skip to content

[debugger-agent] Fix mono_debugger_disconnect implementation #1217

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

eneko-unity
Copy link

Purpose of this PR:

Current mono_debugger_disconnect implementation is trying to stop the debugger thread and start it again, this approach is not working as expected since it creates a deadlock.

Since the debugger the thread is blocked in the RECV method the new approach is just to shutdown the debugger client connection socket so the client disconnects and the debugger_thread loop already handles the debugger client disconnection properly.

Testing status:

Florence has tested the disconnection feature in the scripting/no-cost-editor-attaching-disconnect-fix branch.

- Fix mono_debugger_disconnect method so it disconnects the debugger
client instead of trying to stop the debugger thread.
@@ -1091,12 +1091,18 @@ mono_debugger_get_generate_debug_info ()
return disable_optimizations;
}

// Declare transport_close2 method
static void transport_close2(void);

MONO_API void
mono_debugger_disconnect ()

Choose a reason for hiding this comment

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

Is this a new function we added or are we changing existing behaviour here?

Would it make sense to put the transport_close2 call into a new function like? mono_debugger_disconnect_external() ?

Copy link
Author

@eneko-unity eneko-unity Aug 14, 2019

Choose a reason for hiding this comment

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

transport_close2 is an existing function. In this PR I'm just modifying the implementation of mono_debugger_disconnect.

In my opinion I don't think that mono_debugger_disconnect_external is needed since the mono_debugger_disconnect method is just one call to an existing method.

Choose a reason for hiding this comment

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

I'm asking if you originally added mono_debugger_disconnect or if it already existed and this change could be breaking change.

Copy link
Author

Choose a reason for hiding this comment

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

mono_debugger_disconnect was added by Jonathan Chambers with the other new APIs needed for scripting/no-cost-editor-attaching

Choose a reason for hiding this comment

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

Okay, great :-) Then no existing functionality will break.

- Move method declaration to top of the file
@joshpeterson
Copy link

Should we apply the same changes to the debugger code in IL2CPP?

@eneko-unity
Copy link
Author

eneko-unity commented Aug 14, 2019

This workflow is just for the Unity Editor so I don't think is necessary in IL2CPP. But honestly I don't know what is the usual workflow you guys do, in case you try to maintain full feature parity or not. Feel free to reach me out in slack if you want to discuss more about it

@eneko-unity eneko-unity requested a review from joncham August 14, 2019 18:33
@eneko-unity eneko-unity merged commit 7c87ac0 into unity-master Aug 15, 2019
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.

4 participants