Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Stan Shebs <stanshebs@earthlink.net>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] dynamic printf
Date: Tue, 08 May 2012 07:50:00 -0000	[thread overview]
Message-ID: <4FA8D049.109@codesourcery.com> (raw)
In-Reply-To: <4FA8BC97.2000801@earthlink.net>

Stan,
See some comments on test case below,

On 05/08/2012 02:26 PM, Stan Shebs wrote:
> Index: testsuite/gdb.base/dprintf.exp
> ===================================================================
> RCS file: testsuite/gdb.base/dprintf.exp
> diff -N testsuite/gdb.base/dprintf.exp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ testsuite/gdb.base/dprintf.exp	8 May 2012 04:54:25 -0000
> @@ -0,0 +1,79 @@
> +#   Copyright (C) 2012 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/>.
> +
> +

Some tests in this case reply on inferior io, so board setting
"gdb,noinferiorio" should be checked, and tests should be skipped when
`dprintf-style' is `call'.

> +if { [prepare_for_testing dprintf.exp "dprintf" {} {debug}] } {
> +    return -1
> +}
> +
> +set srcfile dprintf.c
> +
> +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
> +set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
> +
> +gdb_breakpoint "main"
> +gdb_run_cmd
> +
> +gdb_test "dprintf" "Format string required"
> +
> +gdb_test "dprintf foo" "Format string required"
> +
> +gdb_test "dprintf 29" "Format string required"
> +
> +delete_breakpoints
> +
> +gdb_breakpoint "main"
> +
> +gdb_test "dprintf foo,\"At foo entry\\n\"" \
> +  "Dprintf .*"
> +
> +gdb_test "dprintf $dp_location1,\"arg=%d, g=%d\\n\", arg, g" \
> +  "Dprintf .*"
> +
> +gdb_test "break $bp_location1" \
> +  "Breakpoint .*"
> +
> +gdb_run_cmd
> +
> +gdb_test "" "Breakpoint"
> +
> +gdb_test "continue" "At foo entry.*arg=1234, g=1234.*" "1st dprintf, gdb"
> +
> +gdb_test "continue" "At foo entry.*arg=1235, g=2222.*" "2nd dprintf, gdb"
> +
> +# Now switch styles and rerun; in the absence of redirection the
> +# output should be the same.
> +
> +gdb_test "set dprintf-style call" ""

gdb_test_no_output is better.

> +
> +gdb_run_cmd
> +
> +gdb_test "" "Breakpoint"
> +
> +gdb_test "continue" "At foo entry.*arg=1234, g=1234.*" "1st dprintf, call"
> +
> +gdb_test "continue" "At foo entry.*arg=1235, g=2222.*" "2nd dprintf, call"
> +
> +gdb_test "set dprintf-function fprintf" ""
> +gdb_test "set dprintf-channel stderr" ""
> +

and here.

> +gdb_run_cmd
> +
> +gdb_test "" "Breakpoint"
> +
> +gdb_test "continue" "At foo entry.*arg=1234, g=1234.*" "1st dprintf, fprintf"
> +gdb_test "continue" "At foo entry.*arg=1235, g=2222.*" "2nd dprintf, fprintf"
> +
> +gdb_test "set dprintf-style foobar" ""

Better to check the output, event it is an error message.

-- 
Yao (齐尧)


  reply	other threads:[~2012-05-08  7:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08  6:27 Stan Shebs
2012-05-08  7:50 ` Yao Qi [this message]
2012-05-14 15:54   ` Stan Shebs
2012-05-15  4:10     ` [commit] Fix spu-tdep.c build regression [Re: [PATCH v2] dynamic printf] Jan Kratochvil
2012-05-15 10:24       ` Jim Meyering
2012-05-15 13:10     ` [commit] testsuite: gdb.base/dprintf.exp PR 12649 race " Jan Kratochvil
2012-05-15 13:34       ` Joel Brobecker
2012-05-15 13:37         ` [commit#2] " Jan Kratochvil
2012-05-16 20:17     ` [PATCH v2] dynamic printf Tom Tromey
2012-05-16 20:46       ` Stan Shebs
2012-05-16 20:52         ` Pedro Alves
2012-05-16 22:25           ` Stan Shebs
2012-05-17  1:56             ` Tom Tromey
2012-05-18 15:38               ` Pedro Alves
2012-05-16 20:53         ` Pedro Alves
2012-05-16 21:06         ` Tom Tromey

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=4FA8D049.109@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=stanshebs@earthlink.net \
    /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