Skip to content
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

Don't grab the mouse when debugging #97

Merged
merged 3 commits into from Mar 6, 2022

Conversation

madebr
Copy link
Collaborator

@madebr madebr commented Mar 3, 2022

This pr adds 2 main features to make our life easier:

  • don't grab the mouse when a debugger is attached.
    This means that, when debugging in an IDE, the mouse won't be hidden.
    Right now, the mouse is hidden when some breakpoint is hit which is annoying.
  • do abort() instead of exit(1) on a panic when a debugger is attached,
    such that you are thrown right to the correct spot when e.g. an unimplemented function is encountered.

I copied the code to detect a debugger on Macos from this apple faq page: https://developer.apple.com/library/archive/qa/qa1361/_index.html
There is an important note about the code not working on a release build.
Since I don't own an apple (and you do), can you take a look at this and fix it?
You probably might have to #ifdef _DEBUG this function and return 0 when building a release binary.

This is another way to detect a debugger on Macos
https://zgcoder.net/ramblings/osx-debugger-detection/#mach-exception-handlers

Since gdb is not really used by apply, perhaps this 2nd method should be used instead.

@madebr madebr changed the title Better debugger experience Don't grab the mouse when debugging Mar 3, 2022
@dethrace-labs
Copy link
Owner

Seems to work well enough for me - I can build in release mode and it happily runs with no debugger attached. I don't really use a debugger, so I'd be happy enough if the osx one is stubbed with return 0;, but happy to merge as-is for now

@dethrace-labs dethrace-labs merged commit b512e15 into dethrace-labs:main Mar 6, 2022
@madebr madebr deleted the better-debugger-experience branch October 16, 2022 13:07
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.

None yet

2 participants