summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gdbtk/library/ChangeLog21
-rw-r--r--gdb/gdbtk/library/bpwin.itb7
-rw-r--r--gdb/gdbtk/library/srctextwin.itb27
-rw-r--r--gdb/gdbtk/library/srctextwin.ith2
-rw-r--r--gdb/gdbtk/library/srcwin.itb160
-rw-r--r--gdb/gdbtk/library/srcwin.ith19
-rw-r--r--gdb/gdbtk/library/tclIndex25
7 files changed, 224 insertions, 37 deletions
diff --git a/gdb/gdbtk/library/ChangeLog b/gdb/gdbtk/library/ChangeLog
index 48c6a653e3c..e0ee7af8286 100644
--- a/gdb/gdbtk/library/ChangeLog
+++ b/gdb/gdbtk/library/ChangeLog
@@ -1,5 +1,26 @@
2000-12-07 Tom Tromey <tromey@redhat.com>
+ * bpwin.itb (BpWin::goto_bp): Handle multiple source windows.
+ * srctextwin.itb (SrcTextWin::get_file): New method.
+ (SrcTextWin::set_tag_to_stack): New method.
+ * srctextwin.ith (get_file): Declare.
+ * srcwin.ith (update_hook_init, window_list, pc_window): New
+ common variables.
+ (_choose_window, choose_and_update, is_fixed, get_file): Declare.
+ * srcwin.itb (SrcWin::_choose_window): New method.
+ (SrcWin::choose_and_update): Likewise.
+ (SrcWin::_update): Renamed from update. Now private. Added `loc'
+ argument.
+ (SrcWin::get_file): New method.
+ (SrcWin::is_fixed): Likewise.
+ (SrcWin::constructor): Only add update hook once. Append this
+ object to window list.
+ (SrcWin::destructor): Don't add update hook. Remove this object
+ from window list. Clear pc_window if necessary.
+ (SrcWin::get_top): New method.
+ (SrcWin::_set_tag_to_stack): New method.
+ (SrcWin::choose_and_display): New method.
+
* srctextwin.itb (SrcTextWin::do_source_popup): Added "Set
Breakpoint" to popup menu.
diff --git a/gdb/gdbtk/library/bpwin.itb b/gdb/gdbtk/library/bpwin.itb
index 17f85c05dc0..ee895a9472a 100644
--- a/gdb/gdbtk/library/bpwin.itb
+++ b/gdb/gdbtk/library/bpwin.itb
@@ -688,10 +688,5 @@ body BpWin::goto_bp {r} {
}
set pc [lindex $bpinfo 3]
- # !! FIXME: multiple source windows?
- set src [lindex [ManagedWin::find SrcWin] 0]
- set info [gdb_loc *$pc]
- $src location BROWSE_TAG $info
+ SrcWin::choose_and_display BROWSE_TAG [gdb_loc *$pc]
}
-
-
diff --git a/gdb/gdbtk/library/srctextwin.itb b/gdb/gdbtk/library/srctextwin.itb
index c33dfa366f5..9fde1a4ee9e 100644
--- a/gdb/gdbtk/library/srctextwin.itb
+++ b/gdb/gdbtk/library/srctextwin.itb
@@ -1160,6 +1160,22 @@ body SrcTextWin::_highlightAsmLine {win addr pc_addr tagname} {
}
# ------------------------------------------------------------------
+# METHOD: set_tag - update tag to STACK without making other changes
+# ------------------------------------------------------------------
+body SrcTextWin::set_tag_to_stack {} {
+ foreach window [list $twin $bwin] {
+ if {$window == ""} then {
+ continue
+ }
+ foreach {start end} [$window tag ranges PC_TAG] {
+ $window tag remove PC_TAG $start $end
+ $window tag add STACK_TAG $start $end
+ }
+ }
+ set current(tag) STACK_TAG
+}
+
+# ------------------------------------------------------------------
# METHOD: location - display a location in a file
# ------------------------------------------------------------------
body SrcTextWin::location {tagname filename funcname line addr pc_addr lib} {
@@ -1579,7 +1595,7 @@ body SrcTextWin::hasTP {win line} {
}
# ------------------------------------------------------------------
-# METHOD: report_current_location
+# METHOD: report_source_location
#
# This function reports the "current" location in the source
# window, where current means what gdb_loc would return, if
@@ -2798,6 +2814,13 @@ body SrcTextWin::test_get {var} {
}
# ------------------------------------------------------------------
+# METHOD: get_file - Return name of current file.
+# ------------------------------------------------------------------
+body SrcTextWin::get_file {} {
+ return $current(filename)
+}
+
+# ------------------------------------------------------------------
# METHOD: clear_file - Clear out state so that user may load
# new executable. For the SrcTextWin class, this means:
#
@@ -2873,5 +2896,3 @@ body SrcTextWin::_clear_cache {} {
}
}
}
-
-
diff --git a/gdb/gdbtk/library/srctextwin.ith b/gdb/gdbtk/library/srctextwin.ith
index 08852bf9c1f..e045f1e008d 100644
--- a/gdb/gdbtk/library/srctextwin.ith
+++ b/gdb/gdbtk/library/srctextwin.ith
@@ -87,6 +87,8 @@ class SrcTextWin {
method do_thread_bp {listbox}
method test_get {var}
method clear_file {}
+ method get_file {}
+ method set_tag_to_stack {}
}
protected {
diff --git a/gdb/gdbtk/library/srcwin.itb b/gdb/gdbtk/library/srcwin.itb
index 6956f31f4a6..c88c0819b97 100644
--- a/gdb/gdbtk/library/srcwin.itb
+++ b/gdb/gdbtk/library/srcwin.itb
@@ -19,26 +19,29 @@ body SrcWin::constructor {args} {
debug "$args"
eval itk_initialize $args
set top [winfo toplevel $itk_interior]
-
+
_update_title ""
-
+
# On Windows, create a sizebox.
if {$::tcl_platform(platform) == "windows"} {
ide_sizebox $itk_interior.sizebox
}
-
+
set Tracing [pref get gdb/mode]
set current(filename) ""
-
+
if {[catch {_build_win} mssg]} {
dbug E "_build_win returned: $::errorInfo"
}
-
+
# add special delete handler
wm protocol $top WM_DELETE_WINDOW "[code $this _exit]"
-
+
# add hooks
- add_hook gdb_update_hook "$this update"
+ if {! $update_hook_init} then {
+ set update_hook_init 1
+ add_hook gdb_update_hook "SrcWin::choose_and_update"
+ }
add_hook gdb_busy_hook "$this busy"
add_hook gdb_idle_hook "$this idle"
add_hook gdb_no_inferior_hook "$this no_inferior"
@@ -48,6 +51,8 @@ body SrcWin::constructor {args} {
after idle "
update idletasks
$this sizeWinByChild toolbar"
+
+ lappend window_list $this
}
# ------------------------------------------------------------------
@@ -55,13 +60,16 @@ body SrcWin::constructor {args} {
# ------------------------------------------------------------------
body SrcWin::destructor {} {
debug
- remove_hook gdb_update_hook "$this update"
remove_hook gdb_busy_hook "$this busy"
remove_hook gdb_no_inferior_hook "$this no_inferior"
remove_hook gdb_idle_hook "$this idle"
remove_hook download_progress_hook "$this download_progress"
remove_hook state_hook [code $this _set_state]
remove_hook gdb_clear_file_hook [code $this clear_file]
+ set window_list [lremove $window_list $this]
+ if {$pc_window == $this} then {
+ set pc_window ""
+ }
}
# ------------------------------------------------------------------
@@ -463,19 +471,15 @@ body SrcWin::stack {cmd} {
}
# ------------------------------------------------------------------
-# PUBLIC METHOD: update - update widget when PC changes
+# METHOD: _update - update widget when PC changes
# ------------------------------------------------------------------
-body SrcWin::update {} {
- if {[catch {gdb_loc} loc]} {
- set_execution_status
- } else {
- debug "loc=$loc"
- # See if name combobox needs filled.
- if {$need_files} {
- fillNameCB
- }
- location "" $loc
+body SrcWin::_update {loc} {
+ debug "loc=$loc"
+ # See if name combobox needs filled.
+ if {$need_files} {
+ fillNameCB
}
+ location "" $loc
}
# ------------------------------------------------------------------
@@ -868,3 +872,121 @@ body SrcWin::clear_file {} {
# run srctextwin clear_file
$twin clear_file
}
+
+# ------------------------------------------------------------------
+# METHOD: get_file
+# Return name of displayed file, or empty string if no file.
+# ------------------------------------------------------------------
+body SrcWin::get_file {} {
+ if {$twin == ""} {
+ return ""
+ } else {
+ return [$twin get_file]
+ }
+}
+
+# ------------------------------------------------------------------
+# METHOD: is_fixed
+# Return boolean indicating whether this window is fixed.
+# ------------------------------------------------------------------
+body SrcWin::is_fixed {} {
+ return 0
+}
+
+# ------------------------------------------------------------------
+# METHOD: get_top
+# Return toplevel
+# ------------------------------------------------------------------
+body SrcWin::get_top {} {
+ return $top
+}
+
+# ------------------------------------------------------------------
+# METHOD: _set_tag_to_stack
+# Set tag to `stack' and update the underlying window.
+# ------------------------------------------------------------------
+body SrcWin::_set_tag_to_stack {} {
+ set tag STACK_TAG
+ if {$twin != ""} then {
+ $twin set_tag_to_stack
+ }
+}
+
+# ------------------------------------------------------------------
+# METHOD: _choose_window
+# Choose the right source window.
+# ------------------------------------------------------------------
+body SrcWin::_choose_window {file} {
+ # Find the next available source window. The rules are:
+ # 1. LRU overall
+ # 2. Skip iconified windows
+ # 3. If a window already shows the file, use it. Prefer the
+ # window currently showing the PC
+ # 4. If the window is fixed, skip it
+ if {$pc_window != ""} then {
+ if {[$pc_window get_file] == $file} then {
+ return $pc_window
+ }
+ }
+
+ set choice ""
+ foreach win $window_list {
+ if {[wm state [$win get_top]] != "normal"} then {
+ continue
+ }
+
+ if {[$win get_file] == ""
+ || [$win get_file] == $file
+ || ! [$win is_fixed]} then {
+ set choice $win
+ break
+ }
+ }
+
+ # If we didn't find an available window, then pick the current PC
+ # window.
+ if {$choice == ""} then {
+ set choice $pc_window
+ }
+
+ set window_list [lremove $window_list $choice]
+ lappend window_list $choice
+
+ return $choice
+}
+
+# ------------------------------------------------------------------
+# METHOD: choose_and_update
+# Choose the right source window and then cause it to be updated
+# ------------------------------------------------------------------
+body SrcWin::choose_and_update {} {
+ if {$pc_window == ""} then {
+ set pc_window [lindex $window_list 0]
+ }
+
+ if {$pc_window == ""} then {
+ # Nothing.
+ } elseif {[catch {gdb_loc} loc]} {
+ $pc_window set_execution_status
+ } else {
+ set prev $pc_window
+ set file [lindex $loc 2]
+ set pc_window [_choose_window $file]
+ debug "chose window $pc_window"
+ $pc_window _update $loc
+ if {$pc_window != $prev} then {
+ $pc_window reveal
+ $prev _set_tag_to_stack
+ }
+ }
+}
+
+# ------------------------------------------------------------------
+# METHOD: choose_and_display
+# Choose the right source window for a given file
+# ------------------------------------------------------------------
+body SrcWin::choose_and_display {tag linespec} {
+ set file [lindex $linespec 2]
+ set window [_choose_window $file]
+ $window location $tag $linespec
+}
diff --git a/gdb/gdbtk/library/srcwin.ith b/gdb/gdbtk/library/srcwin.ith
index f955158d445..5ad1da70a51 100644
--- a/gdb/gdbtk/library/srcwin.ith
+++ b/gdb/gdbtk/library/srcwin.ith
@@ -48,11 +48,14 @@ class SrcWin {
method stack {cmd}
method test_get {var {private_func 0}}
method toggle_updates {value}
- method update {}
method toolbar {state}
method inferior {action}
method clear_file {}
+ method get_file {}
+ method is_fixed {}
+ proc choose_and_update {}
+ proc choose_and_display {tag linespec}
proc point_to_main {}
}
@@ -64,6 +67,10 @@ class SrcWin {
method _set_name { val {found 1} }
method _set_state {varname}
method _update_title {name}
+ method _update {loc}
+ method get_top {}
+ method _set_tag_to_stack {}
+ proc _choose_window {file}
variable _statbar
variable _status
variable _toolbar
@@ -75,12 +82,18 @@ class SrcWin {
variable _mangled_func
variable Tracing
variable saved_msg "" ;# static
-
+
# statics used for downloads
variable last_section ""
variable last_section_start 0
variable last_done 0
-
+
+ # These keep track of the current PC window and the list of all
+ # source windows.
+ common window_list ""
+ common pc_window ""
+ common update_hook_init 0
+
# fenceposts
variable Running 0
variable NoRun 0
diff --git a/gdb/gdbtk/library/tclIndex b/gdb/gdbtk/library/tclIndex
index caaf35200c7..08a38766072 100644
--- a/gdb/gdbtk/library/tclIndex
+++ b/gdb/gdbtk/library/tclIndex
@@ -8,12 +8,10 @@
set auto_index(About) [list source [file join $dir about.tcl]]
set auto_index(ActionDlg) [list source [file join $dir actiondlg.tcl]]
-set auto_index(::tty::_xterm_rgb) [list source [file join $dir inferior_term.tcl]]
-set auto_index(::tty::create) [list source [file join $dir inferior_term.tcl]]
-set auto_index(::tty::destroy) [list source [file join $dir inferior_term.tcl]]
set auto_index(gdbtk_tcl_preloop) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_busy) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_update) [list source [file join $dir interface.tcl]]
+set auto_index(gdbtk_update_safe) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_idle) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_quit_check) [list source [file join $dir interface.tcl]]
set auto_index(gdbtk_quit) [list source [file join $dir interface.tcl]]
@@ -91,6 +89,8 @@ set auto_index(GDBToolBar) [list source [file join $dir toolbar.tcl]]
set auto_index(TraceDlg) [list source [file join $dir tracedlg.tcl]]
set auto_index(gdb_add_tracepoint) [list source [file join $dir tracedlg.tcl]]
set auto_index(gdb_edit_tracepoint) [list source [file join $dir tracedlg.tcl]]
+set auto_index(::tty::create) [list source [file join $dir tty.tcl]]
+set auto_index(::tty::destroy) [list source [file join $dir tty.tcl]]
set auto_index(keep_raised) [list source [file join $dir util.tcl]]
set auto_index(sleep) [list source [file join $dir util.tcl]]
set auto_index(auto_step) [list source [file join $dir util.tcl]]
@@ -110,7 +110,6 @@ set auto_index(list_element_strcmp) [list source [file join $dir util.tcl]]
set auto_index(VariableWin) [list source [file join $dir variables.tcl]]
set auto_index(::VariableWin::getLocals) [list source [file join $dir variables.tcl]]
set auto_index(WarningDlg) [list source [file join $dir warning.tcl]]
-set auto_index(::WarningDlg::destructor) [list source [file join $dir warning.tcl]]
set auto_index(::WarningDlg::constructor) [list source [file join $dir warning.tcl]]
set auto_index(WatchWin) [list source [file join $dir watch.tcl]]
set auto_index(AttachDlg) [list source [file join $dir attachdlg.ith]]
@@ -235,6 +234,8 @@ set auto_index(::Console::_find_lcp) [list source [file join $dir console.itb]]
set auto_index(::Console::_find_completion) [list source [file join $dir console.itb]]
set auto_index(::Console::_complete) [list source [file join $dir console.itb]]
set auto_index(::Console::_reset_tab) [list source [file join $dir console.itb]]
+set auto_index(::Console::_set_wrap) [list source [file join $dir console.itb]]
+set auto_index(::Console::_update_option) [list source [file join $dir console.itb]]
set auto_index(::Stack::constructor) [list source [file join $dir data.itb]]
set auto_index(::Stack::push) [list source [file join $dir data.itb]]
set auto_index(::Stack::destructor) [list source [file join $dir data.itb]]
@@ -312,6 +313,7 @@ set auto_index(::KodWin::_disable_buttons) [list source [file join $dir kod.itb]
set auto_index(::KodWin::_restore_buttons) [list source [file join $dir kod.itb]]
set auto_index(::ManagedWin::reconfig) [list source [file join $dir managedwin.itb]]
set auto_index(::ManagedWin::window_name) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::pickle) [list source [file join $dir managedwin.itb]]
set auto_index(::ManagedWin::reveal) [list source [file join $dir managedwin.itb]]
set auto_index(::ManagedWin::restart) [list source [file join $dir managedwin.itb]]
set auto_index(::ManagedWin::shutdown) [list source [file join $dir managedwin.itb]]
@@ -393,9 +395,9 @@ set auto_index(::RegWin::fixLength) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::but3) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::display_all) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::delete_from_display_list) [list source [file join $dir regwin.itb]]
-set auto_index(::RegWin::addToWatch) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::edit) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::acceptEdit) [list source [file join $dir regwin.itb]]
+set auto_index(::RegWin::addToWatch) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::unedit) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::update) [list source [file join $dir regwin.itb]]
set auto_index(::RegWin::idle) [list source [file join $dir regwin.itb]]
@@ -432,6 +434,7 @@ set auto_index(::SrcTextWin::FillSource) [list source [file join $dir srctextwin
set auto_index(::SrcTextWin::FillAssembly) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::FillMixed) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::_highlightAsmLine) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::set_tag_to_stack) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::location) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::LoadFile) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::display_line) [list source [file join $dir srctextwin.itb]]
@@ -445,7 +448,9 @@ set auto_index(::SrcTextWin::hasTP) [list source [file join $dir srctextwin.itb]
set auto_index(::SrcTextWin::report_source_location) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::lookup_line) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::continue_to_here) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::jump_to_here) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::set_bp_at_line) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::enable_disable_at_line) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::remove_bp_at_line) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::set_tp_at_line) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::next_hit_at_line) [list source [file join $dir srctextwin.itb]]
@@ -471,6 +476,7 @@ set auto_index(::SrcTextWin::print) [list source [file join $dir srctextwin.itb]
set auto_index(::SrcTextWin::ask_thread_bp) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::do_thread_bp) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::test_get) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::get_file) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::clear_file) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::_initialize_srctextwin) [list source [file join $dir srctextwin.itb]]
set auto_index(::SrcTextWin::_clear_cache) [list source [file join $dir srctextwin.itb]]
@@ -487,7 +493,7 @@ set auto_index(::SrcWin::fillNameCB) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::fillFuncCB) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::location) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::stack) [list source [file join $dir srcwin.itb]]
-set auto_index(::SrcWin::update) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::_update) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::idle) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::mode) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::_update_title) [list source [file join $dir srcwin.itb]]
@@ -507,6 +513,13 @@ set auto_index(::SrcWin::test_get) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::toolbar) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::inferior) [list source [file join $dir srcwin.itb]]
set auto_index(::SrcWin::clear_file) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::get_file) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::is_fixed) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::get_top) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::_set_tag_to_stack) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::_choose_window) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::choose_and_update) [list source [file join $dir srcwin.itb]]
+set auto_index(::SrcWin::choose_and_display) [list source [file join $dir srcwin.itb]]
set auto_index(::StackWin::constructor) [list source [file join $dir stackwin.itb]]
set auto_index(::StackWin::destructor) [list source [file join $dir stackwin.itb]]
set auto_index(::StackWin::build_win) [list source [file join $dir stackwin.itb]]