Index: library/srctextwin.ith =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.ith,v retrieving revision 1.14 diff -u -p -r1.14 srctextwin.ith --- library/srctextwin.ith 23 Dec 2005 18:26:50 -0000 1.14 +++ library/srctextwin.ith 9 Oct 2009 02:51:11 -0000 @@ -1,5 +1,5 @@ # SrcTextWin class definition, for Insight -# Copyright (C) 1997, 1998, 1999, 2001 Red Hat, Inc. +# Copyright (C) 1997, 1998, 1999, 2001, 2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License (GPL) as published by @@ -160,4 +160,8 @@ itcl::class SrcTextWin { protected common TimeOut 100 ;# The timeout value for variable balloon help + # Executabe line search limit: When an executable changes, we might + # have a breakpoint at a location that is no longer valid. This variable + # limits the search for the "nearest" (next) executable line. + protected common ExecutableLineLimit 100 } Index: library/srctextwin.itb =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v retrieving revision 1.44 diff -u -p -r1.44 srctextwin.itb --- library/srctextwin.itb 16 Dec 2008 09:07:57 -0000 1.44 +++ library/srctextwin.itb 9 Oct 2009 02:51:11 -0000 @@ -1,5 +1,5 @@ # Paned text widget for source code, for Insight -# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2008 Red Hat, Inc. +# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2008, 2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License (GPL) as published by @@ -1362,6 +1362,14 @@ itcl::body SrcTextWin::insertBreakTag {w # tag. We will query the length of the previous tag, so we don't have # to hard code it here. + # Find the nearest executable line + for {set i 0} {$i < $ExecutableLineLimit} {incr i} { + if {[line_is_executable $win [expr {$linenum + $i}]]} { + incr linenum $i + break + } + } + set tag_list [$win tag names $linenum.0] set img_name [string range $tag 0 [expr [string length $tag] - 5]] @@ -1378,7 +1386,7 @@ itcl::body SrcTextWin::insertBreakTag {w set other_tag [lindex $tag_list \ [lsearch -glob $tag_list {*[bt]p_tag}]] if {$other_tag == ""} { - set stop 4 + set stop "$linenum.4" } else { set stop [lindex [$win tag nextrange $other_tag \ $linenum.0 "$linenum.0 lineend"] 1]