hpy icon indicating copy to clipboard operation
hpy copied to clipboard

Provide better diagnostics for the debug mode

Open steve-s opened this issue 3 years ago • 1 comments

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

(*) 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.

steve-s avatar Dec 02 '21 08:12 steve-s