Mail Archives: djgpp/2001/11/24/02:55:20
> Newsgroups: comp.os.msdos.djgpp
> From: "Graham Rangel-Sharp" <een7gdr AT leeds DOT ac DOT uk>
> Date: Fri, 23 Nov 2001 10:50:50 GMT
>
> I tried including the following lines:
>
> #include <crt0.h> - into the top of main.c
> int _crt0_startup_flags = _CRT0_FLAG_FILL_SBRK_MEMORY; - at the top of
> main()
That is the correct usage.
> However the problem still persists.
One other suggestion would be to turn on the numeric exceptions and
see where does the program abort with SIGFPE. To this end, make this
line be the first executable statement of your `main' function:
_control87 (0x0332, 0xffff);
(you will need to include the <float.h> header). This will cause your
program to crash instead of producing NaNs. Compile and link the
modified program with the -g switch, then, when it crashes, use the
SYMIFY utility to translate the crash message into a human-readable
backtrace of function calls. That will tell you where in the code
does the first NaN or Inf happens. You can then look around near that
place and try to figure out what goes wrong with that computation, or
use printf to print values of suspicious variables.
Section 9.3 of the DJGPP FAQ list tells more about using SYMIFY, and
section 12.2 tells more about the information printed in the crash
message.
> I did try using the Cygwin port of the
> utilities but the software crashes very early on saying "segmentation fault,
> core dumped."
Something is seriously ill in this program...
> this appears to happen at the line:
>
> Calc_elec_jacobian(&F2v,&F2n,F2p);
>
> However F2v, F2n and F2p all seem to be valid variables. It seems like the
> computer is trying to reference memory at an address that is not available.
Are you sure that the crash is in the code that calls
Calc_elec_jacobian, not inside Calc_elec_jacobian?
> I tried to add the above lines to the cygwin version of the software but
> crt0.h doesnt exsist on my Cygwin version.
That's right, the _crt0_startup_flags variable is DJGPP-specific.
- Raw text -