Unaligned data can slow program execution. You should determine the cause of the unaligned data, fix the source code (if necessary), and recompile and relink the program.
If your program encounters unaligned data at run time, to make it easier to debug the program, you should recompile and relink with the -fpen option to control the handling of exceptions.
To determine the cause of the unaligned data when using idb, follow these steps:
Run the debugger, specifying the program with the unaligned data (shown as testprog in the following example): idb testprog
Before you run the program, enter the catch
(idb) catch unaligned
Unaligned access pid=28413 <testprog> va=140000154 pc=3ff80805d60
Thread received signal BUS
stopped at [oops:13 0x120001834]
Enter a list
command to display the source code at line 12:
(idb) list 12
12 i4 = 1
> 13 end
Enter the where
command to find the location of the unaligned access:
Use any other appropriate debugger commands needed to isolate the cause of the unaligned data, such as up, list, and down.
Repeat these steps for other areas where unaligned data is reported. Use the rerun command to run the program again instead of exiting the debugger and running it from the shell prompt.
After fixing the causes of the unaligned data, compile and link the program again.