From deeb8196c4d4085f3cc5a3389b568de7da739190 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 28 Jun 2011 23:23:34 +0200 Subject: Reorganize trace linking and track link types. --- lib/dump.lua | 14 ++++++++------ lib/v.lua | 17 +++++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/dump.lua b/lib/dump.lua index 5f32eb80..6ada21bc 100644 --- a/lib/dump.lua +++ b/lib/dump.lua @@ -504,13 +504,15 @@ local function dump_trace(what, tr, func, pc, otr, oex) if what == "abort" then out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n") else - local link = traceinfo(tr).link - if link == tr then - link = "loop" - elseif link == 0 then - link = "interpreter" + local info = traceinfo(tr) + local link, ltype = info.link, info.linktype + if link == tr or link == 0 then + out:write(" -> ", ltype, "\n") + elseif ltype == "root" then + out:write(" -> ", link, "\n") + else + out:write(" -> ", link, " ", ltype, "\n") end - out:write(" -> ", link, "\n") end if dumpmode.H then out:write("\n\n") else out:write("\n") end else diff --git a/lib/v.lua b/lib/v.lua index bf61f125..d2a0c235 100644 --- a/lib/v.lua +++ b/lib/v.lua @@ -22,7 +22,7 @@ -- -- The output from the first example should look like this: -- --- [TRACE 1 (command line):1] +-- [TRACE 1 (command line):1 loop] -- [TRACE 2 (1/3) (command line):1 -> 1] -- -- The first number in each line is the internal trace number. Next are @@ -111,15 +111,20 @@ local function dump_trace(what, tr, func, pc, otr, oex) startex, startloc, fmterr(otr, oex))) end elseif what == "stop" then - local link = traceinfo(tr).link - if link == 0 then + local info = traceinfo(tr) + local link, ltype = info.link, info.linktype + if ltype == "interpreter" then out:write(format("[TRACE %3s %s%s -- fallback to interpreter]\n", tr, startex, startloc)) - elseif link == tr then - out:write(format("[TRACE %3s %s%s]\n", tr, startex, startloc)) - else + elseif link == tr or link == 0 then + out:write(format("[TRACE %3s %s%s %s]\n", + tr, startex, startloc, ltype)) + elseif ltype == "root" then out:write(format("[TRACE %3s %s%s -> %d]\n", tr, startex, startloc, link)) + else + out:write(format("[TRACE %3s %s%s -> %d %s]\n", + tr, startex, startloc, link, ltype)) end else out:write(format("[TRACE %s]\n", what)) -- cgit v1.2.3-55-g6feb