From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 30E2F3938C1D for ; Thu, 11 Jun 2020 16:56:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 30E2F3938C1D Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-GB3uCXkDNhuzEtJ0AE0cew-1; Thu, 11 Jun 2020 12:56:12 -0400 X-MC-Unique: GB3uCXkDNhuzEtJ0AE0cew-1 Received: by mail-wr1-f69.google.com with SMTP id z10so2802131wrs.2 for ; Thu, 11 Jun 2020 09:56:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2/9/c5uHkpITVrukim/rceQgHHgL1p8re6rUMMH6Zdk=; b=jC+zhEHidH2kUu768iZsfzJfjDWjbYw6Pg6+3DPAiCYe9e4CK25zKeJGDmpk1C1hQn +xAhmDenENMSrDvUTYy/NsVAvFSB4HE9hRdOqdq1RN3ZPWgPXBxq3MFQD+H+pzRCTlll YdOkxQh5s68cM38AT07w2dOL4QdFHYxxLAhT1yoA5QjGZfn7iuTZf9Lw6Vr61FQyyzbb 0ePY3DMI08VK+WYLPlIsZTNgDMLxF2JJ1YVdBw1KQtenLLrdWnITlIYRTlgBqlHo5o1G r6DVxbuwI1wujDoR8iparQ36q/CC5umQaO49ml/+ruT0+X/2WawVmu9Qn7mnkLNitpHm QCWw== X-Gm-Message-State: AOAM532y/KyEC2bPJArmZ9/lLpPxXMfcmX7Az4tVCpjnJOp6TgOzL5uG wzR2uqQkXOMJySlJeTFa+cXjV9kOe1d5/jWOmNEEk2QFWIXBefnsxZ9DJdR6QB8uFxBVE4v/7we rN+SzgSumJCRqqGoa0tYWQg== X-Received: by 2002:adf:b348:: with SMTP id k8mr11433875wrd.157.1591894570732; Thu, 11 Jun 2020 09:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSCfKpqRTysgqctvs2RIL/OlpWAKuYdtr6XISPJeRuTR/w+7Yd/vZWPF08AKE9LjvCUMwaug== X-Received: by 2002:adf:b348:: with SMTP id k8mr11433854wrd.157.1591894570459; Thu, 11 Jun 2020 09:56:10 -0700 (PDT) Received: from ?IPv6:2001:8a0:f922:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f922:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id r5sm5720586wrq.0.2020.06.11.09.56.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Jun 2020 09:56:09 -0700 (PDT) Subject: Re: [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case To: Tom de Vries , gdb-patches@sourceware.org References: <20200611143522.GA19667@delia> <7d7ce523-b58c-a77d-15be-8091feb6389a@redhat.com> <18e36963-4f04-f871-33fb-89a5d1683bbd@suse.de> From: Pedro Alves Message-ID: Date: Thu, 11 Jun 2020 17:56:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <18e36963-4f04-f871-33fb-89a5d1683bbd@suse.de> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 11 Jun 2020 16:56:15 -0000 On 6/11/20 5:25 PM, Tom de Vries wrote: > On 11-06-2020 17:31, Pedro Alves wrote: >> I'd think it would be cleaner to override unknown in gdb_init, >> and restore in gdb_finish. No need for filename matching that way. >> Like below. Any reason you didn't go for this instead? >> > I don't think it's cleaner, because we run default_gdb_init, as well the > bit of proc runtest between ${tool}_init a ${tool}_finish with the > altered ::unknown. Well, that is code that is exercised by all testscases, it's part of the framework. It's not going to ever contain calls to procedures that don't exist that go unnoticed for long. The whole testsuite would collapse. We can move the overriding until after default_gdb_init is called, even, so that even less code runs under gdb's "unknown": set res [default_gdb_init $test_file_name] # Skip dejagnu_unknown while running a testcase to prevent it from # exiting and aborting the entire test run. Save the unknown proc # defined by DejaGnu, and override the unknown proc with a # gdb-local version. rename ::unknown ::dejagnu_unknown proc unknown { args } { return [uplevel 1 ::tcl_unknown $args] } return $res } > Alternatively, we could override source to detect the precise point that > runtest hands control to the test-case, as attached. But there's still > filename matching. [ Note btw, that this approach changes the scope of > the fix slightly. ] Overriding standard procs and filename matching strikes me as uglier than using the hooks that dejagnu provides (init/finish), but I can also see your point of only overriding unknown for the exact duration of the sourced file being cleaner. Thus, I'm not objecting and leave it up to you. I agree that it's nice that we don't abort the whole testsuite. BTW, isn't "tcl_unknown" an internal DejaGnu name? We should document that in a comment, since this could break if DejaGnu changes the renamed proc's name. Another reason to ask DejaGnu to handle this for us cleanly. Thanks, Pedro Alves