From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15446 invoked by alias); 13 May 2013 08:24:20 -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 15431 invoked by uid 89); 13 May 2013 08:24:18 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-oa0-f51.google.com (HELO mail-oa0-f51.google.com) (209.85.219.51) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 08:24:16 +0000 Received: by mail-oa0-f51.google.com with SMTP id f4so7187499oah.38 for ; Mon, 13 May 2013 01:24:15 -0700 (PDT) X-Received: by 10.60.34.135 with SMTP id z7mr12449514oei.68.1368433455491; Mon, 13 May 2013 01:24:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.13.133 with HTTP; Mon, 13 May 2013 01:23:35 -0700 (PDT) In-Reply-To: <51909285.6070008@codesourcery.com> References: <51909285.6070008@codesourcery.com> From: Hui Zhu Date: Mon, 13 May 2013 08:24:00 -0000 Message-ID: Subject: Re: [PATCH] Fix bug 15433 - GDB crashes when using agent dprintf, %s format, and an in-line string To: Yao Qi Cc: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-05/txt/msg00425.txt.bz2 Hi Yao, Thanks for your review. On Mon, May 13, 2013 at 3:13 PM, Yao Qi wrote: > On 05/11/2013 01:54 PM, Hui Zhu wrote: >> >> @@ -2302,6 +2302,9 @@ build_target_command_list (struct bp_loc >> need to parse the command to bytecodes again. */ >> aexpr = parse_cmd_to_aexpr (bl->address, >> loc->owner->extra_string); >> + if (aexpr == NULL) >> + error (_("Agent is not support commands of breakpoint >> %d."), >> + bl->owner->number); >> loc->cmd_bytecode = aexpr; >> >> if (!aexpr) > > > The existing code has considered the situation that we have a NULL bytecode > expression. Several lines of code below this line of patch do something, > > /* If we have a NULL bytecode expression, it means something > went wrong or we have a null command expression. */ > if (!loc->cmd_bytecode) > { > null_command_or_parse_error = 1; > break; > } > } > } > > /* If anything failed, then we're not doing target-side commands, > and so clean up. */ > if (null_command_or_parse_error) > > Your patch doesn't look right, and probably we need to examine why dprintf > breakpoint is not handled well in this part. I think the design of current build_target_command_list is not right. It use null_command_or_parse_error that close with build_target_condition_list. For the condition, the commands of agent is same with gdb side. So when it got fail or NULL. Agent can go back to let GDB handle this condition. So it have null_condition_or_parse_error. But for commands, the commands of agent is not support by GDB side (agent-printf). So even if it go back to GDB, it still cannot be handle. So I think throw error in build_target_command_list is better. I will post patch to fix it later. Thanks, Hui