Skip to content

Instantly share code, notes, and snippets.

@wolfiestyle
Created November 13, 2015 21:40
Show Gist options
  • Save wolfiestyle/f3320780313f8af8ccd0 to your computer and use it in GitHub Desktop.
Save wolfiestyle/f3320780313f8af8ccd0 to your computer and use it in GitHub Desktop.
gdb script to get bracktraces from Lua core dumps
set $p = L->ci
while ($p > L->base_ci )
if ( $p->func->value.gc->cl.c.isC == 1 )
printf "0x%x C FUNCTION ", $p
output $p->func->value.gc->cl.c.f
printf "\n"
else
if ($p->func.tt==6)
set $proto = $p->func->value.gc->cl.l.p
set $filename = (char*)(&($proto->source->tsv) + 1)
set $lineno = $proto->lineinfo[ $p->savedpc - $proto->code -1 ]
printf "0x%x LUA FUNCTION : %d %s\n", $p, $lineno, $filename
else
printf "0x%x LUA BASE\n", $p
end
end
set $p = $p - 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment