Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* How can I cause unaligned access to generate SIGBUS under DEC OSF/1?
@ 1993-08-27 13:59 Mark Bartelt
  1993-08-27 14:33 ` Matt Thomas
  1993-08-27 15:32 ` SUMMARY: " Mark Bartelt
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Bartelt @ 1993-08-27 13:59 UTC (permalink / raw)


Someone in our group is trying to debug a rather ugly chunk of Fortran
code on our AXPs, and is getting a number of runtime "Unaligned access"
messages.  I know how to use the "uac" command to turn the message off,
but since I suspect that the existence of the unaligned access probably
means that the code is broken, I'd like to be able to trap them.

Specifically, I expect to find errors of the following sort:

	common /spam/ x,y,z
	real*4 x,y,z
	call foo(y)
	[...]
	subroutine foo(q)
	real*8 q
	[...]

It's surprising how much of this sort of cruft one finds, partly because
on a VAX, with real*4 and real*8 having same-size exponents, code such as
this would seemingly work (since there'd be only some small error down in
the low-order bits of the mantissa).  But of course, with IEEE floating
point, one tends to get totally bogus results with this kind of error.

Anyway, looking through <sys/proc.h>, I find

struct	proc {
  [...]
	int	p_uac;	/* unaligned access control flags */
  [...]
};
  [...]
/* p_uac codes */
#define UAC_NOPRINT    0x00000001	/* Don't report unaligned fixups */
#define UAC_NOFIX      0x00000002	/* Don't fix unaligned errors */
#define UAC_SIGBUS     0x00000004	/* Notify unaligned trap by SIGBUS */

The question is, how can I set the UAC_SIGBUS bit in p_uac?  If I could,
then I can ask dbx to catch SIGBUS, and it should be relatively easy to
track down the bug(s).  I RedTFM, but didn't find anything relevant.  Is
there an undocumented system call which permits one to twiddle the bits
in the the proc struct's p_uac?  As usual, TIA.

Mark Bartelt                                                416/978-5619
Canadian Institute for                             mark@cita.toronto.edu
Theoretical Astrophysics                           mark@cita.utoronto.ca

"Clothes not busy being worn are busy drying."  -  Dylan, on laundry day
          [ singing "It's all right, ma (I'm only bleaching)" ]


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

* Re: How can I cause unaligned access to generate SIGBUS under DEC OSF/1?
  1993-08-27 13:59 How can I cause unaligned access to generate SIGBUS under DEC OSF/1? Mark Bartelt
@ 1993-08-27 14:33 ` Matt Thomas
  1993-08-27 15:32 ` SUMMARY: " Mark Bartelt
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Thomas @ 1993-08-27 14:33 UTC (permalink / raw)



In article <CCF86q.M2s@helios.physics.utoronto.ca>, sysmark@helios.physics.utoronto.ca (Mark Bartelt) writes:
|>Someone in our group is trying to debug a rather ugly chunk of Fortran
|>code on our AXPs, and is getting a number of runtime "Unaligned access"
|>messages.  I know how to use the "uac" command to turn the message off,
|>but since I suspect that the existence of the unaligned access probably
|>means that the code is broken, I'd like to be able to trap them.

#include <sys/sysinfo.h>
#include <sys/proc.h>

    int nvpair[2];

    nvpair[0] = SSIN_UACPROC;
    nvpair[1] = UAC_SIGBUS;

    setsysinfo(SSI_NVPAIRS, (char *) nvpair, 1, NULL, 0);

-- 
Matt Thomas                            Internet:   thomas@lkg.dec.com
U*X Networking                         UUCP:       ...!decwrl!thomas
Digital Equipment Corporation          Disclaimer: This message reflects my own
Littleton, MA                                      warped views, etc.


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

* SUMMARY: How can I cause unaligned access to generate SIGBUS under DEC OSF/1?
  1993-08-27 13:59 How can I cause unaligned access to generate SIGBUS under DEC OSF/1? Mark Bartelt
  1993-08-27 14:33 ` Matt Thomas
@ 1993-08-27 15:32 ` Mark Bartelt
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Bartelt @ 1993-08-27 15:32 UTC (permalink / raw)


Well, thanks to all the people, already too numerous to mention, who pointed
me to the setsysinfo(2) manpage.  I even notice that setsysinfo(2) is listed
in the "RELATED INFORMATION" section of the uac(1) manpage.  Embarrassedly,

Mark Bartelt                                                     416/978-5619
Canadian Institute for                                  mark@cita.toronto.edu
Theoretical Astrophysics                                mark@cita.utoronto.ca

"Sheep not busy being shorn are busy frying"  -  Dylan, at a NZ lamb barbecue
             [ singing "It's all right, ma (I'm only bleating)" ]


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

end of thread, other threads:[~1993-08-27 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-08-27 13:59 How can I cause unaligned access to generate SIGBUS under DEC OSF/1? Mark Bartelt
1993-08-27 14:33 ` Matt Thomas
1993-08-27 15:32 ` SUMMARY: " Mark Bartelt

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