Re: new version of powstatd has unaligned traps
On Mon 29 Nov 1999, Peter S Galbraith wrote:
> A not-yet-packaged new version of powstatd (a UPS deamon) has
> unaligned traps. Does this mean there are Alpha C coding issues
> to resolve? Or is it _nothing_ to worry about?
This means that the code is doing incorrect accesses. These are trapped
by the kernel, and emulated (which is much slower). However, everything
works OK, so it's not a critical problem. It _is_ slower than it could,
as the kernel has to emulate stuff.
On Alpha, if you want to access a 4-byte data type (e.g. int), the
address at which you access it must be a multiple of 4. If you want to
access a 8-byte data type (e.g. pointer), the address must be a multiple
of 8. For 2-byte values, the address must be a multiple of 2, and for
1-byte values, it doesn't matter. So, this is wrong (real-life example):
x = *(long *)&array_of_chars;
y = *(long *)&array_of_chars;
You will get a trap on the second line.
If you get a kernel message like so:
powstatd(15285): unaligned trap at 0000000120024a9c: 000000011ffffa34 2d 10
you fire up gdb on powstatd (which must be linked with -g, and with
libc6.1-dbg) and type:
info line *0x0000000120024a9c
which will give you a lines such as:
Line 88 of "bla.c" starts at address 0x120024a40 <_blafunc+10400>
and ends at 0x120024aa4 <_blafunc+10500>.
So look at line 88 and see what's going on there.
home: email@example.com http://www.wurtel.demon.nl/
work: firstname.lastname@example.org http://www.murphy.nl/
debian: email@example.com http://www.debian.org/
isdn4linux: firstname.lastname@example.org http://www.isdn4linux.de/