* Re: tracking down unaligned accesses [not found] <13609.39173.90817.201628@coral.cuspy.com> @ 1998-04-07 3:38 ` Richard Henderson 1998-04-07 7:30 ` Thomas Leitner 1998-04-07 12:24 ` Stefan Traby 0 siblings, 2 replies; 5+ messages in thread From: Richard Henderson @ 1998-04-07 3:38 UTC (permalink / raw) To: Gene McCulley; +Cc: Richard Henderson, axp-list [-- Attachment #1: Type: text/plain, Size: 875 bytes --] [ 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 <sim> 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~ [-- Attachment #2: unaligned.c --] [-- Type: text/plain, Size: 596 bytes --] #ifndef __linux__ #include <sys/sysinfo.h> #else #include <asm/sysinfo.h> #include <asm/unistd.h> 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tracking down unaligned accesses 1998-04-07 3:38 ` tracking down unaligned accesses Richard Henderson @ 1998-04-07 7:30 ` Thomas Leitner 1998-04-07 9:55 ` Richard Henderson 1998-04-07 12:24 ` Stefan Traby 1 sibling, 1 reply; 5+ messages in thread From: Thomas Leitner @ 1998-04-07 7:30 UTC (permalink / raw) To: Richard Henderson; +Cc: Gene McCulley, axp-list On Mon, 6 Apr 1998, Richard Henderson wrote: > [ 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 <sim> 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. [...] You don't need that. The unaligned access message tells you all you need. Just start your program in gdb and set a breakpoint at the address 0x1207ac030 with (gdb) b *0x1207ac030 then run your program and it stops right where the unaligned access happens. At least this is the case under Digital Unix and I suppose Linux should do the same. Tom -------------------------------------------------------------------------- T o m L e i t n e r Dept. of Communications Graz University of Technology, e-mail : tom@finwds01.tu-graz.ac.at Inffeldgasse 12 Phone : +43-316-873-7455 A-8010 Graz / Austria / Europe Fax : +43-316-463-697 Home page : http://wiis.tu-graz.ac.at/people/tom.html PGP public key on : ftp://wiis.tu-graz.ac.at/pgp-keys/tom.asc or send mail with subject "get Thomas Leitner" to pgp-public-keys@keys.pgp.net -------------------------------------------------------------------------- Before we have the paperless office, we have the paperless toilet! ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tracking down unaligned accesses 1998-04-07 7:30 ` Thomas Leitner @ 1998-04-07 9:55 ` Richard Henderson 1998-04-07 10:00 ` Thomas Leitner 0 siblings, 1 reply; 5+ messages in thread From: Richard Henderson @ 1998-04-07 9:55 UTC (permalink / raw) To: Thomas Leitner; +Cc: Richard Henderson, Gene McCulley, axp-list On Tue, Apr 07, 1998 at 09:30:13AM +0200, Thomas Leitner wrote: > You don't need that. The unaligned access message tells you all you need. > Just start your program in gdb and set a breakpoint at the address... Maybe, maybe not. Just setting a breakpoint at the address is slow and irritating if the point is crossed a couple million times before the errant data is presented. Having a signal generated is much friendlier under the debugger. r~ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tracking down unaligned accesses 1998-04-07 9:55 ` Richard Henderson @ 1998-04-07 10:00 ` Thomas Leitner 0 siblings, 0 replies; 5+ messages in thread From: Thomas Leitner @ 1998-04-07 10:00 UTC (permalink / raw) To: Richard Henderson; +Cc: Gene McCulley, axp-list On Tue, 7 Apr 1998, Richard Henderson wrote: > On Tue, Apr 07, 1998 at 09:30:13AM +0200, Thomas Leitner wrote: > > You don't need that. The unaligned access message tells you all you need. > > Just start your program in gdb and set a breakpoint at the address... > > Maybe, maybe not. Just setting a breakpoint at the address is > slow and irritating if the point is crossed a couple million > times before the errant data is presented. Yes but in my experience most unaligned accesses occur when the point in the code is executed the first time. > Having a signal generated is much friendlier under the debugger. I wouldn't exactly call it "friendlier" to have to modify my code in order to debug it. In any case: Your method can be used *if* the point is executed many times before the unaligned access happens. But I'd try to set a breakpoint and look before modifying my code to trigger the signal. Tom -------------------------------------------------------------------------- T o m L e i t n e r Dept. of Communications Graz University of Technology, e-mail : tom@finwds01.tu-graz.ac.at Inffeldgasse 12 Phone : +43-316-873-7455 A-8010 Graz / Austria / Europe Fax : +43-316-463-697 Home page : http://wiis.tu-graz.ac.at/people/tom.html PGP public key on : ftp://wiis.tu-graz.ac.at/pgp-keys/tom.asc or send mail with subject "get Thomas Leitner" to pgp-public-keys@keys.pgp.net -------------------------------------------------------------------------- Before we have the paperless office, we have the paperless toilet! ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tracking down unaligned accesses 1998-04-07 3:38 ` tracking down unaligned accesses Richard Henderson 1998-04-07 7:30 ` Thomas Leitner @ 1998-04-07 12:24 ` Stefan Traby 1 sibling, 0 replies; 5+ messages in thread From: Stefan Traby @ 1998-04-07 12:24 UTC (permalink / raw) To: rth; +Cc: mcculley, axp-list Hi Richard ! > 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. Not really needed for DU. man uac ! -- ciao - Stefan Stefan Traby phone: +43-3133-6107-2 Mitterlasznitzstr. 13 fax: +43-3133-6107-9 8302 Nestelbach mailto://stefan@sime.com Austria ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1998-04-07 12:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <13609.39173.90817.201628@coral.cuspy.com>
1998-04-07 3:38 ` tracking down unaligned accesses Richard Henderson
1998-04-07 7:30 ` Thomas Leitner
1998-04-07 9:55 ` Richard Henderson
1998-04-07 10:00 ` Thomas Leitner
1998-04-07 12:24 ` Stefan Traby
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox