From f11afe2c6885f6d222642e03c1450d14697dee09 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Thu, 16 Sep 2021 00:37:40 +0200 Subject: [PATCH] Fix get_highlight_source line splitting TL;DR: With .splitlines() we splitted over universal splitlines which did not correspond to GDB's target code line splitting... As a result we got `context code` to produce bogus out of sync lines that didn't correspond to GDB's `line` command. See also https://docs.python.org/3/library/stdtypes.html#str.splitlines --- pwndbg/commands/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index caa2b9802..64a8f932a 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -457,7 +457,7 @@ def get_highlight_source(filename): if pwndbg.config.syntax_highlight: source = H.syntax_highlight(source, filename) - source_lines = source.splitlines() + source_lines = source.split('\n') source_lines = tuple(line.rstrip() for line in source_lines) return source_lines