GDBDebugger.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 23 Jun 2019 12:29:15 +0100
changeset 196 80ab1ba7990a
parent 190 0509fe9ad879
child 200 e9250da35d87
permissions -rw-r--r--
Add property API to `GDBDebugger` This allows clients to associate custom data with debugger instance.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
128
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
     1
"{ Encoding: utf8 }"
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
     2
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     3
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     4
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     5
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     6
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     7
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     8
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
     9
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    10
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    11
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    12
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    13
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    15
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    16
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    17
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    18
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    20
"
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ Package: 'jv:libgdbs' }"
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
53
63669c2c0f9e Test fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 48
diff changeset
    23
"{ NameSpace: Smalltalk }"
63669c2c0f9e Test fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 48
diff changeset
    24
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
    25
Object subclass:#GDBDebugger
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
    26
	instanceVariableNames:'connection commandSequenceNumber inferiorStateSequenceNumber
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
    27
		inferiors breakpoints selectedInferior selectedThread
102
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
    28
		selectedFrame prettyPrintingEnabled frameFiltersEnabled
165
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
    29
		finalizationRegistry debuggerFeatures targetFeatures
196
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
    30
		supportedCommands directories properties'
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
	classVariableNames:''
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
    32
	poolDictionaries:'GDBCommandStatus GDBFeatures'
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
	category:'GDB-Core'
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
!
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    36
!GDBDebugger class methodsFor:'documentation'!
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    37
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    38
copyright
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    39
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    40
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    41
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    42
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    43
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    44
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    45
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    46
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    47
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    48
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    49
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    50
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    51
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    52
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    53
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    54
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    55
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    56
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 90
diff changeset
    57
! !
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    58
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
    59
!GDBDebugger class methodsFor:'instance creation'!
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    61
new    
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    62
    ^ self newWithProcess: GDBProcess new
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    63
93
b1715ebf8df1 Resurected old `GDBProcess` implementation using pipes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    64
    "Modified: / 12-12-2017 / 21:15:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    65
!
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    67
newWithProcess: aGDBProcess
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    68
    ^ self basicNew initializeWithProcess: aGDBProcess
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    69
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    70
    "Created: / 20-06-2014 / 21:44:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
! !
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
    73
!GDBDebugger methodsFor:'accessing'!
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    74
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    75
announcer
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
    76
    ^ connection eventAnnouncer.
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    77
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    78
    "Created: / 02-06-2014 / 23:06:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    79
!
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    80
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    81
breakpointForId: id
175
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    82
    ^ self breakpointForId: id ifAbsent:[self error: ('No breakpoint with id ''%1'' found!!' bindWith: id)]
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    83
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    84
    "Created: / 18-05-2018 / 13:39:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    85
    "Modified: / 07-02-2019 / 15:04:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    86
!
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    87
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    88
breakpointForId: id ifAbsent: block
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    89
    self breakpoints do:[:bp |
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    90
        bp number = id ifTrue:[ ^ bp ].
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    91
        bp locations do: [ :loc |
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    92
            loc number = id ifTrue:[ ^ loc ].
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    93
        ].
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    94
    ].
175
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    95
    ^ block value.
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    96
175
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
    97
    "Created: / 07-02-2019 / 15:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    98
!
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
    99
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   100
breakpoints
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   101
    breakpoints isNil ifTrue:[ 
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   102
        breakpoints := List new.
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   103
    ].
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   104
    ^ breakpoints
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   105
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   106
    "Created: / 06-07-2017 / 16:06:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   107
!
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   108
79
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   109
consoleInput
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   110
    ^ connection consoleInput
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   111
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   112
    "Created: / 31-05-2017 / 23:20:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   113
    "Modified: / 02-06-2017 / 23:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   114
!
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   115
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   116
consoleOutput
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   117
    ^ connection consoleOutput
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   118
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   119
    "Created: / 31-05-2017 / 23:20:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   120
    "Modified: / 02-06-2017 / 23:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   121
!
303c4edc75ad `GDBProcess` refatored to have console interpreter on STDIN/STDOUT
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 78
diff changeset
   122
