From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 920 invoked from network); 7 Apr 1998 03:36:25 -0000 Received: from dot.cygnus.com (205.180.230.224) by mail2.redhat.com with SMTP; 7 Apr 1998 03:36:25 -0000 Received: (from rth@localhost) by dot.cygnus.com (8.8.5/8.8.5) id UAA05170; Mon, 6 Apr 1998 20:38:02 -0700 Message-ID: <19980406203802.33715@dot.cygnus.com> Date: Mon, 6 Apr 1998 20:38:02 -0700 From: Richard Henderson To: Gene McCulley Cc: Richard Henderson , axp-list@redhat.com Subject: Re: tracking down unaligned accesses Reply-To: Richard Henderson References: <13609.39173.90817.201628@coral.cuspy.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=VbJkn9YxBvnuCH5J X-Mailer: Mutt 0.84 In-Reply-To: <13609.39173.90817.201628@coral.cuspy.com>; from Gene McCulley on Mon, Apr 06, 1998 at 11:15:14PM -0400 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii [ CC'ed to axp-list because of general interest. ] On Mon, Apr 06, 1998 at 11:15:14PM -0400, Gene McCulley wrote: > I am currently porting a large (1.6 million lines of code) application > to the Alpha. It has worked previously with the -taso stuff, but now > I am making it 64-bit clean and eliminating all of the sizeof(void *) > assumptions. I am working under Digital Unix, but this step was > necessary so that we can move to Linux/Alpha. > > I am getting the unaligned access messages: > Unaligned access pid=5293 va=0x1420f365c pc=0x1207ac030 ra=0x1207abff4 inst=0xb54c0000 > > Is there a way to trap these in the debugger or some other way to > facilitate finding these? The following will tell both Digital Unix and Linux (post 2.1.20 or so) to deliver a SIGBUS rather than fix up the access. This makes the problem significantly easier to debug. r~ --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="unaligned.c" #ifndef __linux__ #include #else #include #include static int setsysinfo(unsigned long op, void *buffer, unsigned long size, int *start, void *arg, unsigned long flag) { syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag); } #endif void trap_unaligned(void) { unsigned int buf[2]; buf[0] = SSIN_UACPROC; buf[1] = UAC_SIGBUS | UAC_NOPRINT; setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0); } #ifdef TEST static int tmp[2]; int main(int ac) { if (ac > 1) trap_unaligned(); return *(int *)((char *)tmp + 1); } #endif --VbJkn9YxBvnuCH5J--