Skip to content

Commit

Permalink
Removed some useless comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
native-human committed Aug 16, 2011
1 parent ff3533e commit fa89852
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 57 deletions.
1 change: 0 additions & 1 deletion dbgmods/__builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def input(prompt=""):
elif dbg.mode == 'normal':
dbg.snapshottingcontrol.set_make_snapshot()
dbg.dbgcom.send_expect_input()
#log.debug("expect input#")
orig = __orig__input(prompt)
stdout_resource_manager = dbg.current_timeline.get_manager(('__stdout__',''))
stdout_resource_manager.update_stdout(prompt + orig + '\r\n')
Expand Down
3 changes: 0 additions & 3 deletions epdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ def main():
debug("SystemExit exception. Frame:", frame)
epdb.interaction(frame, t)
except epdblib.debugger.EpdbExit:
#debug('EpdbExit caught')
break
# sys.exit(0)
except bdb.BdbQuit:
debug('BdbQuit caught - Shutting servers down')
break
Expand All @@ -154,7 +152,6 @@ def main():
#print("Running 'cont' or 'step' will restart the program")

frame = sys._current_frames()[_thread.get_ident()]
#debug("Other exception. Frame:", frame)
t = sys.exc_info()[2]
epdb.interaction(frame, t)

Expand Down
5 changes: 0 additions & 5 deletions epdblib/breakpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,8 @@ def findnextbreakpointic(self):
#from epdblib.breakpoint import Breakpoint
bestic = -1
for bp in self.bplist:
#debug("Checking Bp: ", bp)
try:
for bpic in continued[bp]:
#debug("Try bpic", bpic)
if bpic > dbg.ic:
break
else:
Expand All @@ -318,13 +316,10 @@ def findprecedingbreakpointic(self):
"""Looks for a preceding ic that has a breakpoint. It only looks at executed
instruction counts. Returns 0 if nothing was found"""
continued = dbg.current_timeline.get_continue()
#from epdblib.breakpoint import Breakpoint
bestic = 0
for bp in self.bplist:
#debug("Checking Bp: ", bp)
try:
for bpic in reversed(continued[bp]):
#debug("Try bpic")
if bpic < dbg.ic:
break
else:
Expand Down
51 changes: 3 additions & 48 deletions epdblib/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ def _runscript(self, filename):
self.cleanup()
return
self.dbgcom.send_program_finished()
#debug("Program has finished")
#debug("Going into post-mortem interaction mode", dbg.ic)
dbg.mode = "post_mortem"
self.set_resources()
self.is_postmortem = True
Expand All @@ -248,7 +246,6 @@ def init_reversible(self):
#self.command_running_start_time = time.time()
self.lastline = ''
self.command_running_start_time = None
#debug('Init reversible')
dbg.tempdir = tempfile.mkdtemp(prefix="epdb")
os.mkdir(os.path.join(dbg.tempdir, 'stdout_resource'))
os.mkdir(os.path.join(dbg.tempdir, 'file_resource'))
Expand Down Expand Up @@ -305,7 +302,7 @@ def set_resources(self):
if not res is None:
break
else:
debug("Error: No key found for set_resources")
self.dbgcom.send_debugmessage("Error: No key found for set_resources")
return
self.dbgcom.send_debugmessage("Restoring resource {} {} {}".format(k, i, res))
manager = dbg.current_timeline.get_manager(k)
Expand Down Expand Up @@ -367,23 +364,18 @@ def user_line(self, frame):
lineno = frame.f_lineno
except:
lineno = "err"
#debug("user line: ", dbg.ic, lineno)
# TODO only make snapshots in normal mode?

#debug("Running time", self.runningtime)
if dbg.snapshottingcontrol.get_make_snapshot():
r = self.make_snapshot()
#debug('interaction snapshot made or activated', r)
dbg.snapshottingcontrol.clear_make_snapshot()
self.runningtime = 0
elif self.runningtime >= 1 and dbg.mode == 'normal':
#debug("Make snapshot because of running time")
r = self.make_snapshot()
self.runningtime = 0

self.lastline = "{filename}({lineno})<module>()".format(filename=frame.f_code.co_filename, lineno=frame.f_lineno)
def setmode():
#debug("setmode: ", dbg.ic, dbg.current_timeline.get_max_ic())
if dbg.mode == 'redo':
if dbg.ic >= dbg.current_timeline.get_max_ic():
dbg.mode = 'normal'
Expand Down Expand Up @@ -470,7 +462,6 @@ def set_continue(self):
def cmd_snapshot(self, arg, temporary=0):
"""snapshot - makes a snapshot"""
ic = dbg.ic
#debug("Ic:", ic)
snapshots = dbg.current_timeline.get_snapshots()
for sid in snapshots:
s = self.snapshots[sid]
Expand All @@ -480,8 +471,6 @@ def cmd_snapshot(self, arg, temporary=0):

r = self.make_snapshot()

#if self.stopafter > 0:
# self.stopafter -= 1
if r == "snapshotmade":
self.dbgcom.send_debugmessage("Made snapshot")
self.dbgcom.send_lastline(self.lastline)
Expand Down Expand Up @@ -614,21 +603,17 @@ def cmd_rstep(self, arg):
return

if dbg.ic > dbg.current_timeline.get_max_ic():
#debug("Set max ic: ", dbg.ic)
dbg.current_timeline.set_max_ic(dbg.ic)
#debug("current maxic ", dbg.current_timeline.get_max_ic())

if dbg.ic == 0:
self.dbgcom.send_message("At the beginning of the program. Can't step back.")
#debug("At the beginning of the program. Can't step back")
return

s = self.findsnapshot(dbg.ic-1)
if s == None:
debug("No snapshot made. Can't step back")
return

#debug('snapshot activation', 'id:', s.id, 'steps:', steps)
self.dbgcom.send_debugmessage("Activate ic {0}".format(dbg.ic))
self.mp.activateic(s.id, dbg.ic - 1)
raise EpdbExit()
Expand Down Expand Up @@ -670,16 +655,12 @@ def cmd_rcontinue(self, arg):

if dbg.ic > dbg.current_timeline.get_max_ic():
dbg.current_timeline.set_max_ic(dbg.ic)
#debug("Set max ic: ", dbg.ic)
if dbg.ic == 0:
self.dbgcom.send_message("At the beginning of the program. Can't step back.")
#debug("At the beginning of the program. Can't step back")
return

highestic = self.bpmanager.findprecedingbreakpointic()

#debug("Highest ic found: ", highestic)

s = self.findsnapshot(highestic)
if s == None:
debug("No snapshot made. Can't step back")
Expand Down Expand Up @@ -707,24 +688,18 @@ def cmd_step(self, arg):
if self.is_postmortem:
self.dbgcom.send_message("You are at the end of the program. You cant go forward.")
self.dbgcom.send_finished()
#debug("You are at the end of the program. You cant go forward.")
return
if not self.ron:
return epdblib.basedebugger.BaseDebugger.do_step(self, arg)
#debug("Stepping in mode: ", dbg.mode)
if dbg.mode == 'redo':
#debug("Stepping in redo mode")
s = self.findsnapshot(dbg.ic+1)
if s == None:
#debug("No snapshot made. Can't step back")
return
if s.ic <= dbg.ic:
#debug("No snapshot found to step forward to. Step forward normal way", dbg.ic, s.ic)
self.set_step()
self.running_mode = 'step'
return 1
else:
#debug('snapshot activation', s.id, 0)
self.mp.activateic(s.id, dbg.ic+1)
raise EpdbExit()
else:
Expand All @@ -737,7 +712,6 @@ def cmd_next(self, arg):
if self.is_postmortem:
self.dbgcom.send_message("You are at the end of the program. You cant go forward.")
self.dbgcom.send_finished()
#debug("You are at the end of the program. You cant go forward.")
return
if dbg.mode == 'redo':
nextd = dbg.current_timeline.get_next()
Expand All @@ -753,7 +727,6 @@ def cmd_next(self, arg):
# Use the highest available snapshot
s = self.findsnapshot(dbg.current_timeline.get_max_ic())
if s.ic <= dbg.ic:
#debug("No snapshot found to next forward to. Next forward normal way", dbg.ic, s.ic)
self.set_next(self.curframe)
self.running_mode = 'next'
return 1
Expand All @@ -769,21 +742,17 @@ def cmd_next(self, arg):
pass
else:
nextic = min(nextic, bpic)
#debug('next inside timeline')
s = self.findsnapshot(nextic)

#s = self.findsnapshot(dbg.ic+1)
if s == None:
debug("No snapshot made. This shouldn't be")
return
if s.ic <= dbg.ic:
#debug("No snapshot found to next forward to. Next forward normal way", dbg.ic, s.ic)
self.set_next(self.curframe)
#self.set_step()
self.running_mode = 'next'
return 1
else:
#debug('snapshot activation', s.id, s.ic - nextic)
self.mp.activateic(s.id, nextic)
raise EpdbExit()
else:
Expand All @@ -795,27 +764,24 @@ def cmd_next(self, arg):

def cmd_continue(self, arg):
if self.is_postmortem:
#debug("You are at the end of the program. You cant go forward.")
self.dbgcom.send_message("You are at the end of the program. You cant go forward.")
self.dbgcom.send_finished()
return
if dbg.mode == 'redo':
#debug("Continue in redo mode")
bestic = self.bpmanager.findnextbreakpointic()
if bestic == -1:
#debug("redo_cont: No future bp in executed instructions found")
# go to the highest snapshot and continue
s = self.findsnapshot(dbg.current_timeline.get_max_ic())
#debug("current_ic", dbg.ic, "snapshot_ic", s.ic)
if dbg.ic < s.ic:
#debug("activate continue")
self.mp.activatecontinue(s.id)
raise EpdbExit()
else:
# normal continue
pass
#debug("normal continue")
else:
#debug("redo_cont: Breakpoint found", bestic)
# redo continue
# find snapshot and continue
s = self.findsnapshot(bestic)
self.mp.activateic(s.id, bestic)
Expand All @@ -824,7 +790,6 @@ def cmd_continue(self, arg):
self.command_running_start_time = time.time()
self.set_continue()
return 1
#return epdblib.basedebugger.BaseDebugger.do_continue(self, arg)

def cmd_return(self, arg):
debug("Return not implemented yet for epdb")
Expand Down Expand Up @@ -878,7 +843,6 @@ def cmd_activate_snapshot(self, arg):
snapshots = dbg.current_timeline.get_snapshots()
for sid in snapshots:
s = self.snapshots[sid]
#print(repr(s.id), repr(arg))
if s.id == int(arg):
break
else:
Expand Down Expand Up @@ -969,10 +933,6 @@ def cmd_break(self, arg, temporary = 0):
# last thing to try
(ok, filename, ln) = self.lineinfo(arg)
if not ok:
#debug('*** The specified object', end=' ')
#print(repr(arg), end=' ', file=self.stdout)
#print('is not a function', file=self.stdout)
#print('or was not found along sys.path.', file=self.stdout)
reason = "The specified object " + repr(arg) + \
"is not a function or was not found along sys.path."
self.dbgcom.send_break_nosucess(filename, lineno, reason)
Expand All @@ -987,11 +947,9 @@ def cmd_break(self, arg, temporary = 0):
# now set the break point
err = self.set_break(filename, line, temporary, cond, funcname)
if err:
#debug('***', err)
self.dbgcom.send_break_nosucess(filename, lineno, "Error: " + str(err))
else:
bp = self.get_breaks(filename, line)[-1]
#debug("Breakpoint %d at %s:%d" % (bp.number, bp.file, bp.line))
self.dbgcom.send_break_success(bp.number, bp.file, bp.line)

def checkline(self, filename, lineno):
Expand All @@ -1002,7 +960,6 @@ def checkline(self, filename, lineno):
"""
line = linecache.getline(filename, lineno, self.curframe.f_globals)
if not line:
#print('End of file', file=self.stdout)
return 0
line = line.strip()
# Don't allow setting breakpoint at a blank line
Expand Down Expand Up @@ -1057,7 +1014,6 @@ def cmd_clear(self, arg):
if err:
debug('***', err)
else:
#debug('Deleted breakpoint', i)
self.dbgcom.send_clear_success(i)

def print_stack_trace(self):
Expand All @@ -1075,7 +1031,6 @@ def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):
pass
# I think I don't need this line, not sure however
#sendcmd(' '+self.format_stack_entry(frame_lineno, prompt_prefix), prefix='')
#sendcmd(self.format_stack_entry(frame_lineno, prompt_prefix), prefix='')

def cmd_commands(self, arg):
"""Not supported yet"""
Expand Down

0 comments on commit fa89852

Please sign in to comment.