It is currently Wed, 22 Mar 2023 07:24:06 GMT



 
Author Message
 Get GDB to stop at Unaligned access
Hi,

I'm trying to build an app under OSF 1.3 on an Alpha. Can
anyone tell me how to get gdb or dbx to stop at the C line
causing an 'Unaligned access' error message to be printed?

In case someone as seen my problem, let me describe it.
When I use gdb to stop at the pc contained in an unaligned
access message (via 'break *0x1a2b3c4d5'), it claims the error
comes from a line where I've got a link list and I'm trying
to set a pointer to NULL; like

head->next->next = (struct_type *) NULL;

I don't see why an assignment should cause this kind of error!
Any one seen this or know how I can investigate further?

Regards,
Chuck Packard                          cpack...@mathworks.com
The Mathworks, Inc.                    508.653.1415
-------------------------------------------------------------
If we had known 10 years ago today would be 10 years from now,
would we spend tomorrows yesterdays and make it last somehow.
                      - from "No Time to Kill" by Clint Black



 Wed, 01 May 1996 00:16:13 GMT   
 Get GDB to stop at Unaligned access

There might be two reasons:
        (a) either head or head->next are pointers to unaligned structures
        (b) head->next->next is a pointer to unaligned storage.
where "unaligned" means "not on 8-byte boundary" since we are talking
(8-byte) pointers here.

You can examine the instruction at which the access is unaligned (dbx:
$pc/i, gdb: x/i $pc); if it's a ldq (load quad), it's an unaligned
fetch.  A stq indicates an unaligned store (store quad).  That should
tell you which of the two cases above is the one you have.

--
John Kohl <j...@atria.com> or <jtk...@mit.edu>
working for but not representing:       Atria Software
---------
What are you pretending not to know?



 Wed, 01 May 1996 06:08:21 GMT   
 Get GDB to stop at Unaligned access

|> I'm trying to build an app under OSF 1.3 on an Alpha. Can
|> anyone tell me how to get gdb or dbx to stop at the C line
|> causing an 'Unaligned access' error message to be printed?
|>

using the pc in the unaligned access message, in dbx:
(dbx) 0xyyyyyyyy/i

where yyyyyyyy is the address of the pc in the message. This will tell
you the function and line where the unaligned access occured. To stop
at that point:

        stopi at 0xyyyyyyyy

|> In case someone as seen my problem, let me describe it.
|> When I use gdb to stop at the pc contained in an unaligned
|> access message (via 'break *0x1a2b3c4d5'), it claims the error
|> comes from a line where I've got a link list and I'm trying
|> to set a pointer to NULL; like
|>
|> head->next->next = (struct_type *) NULL;
|>

is one of your nexts an int ?

|> I don't see why an assignment should cause this kind of error!
|> Any one seen this or know how I can investigate further?
|

It only does if one of the "addresses" in not on a pointer boundry.
It is quite possible that head or head->next is not on a proper
boundry but is pointing to something that is not fatal.



 Mon, 06 May 1996 23:19:16 GMT   
 
   [ 3 post ] 

Similar Threads

1. Unaligned access (bus error) on Solaris on global variable

2. Signal handler for unaligned access: emulate and continue?

3. Signal handler for unaligned access: emulate and continue?

4. Fixing unaligned access Solaris 2.3

5. Wanted: Unaligned access exceptions

6. Help: Unaligned access?

7. unaligned access 3

8. unaligned access?!


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software