From c6922cc644851560059813a45049118eee21ae9c Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 15 Dec 2024 17:00:53 +0100 Subject: [PATCH] Fix context history with disabled context-sections (#2616) When gdb is started and context is disabled by clearing `context-sections` before a context output was ever issued, the context history failed to handle the empty history. It assumed that there would always be data in one of the sections after running the context command. --- pwndbg/commands/context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index 2e614c86a..6294eaf0e 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -337,6 +337,8 @@ def serve_context_history(function: Callable[P, List[str]]) -> Callable[P, List[ def history_handle_unchanged_contents() -> None: + if not context_history: + return longest_history = max(len(h) for h in context_history.values()) for section_name, history in context_history.items(): # Duplicate the last entry if it is the same as the previous one