From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 12355 invoked from network); 4 Dec 1998 21:19:47 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 4 Dec 1998 21:19:47 -0000 Received: from hazel.buici.com (root@hazel.buici.com [207.108.197.197]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id QAA25724 for ; Fri, 4 Dec 1998 16:15:42 -0500 Received: by buici.com via sendmail from stdin id (Debian Smail3.2.0.102) for axp-list@redhat.com; Fri, 4 Dec 1998 13:16:16 -0800 (PST) Date: Fri, 4 Dec 1998 13:16:16 -0800 From: Oscar Levi To: axp-list@redhat.com Subject: Re: How do I find/fix unaligned accesses? Message-ID: <19981204131616.A24274@hazel.buici.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.17i In-Reply-To: ; from Eric Ding on Fri, Dec 04, 1998 at 01:25:15PM -0500 On Fri, Dec 04, 1998 at 01:25:15PM -0500, Eric Ding wrote: > Hi all, > > I've read the FAQ about unaligned accesses on Alpha Linux. My question is, > now that I've got a whole log full of errors about unaligned accesses, how > do I go about tracking down the actual place in the code that's causing the > problem? > > I see, for example, > > axmain(521): unaligned trap at 0000000120472178: 000000011ffff2f4 2d 2 > > in /var/log/messages. Now what? Help me get Applixware for Linux/Alpha > out the door! :) What you do is get the source, apply the appropriate patches, build it and use a command like this to find the symbol: nm program | sort | less Once you have this, you know the name of the errant routine. Then, you generate an assembly language listing of the file with that routine. gcc ${CFLAGS} -S sourcefile.c And generate an assembler listing file. as -a sourcefile.s > sourcefile.lst Now, you have something. Find the first address of the routine in the listing, call this value A1. Take the base address of the symbol from the symbol output of nm, call this value A2, and the faulting address A3. The address in the listing where the problem occurs is A2 - A3 + A1. Now, I've done this many times. For some reason, I'm not getting the exact instruction where the fault occurs. Last I checked, I was getting the instruction after it. It is likely that my algorithm is wrong somewhere, but it gets you close. You can also load the program into gdb and use disass * to get an assembly language listing of the problem instruction. Cheers.