(Illustration by Gaich Muramatsu)
One other thing I am interested in, what is the output of LWP's configure. I wonder which type of thread switching it picked. I think NetBSD deprecated makecontext and friends, so it might be using tricks with signal handlers (sigaltstack) to kickstart new threads, or it could be falling back on the old assembly code which might not realize that this is a 32-bit kernel/userspace. So it could be that the first thread switch is trying to perform a 64-bit read which triggers the bus error. A very interesting possibility. It would be cool to have a lwp-config program that outputs information about what it chose. I think ucontext is being used. But with the NetBSD/sparc userland, the #defines in force should be as for sparc (not sparc64). (uname -m used?) I built lwp on NetBSD/sparc64 (native, so 64-bit kernel and userland). gdt-sparc64 86 ~/SOFTWARE/CODA/lwp/src > size *.o text data bss dec hex filename 764 16 0 780 30c cswitch.o 180 0 4 184 b8 liblwp_la-fasttime.o 4272 0 2936 7208 1c28 liblwp_la-iomgr.o 1292 0 0 1292 50c liblwp_la-lock.o 9616 32 1504 11152 2b90 liblwp_la-lwp.o 8 0 0 8 8 liblwp_la-lwp_stacktrace.o 0 0 0 0 0 liblwp_la-lwp_ucontext.o 948 0 4 952 3b8 liblwp_la-timer.o 0 0 0 0 0 process.o 1588 328 0 1916 77c rw.o 1792 0 0 1792 700 tdb.o 888 16 0 904 388 testlwp.o testlwp and rw both work, and tdb crashes: gdt 89 ~/SOFTWARE/CODA/lwp/src > libtool gdb tdb *** Warning: inferring the mode of operation is deprecated. *** Future versions of Libtool will require --mode=MODE be specified. GNU gdb 5.3nb1 Copyright 2002 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 "sparc64--netbsdelf"... (gdb) run Starting program: /usr/home/gdt/SOFTWARE/CODA/lwp/src/.libs/tdb Main thread going to create procA Main thread going to create procB Main thread going to create procC Main thread returned from creating procC procA starting ... Program received signal SIGSEGV, Segmentation fault. 0x0000000040205cd8 in _rtld_symlook_list () from /usr/libexec/ld.elf_so On NetBSD-current on i386, I get /* config.h. Generated by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you have the `getpagesize' function. */ #define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have a working `mmap' system call. */ #define HAVE_MMAP 1 /* Define to 1 if the system has the type `register_t'. */ #define HAVE_REGISTER_T 1 /* Define to 1 if you have the `sigaltstack' function. */ #define HAVE_SIGALTSTACK 1 /* Define to 1 if the system has the type `stack_t'. */ #define HAVE_STACK_T 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <ucontext.h> header file. */ #define HAVE_UCONTEXT_H 1 /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Name of package */ #define PACKAGE "lwp" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "2.1" -- Greg Troxel <gdt_at_ir.bbn.com>Received on 2006-04-25 12:26:00