mirror of https://github.com/pwndbg/pwndbg
Fix heap_config
This commit is contained in:
parent
78065e8ba9
commit
4be16dcd5d
|
@ -12,9 +12,7 @@ import pwndbg.glibc
|
||||||
import pwndbg.lib.heap.helpers
|
import pwndbg.lib.heap.helpers
|
||||||
from pwndbg.color import generateColorFunction
|
from pwndbg.color import generateColorFunction
|
||||||
from pwndbg.color import message
|
from pwndbg.color import message
|
||||||
from pwndbg.commands.config import extend_value_with_default
|
from pwndbg.commands.config import display_config
|
||||||
from pwndbg.commands.config import get_config_parameters
|
|
||||||
from pwndbg.commands.config import print_row
|
|
||||||
from pwndbg.heap.ptmalloc import Chunk
|
from pwndbg.heap.ptmalloc import Chunk
|
||||||
|
|
||||||
|
|
||||||
|
@ -1250,26 +1248,8 @@ parser.add_argument(
|
||||||
|
|
||||||
@pwndbg.commands.ArgparsedCommand(parser)
|
@pwndbg.commands.ArgparsedCommand(parser)
|
||||||
def heap_config(filter_pattern):
|
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 <config-var> <value>`"))
|
|
||||||
print(
|
print(
|
||||||
message.hint(
|
message.hint(
|
||||||
"Some config(e.g. main_arena) will only working when resolve-heap-via-heuristic is `True`"
|
"Some config(e.g. main_arena) will only working when resolve-heap-via-heuristic is `True`"
|
||||||
|
|
|
@ -8,3 +8,6 @@ def test_config():
|
||||||
gdb.execute("set banner-separator #")
|
gdb.execute("set banner-separator #")
|
||||||
# \u2500 is ─
|
# \u2500 is ─
|
||||||
assert "'#' ('\u2500')" in gdb.execute("theme", to_string=True)
|
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)
|
||||||
|
|
Loading…
Reference in New Issue