From patchwork Fri Feb 7 14:59:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahab Vahedi X-Patchwork-Id: 37735 Received: (qmail 82029 invoked by alias); 7 Feb 2020 15:01:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 81322 invoked by uid 89); 7 Feb 2020 15:00:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=GDBserver, our, HContent-Transfer-Encoding:8bit X-HELO: mail-lf1-f67.google.com Received: from mail-lf1-f67.google.com (HELO mail-lf1-f67.google.com) (209.85.167.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Feb 2020 15:00:48 +0000 Received: by mail-lf1-f67.google.com with SMTP id 203so1699004lfa.12 for ; Fri, 07 Feb 2020 07:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r5HVFpZQXf5h4p/Ei8YishVPhw1jYpHRtYgSjhqRF6o=; b=sXaPvizrzzGRvnpQj+PSSEiaV9uEEPVbBGgghG9QkzuUF5ZbAhfRPrIzsqtl1LXqKr HdDrWNEa+FzjvRPQV7L4TY3B4d+sEn7SlQo8tuZfMBDI8TrH62TV6zGo6mB1SSHpPq3r v9c9sEpxdJ3YUP82Pb1gYPqUusqUwCiyOdB8gxCCO0HbAxqmqL1OE7n747ZPnXYlBDtQ mkks+6yRIvXY3KGOEHzRa+82+B3fjHtWPPkZbDF+1TEJSrgJX7TffX+fXU/ThYyHeMe3 Xt3VigkhjdfBx2PaQb1vBomT3ngX6sN/BroNyMl02CXObyMWFFYjy2quVWmOQgBCWFi+ Es0w== Return-Path: Received: from archie.internal.synopsys.com ([2a03:1b20:6:f011::2d]) by smtp.gmail.com with ESMTPSA id p136sm1184412lfa.8.2020.02.07.07.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:00:41 -0800 (PST) From: Shahab Vahedi To: gdb-patches@sourceware.org Cc: Shahab Vahedi , Shahab Vahedi , Francois Bedard , Anton Kolesov Subject: [PATCH 03/14] gdb/testsuite: Add exit_is_reliable proc Date: Fri, 7 Feb 2020 15:59:52 +0100 Message-Id: <20200207150003.8383-4-shahab.vahedi@gmail.com> In-Reply-To: <20200207150003.8383-1-shahab.vahedi@gmail.com> References: <20200207150003.8383-1-shahab.vahedi@gmail.com> MIME-Version: 1.0 From: Anton Kolesov Add a function that returns 1 if exit is reliable or 0 otherwise. Previously value of "board_info gdb,exit_is_reliable" was used only in one place, in "gdb_continue_to_end", and sensible default value was evaluated at the same location. However there are more places that need to check value of "gdb,exit_is_reliable", so it makes sense to extract it into a separate function that returns a reliable value. gdb/testsuite/ChangeLog: 2016-07-13 Anton Kolesov * lib/gdb.exp (exit_is_reliable): Procedure is added. (gdb_continue_to_end): Refactor to use "exit_is_reliable". Signed-off-by: Anton Kolesov --- gdb/testsuite/lib/gdb.exp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index eb1d145f2bb7..4376e08ca1b2 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3357,6 +3357,16 @@ proc use_gdb_stub {} { return [target_info exists use_gdb_stub] } +# Return 1 if target has a reliable exit() function, 0 - otherwise. + +proc exit_is_reliable {} { + if { [target_info exists exit_is_reliable] } { + return [target_info exit_is_reliable] + } else { + return ![use_gdb_stub] + } +} + # Return 1 if the current remote target is an instance of our GDBserver, 0 # otherwise. Return -1 if there was an error and we can't tell. @@ -5287,13 +5297,7 @@ proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} { # loop, or a forced crash/reset. For native targets, by default, we # assume process exit is reported as such. If a non-reliable target # is used, we set a breakpoint at exit, and continue to that. - if { [target_info exists exit_is_reliable] } { - set exit_is_reliable [target_info exit_is_reliable] - } else { - set exit_is_reliable [expr ! $use_gdb_stub] - } - - if { ! $exit_is_reliable } { + if ![exit_is_reliable] { if {![gdb_breakpoint "exit"]} { return 0 }