www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/05/02:05:07

Date: Thu, 5 Sep 1996 08:55:27 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Michael Day <mikeday AT melbpc DOT org DOT au>
Cc: djgpp AT delorie DOT com
Subject: Re: Stack Trace
In-Reply-To: <mikeday.9.0004B0A0@melbpc.org.au>
Message-Id: <Pine.SUN.3.91.960905084544.29960E-100000@is>
Mime-Version: 1.0

On Thu, 5 Sep 1996, Michael Day wrote:

> When a djgpp program crashes, it prints a nice stack trace which is very handy 
> for debugging. Is there anyway to generate this without actually crashing, ie: 
> if you want to find out how a particular procedure got called then insert a 
> line that generates the stacktrace? Or is this a CWSDPMI thing?

Use the following snippet to produce a traceback *and* cause the program 
to exit:

    signal (SIGINT, SIG_DFL);
    __asm__ __volatile__ ("movb $0x1b,%al;call ___djgpp_hw_exception");

I usually put the above code into a function that gets called from 
``impossible'' situation, when something that shouldn't ever happen, 
somehow did.  Then by examining the traceback I know where the culprit 
is.

Why do you need the traceback without exiting?  Isn't that what debuggers 
are for?  E.g., GDB has a command to print the `back-trace' which shows 
all the call sequence that got you to the place you are.

- Raw text -


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