start enumerating syminfo entries at index 1
authorYann Rouillard <yann@pleiades.fr.eu.org>
Mon, 29 Apr 2013 00:07:06 +0000 (02:07 +0200)
committerYann Rouillard <yann@pleiades.fr.eu.org>
Mon, 29 Apr 2013 00:07:06 +0000 (02:07 +0200)
scripts/elfdump.py

index aef365a4e70026c05529ce6c604ebdd4a339d77b..853746dc720f0dd12a7bc40005edcf4b5b4c093c 100755 (executable)
@@ -82,10 +82,10 @@ class Elfdump(object):
             self._emitline("\nSyminfo Section:  %s" % bytes2str(section.name))
             self._emitline('     index  flags            bound to                 symbol')
 
-            for nsym, syminfo in enumerate(section.iter_symbols()):
+            for nsym, syminfo in enumerate(section.iter_symbols(), start=1):
 
                 # elfdump doesn't display anything for this kind of symbols
-                symbol = symtable.get_symbol(nsym + 1)
+                symbol = symtable.get_symbol(nsym)
                 if (symbol['st_info']['type'] == 'STT_NOTYPE' and
                         symbol['st_shndx'] == 'SHN_UNDEF'):
                     continue
@@ -105,7 +105,7 @@ class Elfdump(object):
 
                 # syminfo names are truncated to 25 chars, similarly to readelf
                 self._emitline('%10s  %-5s %10s %-24s %s' % (
-                    '[%d]' % (int(nsym) + 1),
+                    '[%d]' % (int(nsym)),
                     describe_syminfo_flags(syminfo['si_flags']),
                     index,
                     boundto,