Example #1
0
        public static SimpleStackTraceEntry GetStackTraceEntry(uint depth, uint ebp, uint eip)
        {
            var entry = new SimpleStackTraceEntry();

            uint address;

            if (depth == 0 && eip != 0)
            {
                address = eip;
            }
            else
            {
                if (ebp == 0)
                {
                    ebp = Native.GetEBP();
                }

                if (eip != 0)
                {
                    depth--;
                }

                //else
                //	depth += 3;

                ebp = GetStackFrame(depth, ebp);

                address = GetReturnAddressFromStackFrame(ebp);
            }

            var methodDef = GetMethodDefinition(address);

            if (methodDef == null)
            {
                return(entry);
            }

            entry.MethodDefinition = methodDef;
            entry.Offset           = address - (uint)(methodDef->Method);

            return(entry);
        }
Example #2
0
        public static SimpleStackTraceEntry GetStackTraceEntry(uint depth, uint ebp, uint eip)
        {
            var entry = new SimpleStackTraceEntry();

            uint address;
            if (depth == 0 && eip != 0)
                address = eip;
            else
            {
                if (ebp == 0)
                    ebp = Native.GetEBP();

                if (eip != 0)
                    depth--;

                //else
                //	depth += 3;

                ebp = GetStackFrame(depth, ebp);

                address = GetReturnAddressFromStackFrame(ebp);
            }

            var methodDef = GetMethodDefinition(address);

            if (methodDef == null)
                return entry;

            entry.MethodDefinition = methodDef;
            entry.Offset = address - (uint)(methodDef->Method);

            return entry;
        }