Skip to content

structs ¤

Classes:

  • c_pvoid

    Represents a pointer.

  • c_size_t

    Represents a size_t.

  • FakeGDBField

    Fake gdb.Field for compatibility

  • CStruct2GDB
  • c_malloc_state_2_26

    This class represents malloc_state struct for GLIBC < 2.27 as a ctypes struct.

  • c_malloc_state_2_12

    This class represents malloc_state struct for GLIBC < 2.22 as a ctypes struct.

  • c_malloc_state_2_27

    This class represents malloc_state struct for GLIBC >= 2.27 as a ctypes struct.

  • MallocState

    This class represents malloc_state struct with interface compatible with pwndbg.dbg_mod.Value.

  • c_heap_info

    This class represents heap_info struct as a ctypes struct.

  • HeapInfo

    This class represents heap_info struct with interface compatible with pwndbg.dbg_mod.Value.

  • c_malloc_chunk

    This class represents malloc_chunk struct as a ctypes struct.

  • MallocChunk

    This class represents malloc_chunk struct with interface compatible with pwndbg.dbg_mod.Value.

  • c_tcache_perthread_struct_2_29

    This class represents tcache_perthread_struct for GLIBC < 2.30 as a ctypes struct.

  • c_tcache_perthread_struct_2_30

    This class represents the tcache_perthread_struct for GLIBC >= 2.30 as a ctypes struct.

  • TcachePerthreadStruct

    This class represents tcache_perthread_struct with interface compatible with pwndbg.dbg_mod.Value.

  • c_tcache_entry_2_28

    This class represents the tcache_entry struct for GLIBC < 2.29 as a ctypes struct.

  • c_tcache_entry_2_29

    This class represents the tcache_entry struct for GLIBC >= 2.29 as a ctypes struct.

  • TcacheEntry

    This class represents the tcache_entry struct with interface compatible with pwndbg.dbg_mod.Value.

  • c_malloc_par_2_23

    This class represents the malloc_par struct for GLIBC < 2.24 as a ctypes struct.

  • c_malloc_par_2_12

    This class represents the malloc_par struct for GLIBC < 2.15 as a ctypes struct.

  • c_malloc_par_2_24

    This class represents the malloc_par struct for GLIBC >= 2.24 as a ctypes struct.

  • c_malloc_par_2_26

    This class represents the malloc_par struct for GLIBC >= 2.26 as a ctypes struct.

  • c_malloc_par_2_35

    This class represents the malloc_par struct for GLIBC >= 2.35 as a ctypes struct.

  • MallocPar

    This class represents the malloc_par struct with interface compatible with pwndbg.dbg_mod.Value.

Functions:

Attributes:

GLIBC_VERSION module-attribute ¤

GLIBC_VERSION = get_version()

SIZE_SZ module-attribute ¤

SIZE_SZ = ptrsize

MINSIZE module-attribute ¤

MINSIZE = ptrsize * 4

MALLOC_ALIGN module-attribute ¤

MALLOC_ALIGN = 16

long_double_alignment module-attribute ¤

long_double_alignment = alignof

MALLOC_ALIGN_MASK module-attribute ¤

MALLOC_ALIGN_MASK = MALLOC_ALIGN - 1

MAX_FAST_SIZE module-attribute ¤

MAX_FAST_SIZE = 80 * SIZE_SZ // 4

NBINS module-attribute ¤

NBINS = 128

BINMAPSIZE module-attribute ¤

BINMAPSIZE = 4

TCACHE_MAX_BINS module-attribute ¤

TCACHE_MAX_BINS = 64

NFASTBINS module-attribute ¤

PTR module-attribute ¤

PTR = c_uint32

SIZE_T module-attribute ¤

SIZE_T = c_uint32

DEFAULT_TOP_PAD module-attribute ¤

DEFAULT_TOP_PAD = 131072

DEFAULT_MMAP_MAX module-attribute ¤

DEFAULT_MMAP_MAX = 65536

DEFAULT_MMAP_THRESHOLD module-attribute ¤

DEFAULT_MMAP_THRESHOLD = 128 * 1024

DEFAULT_TRIM_THRESHOLD module-attribute ¤

DEFAULT_TRIM_THRESHOLD = 128 * 1024

DEFAULT_PAGE_SIZE module-attribute ¤

DEFAULT_PAGE_SIZE = 4096

