lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sun, Dec 14, 2008 at 4:18 PM, Bogdan Marinescu <> wrote:

I'm going to put a bet on a compiled code issue with the
compiler optimizing a copy or move incorrectly. Probably
in the memcpy() or memmove() operation.
(*many printfs later...*)

Well I'll be. You are officially my new mentor :) You are right, "memcpy" is broken in their library. Probably they try to do memcpy on words instead of bytes to optimize speed, and they ignore alignment. So the memcpy in newlstr (lstring.c) triggered an aligment exception (I don't have any way to actually verify this, but now it's my time to bet that this is the problem, since one of its arguments is not aligned).
Thank you all for your help, and Ralph, very good call!

In your exception table put printf()s in all the exceptions you think might be triggered.  This is what I did with the STM32 port when I was having memcpy/memmove issues due to another reason (the linker script was pointing ram to uninitialized external memory).

It at least told me when I was getting the exception and which exception it was.

Actually I used one of the lower level uart write routines as I could not even rely on printf at the time.