[llvm-commits] [llvm] r141885 - /llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp

Michael J. Spencer bigcheesegs at gmail.com
Thu Oct 13 13:37:08 PDT 2011


Author: mspencer
Date: Thu Oct 13 15:37:08 2011
New Revision: 141885

URL: http://llvm.org/viewvc/llvm-project?rev=141885&view=rev
Log:
llvm-objdump: Fix dumping of multiple symbols with the same address.

This happens in COFF because there is a symbol for the beginning of each
section.

Modified:
    llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp

Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=141885&r1=141884&r2=141885&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Thu Oct 13 15:37:08 2011
@@ -234,7 +234,18 @@
     // Disassemble symbol by symbol.
     for (unsigned si = 0, se = Symbols.size(); si != se; ++si) {
       uint64_t Start = Symbols[si].first;
-      uint64_t End = si == se-1 ? SectSize : Symbols[si + 1].first - 1;
+      uint64_t End;
+      // The end is either the size of the section or the beginning of the next
+      // symbol.
+      if (si == se - 1)
+        End = SectSize;
+      // Make sure this symbol takes up space.
+      else if (Symbols[si + 1].first != Start)
+        End = Symbols[si + 1].first - 1;
+      else
+        // This symbol has the same address as the next symbol. Skip it.
+        continue;
+
       outs() << '\n' << Symbols[si].second << ":\n";
 
 #ifndef NDEBUG





More information about the llvm-commits mailing list