I don't think so. A debugger does not run in the same process as the program being debugged. Also, you don't have any guarantee that you have not corrupted something important as the VM. If we have the debugger in the same process as the program being debugged, then the debugger could be corrupted by the error in the external C library.
Trying to do something like that could be very dangerous.
2. Languages have exception handling, so that errors like divide by zero
can be caught.�� Could our FFI calls be wrapped in similar mechanism?
cheers -ben
The short answer is that it cannot be done automatically, without losing a lot in portability
��
Exception handling implementations depends in the language, operating system and CPU architectude. The way that exceptions are implemented is a wild territory. For C++, you do not have a standard ABI. You cannot interface directly with C++ without losing portability.
For wrapping C++, you first have to write a C wrapper for the C++ library, and then you have to do a wrapper in Pharo to the C library.
In this C wrapper, you could something like catching all the exceptions and store them in some data structure that can be retrieved later. Then in the Pharo image you have to check for a pending exception in this data structure, and then transform wrapped exception into something more appropriate.
Greetings,
Ronie