From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15494 invoked by alias); 13 Apr 2011 14:50:10 -0000 Received: (qmail 15482 invoked by uid 22791); 13 Apr 2011 14:50:08 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Apr 2011 14:50:00 +0000 Received: by vxk20 with SMTP id 20so686516vxk.0 for ; Wed, 13 Apr 2011 07:49:59 -0700 (PDT) Received: by 10.52.111.41 with SMTP id if9mr104871vdb.54.1302706199406; Wed, 13 Apr 2011 07:49:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.175.197 with HTTP; Wed, 13 Apr 2011 07:49:39 -0700 (PDT) In-Reply-To: References: From: Kevin Pouget Date: Wed, 13 Apr 2011 14:50:00 -0000 Message-ID: Subject: Re: Follow-fork-mode and inferiors To: Tom Tromey Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00046.txt.bz2 oh, I didn't now this `follow-exec-mode' setting, which explains why we might want to create a new inferior but (as the name suggests) it's not involved when the inferior forks, and GDB behaves as if it were set to 'new'. Unfortunately, `follow-fork-mode' is already used to follow the child or the parent ... Kevin -- (gdb) help set follow-exec-mode Set debugger response to a program call of exec. An exec call replaces the program image of a process. follow-exec-mode can be: new - the debugger creates a new inferior and rebinds the process to this new inferior. The program the process was running before the exec call can be restarted afterwards by restarting the original inferior. same - the debugger keeps the process bound to the same inferior. The new executable image replaces the previous executable loaded in the inferior. Restarting the inferior after the exec call restarts the executable the process was running after the exec call. By default, the debugger will use the same inferior. (gdb) help set follow-fork-mode Set debugger response to a program call of fork or vfork. A fork or vfork creates a new process. follow-fork-mode can be: parent - the original process is debugged after a fork child - the new process is debugged after a fork The unfollowed process will continue to run. By default, the debugger will follow the parent process. On Wed, Apr 13, 2011 at 10:29 AM, Tom Tromey wrote: >>>>>> "Kevin" == Kevin Pouget writes: > > Kevin> why are there two inferiors? I expected either to stay in inf 1 > Kevin> (if the pid of an inferior can change) or inf 1 to disappear, but > Kevin> not to keep both of them! > > I suspect that it may be due to your `follow-exec-mode' setting. > I am not really certain though. > > Tom >