Author Topic: Troubleshooting Segmentation Faults  (Read 6140 times)

flyvholm

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • http://
Troubleshooting Segmentation Faults
« Reply #15 on: November 03, 2006, 12:39:19 am »
x86 and ARM were designed for different purposes; one is not more right than the other. But it just happens that most of the applications we're compiling for the Z was written and tested on x86. Then if it crashes on the Z, we need to find out why so we can fix it.

As I understand it:
1) When legit x86 code is ported to an ARM device and crashes, unaligned access is likely the issue.
2) Compilers usually align things in memory. Packing code is telling the compiler not to do this, so if the x86 code you are trying to port includes packing, this could well be a reason for unaligned access. Removing the packing from the code could cure the problem.

The reason I want to point this out is that packing the code has appeared as a solution to eliminating unaligned access rather than a source of unaligned access. At least both me and Merli have been adding pack statements to our code in the hope of getting rid of unaligned access. Maybe I misunderstood you, but when you posted code showing how to pack a structure, I took it as a suggestion for something to try to solve my problem. But actually it was a #pragma pack statement in the code that was the whole problem.

Anyway, the code is now fixed and working as intended, so I'm happy.  
SL-C1000, pdaXrom 1.1.0beta1
Ubuntu 6.06 (Dapper) on Compaq R3000Z