Alignment error

Thomas Joseph
Mon Sep 27 10:11:00 GMT 2010


This is regarding the alignment error generated by GDB.

I wrote a small code consisting of following statements for the ARM

        int* pInt   = (int*)0x10002004;  //word-aligned
        char* pChar = (char* )0x10003005;  //non-word-aligned

        *pInt = 0x34;
        *pChar = 'A';

The assembly mnemonics for the above two statements are STR and STRB

This I made part of the u-boot and build successfully for the smdk2400
platform. But when I debugged with GDB, *pChar = 'A' throwed an

Later, I put the above code snippet into my own main() and compiled at
command prompt without any makefile. This time also STR and STRB
respectively were generated. But it worked without any exception in the
same gdb.

So, the same source code and also the same ASM mnemonic works
with the code generation commands(i.e., gcc).

In this regard, I am searching for the gcc command line argument present
in the u-boot makefile which throws exception in GDB for accessing
non-word-aligned address that corresponds to char*.

Kindly give me useful tips.

Thomas Joseph

Scanned and protected by Email scanner

More information about the Gdb mailing list