Minor fixups (#3483)

* fix typo

* fixups
pull/3486/head
k4lizen 3 days ago committed by GitHub
parent 559ed99542
commit 35585eb5fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1271,12 +1271,12 @@ class GlibcMemoryAllocator(pwndbg.aglib.heap.heap.MemoryAllocator, Generic[TheTy
# this will break expected output during tests, so we skip it # this will break expected output during tests, so we skip it
if ( if (
pwndbg.glibc.get_version() >= (2, 42) pwndbg.glibc.get_version() >= (2, 42)
and not not hasattr(GlibcMemoryAllocator.tcachebins, "tcache_2_42_warning_issued") and not hasattr(GlibcMemoryAllocator.tcachebins, "tcache_2_42_warning_issued")
and os.environ.get("PWNDBG_IN_TEST") is None and os.environ.get("PWNDBG_IN_TEST") is None
): ):
print( print(
message.warn( message.warn(
"Changes to tcache in GLIBC 2.42 have not been fully implemented. " "Support for tcache large bins (a GLIBC 2.42 addition) has not been fully implemented. "
"PR contributions are highly appreciated!" "PR contributions are highly appreciated!"
) )
) )
@ -1632,9 +1632,6 @@ class DebugSymsHeap(GlibcMemoryAllocator[pwndbg.dbg_mod.Type, pwndbg.dbg_mod.Val
"tcache", "tcache",
prefer_static=True, prefer_static=True,
) )
if not tcache_ptr:
tcache_ptr = pwndbg.aglib.symbol.lookup_symbol_addr("tcache", prefer_static=True)
if tcache_ptr and (tcache_addr := pwndbg.aglib.memory.read_pointer_width(tcache_ptr)): if tcache_ptr and (tcache_addr := pwndbg.aglib.memory.read_pointer_width(tcache_ptr)):
tcache = tcache_addr tcache = tcache_addr
elif not self.multithreaded: elif not self.multithreaded:

@ -362,6 +362,7 @@ parser.add_argument("addr", nargs="?", type=int, default=None, help="Address of
@pwndbg.commands.Command(parser, category=CommandCategory.PTMALLOC2) @pwndbg.commands.Command(parser, category=CommandCategory.PTMALLOC2)
@pwndbg.commands.OnlyWithResolvedHeapSyms @pwndbg.commands.OnlyWithResolvedHeapSyms
@pwndbg.commands.OnlyWhenHeapIsInitialized
@pwndbg.commands.OnlyWithTcache @pwndbg.commands.OnlyWithTcache
@pwndbg.commands.OnlyWhenUserspace @pwndbg.commands.OnlyWhenUserspace
def tcache(addr: int | None = None) -> None: def tcache(addr: int | None = None) -> None:
@ -744,6 +745,7 @@ parser.add_argument(
@pwndbg.commands.Command(parser, category=CommandCategory.PTMALLOC2) @pwndbg.commands.Command(parser, category=CommandCategory.PTMALLOC2)
@pwndbg.commands.OnlyWithResolvedHeapSyms @pwndbg.commands.OnlyWithResolvedHeapSyms
@pwndbg.commands.OnlyWhenHeapIsInitialized
@pwndbg.commands.OnlyWithTcache @pwndbg.commands.OnlyWithTcache
@pwndbg.commands.OnlyWhenUserspace @pwndbg.commands.OnlyWhenUserspace
def tcachebins(addr: int | None = None, verbose: bool = False) -> None: def tcachebins(addr: int | None = None, verbose: bool = False) -> None:

@ -77,7 +77,7 @@ async def test_command_elf(ctrl: Controller, binary_name: str, is_pie: bool) ->
pytest.skip("TODO multiarch") pytest.skip("TODO multiarch")
out = (await ctrl.execute_and_capture("elf")).splitlines() out = (await ctrl.execute_and_capture("elf")).splitlines()
# Never versions of gcc emit an additional `.sframe` section. # Newer versions of gcc emit an additional `.sframe` section.
assert len(out) == 25 or len(out) == 26 assert len(out) == 25 or len(out) == 26
# test for default # test for default

Loading…
Cancel
Save