Adjust pc down by 1 when calculating error lines, pc is always the /next/ instruction

Mon, 22 Nov 2010 04:54:59 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 22 Nov 2010 04:54:59 +0000
changeset 125
39b6ba804009
parent 124
62354487e1ce
child 126
07ec490c7a6f

Adjust pc down by 1 when calculating error lines, pc is always the /next/ instruction

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Mon Nov 22 04:54:18 2010 +0000
+++ b/lvm.js	Mon Nov 22 04:54:59 2010 +0000
@@ -890,8 +890,8 @@
 		var currfunc = currframe.f;
 		var sourceName = (currfunc.sourceName||"=<unknown>").substr(1);
 		var line = "?";
-		if(currfunc.sourceLines && currfunc.sourceLines[currframe.pc])
-			line = currfunc.sourceLines[currframe.pc];
+		if(currfunc.sourceLines && currfunc.sourceLines[currframe.pc-1])
+			line = currfunc.sourceLines[currframe.pc-1];
 		sys.print("lvm.js: "+sourceName+":"+line+": ");
 	}
 	sys.puts(e);

mercurial