--- a/GDBVariable.st Thu Mar 19 08:25:30 2015 +0000
+++ b/GDBVariable.st Thu Mar 19 08:43:28 2015 +0000
@@ -1,9 +1,11 @@
+"{ Encoding: utf8 }"
+
"{ Package: 'jv:libgdbs' }"
"{ NameSpace: Smalltalk }"
GDBTransientObject subclass:#GDBVariable
- instanceVariableNames:'frame name value'
+ instanceVariableNames:'frame name value varobj'
classVariableNames:''
poolDictionaries:''
category:'GDB-Core'
@@ -27,9 +29,47 @@
!
value
- ^ value
+ ^ self varobj value
"Created: / 27-02-2015 / 23:37:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-03-2015 / 16:47:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!GDBVariable methodsFor:'accessing-private'!
+
+varobj
+ varobj isNil ifTrue:[
+ | result currentThreadId currentFrameId |
+
+ result := debugger send: (GDBMI_thread_list_ids new).
+ currentThreadId := result propertyAt: 'current-thread-id'.
+ result := debugger send: (GDBMI_stack_info_frame new).
+ currentFrameId := (result propertyAt: 'frame') level.
+
+ frame thread id ~= currentThreadId ifTrue:[
+ debugger send: (GDBMI_thread_select new arguments:(Array with:frame thread id)).
+ debugger send: (GDBMI_stack_select_frame new arguments:(Array with:frame level)).
+ ] ifFalse:[
+ frame level ~= currentFrameId ifTrue:[
+ debugger send: (GDBMI_stack_select_frame new arguments:(Array with:frame level)).
+ ].
+ ].
+
+ result := debugger send: (GDBMI_var_create new arguments: { '-' . '*' . name }).
+
+ frame thread id ~= currentThreadId ifTrue:[
+ debugger send: (GDBMI_thread_select new arguments:currentThreadId).
+ debugger send: (GDBMI_stack_select_frame new arguments:currentFrameId).
+ ] ifFalse:[
+ frame level ~= currentFrameId ifTrue:[
+ debugger send: (GDBMI_stack_select_frame new arguments:currentFrameId).
+ ].
+ ].
+ ].
+ ^ varobj value
+
+ "Created: / 27-02-2015 / 17:18:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 18-03-2015 / 16:52:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GDBVariable methodsFor:'initialization'!