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.133.124]) by sourceware.org (Postfix) with ESMTPS id 5D1A43858D28 for ; Fri, 29 Apr 2022 18:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5D1A43858D28 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-546-SWsdv4m-M7yFba7CXRA9TA-1; Fri, 29 Apr 2022 14:15:36 -0400 X-MC-Unique: SWsdv4m-M7yFba7CXRA9TA-1 Received: by mail-ed1-f71.google.com with SMTP id r26-20020a50aada000000b00425afa72622so4874782edc.19 for ; Fri, 29 Apr 2022 11:15:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r2mPqZ2my2O1Dw8wRZ2CbnjSHBqGmBwL1uQyrXLEKno=; b=rE8Fp5mBw0UthJGBDm0D7VAmvnIuJctzQUCN3vysdN3DlPxHz/pi9F1Pv3shdhIRzJ AVhnO6c5ovMicTcRa72i9tbNOkQ3tolSB1KCVJrMvBsORrguRaNaKQLXuo3S7nmkEDeA 6rcWmJYTMlGsEKgafZVd23jdabB3Gh4jQiskMXr5N9fu0mytvQKnMdhuCjf0r6VkWMRd 5gS+RyCBSLfFtFuT9YBIM/5FVusCcGL97JcjZcp4d/01oP1JhYV1WQdY1H9j6WZycj63 s4oXMsIfXKtabYxb4nmbSFWMXQfk2phrM5bGIke3CTcypDoFjhUPaPBAtp4WOtYZf91D FDtg== X-Gm-Message-State: AOAM533cw4HL0OClr4E3QugqosfV0rni8XbGukdyXw+gEPTJaPX5ZSXM HIWi7JZY1QFtN4kzLtXDW/HoVVxKChbvrrVogdps5AZU6+JtUfiz2OS/aKuxENKSLPQTymScDwA 8Py7KFDXyvh2eul4hFwn26VIwwBoKy96pEKCPiXF1zq9UN+vuVGGxpdbTQ9DahqZ5+EbdMjGwCw == X-Received: by 2002:a05:6402:484:b0:415:d931:cb2f with SMTP id k4-20020a056402048400b00415d931cb2fmr484844edv.287.1651256135319; Fri, 29 Apr 2022 11:15:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGSizUZfH3p1bSgQPmcALFhAIHm5GT3hnEnApRjov683ashgBil4brUBWZLRqomsXLZw81Gg== X-Received: by 2002:a05:6402:484:b0:415:d931:cb2f with SMTP id k4-20020a056402048400b00415d931cb2fmr484822edv.287.1651256135079; Fri, 29 Apr 2022 11:15:35 -0700 (PDT) Received: from localhost (host81-136-113-48.range81-136.btcentralplus.com. [81.136.113.48]) by smtp.gmail.com with ESMTPSA id h10-20020a1709070b0a00b006f3ef214daasm858454ejl.16.2022.04.29.11.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 11:15:34 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 1/3] gdb/testsuite: fix mi-exec-run.exp with native-extended-gdbserver board Date: Fri, 29 Apr 2022 19:15:29 +0100 Message-Id: <9ed4da88e2dce89ca7893aa4b8970fadba961508.1651255998.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.4 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, SPF_HELO_NONE, SPF_NONE, 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: Fri, 29 Apr 2022 18:15:40 -0000 When running with the native-extended-gdbserver board, I currently see one failure in gdb.mi/mi-exec-run.exp: FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=0: breakpoint hit reported on console (timeout) In this test the MI interface should be started in a separate tty, which means we should have a CLI tty and an MI tty, however, this is not happening. Instead GDB is just started in MI mode and there is no CLI tty. The test script tries to switch between the CLI an MI terminals and look for some expected output on each, however, as there is no CLI terminal the expected output never arrives, and the test times out. It turns out that this is not a GDB problem, rather, this is an issue with argument passing within the test script. The proc default_mi_gdb_start expects to take a set of flags (strings) as arguments, each of flag is expected to be a separate argument. The default_mi_gdb_start proc collects all its arguments into a list using the special 'args' parameter name, and then iterates over this list to see which flags were passed. In mi_gdb_start, which forwards to default_mi_gdb_start, the arguments are also gathered into the 'args' parameter list, but are then expanded back to be separate arguments using the eval trick, i.e.: proc mi_gdb_start { args } { return [eval default_mi_gdb_start $args] } This ensures that when we arrive in default_mi_gdb_start each flag is a separate argument, rather than appearing as a single list containing all arguments. When using the native-extended-gdbserver board however, the file boards/native-extended-gdbserver.exp is loaded, and this file replaces the default mi_gdb_start with its own version. This new mi_gdb_start also gathers the arguments into an 'args' list, but forgets to expand the arguments out using the eval trick. As a result, when using the native-extended-gdbserver board, by the time we get to default_mi_gdb_start, we end up with the args list containing a single item, which is a list containing all the arguments the user passed. What this means is that if the user passes two arguments, then, in default_mi_gdb_start, instead of seeing two separate arguments, we see a single argument made by concatenating the two arguments together. The only place this is a problem is in the test mi-exec-run.exp, which (as far as I can see) is the only test where we might try to pass both arguments at the same time. Currently we think we passed both arguments to mi_gdb_start, but mi_gdb_start behaves as if no arguments were passed. This commit fixes the problem by making use of the eval trick within the native-extended-gdbserver version of mi_gdb_start. After this, the FAIL listed at the top of this message is resolved. --- gdb/testsuite/boards/native-extended-gdbserver.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp index b925c364993..67acc6fea7c 100644 --- a/gdb/testsuite/boards/native-extended-gdbserver.exp +++ b/gdb/testsuite/boards/native-extended-gdbserver.exp @@ -58,7 +58,7 @@ proc mi_gdb_start { args } { global gdbserver_reconnect_p # Spawn GDB. - set res [extended_gdbserver_mi_gdb_start $args] + set res [eval extended_gdbserver_mi_gdb_start $args] if { $res } { return $res } -- 2.25.4