TCACHE_FILL_COUNT module-attribute ¤

TCACHE_FILL_COUNT = 7

C2GDB_MAPPING module-attribute ¤

C2GDB_MAPPING = {
    c_char: char,
    c_int8: int8,
    c_int16: int16,
    c_int32: int32,
    c_int64: int64,
    c_uint8: uint8,
    c_uint16: uint16,
    c_uint32: uint32,
    c_uint64: uint64,
    c_pvoid: pvoid,
    c_size_t: size_t,
}

DEFAULT_MP_ module-attribute ¤

DEFAULT_MP_ = _c_struct()

c_pvoid ¤

Bases: PTR

Represents a pointer.

c_size_t ¤

Bases: SIZE_T

Represents a size_t.

FakeGDBField ¤

FakeGDBField(
    bitpos: int,
    name: str | None,
    type,
    parent_type,
    enumval: int | None = None,
    artificial: bool = False,
    is_base_class: bool = False,
    bitsize: int = 0,
)

Fake gdb.Field for compatibility

Attributes:

bitpos instance-attribute ¤

bitpos = bitpos

name instance-attribute ¤

name = name

type instance-attribute ¤

type = type

parent_type instance-attribute ¤

parent_type = parent_type

enumval instance-attribute ¤

enumval = enumval

artificial instance-attribute ¤

artificial = artificial

is_base_class instance-attribute ¤

is_base_class = is_base_class

bitsize instance-attribute ¤

bitsize = bitsize

CStruct2GDB ¤

CStruct2GDB(address: int)

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_malloc_state_2_26 ¤

Bases: Structure

This class represents malloc_state struct for GLIBC < 2.27 as a ctypes struct.

https://github.com/bminor/glibc/blob/1c9a5c270d8b66f30dcfaf1cb2d6cf39d3e18369/malloc/malloc.c#L1678-L1716

struct malloc_state { /* Serialize access. */ __libc_lock_define (, mutex);

/* Flags (formerly in max_fast).  */
int flags;

/* Fastbins */
mfastbinptr fastbinsY[NFASTBINS];

/* Base of the topmost chunk -- not otherwise kept in a bin */
mchunkptr top;

/* The remainder from the most recent split of a small request */
mchunkptr last_remainder;

/* Normal bins packed as described above */
mchunkptr bins[NBINS * 2 - 2];

/* Bitmap of bins */
unsigned int binmap[BINMAPSIZE];

/* Linked list */
struct malloc_state *next;

/* Linked list for free arenas.  Access to this field is serialized
    by free_list_lock in arena.c.  */
struct malloc_state *next_free;

/* Number of threads attached to this arena.  0 if the arena is on
    the free list.  Access to this field is serialized by
    free_list_lock in arena.c.  */
INTERNAL_SIZE_T attached_threads;

/* Memory allocated from the system in this arena.  */
INTERNAL_SIZE_T system_mem;
INTERNAL_SIZE_T max_system_mem;

};

c_malloc_state_2_12 ¤

Bases: Structure

This class represents malloc_state struct for GLIBC < 2.22 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.12/malloc/malloc.c#L2362-L2400

struct malloc_state { /* Serialize access. */ mutex_t mutex;

/* Flags (formerly in max_fast). */ int flags;

if THREAD_STATS¤

/* Statistics for locking. Only used if THREAD_STATS is defined. */ long stat_lock_direct, stat_lock_loop, stat_lock_wait;

endif¤

/* Fastbins */ mfastbinptr fastbinsY[NFASTBINS];

/* Base of the topmost chunk -- not otherwise kept in a bin */ mchunkptr top;

/* The remainder from the most recent split of a small request */ mchunkptr last_remainder;

/* Normal bins packed as described above */ mchunkptr bins[NBINS * 2 - 2];

/* Bitmap of bins */ unsigned int binmap[BINMAPSIZE];

/* Linked list */ struct malloc_state *next;

ifdef PER_THREAD¤

/* Linked list for free arenas. */ struct malloc_state *next_free;

endif¤

/* Memory allocated from the system in this arena. */ INTERNAL_SIZE_T system_mem; INTERNAL_SIZE_T max_system_mem; };

c_malloc_state_2_27 ¤

Bases: Structure

This class represents malloc_state struct for GLIBC >= 2.27 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/malloc.c#L1831

