From fc08312ebf8cf01a53b4826acce0f1c3aedcdc53 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 12 Apr 2017 07:55:38 +0200 Subject: debug.traceback --- src/ldebug.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ldebug.js') diff --git a/src/ldebug.js b/src/ldebug.js index 5a5fc34..ce62abc 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -194,10 +194,13 @@ const auxgetinfo = function(L, what, ar, f, ci) { break; } case 'n': { - ar.namewhat = getfuncname(L, ci, ar.name); - if (ar.namewhat === null) { - ar.namewhat = []; + let r = getfuncname(L, ci); + if (r === null) { + ar.namewhat = null; ar.name = null; + } else { + ar.namewhat = r.funcname; + ar.name = r.name; } break; } @@ -395,7 +398,7 @@ const funcnamefromcode = function(L, ci) { let tm = 0; /* (initial value avoids warnings) */ let p = ci.func.p; /* calling function */ - let pc = ci.pcOff; /* calling instruction index */ + let pc = ci.pcOff - 1; /* calling instruction index */ let i = p.code[pc]; /* calling instruction */ if (ci.callstatus & lstate.CIST_HOOKED) { -- cgit v1.2.3-54-g00ecf