Disclaimer: I am not a C programmer.
I compiled Mumps V1 on FreeBSD x64. It compiles fine, but most operations cause a segmentation fault. Is it just my computer?
Code:
[sakura@pcbsd-2457 /usr/home/sakura/Downloads/mumps]$ uname -a
FreeBSD pcbsd-2457 9.0-RC3 FreeBSD 9.0-RC3 #2: Mon Dec 5 15:02:57 PST 2011 root@build9x64.pcbsd.org:/usr/obj/builds/amd64/pcbsd-build90/fbsd-source/9.0/sys/GENERIC amd64
Here are the gdb details:
Code:
[sakura@pcbsd-2457 /usr/home/sakura/Downloads/mumps]$ gdb ./mumps
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) ser arg vistadb.db
Undefined command: "ser". Try "help".
(gdb) set arg vistadb.db
(gdb) run
Starting program: /usr/home/sakura/Downloads/mumps/mumps vistadb.db
M> w "hello"
hello
M> s x=1
Program received signal SIGSEGV, Segmentation fault.
0x0000000800d55df3 in _malloc_postfork () from /lib/libc.so.7
(gdb) bt
#0 0x0000000800d55df3 in _malloc_postfork () from /lib/libc.so.7
#1 0x0000000800d5aa08 in _malloc_prefork () from /lib/libc.so.7
#2 0x0000000800d5cb4a in malloc () from /lib/libc.so.7
#3 0x00000000004424d2 in ST_Set (var=0x657680, data=0x65766b) at symbol_util.c:325
#4 0x000000000042a6a6 in run (savasp=1, savssp=32) at runtime_run.c:732
#5 0x000000000041bac8 in INIT_Run (file=0x7fffffffd87f "vistadb.db", env=0x0, cmd=0x0) at init_run.c:384
#6 0x0000000000402d1e in main (argc=1, argv=0x7fffffffd530) at init/mumps.c:153
(gdb)
(gdb) f 3
#3 0x00000000004424d2 in ST_Set (var=0x657680, data=0x65766b) at symbol_util.c:325
325 newPtrDt = malloc(i); // allocate necessary space
(gdb) l
320 fwd = ST_Create(var->name.var_qu); // attempt to create new ST ent
321 if (symtab[fwd].data == ST_DATA_NULL) // if not already exists
322 { i = DTBLKSIZE + data->len; // reqd memory
323 if ((var->slen != 0) || (i < DTMINSIZ)) // not reqd or too small
324 i = DTMINSIZ; // make it min size
325 newPtrDt = malloc(i); // allocate necessary space
326 if (newPtrDt == NULL) return -(ERRZ56+ERRMLAST); // no memory avlb
327 if (var->slen == 0) // no subscript key
328 { newPtrDt->deplnk = ST_DEPEND_NULL; // no dependents
329 newPtrDt->attach = 1; // initialize attach count
(gdb) p i
$1 = 32
(gdb) pt i
type = int
It crashes at the malloc line. I should have memory, otherwise, I won't be able to type this from FreeBSD.
Looks like IPC Shared Memory is created okay:
Code:
[sakura@pcbsd-2457 /usr/home/sakura/Downloads/mumps]$ ipcs
Message Queues:
T ID KEY MODE OWNER GROUP
Shared Memory:
T ID KEY MODE OWNER GROUP
m 196608 0 --rw------- sakura sakura
m 196609 0 --rw------- sakura sakura
m 196610 0 --rw------- sakura sakura
m 131075 0 --rw------- sakura sakura
m 131076 846715464 --rw-rw---- sakura sakura
m 131077 0 --rw------- sakura sakura
m 131078 0 --rw------- sakura sakura
m 65543 846715506 --rw-rw---- sakura sakura
m 65544 846714726 --rw-rw---- sakura sakura
m 65545 0 --rw------- sakura sakura
m 65546 0 --rw------- sakura sakura
m 65547 0 --rw------- sakura sakura
Semaphores:
T ID KEY MODE OWNER GROUP
s 65536 1953729362 --rw------- sakura sakura
s 65537 846715506 --rw-rw---- sakura sakura
s 65538 846714726 --rw-rw---- sakura sakura
s 65539 846715464 --rw-rw---- sakura sakura