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

Add simple stack trace on unhandled exception #78

Closed
wants to merge 3 commits into from
Closed

Add simple stack trace on unhandled exception #78

wants to merge 3 commits into from

Conversation

ngullotta
Copy link

@ngullotta ngullotta commented Jun 29, 2020

Fixes #43
This leverages wxStackWalker and the OnFatalException handler to
access frames and their associated data

@JLaferri
Copy link
Member

JLaferri commented Jun 29, 2020

Tested this on windows. Did not seem to work for me unfortunately :(

https://github.com/project-slippi/Ishiiruka/tree/pr/78

@ngullotta
Copy link
Author

Hmm. I did not try this on Windows, but I don't see any reason why this wouldn't work on Windows.

Is the OnFatalException function being called at all for you?

Can you try enabling the wxUSE_STACKWALKER and/or wxUSE_ON_FATAL_EXCEPTION flags?

@JLaferri
Copy link
Member

JLaferri commented Jun 29, 2020

Honestly I'm having a lot of trouble telling whether the function is being called at all. If I run it in debug mode in VS, it stalls on the exception itself and never gets there. And if I run the compiled version it just crashes and I don't see anything.

I tried adding logging in the function but it's always possible it is calling the loggers but terminating the app too fast for them to get written?

You can see what I've tried in the PR link I sent before. It's very possible I'm doing something wrong

@ngullotta
Copy link
Author

I'll check it out on Windows when I have some free time

@ngullotta
Copy link
Author

ngullotta commented Jul 1, 2020

I did fix one issue where the path was all borked up on Windows, but, like yourself, I cannot get OnFatalException to be called at all, will investigate further.

Feel free to close this pr until then.

@JLaferri
Copy link
Member

JLaferri commented Jul 3, 2020

Thanks for checking. I think it's fine to keep open as this is a feature we would really like.

ngullotta added 3 commits July 5, 2020 16:01
This leverages wxStackWalker and the OnFatalException handler to
access frames and their associated data
On windows, it can be the case, that the path returned by
File::GetExeDirectory does not end in a directory seperator

This will *hopefully* ensure that this is not the case
@ngullotta
Copy link
Author

ngullotta commented Jul 7, 2020

I have an idea as to what the issue could be but I cannot get a local build running due to my inability to duck the "Precompiled Header Setting"

My idea was this, if you want to try it yourself pending my testing:

I read somewhere on wxWidget's documentation that OnFatalException depends on a compiling with Structured Exception Handling as a feature. This is a feature in Visual Studio.

See this Microsoft documentation on the option here:
https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=vs-2019#to-set-this-compiler-option-in-the-visual-studio-development-environment

Now, here comes the janky part. I tried doing this for myself after rebasing my branch on upstream slippi, but I cannot get it to compile. It always says

compiler option 'C++ Exception Handling Unwinding' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header

I tried disabling PCH and then get hit with even more errors, so I decided to stop there for now.

You might try enabling this yourself and see if you can get past this error. With any luck, this is what's preventing this feature from working on Windows.

@JLaferri
Copy link
Member

@legionxvx Did you update to VS2019? Wondering if that's why you encountered errors.

Fwiw Dolphin doesn't support C++ exceptions afaik, you can't use try/catch

@NikhilNarayana
Copy link
Member

Closing due to inactivity.

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.

Log stack trace to file on unhandled exception
3 participants