equal
deleted
inserted
replaced
20 |
20 |
21 "{ NameSpace: Smalltalk }" |
21 "{ NameSpace: Smalltalk }" |
22 |
22 |
23 GDBDebuggerObject subclass:#GDBInstructionsAndSourceLine |
23 GDBDebuggerObject subclass:#GDBInstructionsAndSourceLine |
24 instanceVariableNames:'file fullname line line_asm_insn' |
24 instanceVariableNames:'file fullname line line_asm_insn' |
25 classVariableNames:'SourceCache' |
25 classVariableNames:'SourceCache SourceCacheSize' |
26 poolDictionaries:'' |
26 poolDictionaries:'' |
27 category:'GDB-Core' |
27 category:'GDB-Core' |
28 ! |
28 ! |
29 |
29 |
30 !GDBInstructionsAndSourceLine class methodsFor:'documentation'! |
30 !GDBInstructionsAndSourceLine class methodsFor:'documentation'! |
53 !GDBInstructionsAndSourceLine class methodsFor:'initialization'! |
53 !GDBInstructionsAndSourceLine class methodsFor:'initialization'! |
54 |
54 |
55 initialize |
55 initialize |
56 "Invoked at system start or when the class is dynamically loaded." |
56 "Invoked at system start or when the class is dynamically loaded." |
57 |
57 |
58 "/ please change as required (and remove this comment) |
58 SourceCache := Dictionary new. |
59 |
59 SourceCacheSize := 16 |
60 SourceCache := CacheDictionary new: 16. |
60 |
61 |
61 "Modified (comment): / 30-10-2018 / 19:44:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
62 "Modified (format): / 07-08-2018 / 11:37:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 ! ! |
62 ! ! |
64 |
63 |
65 !GDBInstructionsAndSourceLine class methodsFor:'accessing-magritte'! |
64 !GDBInstructionsAndSourceLine class methodsFor:'accessing-magritte'! |
66 |
65 |
67 descriptionContainer |
66 descriptionContainer |
144 ! |
143 ! |
145 |
144 |
146 source |
145 source |
147 "Return the source (as StringCollection !!!!!!) or nil if not available" |
146 "Return the source (as StringCollection !!!!!!) or nil if not available" |
148 |
147 |
149 | f | |
148 | f s | |
150 |
149 |
151 f := self file. |
150 f := self file. |
152 f isNil ifTrue:[ ^ nil "no file, source not available" ]. |
151 f isNil ifTrue:[ ^ nil "no file, source not available" ]. |
153 ^ SourceCache at: f ifAbsentPut: [ f asFilename contents withTabsExpanded ]. |
152 s := SourceCache at: f ifAbsentPut: [ nil ]. |
|
153 s isNil ifTrue:[ |
|
154 SourceCache size >= SourceCacheSize ifTrue:[ |
|
155 SourceCache removeKey: (SourceCache keys anElement) |
|
156 ]. |
|
157 SourceCache at: f put: f asFilename contents withTabsExpanded |
|
158 ]. |
|
159 ^ s |
154 |
160 |
155 "Created: / 07-08-2018 / 11:32:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
161 "Created: / 07-08-2018 / 11:32:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
162 "Modified: / 30-10-2018 / 19:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
156 ! ! |
163 ! ! |
157 |
164 |
158 !GDBInstructionsAndSourceLine methodsFor:'enumerating'! |
165 !GDBInstructionsAndSourceLine methodsFor:'enumerating'! |
159 |
166 |
160 instructionsDo: aBlock |
167 instructionsDo: aBlock |