delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/11/13:35:42

Date: Thu, 11 Jun 1998 20:35:08 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: lubaldo AT adinet DOT com DOT uy
cc: djgpp AT delorie DOT com
Subject: Re: Forcing Traceback output with debuging purposes of a library.
In-Reply-To: <m0yjWGE-0001KcC@vivaldi.ort.edu.uy>
Message-ID: <Pine.SUN.3.91.980611203451.26077L-100000@is>
MIME-Version: 1.0

On Tue, 9 Jun 1998 lubaldo AT adinet DOT com DOT uy wrote:

>     I am adding some debuging capabilities to my PPCol library but I don't
> know how to force the output of the traceback, so the user can trace all the
> calls to functions and look where happened the problem.

From the code you posted I understand that you want to generate the
traceback and abort the program.  If that's true, use the following
little wonder:

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

The only thing that's not quite nice about this is that it says
"Exiting due to signal SIGSEGV", which is a lie, but other than that
it works just fine.

>    raise(SIGABRT); //Tried with SIGSEGV also but got the same results.

SIGABRT is not documented to generate a traceback, so it doesn't.  In
DJGPP v2.02, it *will* generate a traceback, so the above will work
then.  In the meantime, use the inline assembly code.

- Raw text -


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