tech-userlevel archive

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

Re: Translate signal to C++ exception



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 09.04.2016 03:48, Christos Zoulas wrote:
> In article <57085C5E.9080506%gmx.com@localhost>, Kamil Rytarowski
> <n54%gmx.com@localhost> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> I'm stuck with .Net porting to NetBSD, with the need to throw
>> C++ exceptions from a signal handler (SIGSEGV).
>> 
>> I have found similar use-case in gcc/libjava and freebsd (dummy?)
>> code there. It was abstracted into a segvcatch library
>> (wip/segvcatch).
>> 
>> I'm failing to make it work on NetBSD (release 7.0). This blocks
>> me from porting dotnet stack.
>> 
>> Thank you in advance,
>> 
>> I'm aware of the danger of this approach, for now I need to make
>> it just work. I cannot rewrite the dotnet code to use atomics
>> etc.
> 
> The java case if very limited and specialized; it won't even work 
> properly in all cases.
> 
> https://stackoverflow.com/questions/12410992/c-is-using-segvcatch-safe
>
>  The only right way to do this is to do all the unwinding after you
>  sigreturn()/setcontext() from the signal handler (since calling
> free() is illegal from a signal handler).
> 
> christos
> 

How to do proper unwinding?

I was trying to disable custom signal stack with sigaltstack(2) but
always I got backtrace(3) without history beyond signal trampoline.

I don't know how to go beyond the trampoline.

Thank you,
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXCGThAAoJEEuzCOmwLnZsICQP/2jqokHD0GicQKVeQCAEZ206
jcW7SX47kuUNvYH+RIuUF6GZJNwuY10djHtk9cgUPSQC0f1E2n8lNmlZPelljMl1
VL2BbWLlRRUrFksdPN3uvRXpHHgYbTDfheX6C27d3Y9xRk64qduxz+eqrr1tRyC7
585uYV76SgfVH5k+B8RIubZuFb2aY+gEqD0h+gwjwxVmEdgf0rkBuT/v7huhKhgg
XNtMU+S73jTW5SiGl7BRomIZYYElGKQVa230M3vcyizEmJHQ388jmDSYeRr76MEC
OOfKT8ndxb8q/xMGS1Oifxh72tRS+Qiw5InXpQ89VKdvh0Q1acuK3subPfKC3Ykb
9BPl0SS/S3vePJV53nuKit5Bpu31CGBJLwzrCcxCs3KffaqKCK5ZKQh1qT5kNcIL
ssOxbUEeyHgfRsPxVKJ+dEkpgX15wLp35Ja5AAEu/nATx4sAf2ftYKy6LU/QBxJ4
jLyc0cmkuiY1hafZDJUod2z+fX1uwdK1d3tltTDBhQUs7JpOCYigQG6K/rRE52A/
BM98t/sYfngs3tUr5ROni1TGU8APU+aaIUBuTihmtKxF577XEK/ftjRAiZYGIyIa
iG5edRJ+G/a8rYupYlkXoyx0/63270Ib4PMovznpgpFLn2P9GPOkYc+yU31LcrYB
pS1wwHzM5mytuaBplBed
=UdkN
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index