This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Alignment error


Hi,

This is regarding the alignment error generated by GDB.

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

        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
respectively.

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
exception.

Later, I put the above code snippet into my own main() and compiled at
the
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
differently
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.

Regards,
Thomas Joseph




______________________________________
Scanned and protected by Email scanner


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]