Exemple #1
0
        private static DEBUG_MODULE_PARAMETERS _GetModParamsByAddress(DbgEngDebugger debugger,
                                                                      DbgEngContext ctx,
                                                                      WDebugSymbols ds,
                                                                      ulong addressInModule)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (0 == addressInModule)
            {
                throw new ArgumentException("You must supply a non-zero address.", "addressInModule");
            }

            return(debugger.ExecuteOnDbgEngThread(() =>
            {
                using (new DbgEngContextSaver(debugger, ctx))
                {
                    if (null == ds)
                    {
                        ds = (WDebugSymbols)debugger.DebuggerInterface;
                    }

                    uint index;
                    ulong baseAddr;

                    // TODO: If it's a managed module, this will fail. We could use
                    // ClrMd to synthesize this DbgModule instead.
                    // https://github.com/Microsoft/DbgShell/issues/35
                    StaticCheckHr(ds.GetModuleByOffset2(addressInModule,
                                                        0,       // start index
                                                        DEBUG_GETMOD.DEFAULT,
                                                        out index,
                                                        out baseAddr));
                    DEBUG_MODULE_PARAMETERS[] modParams;
                    StaticCheckHr(ds.GetModuleParameters(1, null, index, out modParams));
                    Util.Assert(1 == modParams.Length);
                    return modParams[0];
                }
            }));
        } // end _GetModParamsByAddress()
Exemple #2
0
        private static DEBUG_MODULE_PARAMETERS _GetModParamsByAddress(DbgEngDebugger debugger,
                                                                      DbgEngContext ctx,
                                                                      WDebugSymbols ds,
                                                                      ulong addressInModule)
        {
            if (null == debugger)
            {
                throw new ArgumentNullException("debugger");
            }

            if (0 == addressInModule)
            {
                throw new ArgumentException("You must supply a non-zero address.", "addressInModule");
            }

            return(debugger.ExecuteOnDbgEngThread(() =>
            {
                using (new DbgEngContextSaver(debugger, ctx))
                {
                    if (null == ds)
                    {
                        ds = (WDebugSymbols)debugger.DebuggerInterface;
                    }

                    uint index;
                    ulong baseAddr;
                    StaticCheckHr(ds.GetModuleByOffset2(addressInModule,
                                                        0,       // start index
                                                        DEBUG_GETMOD.DEFAULT,
                                                        out index,
                                                        out baseAddr));
                    DEBUG_MODULE_PARAMETERS[] modParams;
                    StaticCheckHr(ds.GetModuleParameters(1, null, index, out modParams));
                    Util.Assert(1 == modParams.Length);
                    return modParams[0];
                }
            }));
        } // end _GetModParamsByAddress()