Skip to content

Instantly share code, notes, and snippets.

@mgruberman
Created February 8, 2010 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgruberman/298727 to your computer and use it in GitHub Desktop.
Save mgruberman/298727 to your computer and use it in GitHub Desktop.
define perl_backtrace_5_10_unthreaded
set $si = (struct stackinfo*)PL_curstackinfo
while $si
printf "struct stackinfo * 0x%x {\n", (int)$si
set $cx = (PERL_CONTEXT*)($si->si_cxstack)
printf " PERL_CONTEXT * 0x%x\n", (int)$cx
set $cxix = (int)($si->si_cxix)
printf " int cxix %d\n", $cxix
while $cxix >= 0
set $curcop = (COP*)($cx->cx_u->cx_blk->blku_oldcop)
set $hv = $curcop->cop_stash
if $hv
set $svook = 0x02000000 & $hv->sv_flags
set $hvmax = $hv->sv_any->xhv_max
set $hvarray = $hv->sv_u->svu_hash
set $hvaux = (struct xpvhv_aux*)($hvarray + $hvmax + 1)
set $xhv_name = $hvaux->xhv_name
printf " %s\n", (char*)($xhv_name->hek_key)
end
printf " opcode %s\n", PL_op_name[$curcop->op_type]
printf " line %d\n", $curcop->cop_line
printf "\n"
set $cx = $cx + 1
set $cxix = $cxix - 1
end
printf "}\n"
set $si = (struct stackinfo*)($si->si_prev)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment