diff options
author | bloodstalker <thabogre@gmail.com> | 2019-06-13 10:38:59 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2019-06-13 10:38:59 +0000 |
commit | 77103c2fad681c3d7a9d575181851117ea8da808 (patch) | |
tree | 9bbba58026f9114c73d0c42bcf58851148071a44 /utils.py | |
parent | update (diff) | |
download | dwasm-77103c2fad681c3d7a9d575181851117ea8da808.tar.gz dwasm-77103c2fad681c3d7a9d575181851117ea8da808.zip |
fixed a bug where string dumps where out of order. custom sections are getting dumped correctly now.
Diffstat (limited to '')
-rw-r--r-- | utils.py | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -280,15 +280,23 @@ def dumpprettysections(sections_list, width, section_name): print(Colors.green + "length: " + Colors.blue + repr(section[2]) + Colors.ENDC) print(Colors.green + "is custom section: " + Colors.blue + repr(section[3]) + Colors.ENDC) print(Colors.green + "name length: " + Colors.blue + repr(section[4]) + Colors.ENDC) - print(Colors.green + "name: " + Colors.blue + section[5] + Colors.ENDC) + + #print(section[5]) + #print(''.join(chr(char) for char in section[5])) + #print( ''.join([chr(char) for char in section[5]])) + + if type(section[5]) == list: + print(Colors.green + "name: " + Colors.blue + ''.join([chr(char) for char in section[5]]) + Colors.ENDC) + else: + print(Colors.green + "name: " + Colors.blue + section[5] + Colors.ENDC) print("\t", end="") for offset in range(0, width): if offset <= 15: - print(Colors.yellow + hex(offset) + " " + Colors.ENDC, end="") + print(Colors.blue + hex(offset) + " " + Colors.ENDC, end="") else: - print(Colors.yellow + hex(offset) + " " + Colors.ENDC, end="") + print(Colors.blue + hex(offset) + " " + Colors.ENDC, end="") print() - print(Colors.yellow + Colors.BOLD + hex(section_offset) + "\t" + Colors.ENDC, end="") + print(Colors.blue + Colors.BOLD + hex(section_offset) + "\t" + Colors.ENDC, end="") for byte in section[6]: if line_counter == width: section_offset += width @@ -296,11 +304,11 @@ def dumpprettysections(sections_list, width, section_name): line_counter = 0 for char in str_list: print(Colors.green + "|" + Colors.ENDC, end="") - if ord(char) < 32: print(" ", end="") + if ord(char) < 32 or ord(char) > 127: print(" ", end="") else: print(char, end="") str_list = [] print() - print(Colors.yellow + Colors.BOLD + hex(section_offset) + "\t" + Colors.ENDC, end="") + print(Colors.blue + Colors.BOLD + hex(section_offset) + "\t" + Colors.ENDC, end="") print(format(byte, '02x') + " ", end="") str_list.append(chr(byte)) line_counter += 1 |