Turning a SIGSEGV into a regular function call under Linux, allowing throw

Vladimir Panteleev vladimir at thecybershadow.net
Wed Mar 14 10:01:07 PDT 2012


On Wednesday, 14 March 2012 at 16:39:29 UTC, deadalnix wrote:
> Le 14/03/2012 17:34, Vladimir Panteleev a écrit :
>> On Wednesday, 14 March 2012 at 07:35:50 UTC, FeepingCreature 
>> wrote:
>>> Sweet. Yeah, I think you need to use naked and reconstruct the
>>> stackframe. Not sure how it'd look; I'm not familiar with the 
>>> x86_64 ABI.
>>
>> I think it might be safe to just reconstruct the stack frame 
>> in the
>> signal handler, and set gregs[REG_EIP] to &_d_throw directly. 
>> It should
>> also use a pre-allocated exception object (like how it's done 
>> with
>> OutofMemoryError and InvalidMemoryOperationError), in case 
>> there's data
>> corruption in the GC.
>
> Especially if the signal is sent because of stack overflow !

Not sure if sarcasm..?

In case of a stack overflow, you can't call _d_throwc (or use the
"throw" statement) anyway.


More information about the Digitalmars-d mailing list