hpy
hpy copied to clipboard
Provide better diagnostics for the debug mode
At this point, if HPy detects an issue in the debug mode, it prints a generic message and aborts the process(*).
It should provide more context to help with debugging of the issue, i.e., "diagnostics output":
- info about the underlying Python object to help to identify it, like inspect: type, length for lists, tuples, etc., or maybe just call
__repr__
? - stack trace of the location where the handle was allocated
- stack trace of the location where the issue was detected
- anything else?
Implementation:
- retaining the stack trace of the allocation can be expensive, so I suggest it can be configured, it will be off by default, but the diagnostics output will give instructions how to turn it on
- we need a way to get a stack trace
- roll out our own (simple) implementation, on MacOS and Linux based on
backtrace
, there seems to be some API for this on Windows too - use 3rd party library:
- roll out our own (simple) implementation, on MacOS and Linux based on
(*) In case of the mmap based raw data protection mechanism (#259), it just segfaults, which we should improve by registering a handler and then we can provide the same diagnostics there too.