Last active
August 29, 2015 14:14
-
-
Save miura1729/5d25abb78b998aa974c7 to your computer and use it in GitHub Desktop.
mruby backtrace
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
define mbt | |
set $p = mrb->c->ci | |
while ($p > mrb->c->cibase) | |
if (($p->proc->flags & 128) != 0 ) | |
printf "0x%x C FUNCTION ", $p | |
output $p->proc->body.func | |
printf "\n" | |
else | |
set $irep = $p->proc->body.irep | |
set $filename = $irep->filename | |
set $lines = $irep->lines | |
if ($filename && $lines) | |
if ($p == mrb->c->ci) | |
set $lineno = $lines[pc - $irep->iseq] | |
else | |
set $lineno = $lines[($p + 1)->pc - $irep->iseq] | |
end | |
printf "0x%x MRUBY FUNCTION : %d %s\n", $p, $lineno, $filename | |
else | |
printf "0x%x MRUBY FUNCTION : \n", $p | |
end | |
end | |
set $p = $p - 1 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment