summaryrefslogtreecommitdiffstats
path: root/Tools/idle/Debugger.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-19 02:24:40 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-19 02:24:40 (GMT)
commitb52cfa1d97051e53b80aee7d4ef1bed97d0f0e03 (patch)
tree5b4f44ce3def398ec14308f6c025c30304d575ec /Tools/idle/Debugger.py
parent6c5baeb6df01f31c0be9b024f5b169969db89680 (diff)
downloadcpython-b52cfa1d97051e53b80aee7d4ef1bed97d0f0e03.zip
cpython-b52cfa1d97051e53b80aee7d4ef1bed97d0f0e03.tar.gz
cpython-b52cfa1d97051e53b80aee7d4ef1bed97d0f0e03.tar.bz2
Use and pass through the 'force' flag to set_dict() where appropriate.
Default source and globals checkboxes to false. Don't interact in user_return(). Add primitive set_breakpoint() method.
Diffstat (limited to 'Tools/idle/Debugger.py')
-rw-r--r--Tools/idle/Debugger.py43
1 files changed, 35 insertions, 8 deletions
diff --git a/Tools/idle/Debugger.py b/Tools/idle/Debugger.py
index 0ef1583..0b2e01c 100644
--- a/Tools/idle/Debugger.py
+++ b/Tools/idle/Debugger.py
@@ -36,7 +36,8 @@ class Debugger(bdb.Bdb):
def user_return(self, frame, rv):
# XXX show rv?
- self.interaction(frame)
+ ##self.interaction(frame)
+ pass
def user_exception(self, frame, info):
self.interaction(frame, info)
@@ -76,7 +77,7 @@ class Debugger(bdb.Bdb):
self.bstack.grid(row=0, column=0)
if not self.vsource:
self.__class__.vsource = BooleanVar(top)
- self.vsource.set(1)
+ ##self.vsource.set(1)
self.bsource = Checkbutton(cframe,
text="Source", command=self.show_source, variable=self.vsource)
self.bsource.grid(row=0, column=1)
@@ -88,7 +89,7 @@ class Debugger(bdb.Bdb):
self.blocals.grid(row=1, column=0)
if not self.vglobals:
self.__class__.vglobals = BooleanVar(top)
- self.vglobals.set(1)
+ ##self.vglobals.set(1)
self.bglobals = Checkbutton(cframe,
text="Globals", command=self.show_globals, variable=self.vglobals)
self.bglobals.grid(row=1, column=1)
@@ -96,7 +97,7 @@ class Debugger(bdb.Bdb):
self.status = Label(top, anchor="w")
self.status.pack(anchor="w")
self.error = Label(top, anchor="w")
- self.error.pack(anchor="w")
+ self.error.pack(anchor="w", fill="x")
self.errorbg = self.error.cget("background")
#
self.fstack = Frame(top, height=1)
@@ -150,7 +151,7 @@ class Debugger(bdb.Bdb):
stack, i = self.get_stack(self.frame, tb)
sv.load_stack(stack, i)
#
- self.show_variables()
+ self.show_variables(1)
#
if self.vsource.get():
self.sync_source_line()
@@ -248,7 +249,7 @@ class Debugger(bdb.Bdb):
self.fglobals['height'] = 1
self.show_variables()
- def show_variables(self):
+ def show_variables(self, force=0):
lv = self.localsviewer
gv = self.globalsviewer
frame = self.frame
@@ -260,6 +261,32 @@ class Debugger(bdb.Bdb):
if lv and gv and ldict is gdict:
ldict = None
if lv:
- lv.load_dict(ldict)
+ lv.load_dict(ldict, force)
if gv:
- gv.load_dict(gdict)
+ gv.load_dict(gdict, force)
+
+ def set_breakpoint_here(self, edit):
+ text = edit.text
+ filename = edit.io.filename
+ if not filename:
+ text.bell()
+ return
+ lineno = int(float(text.index("insert")))
+ msg = self.set_break(filename, lineno)
+ if msg:
+ text.bell()
+ return
+ text.tag_add("BREAK", "insert linestart", "insert lineend +1char")
+
+ # A literal copy of Bdb.set_break() without the print statement at the end
+ def set_break(self, filename, lineno, temporary=0, cond = None):
+ import linecache # Import as late as possible
+ line = linecache.getline(filename, lineno)
+ if not line:
+ return 'That line does not exist!'
+ if not self.breaks.has_key(filename):
+ self.breaks[filename] = []
+ list = self.breaks[filename]
+ if not lineno in list:
+ list.append(lineno)
+ bp = Breakpoint(filename, lineno, temporary, cond)