struct malloc_state { /* Serialize access. */ __libc_lock_define (, mutex);

/* Flags (formerly in max_fast).  */
int flags;

/* Set if the fastbin chunks contain recently inserted free blocks.  */
/* Note this is a bool but not all targets support atomics on booleans.  */
int have_fastchunks;

/* Fastbins */
mfastbinptr fastbinsY[NFASTBINS];

/* Base of the topmost chunk -- not otherwise kept in a bin */
mchunkptr top;

/* The remainder from the most recent split of a small request */
mchunkptr last_remainder;

/* Normal bins packed as described above */
mchunkptr bins[NBINS * 2 - 2];

/* Bitmap of bins */
unsigned int binmap[BINMAPSIZE];

/* Linked list */
struct malloc_state *next;

/* Linked list for free arenas.  Access to this field is serialized
    by free_list_lock in arena.c.  */
struct malloc_state *next_free;

/* Number of threads attached to this arena.  0 if the arena is on
    the free list.  Access to this field is serialized by
    free_list_lock in arena.c.  */
INTERNAL_SIZE_T attached_threads;

/* Memory allocated from the system in this arena.  */
INTERNAL_SIZE_T system_mem;
INTERNAL_SIZE_T max_system_mem;

};

MallocState ¤

MallocState(address: int)

Bases: CStruct2GDB

This class represents malloc_state struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_heap_info ¤

Bases: Structure

This class represents heap_info struct as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/arena.c#L53

typedef struct _heap_info { mstate ar_ptr; /* Arena for this heap. / struct _heap_info *prev; / Previous heap. / size_t size; / Current size in bytes. / size_t mprotect_size; / Size in bytes that has been mprotected PROT_READ|PROT_WRITE. / / Make sure the following data is properly aligned, particularly that sizeof (heap_info) + 2 * SIZE_SZ is a multiple of MALLOC_ALIGNMENT. */ char pad[-6 * SIZE_SZ & MALLOC_ALIGN_MASK]; } heap_info;

HeapInfo ¤

HeapInfo(address: int)

Bases: CStruct2GDB

This class represents heap_info struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_malloc_chunk ¤

Bases: Structure

This class represents malloc_chunk struct as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/malloc.c#L1154

struct malloc_chunk {

INTERNAL_SIZE_T      mchunk_prev_size;  /* Size of previous chunk (if free).  */
INTERNAL_SIZE_T      mchunk_size;       /* Size in bytes, including overhead. */

struct malloc_chunk* fd;         /* double links -- used only if free. */
struct malloc_chunk* bk;

/* Only used for large blocks: pointer to next larger size.  */
struct malloc_chunk* fd_nextsize; /* double links -- used only if free. */
struct malloc_chunk* bk_nextsize;

};

MallocChunk ¤

MallocChunk(address: int)

Bases: CStruct2GDB

This class represents malloc_chunk struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_tcache_perthread_struct_2_29 ¤

Bases: Structure

This class represents tcache_perthread_struct for GLIBC < 2.30 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.29/malloc/malloc.c#L2916

typedef struct tcache_perthread_struct { char counts[TCACHE_MAX_BINS]; tcache_entry *entries[TCACHE_MAX_BINS]; } tcache_perthread_struct;

c_tcache_perthread_struct_2_30 ¤

Bases: Structure

This class represents the tcache_perthread_struct for GLIBC >= 2.30 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/malloc.c#L3025

typedef struct tcache_perthread_struct { uint16_t counts[TCACHE_MAX_BINS]; tcache_entry *entries[TCACHE_MAX_BINS]; } tcache_perthread_struct;

TcachePerthreadStruct ¤

TcachePerthreadStruct(address: int)

Bases: CStruct2GDB

This class represents tcache_perthread_struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_tcache_entry_2_28 ¤

Bases: Structure

This class represents the tcache_entry struct for GLIBC < 2.29 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.28/malloc/malloc.c#L2888

typedef struct tcache_entry { struct tcache_entry *next; } tcache_entry;

c_tcache_entry_2_29 ¤

Bases: Structure

This class represents the tcache_entry struct for GLIBC >= 2.29 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/malloc.c#L3013

typedef struct tcache_entry { struct tcache_entry next; / This field exists to detect double frees. */ uintptr_t key; } tcache_entry;

TcacheEntry ¤

TcacheEntry(address: int)

Bases: CStruct2GDB

This class represents the tcache_entry struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

c_malloc_par_2_23 ¤

