Revert xstrip.py
modified: stub/scripts/xstrip.py
This commit is contained in:
@@ -27,11 +27,6 @@
|
|||||||
# <markus@oberhumer.com> <ezerotven+github@gmail.com>
|
# <markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def eprint(*args, **kwargs):
|
|
||||||
print(*args, file=sys.stderr, **kwargs)
|
|
||||||
|
|
||||||
import getopt, os, re, string, struct, sys
|
import getopt, os, re, string, struct, sys
|
||||||
|
|
||||||
@@ -52,18 +47,16 @@ def strip_with_dump(dump_fn, eh, idata):
|
|||||||
lines = open(dump_fn, "rb").readlines()
|
lines = open(dump_fn, "rb").readlines()
|
||||||
for l in lines:
|
for l in lines:
|
||||||
l = re.sub(r"\s+", " ", l.strip())
|
l = re.sub(r"\s+", " ", l.strip())
|
||||||
# eprint("l=", l, "\n")
|
|
||||||
f = l.split(" ")
|
f = l.split(" ")
|
||||||
# eprint("f=", f, "len(f)=", len(f), "\n")
|
|
||||||
if len(f) >= 8:
|
if len(f) >= 8:
|
||||||
if f[7].startswith("CONTENTS"):
|
if f[7].startswith("CONTENTS"):
|
||||||
sh_offset = int("0x" + f[5], 16)
|
sh_offset = int("0x" + f[5], 16)
|
||||||
sh_size = int("0x" + f[2], 16)
|
sh_size = int("0x" + f[2], 16)
|
||||||
if sh_offset + sh_size > new_len:
|
if sh_offset + sh_size > new_len:
|
||||||
new_len = sh_offset + sh_size
|
new_len = sh_offset + sh_size
|
||||||
# eprint("sh_offset=", sh_offset, "sh_size=", sh_size, "f=", f, "\n")
|
##print sh_offset, sh_size, f
|
||||||
if new_len > len(eh):
|
if new_len > len(eh):
|
||||||
# eprint("dump_fn=", dump_fn, "new_len=", new_len, "\n")
|
##print dump_fn, new_len
|
||||||
return eh, idata[:new_len-len(eh)]
|
return eh, idata[:new_len-len(eh)]
|
||||||
return eh, idata
|
return eh, idata
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user