[Top][All Lists]

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

[Libunwind-devel] Exception handling routines on x86

From: address@hidden
Subject: [Libunwind-devel] Exception handling routines on x86
Date: Sun, 21 Feb 2010 00:46:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20090915 Thunderbird/3.0b4


i've tested libunwind's exception handling routines under linux-x86 (compiled into libunwind via --enable-cxx-exceptions). Initially my test program segfaulted, so i've patched the code of libunwind a little bit. Two patches are attached.

The first patch addresses a difference between gcc and libunwind: the size of exception_class is different - libunwind uses a 32-bit value whereas gcc uses and expects a 64-bit value (which equals to 'GNUCC++\0' or 'GNUCC++\x01')

The second patch is just a quick'n'dirty fix to get the testing executable running correctly. The problem is, that gcc's personality function ( uses __builtin_eh_return_data_regno(0) (== 0) and __builtin_eh_return_data_regno(1) (== 2) to set data registers for exception handling with _Unwind_SetGR. It expects EAX and EDX to be set, respectively. But libunwind sets EAX and ECX. So, how should this problem be addressed cleanly? Should the registers be renumbered (via UNW_REG_* enums in libunwind-x86.h)? Or should _Unwind_SetGR and _Unwind_GetGR be patched to renumber the registers? Or do you have any other idea?

My test program can simply be compiled and executed by calling On my linux machine it fails with gcc's own exception handling routines, while libunwind's ones work great with these patches.


Attachment: libunwind-exception_class-64bit.patch
Description: Text document

Attachment: libunwind-setgr-workaround.patch
Description: Text document

Attachment: test-eh.c
Description: Text Data

Attachment: test-eh.cxx
Description: Text Data

Description: Bourne shell script

reply via email to

[Prev in Thread] Current Thread [Next in Thread]