Wiki
Show
Ignore:
Timestamp:
03/10/10 10:22:59 (2 years ago)
Author:
Chuck.Esterbrook
Message:

Make stackoverflow handling more robust. Stack overflow handling is in effect when -detailed-stack-trace is on.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Source/Cobra.Lang/Native.cs

    r2294 r2309  
    775775    static public int _maxStackFrames = 500; 
    776776    static public int _numLastMaxStackFrames = 20; 
     777    static private bool _inStackOverflow = false; 
    777778 
    778779    static public void PushFrame(string declClassName, string methodName, string fileName, int lineNum, params object[] args) { 
     780        if (_inStackOverflow) return; 
    779781        _detailedStack.Push(_curFrame = new CobraFrame(declClassName, methodName, fileName, lineNum, args)); 
    780782        int max = _maxStackFrames; 
    781783        if (max > 0 && _detailedStack.Count > max) { 
     784            _inStackOverflow = true; 
    782785            int num = _numLastMaxStackFrames; 
    783             if (num < 2) 
    784                 num = 2; 
     786            if (num < 2) num = 2; 
    785787            Console.WriteLine("Cobra detected stack overflow:"); 
    786788            Console.WriteLine("  Last {0} frames:", num);