Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* fixing unaligned memory access on linux/alpha
@ 1999-08-25  4:00 Andrew Brydon
  1999-08-25  4:00 ` Xiaozhou Qiu
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Brydon @ 1999-08-25  4:00 UTC (permalink / raw)



Hi,
	I am porting my code to Linux/alpha, and am receiving unaligned traps in the
system logs. Clearly fixing this would be nice.

My question is, is there an equivalent to the 'uac' command on Tru64 that will
turn the warning into an SIGBUS, leaving me to find the problem in gdb. Pointers
in the direction of appropriate system calls would be fine too.

TIA
	Andrew

-- 
| Andrew Brydon           | phone: +61 3 9905 4429                    |
| Dept. Maths & Stats     | fax:   +61 3 9905 3867                    |
| Monash University       | mailto:Andrew.Brydon@eng.monash.edu.au    |
| Clayton Australia 3168  | http://www-personal.monash.edu.au/~brydon |



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fixing unaligned memory access on linux/alpha
  1999-08-25  4:00 fixing unaligned memory access on linux/alpha Andrew Brydon
@ 1999-08-25  4:00 ` Xiaozhou Qiu
  0 siblings, 0 replies; 2+ messages in thread
From: Xiaozhou Qiu @ 1999-08-25  4:00 UTC (permalink / raw)


Hi, there is a small program written by Sean recently which solve your problem. You can
find the code in the following:
ftp://mars.iol.unh.edu/pub/linux/applications/unalign.c

I also attach Sean's explantion about useful tool.

Xiaozhou Qiu
Linux Consortium
UNH

Sean's mail:

Here is the wrapper program I wrote to assist with the debugging of
unaligned traps.  Its the bastard child of something similar Richard
Henderson posted here, and the execcap program that Andrew Morgan wrote
for the libcap package, with a few bits of mine thrown in. Thanks to
Michal Jaegermann for the pointers. Basically, it runs the program given
on the commandline in gdb with the given arguments, but sets the flags so
that the program will recieve a SIGBUS on encountering an unaligned trap.
What you do is compile the code below thussly... gcc unaligned.c -o
unaligned ...then you run your naughty program.  Say I want to debug the
horrid "ping" program that came with redhat 6 (yes I know there's an
update, this is just an example).  What you do is get the source, build it
(without stripping the debugging symbols), change to the directory so that
gdb can find the relevant source files (in this case the directory is
called "ping"), and go unaligned ping harold ... the "harold" is because
I'm testing it by pinging one of the hosts on my network here.  You'd
substitute a suitable alternative. You'll see the following.... Extra
arguments passed to gdb in file /tmp/file6krPqZ. Be sure to delete it when
you're done.

GNU gdb 4.17.0.11 with Linux support
Copyright 1998 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-redhat-linux".

PING harold.uncarved.co.uk (10.0.1.1): 56 data bytes Program received signal
SIGBUS, Bus error. 0x12000359c in tvsub (out=0x11ffffa30, in=0x1201187fc)
at ping.c:885 885 if ((out->tv_usec -= in->tv_usec) < 0) { (gdb)

In otherwords, gdb has run the program and helpfully stopped at the offending
line.  Now, you just have to figure out how to fix the error...

Sean



Andrew Brydon wrote:

> Hi,
>         I am porting my code to Linux/alpha, and am receiving unaligned traps in the
> system logs. Clearly fixing this would be nice.
>
> My question is, is there an equivalent to the 'uac' command on Tru64 that will
> turn the warning into an SIGBUS, leaving me to find the problem in gdb. Pointers
> in the direction of appropriate system calls would be fine too.
>
> TIA
>         Andrew
>
> --
> | Andrew Brydon           | phone: +61 3 9905 4429                    |
> | Dept. Maths & Stats     | fax:   +61 3 9905 3867                    |
> | Monash University       | mailto:Andrew.Brydon@eng.monash.edu.au    |
> | Clayton Australia 3168  | http://www-personal.monash.edu.au/~brydon |




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-08-25  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-08-25  4:00 fixing unaligned memory access on linux/alpha Andrew Brydon
1999-08-25  4:00 ` Xiaozhou Qiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox