Comment 10 for bug 721531

Revision history for this message
Andrew Stubbs (ams-codesourcery) wrote :

@Steve: if you want GDB to give the true function address use '*main' - 'main' will give the first address after the prologue (at least when setting breakpoints, it does).

@Michael: I think casting pointers from one pointer type to another (type punning) is deeply dodgy due to strict-aliasing rules, but I don't think converting them to integers is a problem (provided they are the same width).

The bug here appears to be that GCC assumes that function pointer are always aligned, but fails to realise that thumb function pointers are always aligned+1, so to speak. I don't think it will be too hard to fix it.

(Of course, fixing GCC so it's consistent probably won't help mono - that'll still need a fix. In my experience, this concept of off-by-one pointers breaks many, many things in 'interesting' ways.)