1 " |
1 " |
2 jv:libgdbs - GNU Debugger Interface Library |
2 jv:libgdbs - GNU Debugger Interface Library |
3 Copyright (C) 2015-now Jan Vrany |
3 Copyright (C) 2015-now Jan Vrany |
|
4 Copyright (C) 2021 LabWare |
4 |
5 |
5 This library is free software; you can redistribute it and/or |
6 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Lesser General Public |
7 modify it under the terms of the GNU Lesser General Public |
7 License as published by the Free Software Foundation; either |
8 License as published by the Free Software Foundation; either |
8 version 2.1 of the License. |
9 version 2.1 of the License. |
31 |
32 |
32 copyright |
33 copyright |
33 " |
34 " |
34 jv:libgdbs - GNU Debugger Interface Library |
35 jv:libgdbs - GNU Debugger Interface Library |
35 Copyright (C) 2015-now Jan Vrany |
36 Copyright (C) 2015-now Jan Vrany |
|
37 Copyright (C) 2021 LabWare |
36 |
38 |
37 This library is free software; you can redistribute it and/or |
39 This library is free software; you can redistribute it and/or |
38 modify it under the terms of the GNU Lesser General Public |
40 modify it under the terms of the GNU Lesser General Public |
39 License as published by the Free Software Foundation; either |
41 License as published by the Free Software Foundation; either |
40 version 2.1 of the License. |
42 version 2.1 of the License. |
71 ! ! |
73 ! ! |
72 |
74 |
73 !GDBTransientDataHolder methodsFor:'accessing'! |
75 !GDBTransientDataHolder methodsFor:'accessing'! |
74 |
76 |
75 value |
77 value |
76 | token old new | |
|
77 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifTrue:[ |
78 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifTrue:[ |
78 ^ value. |
79 ^ value. |
79 ]. |
80 ]. |
80 old := value == InvalidValue ifTrue:[ nil ] ifFalse:[ value ]. |
|
81 lock critical:[ |
81 lock critical:[ |
82 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifFalse:[ |
82 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifFalse:[ |
|
83 | token old new | |
|
84 |
|
85 "/ The trick with `token` here is to avoid call to |
|
86 "/ #value: in case it has been called from within |
|
87 "/ the factory itself. |
|
88 old := value == InvalidValue ifTrue:[ nil ] ifFalse:[ value ]. |
83 value := token := Object new. |
89 value := token := Object new. |
84 new := factory valueWithOptionalArgument: old. |
90 new := factory valueWithOptionalArgument: old. |
85 value == token ifTrue:[ |
91 value == token ifTrue:[ |
86 self value: new. |
92 self value: new. |
87 ]. |
93 ]. |
89 ]. |
95 ]. |
90 ^ value |
96 ^ value |
91 |
97 |
92 "Created: / 17-09-2014 / 22:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
98 "Created: / 17-09-2014 / 22:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
93 "Modified: / 26-09-2018 / 13:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
99 "Modified: / 26-09-2018 / 13:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
100 "Modified (format): / 10-03-2021 / 14:34:22 / Jan Vrany <jan.vrany@labware.com>" |
94 ! |
101 ! |
95 |
102 |
96 value: anObject |
103 value: anObject |
97 value := anObject. |
104 value := anObject. |
98 seqno := debugger currentInferiorStateSequnceNumber. |
105 seqno := debugger currentInferiorStateSequnceNumber. |
99 |
106 |
100 "Created: / 30-01-2018 / 00:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
107 "Created: / 30-01-2018 / 00:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
101 "Modified: / 30-01-2018 / 09:06:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
108 "Modified: / 30-01-2018 / 09:06:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 ! |
|
110 |
|
111 valueButNotStale |
|
112 "Return current value if it is up to date or nil if the value |
|
113 is stale and has not been updated. This method NEVER updates |
|
114 the value. |
|
115 " |
|
116 | retval | |
|
117 |
|
118 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifTrue:[ |
|
119 ^ value. |
|
120 ]. |
|
121 lock critical:[ |
|
122 (value ~~ InvalidValue and:[debugger currentInferiorStateSequnceNumber == seqno]) ifTrue:[ |
|
123 retval := value |
|
124 ] |
|
125 ]. |
|
126 ^ retval |
|
127 |
|
128 "Created: / 10-03-2021 / 14:50:58 / Jan Vrany <jan.vrany@labware.com>" |
|
129 ! |
|
130 |
|
131 valuePossiblyStale |
|
132 "Return current value, no matter whether its (possibly) stale or not. |
|
133 In other words, this method does not check nor update the value |
|
134 (if needed). |
|
135 " |
|
136 ^ value == InvalidValue ifTrue:[ nil ] ifFalse:[ value ] |
|
137 |
|
138 "Created: / 10-03-2021 / 14:36:03 / Jan Vrany <jan.vrany@labware.com>" |
102 ! ! |
139 ! ! |
103 |
140 |
104 !GDBTransientDataHolder methodsFor:'initialization'! |
141 !GDBTransientDataHolder methodsFor:'initialization'! |
105 |
142 |
106 setDebugger: aGDBDebugger factory: aBlock |
143 setDebugger: aGDBDebugger factory: aBlock |