llvm.org GIT mirror llvm / 5733daa
[dwarfdump] Move dumping to a helper function NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243861 91177308-0d34-0410-b5e6-96231b3b80d8 Frederic Riss 5 years ago
1 changed file(s) with 10 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
7575 exit(1);
7676 }
7777
78 static void DumpObjectFile(ObjectFile &Obj, StringRef Filename) {
79 std::unique_ptr DICtx(new DWARFContextInMemory(Obj));
80
81 outs() << Filename
82 << ":\tfile format " << Obj.getFileFormatName() << "\n\n";
83 // Dump the complete DWARF structure.
84 DICtx->dump(outs(), DumpType);
85 }
86
7887 static void DumpInput(StringRef Filename) {
7988 ErrorOr> BuffOrErr =
8089 MemoryBuffer::getFileOrSTDIN(Filename);
8695 error(Filename, ObjOrErr.getError());
8796 ObjectFile &Obj = *ObjOrErr.get();
8897
89 std::unique_ptr DICtx(new DWARFContextInMemory(Obj));
90
91 outs() << Filename
92 << ":\tfile format " << Obj.getFileFormatName() << "\n\n";
93 // Dump the complete DWARF structure.
94 DICtx->dump(outs(), DumpType);
98 DumpObjectFile(Obj, Filename);
9599 }
96100
97101 int main(int argc, char **argv) {