From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33979 invoked by alias); 11 Aug 2016 15:22:40 -0000 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 Received: (qmail 33956 invoked by uid 89); 11 Aug 2016 15:22:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1600, simplest X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Aug 2016 15:22:30 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4241C030701; Thu, 11 Aug 2016 15:22:28 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7BFMRGB026418; Thu, 11 Aug 2016 11:22:28 -0400 Subject: Re: multiple live inferiors To: "taylor, david" , "gdb@sourceware.org" References: <63F1AEE13FAE864586D589C671A6E18B06CA71@MX203CL03.corp.emc.com> From: Pedro Alves Message-ID: Date: Thu, 11 Aug 2016 15:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <63F1AEE13FAE864586D589C671A6E18B06CA71@MX203CL03.corp.emc.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-08/txt/msg00019.txt.bz2 On 08/11/2016 03:56 PM, taylor, david wrote: > Currently GDB supports having multiple non-live inferiors. But, if I try to > add a second live inferior it wants to kill the current live inferior. By "non-live", I assume you mean file_stratum inferiors (executable files, etc.). GDB does not support having multiple core dump inferiors loaded. gdb _does_ however support having multiple live inferiors. It works as long as they're all behind the same target connection. E.g., multiple inferiors with the native target. Or multiple inferiors against gdbserver. The simplest to get them is to enable following forks, with "set detach-on-fork off". You're trying to add a second target connection, which is a bit orthogonal. > > That is, I can do: > > gdb some-file.elf > set non-stop on > set target-async on > target extended-remote | program with some arguments "program" here will be the server. > add-inferior -exec new-file.elf > info inferiors > inferior 2 > target extended-remote | program with different arguments > So here replace the second "target extended-remote" with "attach" or "run" to start the new inferior under control of the first server. > at which point GDB will say: > > A program is being debugged already. Kill it? (y or n) > > I'd be okay with the question if the current inferior was live. But, it is just an executable. > > I assume that there's more to changing this than just modifying target_preopen. > What else is likely to break or need modification? See here: https://sourceware.org/gdb/wiki/MultiTarget Thanks, Pedro Alves