public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* PATCH : Ghost breakpoints
@ 2005-04-20 14:16 elmer.elmer
  0 siblings, 0 replies; only message in thread
From: elmer.elmer @ 2005-04-20 14:16 UTC (permalink / raw)
  To: insight

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...

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-20 14:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 14:16 PATCH : Ghost breakpoints elmer.elmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).