From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29681 invoked by alias); 15 Apr 2013 16:05:40 -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 29671 invoked by uid 89); 15 Apr 2013 16:05:40 -0000 X-Spam-SWARE-Status: No, score=-8.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 15 Apr 2013 16:05:39 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3FG5WMT000322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Apr 2013 12:05:33 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3FG5Um2029559; Mon, 15 Apr 2013 12:05:30 -0400 Message-ID: <516C2549.3060808@redhat.com> Date: Mon, 15 Apr 2013 19:36:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Hui Zhu CC: Tom Tromey , Eli Zaretskii , Hui Zhu , gdb-patches ml , Marc Khouzam Subject: Re: [PATCH] add -s option to make -break-insert support dprintf References: <515451EA.1000200@mentor.com> <83y5d7wpvq.fsf@gnu.org> <516454DA.9040109@redhat.com> <87ppxzhfqy.fsf@fleche.redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00431.txt.bz2 On 04/15/2013 02:33 PM, Hui Zhu wrote: > On Sat, Apr 13, 2013 at 12:32 AM, Tom Tromey wrote: >>>>>>> "Hui" == Hui Zhu writes: >> >> Hui> + [ -s "@var{template},@var{expression}[,@var{expression}@dots{}]" ] >> Hui> + [ @var{location} ] >> >> Hui> +@item -s "@var{template},@var{expression}[,@var{expression}@dots{}]" >> Hui> +Set a dynamic printf breakpoint, described in @ref{Dynamic Printf}. >> Hui> +The @var{template} and @var{expression} should be within double >> Hui> +quotes and be escaped by being preceded with a backslash. >> >> MI already defines a quoting approach and allows multiple arguments. >> In fact one of its selling points is that it doesn't have to be as >> free-form as the CLI -- it can be more predictable for programs to use. >> >> So, I think the above approach is not that great. >> It adds a second layer of parsing to MI, I guess just to work around >> internal deficiencies in gdb. >> >> It seems like you could use positional arguments instead: >> >> -break-insert -s FORMAT LOCATION ARG ARG ARG ... >> >> >> I don't really understand the part about how the expressions should be >> in double quotes. The test suite doesn't do that: >> >> +mi_gdb_test "5-break-insert -s \"\\\"arg=%d, g=%d\\\\n\\\", arg, g\" $dp_location1" \ >> >> I suggest just dropping that text. I think it probably means that the >> argument should be properly quoted for MI, but that is redundant. I stopped for this as well before while reviewing the patches. I ended up not say anything as after trying things out, I realized that unlike with other arguments, which only require quoting if the argument itself contains spaces or quotes, etc., in this case, the quotes really are necessary (as in, GDB complains if you don't add the quotes). I didn't think about the split arguments idea though. That's a good question. >> >> Tom > > This design is because the MI inferior will auto convert the format > string of argument of mi command. But dprintf need format sting keep > the original of the format string. So I use the current format. I have a bit of trouble understanding exactly what you meant. :-( I see that with "target-printf" (what dprintf uses as command when the dprintf runs on the target/agent side), the whole format string plus the expressions are passed down to the target as a single chunk, unanalyzed and unmodified. E.g., even 'dprintf foo, "foo" "bar"' or 'agent-printf "foo" "bar"' is accepted, and passed down to the target as is (whatever that might mean). Is that what you were referring to? What did you mean by "MI inferior" and "auto convert" ? -- Pedro Alves