Esempio n. 1
0
        void TraceOneFrame(object dummy)
        {
            DebugMemoryStream mem = mConnection.NewMemoryStream();
            BinaryReader      rdr = new BinaryReader(mem);

            try
            {
                mem.Seek((long)mChaseEbpValue, SeekOrigin.Begin);
                ulong chaseEbpValue = rdr.ReadUInt32();
                ulong returnAddr    = rdr.ReadUInt32();
                lock (mStackFramesToAdd)
                {
                    mStackFramesToAdd.Add(returnAddr);
                }
                Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "DumpStackFrames"));
                if (chaseEbpValue != 0 && chaseEbpValue > mChaseEbpValue)
                {
                    mChaseEbpValue = chaseEbpValue;
                    ThreadPool.QueueUserWorkItem(TraceOneFrame);
                    return;
                }
            }
            catch (Exception)
            {
            }
            mInProgress = false;
        }
Esempio n. 2
0
        void UpdateRow(object toReadObj)
        {
            ulong             toRead     = (ulong)toReadObj;
            DebugMemoryStream mem        = mConnection.NewMemoryStream();
            StringBuilder     resultName = new StringBuilder(string.Format("{0:X8}:", toRead));

            int width = 16;

            byte[] readBuf = new byte[width];

            mem.Seek((long)toRead, System.IO.SeekOrigin.Begin);

            int i, result = mRunning ? 0 : mem.Read(readBuf, 0, readBuf.Length);

            if (result == 0)
            {
                return;
            }

            for (i = 0; i < readBuf.Length; i++)
            {
                resultName.Append(string.Format(" {0:X2}", (int)readBuf[i]));
            }
            resultName.Append(" | ");
            for (i = 0; i < readBuf.Length; i++)
            {
                resultName.Append((!char.IsControl((char)readBuf[i]) && (int)readBuf[i] < 128) ? (char)readBuf[i] : '\xb7');
            }

            mStoredBytes[toRead] = new ListViewItem(resultName.ToString());
            UpdateMemoryWindow();
        }
Esempio n. 3
0
            public DisplayValue(DebugConnection conn, Registers reg, Variable var)
            {
                mName       = var.Name;
                mConnection = conn;
                mRegisters  = reg;
                mVariable   = var;
                mReader     = new BinaryReader(mConnection.NewMemoryStream());

                StringBuilder sb = new StringBuilder();
                ulong         regVal;

                byte[] buf = new byte[mVariable.Size];

                if (mVariable.Regval)
                {
                    regVal = GetRegisterValue(mVariable.Reg);
                    sb.Append(string.Format("{0:X}", regVal));
                    mValue = sb.ToString();
                    return;
                }
                else if (mVariable.Regrel)
                {
                    regVal = GetRegisterValue(mVariable.Reg);
                    mReader.BaseStream.Seek((long)regVal + mVariable.Offset, SeekOrigin.Begin);
                    mReader.Read(buf, 0, buf.Length);
                }
                else if (mVariable.Local || mVariable.Parameter)
                {
                    mReader.BaseStream.Seek(mVariable.Offset, SeekOrigin.Begin);
                    mReader.Read(buf, 0, buf.Length);
                }
                if (buf.Length == 4)
                {
                    sb.Append(string.Format("{3:X2}{2:X2}{1:X2}{0:X2}",
                                            buf[0], buf[1], buf[2], buf[3]));
                }
                else
                {
                    foreach (byte b in buf)
                    {
                        sb.Append(string.Format("{0:X2} ", (int)b));
                    }
                }
                mValue = sb.ToString();
            }
Esempio n. 4
0
            public DisplayValue(DebugConnection conn, Registers reg, Variable var)
            {
                mName = var.Name;
                mConnection = conn;
                mRegisters = reg;
                mVariable = var;
                mReader = new BinaryReader(mConnection.NewMemoryStream());

                StringBuilder sb = new StringBuilder();
                ulong regVal;
                byte[] buf = new byte[mVariable.Size];

                if (mVariable.Regval)
                {
                    regVal = GetRegisterValue(mVariable.Reg);
                    sb.Append(string.Format("{0:X}", regVal));
                    mValue = sb.ToString();
                    return;
                }
                else if (mVariable.Regrel)
                {
                    regVal = GetRegisterValue(mVariable.Reg);
                    mReader.BaseStream.Seek((long)regVal + mVariable.Offset, SeekOrigin.Begin);
                    mReader.Read(buf, 0, buf.Length);
                }
                else if (mVariable.Local || mVariable.Parameter)
                {
                    mReader.BaseStream.Seek(mVariable.Offset, SeekOrigin.Begin);
                    mReader.Read(buf, 0, buf.Length);
                }
                if (buf.Length == 4)
                {
                    sb.Append(string.Format("{3:X2}{2:X2}{1:X2}{0:X2}",
                        buf[0], buf[1], buf[2], buf[3]));
                }
                else
                {
                    foreach (byte b in buf)
                        sb.Append(string.Format("{0:X2} ", (int)b));
                }
                mValue = sb.ToString();
            }