This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] dynamic printf


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]