fix ptmalloc2 commands: arena, tcache (#2729)

pull/2736/head
patryk4815 10 months ago committed by GitHub
parent 7d8084188a
commit 7d479e1a21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -155,7 +155,7 @@ class CStruct2GDB:
def __eq__(self, other: Any) -> bool: def __eq__(self, other: Any) -> bool:
return self.address == int(other) return self.address == int(other)
def __str__(self) -> str: def value_to_human_readable(self) -> str:
""" """
Returns a string representation of the C struct like `pwndbg.dbg_mod.Value` does. Returns a string representation of the C struct like `pwndbg.dbg_mod.Value` does.
""" """

@ -292,7 +292,7 @@ def arena(addr: int | None = None) -> None:
) )
) )
print(arena._gdbValue) # Breaks encapsulation, find a better way. print(arena._gdbValue.value_to_human_readable()) # Breaks encapsulation, find a better way.
parser = argparse.ArgumentParser(description="List this process's arenas.") parser = argparse.ArgumentParser(description="List this process's arenas.")
@ -382,13 +382,13 @@ def tcache(addr: int | None = None) -> None:
if tcache: if tcache:
print( print(
message.notice( message.notice(
f"tcache is pointing to: {message.hint(hex(tcache.address))} for thread {message.hint(tid)}" f"tcache is pointing to: {message.hint(hex(int(tcache.address)))} for thread {message.hint(tid)}"
) )
) )
else: else:
print_no_tcache_bins_found_error(tid) print_no_tcache_bins_found_error(tid)
if tcache: if tcache:
print(tcache) print(tcache.value_to_human_readable())
parser = argparse.ArgumentParser(description="Print the mp_ struct's contents.") parser = argparse.ArgumentParser(description="Print the mp_ struct's contents.")

Loading…
Cancel
Save