This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: segfault using _Unwind_ForcedUnwind()
Oliver Kowalke <oliver.kowalke@gmx.de> writes:
> Am 30.03.2012 17:08, schrieb Ian Lance Taylor:
>> "Oliver Kowalke"<oliver.kowalke@gmx.de> writes:
>>
>>> I get a segfault with following app - could you verify this?
>> This program works fine for me (gcc 4.4.3, glibc 2.11.1, Ubuntu Lucid)
>> in 64-bit mode. But now I see that you are using 32-bit mode. I can
>> confirm that the program crashes for me in that mode.
>>
>> Looking at the 32-bit implementation of makecontext in glibc, I can see
>> that the problem is that it doesn't set up correct unwind information
>> for the parameters pushed on the stack. The effect is that the first
>> parameter on the stack appears to be a PC value. I think this is a bug
>> in glibc. It should be possible to arrange for unwind information which
>> skips %ebx words on the stack.
>>
>> Ian
>>
>
> I think the test app is not correct - on ppc32/linux it never returns.
Any application that tries to walk up the stack to the end is
unfortunately going to be tricky and non-portable. If you want a
portable program you should always have some way to stop the stack
unwind yourself. That is unfortunate but true.
> Could you give me some hint how the stack unwind information is
> usally writen on the stack/else where (some architectures do not save
> the return address on the stack).
> I believe the code is somewhere in the gcc sources - unfortunately I
> don't know where (for what to grep for?)!
http://www.airs.com/blog/archives/460
Ian