mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 12:24:19 +08:00
* gdbtk.tcl (add_breakpoint_frame): Add more fields.
* (create_file_win create_asm_win build_framework): Create null bindings for meta keys to keep window from dropping down to insertion point when meta is pressed by itself. New bindings: Up/Down - Scroll up/down one line at a time Next/Prior - Scroll up/down one page at a time Home/End - Warp to current pc/end of file * (build_framework): Turn on breakpoint menu. * (create_command_window): Implement tab completion. Add binding for ^C to stop target.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
Tue Jun 20 10:19:40 1995 Stu Grossman (grossman@cygnus.com)
|
||||||
|
|
||||||
|
* gdbtk.tcl (add_breakpoint_frame): Add more fields.
|
||||||
|
* (create_file_win create_asm_win build_framework): Create null
|
||||||
|
bindings for meta keys to keep window from dropping down to
|
||||||
|
insertion point when meta is pressed by itself. New bindings:
|
||||||
|
Up/Down - Scroll up/down one line at a time
|
||||||
|
Next/Prior - Scroll up/down one page at a time
|
||||||
|
Home/End - Warp to current pc/end of file
|
||||||
|
* (build_framework): Turn on breakpoint menu.
|
||||||
|
* (create_command_window): Implement tab completion. Add binding
|
||||||
|
for ^C to stop target.
|
||||||
|
|
||||||
Sat Jun 17 10:17:16 1995 Jeff Law (law@snake.cs.utah.edu)
|
Sat Jun 17 10:17:16 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
* somsolib.c (som_solib_add): Validate regexp argument.
|
* somsolib.c (som_solib_add): Validate regexp argument.
|
||||||
|
132
gdb/gdbtk.tcl
132
gdb/gdbtk.tcl
@ -233,8 +233,15 @@ proc add_breakpoint_frame bpnum {
|
|||||||
|
|
||||||
label $f.id -text "#$bpnum $file:$line ($pc)" \
|
label $f.id -text "#$bpnum $file:$line ($pc)" \
|
||||||
-relief flat -bd 2 -anchor w
|
-relief flat -bd 2 -anchor w
|
||||||
label $f.hit_count -text "Hit count: $hit_count" -relief flat \
|
frame $f.hit_count
|
||||||
|
label $f.hit_count.label -text "Hit count:" -relief flat \
|
||||||
|
-bd 2 -anchor w -width 11
|
||||||
|
label $f.hit_count.val -text $hit_count -relief flat \
|
||||||
-bd 2 -anchor w
|
-bd 2 -anchor w
|
||||||
|
checkbutton $f.hit_count.enabled -text Enabled \
|
||||||
|
-variable enabled -anchor w -relief flat
|
||||||
|
pack $f.hit_count.label $f.hit_count.val -side left
|
||||||
|
pack $f.hit_count.enabled -side right
|
||||||
|
|
||||||
frame $f.thread
|
frame $f.thread
|
||||||
label $f.thread.label -text "Thread: " -relief flat -bd 2 \
|
label $f.thread.label -text "Thread: " -relief flat -bd 2 \
|
||||||
@ -262,8 +269,8 @@ proc add_breakpoint_frame bpnum {
|
|||||||
|
|
||||||
frame $f.disps
|
frame $f.disps
|
||||||
|
|
||||||
checkbutton $f.disps.enabled -text "Enabled " \
|
label $f.disps.label -text "Disposition: " -relief flat -bd 2 \
|
||||||
-variable enabled -anchor w -relief flat
|
-anchor w -width 11
|
||||||
|
|
||||||
radiobutton $f.disps.delete -text Delete \
|
radiobutton $f.disps.delete -text Delete \
|
||||||
-variable disposition -anchor w -relief flat
|
-variable disposition -anchor w -relief flat
|
||||||
@ -274,9 +281,8 @@ proc add_breakpoint_frame bpnum {
|
|||||||
radiobutton $f.disps.donttouch -text "Leave alone" \
|
radiobutton $f.disps.donttouch -text "Leave alone" \
|
||||||
-variable disposition -anchor w -relief flat
|
-variable disposition -anchor w -relief flat
|
||||||
|
|
||||||
pack $f.disps.delete $f.disps.disable $f.disps.donttouch \
|
pack $f.disps.label $f.disps.delete $f.disps.disable \
|
||||||
-side left -anchor w
|
$f.disps.donttouch -side left -anchor w
|
||||||
pack $f.disps.enabled -side right -anchor e
|
|
||||||
text $f.commands -relief sunken -bd 2 -setgrid true \
|
text $f.commands -relief sunken -bd 2 -setgrid true \
|
||||||
-cursor hand2 -height 3 -width 30
|
-cursor hand2 -height 3 -width 30
|
||||||
|
|
||||||
@ -294,6 +300,8 @@ proc add_breakpoint_frame bpnum {
|
|||||||
set bbox [.breakpoints.c bbox $tag]
|
set bbox [.breakpoints.c bbox $tag]
|
||||||
|
|
||||||
set bpframe_lasty [lindex $bbox 3]
|
set bpframe_lasty [lindex $bbox 3]
|
||||||
|
|
||||||
|
.breakpoints.c configure -width [lindex $bbox 2]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete a breakpoint frame
|
# Delete a breakpoint frame
|
||||||
@ -1109,6 +1117,15 @@ proc create_file_win {filename debug_file} {
|
|||||||
bind $win <1> do_nothing
|
bind $win <1> do_nothing
|
||||||
bind $win <B1-Motion> do_nothing
|
bind $win <B1-Motion> do_nothing
|
||||||
|
|
||||||
|
bind $win <Key-Alt_R> do_nothing
|
||||||
|
bind $win <Key-Alt_L> do_nothing
|
||||||
|
bind $win <Key-Prior> "$win yview {@0,0 - 10 lines}"
|
||||||
|
bind $win <Key-Next> "$win yview {@0,0 + 10 lines}"
|
||||||
|
bind $win <Key-Up> "$win yview {@0,0 - 1 lines}"
|
||||||
|
bind $win <Key-Down> "$win yview {@0,0 + 1 lines}"
|
||||||
|
bind $win <Key-Home> {update_listing [gdb_loc]}
|
||||||
|
bind $win <Key-End> "$win yview -pickplace end"
|
||||||
|
|
||||||
bind $win n {interactive_cmd next}
|
bind $win n {interactive_cmd next}
|
||||||
bind $win s {interactive_cmd step}
|
bind $win s {interactive_cmd step}
|
||||||
bind $win c {interactive_cmd continue}
|
bind $win c {interactive_cmd continue}
|
||||||
@ -1222,6 +1239,16 @@ proc create_asm_win {funcname pc} {
|
|||||||
bind $win <Enter> {focus %W}
|
bind $win <Enter> {focus %W}
|
||||||
bind $win <1> {asm_window_button_1 %W %X %Y %x %y}
|
bind $win <1> {asm_window_button_1 %W %X %Y %x %y}
|
||||||
bind $win <B1-Motion> do_nothing
|
bind $win <B1-Motion> do_nothing
|
||||||
|
|
||||||
|
bind $win <Key-Alt_R> do_nothing
|
||||||
|
bind $win <Key-Alt_L> do_nothing
|
||||||
|
bind $win <Key-Prior> "$win yview {@0,0 - 10 lines}"
|
||||||
|
bind $win <Key-Next> "$win yview {@0,0 + 10 lines}"
|
||||||
|
bind $win <Key-Up> "$win yview {@0,0 - 1 lines}"
|
||||||
|
bind $win <Key-Down> "$win yview {@0,0 + 1 lines}"
|
||||||
|
bind $win <Key-Home> {update_assembly [gdb_loc]}
|
||||||
|
bind $win <Key-End> "$win yview -pickplace end"
|
||||||
|
|
||||||
bind $win n {interactive_cmd nexti}
|
bind $win n {interactive_cmd nexti}
|
||||||
bind $win s {interactive_cmd stepi}
|
bind $win s {interactive_cmd stepi}
|
||||||
bind $win c {interactive_cmd continue}
|
bind $win c {interactive_cmd continue}
|
||||||
@ -2009,8 +2036,8 @@ proc build_framework {win {title GDBtk} {label {}}} {
|
|||||||
-command create_expr_window
|
-command create_expr_window
|
||||||
${win}.menubar.window.menu add command -label "Auto Command" \
|
${win}.menubar.window.menu add command -label "Auto Command" \
|
||||||
-command create_autocmd_window
|
-command create_autocmd_window
|
||||||
# ${win}.menubar.window.menu add command -label Breakpoints \
|
${win}.menubar.window.menu add command -label Breakpoints \
|
||||||
# -command create_breakpoints_window
|
-command create_breakpoints_window
|
||||||
|
|
||||||
# ${win}.menubar.window.menu add separator
|
# ${win}.menubar.window.menu add separator
|
||||||
# ${win}.menubar.window.menu add command -label Files \
|
# ${win}.menubar.window.menu add command -label Files \
|
||||||
@ -2047,6 +2074,15 @@ proc build_framework {win {title GDBtk} {label {}}} {
|
|||||||
scrollbar ${win}.scroll -orient vertical -command "${win}.text yview" \
|
scrollbar ${win}.scroll -orient vertical -command "${win}.text yview" \
|
||||||
-relief sunken
|
-relief sunken
|
||||||
|
|
||||||
|
bind $win <Key-Alt_R> do_nothing
|
||||||
|
bind $win <Key-Alt_L> do_nothing
|
||||||
|
bind $win <Key-Prior> "$win yview {@0,0 - 10 lines}"
|
||||||
|
bind $win <Key-Next> "$win yview {@0,0 + 10 lines}"
|
||||||
|
bind $win <Key-Up> "$win yview {@0,0 - 1 lines}"
|
||||||
|
bind $win <Key-Down> "$win yview {@0,0 + 1 lines}"
|
||||||
|
bind $win <Key-Home> "$win yview -pickplace end"
|
||||||
|
bind $win <Key-End> "$win yview -pickplace end"
|
||||||
|
|
||||||
pack ${win}.label -side bottom -fill x -in ${win}.info
|
pack ${win}.label -side bottom -fill x -in ${win}.info
|
||||||
pack ${win}.scroll -side right -fill y -in ${win}.info
|
pack ${win}.scroll -side right -fill y -in ${win}.info
|
||||||
pack ${win}.text -side left -expand yes -fill both -in ${win}.info
|
pack ${win}.text -side left -expand yes -fill both -in ${win}.info
|
||||||
@ -2169,9 +2205,43 @@ proc create_autocmd_window {} {
|
|||||||
pack .autocmd.entryframe -side bottom -fill x -before .autocmd.info
|
pack .autocmd.entryframe -side bottom -fill x -before .autocmd.info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return the longest common prefix in SLIST. Can be empty string.
|
||||||
|
|
||||||
|
proc find_lcp slist {
|
||||||
|
# Handle trivial cases where list is empty or length 1
|
||||||
|
if {[llength $slist] <= 1} {return [lindex $slist 0]}
|
||||||
|
|
||||||
|
set prefix [lindex $slist 0]
|
||||||
|
set prefixlast [expr [string length $prefix] - 1]
|
||||||
|
|
||||||
|
foreach str [lrange $slist 1 end] {
|
||||||
|
set test_str [string range $str 0 $prefixlast]
|
||||||
|
while {[string compare $test_str $prefix] != 0} {
|
||||||
|
decr prefixlast
|
||||||
|
set prefix [string range $prefix 0 $prefixlast]
|
||||||
|
set test_str [string range $str 0 $prefixlast]
|
||||||
|
}
|
||||||
|
if {$prefixlast < 0} break
|
||||||
|
}
|
||||||
|
return $prefix
|
||||||
|
}
|
||||||
|
|
||||||
|
# Look through COMPLETIONS to generate the suffix needed to do command
|
||||||
|
# completion on CMD.
|
||||||
|
|
||||||
|
proc find_completion {cmd completions} {
|
||||||
|
# Get longest common prefix
|
||||||
|
set lcp [find_lcp $completions]
|
||||||
|
set cmd_len [string length $cmd]
|
||||||
|
# Return suffix beyond end of cmd
|
||||||
|
return [string range $lcp $cmd_len end]
|
||||||
|
}
|
||||||
|
|
||||||
proc create_command_window {} {
|
proc create_command_window {} {
|
||||||
global command_line
|
global command_line
|
||||||
|
global saw_tab
|
||||||
|
|
||||||
|
set saw_tab 0
|
||||||
if [winfo exists .cmd] {raise .cmd ; return}
|
if [winfo exists .cmd] {raise .cmd ; return}
|
||||||
|
|
||||||
build_framework .cmd Command "* Command Buffer *"
|
build_framework .cmd Command "* Command Buffer *"
|
||||||
@ -2185,17 +2255,22 @@ proc create_command_window {} {
|
|||||||
bind .cmd.text <Enter> {focus %W}
|
bind .cmd.text <Enter> {focus %W}
|
||||||
bind .cmd.text <Delete> {delete_char %W}
|
bind .cmd.text <Delete> {delete_char %W}
|
||||||
bind .cmd.text <BackSpace> {delete_char %W}
|
bind .cmd.text <BackSpace> {delete_char %W}
|
||||||
|
bind .cmd.text <Control-c> gdb_stop
|
||||||
bind .cmd.text <Control-u> {delete_line %W}
|
bind .cmd.text <Control-u> {delete_line %W}
|
||||||
bind .cmd.text <Any-Key> {
|
bind .cmd.text <Any-Key> {
|
||||||
global command_line
|
global command_line
|
||||||
|
global saw_tab
|
||||||
|
|
||||||
|
set saw_tab 0
|
||||||
%W insert end %A
|
%W insert end %A
|
||||||
%W yview -pickplace end
|
%W yview -pickplace end
|
||||||
append command_line %A
|
append command_line %A
|
||||||
}
|
}
|
||||||
bind .cmd.text <Key-Return> {
|
bind .cmd.text <Key-Return> {
|
||||||
global command_line
|
global command_line
|
||||||
|
global saw_tab
|
||||||
|
|
||||||
|
set saw_tab 0
|
||||||
%W insert end \n
|
%W insert end \n
|
||||||
interactive_cmd $command_line
|
interactive_cmd $command_line
|
||||||
|
|
||||||
@ -2214,6 +2289,47 @@ proc create_command_window {} {
|
|||||||
%W yview -pickplace end
|
%W yview -pickplace end
|
||||||
append command_line [selection get]
|
append command_line [selection get]
|
||||||
}
|
}
|
||||||
|
bind .cmd.text <Key-Tab> {
|
||||||
|
global command_line
|
||||||
|
global saw_tab
|
||||||
|
global choices
|
||||||
|
|
||||||
|
set choices [gdb_cmd "complete $command_line"]
|
||||||
|
set choices [string trimright $choices \n]
|
||||||
|
set choices [split $choices \n]
|
||||||
|
|
||||||
|
# Just do completion if this is the first tab
|
||||||
|
if !$saw_tab {
|
||||||
|
set saw_tab 1
|
||||||
|
set completion [find_completion $command_line $choices]
|
||||||
|
append command_line $completion
|
||||||
|
# Here is where the completion is actually done. If there is one match,
|
||||||
|
# complete the command and print a space. If two or more matches, complete the
|
||||||
|
# command and beep. If no match, just beep.
|
||||||
|
switch -exact [llength $choices] {
|
||||||
|
0 {}
|
||||||
|
1 {%W insert end "$completion "
|
||||||
|
append command_line " "
|
||||||
|
return }
|
||||||
|
default {%W insert end "$completion"}
|
||||||
|
}
|
||||||
|
puts -nonewline stdout \007
|
||||||
|
flush stdout
|
||||||
|
%W yview -pickplace end
|
||||||
|
} else {
|
||||||
|
# User hit another consecutive tab. List the choices. Note that at this
|
||||||
|
# point, choices may contain commands with spaces. We have to lop off
|
||||||
|
# everything before (and including) the last space so that the completion
|
||||||
|
# list only shows the possibilities for the last token.
|
||||||
|
|
||||||
|
set choices [lsort $choices]
|
||||||
|
if [regexp ".* " $command_line prefix] {
|
||||||
|
regsub -all $prefix $choices {} choices
|
||||||
|
}
|
||||||
|
%W insert end "\n[join $choices { }]\n(gdb) $command_line"
|
||||||
|
%W yview -pickplace end
|
||||||
|
}
|
||||||
|
}
|
||||||
proc delete_char {win} {
|
proc delete_char {win} {
|
||||||
global command_line
|
global command_line
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user