예제 #1
0
        // Example:
        //
        // rax=000007f7d5e4e000 rbx=0000000000000000 rcx=0000000000000000
        // rdx=000007fcac628f98 rsi=0000000000000000 rdi=0000000000000000
        // rip=000007fcac571e00 rsp=0000000b9879fb78 rbp=0000000000000000
        //  r8=0000000000000000  r9=000007fcac628f98 r10=0000000000000000
        // r11=0000000000000000 r12=0000000000000000 r13=0000000000000000
        // r14=0000000000000000 r15=0000000000000000
        // iopl=0         nv up ei pl zr na po nc
        // cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246
        //   ntdll!DbgBreakPoint:
        //
        public override ColorString ToColorString()
        {
            if (null == m_colorString)
            {
                ConsoleColor color;
                ColorString  cs = new ColorString("rax=");
                color = GetColorForDiffAgainstBaseline("rax");
                cs.Append(Rax.GetColorizedValueString(color));
                cs.Append(" rbx=");
                color = GetColorForDiffAgainstBaseline("rbx");
                cs.Append(Rbx.GetColorizedValueString(color));
                cs.Append(" rcx=");
                color = GetColorForDiffAgainstBaseline("rcx");
                cs.Append(Rcx.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("rdx=");
                color = GetColorForDiffAgainstBaseline("rdx");
                cs.Append(Rdx.GetColorizedValueString(color));
                cs.Append(" rsi=");
                color = GetColorForDiffAgainstBaseline("rsi");
                cs.Append(Rsi.GetColorizedValueString(color));
                cs.Append(" rdi=");
                color = GetColorForDiffAgainstBaseline("rdi");
                cs.Append(Rdi.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("rip=");
                color = GetColorForDiffAgainstBaseline("rip");
                cs.Append(Rip.GetColorizedValueString(color));
                cs.Append(" rsp=");
                color = GetColorForDiffAgainstBaseline("rsp");
                cs.Append(Rsp.GetColorizedValueString(color));
                cs.Append(" rbp=");
                color = GetColorForDiffAgainstBaseline("rbp");
                cs.Append(Rbp.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append(" r8=");
                color = GetColorForDiffAgainstBaseline("r8");
                cs.Append(R8.GetColorizedValueString(color));
                cs.Append("  r9=");
                color = GetColorForDiffAgainstBaseline("r9");
                cs.Append(R9.GetColorizedValueString(color));
                cs.Append(" r10=");
                color = GetColorForDiffAgainstBaseline("r10");
                cs.Append(R10.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("r11=");
                color = GetColorForDiffAgainstBaseline("r11");
                cs.Append(R11.GetColorizedValueString(color));
                cs.Append(" r12=");
                color = GetColorForDiffAgainstBaseline("r12");
                cs.Append(R12.GetColorizedValueString(color));
                cs.Append(" r13=");
                color = GetColorForDiffAgainstBaseline("r13");
                cs.Append(R13.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("r14=");
                color = GetColorForDiffAgainstBaseline("r14");
                cs.Append(R14.GetColorizedValueString(color));
                cs.Append(" r15=");
                color = GetColorForDiffAgainstBaseline("r15");
                cs.Append(R15.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("iopl=");
                color = GetColorForDiffAgainstBaseline("iopl");
                cs.AppendPushPopFg(color, ((ulong)Iopl.Value).ToString("x"));
                // TODO:
                cs.AppendLine("   TBD: flags");

                cs.Append("cs=");
                color = GetColorForDiffAgainstBaseline("cs");
                cs.AppendPushPopFg(color, ((ushort)Cs.Value).ToString("x4"));
                cs.Append("  ss=");
                color = GetColorForDiffAgainstBaseline("ss");
                cs.AppendPushPopFg(color, ((ushort)Ss.Value).ToString("x4"));
                cs.Append("  ds=");
                color = GetColorForDiffAgainstBaseline("ds");
                cs.AppendPushPopFg(color, ((ushort)Ds.Value).ToString("x4"));
                cs.Append("  es=");
                color = GetColorForDiffAgainstBaseline("es");
                cs.AppendPushPopFg(color, ((ushort)Es.Value).ToString("x4"));
                cs.Append("  fs=");
                color = GetColorForDiffAgainstBaseline("fs");
                cs.AppendPushPopFg(color, ((ushort)Fs.Value).ToString("x4"));
                cs.Append("  gs=");
                color = GetColorForDiffAgainstBaseline("gs");
                cs.AppendPushPopFg(color, ((ushort)Gs.Value).ToString("x4"));
                cs.Append("             efl=");
                color = GetColorForDiffAgainstBaseline("efl");
                cs.Append(Efl.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append(DbgProvider.ColorizeSymbol(StackFrame.SymbolName));
                if (0 != StackFrame.Displacement)
                {
                    cs.Append("+0x");
                    cs.Append(StackFrame.Displacement.ToString("x"));
                }
                cs.AppendLine(":");
                cs.Append(Disasm(Rip.ValueAsPointer));

                m_colorString = cs;
            }
            return(m_colorString);
        } // end ToString()