[PATCH] llvm-readobj: print COFF import table
David Majnemer
david.majnemer at gmail.com
Wed Oct 1 21:48:17 PDT 2014
You don't check to see if the import table is RVA based.
================
Comment at: tools/llvm-readobj/COFFDumper.cpp:887-888
@@ +886,4 @@
+void COFFDumper::printCOFFImports() {
+ for (auto I = Obj->import_directory_begin(), E = Obj->import_directory_end();
+ I != E; ++I) {
+ DictScope Import(W, "Import");
----------------
We should probably add an `iterator_range` for this, then you can use a range-based for loop.
================
Comment at: tools/llvm-readobj/COFFDumper.cpp:890
@@ +889,3 @@
+ DictScope Import(W, "Import");
+ StringRef name;
+ if (error(I->getName(name))) return;
----------------
`Name`
================
Comment at: tools/llvm-readobj/COFFDumper.cpp:893
@@ +892,3 @@
+ W.printString("Name", name);
+ uint32_t addr1, addr2;
+ if (error(I->getImportLookupTableRVA(addr1))) return;
----------------
`Addr1` and `Addr2`
Alternatively, you could do:
if (error(I->getImportLookupTableRVA(Addr))) return;
W.printHex("ImportLookupTableRVA", Addr);
if (error(I->getImportAddressTableRVA(Addr))) return;
W.printHex("ImportAddressTableRVA", Addr);
http://reviews.llvm.org/D5569
More information about the llvm-commits
mailing list