# Buggy code
def dump(self, instruction):
    ins = instruction
    rv = []
    rv.append("%s %s" % (ins.mnemonic, ins.op_str))

    for i, group in enumerate(ins.groups):
        rv.append("   groups[%i]   = %s" % (i, groups.get(group, group)))

    rv.append("           next = %#x" % (ins.next))
    rv.append("      condition = %r" % (ins.condition))

    for i, op in enumerate(ins.operands):
        rv.append("   operands[%i] = %s" % (i, ops.get(op.type, op.type)))
        rv.append("       access   = %s" % (access.get(op.access, op.access)))

        if op.int is not None:
            rv.append("            int = %#x" % (op.int))
        if op.symbol is not None:
            rv.append("            sym = %s" % (op.symbol))
        if op.str is not None:
            rv.append("            str = %s" % (op.str))

    return "\n".join(rv)


# Traceback (gdb.MemoryError)
Traceback (most recent call last):
File "/home/dc/pwndbg/pwndbg/commands/__init__.py", line 135, in __call__
return self.function(*args, **kwargs)
File "/home/dc/pwndbg/pwndbg/commands/__init__.py", line 226, in _OnlyWhenRunning
return function(*a, **kw)
File "/home/dc/pwndbg/pwndbg/commands/context.py", line 88, in context
result.extend(func())
File "/home/dc/pwndbg/pwndbg/commands/context.py", line 100, in context_regs
return [pwndbg.ui.banner("registers")] + get_regs()
File "/home/dc/pwndbg/pwndbg/commands/context.py", line 144, in get_regs
desc = pwndbg.chain.format(value)
File "/home/dc/pwndbg/pwndbg/chain.py", line 122, in format
enhanced = pwndbg.enhance.enhance(chain[-2] + offset, code=code)
File "/home/dc/pwndbg/pwndbg/enhance.py", line 102, in enhance
instr = pwndbg.disasm.one(value)
File "/home/dc/pwndbg/pwndbg/disasm/__init__.py", line 115, in one
for insn in get(address, 1):
File "/home/dc/pwndbg/pwndbg/disasm/__init__.py", line 135, in get
i = get_one_instruction(address)
File "/home/dc/pwndbg/pwndbg/memoize.py", line 48, in __call__
value = self.func(*args, **kwargs)
File "/home/dc/pwndbg/pwndbg/disasm/__init__.py", line 107, in get_one_instruction
pwndbg.disasm.arch.DisassemblyAssistant.enhance(ins)
File "/home/dc/pwndbg/pwndbg/disasm/arch.py", line 55, in enhance
enhancer.enhance_next(instruction)
File "/home/dc/pwndbg/pwndbg/disasm/arch.py", line 111, in enhance_next
instruction.target = self.next(instruction, call=True)
File "/home/dc/pwndbg/pwndbg/disasm/x86.py", line 112, in next
return super(DisassemblyAssistant, self).next(instruction, call)
File "/home/dc/pwndbg/pwndbg/disasm/arch.py", line 150, in next
addr = int(pwndbg.memory.poi(pwndbg.typeinfo.ppvoid, addr))
File "/home/dc/pwndbg/pwndbg/inthook.py", line 40, in __new__
value = value.cast(pwndbg.typeinfo.ulong)
gdb.MemoryError: Cannot access memory at address 0x30

# Fixed code
def dump(self, instruction):
    """
    Debug-only method.
    """
    ins = instruction
    rv = []
    rv.append("%s %s" % (ins.mnemonic, ins.op_str))

    for i, group in enumerate(ins.groups):
        rv.append("   groups[%i]   = %s" % (i, groups.get(group, group)))

    rv.append("           next = %#x" % (ins.next))
    rv.append("      condition = %r" % (ins.condition))

    for i, op in enumerate(ins.operands):
        rv.append("   operands[%i] = %s" % (i, ops.get(op.type, op.type)))
        rv.append("       access   = %s" % (access.get(op.access, op.access)))

        if op.int is not None:
            rv.append("            int = %#x" % (op.int))
        if op.symbol is not None:
            rv.append("            sym = %s" % (op.symbol))
        if op.str is not None:
            rv.append("            str = %s" % (op.str))

    return "\n".join(rv)