From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) by sourceware.org (Postfix) with ESMTPS id 398473850428 for ; Thu, 27 Jan 2022 14:50:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 398473850428 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yj1qJmDxSRbYHOkKxoVIIXWmvdUTWta0IR5NgUTyqUumFoR40RF8NCbY0da5DxDclDcFbGw76h58kbyIdCQoA0ox5Cl6IJ1wBmGTMXiH2RVuob4QPVQw2ljmHgG4W7AIfI2JF5sb0DNdIT8CBmH7LbDT/Ut1QeQ4N68B5QQ04JUV+lSnOvsltCqWnI/WfyAXsxPmPzM5gHJZ/OfuiIGW4qrFZru2TdxBiVwH6Eq7Bo4kNS3TByYfqjljfPMNaJUuszeb/lza5BwUfcR+5WbIhIHgm6spc9QuAZ+OzTxGyWufCX6mu6prc8lCjsNcckxC7k7ri+W75ZGc62pFubT6lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tOEPGLoMiYxepTRDT8U42ABv2eH5NxVYHkRoUij0oYk=; b=MG5RejayH6CdOQ2HyNdhs1fU1nw9OT80ao/91UtlKYdE3fmBJSNxsgRmpZ0VHeZwAYPun6iVYThjoupkM5E80HWGH7Pyek+Fa4/R280VIVzJc0VQHidpKH6ALvblDTkcYPQHME5VQZOvFapkhPuJEaC0+GyFjZ1KLmPzqwlpug0qWjKTJ7uTr1Z0zJUVwzOyz54TcF9NkO91r0aCda9mKlTejYxC1LL6/WaA+tALZBicHJSpI9ZEIwGZEIB+8pV0e4GCn+5BXCso0MJTjK/kLVEE//BEQdJ1j2uFlV1QsOjdlKXk4biq2deCHajDBk74RI74EbTXJREYfVCKaSSfvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR17MB3113.namprd17.prod.outlook.com (2603:10b6:5:6::10) by CH2PR17MB3926.namprd17.prod.outlook.com (2603:10b6:610:84::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.17; Thu, 27 Jan 2022 14:50:26 +0000 Received: from DM6PR17MB3113.namprd17.prod.outlook.com ([fe80::f544:fbc7:cdfb:3017]) by DM6PR17MB3113.namprd17.prod.outlook.com ([fe80::f544:fbc7:cdfb:3017%6]) with mapi id 15.20.4930.017; Thu, 27 Jan 2022 14:50:25 +0000 From: Jan Vrany To: gdb-patches@sourceware.org Cc: Jan Vrany Subject: [PATCH v3 1/1] gdb/mi: PR20684, preserve user selected thread and frame when invoking MI commands Date: Thu, 27 Jan 2022 14:50:11 +0000 Message-Id: <20220127145011.1153142-2-jan.vrany@labware.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <74e5b388-9f7a-dd0a-befe-3b069fba54b7@polymtl.ca> References: <74e5b388-9f7a-dd0a-befe-3b069fba54b7@polymtl.ca> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO2P265CA0208.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::28) To DM6PR17MB3113.namprd17.prod.outlook.com (2603:10b6:5:6::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d367dcd9-d25c-4b47-7d7c-08d9e1a45a61 X-MS-TrafficTypeDiagnostic: CH2PR17MB3926:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WBS7nUGHcaZDthl0xYBcOCNdQORl/AVue2Fp1Jw/FjfkRl0M2cK/+phVSz3jahc8nOw9ELMlG0MV+va8CL24JeOgpbx6+eo3SF8LyXhfrP40o6JRwctOgkBddcSOU2unqUdkbgdto9EjwCgBpC2vxCw7AJ3bd/4NY25MjCLlMo6YD5fVBUaSzT/Tdz8LbvM8zMEDAU3gug+hTnL9urNQeyWT0VUd3lexrDITdR74QsTPiJWg/rT5cENLQmDsA7VagSSP/GW+VExNM1JWonz+6qHd46i2bwTpZlsdqGDvlK0qXYUal9tlKHqJaWlXCKkXHQB5QHuVhza12tuRhnp2PTeFM3mmdOKVoFzxox4JC6+h8XfLpncGoV8k4LTttRcCTQK1dYLL7WoNaRk4PGjg8Fl7EtVCam1F5CvhqzNYRBVL4bvzN/rv5q16y8vm2ymFpMwkxKCgwsovPAQCvTFYbJL+UhH9qjtQHnTv6RTvqAUyjMlar/iDRm/esAd7x9gIEYoEPHLLWg0MvvO9wu7OGgasQ++eoZsp/IxcW3fatCMf5gAotvttvFuEUqHrkEfja5krtBLeUzcFlnDQfw8rqSwjOv8ZIBHI9FMtVJ4IY7epLNSBe6vWPoEkoH+oaPCnT/HXKJcoe16zBL6+JXorzskIkssLICeP97kZlJEOQZdUl1WWv8d5q/X/3u+kcsAhoAzkx3+wuHVY+FDrFc8SA1j4Ww1NyKEuCtvVgVOt2GMyGeMMz1vOqE8xMwm3n9Yxd9yZxjyVx4ar72RfWXBkZ9jIHA3ATuPAFzw3rnEzlvA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR17MB3113.namprd17.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(66476007)(186003)(1076003)(26005)(83380400001)(6916009)(316002)(8936002)(38100700002)(38350700002)(4326008)(8676002)(66556008)(66946007)(107886003)(2906002)(5660300002)(86362001)(36756003)(30864003)(6486002)(508600001)(966005)(6512007)(52116002)(6666004)(2616005)(6506007)(44832011)(2004002)(20210929001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vIhKjNBqlop+//KDBUaZ/keNXwYJbbcRD1XPq7PkAnYgjYji5AEkZnaZn9TO?= =?us-ascii?Q?5Ko8HEnkAzNRE4TPBLgInINBEezqpFEYB+Jm2Lfc7d+UUByuR6Aa5ecHDsuJ?= =?us-ascii?Q?FMZWCE/rV6yxAZ6PqGLbYT8Bsb7pjb++u9L9CigbCMGu3QJrTNbGSaCXVQTu?= =?us-ascii?Q?AckW8o5oEw4zKx5nqdpEGhwhmwN9X02shHqxZJ1zGGjezfcRRaQjTe2/+4C8?= =?us-ascii?Q?tfBAl7zldcasq6yj5ypjUpPB/DUKUB3zYlzCD0ojFGX4sXzTdHhTyjD/NX0y?= =?us-ascii?Q?RHWylEIFhlVa0qwhzFFTRShjVNBg+lwZIsGsKQB6AkpnxLw0FdEPmsPZxwXS?= =?us-ascii?Q?5uys2ysSrA1JOiGwJb+QpDBb5m/67yYBaPv/31tLDHoboQpfsSLRWQxh3/d9?= =?us-ascii?Q?sfvwtr7Kx/xjFBSDkznSkap6DcgIbOKYi22iBK/MSJxdREM+RpQY/dxRDyuP?= =?us-ascii?Q?w5Y89YRcDV6gg78S7+i0DA0jqbgJls9VUYTA1hV9kbKa3EBQae03nAk15QP7?= =?us-ascii?Q?1Fob2llF5U677yMqlMkt5n5vpY8mGjAs2UonBezvSMvdKV1ru/nvgTzQAJFE?= =?us-ascii?Q?PDrWjoVS+fMBboXSIXTcUlmC/u0vJguto4dombMMQcn0pQwlYSTTmxCx1Grr?= =?us-ascii?Q?Vj4Z7fxbF9vMhD8FMgQIs21qUTqKrf+49sSbKLUvDeWrrSO1bt1oW8ixEaBY?= =?us-ascii?Q?RdH5mw4yEu2xp3Eir+uy4LyHpNlkBtkXfaZmIBa4CliUT3LEr+/Dfjsp8Faz?= =?us-ascii?Q?MG2PzLPaDGr/IGhdL5KTsF1k53NMtJdNG6Ygx7ZpA/cxkq8HlTr82oUZaPQ6?= =?us-ascii?Q?0Gx0xe7sdycH5fKLFmIBY/IGTlZq3HFAPusNJzZL+Ry+/LQiruFwksivyQ/o?= =?us-ascii?Q?aOQLrLbB6TefSJfYcP6w0mfPi0igraqxM4ASPEHpi/b+HFnVa+tD9HR1d2pA?= =?us-ascii?Q?GihT18xta68Csr05tXJ+LcLxx+AxZZvhqms2470g1H4TOfYVnzwwhu9Vdxvf?= =?us-ascii?Q?WyNkzX/pexfB6WIW8x9wTyvnwQ/ACNdpcF4AxJEd0V4yCIIQZwtLQbhs6v+t?= =?us-ascii?Q?x6p6vJO0A5tMJi1U18Z69qvZ04m7d/qlvQ4QbJkQTpnm9ev9CHL6fapGBRBW?= =?us-ascii?Q?z1aWVTf2FxjuAHi94mImj01MZ0N1LAZVTAPwDtvS6lUeOePFCDjnr8xEsZ/l?= =?us-ascii?Q?iU/AhpoM2EIGTVNh9cXZXRqfzTarkzjSy6VbzK0nnlITwhbVikEghcvxzMCJ?= =?us-ascii?Q?u2yOXzVe/z6LAKjzE2Eh/ouYVAknxHWw++7DorAnp47Hrgrml2FFJnSihPhB?= =?us-ascii?Q?wGUGpykfqhFcPwown2/96dFiMwvU3F8IYcuHuXYbEhUsMKswzNLH1oXuGxOo?= =?us-ascii?Q?qoBcvRucWH6wuChQ2WDSQwT9SKQ7MYKBw0mxXxqL0riMgHrvIFWt8JtZBx9A?= =?us-ascii?Q?svGEl5VC5LWrCQze0B6xC/XexngaZ3ST90K19BbQJ0KSqMixsNhiOWCb2EAj?= =?us-ascii?Q?kUaXnmqAifTtX98AskYCvswHuJPAj/+qLe1Q/BzMENcNt/bwJmvZA4EEvXOU?= =?us-ascii?Q?rOSJBuBEA5FuGKZyuiw8jkziFuXbREcuqvibif7EklBZ69k91yjlF8kTDM0m?= =?us-ascii?Q?qnwF4alJbG3an2I+Rf1piJY=3D?= X-OriginatorOrg: labware.com X-MS-Exchange-CrossTenant-Network-Message-Id: d367dcd9-d25c-4b47-7d7c-08d9e1a45a61 X-MS-Exchange-CrossTenant-AuthSource: DM6PR17MB3113.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2022 14:50:25.8735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b5db0322-1aa0-4c0a-859c-ad0f96966f4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZTa3fvILyCZWkfSgpj3pRs9pO1je/cjGSj4HYLLS6V7wHURi1VND/4AyuqZf/GYCxsbNljqbrkXDOLVatpnQUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR17MB3926 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: Thu, 27 Jan 2022 14:50:29 -0000 When invoking MI commands with --thread and/or --frame, user selected thread and frame was not preserved: (gdb) info thread &"info thread\n" ~" Id Target Id Frame \n" ~"* 1 Thread 0x7ffff7c30740 (LWP 19302) \"user-selected-c\" main () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60\n" ~" 2 Thread 0x7ffff7c2f700 (LWP 19306) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n" ~" 3 Thread 0x7ffff742e700 (LWP 19307) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n" ^done (gdb) info frame &"info frame\n" ~"Stack level 0, frame at 0x7fffffffdf90:\n" ~" rip = 0x555555555207 in main (/home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60); saved rip = 0x7ffff7c5709b\n" ~" source language c.\n" ~" Arglist at 0x7fffffffdf80, args: \n" ~" Locals at 0x7fffffffdf80, Previous frame's sp is 0x7fffffffdf90\n" ~" Saved registers:\n " ~" rbp at 0x7fffffffdf80, rip at 0x7fffffffdf88\n" ^done (gdb) -stack-info-depth --thread 3 ^done,depth="4" (gdb) info thread &"info thread\n" ~" Id Target Id Frame \n" ~" 1 Thread 0x7ffff7c30740 (LWP 19302) \"user-selected-c\" main () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:60\n" ~" 2 Thread 0x7ffff7c2f700 (LWP 19306) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n" ~"* 3 Thread 0x7ffff742e700 (LWP 19307) \"user-selected-c\" child_sub_function () at /home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30\n" ^done (gdb) info frame &"info frame\n" ~"Stack level 0, frame at 0x7ffff742dee0:\n" ~" rip = 0x555555555169 in child_sub_function (/home/uuu/gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:30); saved rip = 0x555555555188\n" ~" called by frame at 0x7ffff742df00\n" ~" source language c.\n" ~" Arglist at 0x7ffff742ded0, args: \n" ~" Locals at 0x7ffff742ded0, Previous frame's sp is 0x7ffff742dee0\n" ~" Saved registers:\n " ~" rbp at 0x7ffff742ded0, rip at 0x7ffff742ded8\n" ^done (gdb) This was problematic for frontends that provide access to CLI because UI may silently change the context for CLI commands (as demonstrated above). Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20684 --- gdb/mi/mi-cmds.h | 12 ++ gdb/mi/mi-main.c | 54 ++++--- gdb/testsuite/gdb.mi/mi-cmd-user-context.exp | 155 +++++++++++++++++++ 3 files changed, 198 insertions(+), 23 deletions(-) create mode 100644 gdb/testsuite/gdb.mi/mi-cmd-user-context.exp diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 2a93a9f5476..785652ee1c9 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -23,6 +23,7 @@ #define MI_MI_CMDS_H #include "gdbsupport/gdb_optional.h" +#include "mi/mi-main.h" enum print_values { PRINT_NO_VALUES, @@ -163,6 +164,17 @@ struct mi_command wrong. */ void invoke (struct mi_parse *parse) const; + /* Return whether this command preserves user selected context (thread + and frame). */ + bool preserve_user_selected_context () const + { + /* Here we exploit the fact that if MI command is supposed to change + user context, then it should not emit change notifications. Therefore if + command does not suppress user context change notifications, then it should + preserve the context. */ + return m_suppress_notification != &mi_suppress_notification.user_selected_context; + } + protected: /* The core of command invocation, this needs to be overridden in each diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 4860da7536a..e112707e4d1 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1907,6 +1907,16 @@ command_notifies_uscc_observer (struct mi_parse *command) } } +/* Determine whether the thread has changed. */ + +static bool +command_changed_user_selected_thread (ptid_t previous_ptid, ptid_t current_ptid) +{ + return previous_ptid != null_ptid + && current_ptid != previous_ptid + && current_ptid != null_ptid; +} + void mi_execute_command (const char *cmd, int from_tty) { @@ -1971,28 +1981,17 @@ mi_execute_command (const char *cmd, int from_tty) && any_thread_p () /* If the command already reports the thread change, no need to do it again. */ - && !command_notifies_uscc_observer (command.get ())) + && !command_notifies_uscc_observer (command.get ()) + /* Don't report anything if --thread was specified -- the user selected + thread is preserved by mi_execute_command and therefore cannot + change. */ + && command->thread == -1 + /* Don't report anything if the selected thread actually did not change + (compared to selected thread before execution the command). */ + && command_changed_user_selected_thread (previous_ptid, inferior_ptid)) { - int report_change = 0; - - if (command->thread == -1) - { - report_change = (previous_ptid != null_ptid - && inferior_ptid != previous_ptid - && inferior_ptid != null_ptid); - } - else if (inferior_ptid != null_ptid) - { - struct thread_info *ti = inferior_thread (); - - report_change = (ti->global_num != command->thread); - } - - if (report_change) - { - gdb::observers::user_selected_context_changed.notify - (USER_SELECTED_THREAD | USER_SELECTED_FRAME); - } + gdb::observers::user_selected_context_changed.notify + (USER_SELECTED_THREAD | USER_SELECTED_FRAME); } } } @@ -2037,6 +2036,7 @@ mi_cmd_execute (struct mi_parse *parse) set_current_program_space (inf->pspace); } + gdb::optional thread_saver; if (parse->thread != -1) { thread_info *tp = find_thread_global_id (parse->thread); @@ -2047,9 +2047,13 @@ mi_cmd_execute (struct mi_parse *parse) if (tp->state == THREAD_EXITED) error (_("Thread id: %d has terminated"), parse->thread); + if (parse->cmd->preserve_user_selected_context ()) + thread_saver.emplace (); + switch_to_thread (tp); } + gdb::optional frame_saver; if (parse->frame != -1) { struct frame_info *fid; @@ -2057,8 +2061,12 @@ mi_cmd_execute (struct mi_parse *parse) fid = find_relative_frame (get_current_frame (), &frame); if (frame == 0) - /* find_relative_frame was successful */ - select_frame (fid); + { + if (parse->cmd->preserve_user_selected_context ()) + frame_saver.emplace (); + + select_frame (fid); + } else error (_("Invalid frame id: %d"), frame); } diff --git a/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp new file mode 100644 index 00000000000..a373dd3a4b0 --- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-cmd-user-context.exp @@ -0,0 +1,155 @@ +# Copyright 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test that GDB/MI commands preserve user selected context when +# passed --thread and/or --frame. + +load_lib mi-support.exp + +standard_testfile user-selected-context-sync.c + +if {[build_executable $testfile.exp $testfile ${srcfile} "debug pthreads"] == -1} { + untested "failed to compile" + return -1 +} + +set main_break_line [gdb_get_line_number "main break line"] + +set any "\[^\r\n\]*" +set nl "\[\r\n\]" + +mi_clean_restart $binfile +mi_create_breakpoint "$srcfile:$main_break_line" "set breakpoint in main" +mi_run_cmd +mi_expect_stop "breakpoint-hit" "main" "" $srcfile $main_break_line \ + { "" "disp=\"keep\"" } "run to breakpoint in main" + +mi_gdb_test "thread" \ + ".*Current thread is 1.*" \ + "info thread 1" + +#========================= + +mi_gdb_test "-stack-info-depth --thread 3" \ + "\\^done,depth=.*" \ + "-stack-info-depth --thread 3" + +mi_gdb_test "thread" \ + ".*Current thread is 1.*" \ + "info thread 2" + +#========================= + +mi_gdb_test "-thread-select 3" \ + "\\^done,.*" \ + "-thread-select 3" + +mi_gdb_test "thread" \ + ".*Current thread is 3.*" \ + "info thread 3" + +#========================= + +mi_gdb_test "-thread-select --thread 2 1" \ + "\\^done,.*" \ + "-thread-select --thread 2 1" + +mi_gdb_test "thread" \ + ".*Current thread is 1.*" \ + "info thread 4" + +#========================= + +mi_gdb_test "-thread-select --thread 2 2" \ + "\\^done,.*" \ + "-thread-select --thread 2 2" + +mi_gdb_test "thread" \ + ".*Current thread is 2.*" \ + "info thread 5" + +#========================= + +mi_gdb_test "frame" \ + ".*#0 0x.*" \ + "frame 1" + +mi_gdb_test "-stack-info-frame --thread 2 --frame 1" \ + "\\^done,frame=\{level=\"1\".*" \ + "-stack-info-frame 1" + +mi_gdb_test "thread" \ + ".*Current thread is 2.*" \ + "info thread 6" + +mi_gdb_test "frame" \ + ".*#0 0x.*" \ + "frame 2" + +#========================= + +mi_gdb_test "-stack-info-frame --thread 3 --frame 1" \ + "\\^done,frame=\{level=\"1\".*" \ + "-stack-info-frame 2" + +mi_gdb_test "thread" \ + ".*Current thread is 2.*" \ + "info thread 7" + +mi_gdb_test "frame" \ + ".*#0 0x.*" \ + "frame 3" + +#========================= + +mi_gdb_test "-stack-select-frame --thread 2 --frame 0 1" \ + "\\^done" \ + "--stack-select-frame 1" + +mi_gdb_test "thread" \ + ".*Current thread is 2.*" \ + "info thread 8" + +mi_gdb_test "frame" \ + ".*#1 0x.*" \ + "frame 4" + +#========================= + +mi_gdb_test "-stack-select-frame --thread 2 --frame 2 2" \ + "\\^done" \ + "--stack-select-frame 2" + +mi_gdb_test "thread" \ + ".*Current thread is 2.*" \ + "info thread 9" + +mi_gdb_test "frame" \ + ".*#2 0x.*" \ + "frame 5" + +#========================= + +mi_gdb_test "-stack-select-frame --thread 1 --frame 0 0" \ + "\\^done" \ + "--stack-select-frame 3" + +mi_gdb_test "thread" \ + ".*Current thread is 1.*" \ + "info thread 10" + +mi_gdb_test "frame" \ + ".*#0 main.*" \ + "frame 6" -- 2.30.2