From patchwork Tue Apr 16 10:17:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 32299 Received: (qmail 61485 invoked by alias); 16 Apr 2019 10:17:56 -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 61418 invoked by uid 89); 16 Apr 2019 10:17:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=Organization, RUNTESTFLAGS X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-eopbgr150082.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (40.107.15.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Apr 2019 10:17:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hSkDcuOXiVVMAtIatoQ/uESDrz+U/opY0e3E7v3COuA=; b=Jc6LwcBi4X10BKmFKA2H1NEfLtTZ5G0ZuKwjZ2tRt8bxo19TuyoB22r8j35oOFLbmq9X+TQOqlyXgvOdVvQhIq1djJKrVvdT+ZBO1CmnGGeTNd7ubEvaUOCgBlkkTZPNP7DNk4Lhy9oJG/98oA9saxW9klHIqzdFyrMoU8L44Dk= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2597.eurprd08.prod.outlook.com (10.172.247.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.19; Tue, 16 Apr 2019 10:17:43 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::399b:3a32:bff9:827e]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::399b:3a32:bff9:827e%11]) with mapi id 15.20.1792.018; Tue, 16 Apr 2019 10:17:43 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH 4/4] testsuite: Add option to capture gdbserver debug Date: Tue, 16 Apr 2019 10:17:43 +0000 Message-ID: <20190416101729.16176-5-alan.hayward@arm.com> References: <20190416101729.16176-1-alan.hayward@arm.com> In-Reply-To: <20190416101729.16176-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-exchange-purlcount: 1 received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-IsSubscribed: yes Add board option which enables gdbserver debug and sends it to the file gdbserver.log, located in the output directory for the current test. Document this. Add debug versions of the native gdbserver board files. Disable tspeed.exp when debugging to prevent the log file filling many gigabytes then timing out. gdb/testsuite/ChangeLog: 2019-04-16 Alan Hayward * README (gdbserver,debug): Add board setting. * boards/native-extended-gdbserver-debug.exp: New file. * boards/native-gdbserver-debug.exp: New file. * gdb.trace/tspeed.exp: Skip when debugging. * lib/gdbserver-support.exp: Check for gdbserver,debug. --- gdb/testsuite/README | 8 ++++++ .../native-extended-gdbserver-debug.exp | 26 +++++++++++++++++++ .../boards/native-gdbserver-debug.exp | 25 ++++++++++++++++++ gdb/testsuite/gdb.trace/tspeed.exp | 5 ++++ gdb/testsuite/lib/gdbserver-support.exp | 16 +++++++++++- 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/boards/native-extended-gdbserver-debug.exp create mode 100644 gdb/testsuite/boards/native-gdbserver-debug.exp -- 2.20.1 (Apple Git-117) diff --git a/gdb/testsuite/README b/gdb/testsuite/README index db90ea4698..01595d35aa 100644 --- a/gdb/testsuite/README +++ b/gdb/testsuite/README @@ -497,6 +497,14 @@ gdb,nopie_flag The flag required to force the compiler to produce non-position-independent executables. +gdbserver,debug + + When set gdbserver debug is outputed to the file gdbserver.log in the test + output directory. Valid values are: + "debug" - turn on gdbserver debug. + "remote" - turn on gdbserver remote debug. + "all" - turn on all the above debug options. + Testsuite Organization ********************** diff --git a/gdb/testsuite/boards/native-extended-gdbserver-debug.exp b/gdb/testsuite/boards/native-extended-gdbserver-debug.exp new file mode 100644 index 0000000000..aa79416081 --- /dev/null +++ b/gdb/testsuite/boards/native-extended-gdbserver-debug.exp @@ -0,0 +1,26 @@ +# Copyright 2019 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 . + +# This file is a dejagnu "board file" and is used to run the testsuite +# natively with gdbserver, in extended-remote mode, with gdbserver debug +# turned on. +# +# To use this file: +# bash$ cd ${build_dir}/gdb +# bash$ make check RUNTESTFLAGS="--target_board=native-extended-gdbserver-debug" + +load_board_description "native-extended-gdbserver" + +set_board_info gdbserver,debug "all" diff --git a/gdb/testsuite/boards/native-gdbserver-debug.exp b/gdb/testsuite/boards/native-gdbserver-debug.exp new file mode 100644 index 0000000000..ffca2cb8d5 --- /dev/null +++ b/gdb/testsuite/boards/native-gdbserver-debug.exp @@ -0,0 +1,25 @@ +# Copyright 2019 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 . + +# This file is a dejagnu "board file" and is used to run the testsuite +# natively with gdbserver, with gdbserver debug turned on. +# +# To use this file: +# bash$ cd ${build_dir}/gdb +# bash$ make check RUNTESTFLAGS="--target_board=native-gdbserver-debug" + +load_board_description "native-gdbserver" + +set_board_info gdbserver,debug "all" diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp index 6fd812e4f6..70a8e1f5b4 100644 --- a/gdb/testsuite/gdb.trace/tspeed.exp +++ b/gdb/testsuite/gdb.trace/tspeed.exp @@ -19,6 +19,11 @@ if {[skip_shlib_tests]} { return 0 } +# Do not run if gdbsever debug is enabled - the output file is many Gb. +if [target_info exists gdbserver,debug] { + return 0 +} + standard_testfile set executable $testfile diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp index 2cb64f7d2f..745cf670b1 100644 --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -283,12 +283,26 @@ proc gdbserver_start { options arguments } { # If gdbserver_reconnect will be called $gdbserver_reconnect_p must be # set to true already during gdbserver_start. global gdbserver_reconnect_p + global srcdir + global subdir if {![info exists gdbserver_reconnect_p] || !$gdbserver_reconnect_p} { # GDB client could accidentally connect to a stale server. - # append gdbserver_command " --debug --once" append gdbserver_command " --once" } + # Set debug according to the board setting. + if [target_info exists gdbserver,debug] { + set gdbserverdebug [target_info gdbserver,debug] + set debugfile [standard_output_file gdbserver.log] + if { $gdbserverdebug == "debug" } { + append gdbserver_command " --debug --debug-file=$debugfile" + } elseif { $gdbserverdebug == "remote" } { + append gdbserver_command " --remote-debug --debug-file=$debugfile" + } elseif { $gdbserverdebug == "all" } { + append gdbserver_command " --debug --remote-debug --debug-file=$debugfile" + } + } + if { $options != "" } { append gdbserver_command " $options" }