This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Alignment error
- From: "Thomas Joseph" <thomaskj at cdactvm dot in>
- To: <gdb at sourceware dot org>
- Date: Mon, 27 Sep 2010 15:34:12 +0530
- Subject: Alignment error
Hi,
This is regarding to the alignment error generated by GDB when compiled
in
same GCC with u-boot makefile.
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