GDBLocalProcess.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 30 Oct 2018 20:04:25 +0000
changeset 159 5a364902a0fa
parent 152 fab425b52c21
child 164 a16705f64a64
permissions -rw-r--r--
Portability: use `#digitValue` instead of `#digitValueRadix`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
This library is free software; you can redistribute it and/or
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
License as published by the Free Software Foundation; either
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
version 2.1 of the License. 
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
This library is distributed in the hope that it will be useful,
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
Lesser General Public License for more details.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
License along with this library; if not, write to the Free Software
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs' }"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: Smalltalk }"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
GDBProcess subclass:#GDBLocalProcess
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:'pid'
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
	classVariableNames:''
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'GDB-Private'
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!GDBLocalProcess class methodsFor:'documentation'!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
copyright
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
jv:libgdbs - GNU Debugger Interface Library
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
Copyright (C) 2015-now Jan Vrany
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
This library is free software; you can redistribute it and/or
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
License as published by the Free Software Foundation; either
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
version 2.1 of the License. 
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
This library is distributed in the hope that it will be useful,
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
Lesser General Public License for more details.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
License along with this library; if not, write to the Free Software
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
documentation
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    GDBLocalProcess is a specialization of GDBProcess that spawns a
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    local GDB process on a host machine. Spawning a running of GDB
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    process is ully managed by an (sub)instance of `GDBLocalProcess`
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    Due to platform differences, there are concrete variants for 
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
    different platforms.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
    [author:]
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
        Jan Vrany <jan.vrany@fit.cvut.cz>
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    [instance variables:]
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    [class variables:]
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    [see also:]
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
        GDBStXUnixProcess
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
        GDBStXWindowsProcess
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
        GDBRemoteProcess
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
! !
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
!GDBLocalProcess methodsFor:'accessing'!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
id
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    "Return a string identification of this GDBProcess. 
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
     Used for debugging purposes only."
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    ^ pid
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    "Created: / 19-10-2018 / 10:09:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    "Modified: / 20-10-2018 / 06:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
! !
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
!GDBLocalProcess methodsFor:'initialization & release'!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
release
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
    (pid notNil and:[pid > 1]) ifTrue:[
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
        OperatingSystem sendSignal:(OperatingSystem sigTERM) to: pid.       
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    ].
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    "Created: / 20-10-2018 / 07:12:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
! !
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
!GDBLocalProcess methodsFor:'private'!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    99
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
exited: status
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   101
    "Called when spawn GDB process terminates for whatever reason"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
    pid := nil.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
    connection released: status
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   104
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
    "Created: / 20-06-2014 / 21:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
    "Modified: / 12-01-2018 / 21:50:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
    "Modified (comment): / 17-10-2018 / 22:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
! !
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109