remove handling of the case where we don't have alignof in older gdbs

pull/1857/head
smiley 2 years ago committed by Disconnect3d
parent 46fe24a1f0
commit 58120b47f2

@ -968,14 +968,7 @@ class GlibcMemoryAllocator(pwndbg.heap.heap.MemoryAllocator):
# See https://elixir.bootlin.com/glibc/glibc-2.26/source/sysdeps/i386/malloc-alignment.h#L22
return 16
# See https://elixir.bootlin.com/glibc/glibc-2.37/source/sysdeps/generic/malloc-alignment.h#L27
if hasattr(gdb.Type, "alignof"):
long_double_alignment = pwndbg.gdblib.typeinfo.lookup_types("long double").alignof
else:
# alignof doesn't available in GDB < 8.2 (https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=gdb/NEWS;hb=gdb-8.2-release)
# Hardcoded return correct MALLOC_ALIGNMENT for powerpc
# TODO: This will be wrong if there's another architecture similar to powerpc
# TODO: We can remove this when we drop supports for GDB < 8.2
return 16 if pwndbg.gdblib.arch.current == "powerpc" else 2 * self.size_sz
long_double_alignment = pwndbg.gdblib.typeinfo.lookup_types("long double").alignof
return (
long_double_alignment if 2 * self.size_sz < long_double_alignment else 2 * self.size_sz
)

Loading…
Cancel
Save