Commit 6d6ffd9d
6d6ffd9dc190Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · +2 added · ~1 modified
Description
codegen: wire Exception#backtrace to the live capture substrate
#1300 added the backtrace runtime (sp_backtrace_captured over the
sp_bt_buf captured at each raise), but the Exception#backtrace dispatch
was left hardcoded to an empty array ("spinel does not capture stack
frames") -- so the merged feature returned [] in every build. With the
substrate now live (sp_bt_enabled set in --debug main, instance/class
methods external under -rdynamic; #1335), dispatch backtrace to
sp_backtrace_captured() instead.
e.backtrace now yields the frames captured at the raise, method-
granularity (no :lineno: yet -- the shared follow-up), matching CRuby's
frame structure in --debug; release builds stay empty, same as caller.
Refs #1300
Details
- Commit
- 6d6ffd9dc190
- Parent
- b84f2ca6ba06
src/codegen_call.cmodifiedView file
return; } if (!strcmp(name, "backtrace")) { /* spinel does not capture stack frames: an empty array */ buf_puts(b, "((void)("); emit_expr(c, recv, b); buf_puts(b, "), sp_StrArray_new())"); /* the stack captured at the most recent raise (sp_bt_buf); the substrate is live in --debug builds and empty in release, same as Kernel#caller. */ buf_puts(b, "((void)("); emit_expr(c, recv, b); buf_puts(b, "), sp_backtrace_captured())"); return; } if (argc == 1 && (!strcmp(name, "is_a?") || !strcmp(name, "kind_of?") || !strcmp(name, "instance_of?"))) {test/exception_backtrace_wired.rbaddedView file
Loading diff…
test/exception_backtrace_wired.rb.expectedaddedView file
Loading diff…