Bases: Structure

This class represents the malloc_par struct for GLIBC < 2.24 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.23/malloc/malloc.c#L1726

struct malloc_par { /* Tunable parameters */ unsigned long trim_threshold; INTERNAL_SIZE_T top_pad; INTERNAL_SIZE_T mmap_threshold; INTERNAL_SIZE_T arena_test; INTERNAL_SIZE_T arena_max;

/* Memory map support / int n_mmaps; int n_mmaps_max; int max_n_mmaps; / the mmap_threshold is dynamic, until the user sets it manually, at which point we need to disable any dynamic behavior. */ int no_dyn_threshold;

/* Statistics / INTERNAL_SIZE_T mmapped_mem; /*INTERNAL_SIZE_T sbrked_mem;/ /INTERNAL_SIZE_T max_sbrked_mem;/ INTERNAL_SIZE_T max_mmapped_mem; INTERNAL_SIZE_T max_total_mem; /* only kept for NO_THREADS */

/* First address handed out by MORECORE/sbrk. */ char *sbrk_base; };

c_malloc_par_2_12 ¤

Bases: Structure

This class represents the malloc_par struct for GLIBC < 2.15 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.12/malloc/malloc.c#L2402-L2433

struct malloc_par { /* Tunable parameters */ unsigned long trim_threshold; INTERNAL_SIZE_T top_pad; INTERNAL_SIZE_T mmap_threshold;

ifdef PER_THREAD¤

INTERNAL_SIZE_T arena_test; INTERNAL_SIZE_T arena_max;

endif¤

/* Memory map support / int n_mmaps; int n_mmaps_max; int max_n_mmaps; / the mmap_threshold is dynamic, until the user sets it manually, at which point we need to disable any dynamic behavior. */ int no_dyn_threshold;

/* Cache malloc_getpagesize */ unsigned int pagesize;

/* Statistics / INTERNAL_SIZE_T mmapped_mem; /*INTERNAL_SIZE_T sbrked_mem;/ /INTERNAL_SIZE_T max_sbrked_mem;/ INTERNAL_SIZE_T max_mmapped_mem; INTERNAL_SIZE_T max_total_mem; /* only kept for NO_THREADS */

/* First address handed out by MORECORE/sbrk. / char sbrk_base; };

c_malloc_par_2_24 ¤

Bases: Structure

This class represents the malloc_par struct for GLIBC >= 2.24 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.25/malloc/malloc.c#L1690 https://github.com/bminor/glibc/blob/glibc-2.24/malloc/malloc.c#L1719

struct malloc_par { /* Tunable parameters */ unsigned long trim_threshold; INTERNAL_SIZE_T top_pad; INTERNAL_SIZE_T mmap_threshold; INTERNAL_SIZE_T arena_test; INTERNAL_SIZE_T arena_max;

/* Memory map support */
int n_mmaps;
int n_mmaps_max;
int max_n_mmaps;
/* the mmap_threshold is dynamic, until the user sets
    it manually, at which point we need to disable any
    dynamic behavior. */
int no_dyn_threshold;

/* Statistics */
INTERNAL_SIZE_T mmapped_mem;
INTERNAL_SIZE_T max_mmapped_mem;

/* First address handed out by MORECORE/sbrk.  */
char *sbrk_base;

};

c_malloc_par_2_26 ¤

Bases: Structure

This class represents the malloc_par struct for GLIBC >= 2.26 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.34/malloc/malloc.c#L1875

struct malloc_par { /* Tunable parameters */ unsigned long trim_threshold; INTERNAL_SIZE_T top_pad; INTERNAL_SIZE_T mmap_threshold; INTERNAL_SIZE_T arena_test; INTERNAL_SIZE_T arena_max;

/* Memory map support */
int n_mmaps;
int n_mmaps_max;
int max_n_mmaps;
/* the mmap_threshold is dynamic, until the user sets
    it manually, at which point we need to disable any
    dynamic behavior. */
int no_dyn_threshold;

/* Statistics */
INTERNAL_SIZE_T mmapped_mem;
INTERNAL_SIZE_T max_mmapped_mem;

/* First address handed out by MORECORE/sbrk.  */
char *sbrk_base;

if USE_TCACHE¤

/* Maximum number of buckets to use.  */
size_t tcache_bins;
size_t tcache_max_bytes;
/* Maximum number of chunks in each bucket.  */
size_t tcache_count;
/* Maximum number of chunks to remove from the unsorted list, which
    aren't used to prefill the cache.  */
size_t tcache_unsorted_limit;

endif¤

};

