Skip to content

Commit

Permalink
Sync with trpean3k
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Mar 15, 2021
1 parent 4aff1d2 commit 0d8c8d1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions trepan/processor/cmdproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from tracer import EVENT2SHORT

from trepan import vprocessor as Mprocessor
from trepan.vprocessor import Processor
from trepan.lib import bytecode as Mbytecode
from trepan import exception as Mexcept
from trepan.lib import display as Mdisplay
Expand Down Expand Up @@ -177,9 +177,8 @@ def print_location(proc_obj):
remapped_file = None
source_text = None
while i_stack >= 0:
frame_lineno = proc_obj.stack[i_stack]
frame, lineno = proc_obj.stack[i_stack]
i_stack -= 1
frame, lineno = frame_lineno

# # Next check to see that local variable breadcrumb exists and
# # has the magic dynamic value.
Expand Down Expand Up @@ -236,8 +235,9 @@ def print_location(proc_obj):
# into the corresponding line of the tempfile
co = proc_obj.curframe.f_code
tempdir = proc_obj.settings("tempdir")
temp_filename, name_for_code = deparse_and_cache(co, proc_obj.errmsg,
tempdir=tempdir)
temp_filename, name_for_code = deparse_and_cache(
co, proc_obj.errmsg, tempdir=tempdir
)
lineno = 1
# _, lineno = pyficache.unmap_file_line(temp_filename, lineno, True)
if temp_filename:
Expand All @@ -257,14 +257,18 @@ def print_location(proc_obj):
# FIXME: DRY code with version in cmdproc.py print_location
prefix = osp.basename(temp_name).split(".")[0]
fd = tempfile.NamedTemporaryFile(
suffix=".py", prefix=prefix, delete=False,
suffix=".py",
prefix=prefix,
delete=False,
dir=proc_obj.settings("tempdir"),
)
with fd:
fd.write("".join(lines))
remapped_file = fd.name
pyficache.remap_file(remapped_file, filename)
fd.close()
intf_obj.msg("remapped file %s to %s" % (filename, remapped_file))

pass
line = linecache.getline(filename, lineno, proc_obj.curframe.f_globals)
pass
Expand Down Expand Up @@ -305,10 +309,10 @@ def print_location(proc_obj):
}


class CommandProcessor(Mprocessor.Processor):
class CommandProcessor(Processor):
def __init__(self, core_obj, opts=None):
get_option = lambda key: Mmisc.option_set(opts, key, DEFAULT_PROC_OPTS)
Mprocessor.Processor.__init__(self, core_obj)
Processor.__init__(self, core_obj)

self.continue_running = False # True if we should leave command loop
self.event2short = dict(EVENT2SHORT)
Expand Down

0 comments on commit 0d8c8d1

Please sign in to comment.