Mono.Debugger.StackFrame.UnwindStack C# (CSharp) Method

UnwindStack() private method

private UnwindStack ( TargetMemoryAccess memory ) : StackFrame
memory TargetMemoryAccess
return StackFrame
        internal StackFrame UnwindStack(TargetMemoryAccess memory)
        {
            if (parent_frame != null)
                return parent_frame;

            StackFrame new_frame = null;
            if (method != null) {
                try {
                    new_frame = method.UnwindStack (this, memory);
                } catch (TargetException) {
                }

                if (new_frame != null)
                    return new_frame;
            }

            foreach (Module module in thread.Process.Modules) {
                try {
                    new_frame = module.UnwindStack (this, memory);
                } catch {
                    continue;
                }
                if (new_frame != null)
                    return new_frame;
            }

            return thread.Architecture.UnwindStack (this, memory, null, 0);
        }

Usage Example

Example #1
0
        internal bool TryUnwind(ThreadServant thread, TargetMemoryAccess memory,
                                Mode mode, TargetAddress until)
        {
            StackFrame new_frame = null;

            try {
                new_frame = last_frame.UnwindStack(memory);
            } catch (TargetException) {
            }

            if (!TryCallback(thread, memory, ref new_frame, true))
            {
                if ((new_frame == null) || !IsFrameOkForMode(new_frame, mode))
                {
                    if (!tried_lmf)
                    {
                        tried_lmf = true;
                        if (thread.LMFAddress.IsNull)
                        {
                            return(false);
                        }
                        lmf_address = memory.ReadAddress(thread.LMFAddress);
                    }

                    if (!lmf_address.IsNull)
                    {
                        new_frame = TryLMF(thread, memory);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            if (new_frame == null)
            {
                return(false);
            }

            // Sanity check; don't loop.
            if (new_frame.StackPointer <= last_frame.StackPointer)
            {
                return(false);
            }

            if (!until.IsNull && (new_frame.StackPointer >= until))
            {
                return(false);
            }

            AddFrame(new_frame);
            return(true);
        }