Browse Source

SIGSEGV handling for Windows

pre-master-46
h_vogt 17 years ago
parent
commit
4ef61a65cf
  1. 7
      ChangeLog
  2. 1
      configure.in
  3. 7
      src/frontend/signal_handler.c
  4. 7
      src/main.c
  5. 17
      src/spicelib/analysis/dctrcurv.c
  6. 6
      visualc/vngspice.vcproj

7
ChangeLog

@ -1,3 +1,10 @@
2009-05-02 Holger Vogt
* configure.in: new flag NGDEBUG
main.c, signal_handler.c, visualc/vngspice.vcproj:
restore SIGSEGV signal handling for error message after seg fault
(not in debug mode, now only for Windows)
dctrcurv: winmessage about dc
2009-05-01 Holger Vogt
* cktdojob.c, cktsopt.c: moved to cktsopt.c:
maxord set to min 2 or max 6

1
configure.in

@ -211,6 +211,7 @@ if test "$enable_debug" = "no"; then
CFLAGS="$ext_CFLAGS -O2"
fi
else
AC_DEFINE(NGDEBUG,1,[Compile with debug info])
if test "x$GCC" = "xyes"; then
CFLAGS="$ext_CFLAGS -g -O0 -Wall"
else

7
src/frontend/signal_handler.c

@ -17,6 +17,10 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include <signal.h>
#include "signal_handler.h"
#ifdef HAS_WINDOWS
void winmessage(char* new_msg);
#endif
#ifdef HAVE_GNUREADLINE
/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */
/* from spice3f4 patch to ng-spice. jmr */
@ -133,6 +137,9 @@ RETSIGTYPE
sigsegv(void)
{
fprintf(cp_err, "\ninternal error -- segmentation violation\n");
#ifdef HAS_WINDOWS
winmessage("Fatal error in NGSPICE");
#endif
fatal();
}

7
src/main.c

@ -939,10 +939,9 @@ main(int argc, char **argv)
#ifdef SIGBUS
signal(SIGBUS, (SIGNAL_FUNCTION) sigbus);
#endif
#ifdef SIGSEGV
/* Want core files!
* signal(SIGSEGV, sigsegv);
*/
#if defined(SIGSEGV) && !defined(NGDEBUG) && defined(HAS_WINDOWS)
/* Allow a comment and graceful shutdown after seg fault */
signal(SIGSEGV, sigsegv);
#endif
#ifdef SIGSYS
signal(SIGSYS, (SIGNAL_FUNCTION) sig_sys);

17
src/spicelib/analysis/dctrcurv.c

@ -25,6 +25,11 @@ Modified: 1999 Paolo Nenzi
#include <devdefs.h>
extern SPICEdev **DEVices;
#ifdef HAS_WINDOWS
void SetAnalyse( char * Analyse, int Percent);
static double actval, actdiff;
#endif
int
DCtrCurv(CKTcircuit *ckt, int restart)
@ -160,6 +165,11 @@ DCtrCurv(CKTcircuit *ckt, int restart)
found:;
}
#ifdef HAS_WINDOWS
actval = cv->TRCVvStart[cv->TRCVnestLevel];
actdiff = cv->TRCVvStart[cv->TRCVnestLevel] - cv->TRCVvStop[cv->TRCVnestLevel];
#endif
#ifdef XSPICE
/* gtri - add - wbk - 12/19/90 - Add IPC stuff and anal_init and anal_type */
@ -474,6 +484,7 @@ resume:
}
nextstep:;
if(cv->TRCVvType[i]==vcode) { /* voltage source */
((VSRCinstance*)(cv->TRCVvElt[i]))->VSRCdcValue +=
cv->TRCVvStep[i];
@ -503,6 +514,12 @@ nextstep:;
cv->TRCVnestState = i;
return(E_PAUSE);
}
#ifdef HAS_WINDOWS
if (i == cv->TRCVnestLevel) {
actval += cv->TRCVvStep[cv->TRCVnestLevel];
SetAnalyse( "dc", (int)abs(((actval * 100.) / actdiff)));
}
#endif
}
/* all done, lets put everything back */

6
visualc/vngspice.vcproj

@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\src\maths\poly&quot;;&quot;$(ProjectDir)..\src\frontend&quot;;&quot;$(ProjectDir)..\src\spicelib\devices&quot;;&quot;$(ProjectDir)..\src\include&quot;;&quot;$(ProjectDir)include&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR;OUTDECK"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR;OUTDECK;NGDEBUG"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
@ -1100,11 +1100,11 @@
>
</File>
<File
RelativePath="..\src\frontend\plotting\grid.h"
RelativePath="..\src\include\grid.h"
>
</File>
<File
RelativePath="..\src\include\grid.h"
RelativePath="..\src\frontend\plotting\grid.h"
>
</File>
<File

Loading…
Cancel
Save