(addr, count, partial=False)
return bytearray(result)
read(addr, count, partial=False) -> bytearray

    Read memory from the program being debugged.

    Arguments:
        addr(int): Address to read
        count(int): Number of bytes to read
        partial(bool): Whether less than ``count`` bytes can be returned

    Returns:
        :class:`bytearray`: The memory at the specified address,
        or ``None``.
read(addr, count, partial=False) -> bytearray
read ( addr count partial = False ) - > bytearray
def read(addr, count, partial=False):
    """read(addr, count, partial=False) -> bytearray

    Read memory from the program being debugged.

    Arguments:
        addr(int): Address to read
        count(int): Number of bytes to read
        partial(bool): Whether less than ``count`` bytes can be returned

    Returns:
        :class:`bytearray`: The memory at the specified address,
        or ``None``.
    """
    result = b''
    count = max(int(count), 0)

    try:
        result = gdb.selected_inferior().read_memory(addr, count)
    except gdb.error as e:
        if not partial:
            raise

        if not hasattr(e, 'message'):
            e.message=str(e)

        stop_addr = int(e.message.split()[-1], 0)
        if stop_addr != addr:
            return read(addr, stop_addr-addr)

        # QEMU will return the start address as the failed
        # read address.  Try moving back a few pages at a time.
        stop_addr = addr + count

        # Move the stop address down to the previous page boundary
        stop_addr &= PAGE_MASK
        while stop_addr > addr:
            result = read(addr, stop_addr-addr)

            if result:
                return result

            # Move down by another page
            stop_addr -= PAGE_SIZE

    return bytearray(result)
def read ( addr , count , partial = False ) : result = b'' count = max ( int ( count ) , 0 ) try : result = gdb . selected_inferior ( ) . read_memory ( addr , count ) except gdb . error as e : if not partial : raise if not hasattr ( e , 'message' ) : e . message = str ( e ) stop_addr = int ( e . message . split ( ) [ - 1 ] , 0 ) if stop_addr != addr : return read ( addr , stop_addr - addr ) # QEMU will return the start address as the failed # read address.  Try moving back a few pages at a time. stop_addr = addr + count # Move the stop address down to the previous page boundary stop_addr &= PAGE_MASK while stop_addr > addr : result = read ( addr , stop_addr - addr ) if result : return result # Move down by another page stop_addr -= PAGE_SIZE return bytearray ( result )