Skip to content

Commit 707e4eb

Browse files
committed
Fix some of the many disasm spec problems...
We need more and better offset to line number recalculation. But for simple stuff this works whereas the previous code did not.
1 parent b90d785 commit 707e4eb

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

trepan/lib/disassemble.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,18 @@ def null_print(_):
430430
(start_line > cur_line) or start_offset and start_offset > offset
431431
):
432432
continue
433+
else:
434+
msg_nocr = orig_msg_nocr
435+
msg = orig_msg
433436

434437
if (cur_line > end_line) or (end_offset and offset > end_offset):
435438
break
436-
elif start_offset and offset and start_offset <= offset:
437-
continue
439+
elif start_offset and offset:
440+
if offset >= start_offset:
441+
msg_nocr = orig_msg_nocr
442+
msg = orig_msg
443+
else:
444+
continue
438445

439446
print_instruction(
440447
instr,

trepan/processor/cmd_addrlist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ def parse_addr_list_cmd(proc, args, listsize=40):
5656
first = max(1, proc.list_lineno - (2 * listsize) - 1)
5757
elif text == "":
5858
# Continue from where we last left off
59-
first = proc.list_offset + 1
60-
last = first + listsize - 1
59+
first = proc.list_offset
60+
last = first + listsize
6161
return filename, first, True, last, True, proc.list_object
62-
last = first + listsize - 1
62+
last = first + listsize
6363
return filename, first, True, last, True, proc.list_object
6464
else:
6565
try:

trepan/processor/command/disassemble.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ def run(self, args):
184184
opts["start_offset"] = start
185185
else:
186186
opts["start_line"] = start
187+
opts["start_offset"] = 0
187188
if last_is_offset:
188189
opts["end_offset"] = last
189190
else:
190191
opts["end_line"] = last
192+
opts["end_offset"] = None
191193

192194
if not obj and (
193195
bytecode_file

0 commit comments

Comments
 (0)