- To: Andrew Haley <aph@xxxxxxxxxx>
- Subject: Re: segfault using _Unwind_ForcedUnwind()
- From: Ian Lance Taylor <iant@xxxxxxxxxx>
- Date: Mon, 02 Apr 2012 22:19:58 -0700
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <4F785143.7000302@redhat.com> (Andrew Haley's message of "Sun, 01 Apr 2012 13:59:47 +0100")
- User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Andrew Haley <aph@xxxxxxxxxx> writes:
> On 03/30/2012 08:26 PM, Ian Lance Taylor wrote:
>> Oliver Kowalke <oliver.kowalke@xxxxxx> writes:
>>
>>> Am 30.03.2012 17:08, schrieb Ian Lance Taylor:
>>>> "Oliver Kowalke"<oliver.kowalke@xxxxxx> 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.
>>>
>>> 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.
>
> I'm not at all happy about that. Any system that supports backtrace()
> should be able to get this right. I've had to fix more than one
> system to make unwinding work right; if it doesn't, that can (and IMO
> should) be treated as a bug.
I suppose I can't argue with that.
As seen in my message quoted above, I think there is a bug in the 32-bit
x86 implementation of makecontext in glibc.
I have not looked into the PPC32 case.
Ian
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]