} // end property Displacement


        public override string ToString()
        {
            if (null == Function)
            {
                // Let's see if dbgeng can do any better.
                try
                {
                    Util.Fail("We don't have a Function.");
                    ulong  displacement;
                    string fullname = GetNameByInlineContext(InstructionPointer,
                                                             NativeFrameEx.InlineFrameContext,
                                                             out displacement);
                    string modName, funcName;
                    ulong  dontCare;
                    DbgProvider.ParseSymbolName(fullname,
                                                out modName,
                                                out funcName,
                                                out dontCare);

                    if (displacement == 0)
                    {
                        return(fullname);
                    }
                    else
                    {
                        return(Util.Sprintf("{0}+0x{1:x}", fullname, displacement));
                    }
                }
                catch (DbgProviderException dpe)
                {
                    LogManager.Trace("Still couldn't get symbolic name: {0}", Util.GetExceptionMessages(dpe));
                }
            } // end if( !Function )

            if (Displacement == 0)
            {
                return(SymbolName);
            }
            else
            {
                return(Util.Sprintf("{0}+0x{1:x}", SymbolName, Displacement));
            }
        } // end ToString()
Beispiel #2
0
        } // end property Displacement


        public override string ToString()
        {
            if (null == Function)
            {
                // Let's see if dbgeng can do any better.
                try
                {
                    Util.Fail("We don't have a Function.");
                    ulong  displacement;
                    string fullname = GetNameByInlineContext(InstructionPointer,
                                                             NativeFrameEx.InlineFrameContext,
                                                             out displacement);
                    string modName, funcName;
                    ulong  dontCare;
                    DbgProvider.ParseSymbolName(fullname,
                                                out modName,
                                                out funcName,
                                                out dontCare);

                    if (displacement == 0)
                    {
                        return(fullname);
                    }
                    else
                    {
                        return(Util.Sprintf("{0}+0x{1:x}", fullname, displacement));
                    }
                }
                catch (DbgProviderException dpe)
                {
                    LogManager.Trace("Still couldn't get symbolic name: {0}", Util.GetExceptionMessages(dpe));
                }
            } // end if( !Function )

            try
            {
                string disp = String.Empty;

                if (Displacement != 0)
                {
                    disp = "+0x" + Displacement.ToString("x");
                }

                if (null != ManagedFrame)
                {
                    // TODO: Ideally we wouldn't deal with this at this layer; we would
                    // synthesize a DbgModuleInfo instead. But for now this is a handy
                    // workaround.
                    // https://github.com/Microsoft/DbgShell/issues/35

                    // It seems like dbgeng likes to replace dots in module names with
                    // underbars... why? I guess I should do the same?
                    return(ManagedFrame.ModuleName.Replace('.', '_') + "!" + ManagedFrame.Method.GetFullSignature() + disp);
                }

                return(SymbolName + disp);
            }
            catch (DbgProviderException dpe)
            {
                LogManager.Trace("Could not get symbol name: {0}", Util.GetExceptionMessages(dpe));
            }

            return(DbgProvider.FormatAddress(InstructionPointer,
                                             Debugger.TargetIs32Bit,
                                             useTick: true));
        } // end ToString()