From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6416 invoked by alias); 30 Sep 2010 09:11:57 -0000 Received: (qmail 6406 invoked by uid 22791); 30 Sep 2010 09:11:56 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Sep 2010 09:11:52 +0000 Received: (qmail 8523 invoked from network); 30 Sep 2010 09:11:50 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Sep 2010 09:11:50 -0000 From: Pedro Alves To: Jan Kratochvil Subject: Re: [patch] regression: Quit should not ask with core (PR 12071) Date: Thu, 30 Sep 2010 14:02:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <20100929144316.GA16519@host1.dyn.jankratochvil.net> <201009291604.18270.pedro@codesourcery.com> <20100929221138.GA14109@host1.dyn.jankratochvil.net> In-Reply-To: <20100929221138.GA14109@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009301011.48545.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00505.txt.bz2 On Wednesday 29 September 2010 23:11:38, Jan Kratochvil wrote: > On Wed, 29 Sep 2010 17:04:17 +0200, Pedro Alves wrote: > > So, for example, if you have two inferiors in your gdb session, one of them > > is running as a process, while the other is still just a pseudo-inferior > > / file_stratum inferior yet, and you have the latter selected as current, > > your patch will make that have-live-inferiors check still return 0, while > > there _is_ one live inferior. > > Confirming it had this problem. > > No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. Okay, thanks. -- Pedro Alves > > > Thanks, > Jan > > > gdb/ > 2010-09-29 Jan Kratochvil > > * inferior.c (have_live_inferiors): New variables old_chain, inf and > tp. Iterate INFERIOR_LIST and call target_has_execution. > > Gdb/testsuite/ > 2010-09-29 Jan Kratochvil > > * gdb.base/corefile.exp (quit with a process, no question: load core) > (quit with a core file): New tests. > > --- a/gdb/inferior.c > +++ b/gdb/inferior.c > @@ -461,16 +461,29 @@ have_inferiors (void) > int > have_live_inferiors (void) > { > - struct target_ops *t; > + struct cleanup *old_chain; > + struct inferior *inf; > > - /* The check on stratum suffices, as GDB doesn't currently support > - multiple target interfaces. */ > - if (have_inferiors ()) > - for (t = current_target.beneath; t != NULL; t = t->beneath) > - if (t->to_stratum == process_stratum) > - return 1; > + old_chain = make_cleanup_restore_current_thread (); > > - return 0; > + for (inf = inferior_list; inf; inf = inf->next) > + if (inf->pid != 0) > + { > + struct thread_info *tp; > + > + tp = any_thread_of_process (inf->pid); > + if (tp) > + { > + switch_to_thread (tp->ptid); > + > + if (target_has_execution) > + break; > + } > + } > + > + do_cleanups (old_chain); > + > + return inf != NULL; > } > > /* Prune away automatically added program spaces that aren't required > --- a/gdb/testsuite/gdb.base/corefile.exp > +++ b/gdb/testsuite/gdb.base/corefile.exp > @@ -201,8 +201,33 @@ gdb_test_multiple "info files" $test { > } > } > > +set test "quit with a process" > +gdb_test_multiple "quit" $test { > + -re "A debugging session is active.\r\n.*\r\nQuit anyway\\? \\(y or n\\) $" { > + pass $test > + gdb_test "n" {Not confirmed\.} "quit with processes: n" > + } > +} > + > gdb_exit > > +# Verify there is no question if only a core file is loaded. > + > +gdb_start > +gdb_test "core-file $corefile" "Core was generated by .*" "no question: load core" > + > +set test "quit with a core file" > +gdb_test_multiple "quit" $test { > + -re "A debugging session is active.\r\n.*\r\nQuit anyway\\? \\(y or n\\) $" { > + fail $test > + gdb_test "n" {Not confirmed\.} "quit with processes: n" > + } > + eof { > + pass $test > + } > +} > + > +gdb_exit > > # Test an attach command will clear any loaded core file. > >