From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25176 invoked by alias); 20 Apr 2005 14:16:47 -0000 Mailing-List: contact insight-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sources.redhat.com Received: (qmail 25106 invoked from network); 20 Apr 2005 14:16:36 -0000 Received: from unknown (HELO postfix3-1.free.fr) (213.228.0.44) by sourceware.org with SMTP; 20 Apr 2005 14:16:36 -0000 Received: from imp6-q.free.fr (imp6-q.free.fr [212.27.42.6]) by postfix3-1.free.fr (Postfix) with ESMTP id A9BED17350B for ; Wed, 20 Apr 2005 16:16:35 +0200 (CEST) Received: by imp6-q.free.fr (Postfix, from userid 33) id 7E7902145D; Wed, 20 Apr 2005 16:16:35 +0200 (MEST) Received: from smtp.teleca.fr (smtp.teleca.fr [194.250.242.162]) by imp6-q.free.fr (IMP) with HTTP for ; Wed, 20 Apr 2005 16:16:35 +0200 Message-ID: <1114006595.426664435f040@imp6-q.free.fr> Date: Wed, 20 Apr 2005 14:16:00 -0000 From: elmer.elmer@free.fr To: insight@sources.redhat.com Subject: PATCH : Ghost breakpoints MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.5 X-SW-Source: 2005-q2/txt/msg00010.txt.bz2 Hi, When restarting a debug session one the same application, Insight tries to restore breakpoints from the last session. It is a nice feature !!! But it is a little brawback : If you discover a bug, fix it, and then restart a debug session, line numbers in your file may have changed !! Insight records breakpoints as file:line When you restart a new debug session, Insight tries to set breakpoints at the previous location. Generally, its works (your breakpoints are shifted up or down by few lines). But if the file:line does not correspond any more to code (a comment for example), gdb accepts to set the breakpoint (at the next code line), but Insight keeps the old location ... As result, the gdb breakpoint is effective, but Insight does not display it any more in the source window (it can be seen in mixed or assembly mode). Moreover it causes error when clicking on this breakpoint from the breakpoint window. The following patch ensures that a breakpoint is valid (on a real code line) before restoring it ... I'm sure there is better solution (try to record the content of a source line, and then locate this line when restoring breakpoints, but it is much more difficult)... .../gdb/gdbtk/library/session.tcl proc _recreate_bps {specs} { ! set invalid_breakpoints "" foreach spec $specs { lassign $spec create enabled condition commands ! # Check the breakpoint ! set gdb_pos "" ! #debug "$create" ! catch {set name_number [lindex [split $create] 1]} ! catch {set gdb_pos [gdb_cmd "info line $name_number"]} ! if {![string match "*starts at*" $gdb_pos]} { ! # breakpoint cannot be set ! #debug "cannot restore breakpoint at $name_number (file changed ?)" ! set invalid_breakpoints "$name_number \n $invalid_breakpoints" ! continue ! } # Create the breakpoint ................. ! if {$invalid_breakpoints != ""} { ! tk_messageBox -type ok -icon warning -title "Breakpoints" \ ! -message "cannot restore old breakpoints at:\n $invalid_breakpoints" ! } } I you have a better idea...