From 650fe8789b066d7bd8ac206d131d74b56f5da799 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:12:46 +0100 Subject: [PATCH 1/4] Cleaning old source code remaining as comment --- src/NewTools-Debugger/StDebugger.class.st | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/NewTools-Debugger/StDebugger.class.st b/src/NewTools-Debugger/StDebugger.class.st index 43ea5f85..bfebc591 100644 --- a/src/NewTools-Debugger/StDebugger.class.st +++ b/src/NewTools-Debugger/StDebugger.class.st @@ -1360,23 +1360,12 @@ StDebugger >> updateCodeFromContext: aContext [ StDebugger >> updateCodeTextSegmentDecoratorsIn: aContext forInterval: selectionInterval [ self code removeAllTextSegmentDecorations. - - "This decorates the receiver and the next node with an underline" - "self code - addTextSegmentDecoration: - (SpTextPresenterDecorator new - underlineColor: Color orange; - interval: (aContext currentNode start to: aContext currentNode stop + 1); - yourself)." - + "This decorates the next executing node" self code addTextSegmentDecoration: (SpTextPresenterDecorator forHighlight interval: (selectionInterval first to: selectionInterval last + 1); yourself) - - " icon: (self iconNamed: #warning); - iconBlock: [ :n | n inspect ]; - title: 'Click me!';" + ] { #category : 'updating' } From 14d0f299373d729fa7c1652cadd17fbabb043295 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:02:46 +0100 Subject: [PATCH 2/4] Decorating breakpoints in the debugger --- .../DebugPointIconStyler.extension.st | 16 ++++++++++ src/NewTools-Debugger/StDebugger.class.st | 31 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/NewTools-Debugger/DebugPointIconStyler.extension.st diff --git a/src/NewTools-Debugger/DebugPointIconStyler.extension.st b/src/NewTools-Debugger/DebugPointIconStyler.extension.st new file mode 100644 index 00000000..6d932f18 --- /dev/null +++ b/src/NewTools-Debugger/DebugPointIconStyler.extension.st @@ -0,0 +1,16 @@ +Extension { #name : 'DebugPointIconStyler' } + +{ #category : '*NewTools-Debugger' } +DebugPointIconStyler >> buildIconStyleFor: dp to: aNode [ + "there probably is a better way that just adding a second row but i couldn't figure out rubric" + + | r | + r := self segmentMorphClass from: aNode start to: aNode stop + 1. + + r label: (self iconLabelBlock: dp). + r icon: (self iconFor: dp). + r iconBlock: (self iconBlock: dp). + r color: self highlightColor. + r borderColor: self borderColor. + ^ r +] diff --git a/src/NewTools-Debugger/StDebugger.class.st b/src/NewTools-Debugger/StDebugger.class.st index bfebc591..cc32c581 100644 --- a/src/NewTools-Debugger/StDebugger.class.st +++ b/src/NewTools-Debugger/StDebugger.class.st @@ -528,6 +528,33 @@ StDebugger >> debuggerInspectorModelClass [ ^ StDebuggerInspectorModel ] +{ #category : 'updating - presenters' } +StDebugger >> decorateCodeForBreakpointsInContext: aContext [ + + | debugPoints decorators | + debugPoints := DebugPoint all select: [ :dp | + dp link nodes anySatisfy: [ :n | + n methodNode compiledMethod + == aContext method ] ]. + decorators := debugPoints collect: [ :dp | + dp link nodes collect: [ :n | + dp name + -> + (DebugPointIconStyler new buildIconStyleFor: dp to: n) ] ]. + + decorators flattened do: [ :d | + | styler | + styler := d value. + self code addTextSegmentDecoration: + (SpTextPresenterDecorator forHighlight + interval: styler interval; + icon: styler icon; + iconBlock: styler iconBlock; + highlightColor: styler color; + title: d key asString; + yourself) ]. +] + { #category : 'layout' } StDebugger >> defaultLayout [ ^ SpPanedLayout newTopToBottom @@ -1359,8 +1386,12 @@ StDebugger >> updateCodeFromContext: aContext [ { #category : 'updating - presenters' } StDebugger >> updateCodeTextSegmentDecoratorsIn: aContext forInterval: selectionInterval [ + + self code removeAllTextSegmentDecorations. + self decorateCodeForBreakpointsInContext: aContext. + "This decorates the next executing node" self code addTextSegmentDecoration: (SpTextPresenterDecorator forHighlight interval: (selectionInterval first to: selectionInterval last + 1); From 199fa646a8913574de549c0d8fd5c825eae444b6 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:03:15 +0100 Subject: [PATCH 3/4] Fixing bug in text presenters: widget must be explicitly set to use text segments icons --- .../SpMorphicBaseTextAdapter.extension.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NewTools-SpTextPresenterDecorators/SpMorphicBaseTextAdapter.extension.st b/src/NewTools-SpTextPresenterDecorators/SpMorphicBaseTextAdapter.extension.st index 1eaacb5e..2ef65ae5 100644 --- a/src/NewTools-SpTextPresenterDecorators/SpMorphicBaseTextAdapter.extension.st +++ b/src/NewTools-SpTextPresenterDecorators/SpMorphicBaseTextAdapter.extension.st @@ -4,7 +4,8 @@ Extension { #name : 'SpMorphicBaseTextAdapter' } SpMorphicBaseTextAdapter >> addTextSegmentDecoration: aDecorationSegment [ self widgetDo: [ :w | - w addSegment: (RubUnderlinedSegmentMorph on: aDecorationSegment) ] + w addSegment: (RubUnderlinedSegmentMorph on: aDecorationSegment). + w withTextSegmentIcons ] ] { #category : '*NewTools-SpTextPresenterDecorators' } From ff5577028767a618b7cb16274328c4f77f0c6b9c Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:23:06 +0100 Subject: [PATCH 4/4] Refactorings --- src/NewTools-Debugger/DebugPoint.extension.st | 9 +++++++++ src/NewTools-Debugger/StDebugger.class.st | 10 +++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 src/NewTools-Debugger/DebugPoint.extension.st diff --git a/src/NewTools-Debugger/DebugPoint.extension.st b/src/NewTools-Debugger/DebugPoint.extension.st new file mode 100644 index 00000000..0d4207b8 --- /dev/null +++ b/src/NewTools-Debugger/DebugPoint.extension.st @@ -0,0 +1,9 @@ +Extension { #name : 'DebugPoint' } + +{ #category : '*NewTools-Debugger' } +DebugPoint class >> allInstalledInMethod: aCompiledMethod [ + "We don't expect this code to be slow: there are rarely thousands of breakpoints installed in a running system. Therefore the enumerating of all links of all breakpoints should be quick because few breakpoints are involved. Future work could store install-time metadata in debug points to simplify this." + ^ self all select: [ :dp | + dp link nodes anySatisfy: [ :n | + n methodNode compiledMethod == aCompiledMethod method ] ] +] diff --git a/src/NewTools-Debugger/StDebugger.class.st b/src/NewTools-Debugger/StDebugger.class.st index cc32c581..986131df 100644 --- a/src/NewTools-Debugger/StDebugger.class.st +++ b/src/NewTools-Debugger/StDebugger.class.st @@ -532,11 +532,8 @@ StDebugger >> debuggerInspectorModelClass [ StDebugger >> decorateCodeForBreakpointsInContext: aContext [ | debugPoints decorators | - debugPoints := DebugPoint all select: [ :dp | - dp link nodes anySatisfy: [ :n | - n methodNode compiledMethod - == aContext method ] ]. - decorators := debugPoints collect: [ :dp | + debugPoints := DebugPoint allInstalledInMethod: aContext method. + decorators := debugPoints collect: [ :dp | dp link nodes collect: [ :n | dp name -> @@ -552,7 +549,7 @@ StDebugger >> decorateCodeForBreakpointsInContext: aContext [ iconBlock: styler iconBlock; highlightColor: styler color; title: d key asString; - yourself) ]. + yourself) ] ] { #category : 'layout' } @@ -1389,7 +1386,6 @@ StDebugger >> updateCodeTextSegmentDecoratorsIn: aContext forInterval: selection self code removeAllTextSegmentDecorations. - self decorateCodeForBreakpointsInContext: aContext. "This decorates the next executing node"