@@ -63,20 +63,23 @@ class InteractiveDebugger(
6363 private val stepIntoButton = JButton ().apply {
6464 toolTipText = " Step a single instruction"
6565 }
66+ private val stepBackLineButton = JButton ().apply {
67+ toolTipText = " Step to the previous line"
68+ }
6669 private val stepLineButton = JButton ().apply {
6770 toolTipText = " Step to the next line"
6871 }
69- private val stepBackLineButton = JButton ().apply {
70- toolTipText = " Step to the previous line"
72+ private val stepOverLineButton = JButton ().apply {
73+ toolTipText = " Step over line"
7174 }
7275 private val flashButton = JButton ().apply {
7376 toolTipText = " Upload module to microcontroller"
7477 }
7578 private val progressBar = JProgressBar ().apply {
7679 isVisible = false
7780 }
78- private val allButtons = listOf (pauseButton, stepBackButton, stepOverButton, stepIntoButton, stepLineButton, stepBackLineButton, flashButton)
79- private val pausedOnlyButtons = listOf (stepBackButton, stepOverButton, stepIntoButton, stepLineButton, stepBackLineButton)
81+ private val allButtons = listOf (pauseButton, stepBackButton, stepOverButton, stepIntoButton, stepLineButton, stepBackLineButton, stepOverLineButton, flashButton)
82+ private val pausedOnlyButtons = listOf (stepBackButton, stepOverButton, stepIntoButton, stepLineButton, stepBackLineButton, stepOverLineButton )
8083 private var paused = false
8184
8285 init {
@@ -205,6 +208,31 @@ class InteractiveDebugger(
205208 updateStepBackButton()
206209 updatePcLabel()
207210 }
211+ stepOverLineButton.icon = FlatSVGIcon (javaClass.getResource(" /debug-step-over.svg" ))
212+ stepOverLineButton.addActionListener {
213+ if (sourceMapping == null ) {
214+ stepBackLineButton.isEnabled = false
215+ return @addActionListener
216+ }
217+
218+ println (" Step over line" )
219+ var startLine = - 1
220+ try {
221+ startLine = sourceMapping.getLineForPc(debugger.checkpoints.last()!! .snapshot.pc!! )
222+ } catch (re: RuntimeException ) {
223+ System .err.println (" WARNING: " + re.message)
224+ }
225+ debugger.stepOverUntil {
226+ try {
227+ sourceMapping.getLineForPc(it.pc!! ) != startLine
228+ } catch (re: RuntimeException ) {
229+ System .err.println (" WARNING: " + re.message)
230+ false
231+ }
232+ }
233+ updateStepBackButton()
234+ updatePcLabel()
235+ }
208236 flashButton.icon = FlatSVGIcon (javaClass.getResource(" /debug-update-module.svg" ))
209237 flashButton.addActionListener {
210238 /* val dialog = JFileChooser()
@@ -240,6 +268,7 @@ class InteractiveDebugger(
240268 toolBar.addSeparator()
241269 toolBar.add(stepBackLineButton)
242270 toolBar.add(stepLineButton)
271+ toolBar.add(stepOverLineButton)
243272 toolBar.addSeparator()
244273 toolBar.add(flashButton)
245274 toolBar.addSeparator()
0 commit comments