Dear Genodians,
I just stumbled across a not so obvious characteristic of the with_libc lambda. Not so obvious to me, at least. If I run following code snipped, it will result in a "Error: Uncaught exception of type 'Genode::Exception'":
``` try { Libc::with_libc([&] () { throw Genode::Exception(); }); } catch (...) { Genode::log("caught libc exception"); } ```
I didn't find any documentation regarding the with_libc lambda in combination with exceptions. Is this expected behavior? What would be the right pattern to forward the exception to a pure Genode environment e.g. across RPC boundaries? I could think of following pattern:
``` bool libc_exception_thrown = false; Libc::with_libc([&] () { try { throw Genode::Exception(); } catch (...) { Genode::log("caught libc exception"); libc_exception_thrown = true; } }); if (libc_exception_thrown) { throw My_rpc_exception(); } ```
However, it does not look like the most elegant solution...
Cheers, Sid