Suggestion - stack traces
dmarcuse opened this issue · 5 comments
It would be helpful to have stack traces as a feature, either built into the shell or as a standalone program. This can be done without the debug
API using xpcall
and some magic, like so:
It would be easy to add an existing program to the ROM, or add it as a shell feature that can be toggled with the settings
API. What do you guys think? I can whip up a PR, I already have the code written.
If Cobalt (#163) gets merged, it should be safe to expose the entire debug
library without issue. However, if not, it shouldn't be too hard to expose a limited subset of the library (traceback, some of getinfo).
I'd love to have stack traces in CC. Debugging is so much easier when you can see where the problem actually is.
[REDACTED] exposes debug.traceback()
and debug.getinfo()
, but hides the rest of debug
. I think that could be easily implemented by exposing debug
from Java, then in bios.lua
, doing:
_G.debug = {traceback = debug.traceback, getinfo = debug.getinfo}
I've done similar things in the various kernels (yes, plural) I've written in various Lua environments.
@alexbuzzbee if I remember correctly there were issues with LuaJ and the debug API, which is why it's not available in CC, but the Cobalt PR would fix that. (#163)