From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14741 invoked by alias); 8 May 2012 07:50:58 -0000 Received: (qmail 14718 invoked by uid 22791); 8 May 2012 07:50:55 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 May 2012 07:50:41 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SRfBw-0003BA-A7 from Yao_Qi@mentor.com ; Tue, 08 May 2012 00:50:40 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 8 May 2012 00:50:30 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Tue, 8 May 2012 00:50:39 -0700 Message-ID: <4FA8D049.109@codesourcery.com> Date: Tue, 08 May 2012 07:50:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120412 Thunderbird/11.0.1 MIME-Version: 1.0 To: Stan Shebs CC: Subject: Re: [PATCH v2] dynamic printf References: <4FA8BC97.2000801@earthlink.net> In-Reply-To: <4FA8BC97.2000801@earthlink.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2012-05/txt/msg00216.txt.bz2 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 . > + > + 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 (齐尧)