public override object Transform(EngineIntrinsics engineIntrinsics, object inputData)
        {
            object originalInputData = inputData;

            var pso = inputData as PSObject;

            if (null != pso)
            {
                inputData = pso.BaseObject;
            }

            if (inputData is string)
            {
                return(inputData);
            }

            if (inputData is DbgModuleInfo)
            {
                return(((DbgModuleInfo)inputData).ImageName);
            }

            string path     = engineIntrinsics.SessionState.Path.CurrentProviderLocation(DbgProvider.ProviderId).ProviderPath;
            var    debugger = DbgProvider.GetDebugger(path);

            Exception e = null;

            // Maybe it is an address?
            try
            {
                object addrObj = AddressTransformationAttribute.Transform(
                    engineIntrinsics,
                    null,
                    true,                  // skipGlobalSymbolTest
                    false,                 // throwOnFailure
                    originalInputData);
                if (null != addrObj)
                {
                    var mod = new DbgModuleInfo(debugger,
                                                (ulong)addrObj,
                                                debugger.GetCurrentTarget());
                    return(mod.Name);
                }
            }
            catch (DbgEngException dee)
            {
                e = dee;
            }

            throw CreateRecoverableAtme(e,
                                        "Could not convert '{0}' to a module name.",
                                        originalInputData);
        } // end Transform()
        } // end _GetTypeInfoByName()

        private void _GetTypeInfoById(uint typeId, DbgModuleInfo module)
        {
            if (Raw)
            {
                WriteObject(Debugger._GetTypeInfoRaw(module.BaseAddress, typeId));
            }
            else
            {
                WriteObject(DbgTypeInfo.GetTypeInfo(Debugger,
                                                    module,
                                                    typeId));
            }
        } // end _GetTypeInfoById()
        private bool _Matches(DbgModuleInfo mod)
        {
            if (String.IsNullOrEmpty(Name))
            {
                return(true);
            }

            if (WildcardPattern.ContainsWildcardCharacters(Name))
            {
                var pat = new WildcardPattern(Name, WildcardOptions.CultureInvariant | WildcardOptions.IgnoreCase);
                return(pat.IsMatch(mod.Name));
            }

            return(0 == Util.Strcmp_OI(mod.Name, Name));
        } // end _Matches()
Beispiel #4
0
 public NativeModuleRegion(DbgModuleInfo moduleInfo) : base(new Address(moduleInfo.BaseAddress, moduleInfo.Debugger.TargetIs32Bit),
                                                            moduleInfo.Size)
 {
     m_moduleInfo = moduleInfo;
 }