Advertisement

Debugger and var in scope

Started by May 06, 2022 08:35 AM
15 comments, last by Alexander Orefkov 2 years, 6 months ago

Thanks. I've been working on this for almost 20 years now (first started in Feb 2003), and I have no plans to stop anytime soon ?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Hi, I was debug DetermineLiveObjects and found problem.

When search variable in inner loop for current ObjInfo for asOBJ_INIT or asOBJ_UNINIT it used stack positon to identify var. But in my case, there are several variables at the same stack offset and therefore the search finds the wrong variable.

Variables:  
-001: const string& uri
008: string fullPath
027: string source
028: (heap) string[]@[] tags
029: uint firstLine
037: string uName
046: string dName
054: string engine
055: (heap) any[]@[] connectedAddins
056: bool attachDebuger
057: uint it
065: string tag
074: string val
077: (heap) string[]@ tail
078: (heap) Addin@ a
080: (heap) IUnknown@ obj
074: string fileExt
109: NoCaseMapIterator<string> fnd
110: (heap) AddinScript ads
111: (heap) ActiveScript@ script
057: uint k
114: uint km
115: (heap) any[]@ a
080: (heap) IUnknown@ obj
065: string name
116: bool global
016: string  
017: int  
018: (heap) const string&  
019: (heap) Addin@  
038: (heap) const RegExp@  
066: (heap) string[]@  
075: int  
076: int  
079: (heap) AddinMgr@  
081: (heap) IUnknown@  
082: (heap) any[]  
083: (heap) <any[]>  
084: (heap) any@  
085: int  
086: (heap) any[]@  
094: string  
095: (heap) RegExpResult@  
102: NoCaseMapIterator<string>  
112: (heap) ActiveScript@  
113: (heap) ScriptSite@  
117: (heap) IUnknown@  
000: ScriptLoader this
...
 1049 117 *    PSF      v65
1050 118 *    CALLSYS  225           (string::string())
- 206,13 -
              ObjInfo  v65, 1
...
 1097 117 *    PSF      v94
1098 118 *    CALLSYS  224           (string::~string())
- 208,13 -
              ObjInfo  v94, 0

Script suspended at instruction 1115. Then it it start tracks ObjInfo's in backward order from last from suspended address. When it process ObjInfo at 1050 for variable string name (pos 24 in variables list) - it found variable string tag (pos 11 in variables list), and variable 24 not counted as initialized or uninitialized.

Advertisement

Perhaps it can be reproduced like this

for (...) {
	SomeType var;
	...
}
...
for (...) {
	SomeType anotherVar;
	...
}

That makes sense.

I'll do some more investigation with this new information. Thanks.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed this now in revision 2777.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks a lot. Now it works correctly!

This topic is closed to new replies.

Advertisement