blast007 / nls-game-engine

Automatically exported from code.google.com/p/nls-game-engine
0 stars 0 forks source link

Engine::Debug::GetPreviousCallstackLine does not return the expected line number #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Engine::Debug::GetPreviousCallstackLine() returns what appears to be the line 
number of the next executable line in the calling function, not the line number 
of the line in the calling function that called the current function.  This 
almost, but not quite, defeats the purpose of the 
Engine::Debug::GetPreviousCallstackLine(): to allow for easy debugging messages 
from inside AS functions.

Original issue reported on code.google.com by kf6...@gmail.com on 25 May 2012 at 3:17

GoogleCodeExporter commented 9 years ago
Is the line number maybe 0 based instead of 1 based?

Original comment by adam.madram on 13 Jul 2012 at 6:11

GoogleCodeExporter commented 9 years ago
It is worse than that.  Here's some examples:

321: some valid code.
322:
323: broken code # GetPreviousCallstackLine() returns 321.

321: some valid code.
322: broken code # GetPreviousCallstackLine() returns 321.

321: some valid code.
322: /*  Some huge
400: comment block */
401: broken code # GetPreviousCallstackLine() returns 321.

Original comment by kf6...@gmail.com on 13 Jul 2012 at 1:53

GoogleCodeExporter commented 9 years ago
It seems normal to me. It is getting the previous line number for the code that 
was on the call stack. The broken code would be GetCurrentCallstackLine as it 
is on the callstack still.

Original comment by adam.madram on 13 Jul 2012 at 2:12

GoogleCodeExporter commented 9 years ago
Odd, as of r63 (b6acf7869b33) "Upgraded Boost and added compilation flags..." 
it is now returning the NEXT line of execution.  I wonder if the API on the 
ASContext::GetLineNumber method changed?  That's unlikely as we've not changed 
AS versions since May 5 - well before I reported this bug.

Put up a post about it at 
http://www.gamedev.net/topic/628786-contextgetlinenumber-api-reversed/

Original comment by kf6...@gmail.com on 30 Jul 2012 at 4:45