Пример #1
0
        } // end constructor()

        public static DbgUnknownFunction Create(DbgEngDebugger debugger,
                                                DbgEngContext context,
                                                DEBUG_STACK_FRAME_EX nativeFrame)
        {
            ulong address = nativeFrame.InstructionOffset;

            string modName  = null;
            string funcName = null;
            ulong  offset   = 0;
            string fullname = null;

            // If our dbgeng has managed support (or support for whatever this is), let's
            // try that:

            if (0 != nativeFrame.InstructionOffset)
            {
                fullname = debugger.TryGetInfoFromFrame(nativeFrame,
                                                        out modName,
                                                        out funcName,
                                                        out offset);

                if (String.IsNullOrEmpty(fullname))
                {
                    LogManager.Trace("DbgUnknownFunction.Create: dbgeng doesn't know, either.");
                }
            }
            else
            {
                LogManager.Trace("DbgUnknownFunction.Create: we have no chance with an InstructionOffset of zero.");
            }

            if (String.IsNullOrEmpty(fullname))
            {
                funcName = DbgProvider.FormatUInt64(address, useTick: true);
            }
            else
            {
                address = address - offset;
            }

            return(new DbgUnknownFunction(debugger,
                                          context,
                                          nativeFrame,
                                          address,
                                          modName,
                                          funcName));
        } // end static Create() factory