delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/14/04:46:43

Date: Thu, 14 Aug 1997 11:46:12 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Lyle <lpak1 AT ccds DOT cc DOT monash DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: Debugging Information && SIGSEGV faults
In-Reply-To: <33F18E09.C93AB447@NO_SPAMccds.cc.monash.edu>
Message-ID: <Pine.SUN.3.91.970814114501.6734I-100000@is>
MIME-Version: 1.0

On Wed, 13 Aug 1997, Lyle wrote:

> well this is the second time somones "hinted" at what to do. I'm not
> sure i can be any more obvious than; I HAVE NO IDEA WHAT I AM DOING! I
> hvae only used the compiler for about 2 hours all up, and didn;t think
> there would be too much trouble porting my code across. Most of the

I wasn't following this thread from its beginning, so let me apologize
up front if I'm not talking to your point below, but I hope it will
help you.

As far as I understand, your problem is with debugging code that comes
from #include'd files.  If that is correct, then the DJGPP debuggers
won't be able to debug such code unless you get a patched version of
GCC which can generate the so-called ``stabs debug information''.  The
version of GCC in the stock DJGPP distribution doesn't support stubs
debugging, that's why adding -gstabs to the GCC command line didn't
help you.

Several people advised you to get PGCC (GCC with Pentium
optimizations) or rebuild GCC with a certain patch that enables stabs
support.  While this advice is certainly valid, I won't recommend that
approach for a person who is new to DJGPP (as you have described
yourself), since you obviously want to make your program work *fast*.
Building GCC is no small feat, it requires that you download and
install several optional DJGPP packages and be ready to battle
problems that pop up in some cases when you build GCC.  PGCC is still
in beta phase and might get you in trouble in other places.

So these are solutions for somebody who is ready to invest a
significant amount of time into learning to use these tools.  If you
are ready for such an investment of time and effort, by all means go
ahead with one of these options.

If not, here's the approaches to debugging your problem that I can
recommend:

       1) Make a special version of the program source that doesn't
	  use code from included files, by inserting the contents of
	  these file into the main source file.  (If you can guess
	  which inclded files you need to debug, insert only them.)
	  Debug that version with any debugger you fancy.  When you
	  have found the bug(s) and corrected them, go back to the
	  original source files and correct them as well.

       2) Use ``printf debugging''.  That is, insert calls to `printf'
	  in strategic points of the program that will print values of
	  variables which can explain how does the problem happen.
	  Examine the output of these `printf' calls and try to
	  induce what is causing the bug.

       3) Try to make a small (100 lines or less) program that
	  exhibits the same behavior, post it to this forum and ask
	  people to tell what's wrong with it.

- Raw text -


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