@@ -679,11 +679,6 @@ MetaEnum::New(Module* mod,
679679 *handle = TO_CDENUM (NULL );
680680 }
681681
682- if (!mod->GetFile ()->HasMetadata ())
683- {
684- return S_FALSE;
685- }
686-
687682 metaEnum = new (nothrow) MetaEnum;
688683 if (!metaEnum)
689684 {
@@ -4079,9 +4074,9 @@ ClrDataAccess::GetModuleByAddress(
40794074 {
40804075 TADDR base;
40814076 ULONG32 length;
4082- PEFile* file = modDef->GetFile ();
4077+ PEAssembly* pPEAssembly = modDef->GetPEAssembly ();
40834078
4084- if ((base = PTR_TO_TADDR (file ->GetLoadedImageContents (&length))))
4079+ if ((base = PTR_TO_TADDR (pPEAssembly ->GetLoadedImageContents (&length))))
40854080 {
40864081 if (TO_CDADDR (base) <= address &&
40874082 TO_CDADDR (base + length) > address)
@@ -4133,9 +4128,9 @@ ClrDataAccess::StartEnumMethodDefinitionsByAddress(
41334128 {
41344129 TADDR base;
41354130 ULONG32 length;
4136- PEFile* file = modDef->GetFile ();
4131+ PEAssembly* assembly = modDef->GetPEAssembly ();
41374132
4138- if ((base = PTR_TO_TADDR (file ->GetLoadedImageContents (&length))))
4133+ if ((base = PTR_TO_TADDR (assembly ->GetLoadedImageContents (&length))))
41394134 {
41404135 if (TO_CDADDR (base) <= address &&
41414136 TO_CDADDR (base + length) > address)
@@ -6459,7 +6454,7 @@ ClrDataAccess::GetHostGcNotificationTable()
64596454}
64606455
64616456/* static */ bool
6462- ClrDataAccess::GetMetaDataFileInfoFromPEFile (PEFile *pPEFile ,
6457+ ClrDataAccess::GetMetaDataFileInfoFromPEFile (PEAssembly *pPEAssembly ,
64636458 DWORD &dwTimeStamp,
64646459 DWORD &dwSize,
64656460 DWORD &dwDataSize,
@@ -6477,7 +6472,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEFile *pPEFile,
64776472 isNGEN = false ;
64786473 if (pDir == NULL || pDir->Size == 0 )
64796474 {
6480- mdImage = pPEFile-> GetILimage ();
6475+ mdImage = pPEAssembly-> GetPEImage ();
64816476 if (mdImage != NULL )
64826477 {
64836478 layout = mdImage->GetLoadedLayout ();
@@ -6526,7 +6521,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEFile *pPEFile,
65266521}
65276522
65286523/* static */
6529- bool ClrDataAccess::GetILImageInfoFromNgenPEFile (PEFile *peFile ,
6524+ bool ClrDataAccess::GetILImageInfoFromNgenPEFile (PEAssembly *pPEAssembly ,
65306525 DWORD &dwTimeStamp,
65316526 DWORD &dwSize,
65326527 __out_ecount (cchFilePath) LPWSTR wszFilePath,
@@ -6536,10 +6531,10 @@ bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEFile *peFile,
65366531 DWORD dwWritten = 0 ;
65376532
65386533 // use the IL File name
6539- if (!peFile ->GetPath ().DacGetUnicode (cchFilePath, wszFilePath, (COUNT_T *)(&dwWritten)))
6534+ if (!pPEAssembly ->GetPath ().DacGetUnicode (cchFilePath, wszFilePath, (COUNT_T *)(&dwWritten)))
65406535 {
65416536 // Use DAC hint to retrieve the IL name.
6542- peFile ->GetModuleFileNameHint ().DacGetUnicode (cchFilePath, wszFilePath, (COUNT_T *)(&dwWritten));
6537+ pPEAssembly ->GetModuleFileNameHint ().DacGetUnicode (cchFilePath, wszFilePath, (COUNT_T *)(&dwWritten));
65436538 }
65446539 dwTimeStamp = 0 ;
65456540 dwSize = 0 ;
@@ -6603,7 +6598,7 @@ bool ClrDataAccess::GetILImageNameFromNgenImage( LPCWSTR ilExtension,
66036598#endif // FEATURE_CORESYSTEM
66046599
66056600void *
6606- ClrDataAccess::GetMetaDataFromHost (PEFile* peFile ,
6601+ ClrDataAccess::GetMetaDataFromHost (PEAssembly* pPEAssembly ,
66076602 bool * isAlternate)
66086603{
66096604 DWORD imageTimestamp, imageSize, dataSize;
@@ -6634,7 +6629,7 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile,
66346629 // so the field remains for now.
66356630
66366631 if (!ClrDataAccess::GetMetaDataFileInfoFromPEFile (
6637- peFile ,
6632+ pPEAssembly ,
66386633 imageTimestamp,
66396634 imageSize,
66406635 dataSize,
@@ -6647,7 +6642,7 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile,
66476642 }
66486643
66496644 // try direct match for the image that is loaded into the managed process
6650- peFile ->GetLoadedMetadata ((COUNT_T *)(&dataSize));
6645+ pPEAssembly ->GetLoadedMetadata ((COUNT_T *)(&dataSize));
66516646
66526647 DWORD allocSize = 0 ;
66536648 if (!ClrSafeInt<DWORD>::addition (dataSize, sizeof (DAC_INSTANCE), allocSize))
@@ -6665,7 +6660,7 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile,
66656660 buffer = (void *)(inst + 1 );
66666661
66676662 // APIs implemented by hosting debugger. It can use the path/filename, timestamp, and
6668- // file size to find an exact match for the image. If that fails for an ngen'ed image,
6663+ // pPEAssembly size to find an exact match for the image. If that fails for an ngen'ed image,
66696664 // we can request the IL image which it came from.
66706665 if (m_legacyMetaDataLocator)
66716666 {
@@ -6701,7 +6696,7 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile,
67016696 //
67026697 isAlt = true ;
67036698 if (!ClrDataAccess::GetILImageInfoFromNgenPEFile (
6704- peFile ,
6699+ pPEAssembly ,
67056700 imageTimestamp,
67066701 imageSize,
67076702 uniPath,
@@ -6781,13 +6776,13 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile,
67816776
67826777// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67836778//
6784- // Given a PEFile or a ReflectionModule try to find the corresponding metadata
6779+ // Given a PEAssembly or a ReflectionModule try to find the corresponding metadata
67856780// We will first ask debugger to locate it. If fail, we will try
67866781// to get it from the target process
67876782//
67886783// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67896784IMDInternalImport*
6790- ClrDataAccess::GetMDImport (const PEFile* peFile , const ReflectionModule* reflectionModule, bool throwEx)
6785+ ClrDataAccess::GetMDImport (const PEAssembly* pPEAssembly , const ReflectionModule* reflectionModule, bool throwEx)
67916786{
67926787 HRESULT status;
67936788 PTR_CVOID mdBaseTarget = NULL ;
@@ -6796,22 +6791,22 @@ ClrDataAccess::GetMDImport(const PEFile* peFile, const ReflectionModule* reflect
67966791 PVOID mdBaseHost = NULL ;
67976792 bool isAlternate = false ;
67986793
6799- _ASSERTE ((peFile == NULL && reflectionModule != NULL ) || (peFile != NULL && reflectionModule == NULL ));
6800- TADDR peFileAddr = (peFile != NULL ) ? dac_cast<TADDR>(peFile ) : dac_cast<TADDR>(reflectionModule);
6794+ _ASSERTE ((pPEAssembly == NULL && reflectionModule != NULL ) || (pPEAssembly != NULL && reflectionModule == NULL ));
6795+ TADDR peAssemblyAddr = (pPEAssembly != NULL ) ? dac_cast<TADDR>(pPEAssembly ) : dac_cast<TADDR>(reflectionModule);
68016796
68026797 //
68036798 // Look for one we've already created.
68046799 //
6805- mdImport = m_mdImports.Get (peFileAddr );
6800+ mdImport = m_mdImports.Get (peAssemblyAddr );
68066801 if (mdImport != NULL )
68076802 {
68086803 return mdImport;
68096804 }
68106805
6811- if (peFile != NULL )
6806+ if (pPEAssembly != NULL )
68126807 {
68136808 // Get the metadata size
6814- mdBaseTarget = ((PEFile*)peFile )->GetLoadedMetadata (&mdSize);
6809+ mdBaseTarget = const_cast <PEAssembly*>(pPEAssembly )->GetLoadedMetadata (&mdSize);
68156810 }
68166811 else if (reflectionModule != NULL )
68176812 {
@@ -6862,12 +6857,12 @@ ClrDataAccess::GetMDImport(const PEFile* peFile, const ReflectionModule* reflect
68626857 }
68636858
68646859 // Try to see if debugger can locate it
6865- if (peFile != NULL && mdBaseHost == NULL && (m_target3 || m_legacyMetaDataLocator))
6860+ if (pPEAssembly != NULL && mdBaseHost == NULL && (m_target3 || m_legacyMetaDataLocator))
68666861 {
68676862 // We couldn't read the metadata from memory. Ask
68686863 // the target for metadata as it may be able to
68696864 // provide it from some alternate means.
6870- mdBaseHost = GetMetaDataFromHost (const_cast <PEFile *>(peFile ), &isAlternate);
6865+ mdBaseHost = GetMetaDataFromHost (const_cast <PEAssembly *>(pPEAssembly ), &isAlternate);
68716866 }
68726867
68736868 if (mdBaseHost == NULL )
@@ -6902,7 +6897,7 @@ ClrDataAccess::GetMDImport(const PEFile* peFile, const ReflectionModule* reflect
69026897 // The m_mdImports list does get cleaned up by calls to ClrDataAccess::Flush,
69036898 // i.e. every time the process changes state.
69046899
6905- if (m_mdImports.Add (peFileAddr , mdImport, isAlternate) == NULL )
6900+ if (m_mdImports.Add (peAssemblyAddr , mdImport, isAlternate) == NULL )
69066901 {
69076902 mdImport->Release ();
69086903 DacError (E_OUTOFMEMORY);
@@ -6970,9 +6965,9 @@ HRESULT ClrDataAccess::VerifyDlls()
69706965 }
69716966
69726967 // Read the debug directory timestamp from the target mscorwks image using DAC
6973- // Note that we don't use the PE timestamp because the PE file might be changed in ways
6968+ // Note that we don't use the PE timestamp because the PE pPEAssembly might be changed in ways
69746969 // that don't effect the PDB (and therefore don't effect DAC). Specifically, we rebase
6975- // our DLLs at the end of a build, that changes the PE file , but not the PDB.
6970+ // our DLLs at the end of a build, that changes the PE pPEAssembly , but not the PDB.
69766971 // Note that if we wanted to be extra careful, we could read the CV contents (which includes
69776972 // the GUID signature) and verify it matches. Using the timestamp is useful for helpful error
69786973 // messages, and should be sufficient in any real scenario.
0 commit comments