From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32666 invoked by alias); 22 Feb 2013 17:39:05 -0000 Received: (qmail 32515 invoked by uid 22791); 22 Feb 2013 17:39:02 -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 usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Feb 2013 17:38:52 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 83.2C.31450.B2DA7215; Fri, 22 Feb 2013 18:38:51 +0100 (CET) Received: from EUSAAMB103.ericsson.se ([147.117.188.120]) by EUSAAHC007.ericsson.se ([147.117.188.93]) with mapi id 14.02.0318.004; Fri, 22 Feb 2013 12:38:51 -0500 From: Marc Khouzam To: 'Yao Qi' , "'gdb-patches@sourceware.org'" CC: "'tromey@redhat.com'" , 'Pedro Alves' , 'Joel Brobecker' , 'Stan Shebs' Subject: DPrintf feedback (was: [RFC] PR 15075 dprintf interferes with "next") Date: Fri, 22 Feb 2013 17:39:00 -0000 Message-ID: References: <1361192891-29341-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1361192891-29341-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2013-02/txt/msg00595.txt.bz2 Hi, Yao posting a patch for dprintf was good timing. I've been working on integrating the dprintf feature into Eclipse and I ran into some issues. I think the main point to discuss is the fact that dprintf use breakpoint commands. This has been put in question, a couple of times on the mailing list I believe. An impact of that approach is that although in CLI, dprintf are silent=20 breakpoints, they don't seem to be in MI. When I put a dprintf=20 in a loop and run over it, I get a bunch of *stopped/*running=20 events and =3Dbreakpoint-modified events. I'm not sure how I feel about the =3Dbreak-modified event just yet and your expert opinion would be appreciated. However, the=20 *stopped/*running events seem like they shouldn't be there. They cause a lot of un-needed communication between Eclipse and GDB. This gives me the feeling that it would be better to have dprintf behave like an active tracepoint instead of a breakpoint. I believe Joel had suggested that at one point. Such an approach may also help fix the "continue" problem that Yao is trying to address. I seem to recall that Hui had posted=20 patches to add some kind of 'printf' tracepoint command. Maybe that=20 would be something that can help? Also, as pointed out by Pedro, the user is able to modify the=20 dprintf breakpoint commands, which can suddenly turn a dprintf into something else, although GDB still has it tagged as 'dprintf'. The fact that GDB has a new type 'dprintf', implies that dprintf should keep their 'dprintf' properties, and not be turned into a standard bp. Other issues I ran across are below. I wasn't sure opening PRs was the way to do since those issues may disappear if the current=20 implementation is amended: - If I set a condition on a dprintf, things don't behave right. When the condition is false, the printout is not shown, but the=20 dprintf causes the inferior to stop and not continue. - Setting the dprintf-style to 'agent' for a local session defaults to 'gdb' style, but the 'continue' command is not added in that=20 case (easy to fix) - Pagination is triggered for dprintf in CLI mode, at least when using dprintf-style 'gdb'. I think this is a problem because: a) when pagination is triggered, inferior execution will be=20 interrupted until the user answers the pagination prompt b) pagination is triggered by the dprintf but not by real=20 inferior output. So, as dprintf and inferior printouts=20 appear interleaved on the screen, the pagination prompt=20 will be triggered when the dprintfs add up to too many,=20 which will seem random to the user, since the other=20 printouts are also visible. - In Eclipse, the dprintf-style that makes sense is either=20 'call' or 'agent'. 'call' will call 'printf' in the inferior. With GDB 7.5, GDB cannot call an inferior method on Ubuntu,=20 which is a serious limitation for eclipse/dprintf. http://sourceware.org/ml/gdb-patches/2012-07/msg00037.html - Updating the dprintf-style to 'agent' for existing dprintfs=20 will cause: "May only run agent-printf on the target" when=20 it is time to print. - The fact that there is no expression checking on the validity=20 of the dprintf string can be a user-friendliness problem - Output buffering is not behaving as a real printf. For=20 example, if my program does printf("hello"); printf("friend\n"); and I put a dprintf " my " on the second line,=20 I would expect to see "hello my friend" but instead I see " my hellofriend" which shows that the dprintf string does not go to the same=20 buffer as the real printfs, and is flushed earlier. This also happens with the dprintf-style "agent" Thanks=20 Marc