[Wisp-cvs] wisp/users/dig elfdump.py,1.6,1.7
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-15 00:03:57
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv11332 Modified Files: elfdump.py Log Message: cleanup Index: elfdump.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elfdump.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- elfdump.py 14 Apr 2003 23:59:09 -0000 1.6 +++ elfdump.py 15 Apr 2003 00:03:49 -0000 1.7 @@ -54,8 +54,8 @@ e_shoff = take('t') print 'Processor-specific flags: [%08x]' % take('t') - e_ehsize, e_phentsize, e_phnum, e_shentsize = take('wwww') - print 'ELF header size: [%08x] bytes' % e_ehsize + print 'ELF header size: [%08x] bytes' % take('w') + e_phentsize, e_phnum, e_shentsize = take('www') print 'Program header table: %i entries at [%08x], 0x%x bytes each' % \ (e_phnum, e_phoff, e_phentsize) @@ -67,11 +67,9 @@ # load section header string table if e_shstrndx <> 0: - f.seek(e_shoff + e_shentsize * e_shstrndx) - shstrshent = f.read(e_shentsize) - if len(shstrshent) == e_shentsize >= 24: - shstr_ofs, = struct.unpack(bytesex + ' L', shstrshent[16:20]) - shstr_size, = struct.unpack(bytesex + ' L', shstrshent[20:24]) + f.seek(e_shoff + e_shentsize * e_shstrndx + 16) + if e_shentsize >= 24: + shstr_ofs, shstr_size = take('tt') f.seek(shstr_ofs) shstr = f.read(shstr_size) if len(shstr) <> shstr_size: |