memory ¤
Functions:
-
read
–read(addr, count, partial=False) -> bytearray
-
readtype
–readtype(type, addr) -> int
-
write
–write(addr, data)
-
peek
–peek(address) -> bytearray
-
is_readable_address
–is_readable_address(address) -> bool
-
poke
–poke(address)
-
string
–Reads a null-terminated string from memory.
-
byte
–byte(addr) -> int
-
uchar
–uchar(addr) -> int
-
ushort
–ushort(addr) -> int
-
uint
–uint(addr) -> int
-
pvoid
–pvoid(addr) -> int
-
u8
–u8(addr) -> int
-
u16
–u16(addr) -> int
-
u32
–u32(addr) -> int
-
u64
–u64(addr) -> int
-
u
–u(addr, size=None) -> int
-
s8
–s8(addr) -> int
-
s16
–s16(addr) -> int
-
s32
–s32(addr) -> int
-
s64
–s64(addr) -> int
-
cast_pointer
–Create a Value containing given address and cast it to the pointer of specified type
-
get_typed_pointer
–Look up a type by name if necessary and return a Value of addr cast to that type
-
get_typed_pointer_value
–Read the pointer value of addr cast to type specified by type_name
-
find_upper_boundary
–find_upper_boundary(addr, max_pages=1024) -> int
-
find_lower_boundary
–find_lower_boundary(addr, max_pages=1024) -> int
-
update_min_addr
– -
fetch_struct_as_dictionary
– -
pack_struct_into_dictionary
– -
convert_pwndbg_value_to_python_value
– -
resolve_renamed_struct_field
–
Attributes:
-
GdbDict
– -
MMAP_MIN_ADDR
–
read ¤
read(addr, count, partial=False) -> bytearray
Read memory from the program being debugged.
Parameters:
-
addr
(int
) –Address to read
-
count
(int
) –Number of bytes to read
-
partial
(bool
, default:False
) –Whether less than
count
bytes can be returned
Returns:
-
bytearray
–bytearray
The memory at the specified address, -
bytearray
–or
None
.
readtype ¤
readtype(type: Type, addr: int) -> int
readtype(type, addr) -> int
Reads an integer-type (e.g. uint64
) and returns a Python native integer representation of the same.
Parameters:
-
type
(Type
) –GDB type to read
-
addr
(int
) –Address at which the value to be read resides
Returns:
-
int
–int
write ¤
write(addr, data)
Writes data into the memory of the process being debugged.
Parameters:
-
addr
(int
) –Address to write
-
data
(str | bytes | bytearray
) –Data to write
peek ¤
peek(address) -> bytearray
Read one byte from the specified address.
Parameters:
-
address
(int
) –Address to read
Returns:
-
bytearray | None
–bytearray
A single byte of data, orNone
if the -
bytearray | None
–address cannot be read.
is_readable_address ¤
is_readable_address(address) -> bool
Check if the address can be read by GDB.
Parameters:
-
address
(int
) –Address to read
Returns:
-
bool
–bool
: Whether the address is readable.
poke ¤
poke(address)
Checks whether an address is writable.
Parameters:
-
address
(int
) –Address to check
Returns:
-
bool
–bool
: Whether the address is writable.
string ¤
Reads a null-terminated string from memory.
Parameters:
-
addr
(int
) –Address to read from
-
max
(int
, default:4096
) –Maximum string length (default 4096)
Returns:
-
bytearray
–An empty bytearray, or a NULL-terminated bytearray.
ushort ¤
ushort(addr) -> int
Read one unisgned short
at the specified address.
u ¤
u(addr, size=None) -> int
Read one unsigned
integer from the specified address, with the bit-width specified by size
, which defaults to the pointer width.
cast_pointer ¤
Create a Value containing given address and cast it to the pointer of specified type
get_typed_pointer ¤
Look up a type by name if necessary and return a Value of addr cast to that type
get_typed_pointer_value ¤
Read the pointer value of addr cast to type specified by type_name
find_upper_boundary ¤
find_upper_boundary(addr, max_pages=1024) -> int
Brute-force search the upper boundary of a memory mapping, by reading the first byte of each page, until an unmapped page is found.
find_lower_boundary ¤
find_lower_boundary(addr, max_pages=1024) -> int
Brute-force search the lower boundary of a memory mapping, by reading the first byte of each page, until an unmapped page is found.
fetch_struct_as_dictionary ¤
fetch_struct_as_dictionary(
struct_name: str,
struct_address: int | Value,
include_only_fields: set[str] | None = None,
exclude_fields: set[str] | None = None,
) -> GdbDict
pack_struct_into_dictionary ¤
pack_struct_into_dictionary(
fetched_struct: Value,
include_only_fields: set[str] | None = None,
exclude_fields: set[str] | None = None,
) -> GdbDict