1 |
578 |
markom |
# SrcBar
|
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 |
|
|
# Implements a menu and a toolbar that are attached to a source window.
|
16 |
|
|
#
|
17 |
|
|
# PUBLIC ATTRIBUTES:
|
18 |
|
|
#
|
19 |
|
|
#
|
20 |
|
|
# METHODS:
|
21 |
|
|
#
|
22 |
|
|
# configure ....... used to change public attributes
|
23 |
|
|
#
|
24 |
|
|
# PRIVATE METHODS
|
25 |
|
|
#
|
26 |
|
|
# X11 OPTION DATABASE ATTRIBUTES
|
27 |
|
|
#
|
28 |
|
|
#
|
29 |
|
|
# ----------------------------------------------------------------------
|
30 |
|
|
|
31 |
|
|
class SrcBar {
|
32 |
|
|
inherit itk::Widget GDBEventHandler
|
33 |
|
|
|
34 |
|
|
# ------------------------------------------------------------------
|
35 |
|
|
# CONSTRUCTOR - create widget
|
36 |
|
|
# ------------------------------------------------------------------
|
37 |
|
|
constructor {src args} {
|
38 |
|
|
set source $src
|
39 |
|
|
|
40 |
|
|
# Load the images to be used in toolbar buttons
|
41 |
|
|
_load_images
|
42 |
|
|
_load_src_images
|
43 |
|
|
|
44 |
|
|
# Create a menu widget for the Source Window
|
45 |
|
|
set Menu [GDBMenuBar $itk_interior.menubar]
|
46 |
|
|
|
47 |
|
|
# Fill it with the initial set of entries
|
48 |
|
|
if {! [create_menu_items]} {
|
49 |
|
|
destroy $this
|
50 |
|
|
} else {
|
51 |
|
|
# We do not pack the menu, but make it the menu of the toplevel window
|
52 |
|
|
$Menu show
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
# Create a toolbar widget for the Source Window
|
56 |
|
|
set Tool [GDBToolBar $itk_interior.toolbar]
|
57 |
|
|
|
58 |
|
|
# Now create the Source Window initial set of toolbar buttons
|
59 |
|
|
# First give the necessary info about each button and their position
|
60 |
|
|
create_buttons
|
61 |
|
|
# Then effectively create the tollbar widget
|
62 |
|
|
$Tool show
|
63 |
|
|
|
64 |
|
|
# Pack the toolbar
|
65 |
|
|
pack $Tool -expand 1 -fill both
|
66 |
|
|
|
67 |
|
|
# Set the srcbar's initial state
|
68 |
|
|
enable_ui 2
|
69 |
|
|
|
70 |
|
|
eval itk_initialize $args
|
71 |
|
|
add_hook gdb_no_inferior_hook "$this enable_ui 2"
|
72 |
|
|
add_hook gdb_trace_find_hook "$this handle_trace_find_hook"
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
# ------------------------------------------------------------------
|
76 |
|
|
# DESTRUCTOR - destroy window containing widget
|
77 |
|
|
# ------------------------------------------------------------------
|
78 |
|
|
destructor {
|
79 |
|
|
global GDBSrcBar_state
|
80 |
|
|
|
81 |
|
|
unset GDBSrcBar_state($this)
|
82 |
|
|
remove_hook gdb_no_inferior_hook "$this enable_ui 2"
|
83 |
|
|
remove_hook gdb_trace_find_hook "$this handle_trace_find_hook"
|
84 |
|
|
|
85 |
|
|
#destroy $this
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
####################################################################
|
89 |
|
|
# The next set of functions create the common menu groupings that
|
90 |
|
|
# are used in gdb menus.
|
91 |
|
|
# Private. Used at contruction time.
|
92 |
|
|
# These were previously at the GDBToolBar...
|
93 |
|
|
####################################################################
|
94 |
|
|
|
95 |
|
|
# ------------------------------------------------------------------
|
96 |
|
|
# METHOD: create_menu_items - Add some menu items to the menubar.
|
97 |
|
|
# Returns 1 if any items added.
|
98 |
|
|
# ------------------------------------------------------------------
|
99 |
|
|
private method create_menu_items {} {
|
100 |
|
|
|
101 |
|
|
create_file_menu
|
102 |
|
|
|
103 |
|
|
create_run_menu
|
104 |
|
|
|
105 |
|
|
create_view_menu
|
106 |
|
|
|
107 |
|
|
if {[pref get gdb/control_target]} {
|
108 |
|
|
create_control_menu
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
if {[pref get gdb/mode]} {
|
112 |
|
|
create_trace_menu
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
create_plugin_menu
|
116 |
|
|
|
117 |
|
|
create_pref_menu
|
118 |
|
|
|
119 |
|
|
create_help_menu
|
120 |
|
|
|
121 |
|
|
return 1
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
# ------------------------------------------------------------------
|
125 |
|
|
# METHOD: create_file_menu - Creates the standard file menu.
|
126 |
|
|
# ------------------------------------------------------------------
|
127 |
|
|
|
128 |
|
|
private method create_file_menu {} {
|
129 |
|
|
global enable_external_editor tcl_platform
|
130 |
|
|
|
131 |
|
|
$Menu add menubutton file "File" 0
|
132 |
|
|
|
133 |
|
|
if {[info exists enable_external_editor] && $enable_external_editor} {
|
134 |
|
|
$Menu add command None "Edit Source" \
|
135 |
|
|
[code $source edit]
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
$Menu add command Other "Open..." \
|
139 |
|
|
"_open_file" -underline 0 -accelerator "Ctrl+O"
|
140 |
|
|
|
141 |
|
|
$Menu add command Other "Close" \
|
142 |
|
|
"_close_file" -underline 0 -accelerator "Ctrl+W"
|
143 |
|
|
|
144 |
|
|
$Menu add command Other "Source..." \
|
145 |
|
|
"source_file" -underline 0
|
146 |
|
|
|
147 |
|
|
set sessions [session_list]
|
148 |
|
|
if {[llength $sessions]} {
|
149 |
|
|
$Menu add separator
|
150 |
|
|
set i 1
|
151 |
|
|
foreach item $sessions {
|
152 |
|
|
$Menu add command Other "$i $item" \
|
153 |
|
|
[list session_load $item] \
|
154 |
|
|
-underline 0
|
155 |
|
|
incr i
|
156 |
|
|
}
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
$Menu add separator
|
160 |
|
|
|
161 |
|
|
if {$tcl_platform(platform) == "windows"} {
|
162 |
|
|
$Menu add command None "Page Setup..." \
|
163 |
|
|
[format {
|
164 |
|
|
set top %s
|
165 |
|
|
ide_winprint page_setup -parent $top
|
166 |
|
|
} [winfo toplevel [namespace tail $this]]] \
|
167 |
|
|
-underline 8
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
$Menu add command None "Print Source..." \
|
171 |
|
|
[code $source print] \
|
172 |
|
|
-underline 0 -accelerator "Ctrl+P"
|
173 |
|
|
|
174 |
|
|
$Menu add separator
|
175 |
|
|
|
176 |
|
|
$Menu add command Other "Target Settings..." \
|
177 |
|
|
"set_target_name" -underline 0
|
178 |
|
|
|
179 |
|
|
$Menu add separator
|
180 |
|
|
|
181 |
|
|
$Menu add command None "Exit" gdbtk_quit -underline 1
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
# ------------------------------------------------------------------
|
185 |
|
|
# METHOD: create_run_menu - Creates the standard run menu,
|
186 |
|
|
# or reconfigures it if it already exists.
|
187 |
|
|
# ------------------------------------------------------------------
|
188 |
|
|
|
189 |
|
|
private method create_run_menu {} {
|
190 |
|
|
|
191 |
|
|
if {![$Menu exists Run]} {
|
192 |
|
|
set run_menu [$Menu add menubutton run "Run" 0]
|
193 |
|
|
} else {
|
194 |
|
|
set run_menu [$Menu clear Run]
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
set is_native [TargetSelection::native_debugging]
|
198 |
|
|
|
199 |
|
|
# If we are on a Unix target, put in the attach options. "ps" doesn't
|
200 |
|
|
# give me the Windows PID yet, and the attach also seems flakey, so
|
201 |
|
|
# I will hold off on the Windows implementation for now.
|
202 |
|
|
|
203 |
|
|
if {$is_native} {
|
204 |
|
|
if {[string compare $::tcl_platform(platform) windows] != 0} {
|
205 |
|
|
$Menu add command Attach "Attach to process" \
|
206 |
|
|
[code $this do_attach $run_menu] \
|
207 |
|
|
-underline 0 -accelerator "Ctrl+A"
|
208 |
|
|
}
|
209 |
|
|
} else {
|
210 |
|
|
$Menu add command Other "Connect to target" \
|
211 |
|
|
"$this do_connect $run_menu" -underline 0
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
if {[pref get gdb/control_target]} {
|
215 |
|
|
if {!$is_native} {
|
216 |
|
|
$Menu add command Other "Download" Download::download_it \
|
217 |
|
|
-underline 0 -accelerator "Ctrl+D"
|
218 |
|
|
}
|
219 |
|
|
$Menu add command Other "Run" [code $source inferior run] \
|
220 |
|
|
-underline 0 -accelerator R
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
if {$is_native} {
|
224 |
|
|
if {[string compare $::tcl_platform(platform) windows] != 0} {
|
225 |
|
|
$Menu add command Detach "Detach" \
|
226 |
|
|
[code $this do_detach $run_menu] \
|
227 |
|
|
-underline 0 -state disabled
|
228 |
|
|
}
|
229 |
|
|
} else {
|
230 |
|
|
$Menu add command Other "Disconnect" \
|
231 |
|
|
[code $this do_disconnect $run_menu] -underline 0 -state disabled
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
if {$is_native} {
|
235 |
|
|
$Menu add separator
|
236 |
|
|
$Menu add command Control "Kill" \
|
237 |
|
|
[code $this do_kill $run_menu] \
|
238 |
|
|
-underline 0 -state disabled
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
if { [pref get gdb/mode] } {
|
242 |
|
|
$Menu add separator
|
243 |
|
|
|
244 |
|
|
$Menu add command Other "Start collection" "$this do_tstop" \
|
245 |
|
|
-underline 0 -accelerator "Ctrl+B"
|
246 |
|
|
|
247 |
|
|
$Menu add command Other "Stop collection" "$this do_tstop" \
|
248 |
|
|
-underline 0 -accelerator "Ctrl+E" -state disabled
|
249 |
|
|
}
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
# ------------------------------------------------------------------
|
253 |
|
|
# METHOD: create_view_menu - Creates the standard view menu
|
254 |
|
|
# ------------------------------------------------------------------
|
255 |
|
|
|
256 |
|
|
private method create_view_menu {} {
|
257 |
|
|
|
258 |
|
|
$Menu add menubutton view "View" 0
|
259 |
|
|
|
260 |
|
|
$Menu add command Other "Stack" {ManagedWin::open StackWin} \
|
261 |
|
|
-underline 0 -accelerator "Ctrl+S"
|
262 |
|
|
|
263 |
|
|
$Menu add command Other "Registers" {ManagedWin::open RegWin} \
|
264 |
|
|
-underline 0 -accelerator "Ctrl+R"
|
265 |
|
|
|
266 |
|
|
$Menu add command Other "Memory" {ManagedWin::open MemWin} \
|
267 |
|
|
-underline 0 -accelerator "Ctrl+M"
|
268 |
|
|
|
269 |
|
|
$Menu add command Other "Watch Expressions" \
|
270 |
|
|
{ManagedWin::open WatchWin} \
|
271 |
|
|
-underline 0 -accelerator "Ctrl+T"
|
272 |
|
|
$Menu add command Other "Local Variables" \
|
273 |
|
|
{ManagedWin::open LocalsWin} \
|
274 |
|
|
-underline 0 -accelerator "Ctrl+L"
|
275 |
|
|
|
276 |
|
|
if {[pref get gdb/control_target]} {
|
277 |
|
|
$Menu add command Other "Breakpoints" \
|
278 |
|
|
{ManagedWin::open BpWin -tracepoints 0} \
|
279 |
|
|
-underline 0 -accelerator "Ctrl+B"
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
if {[pref get gdb/mode]} {
|
283 |
|
|
$Menu add command Other "Tracepoints" \
|
284 |
|
|
{ManagedWin::open BpWin -tracepoints 1} \
|
285 |
|
|
-underline 0 -accelerator "Ctrl+T"
|
286 |
|
|
$Menu add command Other "Tdump" {ManagedWin::open TdumpWin} \
|
287 |
|
|
-underline 2 -accelerator "Ctrl+U"
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
$Menu add command Other "Console" {ManagedWin::open Console} \
|
291 |
|
|
-underline 2 -accelerator "Ctrl+N"
|
292 |
|
|
|
293 |
|
|
$Menu add command Other "Function Browser" \
|
294 |
|
|
{ManagedWin::open BrowserWin} \
|
295 |
|
|
-underline 1 -accelerator "Ctrl+F"
|
296 |
|
|
$Menu add command Other "Thread List" \
|
297 |
|
|
{ManagedWin::open ProcessWin} \
|
298 |
|
|
-underline 0 -accelerator "Ctrl+H"
|
299 |
|
|
if {[info exists ::env(GDBTK_DEBUG)] && $::env(GDBTK_DEBUG)} {
|
300 |
|
|
$Menu add separator
|
301 |
|
|
$Menu add command Other "Debug Window" \
|
302 |
|
|
{ManagedWin::open DebugWin} \
|
303 |
|
|
-underline 3 -accelerator "Ctrl+U"
|
304 |
|
|
}
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
# ------------------------------------------------------------------
|
308 |
|
|
# METHOD: create_control_menu - Creates the standard control menu
|
309 |
|
|
# ------------------------------------------------------------------
|
310 |
|
|
|
311 |
|
|
private method create_control_menu {} {
|
312 |
|
|
|
313 |
|
|
$Menu add menubutton cntrl "Control" 0
|
314 |
|
|
|
315 |
|
|
$Menu add command Control "Step" [code $source inferior step] \
|
316 |
|
|
-underline 0 -accelerator S
|
317 |
|
|
|
318 |
|
|
$Menu add command Control "Next" [code $source inferior next] \
|
319 |
|
|
-underline 0 -accelerator N
|
320 |
|
|
|
321 |
|
|
$Menu add command Control "Finish" \
|
322 |
|
|
[code $source inferior finish] \
|
323 |
|
|
-underline 0 -accelerator F
|
324 |
|
|
|
325 |
|
|
$Menu add command Control "Continue" \
|
326 |
|
|
[code $source inferior continue] \
|
327 |
|
|
-underline 0 -accelerator C
|
328 |
|
|
|
329 |
|
|
$Menu add separator
|
330 |
|
|
$Menu add command Control "Step Asm Inst" \
|
331 |
|
|
[code $source inferior stepi] \
|
332 |
|
|
-underline 1 -accelerator S
|
333 |
|
|
|
334 |
|
|
$Menu add command Control "Next Asm Inst" \
|
335 |
|
|
[code $source inferior nexti] \
|
336 |
|
|
-underline 1 -accelerator N
|
337 |
|
|
|
338 |
|
|
# $Menu add separator
|
339 |
|
|
# $Menu add command Other "Automatic Step" auto_step
|
340 |
|
|
}
|
341 |
|
|
|
342 |
|
|
# ------------------------------------------------------------------
|
343 |
|
|
# METHOD: create_trace_menu - Creates the standard trace menu
|
344 |
|
|
# ------------------------------------------------------------------
|
345 |
|
|
|
346 |
|
|
private method create_trace_menu {} {
|
347 |
|
|
|
348 |
|
|
$Menu add menubutton trace "Trace" 0
|
349 |
|
|
|
350 |
|
|
$Menu add command Other "Save Trace Commands..." \
|
351 |
|
|
"save_trace_commands" \
|
352 |
|
|
-underline 0
|
353 |
|
|
|
354 |
|
|
$Menu add separator
|
355 |
|
|
|
356 |
|
|
$Menu add command Trace "Next Hit" {tfind_cmd tfind} \
|
357 |
|
|
-underline 0 -accelerator N
|
358 |
|
|
|
359 |
|
|
$Menu add command Trace "Previous Hit" {tfind_cmd "tfind -"} \
|
360 |
|
|
-underline 0 -accelerator P
|
361 |
|
|
|
362 |
|
|
$Menu add command Trace "First Hit" {tfind_cmd "tfind start"} \
|
363 |
|
|
-underline 0 -accelerator F
|
364 |
|
|
|
365 |
|
|
$Menu add command Trace "Next Line Hit" \
|
366 |
|
|
{tfind_cmd "tfind line"} \
|
367 |
|
|
-underline 5 -accelerator L
|
368 |
|
|
|
369 |
|
|
$Menu add command Trace "Next Hit Here" \
|
370 |
|
|
{tfind_cmd "tfind tracepoint"} \
|
371 |
|
|
-underline 9 -accelerator H
|
372 |
|
|
|
373 |
|
|
$Menu add separator
|
374 |
|
|
$Menu add command Trace "Tfind Line..." \
|
375 |
|
|
"ManagedWin::open TfindArgs -Type LN" \
|
376 |
|
|
-underline 9 -accelerator E
|
377 |
|
|
|
378 |
|
|
$Menu add command Trace "Tfind PC..." \
|
379 |
|
|
"ManagedWin::open TfindArgs -Type PC" \
|
380 |
|
|
-underline 7 -accelerator C
|
381 |
|
|
|
382 |
|
|
$Menu add command Trace "Tfind Tracepoint..." \
|
383 |
|
|
"ManagedWin::open TfindArgs -Type TP" \
|
384 |
|
|
-underline 6 -accelerator T
|
385 |
|
|
|
386 |
|
|
$Menu add command Trace "Tfind Frame..." \
|
387 |
|
|
"ManagedWin::open TfindArgs -Type FR" \
|
388 |
|
|
-underline 6 -accelerator F
|
389 |
|
|
}
|
390 |
|
|
|
391 |
|
|
# ------------------------------------------------------------------
|
392 |
|
|
# METHOD: create_plugin_menu - Creates the optional plugin menu
|
393 |
|
|
# ------------------------------------------------------------------
|
394 |
|
|
private method create_plugin_menu {} {
|
395 |
|
|
global gdb_plugins
|
396 |
|
|
|
397 |
|
|
if {$gdb_plugins != ""} {
|
398 |
|
|
$Menu add menubutton plugin "PlugIn" 4
|
399 |
|
|
set plugins_available 0
|
400 |
|
|
source [file join $gdb_plugins plugins.tcl]
|
401 |
|
|
if {! $plugins_available} {
|
402 |
|
|
# No plugins are available for this configuration,
|
403 |
|
|
# so remove the menu
|
404 |
|
|
debug "No plugins configured, go remove the PlugIn menu..."
|
405 |
|
|
$Menu delete plugin
|
406 |
|
|
}
|
407 |
|
|
}
|
408 |
|
|
}
|
409 |
|
|
|
410 |
|
|
# ------------------------------------------------------------------
|
411 |
|
|
# METHOD: create_pref_menu - Creates the standard preferences menu
|
412 |
|
|
# ------------------------------------------------------------------
|
413 |
|
|
private method create_pref_menu {} {
|
414 |
|
|
|
415 |
|
|
$Menu add menubutton pref "Preferences" 0
|
416 |
|
|
|
417 |
|
|
$Menu add command Other "Global..." \
|
418 |
|
|
"ManagedWin::open GlobalPref -transient" -underline 0
|
419 |
|
|
|
420 |
|
|
$Menu add command Other "Source..." \
|
421 |
|
|
"ManagedWin::open SrcPref -transient" -underline 0
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
# ------------------------------------------------------------------
|
425 |
|
|
# METHOD: create_help_menu - Creates the standard help menu
|
426 |
|
|
# ------------------------------------------------------------------
|
427 |
|
|
private method create_help_menu {} {
|
428 |
|
|
|
429 |
|
|
$Menu add menubutton help "Help" 0
|
430 |
|
|
$Menu add command Other "Help Topics" \
|
431 |
|
|
{HtmlViewer::open_help index.html} \
|
432 |
|
|
-underline 0
|
433 |
|
|
$Menu add separator
|
434 |
|
|
$Menu add command Other "About GDB..." \
|
435 |
|
|
{ManagedWin::open About -transient} \
|
436 |
|
|
-underline 0
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
####################################################################
|
440 |
|
|
# The next set of functions are the generic button groups that gdb uses.
|
441 |
|
|
# Private. Used at contruction time.
|
442 |
|
|
# These were previously at the GDBToolBar...
|
443 |
|
|
####################################################################
|
444 |
|
|
|
445 |
|
|
# ------------------------------------------------------------------
|
446 |
|
|
# METHOD: create_buttons - Add some buttons to the toolbar.
|
447 |
|
|
# Returns list of buttons in form acceptable
|
448 |
|
|
# to standard_toolbar.
|
449 |
|
|
# ------------------------------------------------------------------
|
450 |
|
|
private method create_buttons {} {
|
451 |
|
|
global enable_external_editor
|
452 |
|
|
|
453 |
|
|
$Tool add button stop None {} {}
|
454 |
|
|
_set_runstop
|
455 |
|
|
|
456 |
|
|
if {[pref get gdb/mode]} {
|
457 |
|
|
$Tool add button tstop Control \
|
458 |
|
|
[list $this do_tstop] "Start Collection" \
|
459 |
|
|
-image Movie_on_img
|
460 |
|
|
|
461 |
|
|
$Tool add button view Other [list $this set_control_mode 1] \
|
462 |
|
|
"Switch to Browse Mode" -image watch_movie_img
|
463 |
|
|
|
464 |
|
|
$Tool add separator
|
465 |
|
|
|
466 |
|
|
}
|
467 |
|
|
|
468 |
|
|
if {[pref get gdb/control_target]} {
|
469 |
|
|
create_control_buttons
|
470 |
|
|
if {[pref get gdb/mode]} {
|
471 |
|
|
create_trace_buttons 0
|
472 |
|
|
}
|
473 |
|
|
} elseif {[get pref gdb/mode]} {
|
474 |
|
|
|
475 |
|
|
#
|
476 |
|
|
# If we don't control the target, then we might as well
|
477 |
|
|
# put a copy of the trace controls on the source window.
|
478 |
|
|
#
|
479 |
|
|
create_trace_buttons 1
|
480 |
|
|
}
|
481 |
|
|
|
482 |
|
|
$Tool add separator
|
483 |
|
|
|
484 |
|
|
create_window_buttons
|
485 |
|
|
|
486 |
|
|
# Random bits of obscurity...
|
487 |
|
|
$Tool itembind reg "ManagedWin::open RegWin -force"
|
488 |
|
|
$Tool itembind mem "ManagedWin::open MemWin -force"
|
489 |
|
|
$Tool itembind watch \
|
490 |
|
|
"ManagedWin::open WatchWin -force"
|
491 |
|
|
$Tool itembind vars \
|
492 |
|
|
"ManagedWin::open LocalsWin -force"
|
493 |
|
|
|
494 |
|
|
$Tool add separator
|
495 |
|
|
|
496 |
|
|
if {[info exists enable_external_editor] && $enable_external_editor} {
|
497 |
|
|
$Tool add button edit Other [code $source edit] "Edit Source" \
|
498 |
|
|
-image edit_img
|
499 |
|
|
|
500 |
|
|
$Tool add separator
|
501 |
|
|
}
|
502 |
|
|
|
503 |
|
|
$Tool add label addr $address "Address" -width 10 -relief sunken \
|
504 |
|
|
-bd 1 -anchor e -font src-font
|
505 |
|
|
|
506 |
|
|
$Tool add label line $line "Line Number" -width 6 -relief sunken \
|
507 |
|
|
-bd 1 -anchor e -font src-font
|
508 |
|
|
|
509 |
|
|
$Tool toolbar_button_right_justify
|
510 |
|
|
|
511 |
|
|
create_stack_buttons
|
512 |
|
|
|
513 |
|
|
# This feature has been disabled for now.
|
514 |
|
|
# checkbutton $ButtonFrame.upd -command "$this _toggle_updates" \
|
515 |
|
|
# -variable GDBSrcBar_state($this)
|
516 |
|
|
# lappend button_list $ButtonFrame.upd
|
517 |
|
|
# global GDBSrcBar_state
|
518 |
|
|
# ::set GDBSrcBar_state($this) $updatevalue
|
519 |
|
|
# balloon register $ButtonFrame.upd "Toggle Window Updates"
|
520 |
|
|
}
|
521 |
|
|
|
522 |
|
|
# ------------------------------------------------------------------
|
523 |
|
|
# METHOD: create_control_buttons - Creates the step, continue, etc buttons.
|
524 |
|
|
# ------------------------------------------------------------------
|
525 |
|
|
|
526 |
|
|
private method create_control_buttons {} {
|
527 |
|
|
$Tool add button step Control [code $source inferior step] \
|
528 |
|
|
"Step (S)" -image step_img
|
529 |
|
|
|
530 |
|
|
$Tool add button next Control [code $source inferior next] \
|
531 |
|
|
"Next (N)" -image next_img
|
532 |
|
|
|
533 |
|
|
$Tool add button finish Control [code $source inferior finish] \
|
534 |
|
|
"Finish (F)" -image finish_img
|
535 |
|
|
|
536 |
|
|
$Tool add button continue Control [code $source inferior continue] \
|
537 |
|
|
"Continue (C)" -image continue_img
|
538 |
|
|
|
539 |
|
|
# A spacer before the assembly-level items looks good. It helps
|
540 |
|
|
# to indicate that these are somehow different.
|
541 |
|
|
$Tool add separator
|
542 |
|
|
|
543 |
|
|
$Tool add button stepi Control [code $source inferior stepi] \
|
544 |
|
|
"Step Asm Inst (S)" -image stepi_img
|
545 |
|
|
|
546 |
|
|
$Tool add button nexti Control [code $source inferior nexti] \
|
547 |
|
|
"Next Asm Inst (N)" -image nexti_img
|
548 |
|
|
|
549 |
|
|
_set_stepi
|
550 |
|
|
|
551 |
|
|
set Run_control_buttons {step next finish continue -stepi nexti}
|
552 |
|
|
|
553 |
|
|
}
|
554 |
|
|
|
555 |
|
|
# ------------------------------------------------------------------
|
556 |
|
|
# METHOD: create_trace_buttons - Creates the next hit, etc.
|
557 |
|
|
# ------------------------------------------------------------------
|
558 |
|
|
|
559 |
|
|
private method create_trace_buttons {{show 0}} {
|
560 |
|
|
|
561 |
|
|
if {$show} {
|
562 |
|
|
set command $Tool add button
|
563 |
|
|
} else {
|
564 |
|
|
set command $Tool create
|
565 |
|
|
}
|
566 |
|
|
|
567 |
|
|
$command tfindstart Trace {tfind_cmd "tfind start"} "First Hit " \
|
568 |
|
|
-image rewind_img
|
569 |
|
|
|
570 |
|
|
$command tfind Trace {tfind_cmd tfind} "Next Hit " -image next_hit_img
|
571 |
|
|
|
572 |
|
|
$command tfindprev Trace {tfind_cmd "tfind -"} "Previous Hit " \
|
573 |
|
|
-image prev_hit_img
|
574 |
|
|
|
575 |
|
|
$command tfindline Trace {tfind_cmd "tfind line"} "Next Line Hit " \
|
576 |
|
|
-image next_line_img
|
577 |
|
|
|
578 |
|
|
$command tfindtp Trace { tfind_cmd "tfind tracepoint"} \
|
579 |
|
|
"Next Hit Here " -image next_check_img
|
580 |
|
|
|
581 |
|
|
set Trace_control_buttons {tfindstart tfind tfindprev tfindline tfindtp}
|
582 |
|
|
}
|
583 |
|
|
|
584 |
|
|
# ------------------------------------------------------------------
|
585 |
|
|
# METHOD: create_window_buttons - Creates the registers, etc, buttons
|
586 |
|
|
# ------------------------------------------------------------------
|
587 |
|
|
|
588 |
|
|
private method create_window_buttons {} {
|
589 |
|
|
$Tool add button reg Other {ManagedWin::open RegWin} \
|
590 |
|
|
"Registers (Ctrl+R)" -image reg_img
|
591 |
|
|
|
592 |
|
|
$Tool add button mem Other {ManagedWin::open MemWin} \
|
593 |
|
|
"Memory (Ctrl+M)" -image memory_img
|
594 |
|
|
|
595 |
|
|
$Tool add button stack Other {ManagedWin::open StackWin} \
|
596 |
|
|
"Stack (Ctrl+S)" -image stack_img
|
597 |
|
|
|
598 |
|
|
$Tool add button watch Other {ManagedWin::open WatchWin} \
|
599 |
|
|
"Watch Expressions (Ctrl+W)" -image watch_img
|
600 |
|
|
|
601 |
|
|
$Tool add button vars Other {ManagedWin::open LocalsWin} \
|
602 |
|
|
"Local Variables (Ctrl+L)" -image vars_img
|
603 |
|
|
|
604 |
|
|
if {[pref get gdb/control_target]} {
|
605 |
|
|
$Tool add button bp Other {ManagedWin::open BpWin} \
|
606 |
|
|
"Breakpoints (Ctrl+B)" -image bp_img
|
607 |
|
|
}
|
608 |
|
|
|
609 |
|
|
if {[pref get gdb/mode]} {
|
610 |
|
|
$Tool add button tp Other \
|
611 |
|
|
{ManagedWin::open BpWin -tracepoints 1} \
|
612 |
|
|
"Tracepoints (Ctrl+T)" -image tp_img
|
613 |
|
|
|
614 |
|
|
$Tool add button tdump Trace {ManagedWin::open TdumpWin} \
|
615 |
|
|
"Tdump (Ctrl+D)" -image tdump_img
|
616 |
|
|
}
|
617 |
|
|
|
618 |
|
|
$Tool add button con Other {ManagedWin::open Console} \
|
619 |
|
|
"Console (Ctrl+N)" -image console_img
|
620 |
|
|
}
|
621 |
|
|
|
622 |
|
|
# ------------------------------------------------------------------
|
623 |
|
|
# METHOD: create_stack_buttons - Creates the up down bottom stack buttons
|
624 |
|
|
# ------------------------------------------------------------------
|
625 |
|
|
|
626 |
|
|
private method create_stack_buttons {} {
|
627 |
|
|
|
628 |
|
|
$Tool add button down {Trace Control} \
|
629 |
|
|
[code $source stack down] \
|
630 |
|
|
"Down Stack Frame" -image down_img
|
631 |
|
|
|
632 |
|
|
$Tool add button up {Trace Control} \
|
633 |
|
|
[code $source stack up] \
|
634 |
|
|
"Up Stack Frame" -image up_img
|
635 |
|
|
|
636 |
|
|
$Tool add button bottom {Trace Control} \
|
637 |
|
|
[code $source stack bottom] \
|
638 |
|
|
"Go to Bottom of Stack" -image bottom_img
|
639 |
|
|
|
640 |
|
|
}
|
641 |
|
|
|
642 |
|
|
####################################################################
|
643 |
|
|
#
|
644 |
|
|
# Auxiliary methods used by the toolbar
|
645 |
|
|
#
|
646 |
|
|
####################################################################
|
647 |
|
|
|
648 |
|
|
# ------------------------------------------------------------------
|
649 |
|
|
# METHOD: _load_images - Load standard images. Private method.
|
650 |
|
|
# ------------------------------------------------------------------
|
651 |
|
|
public method _load_images { {reconfig 0} } {
|
652 |
|
|
global gdb_ImageDir
|
653 |
|
|
if {!$reconfig && $_loaded_images} {
|
654 |
|
|
return
|
655 |
|
|
}
|
656 |
|
|
set _loaded_images 1
|
657 |
|
|
|
658 |
|
|
lappend imgs console reg stack vmake vars watch memory bp
|
659 |
|
|
foreach name $imgs {
|
660 |
|
|
image create photo ${name}_img -file [file join $gdb_ImageDir ${name}.gif]
|
661 |
|
|
}
|
662 |
|
|
}
|
663 |
|
|
|
664 |
|
|
# ------------------------------------------------------------------
|
665 |
|
|
# METHOD: _load_src_images - Load standard images. Private method.
|
666 |
|
|
# ------------------------------------------------------------------
|
667 |
|
|
method _load_src_images { {reconf 0} } {
|
668 |
|
|
global gdb_ImageDir
|
669 |
|
|
|
670 |
|
|
if {!$reconf && $_loaded_src_images} {
|
671 |
|
|
return
|
672 |
|
|
}
|
673 |
|
|
set _loaded_src_images 1
|
674 |
|
|
|
675 |
|
|
foreach name {run stop step next finish continue edit \
|
676 |
|
|
stepi nexti up down bottom Movie_on Movie_off \
|
677 |
|
|
next_line next_check next_hit rewind prev_hit \
|
678 |
|
|
watch_movie run_expt tdump tp} {
|
679 |
|
|
image create photo ${name}_img -file [file join $gdb_ImageDir ${name}.gif]
|
680 |
|
|
}
|
681 |
|
|
}
|
682 |
|
|
|
683 |
|
|
# ------------------------------------------------------------------
|
684 |
|
|
# METHOD: _set_runstop - Set state of run/stop button.
|
685 |
|
|
#
|
686 |
|
|
# busy - Run button becomes disabled
|
687 |
|
|
# running - Stop button appears, allowing user to stop executing target
|
688 |
|
|
# downloading - Stop button appears, allowing user to interrupt downloading
|
689 |
|
|
# normal - Run button appears, allowing user to run/re-run exe
|
690 |
|
|
# ------------------------------------------------------------------
|
691 |
|
|
public method _set_runstop {} {
|
692 |
|
|
dbug I $runstop
|
693 |
|
|
|
694 |
|
|
switch $runstop {
|
695 |
|
|
busy {
|
696 |
|
|
$Tool itemconfigure stop -state disabled
|
697 |
|
|
}
|
698 |
|
|
downloading {
|
699 |
|
|
$Tool itemconfigure stop -state normal -image stop_img \
|
700 |
|
|
-command [code $this cancel_download]
|
701 |
|
|
$Tool itemballoon stop "Stop"
|
702 |
|
|
}
|
703 |
|
|
running {
|
704 |
|
|
$Tool itemconfigure stop -state normal -image stop_img \
|
705 |
|
|
-command [code $source inferior stop]
|
706 |
|
|
$Tool itemballoon stop "Stop"
|
707 |
|
|
}
|
708 |
|
|
normal {
|
709 |
|
|
$Tool itemconfigure stop -state normal -image run_img \
|
710 |
|
|
-command [code $source inferior run]
|
711 |
|
|
$Tool itemballoon stop "Run (R)"
|
712 |
|
|
}
|
713 |
|
|
default {
|
714 |
|
|
dbug W "unknown state $runstop"
|
715 |
|
|
}
|
716 |
|
|
}
|
717 |
|
|
}
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
# ------------------------------------------------------------------
|
721 |
|
|
# METHOD: _set_stepi - Set state of stepi/nexti buttons.
|
722 |
|
|
# ------------------------------------------------------------------
|
723 |
|
|
public method _set_stepi {} {
|
724 |
|
|
|
725 |
|
|
# Only do this in synchronous mode
|
726 |
|
|
if {!$Tracing} {
|
727 |
|
|
# In source-only mode, disable these buttons. Otherwise, enable
|
728 |
|
|
# them.
|
729 |
|
|
if {$displaymode == "SOURCE"} {
|
730 |
|
|
set state disabled
|
731 |
|
|
} else {
|
732 |
|
|
set state normal
|
733 |
|
|
}
|
734 |
|
|
$Tool itemconfigure stepi -state $state
|
735 |
|
|
$Tool itemconfigure nexti -state $state
|
736 |
|
|
}
|
737 |
|
|
}
|
738 |
|
|
|
739 |
|
|
|
740 |
|
|
####################################################################
|
741 |
|
|
#
|
742 |
|
|
# State control methods used by both the menu and the toolbar
|
743 |
|
|
#
|
744 |
|
|
####################################################################
|
745 |
|
|
|
746 |
|
|
# ------------------------------------------------------------------
|
747 |
|
|
# METHOD: handle_trace_find_hook - response to the tfind command.
|
748 |
|
|
# If the command puts us in a new mode, then switch modes...
|
749 |
|
|
# ------------------------------------------------------------------
|
750 |
|
|
method handle_trace_find_hook {mode from_tty} {
|
751 |
|
|
debug "mode: $mode, from_tty: $from_tty, Browsing: $Browsing"
|
752 |
|
|
if {[string compare $mode -1] == 0} {
|
753 |
|
|
if {$Browsing} {
|
754 |
|
|
set_control_mode 0
|
755 |
|
|
}
|
756 |
|
|
} else {
|
757 |
|
|
if {!$Browsing} {
|
758 |
|
|
set_control_mode 1
|
759 |
|
|
}
|
760 |
|
|
}
|
761 |
|
|
}
|
762 |
|
|
|
763 |
|
|
# ------------------------------------------------------------------
|
764 |
|
|
# METHOD: set_control_mode - sets up the srcbar for browsing
|
765 |
|
|
# a trace experiment.
|
766 |
|
|
# mode: 1 => browse mode
|
767 |
|
|
# 0 => control mode
|
768 |
|
|
# ------------------------------------------------------------------
|
769 |
|
|
method set_control_mode {mode} {
|
770 |
|
|
debug "set_control_mode called with mode $mode"
|
771 |
|
|
if {$mode} {
|
772 |
|
|
set Browsing 1
|
773 |
|
|
$Tool itemconfigure view -image run_expt_img \
|
774 |
|
|
-command "$this set_control_mode 0"
|
775 |
|
|
$Tool itemballoon view "Switch to Control mode"
|
776 |
|
|
# Now swap out the buttons...
|
777 |
|
|
$Tool toolbar_swap_button_lists $Trace_control_buttons \
|
778 |
|
|
$Run_control_buttons
|
779 |
|
|
enable_ui 1
|
780 |
|
|
} else {
|
781 |
|
|
if {$Browsing} {
|
782 |
|
|
tfind_cmd {tfind none}
|
783 |
|
|
}
|
784 |
|
|
set Browsing 0
|
785 |
|
|
$Tool itemconfigure view -image watch_movie_img \
|
786 |
|
|
-command "$this set_control_mode 1"
|
787 |
|
|
$Tool itemballoon view "Switch to Browse mode"
|
788 |
|
|
# Now swap out the buttons...
|
789 |
|
|
$Tool toolbar_swap_button_lists $Run_control_buttons \
|
790 |
|
|
$Trace_control_buttons
|
791 |
|
|
enable_ui 1
|
792 |
|
|
}
|
793 |
|
|
}
|
794 |
|
|
|
795 |
|
|
# ------------------------------------------------------------------
|
796 |
|
|
# METHOD: reconfig - reconfigure the srcbar
|
797 |
|
|
# used when preferences change
|
798 |
|
|
# ------------------------------------------------------------------
|
799 |
|
|
public method reconfig {} {
|
800 |
|
|
debug
|
801 |
|
|
_load_src_images 1
|
802 |
|
|
_load_images 1
|
803 |
|
|
# FIXME: Must Check if we are Tracing and set the buttons accordingly.
|
804 |
|
|
}
|
805 |
|
|
|
806 |
|
|
# ------------------------------------------------------------------
|
807 |
|
|
# METHOD: set_variable - run when user enters a `set' command.
|
808 |
|
|
#
|
809 |
|
|
# FIXME: Should not be accessing the base class internal data
|
810 |
|
|
# As the spec says, one must clear the menu and recreate it.
|
811 |
|
|
# ------------------------------------------------------------------
|
812 |
|
|
public method set_variable {event} {
|
813 |
|
|
set varname [$event get variable]
|
814 |
|
|
set value [$event get value]
|
815 |
|
|
debug "Got $varname = $value"
|
816 |
|
|
|
817 |
|
|
if {$varname == "os"} {
|
818 |
|
|
# Make current_menu pointer point to the View Menu.
|
819 |
|
|
# FIXME: Should not be accessing the base class internal data directly
|
820 |
|
|
set view_menu [menu_find View]
|
821 |
|
|
# Restore the current_menu pointer.
|
822 |
|
|
set save_menu [$Menu menubar_set_current_menu $view_menu]
|
823 |
|
|
set title "Kernel Objects"
|
824 |
|
|
|
825 |
|
|
# Look for the KOD menu entry...
|
826 |
|
|
if {[catch {$view_menu index $title} index]} {
|
827 |
|
|
set index none
|
828 |
|
|
}
|
829 |
|
|
|
830 |
|
|
# FIXME: This assumes that the KOD menu is the last one as it does not
|
831 |
|
|
# adjust the index information kept by the GDBMenuBar class.
|
832 |
|
|
if {$value == ""} {
|
833 |
|
|
# No OS, so remove KOD from View menu.
|
834 |
|
|
if {$index != "none"} {
|
835 |
|
|
# FIXME: Should not be accessing the base class internal data
|
836 |
|
|
$view_menu delete $index
|
837 |
|
|
}
|
838 |
|
|
} else {
|
839 |
|
|
# Add KOD to View menu, but only if it isn't already there.
|
840 |
|
|
if {$index == "none"} {
|
841 |
|
|
$Menu add command Other $title \
|
842 |
|
|
{ManagedWin::open KodWin} \
|
843 |
|
|
-underline 0 -accelerator "Ctrl+K"
|
844 |
|
|
}
|
845 |
|
|
}
|
846 |
|
|
|
847 |
|
|
# Restore the current_menu pointer.
|
848 |
|
|
$Menu menubar_set_current_menu $save_menu
|
849 |
|
|
|
850 |
|
|
global gdb_kod_cmd
|
851 |
|
|
set gdb_kod_cmd $value
|
852 |
|
|
}
|
853 |
|
|
}
|
854 |
|
|
|
855 |
|
|
####################################################################
|
856 |
|
|
# The following method enables/disables both menus and buttons.
|
857 |
|
|
####################################################################
|
858 |
|
|
|
859 |
|
|
# ------------------------------------------------------------------
|
860 |
|
|
# METHOD: enable_ui - enable/disable the appropriate buttons and menus
|
861 |
|
|
# Called from the busy, idle, and no_inferior hooks.
|
862 |
|
|
#
|
863 |
|
|
# on must be:
|
864 |
|
|
# value Control Other Trace State
|
865 |
|
|
# 0 off off off gdb is busy
|
866 |
|
|
# 1 on on off gdb has inferior, and is idle
|
867 |
|
|
# 2 off on off gdb has no inferior, and is idle
|
868 |
|
|
# ------------------------------------------------------------------
|
869 |
|
|
public method enable_ui {on} {
|
870 |
|
|
global tcl_platform
|
871 |
|
|
debug "$on - Browsing=$Browsing"
|
872 |
|
|
|
873 |
|
|
# Do the enabling so that all the disabling happens first, this way if a
|
874 |
|
|
# button belongs to two groups, enabling takes precedence, which is
|
875 |
|
|
# probably right.
|
876 |
|
|
|
877 |
|
|
switch $on {
|
878 |
|
|
|
879 |
|
|
# Busy
|
880 |
|
|
set enable_list {Control disabled \
|
881 |
|
|
Other disabled \
|
882 |
|
|
Trace disabled \
|
883 |
|
|
Attach disabled \
|
884 |
|
|
Detach disabled}
|
885 |
|
|
}
|
886 |
|
|
1 {
|
887 |
|
|
# Idle, with inferior
|
888 |
|
|
if {!$Browsing} {
|
889 |
|
|
set enable_list {Trace disabled \
|
890 |
|
|
Control normal \
|
891 |
|
|
Other normal \
|
892 |
|
|
Attach disabled \
|
893 |
|
|
Detach normal }
|
894 |
|
|
# set the states of stepi and nexti correctly
|
895 |
|
|
_set_stepi
|
896 |
|
|
} else {
|
897 |
|
|
set enable_list {Control disabled Other normal Trace normal}
|
898 |
|
|
}
|
899 |
|
|
|
900 |
|
|
}
|
901 |
|
|
2 {
|
902 |
|
|
# Idle, no inferior
|
903 |
|
|
set enable_list {Control disabled \
|
904 |
|
|
Trace disabled \
|
905 |
|
|
Other normal \
|
906 |
|
|
Attach normal \
|
907 |
|
|
Detach disabled }
|
908 |
|
|
}
|
909 |
|
|
default {
|
910 |
|
|
debug "Unknown type: $on in enable_ui"
|
911 |
|
|
return
|
912 |
|
|
}
|
913 |
|
|
}
|
914 |
|
|
|
915 |
|
|
$Menu set_class_state $enable_list
|
916 |
|
|
$Tool set_class_state $enable_list
|
917 |
|
|
}
|
918 |
|
|
|
919 |
|
|
####################################################################
|
920 |
|
|
#
|
921 |
|
|
# Execute actions corresponding to menu events
|
922 |
|
|
#
|
923 |
|
|
####################################################################
|
924 |
|
|
|
925 |
|
|
# ------------------------------------------------------------------
|
926 |
|
|
# METHOD: do_attach: attach to a running target
|
927 |
|
|
# ------------------------------------------------------------------
|
928 |
|
|
method do_attach {menu} {
|
929 |
|
|
gdbtk_attach_native
|
930 |
|
|
}
|
931 |
|
|
|
932 |
|
|
# ------------------------------------------------------------------
|
933 |
|
|
# METHOD: do_detach: detach from a running target
|
934 |
|
|
# ------------------------------------------------------------------
|
935 |
|
|
method do_detach {menu} {
|
936 |
|
|
gdbtk_disconnect
|
937 |
|
|
gdbtk_idle
|
938 |
|
|
}
|
939 |
|
|
|
940 |
|
|
# ------------------------------------------------------------------
|
941 |
|
|
# METHOD: do_kill: kill the current target
|
942 |
|
|
# ------------------------------------------------------------------
|
943 |
|
|
method do_kill {menu} {
|
944 |
|
|
gdb_cmd "kill"
|
945 |
|
|
run_hooks gdb_no_inferior_hook
|
946 |
|
|
}
|
947 |
|
|
|
948 |
|
|
# ------------------------------------------------------------------
|
949 |
|
|
# METHOD: do_connect: connect to a remote target
|
950 |
|
|
# in asynch mode if async is 1
|
951 |
|
|
# ------------------------------------------------------------------
|
952 |
|
|
method do_connect {menu {async 0}} {
|
953 |
|
|
|
954 |
|
|
set successful [gdbtk_connect $async]
|
955 |
|
|
|
956 |
|
|
if {$successful} {
|
957 |
|
|
$menu entryconfigure "Connect to target" -state disabled
|
958 |
|
|
$menu entryconfigure "Disconnect" -state normal
|
959 |
|
|
} else {
|
960 |
|
|
$menu entryconfigure "Connect to target" -state normal
|
961 |
|
|
$menu entryconfigure "Disconnect" -state disabled
|
962 |
|
|
}
|
963 |
|
|
|
964 |
|
|
# Make the menu reflect this change
|
965 |
|
|
::update idletasks
|
966 |
|
|
}
|
967 |
|
|
|
968 |
|
|
# ------------------------------------------------------------------
|
969 |
|
|
# METHOD: do_disconnect: disconnect from a remote target
|
970 |
|
|
# in asynch mode if async is 1.
|
971 |
|
|
#
|
972 |
|
|
# ------------------------------------------------------------------
|
973 |
|
|
method do_disconnect {menu {async 0}} {
|
974 |
|
|
debug "$menu $async"
|
975 |
|
|
#
|
976 |
|
|
# For now, these are the same, but they might be different...
|
977 |
|
|
#
|
978 |
|
|
|
979 |
|
|
gdbtk_disconnect $async
|
980 |
|
|
|
981 |
|
|
$menu entryconfigure "Connect to target" -state normal
|
982 |
|
|
$menu entryconfigure "Disconnect" -state disabled
|
983 |
|
|
}
|
984 |
|
|
|
985 |
|
|
####################################################################
|
986 |
|
|
#
|
987 |
|
|
# Execute actions corresponding to toolbar events
|
988 |
|
|
#
|
989 |
|
|
####################################################################
|
990 |
|
|
|
991 |
|
|
# ------------------------------------------------------------------
|
992 |
|
|
# METHOD: _toggle_updates - Run when the update checkbutton is
|
993 |
|
|
# toggled. Private method.
|
994 |
|
|
# ------------------------------------------------------------------
|
995 |
|
|
public method _toggle_updates {} {
|
996 |
|
|
global GDBSrcBar_state
|
997 |
|
|
if {$updatecommand != ""} {
|
998 |
|
|
uplevel \#0 $updatecommand $GDBSrcBar_state($this)
|
999 |
|
|
}
|
1000 |
|
|
}
|
1001 |
|
|
|
1002 |
|
|
# ------------------------------------------------------------------
|
1003 |
|
|
# METHOD: cancel_download
|
1004 |
|
|
# ------------------------------------------------------------------
|
1005 |
|
|
public method cancel_download {} {
|
1006 |
|
|
global download_dialog download_cancel_ok
|
1007 |
|
|
|
1008 |
|
|
if {"$download_dialog" != ""} {
|
1009 |
|
|
$download_dialog cancel
|
1010 |
|
|
} else {
|
1011 |
|
|
set download_cancel_ok 1
|
1012 |
|
|
}
|
1013 |
|
|
}
|
1014 |
|
|
|
1015 |
|
|
####################################################################
|
1016 |
|
|
#
|
1017 |
|
|
# Execute actions that can be activated by both menu entries and
|
1018 |
|
|
# toolbar buttons
|
1019 |
|
|
#
|
1020 |
|
|
####################################################################
|
1021 |
|
|
|
1022 |
|
|
# ------------------------------------------------------------------
|
1023 |
|
|
# METHOD: do_tstop: Change the GUI state, then do the tstop or
|
1024 |
|
|
# tstart command, whichever is appropriate.
|
1025 |
|
|
#
|
1026 |
|
|
# ------------------------------------------------------------------
|
1027 |
|
|
method do_tstop {} {
|
1028 |
|
|
debug "do_tstop called... Collecting is $Collecting"
|
1029 |
|
|
|
1030 |
|
|
if {!$Collecting} {
|
1031 |
|
|
#
|
1032 |
|
|
# Start the trace experiment
|
1033 |
|
|
#
|
1034 |
|
|
|
1035 |
|
|
if {$Browsing} {
|
1036 |
|
|
set ret [tk_messageBox -title "Warning" -message \
|
1037 |
|
|
"You are currently browsing a trace experiment.
|
1038 |
|
|
This command will clear the results of that experiment.
|
1039 |
|
|
Do you want to continue?" \
|
1040 |
|
|
-icon warning -type okcancel -default ok]
|
1041 |
|
|
if {[string compare $ret cancel] == 0} {
|
1042 |
|
|
return
|
1043 |
|
|
}
|
1044 |
|
|
set_control_mode 1
|
1045 |
|
|
}
|
1046 |
|
|
if {[tstart]} {
|
1047 |
|
|
# FIXME: Must enable the Stop Collection menu item and
|
1048 |
|
|
# disable the Start Collection item
|
1049 |
|
|
$Tool itemconfigure tstop -image Movie_off_img
|
1050 |
|
|
$Tool itemballoon tstop "End Collection"
|
1051 |
|
|
set Collecting 1
|
1052 |
|
|
} else {
|
1053 |
|
|
tk_messageBox -title Error \
|
1054 |
|
|
-message "Error downloading tracepoint info" \
|
1055 |
|
|
-icon error -type ok
|
1056 |
|
|
}
|
1057 |
|
|
} else {
|
1058 |
|
|
#
|
1059 |
|
|
# Stop the trace experiment
|
1060 |
|
|
#
|
1061 |
|
|
|
1062 |
|
|
if {[tstop]} {
|
1063 |
|
|
# FIXME: Must enable the Stop Collection menu item and
|
1064 |
|
|
# disable the Start Collection item
|
1065 |
|
|
$Tool itemconfigure tstop -image Movie_on_img
|
1066 |
|
|
$Tool itemballoon tstop "Start Collection"
|
1067 |
|
|
set Collecting 0
|
1068 |
|
|
}
|
1069 |
|
|
}
|
1070 |
|
|
}
|
1071 |
|
|
|
1072 |
|
|
# ------------------------------------------------------------------
|
1073 |
|
|
# METHOD: busy - BusyEvent handler
|
1074 |
|
|
# ------------------------------------------------------------------
|
1075 |
|
|
method busy {event} {
|
1076 |
|
|
enable_ui 0
|
1077 |
|
|
}
|
1078 |
|
|
|
1079 |
|
|
# ------------------------------------------------------------------
|
1080 |
|
|
# METHOD: idle - IdleEvent handler
|
1081 |
|
|
# ------------------------------------------------------------------
|
1082 |
|
|
method idle {event} {
|
1083 |
|
|
enable_ui 1
|
1084 |
|
|
}
|
1085 |
|
|
|
1086 |
|
|
####################################################################
|
1087 |
|
|
#
|
1088 |
|
|
# PRIVATE DATA
|
1089 |
|
|
#
|
1090 |
|
|
####################################################################
|
1091 |
|
|
|
1092 |
|
|
# This is a handle on our parent source window.
|
1093 |
|
|
private variable source {}
|
1094 |
|
|
|
1095 |
|
|
# The GdbMenuBar component
|
1096 |
|
|
private variable Menu
|
1097 |
|
|
|
1098 |
|
|
# The GdbToolBar component
|
1099 |
|
|
private variable Tool
|
1100 |
|
|
|
1101 |
|
|
# FIXME - Need to break the images into the sets needed for
|
1102 |
|
|
# each button group, and load them when the button group is
|
1103 |
|
|
# created.
|
1104 |
|
|
|
1105 |
|
|
# This is set if we've already loaded the standard images.
|
1106 |
|
|
private common _loaded_images 0
|
1107 |
|
|
|
1108 |
|
|
# This is set if we've already loaded the standard images. Private
|
1109 |
|
|
# variable.
|
1110 |
|
|
private common _loaded_src_images 0
|
1111 |
|
|
|
1112 |
|
|
# These buttons go in the control area when we are browsing
|
1113 |
|
|
protected variable Trace_control_buttons
|
1114 |
|
|
|
1115 |
|
|
# And these go in the control area when we are running
|
1116 |
|
|
protected variable Run_control_buttons
|
1117 |
|
|
|
1118 |
|
|
####################################################################
|
1119 |
|
|
#
|
1120 |
|
|
# PUBLIC DATA
|
1121 |
|
|
#
|
1122 |
|
|
####################################################################
|
1123 |
|
|
|
1124 |
|
|
# This is the command that should be run when the `update'
|
1125 |
|
|
# checkbutton is toggled. The current value of the checkbutton is
|
1126 |
|
|
# appended to the command.
|
1127 |
|
|
public variable updatecommand {}
|
1128 |
|
|
|
1129 |
|
|
# This controls whether the `update' checkbutton is turned on or
|
1130 |
|
|
# off.
|
1131 |
|
|
public variable updatevalue 0 {
|
1132 |
|
|
global GDBSrcBar_state
|
1133 |
|
|
::set GDBSrcBar_state($this) $updatevalue
|
1134 |
|
|
}
|
1135 |
|
|
|
1136 |
|
|
# This holds the text that is shown in the address label.
|
1137 |
|
|
public variable address {} {
|
1138 |
|
|
$Tool itemconfigure addr -text $address -font src-font
|
1139 |
|
|
}
|
1140 |
|
|
|
1141 |
|
|
# This holds the text that is shown in the line label.
|
1142 |
|
|
public variable line {} {
|
1143 |
|
|
$Tool itemconfigure line -text $line
|
1144 |
|
|
}
|
1145 |
|
|
|
1146 |
|
|
# This holds the source window's display mode. Valid values are
|
1147 |
|
|
# SOURCE, ASSEMBLY, SRC+ASM, and MIXED.
|
1148 |
|
|
public variable displaymode SOURCE {
|
1149 |
|
|
_set_stepi
|
1150 |
|
|
}
|
1151 |
|
|
|
1152 |
|
|
# This indicates what is the inferior state.
|
1153 |
|
|
# Possible values are: {busy running downloading normal}
|
1154 |
|
|
public variable runstop normal {
|
1155 |
|
|
dbug I "configuring runstop $runstop"
|
1156 |
|
|
|
1157 |
|
|
# Set the Run/Stop button accordingly
|
1158 |
|
|
_set_runstop
|
1159 |
|
|
}
|
1160 |
|
|
|
1161 |
|
|
# The next three determine the state of the application when Tracing is enabled.
|
1162 |
|
|
|
1163 |
|
|
public variable Tracing 0 ;# Is tracing enabled for this gdb?
|
1164 |
|
|
public variable Browsing 0 ;# Are we currently browsing a trace experiment?
|
1165 |
|
|
public variable Collecting 0 ;# Are we currently collecting a trace experiment?
|
1166 |
|
|
}
|