llvm.org GIT mirror llvm / 6010e5d
llvm-objdump/COFF: Print DLL name in the export table header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199422 91177308-0d34-0410-b5e6-96231b3b80d8 Rui Ueyama 6 years ago
4 changed file(s) with 20 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
405405
406406 bool operator==(const ExportDirectoryEntryRef &Other) const;
407407 error_code getNext(ExportDirectoryEntryRef &Result) const;
408
409 error_code getDllName(StringRef &Result) const;
408410 error_code getOrdinal(uint32_t &Result) const;
409411 error_code getExportRVA(uint32_t &Result) const;
410 error_code getName(StringRef &Result) const;
412 error_code getSymbolName(StringRef &Result) const;
411413
412414 private:
413415 const export_directory_table_entry *ExportTable;
948948 return object_error::success;
949949 }
950950
951 // Returns the name of the current export symbol. If the symbol is exported only
952 // by ordinal, the empty string is set as a result.
953 error_code ExportDirectoryEntryRef::getDllName(StringRef &Result) const {
954 uintptr_t IntPtr = 0;
955 if (error_code EC = OwningObject->getRvaPtr(ExportTable->NameRVA, IntPtr))
956 return EC;
957 Result = StringRef(reinterpret_cast(IntPtr));
958 return object_error::success;
959 }
960
951961 // Returns the export ordinal of the current export symbol.
952962 error_code ExportDirectoryEntryRef::getOrdinal(uint32_t &Result) const {
953963 Result = ExportTable->OrdinalBase + Index;
967977
968978 // Returns the name of the current export symbol. If the symbol is exported only
969979 // by ordinal, the empty string is set as a result.
970 error_code ExportDirectoryEntryRef::getName(StringRef &Result) const {
980 error_code ExportDirectoryEntryRef::getSymbolName(StringRef &Result) const {
971981 uintptr_t IntPtr = 0;
972982 if (error_code EC = OwningObject->getRvaPtr(
973983 ExportTable->OrdinalTableRVA, IntPtr))
1010 // RUN: FileCheck -check-prefix=EXPORT %s
1111
1212 EXPORT: Export Table:
13 EXPORT-NEXT: DLL name: export.test.tmp3.dll
1314 EXPORT-NEXT: Ordinal RVA Name
1415 EXPORT-NEXT: 5 0x2008
1516 EXPORT-NEXT: 6 0x2010 exportfn2
278278 export_directory_iterator E = Obj->export_directory_end();
279279 if (I == E)
280280 return;
281 StringRef DllName;
282 if (I->getDllName(DllName))
283 return;
284 outs() << " DLL name: " << DllName << "\n";
281285 outs() << " Ordinal RVA Name\n";
282286 error_code EC;
283287 for (; I != E; I = I.increment(EC)) {
292296 outs() << format(" % 4d %# 8x", Ordinal, RVA);
293297
294298 StringRef Name;
295 if (I->getName(Name))
299 if (I->getSymbolName(Name))
296300 continue;
297301 if (!Name.empty())
298302 outs() << " " << Name;