[Mono-list] Re: Seeing Values of Unwound Stack variables at Exception Handler

TB nospam_40811@alltel.net
Mon, 20 Dec 2004 13:05:57 -0500


I forgot to mention -- please reply directly to me.
I'm not subscribed.

On Mon, Dec 20, 2004 at 01:03:22PM -0500, TB wrote:
> With the Microsoft CLR one can use WinDBG !clrstack to view the CLR 
> stack when an UHHANDLED exception is thrown.  But when you have an
> try..catch exception block active, the stack will be unwound.  The
> Exception.StackTrace property gives you the *names* of the methods
> that were unwound, but not the locals or function parameters -- the 
> stack variables.
> 
> Does Mono allow you to register a "custom stack unwinder notification"
> function?  I could do it myself by adding the following code to every
> single method body:
> 
> function MayThrowException (int arg1, int arg2, intarg3) {
>   bool completed = false;
>   try {
>     // real method body
>    completed = true;
>   } finally {
>     if (!completed) {
>       //stash arg1, args2, arg3 on heap for later perusal
>       //possibly serialize them
>       //you can use reflection to enumerate all method
>       //arguments, can you use serialization to enumerate
>       //the locals?
>     }
>   }
> }
> 
> The compiler could output this prolog/epilogue code
> for each method.
> 
> But if the Runtime called back some code before it
> unwinds the stack that would be best.  It would help
> to debug.