This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: [RFA] quit patch
- From: "Martin M. Hunt" <hunt at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: insight at sources dot redhat dot com
- Date: Fri, 26 Apr 2002 13:29:29 -0700 (PDT)
- Subject: Re: [RFA] quit patch
On Fri, 26 Apr 2002, Keith Seitz wrote:
> On Fri, 26 Apr 2002, Martin M. Hunt wrote:
>
> > > Doesn't ManagedWin::shutdown search for all open windows to be reopened
> > > when insight is restarted? Deleting SrcWins, then, won't get added to the
> > > list?
> >
> > Yes they will because shutdown is being called from their destructor, so
> > they are still there.
>
> I don't understand. I don't see any calls to ManagedWin::shutdown in
> SrcWin::destructor (or anywhere else but gdbtk_cleanup).
SrcWin isa ManagedWin. ManagedWin's destructor calls gdb_force_quit
which calls gdbtk_cleanup which calls ManagedWin::shutdown.
> So what happens when the user quits?
How? There are 3 different ways for the user to quit. Clicking the
closebox on the source window calls Srcwin::_exit. Selecting the menu
item "Exit" will do the same thing as Srcwin:_exit with my patch.
Without my patch it will do the same thing as typing "quit" into the
console, which is way to complex to figure out and I spent hours trying
to do so. So this patch is basically a quick fix to make the menu quit
option work like closing the window and not crash Insight when using the
simulator. It does not fix the underlying problem which has been there
for years. All I can tell is that detach_hook() is getting called and
then there are attempts to read registers even though we no longer have a
target and eventually GDB segfaults. You are welcome to give it a shot if
you are bored.
>
> Now when gdbtk_cleanup is called in interface.tcl, we call Session::save,
> set ::gdb_shutting_down, call ManagedWin::shutdown and finally save
> preferences.
Yes.
> ManagedWin::shutdown is called to save off any open windows to the
> active list (so that the can be re-opened next time).
Yes.
> In your scenario, it seems to me that if we close/destroy all the SrcWins
> and then call gdb_force_quite (and gdbtk_cleanup), none of the SrcWins
> will be around when ManagedWin::shutdown runs to figure out which ones to
> reopen.
>
> Am I missing something?
Yes, as I explained above.
> In either case, what happens when the user types "quit" at the console
> prompt? gdbtk_force_quit won't be called then and the same problem arises,
> doesn't it?
Yep, still broken, but no customer demanded a fix, it doesn't crash the
testsuite, and it hasn't bothered anyone enough to fix it yet.
> Ok, I admit it. I'm confused. Please help me understand.
I'm confused too. Spend a while trying to figure out what happens when
you quit Insight from the console and anyone will be.
Again, all my patch does is make the menu item "Exit" do the same thing
as closing the last source window.
body SrcWin::_exit {} {
debug
if {[llength [ManagedWin::find SrcWin]] == 1} {
if {![gdbtk_quit_check]} {
return
}
}
after idle [delete object $this]
}
proc gdbtk_force_quit {} {
foreach win [ManagedWin::find SrcWin] {
delete object $win
}
# not really necessary because closing the source window will
# cause this to happen, but here it is just in case.
gdb_force_quit
}
Martin