From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3500 invoked by alias); 23 Apr 2013 09:34:58 -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 3484 invoked by uid 89); 23 Apr 2013 09:34:57 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Apr 2013 09:34:56 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UUZck-0001ze-Cv from Yao_Qi@mentor.com ; Tue, 23 Apr 2013 02:34:54 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 23 Apr 2013 02:34:54 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Tue, 23 Apr 2013 02:34:52 -0700 Message-ID: <517655B9.3040805@codesourcery.com> Date: Tue, 23 Apr 2013 20:38:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Hui Zhu CC: gdb-patches ml Subject: Re: [PATCH] fix Bug 15180 Agent style dprintf does not respect conditions References: In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-04/txt/msg00705.txt.bz2 On 04/23/2013 03:14 PM, Hui Zhu wrote: > + condition_true = gdb_breakpoint_here (event_child->stop_pc) > + && gdb_condition_true_at_breakpoint (event_child->stop_pc); > + > /* If GDB wanted this thread to single step, we always want to > report the SIGTRAP, and let GDB handle it. Watchpoints should > always be reported. So should signals we can't explain. A > @@ -2628,11 +2632,11 @@ Check if we're already there.\n", > || event_child->stopped_by_watchpoint > || (!step_over_finished > && !bp_explains_trap && !trace_event) > - || (gdb_breakpoint_here (event_child->stop_pc) > - && gdb_condition_true_at_breakpoint (event_child->stop_pc) > + || (condition_true > && gdb_no_commands_at_breakpoint (event_child->stop_pc))); > > - run_breakpoint_commands (event_child->stop_pc); > + if (condition_true) > + run_breakpoint_commands (event_child->stop_pc); Hui, This patch works when there is only one dprintf set on a certain address. However, supposing we set two dprintf breakpoints on the same address, one condition is true and the other is false, commands of both breakpoint will be executed, which is wrong. See the session below: $ ./gdb ./testsuite/gdb.base/dprintf (gdb) target remote :1234 (gdb) set breakpoint condition-evaluation target // ensure that condition is evaluated in the target side. (gdb) set dprintf-style agent (gdb) dprintf foo , "true\n" (gdb) condition 1 main > 1 (gdb) dprintf foo, "false\n" (gdb) condition 2 main == 0 (gdb) info breakpoints Num Type Disp Enb Address What 1 dprintf keep y 0x080484aa in foo at ../../../../git/gdb/testsuite/gdb.base/dprintf.c:25 stop only if main > 1 (host evals) ^^^^^^^^^^ // it should be "(target evals)", caused by a separated bug. agent-printf "true\n" 2 dprintf keep y 0x080484aa in foo at ../../../../git/gdb/testsuite/gdb.base/dprintf.c:25 stop only if main == 0 (host evals) agent-printf "false\n" (gdb) c Continuing. [Inferior 1 (process 4135) exited with code 0152] In the other console, we can see the output: kickoff 1234 also to stderr 1234 false true false false true false false true false Child exited with status 106 AFAICS, it is not a bug specific to dprintf, all target-side commands are affected by this bug, because the command is not well grouped or associated with condition in target side. -- Yao (齐尧)