Skip to content

Commit 7b61d7d

Browse files
committed
Fix bugs in "info pc"
1 parent bf0c310 commit 7b61d7d

File tree

1 file changed

+16
-12
lines changed
  • trepan/processor/command/info_subcmd

1 file changed

+16
-12
lines changed

trepan/processor/command/info_subcmd/pc.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@
2323
from trepan.misc import wrapped_lines
2424

2525

26+
# FIXME: this could be combined with trepan-xpy's `info pc`, but that
27+
# requires a running program whereas where we just use f_lasti.
28+
# What we have here is more flexible in the presence of exceptions.
29+
# trepan3k would have to be looked over to see if it too would
30+
# work.
2631
class InfoPC(DebuggerSubcommand):
2732
"""**info pc**
2833
29-
List the current program counter or bytecode offset,
30-
and disassemble the instructions around that.
34+
List the current program counter or bytecode offset,
35+
and disassemble the instructions around that.
3136
32-
See also:
33-
---------
37+
See also:
38+
---------
3439
35-
`info line`, `info program`
36-
"""
40+
`info line`, `info program`"""
3741

3842
min_abbrev = 2 # Need at least info 'pc'
3943
max_args = 0
@@ -55,19 +59,18 @@ def run(self, args):
5559
disassemble_bytes(
5660
self.msg,
5761
self.msg_nocr,
58-
code = co_code,
59-
lasti = offset,
60-
cur_line = line_no,
61-
start_line = line_no - 1,
62-
end_line = line_no + 1,
62+
code=co_code,
63+
lasti=offset,
64+
cur_line=line_no,
65+
start_line=line_no - 1,
66+
end_line=line_no + 1,
6367
varnames=code.co_varnames,
6468
names=code.co_names,
6569
constants=code.co_consts,
6670
cells=code.co_cellvars,
6771
freevars=code.co_freevars,
6872
linestarts=dict(findlinestarts(code)),
6973
end_offset=offset + 10,
70-
opc=proc.vm.opc,
7174
)
7275
pass
7376
pass
@@ -88,6 +91,7 @@ def run(self, args):
8891

8992
if __name__ == "__main__":
9093
from trepan.processor.command import mock, info as Minfo
94+
9195
d, cp = mock.dbg_setup()
9296
i = Minfo.InfoCommand(cp)
9397
sub = InfoPC(i)

0 commit comments

Comments
 (0)