c_malloc_par_2_35 ¤

Bases: Structure

This class represents the malloc_par struct for GLIBC >= 2.35 as a ctypes struct.

https://github.com/bminor/glibc/blob/glibc-2.35/malloc/malloc.c#L1874

struct malloc_par { /* Tunable parameters */ unsigned long trim_threshold; INTERNAL_SIZE_T top_pad; INTERNAL_SIZE_T mmap_threshold; INTERNAL_SIZE_T arena_test; INTERNAL_SIZE_T arena_max;

if HAVE_TUNABLES¤

/* Transparent Large Page support.  */
INTERNAL_SIZE_T thp_pagesize;
/* A value different than 0 means to align mmap allocation to hp_pagesize
    add hp_flags on flags.  */
INTERNAL_SIZE_T hp_pagesize;
int hp_flags;

endif¤

/* Memory map support */
int n_mmaps;
int n_mmaps_max;
int max_n_mmaps;
/* the mmap_threshold is dynamic, until the user sets
    it manually, at which point we need to disable any
    dynamic behavior. */
int no_dyn_threshold;

/* Statistics */
INTERNAL_SIZE_T mmapped_mem;
INTERNAL_SIZE_T max_mmapped_mem;

/* First address handed out by MORECORE/sbrk.  */
char *sbrk_base;

if USE_TCACHE¤

/* Maximum number of buckets to use.  */
size_t tcache_bins;
size_t tcache_max_bytes;
/* Maximum number of chunks in each bucket.  */
size_t tcache_count;
/* Maximum number of chunks to remove from the unsorted list, which
    aren't used to prefill the cache.  */
size_t tcache_unsorted_limit;

endif¤

};

MallocPar ¤

MallocPar(address: int)

Bases: CStruct2GDB

This class represents the malloc_par struct with interface compatible with pwndbg.dbg_mod.Value.

Methods:

  • __int__

    Returns the address of the C struct.

  • __getitem__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __getattr__

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • __eq__
  • value_to_human_readable

    Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

  • read_field

    Returns the value of the specified field as a pwndbg.dbg_mod.Value.

  • unqualified

    Returns cls to make it compatible with the gdb.types.has_field() interface.

  • fields

    Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • keys

    Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

  • get_field_address

    Returns the address of the specified field.

  • get_field_offset

    Returns the offset of the specified field.

  • items

    Returns a tuple of (field name, field value) pairs.

  • has_field

    Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

Attributes:

  • sizeof
  • code
  • address
  • type

    Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

sizeof class-attribute instance-attribute ¤

sizeof = sizeof(_c_struct)

code class-attribute instance-attribute ¤

code = STRUCT

address instance-attribute ¤

address = address

type property ¤

type

Returns type(self) to make it compatible with the pwndbg.dbg_mod.Value interface.

__int__ ¤

__int__() -> int

Returns the address of the C struct.

__getitem__ ¤

__getitem__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__getattr__ ¤

__getattr__(key: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

__eq__ ¤

__eq__(other: Any) -> bool

value_to_human_readable ¤

value_to_human_readable() -> str

Returns a string representation of the C struct like pwndbg.dbg_mod.Value does.

read_field ¤

read_field(field: str) -> Value

Returns the value of the specified field as a pwndbg.dbg_mod.Value.

unqualified classmethod ¤

unqualified()

Returns cls to make it compatible with the gdb.types.has_field() interface.

fields classmethod ¤

fields() -> list[FakeGDBField]

Return fields of the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

keys classmethod ¤

keys() -> list[str]

Return a list of the names of the fields in the struct to make it compatible with the pwndbg.dbg_mod.Type interface.

get_field_address ¤

get_field_address(field: str) -> int

Returns the address of the specified field.

get_field_offset classmethod ¤

get_field_offset(field: str) -> int

Returns the offset of the specified field.

items ¤

items() -> tuple[tuple[Any, Any], ...]

Returns a tuple of (field name, field value) pairs.

has_field classmethod ¤

has_field(field: str) -> bool

Checks whether a field exists to make it compatible with the pwndbg.dbg_mod.Type interface.

request2size ¤

request2size(req: int) -> int

fastbin_index ¤

fastbin_index(size: int) -> int