Skip to content

Commit

Permalink
Add a maximum size for preview to print-format config settings (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
therealdreg authored Jul 2, 2022
1 parent 7c0a1ee commit 08c06b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -4612,6 +4612,7 @@ class PrintFormatCommand(GenericCommand):

def __init__(self) -> None:
super().__init__(complete=gdb.COMPLETE_LOCATION)
self["max_size_preview"] = (10, "max size preview of bytes")
return

@property
Expand Down Expand Up @@ -4654,7 +4655,7 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:

if args.lang == "bytearray":
data = gef.memory.read(start_addr, args.length)
preview = str(data[0:10])
preview = str(data[0:self["max_size_preview"]])
out = f"Saved data {preview}... in '{gef_convenience(data)}'"
elif args.lang == "py":
out = f"buf = [{sdata}]"
Expand Down

0 comments on commit 08c06b8

Please sign in to comment.