From e4beff7dacb170298f86bb5bde1946b9b827b174 Mon Sep 17 00:00:00 2001 From: Gilad Arnold Date: Thu, 16 Jul 2015 14:14:03 -0700 Subject: paycheck: Fix printing of operation index while tracing. The block tracer is meant to scan operations in reverse order, to discover the latest operation that writes to a block. Strangely, it only reversed the operation indexes but scanned the actual operations in the original order, which is both incorrect in the general case, but even when it works the printed results are confusing (operations shown with the wrong index). This fixes it. Also some cosmetic changes to pacify the linter. BUG=chromium:510909 TEST=paycheck -B now prints the correct operation indexes. Change-Id: I65c44eeb450c229a2d5251737a0953716e124687 Reviewed-on: https://chromium-review.googlesource.com/286220 Commit-Queue: Gilad Arnold Tested-by: Gilad Arnold Reviewed-by: Don Garrett --- scripts/update_payload/common.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/update_payload/common.py') diff --git a/scripts/update_payload/common.py b/scripts/update_payload/common.py index e8c7c766..1a9b010d 100644 --- a/scripts/update_payload/common.py +++ b/scripts/update_payload/common.py @@ -67,7 +67,6 @@ def IntPackingFmtStr(size, is_unsigned): Raises: PayloadError if something is wrong with the arguments. - """ # Determine the base conversion format. if size == 2: @@ -105,7 +104,6 @@ def Read(file_obj, length, offset=None, hasher=None): Raises: PayloadError if a read error occurred or not enough data was read. - """ if offset is not None: if offset >= 0: @@ -160,9 +158,10 @@ def _ObjNameIter(items, base_name, reverse=False, name_format_func=None): Yields: An iterator whose i-th invocation returns (items[i], name), where name == base_name + '[i]' (with a formatting function optionally applied to it). - """ idx, inc = (len(items), -1) if reverse else (1, 1) + if reverse: + items = reversed(items) for item in items: item_name = '%s[%d]' % (base_name, idx) if name_format_func: -- cgit v1.2.3