+proc create_breakpoints_window {} {
+ global bpframe_lasty
+
+ if [winfo exists .breakpoints] {raise .breakpoints ; return}
+
+ build_framework .breakpoints "Breakpoints" ""
+
+# First, delete all the old view menu entries
+
+ .breakpoints.menubar.view.menu delete 0 last
+
+# Get rid of label
+
+ destroy .breakpoints.label
+
+# Replace text with a canvas and fix the scrollbars
+
+ destroy .breakpoints.text
+ canvas .breakpoints.c -relief sunken -bd 2 \
+ -cursor hand2 -yscrollcommand {.breakpoints.scroll set}
+ .breakpoints.scroll configure -command {.breakpoints.c yview}
+ scrollbar .breakpoints.scrollx -orient horizontal \
+ -command {.breakpoints.c xview} -relief sunken
+
+ pack .breakpoints.scrollx -side bottom -fill x -in .breakpoints.info
+ pack .breakpoints.c -side left -expand yes -fill both \
+ -in .breakpoints.info
+
+ set bpframe_lasty 0
+
+# Create a frame for each breakpoint
+
+ foreach bpnum [gdb_get_breakpoint_list] {
+ add_breakpoint_frame $bpnum
+ }
+}
+
+# Create a frame for bpnum in the .breakpoints canvas
+
+proc add_breakpoint_frame bpnum {
+ global bpframe_lasty
+
+ if ![winfo exists .breakpoints] return
+
+ set bpinfo [gdb_get_breakpoint_info $bpnum]
+
+ set file [lindex $bpinfo 0]
+ set line [lindex $bpinfo 1]
+ set pc [lindex $bpinfo 2]
+ set type [lindex $bpinfo 3]
+ set enabled [lindex $bpinfo 4]
+ set disposition [lindex $bpinfo 5]
+ set silent [lindex $bpinfo 6]
+ set ignore_count [lindex $bpinfo 7]
+ set commands [lindex $bpinfo 8]
+ set cond [lindex $bpinfo 9]
+ set thread [lindex $bpinfo 10]
+ set hit_count [lindex $bpinfo 11]
+
+ set f .breakpoints.c.$bpnum
+
+ if ![winfo exists $f] {
+ frame $f -relief sunken -bd 2
+
+ label $f.id -text "#$bpnum $file:$line ($pc)" \
+ -relief flat -bd 2 -anchor w
+ label $f.hit_count -text "Hit count: $hit_count" -relief flat \
+ -bd 2 -anchor w
+
+ frame $f.thread
+ label $f.thread.label -text "Thread: " -relief flat -bd 2 \
+ -width 11 -anchor w
+ entry $f.thread.entry -bd 2 -relief sunken -width 10
+ $f.thread.entry insert end $thread
+ pack $f.thread.label -side left
+ pack $f.thread.entry -side left -fill x
+
+ frame $f.cond
+ label $f.cond.label -text "Condition: " -relief flat -bd 2 \
+ -width 11 -anchor w
+ entry $f.cond.entry -bd 2 -relief sunken
+ $f.cond.entry insert end $cond
+ pack $f.cond.label -side left
+ pack $f.cond.entry -side left -fill x -expand yes
+
+ frame $f.ignore_count
+ label $f.ignore_count.label -text "Ignore count: " \
+ -relief flat -bd 2 -width 11 -anchor w
+ entry $f.ignore_count.entry -bd 2 -relief sunken -width 10
+ $f.ignore_count.entry insert end $ignore_count
+ pack $f.ignore_count.label -side left
+ pack $f.ignore_count.entry -side left -fill x
+
+ frame $f.disps
+
+ checkbutton $f.disps.enabled -text "Enabled " \
+ -variable enabled -anchor w -relief flat
+
+ radiobutton $f.disps.delete -text Delete \
+ -variable disposition -anchor w -relief flat
+
+ radiobutton $f.disps.disable -text Disable \
+ -variable disposition -anchor w -relief flat
+
+ radiobutton $f.disps.donttouch -text "Leave alone" \
+ -variable disposition -anchor w -relief flat
+
+ pack $f.disps.delete $f.disps.disable $f.disps.donttouch \
+ -side left -anchor w
+ pack $f.disps.enabled -side right -anchor e
+ text $f.commands -relief sunken -bd 2 -setgrid true \
+ -cursor hand2 -height 3 -width 30
+
+ foreach line $commands {
+ $f.commands insert end "${line}\n"
+ }
+
+ pack $f.id -side top -anchor nw -fill x
+ pack $f.hit_count $f.cond $f.thread $f.ignore_count $f.disps \
+ $f.commands -side top -fill x -anchor nw
+ }
+
+ set tag [.breakpoints.c create window 0 $bpframe_lasty -window $f -anchor nw]
+ update
+ set bbox [.breakpoints.c bbox $tag]
+
+ set bpframe_lasty [lindex $bbox 3]
+}
+
+# Delete a breakpoint frame
+
+proc delete_breakpoint_frame bpnum {
+ global bpframe_lasty
+
+ if ![winfo exists .breakpoints] return
+
+# First, clear the canvas
+
+ .breakpoints.c delete all
+
+# Now, repopulate it with all but the doomed breakpoint
+
+ set bpframe_lasty 0
+ foreach bp [gdb_get_breakpoint_list] {
+ if {$bp != $bpnum} {
+ add_breakpoint_frame $bp
+ }
+ }
+}
+