Ejemplo n.º 1
0
 public void LoadModules()
 {
     foreach (string module in mLoadedModules.Keys)
     {
         DbgHelp.SymUnloadModule64(hProcess, mLoadedModules[module]);
     }
 }
Ejemplo n.º 2
0
 public void SetModuleAddress(string module, ulong addr)
 {
     if (mLoadedModules.ContainsKey(module))
     {
         DbgHelp.SymUnloadModule64(hProcess, mLoadedModules[module]);
     }
     mLoadedModules[module] = addr;
     LoadModule(module, addr);
 }
Ejemplo n.º 3
0
 public List <Variable> GetLocals(ulong addr)
 {
     lock (mVariables)
     {
         mVariables.Clear();
         IMAGEHLP_STACK_FRAME stackFrame = new IMAGEHLP_STACK_FRAME();
         stackFrame.InstructionOffset = addr;
         // Always succeeds
         DbgHelp.SymSetContext(hProcess, ref stackFrame, IntPtr.Zero);
         DbgHelp.SymEnumSymbols(hProcess, 0, null, EnumLocals, IntPtr.Zero);
         return(new List <Variable>(mVariables));
     }
 }
Ejemplo n.º 4
0
        public Variable GetNamedVar(string name, ulong addr)
        {
            SYMBOL_INFO symInfo = new SYMBOL_INFO();

            symInfo.Initialize();
            if (DbgHelp.SymFromName(hProcess, name, ref symInfo))
            {
                return(MakeVarFromSym(symInfo));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public KeyValuePair <string, int> GetFileAndLine(ulong addr)
        {
            IntPtr          displacement    = new IntPtr();
            IMAGEHLP_LINE64 lineNumberIdent = new IMAGEHLP_LINE64();

            lineNumberIdent.Initialize();
            if (DbgHelp.SymGetLineFromAddr64
                    (hProcess, addr, out displacement, ref lineNumberIdent))
            {
                Console.Out.WriteLine("Got File and Line for addr " + addr + ": " + lineNumberIdent.FileName.ToString() + ":" + lineNumberIdent.LineNumber);
                return(new KeyValuePair <string, int>(lineNumberIdent.FileName.ToString(), (int)lineNumberIdent.LineNumber));
            }
            return(new KeyValuePair <string, int>("unknown", 0));
        }
Ejemplo n.º 6
0
        public void LoadModule(string module, ulong addr)
        {
            string realPath = mFileMap.GetFilePathFromShortName((Path.GetFileNameWithoutExtension(module) + ".nostrip").ToUpper());

            if (realPath != null)
            {
                long loadResult = DbgHelp.SymLoadModuleEx
                                      (hProcess,
                                      IntPtr.Zero,
                                      realPath,
                                      null,
                                      addr,
                                      0,
                                      IntPtr.Zero,
                                      0);
            }
        }
Ejemplo n.º 7
0
 public void Initialize()
 {
     DbgHelp.SymInitialize(hProcess, null, false);
     mFileMap.Directories = new string[] { mReactosOutputPath };
 }
Ejemplo n.º 8
0
 static SymbolContext()
 {
     DbgHelp.SymSetOptions(SymOptionsFlags.SYMOPT_LOAD_LINES);
 }