Esempio n. 1
0
        // Improves the function names of the managed frames.
        public void AddManagedInfo(int threadNum, ManagedStackInfo managedStack)
        {
            List <FrameInfo> stack = Threads[threadNum].stack;

            foreach (ManagedStackFrameInfo managedFrame in managedStack.frames)
            {
                foreach (FrameInfo frame in stack)
                {
                    if (frame.inline)
                    {
                        continue;
                    }
                    if ((Program.is32bitDump && Utils.SameStrAddress(managedFrame.instructPtr, frame.callSite)) ||
                        (!Program.is32bitDump && managedFrame.childSP == frame.childSP))
                    {
                        if (!managedFrame.callSite.Contains("!")) // If the managed frame does not contain a module name, add a default one
                        {
                            frame.callSite = "(managed)!" + managedFrame.callSite;
                        }
                        else
                        {
                            frame.callSite = managedFrame.callSite;
                        }
                        ParseCallSite(frame);
                    }
                }
            }
        }
Esempio n. 2
0
        // Improves the function names of the managed frames.
        public void AddManagedInfo(int threadNum, ManagedStackInfo managedStack)
        {
            List <FrameInfo> stack = Threads[threadNum].stack;

            foreach (ManagedStackFrameInfo managedFrame in managedStack.frames)
            {
                foreach (FrameInfo frame in stack)
                {
                    if (frame.inline)
                    {
                        continue;
                    }
                    if ((Program.is32bitDump && Utils.SameStrAddress(managedFrame.instructPtr, frame.callSite)) ||
                        (!Program.is32bitDump && managedFrame.childSP == frame.childSP))
                    {
                        frame.callSite = string.Format("(managed)!{0}", managedFrame.callSite);
                        ParseCallSite(frame);
                    }
                }
            }
        }
Esempio n. 3
0
        public override void Parse()
        {
            int              idx = 0;
            string           line;
            string           thread_id;
            int              thread_num;
            ManagedStackInfo stack = null;

            Stacks = new List <ManagedStackInfo>();
            Debug.Assert(lines.Count > 0);

            while (idx < lines.Count)
            {
                line    = lines[idx++];
                pattern = @"OS Thread Id: (?<thread_id>\w+)\s\((?<thread_num>\w+)\)";
                matches = Regex.Matches(line, pattern);
                if (matches.Count == 1)
                {
                    thread_id  = matches[0].Groups["thread_id"].Value;
                    thread_num = Convert.ToInt32(matches[0].Groups["thread_num"].Value);
                    stack      = null;

                    while (idx < lines.Count)
                    {
                        line = lines[idx++];
                        if (line.Contains("Child SP"))
                        {
                            continue;
                        }
                        if (line.Contains("GetFrameContext failed") || line.Contains("Unable to walk the managed stack"))
                        {
                            break;
                        }
                        if (line.Contains("OS Thread Id"))
                        {
                            idx--;
                            break;
                        }
                        if (line.Contains("InlinedCallFrame:"))
                        {
                            continue;
                        }

                        pattern = @"(?<child_SP>[\w]{8,16})\s(?<ip>[\w]{8,16})\s(?<call_site>.+)";
                        matches = Regex.Matches(line, pattern);

                        if (matches.Count == 1)
                        {
                            if (stack == null)
                            {
                                stack           = new ManagedStackInfo();
                                stack.threadId  = thread_id;
                                stack.threadNum = thread_num;
                                stack.frames    = new List <ManagedStackFrameInfo>();
                                Stacks.Add(stack);
                            }

                            ManagedStackFrameInfo manStackFrame = new ManagedStackFrameInfo();
                            manStackFrame.childSP     = matches[0].Groups["child_SP"].Value;
                            manStackFrame.instructPtr = matches[0].Groups["ip"].Value;
                            manStackFrame.callSite    = matches[0].Groups["call_site"].Value;

                            while (manStackFrame.callSite.Contains("*** ") && idx < lines.Count)
                            {
                                manStackFrame.callSite = lines[idx++];
                            }

                            stack.frames.Add(manStackFrame);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
        }