]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Add recursive dump option to jit.bc.dump().
authorMike Pall <mike>
Sun, 12 Jun 2011 21:51:13 +0000 (23:51 +0200)
committerMike Pall <mike>
Sun, 12 Jun 2011 21:51:13 +0000 (23:51 +0200)
lib/bc.lua
src/lib_jit.c

index 366617c8bd2ce92b464e151a052e5b55bc7e7d58..f4ee8e8ab35eb40689cf1b9f299e02e5c575ab30 100644 (file)
@@ -125,9 +125,16 @@ local function bctargets(func)
 end
 
 -- Dump bytecode instructions of a function.
-local function bcdump(func, out)
+local function bcdump(func, out, all)
   if not out then out = stdout end
   local fi = funcinfo(func)
+  if all and fi.children then
+    for n=-1,-1000000000,-1 do
+      local k = funck(func, n)
+      if not k then break end
+      if type(k) == "proto" then bcdump(k, out, true) end
+    end
+  end
   out:write(format("-- BYTECODE -- %s-%d\n", fi.loc, fi.lastlinedefined))
   local target = bctargets(func)
   for pc=1,1000000000 do
index 31b27ccbf223ed796176b88429c0adafbf1e7f68..66b3856aee37065e2009010e4d74bae124b56b4e 100644 (file)
@@ -193,6 +193,8 @@ LJLIB_CF(jit_util_funcinfo)
       setintfield(L, t, "currentline", lj_debug_line(pt, pc));
     lua_pushboolean(L, (pt->flags & PROTO_VARARG));
     lua_setfield(L, -2, "isvararg");
+    lua_pushboolean(L, (pt->flags & PROTO_CHILD));
+    lua_setfield(L, -2, "children");
     setstrV(L, L->top++, proto_chunkname(pt));
     lua_setfield(L, -2, "source");
     lj_debug_pushloc(L, pt, pc);