Disable debug prints

pull/17/head
Zach Riggle 11 years ago
parent c4f2a6ea4d
commit 2d9cee6f1d

@ -4,6 +4,7 @@
Compatibility functionality for Windbg users. Compatibility functionality for Windbg users.
""" """
import codecs import codecs
import sys
import math import math
import gdb import gdb
@ -29,7 +30,7 @@ def db(address, count=64):
Starting at the specified address, dump N bytes Starting at the specified address, dump N bytes
(default 64). (default 64).
""" """
return dX(1, int(address), int(count)) return dX(1, (address), (count))
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@ -38,7 +39,7 @@ def dw(address, count=32):
Starting at the specified address, dump N words Starting at the specified address, dump N words
(default 32). (default 32).
""" """
return dX(2, int(address), int(count)) return dX(2, (address), (count))
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@ -47,7 +48,7 @@ def dd(address, count=16):
Starting at the specified address, dump N dwords Starting at the specified address, dump N dwords
(default 16). (default 16).
""" """
return dX(4, int(address), int(count)) return dX(4, (address), (count))
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@ -56,7 +57,7 @@ def dq(address, count=8):
Starting at the specified address, dump N qwords Starting at the specified address, dump N qwords
(default 8). (default 8).
""" """
return dX(8, int(address), int(count)) return dX(8, (address), (count))
@pwndbg.commands.ParsedCommand @pwndbg.commands.ParsedCommand
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
@ -72,6 +73,7 @@ def dX(size, address, count, to_string=False):
for i in range(count): for i in range(count):
try: try:
gval = pwndbg.memory.poi(type, address + i * size) gval = pwndbg.memory.poi(type, address + i * size)
# print(str(gval))
values.append(int(gval)) values.append(int(gval))
except gdb.MemoryError: except gdb.MemoryError:
break break
@ -81,6 +83,8 @@ def dX(size, address, count, to_string=False):
rows = [values[i*row_sz:(i+1)*row_sz] for i in range(n_rows)] rows = [values[i*row_sz:(i+1)*row_sz] for i in range(n_rows)]
lines = [] lines = []
# sys.stdout.write(repr(rows) + '\n')
for i, row in enumerate(rows): for i, row in enumerate(rows):
if not row: if not row:
continue continue
@ -262,4 +266,4 @@ def u(where=None, n=5):
@pwndbg.commands.Command @pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning @pwndbg.commands.OnlyWhenRunning
def k(): def k():
gdb.execute('bt') gdb.execute('bt')

Loading…
Cancel
Save