From 509c9b3e9c578ea7eb42a3ff76a05c380e9978d4 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sun, 2 Aug 2015 16:50:19 -0400 Subject: [PATCH] Fix printing of negative values, multiplication vs addition --- pwndbg/commands/windbg.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pwndbg/commands/windbg.py b/pwndbg/commands/windbg.py index a4294e198..93078d7c8 100644 --- a/pwndbg/commands/windbg.py +++ b/pwndbg/commands/windbg.py @@ -69,6 +69,7 @@ def dX(size, address, count, to_string=False): Traditionally, windbg will display 16 bytes of data per line. """ values = [] + address = int(address) & pwndbg.arch.ptrmask type = get_type(size) for i in range(count): try: @@ -88,8 +89,7 @@ def dX(size, address, count, to_string=False): for i, row in enumerate(rows): if not row: continue - - line = [enhex(pwndbg.arch.ptrsize, address + i+16)] + line = [enhex(pwndbg.arch.ptrsize, address + (i*16)),' '] for value in row: line.append(enhex(size, value)) lines.append(' '.join(line)) @@ -100,6 +100,7 @@ def dX(size, address, count, to_string=False): return lines def enhex(size, value): + value = value & pwndbg.arch.ptrmask x = "%x" % abs(value) x = x.rjust(size * 2, '0') return x