Hi,

I haven't used the raw mach API's yet, so can't help you here. I must say that this looks like a pretty evil API. I wonder why they didn't use a manually passed in callback function like sane APIs.

Ronald

On Dec 11, 2006, at 11:43 PM, Charlie Miller wrote:

Is it possible to monitor for exceptions using the Mac OS X
catch_exception_raise function inside python?  As you may know, after
some setup, this function gets called whenever an exception occurs.
I have a program which works great in C but when I wrap it in python
it fails.  This is due to the fact that it calls exc_server, which
uses _dyld_lookup_and_bind, to try to find the location of the
function catch_exception_raise.  When wrapped in python,
dyld_lookup_and_bind returns 0x2030 which is NOT the correct
address.  It then jumps there and tries executing which causes a BUS
ERROR.

In C at least, dyld_lookup_and_bind works if the
catch_exception_raise function is compiled into the binary or linked
dynamically at runtime via a shared library (dylib).  However, it
doesn't work if it is brought into the executable space via dlopen -
which presumably is how python does it.

How can I set it up so that I can monitor applications for exceptions
in a python script?  I could fork and exec a program with its own
address space, but that seems ridiculous.  I could recompile the
python interpreter and include catch_exception_raise, but that also
seems terrible.  Or is it impossible to wrap such a program in python
- which seems silly?

Any help is appreciated.  Thanks,

Charlie


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to