GDBFrame.st
changeset 115 efb49f057011
parent 111 7ce18f6f18ac
child 126 fb73b0af430b
equal deleted inserted replaced
114:be5bdaecb9b3 115:efb49f057011
    72 addr
    72 addr
    73     ^ addr
    73     ^ addr
    74 !
    74 !
    75 
    75 
    76 file
    76 file
    77     "Return filename containing frame's function source."
    77     "Return filename (path) containing frame's function source."
    78     ^ fullname notNil ifTrue:[ fullname ] ifFalse:[ file ]
    78 
    79 
    79     | f |
    80     "Modified: / 11-06-2017 / 20:59:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    80 
       
    81     "/ GDB/MI provides two paths, `file` and `fullname`. 
       
    82     "/ 
       
    83     "/ However, sometimes GDB gets confused and does not return
       
    84     "/ anything directly useful, especially when debug info contains
       
    85     "/ relative paths with multiple segments. 
       
    86     "/ 
       
    87     "/ As a courtesy to the user, in that case try to resolve full
       
    88     "/ path here too. Hence the code below.
       
    89     "/
       
    90     "/ To avoid re-resolving of file each time this method is called,
       
    91     "/ cache resolved Filename in `fullname` instvar. 
       
    92 
       
    93     fullname isFilename ifTrue:[ 
       
    94         "/ Already resolved by the code below
       
    95         ^ fullname pathName
       
    96     ].
       
    97 
       
    98     f := fullname ? file.
       
    99     f isNil ifTrue:[ ^ nil ].
       
   100     f := f copyReplaceAll: $/ with: Filename separator.
       
   101     f := f asFilename.
       
   102 
       
   103     "/ check, if GDB returned correctly resolved filename...
       
   104     f exists ifTrue:[
       
   105         fullname := f.
       
   106         ^ fullname pathName
       
   107     ].
       
   108 
       
   109     "/ ...if not, try to look it up in source directories...
       
   110     self debugger directories do:[:d | 
       
   111         f := d asFilename / (fullname ? file).
       
   112         f exists ifTrue:[ 
       
   113             fullname := f.
       
   114             ^ fullname pathName.
       
   115         ].
       
   116     ].
       
   117 
       
   118     "/ ...if not found there...
       
   119     ^ nil
       
   120 
       
   121     "Modified: / 12-03-2018 / 10:32:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   122     "Modified: / 22-03-2018 / 16:52:52 / jv"
    81 !
   123 !
    82 
   124 
    83 from
   125 from
    84     ^ from
   126     ^ from
    85 !
       
    86 
       
    87 fullname
       
    88     ^ fullname
       
    89 !
   127 !
    90 
   128 
    91 func
   129 func
    92     ^ func
   130     ^ func
    93 !
   131 !