Exemple #1
0
        } // end _FormatBits()

        private static ColorString _DefaultSymLookup(DbgEngDebugger debugger, ulong addr)
        {
            ulong  disp;
            string symName;

            if (debugger.TryGetNameByOffset(addr, out symName, out disp))
            {
                ColorString cs = DbgProvider.ColorizeSymbol(symName);
                if (disp != 0)
                {
                    cs.AppendPushPopFg(ConsoleColor.Gray, "+" + disp.ToString("x"));
                }

                return(cs);
            }
            return(ColorString.Empty);
        } // end _DefaultSymLookup()
        } // end ToString()

        public ColorString ToColorString()
        {
            ColorString cs;

            if (0 == InstructionPointer)
            {
                cs = new ColorString(ConsoleColor.Red, "0")
                     .Append("   ")
                     .AppendPushFg(ConsoleColor.Yellow)
                     .Append("WARNING: Frame IP not in any known module. Following frames may be wrong.")
                     .AppendPop();
            }
            else
            {
                cs = DbgProvider.ColorizeSymbol(ToString());
                if ((null != Module) && (Module.SymbolType == DEBUG_SYMTYPE.EXPORT))
                {
                    // If we only have export symbols, let's give a visual clue:
                    cs = new ColorString().AppendPushBg(ConsoleColor.DarkRed).Append(cs).AppendPop();
                }
            }
            return(cs);
        } // end ToColorString()
Exemple #3
0
        // Example:
        //
        //   eax=7ffdb000 ebx=00000000 ecx=00000000 edx=7785f17d esi=00000000 edi=00000000
        //   eip=777f410c esp=040ef770 ebp=040ef79c iopl=0         nv up ei pl zr na pe nc
        //   cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
        //   ntdll!DbgBreakPoint:
        //
        public override ColorString ToColorString()
        {
            if (null == m_colorString)
            {
                ConsoleColor color;
                ColorString  cs = new ColorString("eax=");
                color = GetColorForDiffAgainstBaseline("eax");
                cs.Append(Eax.GetColorizedValueString(color));
                cs.Append(" ebx=");
                color = GetColorForDiffAgainstBaseline("ebx");
                cs.Append(Ebx.GetColorizedValueString(color));
                cs.Append(" ecx=");
                color = GetColorForDiffAgainstBaseline("ecx");
                cs.Append(Ecx.GetColorizedValueString(color));
                cs.Append(" edx=");
                color = GetColorForDiffAgainstBaseline("edx");
                cs.Append(Edx.GetColorizedValueString(color));
                cs.Append(" esi=");
                color = GetColorForDiffAgainstBaseline("esi");
                cs.Append(Esi.GetColorizedValueString(color));
                cs.Append(" edi=");
                color = GetColorForDiffAgainstBaseline("edi");
                cs.Append(Edi.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("eip=");
                color = GetColorForDiffAgainstBaseline("eip");
                cs.Append(Eip.GetColorizedValueString(color));
                cs.Append(" esp=");
                color = GetColorForDiffAgainstBaseline("esp");
                cs.Append(Esp.GetColorizedValueString(color));
                cs.Append(" ebp=");
                color = GetColorForDiffAgainstBaseline("ebp");
                cs.Append(Ebp.GetColorizedValueString(color));
                cs.Append(" iopl=");
                color = GetColorForDiffAgainstBaseline("iopl");
                cs.AppendPushPopFg(color, ((uint)Iopl.Value).ToString("x"));
                // TODO:
                cs.AppendLine("   TBD: flags");

                cs.Append("cs=");
                color = GetColorForDiffAgainstBaseline("cs");
                cs.AppendPushPopFg(color, ((uint)Cs.Value).ToString("x4"));
                cs.Append("  ss=");
                color = GetColorForDiffAgainstBaseline("ss");
                cs.AppendPushPopFg(color, ((uint)Ss.Value).ToString("x4"));
                cs.Append("  ds=");
                color = GetColorForDiffAgainstBaseline("ds");
                cs.AppendPushPopFg(color, ((uint)Ds.Value).ToString("x4"));
                cs.Append("  es=");
                color = GetColorForDiffAgainstBaseline("es");
                cs.AppendPushPopFg(color, ((uint)Es.Value).ToString("x4"));
                cs.Append("  fs=");
                color = GetColorForDiffAgainstBaseline("fs");
                cs.AppendPushPopFg(color, ((uint)Fs.Value).ToString("x4"));
                cs.Append("  gs=");
                color = GetColorForDiffAgainstBaseline("gs");
                cs.AppendPushPopFg(color, ((uint)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(Eip.ValueAsPointer));

                m_colorString = cs;
            }
            return(m_colorString);
        } // end ToString()
Exemple #4
0
        // Example:
        //
        //    0:009> r
        //     r0=00000000  r1=00000000  r2=00000000  r3=76fdcf09  r4=00000000  r5=028df6e0
        //     r6=028df730  r7=00000000  r8=00000001  r9=01507858 r10=015156a8 r11=028df8e8
        //    r12=00000000  sp=028df6c8  lr=00000000  pc=76ccce24 psr=600f0030 -ZC-- Thumb
        //    KERNELBASE!RaiseFailFastException+0x60:
        //    76ccce24 f000f846 bl          KERNELBASE!SignalStartWerSvc (76ccceb4)
        //
        public override ColorString ToColorString()
        {
            if (null == m_colorString)
            {
                ConsoleColor color;
                ColorString  cs = new ColorString(" r0=");
                color = GetColorForDiffAgainstBaseline("r0");
                cs.Append(R0.GetColorizedValueString(color));
                cs.Append("  r1=");
                color = GetColorForDiffAgainstBaseline("r1");
                cs.Append(R1.GetColorizedValueString(color));
                cs.Append("  r2=");
                color = GetColorForDiffAgainstBaseline("r2");
                cs.Append(R2.GetColorizedValueString(color));
                cs.Append("  r3=");
                color = GetColorForDiffAgainstBaseline("r3");
                cs.Append(R3.GetColorizedValueString(color));
                cs.Append("  r4=");
                color = GetColorForDiffAgainstBaseline("r4");
                cs.Append(R4.GetColorizedValueString(color));
                cs.Append("  r5=");
                color = GetColorForDiffAgainstBaseline("r5");
                cs.Append(R5.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append(" r6=");
                color = GetColorForDiffAgainstBaseline("r6");
                cs.Append(R6.GetColorizedValueString(color));
                cs.Append("  r7=");
                color = GetColorForDiffAgainstBaseline("r7");
                cs.Append(R7.GetColorizedValueString(color));
                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.Append(" r11=");
                color = GetColorForDiffAgainstBaseline("r11");
                cs.Append(R11.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("r12=");
                color = GetColorForDiffAgainstBaseline("r12");
                cs.Append(R12.GetColorizedValueString(color));
                cs.Append("  sp=");
                color = GetColorForDiffAgainstBaseline("sp");
                cs.Append(Sp.GetColorizedValueString(color));
                cs.Append("  lr=");
                color = GetColorForDiffAgainstBaseline("lr");
                cs.Append(Lr.GetColorizedValueString(color));
                cs.Append("  pc=");
                color = GetColorForDiffAgainstBaseline("pc");
                cs.Append(Pc.GetColorizedValueString(color));
                cs.Append(" psr=");
                color = GetColorForDiffAgainstBaseline("psr");
                cs.Append(Psr.GetColorizedValueString(color));

                // TODO:
                cs.AppendLine(" TBD: flags and mode");

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

                m_colorString = cs;
            }
            return(m_colorString);
        } // end ToString()
Exemple #5
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()