>From b63fcf960a4194afcca2a6fbd200dbcf507f8280 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio
Date: Mon, 27 May 2013 22:09:51 +0200
Subject: [PATCH] Improve the debug experience: - center the view; -
step/step into are better
---
.../Commands/DebugMenus/StepDebugCommand.st | 21 +++++++++++
.../Commands/DebugMenus/StepIntoDebugCommand.st | 2 +-
packages/visualgst/Debugger/Extensions.st | 9 +++++
packages/visualgst/Debugger/GtkDebugger.st | 41 +++++++---------------
packages/visualgst/Extensions.st | 39 --------------------
packages/visualgst/Menus/DebuggerToolbar.st | 2 +-
packages/visualgst/Text/GtkTextWidget.st | 9 +++++
packages/visualgst/package.xml | 2 ++
8 files changed, 55 insertions(+), 70 deletions(-)
create mode 100644 packages/visualgst/Commands/DebugMenus/StepDebugCommand.st
diff --git a/packages/visualgst/Commands/DebugMenus/StepDebugCommand.st b/packages/visualgst/Commands/DebugMenus/StepDebugCommand.st
new file mode 100644
index 0000000..41d07af
--- /dev/null
+++ b/packages/visualgst/Commands/DebugMenus/StepDebugCommand.st
@@ -0,0 +1,21 @@
+DebugCommand subclass: StepDebugCommand [
+
+ item [
+
+
+ ^ 'Step'
+ ]
+
+ stockIcon [
+
+ ^ 'Icons/go-next.png'
+ ]
+
+ execute [
+
+
+ target step
+ ]
+
+]
+
diff --git a/packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st b/packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st
index 30ac7dc..5e11820 100644
--- a/packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st
+++ b/packages/visualgst/Commands/DebugMenus/StepIntoDebugCommand.st
@@ -8,7 +8,7 @@ DebugCommand subclass: StepIntoDebugCommand [
stockIcon [
- ^ 'Icons/go-next.png'
+ ^ 'Icons/go-jump.png'
]
execute [
diff --git a/packages/visualgst/Debugger/Extensions.st b/packages/visualgst/Debugger/Extensions.st
index 8e73074..79a22f8 100644
--- a/packages/visualgst/Debugger/Extensions.st
+++ b/packages/visualgst/Debugger/Extensions.st
@@ -42,3 +42,12 @@ Behavior extend [
]
]
+Debugger extend [
+
+ receiver [
+
+
+ ^ self suspendedContext receiver
+ ]
+]
+
diff --git a/packages/visualgst/Debugger/GtkDebugger.st b/packages/visualgst/Debugger/GtkDebugger.st
index 1998940..f57c9d7 100644
--- a/packages/visualgst/Debugger/GtkDebugger.st
+++ b/packages/visualgst/Debugger/GtkDebugger.st
@@ -179,25 +179,6 @@ GtkBrowsingTool subclass: GtkDebugger [
updateContextWidget
]
- skipTopContext [
-
-
- | context lastContext contexts |
- context := debugger suspendedContext.
- lastContext := context environment.
- "stacktrace := OrderedCollection new."
- contexts := OrderedCollection new.
-
- [ context ~~ lastContext and: [ context isInternalExceptionHandlingContext ] ]
- whileTrue: [ context := context parentContext ].
- [ context == lastContext ] whileFalse:
- [ context isDisabled
- ifFalse:
- [ "stacktrace add: context printString."
- contexts add: context ].
- context := context parentContext ].
- ]
-
initializeProcess: aProcess [
@@ -226,7 +207,8 @@ GtkBrowsingTool subclass: GtkDebugger [
self initializeProcess: aProcess.
3 timesRepeat: [ debugger step ].
- debugger myStepInto.
+ debugger step.
+ debugger step.
self updateContextWidget
]
@@ -265,36 +247,37 @@ GtkBrowsingTool subclass: GtkDebugger [
contextChanged [
- | iter |
self checkCodeWidgetAndUpdate: [
+ | line |
contextWidget hasSelectedContext ifFalse: [ ^ self ].
codeWidget source: (BrowserMethodSource on: contextWidget selectedContext method).
- codeWidget applyTag: #debug forLine: contextWidget selectedContext currentLine.
+ contextWidget selectedContext currentLine ~= 0
+ ifTrue: [ line := contextWidget selectedContext currentLine ]
+ ifFalse: [ line := 1 ].
+ codeWidget
+ applyTag: #debug forLine: line;
+ centerViewAtLine: line.
self updateInspectorWidget: contextWidget selectedContext ]
]
step [
- contextWidget isLastContextSelected
- ifTrue: [ debugger myStep ]
- ifFalse: [ debugger finish: contextWidget selectedContext ].
+ debugger next.
self updateContextWidget
]
stepInto [
- contextWidget isLastContextSelected
- ifTrue: [ debugger myStepInto ]
- ifFalse: [ debugger finish: contextWidget selectedContext ].
+ debugger step.
self updateContextWidget
]
stepOver [
- debugger step.
+ debugger finish.
self updateContextWidget
]
diff --git a/packages/visualgst/Extensions.st b/packages/visualgst/Extensions.st
index 92e98c0..5c8656c 100644
--- a/packages/visualgst/Extensions.st
+++ b/packages/visualgst/Extensions.st
@@ -344,45 +344,6 @@ ContextPart extend [
]
]
-Debugger extend [
-
- receiver [
-
-
- ^ self suspendedContext receiver
- ]
-
- myStepInto [
- "Run to the end of the current line in the inferior process or to the
- next message send."
-
- "TODO: Stop when affectation (get the current bytecode)"
-
- | context |
- context := self suspendedContext.
-
- [ self stepBytecode.
- self suspendedContext == context ]
- whileTrue
- ]
-
- myStep [
- "Run to the end of the current line in the inferior process, skipping
- over message sends."
-
- "TODO: Stop when affectation (get the current bytecode)"
-
- | context |
- context := self suspendedContext.
-
- [ self stepBytecode.
- (self suspendedContext notNil and: [ self suspendedContext parentContext == context ])
- ifTrue: [ self finish: self suspendedContext. ^ self ].
- self suspendedContext == context ]
- whileTrue
- ]
-]
-
VariableBinding extend [
hasLiterals [
diff --git a/packages/visualgst/Menus/DebuggerToolbar.st b/packages/visualgst/Menus/DebuggerToolbar.st
index ed89925..52a4fb3 100644
--- a/packages/visualgst/Menus/DebuggerToolbar.st
+++ b/packages/visualgst/Menus/DebuggerToolbar.st
@@ -3,6 +3,6 @@ MenuBuilder subclass: DebuggerToolbar [
^ {ContinueDebugCommand.
StepIntoDebugCommand.
- StepToDebugCommand}
+ StepDebugCommand}
]
]
diff --git a/packages/visualgst/Text/GtkTextWidget.st b/packages/visualgst/Text/GtkTextWidget.st
index 4c08498..eb8e0e0 100644
--- a/packages/visualgst/Text/GtkTextWidget.st
+++ b/packages/visualgst/Text/GtkTextWidget.st
@@ -379,4 +379,13 @@ GtkConcreteWidget subclass: GtkTextWidget [
self buffer selectRange: start bound: end
]
+ centerViewAtLine: anInteger [
+
+
+ | mark iter |
+ iter := self buffer getIterAtLine: anInteger.
+ mark := GTK.GtkTextMark new: nil leftGravity: false.
+ self buffer addMark: mark where: iter.
+ textWidget scrollMarkOnscreen: mark.
+ ]
]
diff --git a/packages/visualgst/package.xml b/packages/visualgst/package.xml
index e5c54e2..b52f2fd 100644
--- a/packages/visualgst/package.xml
+++ b/packages/visualgst/package.xml
@@ -135,6 +135,7 @@
Commands/DebugMenus/ContinueDebugCommand.st
Commands/DebugMenus/StepIntoDebugCommand.st
Commands/DebugMenus/StepToDebugCommand.st
+ Commands/DebugMenus/StepDebugCommand.st
Menus/MenuBuilder.st
Menus/MenuSeparator.st
Menus/ToolbarSeparator.st
@@ -362,6 +363,7 @@
Commands/DebugMenus/ContinueDebugCommand.st
Commands/DebugMenus/StepIntoDebugCommand.st
Commands/DebugMenus/StepToDebugCommand.st
+ Commands/DebugMenus/StepDebugCommand.st
Menus/MenuBuilder.st
Menus/MenuSeparator.st
Menus/ToolbarSeparator.st
--
1.8.1.2