How to check ULF "flag" from running kernel? Finding the exact location triggering an unsp

Is there a way for a running kernel to check wether its ULF flag was already set? If so, how can this be done? (Maybe by means of inlining some assembler reading out some status register?)

I’d really like to have such an oppotunity in order to ease debugging: At the moment, I’m debugging a large raytracing kernel that takes about 5 minutes to compile! Using some (questionable) tricks (allocating some global device memory and reading it out before initializing it), I am able to retrieve output from a previous failed kernel run. Currently, I am “outputting” marks as the kernel proceeds. Unfortunately, if a kernel causes an ULF, this apperantly does not necessarily lead to an immediate end of kernel execution: I am getting the last mark of “output” issued immediately before the closing bracelet of the global function. Still the kernel finishes with an ULF. I am now planning to add marks specifying if the ULF flag is set or not. This should significantly increase my chances of finding the exact location triggering the ULF. (Using the debugger is currently not an option: 64-Bit system, hoping for the 64-bit debugger in 2.2 to come out soon enough before installing a dual boot 32-bit Linux.)