[llvm-commits] [llvm] r171302 - in /llvm/trunk: test/Object/readobj-shared-object.test tools/llvm-readobj/llvm-readobj.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Dec 31 08:05:22 PST 2012
Author: rafael
Date: Mon Dec 31 10:05:21 2012
New Revision: 171302
URL: http://llvm.org/viewvc/llvm-project?rev=171302&view=rev
Log:
Print a header above the symbols. Extracted from a patch by Sami Liedes.
Modified:
llvm/trunk/test/Object/readobj-shared-object.test
llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
Modified: llvm/trunk/test/Object/readobj-shared-object.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/readobj-shared-object.test?rev=171302&r1=171301&r2=171302&view=diff
==============================================================================
--- llvm/trunk/test/Object/readobj-shared-object.test (original)
+++ llvm/trunk/test/Object/readobj-shared-object.test Mon Dec 31 10:05:21 2012
@@ -19,6 +19,7 @@
ELF32:Load Name : libfoo.so
ELF:Symbols:
+ELF: Name Type Address Size FileOffset Flags
ELF: .dynsym DBG {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific
ELF: .dynstr DBG {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific
ELF: .text DBG {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} formatspecific
@@ -42,6 +43,7 @@
ELF: Total: 21
ELF:Dynamic Symbols:
+ELF: Name Type Address Size FileOffset Flags
ELF: common_sym DATA {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global
ELF: tls_sym DATA {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global,threadlocal
ELF: defined_sym DATA {{[0-9a-f]+}} {{[0-9a-f]+}} {{[0-9a-f]+}} global
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=171302&r1=171301&r2=171302&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Mon Dec 31 10:05:21 2012
@@ -33,6 +33,16 @@
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input object>"), 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 @@
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 @@
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) {
More information about the llvm-commits
mailing list