On Mon, Jan 10, 2011 at 11:31 PM, Andres Valloud < avalloud@smalltalk.comcastbiz.net> wrote:
Indeed, quite right. I happened to add a flag to turn off the heartbeat
so I could debug the crash Matthew was seeing in starting up Squeak4.2-10856-beta.image (since single-stepping through machine code always gets interrupted by the heartbeat, it being an interval timer) and lo and behold the bug went away. This is very worrying because it appears to imply that there's a serious bug in the linux kernel/gcc since delivering a software interrupt shouldn't corrupt registers, but it clearly does. I'll try and pass it by someone who's an expert in this area.
Or the signal handler functions do not comply with the relevant specifications, e.g.: signal handlers that do not preserve the value of errno, signal handlers that use a function not in the list of approved safe functions you can call from a signal handler as per the Single Unix Specification, etc...
Good point. The signal handler essentially calls gettimeofday (not on the approved list but time is) and sets a couple of variables (current 64-bit microsecond time, stackLimit). But it does not preserve errno. I don't want to avoid calling gettimeofday and can see no harm in it; it's equivalent internally to time providing it doesn't use its TIMEZONE arg (which it doesn't). But the signal handler /doesn't/ preserve errno and doing so is a very good idea and easy to do. Thanks.
Andres.
vm-dev@lists.squeakfoundation.org