From patchwork Sun Mar 23 11:35:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Zhu X-Patchwork-Id: 238 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id CDFCF36018A for ; Sun, 23 Mar 2014 04:36:08 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 6F0CB61D3F45B; Sun, 23 Mar 2014 04:36:08 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 4800961D3F45B for ; Sun, 23 Mar 2014 04:36:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=lRj/iagvRMhPDTSJ IZ4ckNsgPTNPVfUoxDU14rY/9KDcbsUjOTVodNrfTOC31kik+aFYgRg4dazBpd43 Mb/ysp1zgJPym3XL+naIES8xcDib2grEgqB1jb5DYWUtnTFDjxVwX7d0U6WItUVl mnBzn8SSp/yRM88MwxQx29m/D1c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=nSiM1ljzBzXrjZdlZ4ezmi KNMHk=; b=S7GZa74HdGN3TQLNWJM5VbtBuOXML0n3knDOmO74HM3Gz+Lgua8yPZ 3ckVTuw6unUBvhoGP1O8bW9lP+HJYZWPE1QFuqNwEpThQdvEBem/ArnZxHUUfsLH mkd0yh/uOzg4hkgOBKqRtJfOKZLWKTffYdxFN+or+dWQVf1AHwpDM= Received: (qmail 11066 invoked by alias); 23 Mar 2014 11:36:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 11056 invoked by uid 89); 23 Mar 2014 11:36:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Mar 2014 11:36:03 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WRgh4-0003kM-Th from Hui_Zhu@mentor.com ; Sun, 23 Mar 2014 04:35:58 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 23 Mar 2014 04:35:58 -0700 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Sun, 23 Mar 2014 04:35:57 -0700 Message-ID: <532EC71C.8050909@mentor.com> Date: Sun, 23 Mar 2014 19:35:56 +0800 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches ml Subject: Re: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers References: <531F1E7B.8030301@mentor.com> <532C3A74.3040300@redhat.com> In-Reply-To: <532C3A74.3040300@redhat.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On 03/21/14 21:11, Pedro Alves wrote: Thanks for your review. > On 03/11/2014 02:32 PM, Hui Zhu wrote: >> --- a/gdb/testsuite/gdb.base/dprintf.exp >> +++ b/gdb/testsuite/gdb.base/dprintf.exp >> @@ -109,6 +109,24 @@ gdb_test_multiple "set dprintf-style age >> } >> >> if $target_can_dprintf { >> + # Second check to make sure current target support breakpoints that have target side commands > > Line too long. "make sure THE current target supportS". Period at end of sentence. Update this part to: # Make sure the current target support target side commands. Update mi-dprintf.exp to: # Make sure the current target support target side commands. > >> + gdb_run_cmd >> + >> + gdb_test "" "Breakpoint" >> + >> + set msg "Send dprintf to target" >> + gdb_test_multiple "continue" $msg { >> + -re "Warning:.*Target doesn't support breakpoints that have target side commands.*\r\n$gdb_prompt $" { >> + set target_can_dprintf 0 >> + pass "$msg - cannot do" >> + } >> + -re ".*$gdb_prompt $" { >> + pass "$msg - can do" >> + } >> + } > > Why not simply merge this check with the existing code just > below, that does pretty much the same thing? > > if $target_can_dprintf { > gdb_run_cmd > ... > Update this part to: set msg "Send dprintf to target" gdb_test_multiple "continue" $msg { -re "Warning:.*Target doesn't support breakpoints that have target side commands.*\r\n$gdb_prompt $" { set target_can_dprintf 0 pass "$msg - cannot do" } -re "Breakpoint \[0-9\]+, foo .*" { pass "1st dprintf, agent" } } if $target_can_dprintf { gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" gdb_test_sequence "info breakpoints" "dprintf info 2" { "\[\r\n\]Num Type Disp Enb Address +What" "\[\r\n\]2 breakpoint" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\]3 dprintf" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\] agent-printf \"At foo entry\\\\n\"" "\[\r\n\]4 dprintf" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\] agent-printf \"arg=%d, g=%d\\\\n\", arg, g" } } Update mi-dprintf.exp to: if $target_can_dprintf { # Make sure the current target support target side commands. if {[mi_run_cmd] < 0} { set target_can_dprintf 0 unsupported "send dprintf to target" } if $target_can_dprintf { mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent" mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent" # The =breakpoint-modified text is a part of the "-exec-continue" output. set msg "mi info dprintf second time" gdb_expect { -re "=breakpoint-modified," { pass $msg } -re ".*$mi_gdb_prompt$" { fail "$msg" } timeout { fail "$msg" } } mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" } } > > >> if $target_can_dprintf { >> + # Second check to make sure current target support breakpoints that have target side commands >> + if {[mi_run_cmd] < 0} { >> + set target_can_dprintf 0 >> + unsupported "send dprintf to target" >> + } >> +} >> + >> +if $target_can_dprintf { >> mi_run_cmd > > Likewise. > Post new version. Please help me review it. Best. Hui 2014-03-23 Hui Zhu PR breakpoints/16494 * gdb.base/dprintf.exp: Add second check to make sure current target support breakpoints that have target side commands. * gdb.base/mi-dprintf.exp: Ditto. * lib/mi-support.exp (mi_run_cmd_full): Add handle for error. --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -109,24 +109,36 @@ gdb_test_multiple "set dprintf-style age } if $target_can_dprintf { + # Make sure the current target support target side commands. gdb_run_cmd gdb_test "" "Breakpoint" - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent" + set msg "Send dprintf to target" + gdb_test_multiple "continue" $msg { + -re "Warning:.*Target doesn't support breakpoints that have target side commands.*\r\n$gdb_prompt $" { + set target_can_dprintf 0 + pass "$msg - cannot do" + } + -re "Breakpoint \[0-9\]+, foo .*" { + pass "1st dprintf, agent" + } + } - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" + if $target_can_dprintf { + gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" - gdb_test_sequence "info breakpoints" "dprintf info 2" { - "\[\r\n\]Num Type Disp Enb Address +What" - "\[\r\n\]2 breakpoint" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\]3 dprintf" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\] agent-printf \"At foo entry\\\\n\"" - "\[\r\n\]4 dprintf" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\] agent-printf \"arg=%d, g=%d\\\\n\", arg, g" + gdb_test_sequence "info breakpoints" "dprintf info 2" { + "\[\r\n\]Num Type Disp Enb Address +What" + "\[\r\n\]2 breakpoint" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\]3 dprintf" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\] agent-printf \"At foo entry\\\\n\"" + "\[\r\n\]4 dprintf" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\] agent-printf \"arg=%d, g=%d\\\\n\", arg, g" + } } } --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -140,30 +140,36 @@ gdb_expect { } if $target_can_dprintf { - mi_run_cmd + # Make sure the current target support target side commands. + if {[mi_run_cmd] < 0} { + set target_can_dprintf 0 + unsupported "send dprintf to target" + } - mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" + if $target_can_dprintf { + mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" - mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" - mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent" + mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" + mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent" - mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent" + mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent" - # The =breakpoint-modified text is a part of the "-exec-continue" output. - set msg "mi info dprintf second time" - gdb_expect { - -re "=breakpoint-modified," { - pass $msg - } - -re ".*$mi_gdb_prompt$" { - fail "$msg" - } - timeout { - fail "$msg" + # The =breakpoint-modified text is a part of the "-exec-continue" output. + set msg "mi info dprintf second time" + gdb_expect { + -re "=breakpoint-modified," { + pass $msg + } + -re ".*$mi_gdb_prompt$" { + fail "$msg" + } + timeout { + fail "$msg" + } } - } - mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" + mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" + } } mi_gdb_test "set dprintf-style foobar" ".*error.*" "mi set dprintf style to an unrecognized type" --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -843,6 +843,7 @@ proc mi_run_cmd_full {use_mi_command arg send_gdb "${run_prefix}continue\n" gdb_expect 60 { -re "${run_match}\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt" {} + -re "${run_match}\\^error.*" {return -1} default {} } return 0