Answer the question
In order to leave comments, you need to log in
How to get the location where sigsegv and the like are thrown from?
Good day!
I catch sigsegv and others with SetUnhandledExceptionFilter() on Windows.
And using signal() on Linux.
How can I get the location where the exception is thrown from? Both on Windows and Linux.
Thank you!
Answer the question
In order to leave comments, you need to log in
For Windows, to find out where an exception occurred, you need to:
1. Compile in debug mode
2. After throwing an exception, create a mini-dump, which can then be opened using windbg
But this method has disadvantages:
1. If the exception occurred in the library, then it will say the function in which the exception occurred, but will not say where this function was called from.
2. If you use qt, then you will have to carry a couple of hundred megabytes of library dlls with you, instead of a couple of tens, because debugging dlls weigh about ten times more
What is it for you?
In the case of linux:
For analysis after the fact - look at the core dump using gdb.
Try to do something programmatically - use sigaction() instead of signal() and there all information available information is passed in the handler's siginfo_t *info parameter
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question