Esempio n. 1
0
        public AssemblyLine[] Disassemble(int frameIndex, int firstLine, int count)
        {
            SelectFrame(frameIndex);
            if (disBuffers == null)
            {
                disBuffers = new DissassemblyBuffer[fcount];
            }

            DissassemblyBuffer buffer = disBuffers[frameIndex];

            if (buffer == null)
            {
                ResultData data = session.RunCommand("-stack-info-frame");
                long       addr = long.Parse(data.GetObject("frame").GetValue("addr").Substring(2), NumberStyles.HexNumber);
                buffer = new GdbDissassemblyBuffer(session, addr);
                disBuffers[frameIndex] = buffer;
            }

            return(buffer.GetLines(firstLine, firstLine + count - 1));
        }
Esempio n. 2
0
        public StackFrame[] GetStackFrames(int firstIndex, int lastIndex)
        {
            List <StackFrame> frames = new List <StackFrame>();

            if (firstIndex == 0 && firstFrame != null)
            {
                frames.Add(firstFrame);
                firstIndex++;
            }

            if (lastIndex >= fcount)
            {
                lastIndex = fcount - 1;
            }

            if (firstIndex > lastIndex)
            {
                return(frames.ToArray());
            }

            session.SelectThread(threadId);

            GdbCommandResult res = session.RunCommand("-stack-list-frames", firstIndex.ToString(), lastIndex.ToString());

            if (res.Status == CommandStatus.Done)
            {
                ResultData stack = res.GetObject("stack");
                for (int n = 0; n < stack.Count; n++)
                {
                    ResultData frd = stack.GetObject(n);
                    frames.Add(CreateFrame(frd.GetObject("frame")));
                }
            }

            return(frames.ToArray());
        }
Esempio n. 3
0
        protected override Backtrace OnGetThreadBacktrace(long processId, long threadId)
        {
            ResultData       data = SelectThread(threadId);
            GdbCommandResult res  = RunCommand("-stack-info-depth");
            int          fcount   = int.Parse(res.GetValue("depth"));
            GdbBacktrace bt       = new GdbBacktrace(this, threadId, fcount, data != null ? data.GetObject("frame") : null);

            return(new Backtrace(bt));
        }