1 |
578 |
markom |
# GDB event class implementations for Insight.
|
2 |
|
|
# Copyright 2001 Red Hat, Inc.
|
3 |
|
|
#
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify it
|
5 |
|
|
# under the terms of the GNU General Public License (GPL) as published by
|
6 |
|
|
# the Free Software Foundation; either version 2 of the License, or (at
|
7 |
|
|
# your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
# ------------------------------------------------------------
|
15 |
|
|
# PUBLIC METHOD: get - Retrieve data about the event
|
16 |
|
|
# ------------------------------------------------------------
|
17 |
|
|
body BreakpointEvent::get {what} {
|
18 |
|
|
|
19 |
|
|
switch $what {
|
20 |
|
|
action { return $action }
|
21 |
|
|
number { return $number }
|
22 |
|
|
file { return $_file }
|
23 |
|
|
function { return $_function }
|
24 |
|
|
line { return $_line }
|
25 |
|
|
address { return $_address }
|
26 |
|
|
type { return $_type }
|
27 |
|
|
enabled { return $_enabled }
|
28 |
|
|
disposition { return $_disposition }
|
29 |
|
|
ignore_count { return $_ignore_count }
|
30 |
|
|
commands { return $_commands }
|
31 |
|
|
condition { return $_condition }
|
32 |
|
|
thread { return $_thread }
|
33 |
|
|
hit_count { return $_hit_count }
|
34 |
|
|
user_specification { return $_user_specification }
|
35 |
|
|
|
36 |
|
|
default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|type|enabled|disposition|ignore_count|commands|condition|thread|hit_count|user_specification" }
|
37 |
|
|
}
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
# ------------------------------------------------------------
|
41 |
|
|
# PRIVATE METHOD: _init - Initialize all private data
|
42 |
|
|
# ------------------------------------------------------------
|
43 |
|
|
body BreakpointEvent::_init {} {
|
44 |
|
|
if {[catch {gdb_get_breakpoint_info $number} bpinfo]} {
|
45 |
|
|
set _file {}
|
46 |
|
|
set _function {}
|
47 |
|
|
set _line {}
|
48 |
|
|
set _address {}
|
49 |
|
|
set _type {}
|
50 |
|
|
set _enabled {}
|
51 |
|
|
set _disposition {}
|
52 |
|
|
set _ignore_count {}
|
53 |
|
|
set _commands {}
|
54 |
|
|
set _condition {}
|
55 |
|
|
set _thread {}
|
56 |
|
|
set _hit_count {}
|
57 |
|
|
set _user_specification {}
|
58 |
|
|
} else {
|
59 |
|
|
lassign $bpinfo \
|
60 |
|
|
_file \
|
61 |
|
|
_function \
|
62 |
|
|
_line \
|
63 |
|
|
_address \
|
64 |
|
|
_type \
|
65 |
|
|
_enabled \
|
66 |
|
|
_disposition \
|
67 |
|
|
_ignore_count \
|
68 |
|
|
_commands \
|
69 |
|
|
_condition \
|
70 |
|
|
_thread \
|
71 |
|
|
_hit_count \
|
72 |
|
|
_user_specification
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
# When the breakpoint number for the event changes,
|
77 |
|
|
# update the private data in the event.
|
78 |
|
|
configbody BreakpointEvent::number {
|
79 |
|
|
_init
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
# ------------------------------------------------------------
|
83 |
|
|
# PUBLIC METHOD: get - Retrieve data about the event
|
84 |
|
|
# ------------------------------------------------------------
|
85 |
|
|
body TracepointEvent::get {what} {
|
86 |
|
|
|
87 |
|
|
switch $what {
|
88 |
|
|
action { return $action }
|
89 |
|
|
number { return $number }
|
90 |
|
|
file { return $_file }
|
91 |
|
|
function { return $_function }
|
92 |
|
|
line { return $_line }
|
93 |
|
|
address { return $_address }
|
94 |
|
|
enabled { return $_enabled }
|
95 |
|
|
pass_count { return $_pass_count }
|
96 |
|
|
step_count { return $_step_count }
|
97 |
|
|
thread { return $_thread }
|
98 |
|
|
hit_count { return $_hit_count }
|
99 |
|
|
actions { return $_actions }
|
100 |
|
|
|
101 |
|
|
default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|pass_count|step_count|thread|hit_count|actions" }
|
102 |
|
|
}
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
# ------------------------------------------------------------
|
106 |
|
|
# PRIVATE METHOD: _init - Initialize all private data
|
107 |
|
|
# ------------------------------------------------------------
|
108 |
|
|
body TracepointEvent::_init {} {
|
109 |
|
|
if {[catch {gdb_get_tracepoint_info $number} tpinfo]} {
|
110 |
|
|
set _file {}
|
111 |
|
|
set _function {}
|
112 |
|
|
set _line {}
|
113 |
|
|
set _address {}
|
114 |
|
|
set _enabled {}
|
115 |
|
|
set _pass_count {}
|
116 |
|
|
set _step_count {}
|
117 |
|
|
set _thread {}
|
118 |
|
|
set _hit_count {}
|
119 |
|
|
set _actions {}
|
120 |
|
|
} else {
|
121 |
|
|
lassign $tpinfo \
|
122 |
|
|
_file \
|
123 |
|
|
_function \
|
124 |
|
|
_line \
|
125 |
|
|
_address \
|
126 |
|
|
_enabled \
|
127 |
|
|
_pass_count \
|
128 |
|
|
_step_count \
|
129 |
|
|
_thread \
|
130 |
|
|
_hit_count \
|
131 |
|
|
_actions
|
132 |
|
|
}
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
# When the tracepoint number for the event changes,
|
136 |
|
|
# update the private data in the event.
|
137 |
|
|
configbody TracepointEvent::number {
|
138 |
|
|
_init
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
# ------------------------------------------------------------
|
142 |
|
|
# PUBLIC METHOD: get - Retrieve data about the event
|
143 |
|
|
# ------------------------------------------------------------
|
144 |
|
|
body TracepointEvent::get {what} {
|
145 |
|
|
|
146 |
|
|
switch $what {
|
147 |
|
|
action { return $action }
|
148 |
|
|
number { return $number }
|
149 |
|
|
file { return $_file }
|
150 |
|
|
function { return $_function }
|
151 |
|
|
line { return $_line }
|
152 |
|
|
address { return $_address }
|
153 |
|
|
enabled { return $_enabled }
|
154 |
|
|
pass_count { return $_pass_count }
|
155 |
|
|
step_count { return $_step_count }
|
156 |
|
|
thread { return $_thread }
|
157 |
|
|
hit_count { return $_hit_count }
|
158 |
|
|
actions { return $_actions }
|
159 |
|
|
|
160 |
|
|
default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|pass_count|step_count|thread|hit_count|actions" }
|
161 |
|
|
}
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
# ------------------------------------------------------------
|
165 |
|
|
# PUBLIC METHOD: get - Retrieve data about the event
|
166 |
|
|
# ------------------------------------------------------------
|
167 |
|
|
body SetVariableEvent::get {what} {
|
168 |
|
|
|
169 |
|
|
switch $what {
|
170 |
|
|
variable { return $variable }
|
171 |
|
|
value { return $value }
|
172 |
|
|
|
173 |
|
|
default { error "unknown event data \"$what\": should be: variable|value" }
|
174 |
|
|
}
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
# ------------------------------------------------------------
|
178 |
|
|
# CONSTRUCTOR: Create an UpdateEvent
|
179 |
|
|
# ------------------------------------------------------------
|
180 |
|
|
body UpdateEvent::constructor {args} {
|
181 |
|
|
if {[catch {gdb_loc} loc]} {
|
182 |
|
|
dbug E "could not get current location: $loc"
|
183 |
|
|
} else {
|
184 |
|
|
lassign $loc _compile_filename _function _full_filename \
|
185 |
|
|
_line _frame_pc _pc _shlib
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
# ------------------------------------------------------------
|
190 |
|
|
# PUBLIC METHOD: get - Retrieve data about the event
|
191 |
|
|
# ------------------------------------------------------------
|
192 |
|
|
body UpdateEvent::get {what} {
|
193 |
|
|
|
194 |
|
|
switch $what {
|
195 |
|
|
compile_filename { return $_compile_filename }
|
196 |
|
|
full_filename { return $_full_filename }
|
197 |
|
|
function { return $_function }
|
198 |
|
|
line { return $_line }
|
199 |
|
|
frame_pc { return $_frame_pc }
|
200 |
|
|
pc { return $_pc }
|
201 |
|
|
shlib { return $_shlib }
|
202 |
|
|
|
203 |
|
|
default { error "unknown event data \"$what\": should be: variable|value" }
|
204 |
|
|
}
|
205 |
|
|
}
|