Subject: g++ throw/catch on 164LX
To: None <port-alpha@NetBSD.org>
From: Johan Hattne <johan.hattne@embl-hamburg.de>
List: port-alpha
Date: 04/25/2006 17:40:09
Dear List;

I think I've looked through the obvious sources of information but 
haven't been able to figure this one out yet.  On my 164LX I cannot use 
exceptions in g++ without dumping core.

zsh> g++ -Wall -g -o throw throw.cpp && ./throw
Throwing
pid 18647 (throw): unaligned access: va=0x160181bda pc=0x160198688 
ra=0x160198734 sp=0x1ffffdbd8 op=ldl
pid 18647 (throw): unaligned access: va=0x160181bda pc=0x160198818 
ra=0x1601988e0 sp=0x1ffffdbd8 op=ldl
pid 18647 (throw): unaligned access: va=0x1602d21d2 pc=0x160198688 
ra=0x160198734 sp=0x1ffffe088 op=ldl
pid 18647 (throw): unaligned access: va=0x1602d21d2 pc=0x160198818 
ra=0x1601988e0 sp=0x1ffffe088 op=ldl
zsh: abort (core dumped)  ./throw

zsh> gdb throw
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 "alpha--netbsd"...
(gdb) r
Starting program: /home/myuser/tmp/throw
Throwing
pid 13594 (throw): unaligned access: va=0x160181bda pc=0x160198688 
ra=0x160198734 sp=0x1ffffdbc8 op=ldl
pid 13594 (throw): unaligned access: va=0x160181bda pc=0x160198818 
ra=0x1601988e0 sp=0x1ffffdbc8 op=ldl
pid 13594 (throw): unaligned access: va=0x1602d21d2 pc=0x160198688 
ra=0x160198734 sp=0x1ffffe078 op=ldl
pid 13594 (throw): unaligned access: va=0x1602d21d2 pc=0x160198818 
ra=0x1601988e0 sp=0x1ffffe078 op=ldl

Program received signal SIGABRT, Aborted.
0x00000001601dd860 in kill () from /usr/lib/libc.so.12
(gdb)

Using g++ 3.3.5 from ports, I get segmentation violation instead of 
abort, with 3.4.6 I again have SIGABRT.  Static linking makes the 
unaligned accesses go away but not the abort.  Kernel and userland were 
built from stable sources updated from CVS around april 11.

zsh> uname -a
NetBSD mymachine 3.0.0_STABLE NetBSD 3.0.0_STABLE (GENERIC) #1: Tue Apr 
11 12:11:15 CEST 2006  
myuser@mymachine:/usr/obj/sys/arch/alpha/compile/GENERIC alpha

Early lines from dmesg look like this:

...
NetBSD 3.0.0_STABLE (GENERIC) #1: Tue Apr 11 12:11:15 CEST 2006
         myuser@mymachine:/usr/obj/sys/arch/alpha/compile/GENERIC
Digital AlphaPC 164LX 533 MHz, s/n
8192 byte page size, 1 processor.
total memory = 512 MB
(2128 KB reserved for PROM, 509 MB used by NetBSD)
avail memory = 492 MB
mainbus0 (root)
cpu0 at mainbus0: ID 0 (primary), 21164A-2
cpu0: Architecture extensions: 1<BWX>
cia0 at mainbus0: DECchip 2117x Core Logic Chipset (Pyxis), pass 1
cia0: extended capabilities: 1<BWEN>
cia0: using BWX for PCI config access
...

This seems like a severe problem -- so severe that I'm inclined to 
believe I'm either missing something trivial or that there's something 
funny going with my hardware.  Anybody have any suggestions?

// Cheers; Johan