RE: [ng-spice] Segmentation violation on running scripts


To "'ng-spice@ieee.ing.uniroma1.it'" <ng-spice@ieee.ing.uniroma1.it>
From Robert Penny <rob@network.ucsd.edu>
Date Wed, 10 Jan 2001 11:17:44 -0800 (PST)
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
In-Reply-To <CF654D964573D311A1CA0090278A36FF4CBD34@EDIN_EXM1 >
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice@ieee.ing.uniroma1.it

On Wed, 10 Jan 2001, Gillespie, Alan wrote:

> Is this a different seg fault from the one that has been
> fixed since rework 13 ? As far as I remember, the file
> variable.c had some fixes to stop some memory leaks, but
> because of some side effects of other functions, it ended
> up freeing pointers which had been moved from their
> original malloced location.

I'm afraid I haven't downloaded the CVS archive, but maybe this will
answer which seg fault is causing the error.  

I logged the output from gdb when starting up and running both the gc and
non-gc versions of the code.  Doing a backtrace on the code just prior to
exit does seem so show the exception is being thrown while doing a free in
variable.c.

In more detail: I set gdb to pass all SIGSEGV signals to the program, but
to print them out.  The gc version successfully traps 13 SIGSEGVs on
startup.  The non-gc version also traps 13 SIGSEGVs on startup and then
gives me the command prompt.  If I then ask it to execute a script the
non-gc version fails, receiving an additional SIGSEGV that gets trapped to
sigsegv() in signal_handler.c. (I assume the handler for SIGSEGV gets
changed back and forth during execution of the spice code.)

I put a breakpoint on function sigsegv() in signal_handler.c so I could do
a backtrace of how we got here... 

-------------------------------------------------------------------

(gdb) handle SIGSEGV pass print nostop
Signal        Stop      Print   Pass to program Description
SIGSEGV       No        Yes     Yes             Segmentation fault
(gdb) break sigsegv
Breakpoint 1 at 0x8069bd5: file signal_handler.c, line 114.
(gdb) run
Starting program: 
/usr/src/tarballs/ng-spice-rework-13-nogc/src/.libs/lt-ngspice 

Program received signal SIGSEGV, Segmentation fault.

   ---- 13 repeat SIGSEGV messages deleted (RDP) --- 

Note: can't find init file.
******
** ngspice-13 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please submit bug-reports to: ng-spice-bugs@ieee.ing.uniroma1.it
** Creation Date: Tue Jan  9 10:59:27 PST 2001
******
ngspice 1 -> testit

Program received signal SIGSEGV, Segmentation fault.

internal error -- segmentation violation

Breakpoint 1, sigsegv () at signal_handler.c:114
warning: Source file is more recent than executable.

114         fatal();
(gdb) bt
#0  sigsegv () at signal_handler.c:114
#1  0x403b3c98 in __restore ()
    at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127
#2  0x403e6ad8 in __libc_free (mem=0x80faee9) at malloc.c:2967
#3  0x80ae5ae in txfree (ptr=0x80faee9) at alloc.c:116
#4  0x8053269 in cp_setparse (wl=0x80fadf8) at variable.c:357
#5  0x80505ae in com_set (wl=0x80fadf8) at com_set.c:23
#6  0x80564eb in cp_oddcomm (s=0x80fade8 "testit", wl=0x0) at cpitf.c:320
#7  0x8050c94 in docommand (wlist=0x80fadd8) at control.c:161
#8  0x8051288 in doblock (bl=0x80fada8, num=0xbffff07c) at control.c:456
#9  0x8051bba in cp_evloop (string=0x0) at control.c:717
#10 0x804cd0a in main (argc=1, argv=0xbffff344) at ./main.c:633
(gdb) 

-----------------------------------------------------------------

I hope this helps identify whether it's a bug that's already been fixed.

-Rob Penny (rob@ucsd.edu)


Partial thread listing: