From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9254 invoked by alias); 8 Aug 2010 16:43:12 -0000 Received: (qmail 9243 invoked by uid 22791); 8 Aug 2010 16:43:09 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_20,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; Sun, 08 Aug 2010 16:43:03 +0000 Received: (qmail 20664 invoked from network); 8 Aug 2010 16:43:01 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Aug 2010 16:43:01 -0000 From: Pedro Alves To: Kevin Buettner Subject: Re: [RFA] remote-sim.c: Add support for multiple sim instances Date: Sun, 08 Aug 2010 16:43:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.31-11-rt; KDE/4.4.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <20100702153017.4381070b@mesquite.lan> <201008031305.12102.pedro@codesourcery.com> <20100806162043.01c142e2@mesquite.lan> In-Reply-To: <20100806162043.01c142e2@mesquite.lan> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008081742.58022.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-08/txt/msg00098.txt.bz2 On Saturday 07 August 2010 00:20:43, Kevin Buettner wrote: > +static int > +gdbsim_close_inferior (struct inferior *inf, void *arg) > +{ > + struct sim_inferior_data *sim_data = inferior_data (inf, > + sim_inferior_data_key); > + if (sim_data != NULL) > + { > + ptid_t ptid = sim_data->remote_sim_ptid; > + > + sim_inferior_data_cleanup (inf, sim_data); > + set_inferior_data (inf, sim_inferior_data_key, NULL); > + > + inferior_ptid = ptid; Please do "switch_to_thread (ptid)" instead, so that the program space and current inferior globals are kept in sync with inferior_ptid while mourning. > + generic_mourn_inferior (); > + } > + > + return 0; > } > > +static int > +gdbsim_stop_inferior (struct inferior *inf, void *arg) > +{ > + struct sim_inferior_data *sim_data > + = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED); > + > + if (sim_data) > + { > + /* Try to stop the sim. If it can't stop, exit GDB altogether. */ > + if (!sim_stop (sim_data->gdbsim_desc)) > + { > + quit (); > + } > + } > + Calling quit doesn't exit GDB; it throws the same exception ^C usually ends up throwing, cancelling the whole current operation all the way back to the top CLI prompt. (Well, usually. Some places catch all exceptions instead of just RETURN_MASK_ERROR. Other than that, it looked good to me. Thanks! -- Pedro Alves