From dd81b327b861e875ab356e72f23c5db62eb1a77f Mon Sep 17 00:00:00 2001 From: Giuseppe Scelsi Date: Thu, 27 Sep 2018 13:35:16 +1000 Subject: [PATCH 1/2] Fix broken "list ." command --- trepan/processor/cmdlist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trepan/processor/cmdlist.py b/trepan/processor/cmdlist.py index 8d0a84a7..57c6ddbf 100644 --- a/trepan/processor/cmdlist.py +++ b/trepan/processor/cmdlist.py @@ -30,7 +30,8 @@ def parse_list_cmd(proc, args, listsize=10): if text in frozenset(('', '.', '+', '-')): if text == '.': location = resolve_location(proc, '.') - return location.path, location.line_number, listsize + filename = location.path + first = location.line_number - (listsize // 2) else: if proc.list_lineno is None: proc.errmsg("Don't have previous list location") From 1bdb0490b9123910afe6658e9fb05314376db262 Mon Sep 17 00:00:00 2001 From: Giuseppe Scelsi Date: Thu, 27 Sep 2018 13:35:46 +1000 Subject: [PATCH 2/2] Fix line count for "list " commands --- trepan/processor/cmdlist.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trepan/processor/cmdlist.py b/trepan/processor/cmdlist.py index 57c6ddbf..869717b5 100644 --- a/trepan/processor/cmdlist.py +++ b/trepan/processor/cmdlist.py @@ -70,7 +70,7 @@ def parse_list_cmd(proc, args, listsize=10): if not location: return INVALID_PARSE_LIST last = location.line_number - first = max(1, last - listsize) + first = max(1, last - listsize + 1) return location.path, first, last elif isinstance(list_range.first, int): first = list_range.first @@ -81,7 +81,7 @@ def parse_list_cmd(proc, args, listsize=10): last = location.line_number if last < first: # Treat as a count rather than an absolute location - last = first + last + last = first + last - 1 return location.path, first, last else: # First is location. Last may be empty or a number @@ -98,10 +98,10 @@ def parse_list_cmd(proc, args, listsize=10): assert last[0] == '+' last = first + int(last[1:]) elif not last: - last = first + listsize + last = first + listsize - 1 elif last < first: # Treat as a count rather than an absolute location - last = first + last + last = first + last - 1 return location.path, first, last pass