extensions.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Jul 2019 13:31:11 +0100
changeset 178 5d1c3e5fab6b
parent 177 fd154978bab5
child 186 8110a5e2c704
permissions -rw-r--r--
Initial support for VDB python-based variable objects Due to a limitation of GDB itself, one cannot create variable object for "synthetic" argument/local created by custom frame decorator. Therefore one cannot "dig deeper" and inspect contents of such a variable in case it is a kind of composite - like an object on a heap referring to another objects. This is a problem when a debugee is does not have debug information and / or it's language is not C - such as when debugging JITed code. This (experimental) commit adds a parallel implementation of variable objects done completely in python. This new varobj MI interface is a super-set of GDB's builtin varobj MI interface.

"{ Package: 'jv:vdb' }"!

!GDBDebugger methodsFor:'event handling'!

onRRExitEvent:anRRExitEvent
    | status |

    anRRExitEvent rr announcer unsubscribe: self.
    status := anRRExitEvent status.
    (status success or:[ status status == #signal and:[status code == OperatingSystem sigTERM ]]) ifFalse:[ 
        Dialog warn: (self class classResources string: 'Replay server terminated with error')
    ].

    "Created: / 31-07-2018 / 09:37:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBDebugger methodsFor:'commands - API'!

pythonImportVDB
    "Import VDB support"

    | pythonDir |

    pythonDir := (Smalltalk getPackageDirectoryForPackage: #jv:vdb) / 'python'.
    self assert: pythonDir isDirectory.

    self pythonSysPathAppend: pythonDir.
    self pythonImport: 'vdb'

    "Created: / 08-07-2019 / 11:44:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBDebugger methodsFor:'commands - API'!

targetConnectRR: rr
    "Connect to rr replay server"

    "/ rr suggest to connect as follows:
    "/ 
    "/     gdb '-l' '10000' '-ex' 'set sysroot /' '-ex' 'target extended-remote 127.0.0.1:9876' ...
    "/
    self send: (GDBMI_gdb_set arguments: #('sysroot' '/')).
    self targetConnect: 'extended-remote'  parameters: (Array with: '127.0.0.1:' with: rr port).
    rr announcer when: RRExitEvent send: #onRRExitEvent: to: self.

    "Created: / 26-07-2018 / 21:48:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 31-07-2018 / 09:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBVariableObject methodsFor:'inspecting'!

inspector2TabVariable
    <inspector2Tab>

    | varObjApp |

    varObjApp := Smalltalk at: #VDBVariableObjectListApplication ifAbsent:[ ^ nil ].
    ^ (self newInspector2Tab)
        label:'Variable';
        priority:95;
        "/ view: [ ... ];
        application: [ varObjApp new debugger: debugger; variableObjectList: (Array with: self); yourself ];
        "/ text: [ ... ];
        yourself

    "Modified: / 03-02-2018 / 09:58:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!jv_vdb class methodsFor:'documentation'!

extensionsVersion_HG

    ^ '$Changeset: <not expanded> $'
! !