From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8EE7B3858032 for ; Tue, 22 Feb 2022 14:08:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8EE7B3858032 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-nkQIzKj3MIasx2M-jg95Tg-1; Tue, 22 Feb 2022 09:08:21 -0500 X-MC-Unique: nkQIzKj3MIasx2M-jg95Tg-1 Received: by mail-wr1-f72.google.com with SMTP id g17-20020adfa591000000b001da86c91c22so9005729wrc.5 for ; Tue, 22 Feb 2022 06:08:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=fagmF0M6k8gMPx8pzp0IDlMe8Lz38wU964YiB/C0Y64=; b=T1oWhssH0zhVYbBXpKW0Kfd6UayoZy4LQbpJFTB5Q63qziq2ZQfkTYLnxHUVHyetTd 7lDz6YA5VdbplUXJa2O23QXr2NrPxhblIj8GxnPGv5eenDWf4nAjO11Kl1Ohf7ys2F3G xiWfMAWsjGafFbWrO5MlPv1qHVlUoS/as3mEaWHeEpzzvF6MGdpbcxrRIbWROS246+yr kRLpkvI8x8Mdol0k1DllsO25oVJvfyrkBrDI1Lzxa6HFoRlHgtrVfo1lOjlRk+UBc9eQ gJjbV4kOA7Vpb5FKhfud65L1hTN3emCMoNJ5b/lABfPAmeIwoNlahO1zgpEmbFafCtxA d7Sw== X-Gm-Message-State: AOAM531UqCF0V8i2Pa5Qgor0P/x1apINcTV8bXtUgh/wQTftvLTJ0MZW k6I2DzO260WlB4DWynujUuvt8RlyalTlmdscy3bNLHJfk3eipJHx5lIXwOmGLYJVC6krUxxmFD4 9coDCdEd7gYdmmTVGzNQmEA== X-Received: by 2002:a7b:c381:0:b0:37b:e01f:c1c0 with SMTP id s1-20020a7bc381000000b0037be01fc1c0mr3516796wmj.98.1645538900538; Tue, 22 Feb 2022 06:08:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoo9WDQnEEwUvzVzdc5r39iEg8LmqIzgIfdSkOBFv+n7yHY4drVRkId7BKS2iaDPa1CC/7eQ== X-Received: by 2002:a7b:c381:0:b0:37b:e01f:c1c0 with SMTP id s1-20020a7bc381000000b0037be01fc1c0mr3516785wmj.98.1645538900357; Tue, 22 Feb 2022 06:08:20 -0800 (PST) Received: from localhost (host86-169-131-29.range86-169.btcentralplus.com. [86.169.131.29]) by smtp.gmail.com with ESMTPSA id f6sm34476502wrv.116.2022.02.22.06.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 06:08:19 -0800 (PST) From: Andrew Burgess To: Muhammad Umair Sair , "gdb-patches\@sourceware.org" Subject: Re: Making mi -add-inferior command consistent with ci In-Reply-To: References: Date: Tue, 22 Feb 2022 14:08:19 +0000 Message-ID: <87pmnfat9o.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2022 14:08:26 -0000 Muhammad Umair Sair via Gdb-patches writes: > From 3729f798d1f75a74eefe0c240d8c4c9849dac308 Mon Sep 17 00:00:00 2001 > From: Umair Sair > Date: Tue, 22 Feb 2022 01:40:06 +0500 > Subject: [PATCH] Making mi -add-inferior command consistent with ci > > With multi-target debugging support in gdb, add-inferior command without > arguments in console interpreter adds a new inferior and sets the connection > of previously selected inferior as the connection of new inferior as well. > But the same command for machine interpreter is not setting the connection > for new inferior. This commit fixes this issue and makes the console and > machine interpreter behavior consistent for add-inferior command. We're usually pretty conservative about changing MI behaviour in non backward compatible ways. I'm not entirely sure that this change wont cause problems for an existing f/e that is using -add-inferior? Maybe I'm worrying about nothing? I'm open to being convinced. Another option would be to add a new option, e.g.: -add-inferior [--connection NUM] or -add-inferior [--inherit-connection] > --- > gdb/ChangeLog | 9 +++++++++ > gdb/inferior.c | 4 ++-- > gdb/inferior.h | 5 ++++- > gdb/mi/mi-main.c | 4 +++- > 4 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index dfee3dad157..1f342cc628f 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,3 +1,12 @@ > +2022-02-22 Umair Sair > + > + * gdb/inferior.c (switch_to_inferior_and_push_target): allowing > + access to this function outside of file. > + * gdb/inferior.h (switch_to_inferior_and_push_target): added extern > + entry for function in header. > + * gdb/mi/mi-main.c (mi_cmd_add_inferior): new inferior should use > + the connection from previously selected inferior. > + We no longer maintain ChangeLog in gdb, so this part is not needed. You're welcome to keep the ChangeLog text in the commit message in _addition_ to the long form description, but this is not a requirement. > 2021-04-23 Tom Tromey > > PR gdb/27743: > diff --git a/gdb/inferior.c b/gdb/inferior.c > index 4fdddbcb55b..16e4279bc1a 100644 > --- a/gdb/inferior.c > +++ b/gdb/inferior.c > @@ -1,6 +1,6 @@ > /* Multi-process control for GDB, the GNU debugger. > > - Copyright (C) 2008-2021 Free Software Foundation, Inc. > + Copyright (C) 2008-2022 Free Software Foundation, Inc. > Not sure what's going on here. The patch shows all the dates changing, but all the files you've changed already have 2022 in the upstream master branch. Thanks, Andrew > This file is part of GDB. > > @@ -740,7 +740,7 @@ add_inferior_with_spaces (void) > NO_CONNECTION is true, push the process_stratum_target of ORG_INF > to NEW_INF. */ > > -static void > +void > switch_to_inferior_and_push_target (inferior *new_inf, > bool no_connection, inferior *org_inf) > { > diff --git a/gdb/inferior.h b/gdb/inferior.h > index fb7d0c2bc1a..d4abd00489a 100644 > --- a/gdb/inferior.h > +++ b/gdb/inferior.h > @@ -1,7 +1,7 @@ > /* Variables that describe the inferior process running under GDB: > Where it is, why it stopped, and how to step it. > > - Copyright (C) 1986-2021 Free Software Foundation, Inc. > + Copyright (C) 1986-2022 Free Software Foundation, Inc. > > This file is part of GDB. > > @@ -686,4 +686,7 @@ extern struct inferior *add_inferior_with_spaces (void); > /* Print the current selected inferior. */ > extern void print_selected_inferior (struct ui_out *uiout); > > +extern void switch_to_inferior_and_push_target (inferior *new_inf, > + bool no_connection, inferior *org_inf); > + > #endif /* !defined (INFERIOR_H) */ > diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c > index e38520a98e6..65c0aa5be0b 100644 > --- a/gdb/mi/mi-main.c > +++ b/gdb/mi/mi-main.c > @@ -1,6 +1,6 @@ > /* MI Command Set. > > - Copyright (C) 2000-2021 Free Software Foundation, Inc. > + Copyright (C) 2000-2022 Free Software Foundation, Inc. > > Contributed by Cygnus Solutions (a Red Hat company). > > @@ -1702,6 +1702,8 @@ mi_cmd_add_inferior (const char *command, char **argv, int argc) > > inf = add_inferior_with_spaces (); > > + switch_to_inferior_and_push_target (inf, false, current_inferior ()); > + > current_uiout->field_fmt ("inferior", "i%d", inf->num); > } > > -- > 2.31.1