Date: Thu, 5 Sep 1996 08:55:27 +0200 (IST) From: Eli Zaretskii To: Michael Day Cc: djgpp AT delorie DOT com Subject: Re: Stack Trace In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.