From 148ee4f224be6448834bf039807c70bb1a7c78f5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 31 Dec 2012 16:05:21 +0000 Subject: Print a header above the symbols. Extracted from a patch by Sami Liedes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171302 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-readobj/llvm-readobj.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tools/llvm-readobj/llvm-readobj.cpp') diff --git a/tools/llvm-readobj/llvm-readobj.cpp b/tools/llvm-readobj/llvm-readobj.cpp index 8f8804a7c4..81d2bfb730 100644 --- a/tools/llvm-readobj/llvm-readobj.cpp +++ b/tools/llvm-readobj/llvm-readobj.cpp @@ -33,6 +33,16 @@ using namespace llvm::object; static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("")); +static void dumpSymbolHeader() { + outs() << format(" %-32s", (const char*)"Name") + << format(" %-4s", (const char*)"Type") + << format(" %-16s", (const char*)"Address") + << format(" %-16s", (const char*)"Size") + << format(" %-16s", (const char*)"FileOffset") + << format(" %-26s", (const char*)"Flags") + << "\n"; +} + static const char *getTypeStr(SymbolRef::Type Type) { switch (Type) { case SymbolRef::ST_Unknown: return "?"; @@ -118,6 +128,7 @@ static void dumpSymbols(const ObjectFile *obj) { error_code ec; uint32_t count = 0; outs() << "Symbols:\n"; + dumpSymbolHeader(); symbol_iterator it = obj->begin_symbols(); symbol_iterator ie = obj->end_symbols(); while (it != ie) { @@ -135,6 +146,7 @@ static void dumpDynamicSymbols(const ObjectFile *obj) { error_code ec; uint32_t count = 0; outs() << "Dynamic Symbols:\n"; + dumpSymbolHeader(); symbol_iterator it = obj->begin_dynamic_symbols(); symbol_iterator ie = obj->end_dynamic_symbols(); while (it != ie) { -- cgit v1.2.3-18-g5258