Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Instead of preserving a backtrace in `mrb_state`, `mrb_exc_set` keeps packed backtrace in an exception object. `#backtrace` unpacks it to an array of strings.
- Loading branch information
Showing
8 changed files
with
91 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether this fix is "correct" per se, but I think
mrb_get_backtrace
is broken (so ismrb_keep_backtrace
, right?):mrb_get_backtrace
doesn't return any backtraces otherwise (supposedly 1 stack frame, where the filename is empty...)9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mrb_get_backtrace()
is an implementation function ofcaller()
so it's not a function to retrieve backtrace from an exception, but retrieve backtrace from call stack. Thus it's correct.9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matz cool (though I'm not really sure what the function does, but I guess that's the exact issue then).
I used to:
But
mrb_exc_backtrace
got yanked. So how am I to get to the backtrace now?Based on the diff above, I guess I could now:
But I don't think I should have access to
mrb_unpack_backtrace
... I must be missing the obvious, but how does one get to the backtrace now?I was thinking
mrb_get_backtrace
would provide this for me. But surprisingly, whileprints out the backtrace just fine, while
doesn't seem to return anything useful...
9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those functions work differently.
mrb_print_backtrace
prints the backtrace from the last exception (mrb->exc
). Butmrb_get_backtrace
retrieves the backtrace from the current call frames (no relation to exceptions).I think we should restore
mrb_exc_backtrace
.9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored.
9644ad5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thanks!