diff --git a/pwndbg/commands/heap.py b/pwndbg/commands/heap.py index b44285f0..3b927431 100644 --- a/pwndbg/commands/heap.py +++ b/pwndbg/commands/heap.py @@ -12,9 +12,7 @@ import pwndbg.glibc import pwndbg.lib.heap.helpers from pwndbg.color import generateColorFunction from pwndbg.color import message -from pwndbg.commands.config import extend_value_with_default -from pwndbg.commands.config import get_config_parameters -from pwndbg.commands.config import print_row +from pwndbg.commands.config import display_config from pwndbg.heap.ptmalloc import Chunk @@ -1250,26 +1248,8 @@ parser.add_argument( @pwndbg.commands.ArgparsedCommand(parser) def heap_config(filter_pattern): - values = get_config_parameters("heap", filter_pattern) + display_config(filter_pattern, "heap") - if not values: - print(message.hint('No config parameter found with filter "{}"'.format(filter_pattern))) - return - - longest_optname = max(map(len, [v.optname for v in values])) - longest_value = max( - map(len, [extend_value_with_default(repr(v.value), repr(v.default)) for v in values]) - ) - - header = print_row("Name", "Value", "Def", "Documentation", longest_optname, longest_value) - print("-" * (len(header))) - - for v in sorted(values): - print_row( - v.optname, repr(v.value), repr(v.default), v.docstring, longest_optname, longest_value - ) - - print(message.hint("You can set config variable with `set `")) print( message.hint( "Some config(e.g. main_arena) will only working when resolve-heap-via-heuristic is `True`" diff --git a/tests/gdb-tests/tests/test_command_config.py b/tests/gdb-tests/tests/test_command_config.py index 89945b36..f7e99153 100644 --- a/tests/gdb-tests/tests/test_command_config.py +++ b/tests/gdb-tests/tests/test_command_config.py @@ -8,3 +8,6 @@ def test_config(): gdb.execute("set banner-separator #") # \u2500 is ─ assert "'#' ('\u2500')" in gdb.execute("theme", to_string=True) + + gdb.execute("set global-max-fast 0x80") + assert "'0x80' ('0')" in gdb.execute("heap_config", to_string=True)