Any libunwind experts n da house?
Iain Buclaw via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 23 15:14:50 PDT 2014
On 23 September 2014 22:20, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 9/23/14, 2:07 PM, David Nadlinger wrote:
>>
>> On Tuesday, 23 September 2014 at 20:29:22 UTC, Walter Bright wrote:
>>>
>>> On 9/23/2014 12:57 PM, Jacob Carlborg wrote:
>>>>
>>>> From the LLVM docs [1]:
>>>
>>>
>>> Thank you. This is helpful.
>>
>>
>> Yes, that's quite a nice list already.
>>
>> As far as the C++ implementation details go, I posted the most
>> interesting source files in the earlier discussion:
>> http://forum.dlang.org/thread/lutf3c$2usj$1@digitalmars.com (the GCC
>> ones can be found in the GCC release tarballs, the OS X Clang ones at
>> http://llvm.org/svn/llvm-project/libcxxabi/trunk/src/).
>>
>> David
>
>
> Speaking of which, what's the current story with gdc and ldc with regard to
> unwinding? Can they unwind properly when a C++ exception gets thrown? --
> Andrei
GDC lets foreign exceptions pass through just fine. The only time
when runtime terminates is when GDC has no choice *but* to handle a
foreign exception it doesn't know about.
By all means, you can have this kind of code:
---
D:
extern(C++) int Dfunction()
{
try {
return CXXfunction(2);
}
catch {
return 8;
}
}
---
C++:
int main() {
try {
return Dfunction();
}
catch (int error) {
return error;
}
}
int CXXfunction(int i)
{
throw int(16);
return i * 2;
}
And the runtime flow is:
Phase 1.
=> __gdc_personality_v0 // Found nothing, continue unwinding.
=> __gxx_personality_v0 // Found something, cache details and continue unwind
Phase 2.
=> __gdc_personality_v0 // Found nothing, continue unwinding.
=> __gxx_personality_v0 // Found something, finish unwinding.
And we land back in C++ main, return 16.
Iain.
More information about the Digitalmars-d
mailing list