GDBThreadGroup.st
changeset 174 18ef81a3fee5
parent 173 02546d4fbe6d
child 204 657ffb5e85fa
equal deleted inserted replaced
173:02546d4fbe6d 174:18ef81a3fee5
   110 
   110 
   111 executable
   111 executable
   112     "Return name path of the executable (if known) or nil (if unknown)"
   112     "Return name path of the executable (if known) or nil (if unknown)"
   113 
   113 
   114     (executable isNil and:[ pid notNil and:[self isStopped or:[debugger hasFeature:'async']]]) ifTrue:[
   114     (executable isNil and:[ pid notNil and:[self isStopped or:[debugger hasFeature:'async']]]) ifTrue:[
   115         | result tg |
   115         debugger send: GDBMI_list_thread_groups new andWithResultDo:[:result|
   116 
   116             | tg |
   117         result := debugger send: GDBMI_list_thread_groups new.
   117 
   118         result status ~~ CommandStatusDone ifTrue:[ 
   118             result status ~~ CommandStatusDone ifTrue:[ 
   119             self error: 'Failed to send command.'
   119                 self error: 'Failed to send command.'
       
   120             ].
       
   121             tg := (result propertyAt: 'groups') detect: [: each | each id = id ].
       
   122             "/ In some cases the executable is not known - it may not exist (such as
       
   123             "/ when debugging bare-metal code) or the target does not report it
       
   124             "/ (may happen, for example wine's winedbg GDB proxy does not report
       
   125             "/ executable names).
       
   126             "/ 
       
   127             "/ In this case, we store a sentinel object in `executable` instvar
       
   128             "/ to prevent repeated queries which are bound to fail (see the nil-check
       
   129             "/ above.
       
   130             executable := tg executableOrNil ? ExecutableSentinel.
   120         ].
   131         ].
   121         tg := (result propertyAt: 'groups') detect: [: each | each id = id ].
       
   122         "/ In some cases the executable is not known - it may not exist (such as
       
   123         "/ when debugging bare-metal code) or the target does not report it
       
   124         "/ (may happen, for example wine's winedbg GDB proxy does not report
       
   125         "/ executable names).
       
   126         "/ 
       
   127         "/ In this case, we store a sentinel object in `executable` instvar
       
   128         "/ to prevent repeated queries which are bound to fail (see the nil-check
       
   129         "/ above.
       
   130         executable := tg executableOrNil ? ExecutableSentinel.
       
   131     ].
   132     ].
   132     ^ executable == ExecutableSentinel ifTrue:[ nil ] ifFalse:[ executable ]
   133     ^ executable == ExecutableSentinel ifTrue:[ nil ] ifFalse:[ executable ]
   133 
   134 
   134     "Created: / 06-06-2017 / 00:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   135     "Created: / 06-06-2017 / 00:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   135     "Modified: / 26-03-2018 / 21:44:53 / jv"
   136     "Modified: / 26-03-2018 / 21:44:53 / jv"
   136     "Modified (comment): / 07-06-2018 / 10:09:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   137     "Modified: / 28-01-2019 / 14:57:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   137 !
   138 !
   138 
   139 
   139 executableOrNil
   140 executableOrNil
   140     ^ executable
   141     ^ executable
   141 
   142