www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/14/20:46:55

From: Doug Eleveld <deleveld AT dds DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] How to get call stack after assert in RHIDE
Date: Sat, 14 Mar 1998 21:22:07 +0100
Organization: Rijksuniversiteit Groningen
Lines: 41
Message-ID: <350AE6EF.430FC8AA@dds.nl>
References: <199803140121 DOT RAA05954 AT adit DOT ap DOT net>
NNTP-Posting-Host: client36-122.oprit.rug.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

At 09:30  3/12/1998 GMT, steve wrote:
>When debugging in RHIDE and an assert occurs the call stack is always
>shown empty (it would be nice to see the function call stack showing
>how the program got there. When debugging and an error occurs, i.e. 

Here is something that I use to get kind of what you describe.  I
plucked the code from something someone else posted, I dont remember
exactly who.  Whoever did send me a mail and I'll put thier name in the
sources..

Here is the code:

//----------------------------------------------------------------------------
// abort program with stacktrace suitable for symify
// if -g was used for compiling

void _detl_assert (const char* test, const char* file, const int line)
   {
   long *bp=(long*)&bp+1;

   FILE *stream = fopen("assert.log","w");

   fprintf(stream,"DETL assertion %s at line %i in %s
failed!\n",test,line,file);

   while(*bp)
      {
      fprintf(stream,"  0x%08lx\n",((long*)bp)[1]);
      bp=(long*)*bp;
      }
   fclose(stream);

   exit(255);
   }

The output gets written to an assert.log file and if you symify that
file you should get the stack trace.

Good luck.

Doug Eleveld

- Raw text -


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