db4 on macppc
Can anyone confirm whether the db4 port is working on -current on macppc at the moment? I was trying to install cyrus, but it's hanging on ctl_cyrusdb -r at startup. Simplifying things I've tested with /usr/local/share/examples/db4/ex_env.c which has also been hanging sometimes when it does 'dbenv-open'. I'm pretty new to gdb and haven't worked out how to trace into libraries yet so haven't found more about where it's called from (well, it's from __os_sleep but I'm not sure where that's called from). Same thing on i386 is working fine as far as I can determine. If anyone could point me in a suitable direction to start looking I'd appreciate it, but just knowing whether it works for anyone else would be a good start.. Here's what I did to get ex_env running: install db4 package, cd /usr/local/share/examples/db4 gcc -o /tmp/ex_env -I /usr/local/include/db4 -ldb -L /usr/local/lib/db4 ex_env.c mkdir /tmp/database /tmp/ex_env This should output 'Setup env' then 'Teardown env', on my problem box I just get 'Setup env' then have to ^C most of the time, but (just to confuse me) sometimes it runs correctly. I haven't had 'ctl_cyrusdb -r' run correctly though. Thanks in advance for any pointers... Stuart - this is running a recent snap on a new Mac Mini. Haven't used macppc before but can't think of anything I might have done wrong so far. OpenBSD 3.8-beta (GENERIC) #403: Thu Aug 18 19:14:19 MDT 2005 [EMAIL PROTECTED]:/usr/src/sys/arch/macppc/compile/GENERIC real mem = 536870912 (524288K) avail mem = 483835904 (472496K) using 1254 buffers containing 26841088 bytes of memory mainbus0 (root) cpu0 at mainbus0: 7447A (Revision 0x102): 1249 MHz etc. (more at http://vervain.spacehopper.org/~sthen/macmini.dmesg)
Re: db4 on macppc
On Tue, Aug 23, 2005 at 07:54:56PM +0100, Stuart Henderson wrote: Simplifying things I've tested with /usr/local/share/examples/db4/ex_env.c which has also been hanging sometimes when it does 'dbenv-open'. Same problem here (with a four days old -current installation). I'm pretty new to gdb and haven't worked out how to trace into libraries yet so haven't found more about where it's called from (well, it's from __os_sleep but I'm not sure where that's called from). Rebuild libdb with debugging enabled: $ cd /usr/ports/databases/db/v4 $ make uninstall $ DEBUG=-g make install (and don't make clean until you're finished with debugging). Ciao, Kili ps: I'm just rebuilding libdb with debugging here.
Re: db4 on macppc
--On 23 August 2005 21:48 +0200, Matthias Kilian wrote: Rebuild libdb with debugging enabled: $ cd /usr/ports/databases/db/v4 $ make uninstall $ DEBUG=-g make install Thanks, that's helpful. # gdb /tmp/ex_env GNU gdb 6.3 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 powerpc-unknown-openbsd3.8... (gdb) break __db_tas_mutex_lock Function __db_tas_mutex_lock not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (__db_tas_mutex_lock) pending. (gdb) r Starting program: /tmp/ex_env Breakpoint 2 at 0x262e9b30: file ../mutex/mut_tas.c, line 99. Pending breakpoint __db_tas_mutex_lock resolved Setup env Breakpoint 2, __db_tas_mutex_lock (dbenv=0x2d57b000, mutexp=0x27f92000) at ../mutex/mut_tas.c:99 99 if (F_ISSET(dbenv, DB_ENV_NOLOCKING) || F_ISSET(mutexp, MUTEX_IGNORE)) (gdb) s 108 max_ms = F_ISSET(mutexp, MUTEX_LOGICAL_LOCK) ? 10 : 25; (gdb) 107 ms = 1; (gdb) 108 max_ms = F_ISSET(mutexp, MUTEX_LOGICAL_LOCK) ? 10 : 25; (gdb) 111 for (nspins = dbenv-tas_spins; nspins 0; --nspins) { (gdb) 585 mutex.h: No such file or directory. in mutex.h (gdb) 582 in mutex.h (gdb) 111 for (nspins = dbenv-tas_spins; nspins 0; --nspins) { (gdb) 169 __os_yield(NULL, ms * USEC_PER_MS); (gdb) 170 if ((ms = 1) max_ms) (gdb) 169 __os_yield(NULL, ms * USEC_PER_MS); (gdb) __os_yield (dbenv=0x27f92000, usecs=1000) at ../os/os_spin.c:107 107 if (DB_GLOBAL(j_yield) != NULL DB_GLOBAL(j_yield)() == 0) (gdb) 106 { (gdb) 107 if (DB_GLOBAL(j_yield) != NULL DB_GLOBAL(j_yield)() == 0) (gdb) 112 (void)__os_sleep(dbenv, 0, usecs); (gdb) __os_sleep (dbenv=0x0, secs=0, usecs=1000) at ../os/os_sleep.c:59 59 for (; usecs = 100; usecs -= 100) and again...etc... /usr/ports/databases/db/v4/w-db-4.2.52p2/db-4.2.52/dbinc/mutex.h line 585 is PPC assembly code, it's the asm volatile line in this - static inline int MUTEX_SET(int *tsl) { int __r; int __tmp = (int)tsl; asm volatile ( 0: \n\t lwarx %0,0,%2 \n\t cmpwi %0,0\n\t bne-1f \n\t stwcx. %2,0,%2 \n\t isync \n\t beq+2f \n\t b 0b \n\t 1: \n\t li %1, 0 \n\t 2: \n\t : =r (__r), =r (tsl) : r (__tmp) : cr0, memory); return (int)tsl; } I've done enough learning for today (I started by sprinkling printf through the code which annoyed me sufficiently to make me learn gdb basics) so I'll leave it for tonight, but thought I'd post what I've found so far in case it helps anyone else before I look at it again.
Re: db4 on macppc
--On 23 August 2005 21:48 +0200, Matthias Kilian wrote: On Tue, Aug 23, 2005 at 07:54:56PM +0100, Stuart Henderson wrote: Simplifying things I've tested with /usr/local/share/examples/db4/ex_env.c which has also been hanging sometimes when it does 'dbenv-open'. Same problem here (with a four days old -current installation). I've just posted to ports@ with some different ppc mutex assembly code for db which I found in Evolution's tree, which works better for me so far.