114
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   123
directories
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   124
    "Return a list of directories where GDB looks for source code and an Array.
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   125
     Variables such as $cdir and $cwd are NOT expanded.
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   126
    "
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   127
    | result |
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   128
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   129
    directories isNil ifTrue:[
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   130
        result := self send: (GDBMI_gdb_show arguments: #('directories')).
119
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   131
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   132
        OperatingSystem isMSWINDOWSlike ifTrue:[ 
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   133
            "/ On Windows, GDB uses cygwin paths (i.e., slashed, unix-like paths). 
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   134
            "/ Convert them to Windows paths as used in Smalltalk/X:
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   135
            directories := ((result propertyAt: #value) tokensBasedOn: $;) 
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   136
                                collect: [ :d | (Filename cygNamed:d) pathName ]
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   137
                                as: Array.
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   138
        ] ifFalse:[ 
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   139
            directories := ((result propertyAt: #value) tokensBasedOn: $:) asArray
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   140
        ].
114
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   141
    ].
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   142
    ^ directories
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   143
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   144
    "Created: / 09-03-2018 / 12:05:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
119
258bf0b2317c Fixed `GDBDebugger >> directories` to work on Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 116
diff changeset
   145
    "Modified: / 03-04-2018 / 21:14:45 / jv"
114
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   146
!
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   147
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   148
features
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   149
    "Return a list of features supported ty this version og GDB.
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   150
     See 
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   151
            * GDBFeatures` pool
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   152
            * https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Support-Commands.html,
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   153
              command `-list-features`
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   154
    "
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   155
    ^ debuggerFeatures , (targetFeatures ? connection nativeTargetFeatures)
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   156
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   157
    "Created: / 07-02-2018 / 10:50:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   158
    "Modified: / 26-03-2018 / 21:35:22 / jv"
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   159
    "Modified: / 09-04-2018 / 15:39:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   160
!
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   161
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   162
inferiorForId: id
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   163
    ^ inferiors ? #() detect:[:e | e id = id ] ifNone:[ 
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   164
        self error: ('No inferior (thread group) with id ''%1'' found!!' bindWith: id)
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   165
    ].
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   166
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   167
    "Created: / 07-09-2014 / 21:22:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   168
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
   169
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   170
inferiorStderr
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   171
    ^ connection inferiorPTY master
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   172
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   173
    "Created: / 09-06-2014 / 10:01:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11
474fbb650afe PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   174
    "Modified: / 09-06-2014 / 18:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   175
!
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   176
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   177
inferiorStdin
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   178
    ^ connection inferiorPTY master
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   179
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   180
    "Created: / 09-06-2014 / 10:00:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11
474fbb650afe PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   181
    "Modified: / 09-06-2014 / 18:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   182
!
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   183
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   184
inferiorStdout
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   185
    ^ connection inferiorPTY master
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   186
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   187
    "Created: / 09-06-2014 / 10:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11
474fbb650afe PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   188
    "Modified: / 09-06-2014 / 18:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
   189
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
   190
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
   191
inferiors
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   192
    ^ inferiors ? #()
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   193
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   194
    "Modified: / 06-07-2017 / 16:06:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   195
!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   196
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   197
selectedInferior
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   198
    selectedInferior isNil ifTrue:[ 
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   199
        inferiors size == 1 ifTrue:[ 
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   200
            ^ inferiors anElement.
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   201
        ].
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   202
    ].
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   203
    ^ selectedInferior
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   204
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   205
    "Created: / 07-09-2014 / 23:02:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
106
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   206
!
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   207
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   208
threadForId: id
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   209
    inferiors ? #() do:[:tg |
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   210
        tg threads do:[:t | 
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   211
            t id = id ifTrue:[ ^ t ]
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   212
        ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   213
    ].
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   214
    self error: ('No thread with id ''%1'' found!!' bindWith: id)
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   215
12c96f17fc53 Variable objects: invalidate variable object when thread on inferior terminates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 105
diff changeset
   216
    "Created: / 04-02-2018 / 21:37:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   217
! !
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   218
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
   219
!GDBDebugger methodsFor:'accessing-private'!
10
f04a22c9b16c Use special PTY for inferior input/output...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   220
113
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   221
connectionTrace
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   222
    ^ connection trace
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   223
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   224
    "Created: / 09-03-2018 / 10:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   225
!
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
   226
19
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   227
currentInferiorStateSequnceNumber
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   228
    ^ inferiorStateSequenceNumber
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   229
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   230
    "Created: / 19-06-2014 / 22:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   231
!
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   232
102
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
   233
finalizationRegistry
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
   234
    ^ finalizationRegistry
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
   235
!
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
   236
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   237
nextCommandSequnceNumber
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   238
    commandSequenceNumber := commandSequenceNumber + 1.
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   239
    commandSequenceNumber == SmallInteger maxVal ifTrue:[ 
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   240
        commandSequenceNumber := 0.
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   241
    ].
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   242
    ^ commandSequenceNumber
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   243
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   244
    "Created: / 02-06-2014 / 23:48:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   245
!
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   246
19
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   247
nextInferiorStateSequnceNumber
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   248
    inferiorStateSequenceNumber := inferiorStateSequenceNumber + 1.
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   249
    inferiorStateSequenceNumber == SmallInteger maxVal ifTrue:[
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   250
        inferiorStateSequenceNumber := 0.
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   251
    ].
19
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
   252
    ^ inferiorStateSequenceNumber
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   253
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   254
    "Created: / 02-06-2014 / 23:48:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
185
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   255
!
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   256
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   257
process
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   258
    "Return a (sub)instance of `GDBProcess` used but this debugger.
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   259
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   260
     This method is provided for stx:libgdbs debugging purposes and
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   261
     should not be normally used."
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   262
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   263
    ^ connection process
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   264
4e1be69b39ce API: add `GDBDebugger >> process`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 180
diff changeset
   265
    "Created: / 27-03-2019 / 09:20:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   266
! !
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   267
196
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   268
!GDBDebugger methodsFor:'accessing-properties'!
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   269
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   270
properties
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   271
    ^ self objectAttributes
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   272
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   273
    "Modified: / 23-06-2019 / 12:22:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   274
!
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   275
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   276
propertyAt: name    
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   277
    ^ self objectAttributeAt: name
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   278
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   279
    "Created: / 31-05-2014 / 00:00:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   280
    "Modified: / 23-06-2019 / 12:22:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   281
!
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   282
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   283
propertyAt: name put: value
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   284
    self assert: name isSymbol.
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   285
    ^ self objectAttributeAt: name put: value.
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   286
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   287
    "Created: / 31-05-2014 / 00:01:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   288
    "Modified: / 23-06-2019 / 12:22:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   289
! !
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   290
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   291
!GDBDebugger methodsFor:'attributes access'!
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   292
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   293
objectAttributes
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   294
    ^ properties
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   295
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   296
    "Created: / 18-06-2014 / 07:56:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   297
!
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   298
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   299
objectAttributes: aDictionary
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   300
    properties := aDictionary
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   301
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   302
    "Created: / 18-06-2014 / 07:57:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   303
! !
80ab1ba7990a Add property API to `GDBDebugger`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 190
diff changeset
   304
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
   305
!GDBDebugger methodsFor:'commands'!
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   306
56
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 53
diff changeset
   307
send: command
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   308
    "Execute given `command` and wait until it finishes and return its result.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   309
     `command` may be either a GDBCommand or string, in which case it will
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   310
     be parsed into a GDBCommand. 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   311
   "
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   312
    ^ self send:command andWait:true.
8
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   313
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   314
    "Created: / 03-06-2014 / 00:10:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   315
    "Modified (comment): / 08-03-2015 / 05:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   316
!
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   317
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   318
send:command andWait:wait 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   319
    "Sends given `command` to GDB. If `wait` is true, wait for
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   320
     command to finish and return the command result.  
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   321
     Otherwise, return nil immediately.
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   322
85
6fea1000a2a5 Implemented proper quoting of MI commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   323
     If `wait` is true and if command results in an error GDBError
6fea1000a2a5 Implemented proper quoting of MI commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   324
     is thrown.
6fea1000a2a5 Implemented proper quoting of MI commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   325
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   326
     `command` may be either a GDBCommand or string, in which case it will
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   327
     be parsed into a GDBCommand.           
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   328
    "
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   329
    
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   330
    | blocker result |
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   331
105
1d4ca4370d05 Report gdb's exist status in `GDBExitEvent` in case `gdb` terminates prematurely
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   332
    self assert: self isConnected.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   333
    ^ wait ifTrue:[
148
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   334
        self 
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   335
            assert:Processor activeProcess ~~ connection eventDispatchProcess
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   336
            message:'Cannot send commands from within event dispatching process. Would deadlock'.
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   337
        blocker := Semaphore new.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   338
        self send: command andWithResultDo: [ :r | 
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   339
            result := r.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   340
            blocker signal
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   341
        ].
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   342
        blocker wait.
85
6fea1000a2a5 Implemented proper quoting of MI commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   343
        result isError ifTrue:[
88
90c50fd6374c Introduced new exception class: `GDBCommandFailedError`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 87
diff changeset
   344
            GDBCommandFailedError raiseForResult: result.
85
6fea1000a2a5 Implemented proper quoting of MI commands
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   345
        ].
40
0ce76b671515 Some more support for stack frames.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
   346
        result.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   347
    ]
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   348
    ifFalse:[
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   349
        | cmd |
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   350
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   351
        cmd := command.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   352
        cmd isString ifTrue:[
174
18ef81a3fee5 Add `GDBCLICommand >> #operation` returning (expanded) CLI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 172
diff changeset
   353
            cmd := GDBCommand parse:cmd.
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   354
        ].    
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   355
        cmd token: self nextCommandSequnceNumber.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   356
        connection pushEvent:(GDBCommandEvent new command:cmd).
40
0ce76b671515 Some more support for stack frames.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
   357
        nil.
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   358
    ]
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   359
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   360
    "Created: / 02-06-2014 / 23:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   361
    "Modified: / 26-03-2018 / 21:19:59 / jv"
174
18ef81a3fee5 Add `GDBCLICommand >> #operation` returning (expanded) CLI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 172
diff changeset
   362
    "Modified: / 28-01-2019 / 21:26:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   363
!
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   364
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   365
send:command andWaitFor:eventHandlers
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   366
    "Sends given `command` to GDB and then wait for events mathing 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   367
     `eventHandlers`. 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   368
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   369
     Params:
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   370
     `command`      may be either a GDBCommand or string, in which case it will
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   371
                    be parsed into a GDBCommand.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   372
     `eventHandler` may be either nil or event class or one arg block or collection
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   373
                    of event classes or blocks.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   374
                    - If nil then do not wait for anything (use nil for async send)
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   375
                    - If event class, then wait for an event of that class. Note, that
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   376
                      subclasses are handled too.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   377
                    - If block, then wait for an event for which the block returns true.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   378
                    - If collectio, then wait for a sequence of events, each matched as above.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   379
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   380
     Returns:       a matching event or events (in case a collection of handlers has been passes)"
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   381
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   382
    ^ self send: command andWaitFor: eventHandlers withTimeoutMs: nil
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   383
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   384
    "Created: / 08-03-2015 / 06:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   385
!
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   386
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   387
send:command andWaitFor:eventHandlers withTimeoutMs:timeout 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   388
    "Sends given `command` to GDB and then wait for events mathing 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   389
     `eventHandlers`. Raise a TimeoutError if expected events don't arrive
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   390
     in specified time.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   391
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   392
     Params:
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   393
     `command`      may be either a GDBCommand or string, in which case it will
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   394
                    be parsed into a GDBCommand.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   395
     `eventHandler` may be either nil or event class or one arg block or collection
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   396
                    of event classes or blocks.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   397
                    - If nil then do not wait for anything (use nil for async send)
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   398
                    - If event class, then wait for an event of that class. Note, that
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   399
                      subclasses are handled too.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   400
                    - If block, then wait for an event for which the block returns true.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   401
                    - If collectio, then wait for a sequence of events, each matched as above.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   402
     `timeout`       wait at most that much milliseconds, throw TimeoutError otherwise. If `timeout` == mil
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   403
                    then wait for indefinitly
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   404
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   405
     Returns:       a matching event or events (in case a collection of handlers has been passes)"
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   406
    
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   407
    | commandObject |
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   408
105
1d4ca4370d05 Report gdb's exist status in `GDBExitEvent` in case `gdb` terminates prematurely
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   409
    self assert: self isConnected.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   410
    command isString ifTrue:[
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   411
        commandObject := GDBCommand parse: command.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   412
        commandObject token:self nextCommandSequnceNumber.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   413
    ] ifFalse:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   414
        commandObject := command.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   415
        commandObject token isNil ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   416
            commandObject token:self nextCommandSequnceNumber.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   417
        ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   418
    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   419
    ^ self 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   420
        do:[ connection pushEvent:(GDBCommandEvent new command: commandObject) ] 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   421
        andWaitFor: eventHandlers 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   422
        withTimeoutMs: timeout
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   423
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   424
    "Created: / 07-03-2015 / 11:38:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   425
    "Modified: / 19-01-2019 / 23:05:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   426
!
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   427
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   428
send:command andWithResultDo: block
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   429
    "Sends given `command` to GDB and return nil immediately. Once the command
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   430
     is processed and result returned, evaluate `block` passing the
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   431
     result (as instance of GDBCommandResult)
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   432
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   433
     The `command` may be either a GDBCommand or string, in which case it will
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   434
     be parsed into a GDBCommand.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   435
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   436
     When calling this method from a UI code, i.e., from an UI even loop, keep
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   437
     in mind that the block will be evaluated from within GDB's internal event
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   438
     dispatch loop.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   439
166
5cb191425081 Add class for new MI command `-complete`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
   440
     It's is a good practice not to do anything real within the block but just
5cb191425081 Add class for new MI command `-complete`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
   441
     grab the result and let it be processed within UI event loop, e.g.
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   442
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   443
         doSomeAction
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   444
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   445
             debugger send: (GDBMI_data_read_memory arguments:...) 
166
5cb191425081 Add class for new MI command `-complete`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 165
diff changeset
   446
                      andWithResultDo:[ :result | self sensor pushUserEvent: #updateWithResult: with: result ].
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   447
    "
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   448
    
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   449
    | cmd  token handler1  handler2  result |
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   450
105
1d4ca4370d05 Report gdb's exist status in `GDBExitEvent` in case `gdb` terminates prematurely
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 104
diff changeset
   451
    self assert: self isConnected.
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   452
    cmd := command.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   453
    cmd isString ifTrue:[
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   454
        cmd := GDBCommand parse:cmd.
96
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   455
    ].
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   456
    token := self nextCommandSequnceNumber.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   457
    cmd token:token.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   458
    handler1 := [:ev | 
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   459
        ev token == token ifTrue:[
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   460
            connection eventAnnouncer unsubscribe:handler1.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   461
            result := ev result.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   462
            connection eventAnnouncerInternal when:GDBEventSetProcessingFinished
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   463
                do:handler2.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   464
        ]
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   465
    ].
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   466
    handler2 := [:ev | 
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   467
        connection eventAnnouncerInternal unsubscribe:handler2.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   468
        block value: result.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   469
    ].
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   470
    connection eventAnnouncer when:GDBCommandResultEvent do:handler1.
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   471
    connection pushEvent:(GDBCommandEvent new command:cmd).
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   472
    ^ nil
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   473
43591d874c9f Added API method `GDBDebugger >> send:andWithResultDo:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
   474
    "Created: / 26-01-2018 / 21:47:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   475
    "Modified: / 26-03-2018 / 21:48:02 / jv"
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   476
    "Modified: / 19-01-2019 / 23:06:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   477
! !
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   478
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   479
!GDBDebugger methodsFor:'commands - API'!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   480
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   481
attach: aStringOrInteger
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   482
    "Attach to a running process.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   483
     API equivalent to CLI command:
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   484
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   485
        (gdb) attach <aStringOrInteger>
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   486
    "
97
b17c889076e4 Added API for memory dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 96
diff changeset
   487
    self send:(GDBMI_target_attach arguments:(Array with: aStringOrInteger asString)).
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   488
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   489
    "Created: / 05-06-2017 / 17:08:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
97
b17c889076e4 Added API for memory dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 96
diff changeset
   490
    "Modified: / 25-01-2018 / 23:28:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   491
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   492
126
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   493
disassembleFile: file line: line count: count
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   494
    "
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   495
    Disassemble `count` source lines from `file` starting at line `line`.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   496
    Returns a list of GDBInstructionsAndSourceLine objects.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   497
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   498
    If `count` is nil, then disassemble entire function at given
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   499
    source `file` and `line`.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   500
    "
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   501
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   502
    | cmd result disassembly |
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   503
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   504
    self assert: file isString.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   505
    self assert: line isInteger.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   506
    self assert:(count isNil or:[ count isInteger ]).
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   507
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   508
    count notNil ifTrue:[ 
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   509
        cmd := GDBMI_data_disassemble arguments: (Array with: '-f' with: file with: '-l' with: line with: '-n' with: count with: '--' with: 5)
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   510
    ] ifFalse:[ 
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   511
        cmd := GDBMI_data_disassemble arguments: (Array with: '-f' with: file with: '-l' with: line                        with: '--' with: 5)
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   512
    ].
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   513
    result := self send: cmd.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   514
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   515
    disassembly := result propertyAt: 'asm_insns'
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   516
.   disassembly do:[:each | each setDebugger: self ].
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   517
    ^ disassembly
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   518
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   519
    "Created: / 22-06-2018 / 11:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   520
!
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   521
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   522
disassembleFunction: address
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   523
    "
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   524
    Disassemble function at given `address` (given as String). Address
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   525
    might be any expression evaluable by GDB or function name (as it 
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   526
    appears in debug info)
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   527
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   528
    WARNING: This requires feature 'data-disassemble-a-option'.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   529
    This feature is not present in GDB as of 8.1 and likely won't be in
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   530
    8.2.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   531
    "
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   532
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   533
    | result disassembly |
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   534
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   535
    self assert: address isString.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   536
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   537
    self ensureFeature: 'data-disassemble-a-option'.
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   538
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   539
    result := self send: (GDBMI_data_disassemble arguments: (Array with: '-a' with: address with: '--' with: 5)).
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   540
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   541
    disassembly := result propertyAt: 'asm_insns'
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   542
.   disassembly do:[:each | each setDebugger: self ].
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   543
    ^ disassembly
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   544
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   545
    "Created: / 03-07-2018 / 14:31:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   546
!
fb73b0af430b Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 120
diff changeset
   547
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   548
enableFrameFilters
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   549
    "Enables frame filters & frame decorators for MI interface. Once enabled,
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   550
     cannot be turned off.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   551
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   552
     @see GDBMI_enable_frame_filters"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   553
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   554
    | result |
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   555
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   556
    self ensureFeature: DebuggerFeaturePython.  
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   557
    result := self send: GDBMI_enable_frame_filters new.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   558
    result isDone ifTrue:[ 
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   559
        frameFiltersEnabled := true.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   560
    ] ifFalse:[ 
153
dd55019f1d86 Partability: use ANSI `#signal:` to raise an exception
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 148
diff changeset
   561
        GDBError signal: 'failed to enable frame filters'
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   562
    ].
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   563
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   564
    "Created: / 12-06-2017 / 09:29:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
153
dd55019f1d86 Partability: use ANSI `#signal:` to raise an exception
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 148
diff changeset
   565
    "Modified: / 21-10-2018 / 08:07:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   566
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   567
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   568
enablePrettyPrinting
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   569
    "Enables pretty printing for MI interface. Once enabled,
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   570
     cannot be turned off.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   571
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   572
     @see GDBMI_enable_pretty_printing"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   573
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   574
    | result |
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   575
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   576
    self ensureFeature: DebuggerFeaturePython.  
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   577
    result := self send: GDBMI_enable_pretty_printing new.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   578
    result isDone ifTrue:[ 
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   579
        prettyPrintingEnabled := true.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   580
    ] ifFalse:[ 
153
dd55019f1d86 Partability: use ANSI `#signal:` to raise an exception
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 148
diff changeset
   581
        GDBError signal: 'failed to enable pretty printing'
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   582
    ].
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   583
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   584
    "Created: / 12-06-2017 / 09:29:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
153
dd55019f1d86 Partability: use ANSI `#signal:` to raise an exception
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 148
diff changeset
   585
    "Modified: / 21-10-2018 / 08:07:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   586
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   587
109
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   588
evaluate: expression
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   589
    "Evaluates passed `expression` (in target language) in current thread.
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   590
     Returns the result as `GDBVariableObject`,"
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   591
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   592
    ^ self evaluate: expression in: nil
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   593
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   594
    "Created: / 20-03-2018 / 22:53:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   595
!
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   596
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   597
evaluate: expression in: frame
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   598
    "Evaluates passed `expression` (in target language). If
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   599
     `frame` (as `GDBFrame`) is given, evaluate expression in
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   600
     context of that `frame`.
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   601
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   602
     Returns the result as `GDBVariableObject`,"
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   603
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   604
    | result varobj |
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   605
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   606
    frame notNil ifTrue:[
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   607
        result := self send: (GDBMI_var_create new arguments: (Array with: '--thread' with: frame thread id with: '--frame' with: frame level with: '-' with: '*' with: expression)).
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   608
    ] ifFalse:[
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   609
        result := self send: (GDBMI_var_create new arguments: (Array with: '-' with: '*' with: expression)).
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   610
    ].
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   611
    varobj := result value.
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   612
    varobj 
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   613
        setDebugger: self; 
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   614
        setExpression: expression;
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   615
        setFrame: frame;
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   616
        registerForFinalization. 
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   617
    ^ varobj
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   618
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   619
    "Created: / 13-02-2018 / 22:21:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   620
    "Modified (format): / 20-03-2018 / 22:55:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   621
!
f57ce907abf4 Variable objects: added `GDBVariableObject >> #duplicate`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 106
diff changeset
   622
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   623
executable: aStringOrFilename
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   624
    "Sets the executable to debug. 
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   625
     API equivalent to CLI command:
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   626
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   627
        (gdb) exec-file <aStringOrFilename>
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   628
    "
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   629
    self executable: aStringOrFilename arguments: nil
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   630
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   631
    "Created: / 28-02-2015 / 00:19:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   632
    "Modified: / 05-06-2017 / 17:06:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   633
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   634
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   635
executable: aStringOrFilename arguments: anArray"of String"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   636
    "Sets the executable to debug and argument to pass to it.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   637
     API equivalent to CLI command:
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   638
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   639
        (gdb) exec-file <aStringOrFilename>   
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   640
        (gdb) set args <anArray>
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   641
    "
97
b17c889076e4 Added API for memory dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 96
diff changeset
   642
    self send:(GDBMI_file_exec_and_symbols arguments: (Array with: aStringOrFilename asString)).
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   643
    anArray notEmptyOrNil ifTrue:[ 
97
b17c889076e4 Added API for memory dumps
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 96
diff changeset
   644
        self send: (GDBMI_exec_arguments arguments: anArray).
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   645
    ].
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   646
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   647
    "Created: / 05-06-2017 / 17:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
   648
    "Modified: / 09-02-2018 / 09:44:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   649
!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   650
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   651
getParameter:name 
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   652
    "Teturn the current value of a GDB parameter. 
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   653
     See `show` GDB command.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   654
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   655
     Subscribe to `GDBCmdParamChangedEvent` to get notified
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   656
     when parameter value changes.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   657
    "
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   658
    
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   659
    | result |
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   660
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   661
    result := self send:(GDBMI_gdb_show arguments:(Array with:name)).
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   662
    ^ result propertyAt:#value.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   663
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   664
    "Created: / 19-01-2019 / 21:55:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   665
!
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   666
104
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   667
selectFrame: aGDBFrame
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   668
    "
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   669
    Set the context frame to given frame. This frame is then
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   670
    the contex frame for other commands, like finish, info frame
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   671
    and so on
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   672
      "
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   673
    self send:(GDBMI_thread_select new arguments:(Array with:aGDBFrame thread id))andWait:false.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   674
    self send:(GDBMI_stack_select_frame new arguments:(Array with:aGDBFrame level)) andWait:false.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   675
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   676
    "Created: / 01-02-2018 / 22:27:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   677
!
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   678
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   679
selectThread: aGDBThread
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   680
    "
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   681
    Set the context thread to given thread. This thread is then
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   682
    the contex thread for other commands (if no thread id is given)
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   683
    "
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   684
    self send:(GDBMI_thread_select new arguments:(Array with:aGDBThread id))andWait:false.
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   685
4add55336dfe Variable objects: automagically update values whenever changed.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 102
diff changeset
   686
    "Created: / 01-02-2018 / 22:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
128
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   687
!
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   688
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   689
setParameter:name to:value 
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   690
    "Set an internal GDB parameter named `name` to `value`.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   691
     See `set` GDB command.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   692
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   693
     Subscribe to `GDBCmdParamChangedEvent` to get notified
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   694
     when parameter value changes.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   695
    "
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   696
    
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   697
    self assert:value isString.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   698
    self send:(GDBMI_gdb_set arguments:(Array with:name with:value)).
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   699
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   700
    "Created: / 19-01-2019 / 21:56:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   701
!
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   702
128
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   703
targetConnect: type parameters: parameters
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   704
    "Connect to the remote target. `type` is the type of target, 
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   705
     for instance ‘extended-remote=’. `parameters` are device names, 
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   706
     host names and the like.
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   707
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   708
     See https://sourceware.org/gdb/onlinedocs/gdb/Target-Commands.html#Target-Commands
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   709
    "
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   710
    self send:(GDBMI_target_select arguments:(Array with: type) , parameters).
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   711
8d7c075a06b9 API: added GDBDebugger >> #targetConnect:parameters:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 126
diff changeset
   712
    "Created: / 26-07-2018 / 21:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   713
! !
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   714
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   715
!GDBDebugger methodsFor:'evaluating'!
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   716
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   717
do: block andWaitFor:eventHandlers
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   718
    "Evaluates a given block and then wait for events.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   719
     `eventHandlers`. 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   720
     Params:
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   721
     `block`        block to evaluate
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   722
     `eventHandler` may be either nil or event class or one arg block or collection
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   723
                    of event classes or blocks.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   724
                    - If nil then do not wait for anything (use nil for async send)
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   725
                    - If event class, then wait for an event of that class. Note, that
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   726
                      subclasses are handled too.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   727
                    - If block, then wait for an event for which the block returns true.
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   728
                    - If collection, then wait for a sequence of events, each matched as above.
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   729
     Returns:       a matching event or events (in case a collection of handlers has been passed)"
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   730
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   731
    ^ self do: block andWaitFor: eventHandlers withTimeoutMs: nil
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   732
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   733
    "Created: / 08-03-2015 / 07:30:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
   734
    "Modified (comment): / 12-06-2017 / 09:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   735
!
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   736
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   737
do: block andWaitFor:eventHandlers withTimeoutMs:timeout 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   738
    "Evaluates a given block and then wait for events.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   739
     `eventHandlers`. Raise a TimeoutError if expected events don't arrive
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   740
     in specified time.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   741
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   742
     Params:
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   743
     `block`        block to evaluate
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   744
     `eventHandler` may be either nil or event class or one arg block or collection
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   745
                    of event classes or blocks.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   746
                    - If nil then do not wait for anything (use nil for async send)
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   747
                    - If event class, then wait for an event of that class. Note, that
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   748
                      subclasses are handled too.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   749
                    - If block, then wait for an event for which the block returns true.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   750
                    - If collectio, then wait for a sequence of events, each matched as above.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   751
     `timeout`       wait at most that much milliseconds, throw TimeoutError otherwise. If `timeout` == mil
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   752
                    then wait for indefinitly
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   753
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   754
     Returns:       a matching event or events (in case a collection of handlers has been passes)"
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   755
    
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   756
    | handlersArray handlerFinal eventsArray blocker |
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   757
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   758
    eventHandlers isNil ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   759
        "/ Asynchronous send...
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   760
        self assert:timeout isNil.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   761
        block value.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   762
        ^ nil
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   763
    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   764
    "/ Synchronous send...
148
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   765
    self 
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   766
        assert:Processor activeProcess ~~ connection eventDispatchProcess
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   767
        message:'Cannot send commands from within event dispatching process. Would deadlock'.            
64
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   768
    eventHandlers isCollection 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   769
        ifTrue:[ handlersArray := eventHandlers ]
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   770
        ifFalse:[ handlersArray := Array with:eventHandlers ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   771
    eventsArray := Array new:handlersArray size.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   772
    1 to:handlersArray size do:[:i | 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   773
        | handler |
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   774
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   775
        handler := handlersArray at:i.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   776
        handlersArray at:i
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   777
            put:[:event | 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   778
                | matches |
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   779
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   780
                matches := handler isBlock ifTrue:[ handler value:event ] ifFalse:[ event isKindOf:handler ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   781
                (matches and:[ i == 1 or:[ (eventsArray at:i - 1) notNil ] ]) ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   782
                    eventsArray at:i put:event.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   783
                    self announcer unsubscribe:(handlersArray at:i).
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   784
                    i == handlersArray size ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   785
                        connection eventAnnouncerInternal when: GDBEventSetProcessingFinished do: handlerFinal.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   786
                    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   787
                ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   788
            ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   789
        self announcer when:GDBEvent do:(handlersArray at:i).
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   790
    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   791
    handlerFinal := [ :event | connection eventAnnouncerInternal unsubscribe: handlerFinal. blocker signal ].  
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   792
    blocker := Semaphore new.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   793
    block value.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   794
    [
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   795
        (blocker waitWithTimeoutMs:timeout) isNil ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   796
            eventsArray := nil.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   797
        ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   798
    ] ensure:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   799
        handlersArray do:[:handler | 
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   800
            handler notNil ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   801
                self announcer unsubscribe:handler
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   802
            ]
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   803
        ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   804
    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   805
    eventsArray isNil ifTrue:[
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   806
        (TimeoutError newException)
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   807
            parameter:timeout;
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   808
            raise.
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   809
    ].
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   810
    ^ eventHandlers isCollection ifTrue:[ eventsArray ] ifFalse:[ eventsArray first ]
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   811
ed6b45e838b7 To fold
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 56
diff changeset
   812
    "Created: / 08-03-2015 / 07:28:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
148
9fb679577cac Forbid blocking calls to `#send:andWait:` and: `send:andWaitFor:withTimeoutMs` from within an event dispatcher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 144
diff changeset
   813
    "Modified (format): / 03-10-2018 / 12:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   814
! !
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   815
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
   816
!GDBDebugger methodsFor:'event handling'!
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   817
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   818
onBreakpointCreatedEvent: aGDBBreakpointCreatedEvent
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   819
    | breakpoint |
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   820
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   821
    breakpoints isNil ifTrue:[ 
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   822
        breakpoints := List new.
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   823
    ].
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   824
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   825
    "/ Care for breakpoints with multiple locations. 
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   826
    "/ 
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   827
    "/.If the breakpoint created has multiple locations,
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   828
    "/ the breakppints contains an instance of GDBBreakpoint
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   829
    "/ for the top-level breakpoint, followed by a GDBBreakpoint
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   830
    "/ for each location.
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   831
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   832
    breakpoint := aGDBBreakpointCreatedEvent breakpoints first.
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   833
    aGDBBreakpointCreatedEvent breakpoints size > 1 ifTrue:[ 
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   834
        breakpoint locations: (aGDBBreakpointCreatedEvent breakpoints copyFrom: 2)
89
ba62d486014f Initial support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
   835
    ].
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   836
    breakpoint setDebugger: self.    
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   837
    breakpoints add: breakpoint.
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   838
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   839
    "Created: / 06-07-2017 / 16:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   840
    "Modified: / 18-05-2018 / 14:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   841
!
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   842
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   843
onBreakpointDeletedEvent: aGDBBreakpointDeletedEvent
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   844
    | breakpoint |
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   845
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   846
    breakpoint := self breakpointForId: aGDBBreakpointDeletedEvent id.
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   847
    breakpoint setDebugger: nil.
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   848
    breakpoints remove: breakpoint.
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   849
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   850
    "Created: / 06-07-2017 / 16:26:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
120
73877848ea7f Added support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 119
diff changeset
   851
    "Modified: / 18-05-2018 / 14:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   852
!
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   853
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   854
onBreakpointModifiedEvent: aGDBBreakpointModifiedEvent
89
ba62d486014f Initial support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
   855
    aGDBBreakpointModifiedEvent breakpoints do:[:new | 
ba62d486014f Initial support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
   856
        | old |    
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   857
175
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   858
        old := self breakpointForId: new number ifAbsent:[ nil ].
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   859
        old notNil ifTrue:[
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   860
            old updateFrom: new.
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   861
        ] ifFalse:[ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   862
            "/ Care for breakpoints with multiple locations. 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   863
            "/ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   864
            "/.If the breakpoint has been created as pending breakpoint
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   865
            "/ it is unknown whether it is a multi-location breakpoint or not
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   866
            "/ so it has no locations.
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   867
            "/ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   868
            "/ If, once the object is loaded abd breakpoint can be installed,
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   869
            "/ it turns out there are multiple locations, we get an an
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   870
            "/ =breakpoint-modified event listing all locations.
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   871
            "/ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   872
            "/ Therefore, we have to update existing breakpoint and add 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   873
            "/ locations.
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   874
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   875
            | dot |
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   876
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   877
            "/ First, check if it is a 'location':
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   878
            dot := new number indexOf: $..
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   879
            dot ~~ 0 ifTrue:[ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   880
                | bpt |    
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   881
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   882
                bpt := self breakpointForId: (new number copyTo: dot - 1).
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   883
                "/ See GDBBreakpoint >> locations...
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   884
                (bpt locations includes: bpt) ifTrue:[ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   885
                    bpt locations: (Array with: new)
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   886
                ] ifFalse:[ 
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   887
                    bpt locations: (bpt locations copyWith: new)
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   888
                ].
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   889
            ].
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   890
        ].
89
ba62d486014f Initial support for breakpoints with multiple locations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
   891
    ].
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   892
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   893
    "Created: / 06-07-2017 / 16:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
   894
    "Modified: / 15-01-2018 / 23:11:52 / jv"
175
a04e1a36e888 Fix for multi-location breakpoints created initially as pending
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   895
    "Modified: / 07-02-2019 / 15:14:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   896
!
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
   897
114
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   898
onCmdParamChangedEvent: aGDBCmdParamChangedEvent
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   899
    (aGDBCmdParamChangedEvent name = 'directories') ifTrue:[ 
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   900
        directories := nil.
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   901
    ].
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   902
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   903
    "Created: / 09-03-2018 / 12:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   904
!
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
   905
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   906
onCommandEvent:aGDBCommandEvent 
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   907
    connection send:aGDBCommandEvent command.
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   908
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   909
    "Created: / 02-06-2014 / 23:38:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   910
    "Modified: / 20-06-2014 / 22:09:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   911
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
   912
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   913
onCommandResultEvent:aGDBCommandResultEvent
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   914
    | result |
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   915
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   916
    result := aGDBCommandResultEvent result.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   917
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   918
    "/ For some reason, -gdb-set MI command does not cause
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   919
    "/ =cmd-param-changed notification. To make this transparent
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   920
    "/ for users, catch successful -gdb-set here and send
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   921
    "/ GDBCmdParamChangedEvent manually. Sigh, what a hack!!
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   922
    (result isDone
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   923
        and:[ result command notNil
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   924
        and:[ result command isMICommand 
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   925
        and:[ result command operation = 'gdb-set' ]]]) ifTrue:[ 
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   926
        | event |
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   927
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   928
        event := GDBCmdParamChangedEvent name: result command arguments first value: result command arguments second.
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   929
        connection pushEvent: event.  
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   930
    ].
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   931
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   932
    "Created: / 19-01-2019 / 22:35:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   933
    "Modified: / 21-01-2019 / 17:53:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   934
!
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   935
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   936
onExitEvent:aGDBExitEvent 
8
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   937
    self release.
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   938
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
   939
    "Created: / 03-06-2014 / 00:36:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9
5cc8797f6523 Make simple example with -gdb-exit command working
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8
diff changeset
   940
    "Modified: / 04-06-2014 / 09:28:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
   941
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
   942
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   943
onRunningEvent: aGDBRunningEvent
38
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   944
    | threads threadId |
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   945
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   946
    self nextInferiorStateSequnceNumber.        
38
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   947
    threadId := aGDBRunningEvent threadId.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   948
    threadId = 'all' ifFalse:[ 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   949
        threadId := threadId asInteger.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   950
    ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   951
    threads := Set new.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   952
    inferiors do:[:inferior | 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   953
        inferior threads do:[:thread | 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   954
            (threadId isString or:[thread id = threadId]) ifTrue:[ 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   955
                threads add: thread.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   956
            ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   957
        ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   958
    ].
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   959
    aGDBRunningEvent setThreads: threads.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   960
    threads do:[:thread | 
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   961
        thread onRunningEvent: aGDBRunningEvent.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   962
    ].
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   963
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   964
    "Created: / 07-09-2014 / 23:34:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   965
    "Modified: / 12-07-2017 / 13:48:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   966
!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   967
38
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   968
onStoppedEvent: aGDBStoppedEvent
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   969
    | threads threadIds |
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   970
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   971
    self nextInferiorStateSequnceNumber.  
38
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   972
    threadIds := aGDBStoppedEvent stoppedThreadIds.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   973
    threadIds = 'all' ifFalse:[ 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   974
        threadIds := threadIds collect:[:e | e asInteger ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   975
    ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   976
    threads := Set new.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   977
    inferiors do:[:inferior | 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   978
        inferior threads do:[:thread | 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   979
            (threadIds isString or:[threadIds includes: thread id]) ifTrue:[ 
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   980
                threads add: thread.
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   981
            ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   982
        ].
c9eaa506824b More work on GDBThreadStatus
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 37
diff changeset
   983
    ].
86
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   984
    aGDBStoppedEvent setThreads: threads.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   985
    threads do:[:thread | 
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   986
        thread onStoppedEvent: aGDBStoppedEvent.
7f53d51a0a65 Cache thread status and update it on `=stopped` and `=running` events
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 85
diff changeset
   987
    ].
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   988
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   989
    "/ Initialize target features properly
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   990
    targetFeatures isNil ifTrue:[
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   991
        self send: GDBMI_list_target_features new 
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   992
             andWithResultDo:[ :result | targetFeatures := result propertyAt: #features ].
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   993
    ].
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   994
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   995
    "Created: / 07-09-2014 / 23:34:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
   996
    "Modified: / 09-04-2018 / 15:42:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   997
!
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
   998
172
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
   999
onTargetConnectedEvent: aGDBTargetConnectedEvent
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1000
    targetFeatures := aGDBTargetConnectedEvent features
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1001
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1002
    "Created: / 22-01-2019 / 13:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1003
!
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1004
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1005
onThreadCreatedEvent:aGDBThreadCreatedEvent 
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1006
    | inferior |
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1007
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1008
    inferior := self inferiorForId:aGDBThreadCreatedEvent threadGroupId.
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1009
    inferior onThreadCreatedEvent:aGDBThreadCreatedEvent.
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1010
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1011
    "Created: / 07-09-2014 / 21:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1012
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1013
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1014
onThreadExitedEvent:aGDBThreadExitedEvent 
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1015
    | inferior |
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1016
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
  1017
    self nextInferiorStateSequnceNumber.  
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1018
    inferior := self inferiorForId:aGDBThreadExitedEvent threadGroupId.
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1019
    inferior onThreadExitedEvent:aGDBThreadExitedEvent.
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1020
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1021
    "/ reset target features
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1022
    targetFeatures := nil.
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1023
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1024
    "Created: / 07-09-2014 / 21:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1025
    "Modified: / 09-04-2018 / 15:42:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1026
!
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1027
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1028
onThreadGroupAddedEvent:aGDBThreadGroupAddedEvent 
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1029
    | inferior |
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1030
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1031
    inferiors isNil ifTrue:[
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1032
        inferiors := List new.
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1033
    ].
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1034
    inferior := GDBThreadGroup newWithDebugger:self
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1035
            id:aGDBThreadGroupAddedEvent threadGroupId.
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1036
    inferiors add:inferior.
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1037
    aGDBThreadGroupAddedEvent setThreadGroup:inferior.
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1038
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1039
    "Modified: / 26-03-2018 / 21:46:51 / jv"
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1040
    "Modified: / 09-04-2018 / 15:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1041
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1042
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1043
onThreadGroupExitedEvent:aGDBThreadGroupExitedEvent 
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1044
    | inferior |
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1045
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
  1046
    self nextInferiorStateSequnceNumber.        
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1047
    inferior := self inferiorForId:aGDBThreadGroupExitedEvent threadGroupId.
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1048
    inferior setExitCode:aGDBThreadGroupExitedEvent exitCode.
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1049
    aGDBThreadGroupExitedEvent setThreadGroup:inferior
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1050
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1051
    "Created: / 06-09-2014 / 02:37:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
72
eb4eea3ebf4c Increate sequence number also when thread or thread group is stopped
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
  1052
    "Modified: / 18-03-2015 / 13:57:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1053
!
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1054
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1055
onThreadGroupStartedEvent:aGDBThreadGroupStartedEvent 
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1056
    | inferior |
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1057
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1058
    inferior := self inferiorForId:aGDBThreadGroupStartedEvent threadGroupId.
144
342b6dfe3a6f Add model for machine registers
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 129
diff changeset
  1059
    inferior reset.
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1060
    inferior setPid:aGDBThreadGroupStartedEvent pid.
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1061
    aGDBThreadGroupStartedEvent setThreadGroup:inferior.
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1062
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1063
    "Created: / 06-09-2014 / 02:37:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1064
    "Modified: / 26-03-2018 / 21:33:11 / jv"
144
342b6dfe3a6f Add model for machine registers
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 129
diff changeset
  1065
    "Modified: / 26-09-2018 / 10:57:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
129
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1066
!
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1067
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1068
onThreadSelectedEvent: aGDBThreadSelectedEvent 
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1069
    | inferior |
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1070
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1071
    inferior := self selectedInferior.
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1072
    inferior onThreadSelectedEvent:aGDBThreadSelectedEvent.
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1073
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1074
    "Created: / 29-07-2018 / 22:20:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1075
! !
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1076
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
  1077
!GDBDebugger methodsFor:'finalization'!
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1078
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1079
finalize
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1080
    self release.
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1081
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1082
    "Created: / 26-05-2014 / 21:23:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1083
! !
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1084
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
  1085
!GDBDebugger methodsFor:'initialize & release'!
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1086
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1087
initializeWithProcess: aGDBProcess
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1088
    | result |
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1089
1
da21f8614c2d Fixes in GDBLauncher
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
  1090
    self registerForFinalization.
102
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
  1091
d573a3b2abe2 Variable objects: delete var. objects that are no longer needed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 97
diff changeset
  1092
    finalizationRegistry := Registry new.
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1093
    connection := GDBConnection newWithProcess: aGDBProcess.
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1094
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1095
    commandSequenceNumber := 0.
19
c48d33e27d34 Added internal announcer.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
  1096
    inferiorStateSequenceNumber := 0.
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1097
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1098
    self subscribe.        
8
7f4882e2562a More work on basic example. GDB exiting not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7
diff changeset
  1099
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1100
    connection eventPumpStart.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1101
    connection eventDispatchStart.
25
58e042a191a9 More work on GDB session recorder.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
  1102
    Delay waitForMilliseconds:100.  
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1103
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
  1104
    connection inferiorPTY notNil ifTrue:[
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
  1105
        self send: (GDBMI_inferior_tty_set arguments: (Array with: connection inferiorPTY name)).
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
  1106
    ].
190
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1107
    self setParameter: 'mi-async' to: 'on'.
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1108
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1109
    "/ If the following fails it means that you're using GDB without
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1110
    "/ all required patches. Please see:
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1111
    "/
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1112
    "/  * https://bitbucket.org/janvrany/jv-libgdbs/src/tip/doc/GDB.md
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1113
    "/  * https://bitbucket.org/janvrany/jv-vdb/src/2bd269c89e8ca67816b41be2dbf6185b9005f46a/doc/Invoking.md
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1114
    "/
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1115
    GDBError catch: [self setParameter: 'mi-always-notify' to: 'on'].
11
474fbb650afe PTY support refactored to use GDBPTY object.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
  1116
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1117
    result := self send: GDBMI_list_features new.
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1118
    debuggerFeatures := result propertyAt: #features.
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1119
    targetFeatures := nil.
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1120
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1121
    prettyPrintingEnabled := false.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1122
    frameFiltersEnabled := false.
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1123
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1124
    "Created: / 20-06-2014 / 21:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1125
    "Modified: / 26-03-2018 / 21:36:31 / jv"
190
0509fe9ad879 Set `mi-always-notify` to 'on' (if supported)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 185
diff changeset
  1126
    "Modified: / 12-06-2019 / 12:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1127
!
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1128
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1129
release
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1130
    connection notNil ifTrue:[ 
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1131
        self unsubscribe.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1132
        connection release.
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1133
        connection := nil.
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1134
    ].
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1135
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1136
    "Created: / 26-05-2014 / 21:24:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1137
    "Modified: / 20-06-2014 / 22:08:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1138
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1139
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1140
subscribe
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1141
    connection eventAnnouncerInternal
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1142
        when: GDBCommandEvent               send: #onCommandEvent:           to: self;
169
a3d1f59e3bfd API: add `GDBDebugger >> getParameter:` and `setParameter:to:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
  1143
        when: GDBCommandResultEvent         send: #onCommandResultEvent:     to: self;
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1144
        when: GDBExitEvent                  send: #onExitEvent:              to: self;
35
c17ecf90e446 Initial support for thread groups, threads and breakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 25
diff changeset
  1145
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1146
        when: GDBThreadGroupAddedEvent      send: #onThreadGroupAddedEvent:  to: self;
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1147
        when: GDBThreadGroupStartedEvent    send: #onThreadGroupStartedEvent: to: self;
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1148
        when: GDBThreadGroupExitedEvent     send: #onThreadGroupExitedEvent: to: self;
36
095c4b0b74d3 Added support for threads.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 35
diff changeset
  1149
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1150
        when: GDBThreadCreatedEvent         send: #onThreadCreatedEvent:      to: self;
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1151
        when: GDBThreadExitedEvent          send: #onThreadExitedEvent:       to: self;
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1152
129
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1153
        when: GDBThreadSelectedEvent        send: #onThreadSelectedEvent:     to: self;
661e16236c67 Set `GDBThreadSelectedEvent`'s thread and frame
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 128
diff changeset
  1154
37
a85f0c91f164 Some more work on threads (thread status)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 36
diff changeset
  1155
        when: GDBRunningEvent               send: #onRunningEvent:            to: self;
87
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
  1156
        when: GDBStoppedEvent               send: #onStoppedEvent:            to: self;
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
  1157
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
  1158
        when: GDBBreakpointCreatedEvent     send: #onBreakpointCreatedEvent:  to: self;
50e80d25ea6f Added initial support for breakppints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 86
diff changeset
  1159
        when: GDBBreakpointModifiedEvent    send: #onBreakpointModifiedEvent: to: self;
114
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
  1160
        when: GDBBreakpointDeletedEvent     send: #onBreakpointDeletedEvent:  to: self;
be5bdaecb9b3 API: added methods for querying source directories
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 113
diff changeset
  1161
172
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1162
        when: GDBCmdParamChangedEvent       send: #onCmdParamChangedEvent:    to: self;
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1163
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1164
        when: GDBTargetConnectedEvent       send: #onTargetConnectedEvent:    to: self.
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1165
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1166
    "Created: / 20-06-2014 / 22:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
172
836209352efb Update target features from `=target-connected event`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 170
diff changeset
  1167
    "Modified: / 22-01-2019 / 13:36:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1168
!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1169
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1170
unsubscribe
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1171
    connection eventAnnouncerInternal unsubscribe: self
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1172
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1173
    "Created: / 20-06-2014 / 22:07:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1174
! !
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1175
113
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1176
!GDBDebugger methodsFor:'inspecting'!
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1177
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1178
inspector2TabGDBMITrace
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1179
    <inspector2Tab>
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1180
    ^ (self newInspector2Tab)
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1181
        label:'GDB/MI Trace';
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1182
        priority:50;
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1183
        application:[ GDBMITraceViewer new debugger:self ];
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1184
        yourself
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1185
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1186
    "Modified (format): / 09-03-2018 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1187
! !
c4f07d0e7b7a GNI/MI: added custom inspector view for viewing GDB/MI comminicatication trace
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 111
diff changeset
  1188
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1189
!GDBDebugger methodsFor:'queries'!
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1190
165
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1191
hasCommand: aClassOrString
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1192
    "Return `true`, if this debugger support given MI command, false otherwise.
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1193
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1194
     `aClassOrString can be either a MI command class (a subclass of GDBMICommand
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1195
     or MI command string (inclusding starting dash).
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1196
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1197
     Note, that this can only query MI commands, queries for CLI command support
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1198
     are not supported (limitation of GDB itself).
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1199
    "
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1200
    | commandString |
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1201
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1202
    supportedCommands isNil ifTrue:[ supportedCommands := Dictionary new ].
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1203
    aClassOrString isClass ifTrue:[ 
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1204
        self assert: (aClassOrString inheritsFrom: GDBMICommand).
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1205
        commandString := aClassOrString new operation.
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1206
    ] ifFalse:[ 
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1207
        commandString := aClassOrString.
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1208
    ].
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1209
    ^ supportedCommands at: commandString ifAbsentPut:[ 
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1210
        | result exists |
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1211
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1212
        result := self send: (GDBMI_info_gdb_mi_command arguments: (Array with: commandString)) andWait: true.
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1213
        exists := ((result propertyAt: #command) at: #exists) = 'true'.
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1214
        exists
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1215
    ].
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1216
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1217
    "
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1218
    GDBDebugger new hasCommand:
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1219
    "
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1220
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1221
    "Created: / 29-12-2018 / 23:10:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1222
!
780e1f6168c5 Add new API `GDBDebugger >> #hasCommand:` to test support for particular MI command
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 153
diff changeset
  1223
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1224
hasFeature: feature
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1225
    "Return true, if this debugger support given feature, false otherwise.
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1226
     See GDBFeatures pool for available features.
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1227
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1228
     Note however, that newer versions og GDB may have more features.
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1229
    "
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1230
    ^ self features includes: feature
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1231
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1232
    "Created: / 07-02-2018 / 11:32:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1233
    "Modified (comment): / 07-02-2018 / 12:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
116
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1234
!
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1235
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1236
hasFeatureAsync
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1237
    "Indicates that the target is capable of asynchronous command execution, which means 
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1238
     that GDB will accept further commands while the target is running." 
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1239
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1240
    targetFeatures notNil ifTrue:[ 
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1241
        ^ targetFeatures includes: 'async'
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1242
    ] ifFalse:[ 
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1243
        ^ connection nativeTargetFeatures includes: 'async'.
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1244
    ].
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1245
ffd185f7a357 Fix: initialize debugger features early during initialization
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 114
diff changeset
  1246
    "Created: / 09-04-2018 / 15:45:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
170
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1247
!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1248
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1249
hasPendingCommands
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1250
    "Return `true` if there are commands being sent but not yet
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1251
     processed, `false` otherwise. By 'processed' we mean that 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1252
     command result event not yet arrived or is waiting in a queue
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1253
     to be dispatched.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1254
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1255
     Note that by the nature of event queues and threads, 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1256
     return value may be obsolete by the time client uses
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1257
     it. Use with caution!!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1258
    "
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1259
    ^ connection hasPendingCommands
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1260
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1261
    "Created: / 23-01-2019 / 20:41:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1262
!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1263
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1264
hasPendingEvents
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1265
    "Return `true` if there are events in a queue wating
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1266
     to be dispatched, `false` otherwise.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1267
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1268
     Note that by the nature of event queues and threads, 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1269
     return value may be obsolete by the time client uses
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1270
     it. Use with caution!!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1271
    "
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1272
    ^ connection hasPendingEvents
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1273
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1274
    "Created: / 23-01-2019 / 20:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
180
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1275
!
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1276
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1277
nativeTargetHasFeature: aString
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1278
    ^ connection nativeTargetFeatures includes:  aString
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1279
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1280
    "Created: / 13-03-2019 / 12:53:38 / jv"
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1281
!
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1282
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1283
nativeTargetHasFeatureAsync
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1284
    ^ self nativeTargetHasFeature: 'async'
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1285
cd22cacfcdcb API: temporarily add `GDBDebugger >> nativeTargetHasFeature:`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 175
diff changeset
  1286
    "Created: / 13-03-2019 / 12:53:54 / jv"
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1287
! !
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1288
23
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1289
!GDBDebugger methodsFor:'testing'!
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1290
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1291
isConnected
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1292
    ^ connection notNil
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1293
a7eb888c81b5 Introduced GDBProcess - a class encapsulating gdb OS process.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 21
diff changeset
  1294
    "Created: / 20-06-2014 / 22:12:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
82
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1295
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1296
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1297
isFrameFiltersEnabled
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1298
    ^ frameFiltersEnabled
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1299
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1300
    "Created: / 12-06-2017 / 09:41:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1301
!
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1302
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1303
isPrettyPrintingEnabled
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1304
    ^ prettyPrintingEnabled
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1305
7ee72b7a498f Added #enablePrettyPrinting and #enableFrameFilters to allow Python scripts to augment presentation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 80
diff changeset
  1306
    "Created: / 12-06-2017 / 09:40:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1307
! !
0b9e93821620 First shot (merely backup)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1308
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1309
!GDBDebugger methodsFor:'utilities'!
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1310
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1311
ensureFeature: feature
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1312
    "No-op if this debugger supports given `feature`, otherwise
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1313
     throw an error"
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1314
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1315
    (self hasFeature: feature) ifFalse:[ 
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1316
        GDBUnsupportedFeatureError newException
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1317
            parameter: self -> feature;
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1318
            messageText:'Unssuported feature: ' , feature printString;
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1319
            raise.                               
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1320
    ].
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1321
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1322
    "Created: / 07-02-2018 / 11:34:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
170
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1323
!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1324
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1325
waitUntilAlCommandsProcessed
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1326
    "BLock caller until all commands are processed. This method is provided
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1327
     mainly for use in tests or synchronization. Normal code should avoid 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1328
     using this.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1329
    "
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1330
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1331
    self 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1332
        assert:Processor activeProcess ~~ connection eventDispatchProcess
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1333
        message:'Cannot wait from within event dispatching process. Would deadlock'.           
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1334
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1335
    "/ Since this method is not required to be 100% accurate, polling seems
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1336
    "/ like an easy and safe approach. It's not meant for normal usage, anyway.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1337
    [ self hasPendingCommands ] whileTrue:[ Delay waitForMilliseconds: 100 ].
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1338
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1339
    "Created: / 23-01-2019 / 21:03:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1340
!
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1341
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1342
waitUntilAllEventsProcessed
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1343
    "BLock caller until all events are processed. This method is provided
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1344
     mainly for use in tests or synchronization. Normal code should avoid 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1345
     using this.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1346
    "
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1347
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1348
    self 
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1349
        assert:Processor activeProcess ~~ connection eventDispatchProcess
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1350
        message:'Cannot wait from within event dispatching process. Would deadlock'.           
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1351
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1352
    "/ Since this method is not required to be 100% accurate, polling seems
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1353
    "/ like an easy and safe approach. It's not meant for normal usage, anyway.
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1354
    [ self hasPendingEvents ] whileTrue:[ Delay waitForMilliseconds: 100 ].
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1355
6cf990ac2cad Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 169
diff changeset
  1356
    "Created: / 23-01-2019 / 21:03:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
111
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1357
! !
7ce18f6f18ac API: added methods for querying debugger and target features
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 109
diff changeset
  1358
21
83395ca8b257 Renamed GDB to GDBDebugger
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 19
diff changeset
  1359
!GDBDebugger class methodsFor:'documentation'!
7
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1360
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1361
version_HG
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1362
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1363
    ^ '$Changeset: <not expanded> $'
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1364
! !
7a51f98e7162 Initial implementation of event dispatcher and event pump.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
  1365