[Piglit] [Patch RFC] Piglit Segmentation Handler
Ken Phillis Jr
kphillisjr at gmail.com
Tue Feb 19 14:41:20 PST 2013
On Mon, Feb 18, 2013 at 10:40 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
> I think this is a great idea.
> Concerning Windows, I don't have time to test myself now, but FWIW, feel free to lift inspiration/code from apitrace's exception handler: https://github.com/apitrace/apitrace/blob/master/common/os_win32.cpp#L248 I know it works very well.
I did find some of that useful. I also see that I probably *should*
add a function to remove the handlers for the cases when a particular
host system does not support automatically reverting things to default
state. However, From what I can see, Windows automatically uses
> However this is not enough to make piglit on windows 100% handsfree -- because assertion failures / errors on windows often create an interactive dialog box, the only way to be 100% sure the test won't hang is to have the piglit python framework periodically search for dialog boxes...
SetErrorMode is what you use to simply enable/disable error
Functionality. SEM_NOGPFAULTERRORBOX is the exact flag that needs to
be used to disable the crash dialog.
As for other things, the best way to capture crash backtraces that I
can find is to use the AddVectoredExceptionHandler ( and
RemoveVectoredExceptionHandler ) functions over the other functions (
SetUnhandledExceptionFilter, Signal, and _set_se_translator ). That
said, Currently I only have backtraces generated for the following
That said, Here's some of the documentation I'm using to figure out
what exceptions to handle/use...
MSDN - EXCEPTION_RECORD Structure
MSDN - SetErrorMode documentation
MSDN - AddVectoredExceptionHandler
MSDN - RemoveVectoredExceptionHandler
As for backtracing, I am using SymFromAddr, SymGetLineFromAddr64, and
SymInitialize from dbghelp (
), and CaptureStackBackTrace (
NOTE: I have not yet tested the backtrace capture on a real driver
with windows, but with an in-program crash the capture works well
enough to guarantee that piglit will get a "Crash" result and
backtrace before the program closes out.
More information about the Piglit