From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123807 invoked by alias); 25 Apr 2016 08:58:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 123792 invoked by uid 89); 25 Apr 2016 08:58:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Match, Hx-languages-length:5008 X-HELO: mail-pf0-f169.google.com Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 25 Apr 2016 08:58:09 +0000 Received: by mail-pf0-f169.google.com with SMTP id y69so44257288pfb.1 for ; Mon, 25 Apr 2016 01:58:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=OsRjBQuCohfirWQnf0kNIjjOln+U0ZXn30FM/2jGcIM=; b=Z6O4rZCA0ucFFJBzrtDS1ULPC3uorNGLw8ZeXNK4/5iTm4HawLK4A4D0gaUmkpZwzI kyiQnuY9nHa7xjpcch7WpO2gh+0YBZlcRtpnnYCExYChu+OBIShJbfQQsnMWGZnzWLC5 Annv48qspBZLjIuP81DLMrqu3EQ4uOi/l+BfgzwdlbqrVBW8JgDuECy/0KPfScN62/Iy yhTBPQaC9Pps0eVtk1oWsKZaqwjGdYBqD5PjDtDh6pG5629DNSRjna+33grUkqKGuHhy U/vSdlDIJhaKreLx/LSQ+XvM+PYTg8FpzP0iC1c9WsYIZnIYhl0bl9ySFU6akbkf65Rc Y+0w== X-Gm-Message-State: AOPr4FXdHkeA/fnLOamL/F4FwA8PLpTZ40gSFODxE0UtBOUPCNHAXUmS4vfEzy2jqB9hUA== X-Received: by 10.98.42.211 with SMTP id q202mr46761311pfq.13.1461574687156; Mon, 25 Apr 2016 01:58:07 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id d186sm10035024pfa.45.2016.04.25.01.58.03 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 25 Apr 2016 01:58:06 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 7/7] New test case gdb.base/branch-to-self.exp References: <1458749384-19793-1-git-send-email-yao.qi@linaro.org> <1458749384-19793-8-git-send-email-yao.qi@linaro.org> <570BC40B.1000908@redhat.com> Date: Mon, 25 Apr 2016 08:58:00 -0000 In-Reply-To: <570BC40B.1000908@redhat.com> (Pedro Alves's message of "Mon, 11 Apr 2016 16:34:35 +0100") Message-ID: <86zisif4l6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00544.txt.bz2 Pedro Alves writes: > Did you mean to put something here? #error perhaps? > > I wonder whether we should just use > > while (1); > The source C code leading me looking at this issue is "for (;;);", we can use it too. >> +with_test_prefix "single-step" { >> + global testfile >> + >> + clean_restart ${testfile} >> + if ![runto_main] { >> + return -1 >> + } >> + set line_num [gdb_get_line_number "loop-line" ${testfile}.c] >> + >> + gdb_test "break ${testfile}.c:${line_num}" > > Please avoid line numbers in test messages, as they'll change > as the test evolves in future. Fixed. Patch below is pushed in. --=20 Yao (=E9=BD=90=E5=B0=A7) =46rom f3abeff575541dd80e1facd6d0f920e10f77fede Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Mon, 25 Apr 2016 09:53:51 +0100 Subject: [PATCH] New test case gdb.base/branch-to-self.exp gdb/testsuite: 2016-04-25 Yao Qi * gdb.base/branch-to-self.c: New file. * gdb.base/branch-to-self.exp: New file. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c7c9d58..c919c47 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-25 Yao Qi + + * gdb.base/branch-to-self.c: New file. + * gdb.base/branch-to-self.exp: New file. + 2016-04-22 Yao Qi =20 * gdb.trace/unavailable.exp (gdb_collect_globals_test_1): Match diff --git a/gdb/testsuite/gdb.base/branch-to-self.c b/gdb/testsuite/gdb.ba= se/branch-to-self.c new file mode 100644 index 0000000..594214b --- /dev/null +++ b/gdb/testsuite/gdb.base/branch-to-self.c @@ -0,0 +1,40 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2016 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 . = */ + +#include +#include +#include + +volatile int counter =3D 0; + +static void +handler (int sig) +{ + counter =3D 5; +} + +int +main (void) +{ + signal (SIGALRM, handler); + alarm (5); + + /* Compiler may generate a single instruction which branches to + itself. */ + for (;;); /* loop-line */ + return 0; +} diff --git a/gdb/testsuite/gdb.base/branch-to-self.exp b/gdb/testsuite/gdb.= base/branch-to-self.exp new file mode 100644 index 0000000..2fd3b38 --- /dev/null +++ b/gdb/testsuite/gdb.base/branch-to-self.exp @@ -0,0 +1,69 @@ +# This testcase is part of GDB, the GNU debugger. +# +# Copyright 2016 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 . + +standard_testfile + +if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] =3D= =3D -1 } { + return -1 +} + +with_test_prefix "single-step" { + global testfile + + clean_restart ${testfile} + if ![runto_main] { + return -1 + } + set line_num [gdb_get_line_number "loop-line" ${testfile}.c] + + gdb_test "break ${testfile}.c:${line_num}" "Breakpoint .*" \ + "set breakpoint" + gdb_continue_to_breakpoint "hit breakpoint" + gdb_test "si" ".*${testfile}.c:${line_num}.*" +} + +with_test_prefix "break-cond" { + global testfile + + foreach_with_prefix side {"host" "target"} { + + clean_restart ${testfile} + + if ![runto_main] { + return -1 + } + + set test "set breakpoint condition-evaluation $side" + gdb_test_multiple $test $test { + -re "warning: Target does not support breakpoint condition evaluation= .\r\nUsing host evaluation mode instead.\r\n$gdb_prompt $" { + # Target doesn't support breakpoint condition + # evaluation on its side. Skip the test. + continue + } + -re "^$test\r\n$gdb_prompt $" { + } + } + + set line_num [gdb_get_line_number "loop-line" ${testfile}.c] + gdb_test "break ${testfile}.c:${line_num} if counter > 3" \ + "Breakpoint .*" "set breakpoint with condition" + + gdb_continue_to_breakpoint "continue to break" + + gdb_test "p counter" ".* =3D 5" + } +}