public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: elmer.elmer@free.fr
To: insight@sources.redhat.com
Subject: PATCH : Ghost breakpoints
Date: Wed, 20 Apr 2005 14:16:00 -0000	[thread overview]
Message-ID: <1114006595.426664435f040@imp6-q.free.fr> (raw)

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

                 reply	other threads:[~2005-04-20 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1114006595.426664435f040@imp6-q.free.fr \
    --to=elmer.elmer@free.fr \
    --cc=insight@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).