GDBBreakpoint.st
changeset 87 50e80d25ea6f
parent 81 5e07808d349f
child 90 6046abc9ddf4
--- a/GDBBreakpoint.st	Wed Jul 12 16:27:29 2017 +0200
+++ b/GDBBreakpoint.st	Fri Jul 07 11:28:44 2017 +0200
@@ -3,7 +3,8 @@
 "{ NameSpace: Smalltalk }"
 
 GDBDebuggerObject subclass:#GDBBreakpoint
-	instanceVariableNames:'number type disp enabled addr func file fullname line times'
+	instanceVariableNames:'number type disp enabled addr func file fullname line times
+		condition script'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'GDB-Core'
@@ -35,6 +36,20 @@
     ^ addr
 !
 
+condition
+    ^ condition
+!
+
+condition:aString
+    self assert: debugger notNil.
+    condition ~= aString ifTrue:[ 
+        debugger send: (GDBMI_break_condition arguments: { number . aString }) andWait: true.    
+        condition := aString
+    ].
+
+    "Modified: / 11-07-2017 / 14:31:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 disp
     ^ disp
 !
@@ -43,6 +58,20 @@
     ^ enabled
 !
 
+enabled: aBoolean
+    self assert: debugger notNil.
+    enabled ~~ aBoolean ifTrue:[
+        aBoolean ifTrue:[
+            debugger send: (GDBMI_break_enable arguments: { number }) andWait: true.
+        ] ifFalse:[ 
+            debugger send: (GDBMI_break_disable arguments: { number }) andWait: true.
+        ].
+        enabled := aBoolean.
+    ].
+
+    "Created: / 07-07-2017 / 12:33:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 file
     ^ file
 !
@@ -63,6 +92,21 @@
     ^ number
 !
 
+script
+    ^ script
+!
+
+script:aString
+    self assert: debugger notNil.
+    script ~= aString ifTrue:[ 
+        debugger send: (GDBMI_break_commands arguments: { number } , aString asStringCollection) andWait: true.    
+        script := aString
+    ].
+
+    "Created: / 11-07-2017 / 14:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-07-2017 / 18:34:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 times
     ^ times
 !
@@ -93,6 +137,107 @@
     "Modified: / 06-06-2017 / 09:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBBreakpoint methodsFor:'inspecting'!
+
+inspector2TabCondition
+    <inspector2Tab>
+
+    | editor |
+
+    editor := (HVScrollableView for:EditTextView).
+    editor model: ((AspectAdaptor forAspect: #condition) subject: self).
+
+    ^ Tools::Inspector2Tab new
+            priority: 41;
+            label:'Condition';  
+            view: editor
+            yourself.
+
+    "Created: / 11-07-2017 / 14:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+inspector2TabScript
+    <inspector2Tab>
+
+    | editor |
+
+    editor := (HVScrollableView for:EditTextView).
+    editor model: ((AspectAdaptor forAspect: #script) subject: self).
+
+    ^ Tools::Inspector2Tab new
+            priority: 40;
+            label:'Script';  
+            view: editor
+            yourself.
+
+    "Created: / 11-07-2017 / 14:41:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBBreakpoint methodsFor:'printing & storing'!
+
+printOn:aStream
+    "append a printed representation of the receiver to the argument, aStream"
+
+    super printOn:aStream.
+    aStream nextPut:$(.
+    number printOn:aStream.
+    aStream nextPutAll:', '.
+    aStream nextPutAll:(enabled ifTrue:[ 'enabled, ' ] ifFalse:[ 'disabled, ' ]).
+    func notNil ifTrue:[ 
+        aStream nextPutAll:'in '.
+        func printOn:aStream.   
+        aStream nextPutAll:'(), '. 
+    ].
+    file notNil ifTrue:[
+        file printOn:aStream.
+        aStream nextPut:$:.
+        line printOn:aStream.
+    ] ifFalse:[ 
+        aStream nextPutAll:'at '.
+        addr printOn: aStream.
+    ].
+
+    "Modified: / 10-07-2017 / 12:55:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBBreakpoint methodsFor:'private'!
+
+_cond: aString
+    condition := aString
+
+    "Created: / 11-07-2017 / 14:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_enabled: aBoolean
+    enabled := aBoolean
+
+    "Created: / 07-07-2017 / 12:46:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+_script: anArray
+    script := anArray asStringWith: Character cr.
+
+    "Created: / 11-07-2017 / 14:11:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateFrom: aGDBBreakpoint
+    self assert: number == aGDBBreakpoint number.
+    self class superclass instSize + 1 to: self class instSize do:[:i | 
+        self instVarAt: i put: (aGDBBreakpoint instVarAt: i).
+    ].
+    properties := aGDBBreakpoint properties.
+
+    "Created: / 06-07-2017 / 16:30:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBBreakpoint methodsFor:'testing'!
+
+isEnabled
+    ^ enabled
+
+    "Created: / 07-07-2017 / 12:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !GDBBreakpoint class methodsFor:'documentation'!
 
 version_HG