Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/8] Add new test, gdb.base/loop-break.exp
Date: Tue, 25 Aug 2015 12:10:00 -0000	[thread overview]
Message-ID: <55DC5B1E.3050407@redhat.com> (raw)
In-Reply-To: <20150818235756.23c9d7db@pinnacle.lan>

On 08/19/2015 07:57 AM, Kevin Buettner wrote:

> index 0000000..3e4b5ca
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/loop-break.c
> @@ -0,0 +1,42 @@
> +volatile int v;
> +volatile int w;

Copyright header missing.

> +  v = 0;
> +  goto b;				/* Loop 4 initial goto */
> +a:  v++;
> +b:  if (v < 3) goto a;			/* Loop 4 condition */
> +}
> +
> +int main (int argc, char **argv)

Line break after first int.

> +{
> +  loop_test ();
> +
> +  return 0;
> +}
> diff --git a/gdb/testsuite/gdb.base/loop-break.exp b/gdb/testsuite/gdb.base/loop-break.exp
> new file mode 100644
> index 0000000..fef3fcb
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/loop-break.exp
> @@ -0,0 +1,113 @@
> +# Copyright 2015 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 <http://www.gnu.org/licenses/>.
> +
> +# Place breakpoints at various points on several different looping
> +# constructs.  Make sure that GDB correctly runs to each of these
> +# breakpoints and that computed values are correct at each point along
> +# the way.
> +
> +standard_testfile
> +
> +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
> +    return -1
> +}
> +
> +if ![runto_main] then { fail "loop-break tests suppressed" }

This should return rather than continue into a cascade of failures:

if ![runto_main] then {
    fail "Can't run to main"
    return 0
}

> +
> +proc break_at { search_string } {
> +	global srcfile
> +	set bp_location [gdb_get_line_number $search_string]
> +	gdb_test "break $bp_location" \
> +	    "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
> +	    "break $search_string"
> +
> +	return $bp_location;
> +}
> +
> +proc continue_to { linenum testname iter } {
> +    global srcfile
> +    global gdb_prompt
> +    set full_name "continue to $testname, $iter"
> +
> +    send_gdb "continue\n"
> +    gdb_expect {
> +	-re "Continuing.*Breakpoint.*$srcfile:$linenum\r\n.*\r\n$gdb_prompt $" {
> +	    pass $full_name
> +	}
> +	-re ".*$gdb_prompt $" {
> +	    fail $full_name
> +	}
> +	timeout { 
> +	    fail "$full_name (timeout)"
> +	}

Use gdb_test_multiple.  Or even, gdb_test ?

Thanks,
Pedro Alves


  reply	other threads:[~2015-08-25 12:10 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  6:53 [PATCH 0/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2015-08-19  6:58 ` [PATCH 1/8] Add new test, gdb.base/loop-break.exp Kevin Buettner
2015-08-25 12:10   ` Pedro Alves [this message]
2015-09-18  0:50     ` Kevin Buettner
2016-02-01 20:00       ` Kevin Buettner
2016-02-15 16:51         ` Kevin Buettner
2016-02-29 16:17         ` Kevin Buettner
2015-09-22  0:11   ` Kevin Buettner
2015-08-19  7:00 ` [PATCH 2/8] Add new gdbarch method, unconditional_branch_address Kevin Buettner
2015-08-25 12:13   ` Pedro Alves
2015-09-18  1:14     ` Kevin Buettner
2015-09-18 12:02   ` Andrew Burgess
2015-09-18 12:06     ` Andrew Burgess
2015-09-18 12:26       ` Kevin Buettner
2015-09-18 12:24     ` Kevin Buettner
2015-09-22 16:09   ` Yao Qi
2015-09-22 18:03     ` Kevin Buettner
2015-08-19  7:03 ` [PATCH 3/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2015-08-25 12:10   ` Pedro Alves
2015-09-18  1:57     ` Kevin Buettner
2015-09-30 12:17       ` Pedro Alves
2015-10-01  1:13         ` Kevin Buettner
2015-10-01  4:09         ` Doug Evans
2015-08-19  7:06 ` [PATCH 4/8] Implement unconditional_branch_address method for x86-64 and i386 Kevin Buettner
2015-09-18  2:03   ` Kevin Buettner
2015-08-19  7:08 ` [PATCH 5/8] Implement unconditional_branch_address method for arm and thumb Kevin Buettner
2015-08-19  7:11 ` [PATCH 6/8] Implement unconditional_branch_address method for powerpc / rs6000 Kevin Buettner
2015-08-19  7:13 ` [PATCH 7/8] Implement unconditional_branch_address method for rl78 Kevin Buettner
2015-08-19  7:15 ` [PATCH 8/8] Implement unconditional_branch_address method for rx Kevin Buettner
2016-01-18 16:48 ` [PATCH 0/8] Break at each iteration for breakpoints placed on a while statement Kevin Buettner
2016-04-04 15:56 ` Yao Qi
2016-04-14 16:31   ` Luis Machado
2016-04-15 11:59     ` Yao Qi
2016-04-15 19:48       ` Kevin Buettner
2016-04-15 22:34         ` Pedro Alves
2016-04-19 16:24           ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55DC5B1E.3050407@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox