Mumpster http://mumpster.org/ |
|
Compiling Mumps V1 on FreeBSD x64: Malloc causes segfault? http://mumpster.org/viewtopic.php?f=22&t=1676 |
Page 1 of 1 |
Author: | shabiel [ Sat Dec 17, 2011 7:02 pm ] |
Post subject: | Compiling Mumps V1 on FreeBSD x64: Malloc causes segfault? |
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 |
Author: | raynewman [ Fri Dec 30, 2011 2:58 pm ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
From the look of your ipcs, you may have some improperly shut down mumps processes; this can cause this problem. Reboot FreeBSD and try again to see if the problem exists. Ray Newman |
Author: | shabiel [ Tue Jan 03, 2012 2:30 pm ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
Thank you for responding Mr. Newman. I tried it again another time and the same thing happened (a couple of weeks later; the computer was definitely restarted). I wrote a tiny C program that does a malloc, and it executed fine. I also found out that MV1 does a few allocations before this, and they work fine. So I am not sure why this specific one fails. Sam |
Author: | raynewman [ Tue Jan 03, 2012 3:19 pm ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
How does the pre-compiled package I supplied for FreeBSD go? (http://sourceforge.net/projects/mumps/f ... z/download) What version of FreeBSD are you using? Ray |
Author: | shabiel [ Thu Jan 05, 2012 9:11 am ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
Mr. Newman, I will get back to you on installing the pre-compiled package. I am using FreeBSD 9.0 RC3. Sam |
Author: | shabiel [ Fri Jan 06, 2012 4:22 pm ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
The precompiled package works fine! |
Author: | raynewman [ Wed Feb 22, 2012 1:35 am ] |
Post subject: | Re: Compiling Mumps V1 on FreeBSD x64: Malloc causes segfaul |
Hmmmm, I can't get a version compiled on FreeBSD 9.0-RELEASE to work either - same problem. The version compiled on ver 8 works fine on 9. For now, don't compile on 9. Ray |
Page 1 of 1 | All times are UTC - 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |