chibi-scheme icon indicating copy to clipboard operation
chibi-scheme copied to clipboard

Source location information in opcodes vs procedures

Open dpapavas opened this issue 2 years ago • 2 comments

I notice that when exporting a C function with the sexp_define_foreign[_opt] facility, errors generated in that C function don't have a complete stack (meaning that the actual location of the call is not reported in the trace). If, on the other hand, I use the recently introduced sexp_define_foreign_proc to export the function, the stack trace is complete (or at least the call location is reported).

It is not a big deal to circumvent the problem locally (by using the *_proc variants), but I thought I'd report it, in case it is something that should (and can) be fixed.

dpapavas avatar Jun 05 '22 19:06 dpapavas

The difference is the _proc variants define a procedure that calls out to the opcode, so you're getting an extra level of indirection. The source location is coming from there.

ashinn avatar Aug 27 '22 15:08 ashinn

I assumed something like that. I have since simply changed all my exprots to using the _proc variants, so this doesn't affect me personally any more, but since the non-_proc variants are the officially documented way of exporting C functions to scheme, and since basic debugging information like source locations is important, let me know if you think that it can (and should) be added to the plain variants and if I can be of help.

dpapavas avatar Aug 29 '22 17:08 dpapavas