delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/31/19:04:57

Message-Id: <199605312302.AA15609@interlock.wdni.com>
Date: Fri, 31 May 1996 16:10:29 -0700 (PDT)
From: Jeff Welty <jwelty AT wdni DOT com>
To: Roland Exler <R DOT Exler AT jk DOT uni-linz DOT ac DOT at>
Cc: djgpp AT delorie DOT com
Subject: Re: user-requested stack-trace at exit
In-Reply-To: <31ADDBB3.45D7@jk.uni-linz.ac.at>
Mime-Version: 1.0

On Thu, 30 May 1996, Roland Exler wrote:

> Taking a recently posted message from A.Appleyard I've hacked a 
> stack-trace for V2. With this functions it's possible to determine how 
> deep the function-nesting is at a particular place in the program and 
> print a stack-trace suitable for use with symify.

Or you can just do an

    asm("int $3") ;

which generates a stack dump.  This will abort the program though, so your
method would be better if you want to continue execution.

> This way you can trace down how you've reached some point in your program 
> without generating a floating-point error or a NULL-pointer dereference.

Floating point errors won't generate a correct stack dump anyway,
at least with version V2, because the FPU has generated a hardware
interrupt, and the stack starts with the exception processor, which
hasn't got the original stack pointers set correctly for a stack dump.
 
> I think this part of code would help debugging many programs. I'll try to 
> redefine assert() so it will print a stack-trace too.

That sounds very useful indeed.

Jeff Welty --  weltyj AT wdni DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019