From patchwork Tue Mar 11 14:32:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Zhu X-Patchwork-Id: 39 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (caibbdcaabij.dreamhost.com [208.113.200.189]) by wilcox.dreamhost.com (Postfix) with ESMTP id 1FADD360083 for ; Tue, 11 Mar 2014 07:32:40 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id BFE314D39813; Tue, 11 Mar 2014 07:32:39 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.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-mx22.g.dreamhost.com (Postfix) with ESMTPS id 8D44B4D39805 for ; Tue, 11 Mar 2014 07:32:39 -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:content-type:content-transfer-encoding; q=dns; s= default; b=dMqNqnWR2mmY32VqZZu2v5uMLFQtjZHRPQzn8hi5DsjjMKIRzBLob Kd1BOYbN4ydNKtLKgTzxKeU1hMwhSvF3HxwTEXbrN9iaD5UG+76PECj9SRSbfZDB 0A6U/sKjw9F6eH4bBNb/OqQyz+xwJ+Ty2kGVT+RblXCsxWBrLjbaS4= 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:content-type:content-transfer-encoding; s=default; bh=l ytiYRHvnJd+RZ0iMkUQbx6aUdo=; b=FeiJ/TX4rkNTAjaNXEIrFRXn+trspT3WT M9hBHAfknA37XLSwEC5VWg5Hw5chHof0CjRyc0xlCKpoOCOG/AuAP74GRoVmw6Un EJla+QFZiIhCfHC+cC9/IjDytqdznDycapTlo+Tmcu1dbDQpKiIHVSahTDaWD8W/ sZFwglmMiw= Received: (qmail 11797 invoked by alias); 11 Mar 2014 14:32:37 -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 11783 invoked by uid 89); 11 Mar 2014 14:32:36 -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; Tue, 11 Mar 2014 14:32:34 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WNNjK-0006JA-H0 from Hui_Zhu@mentor.com ; Tue, 11 Mar 2014 07:32:30 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 11 Mar 2014 07:32:30 -0700 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Tue, 11 Mar 2014 07:31:14 -0700 Message-ID: <531F1E7B.8030301@mentor.com> Date: Tue, 11 Mar 2014 22:32:27 +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: gdb-patches ml CC: Pedro Alves Subject: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in After the patch that commited by Pedro, the GDB can throw error about gdbserver doesn't support agent commands. But the test still get this error because the it doesn't try handle the error when send dprintf to gdbserver. So I make this patch. It test OK and pass regression test in x86_64-linux and powerpc-linux. Thanks, Hui 2014-03-11 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,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 + 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" + } + } +} + +if $target_can_dprintf { gdb_run_cmd gdb_test "" "Breakpoint" @@ -120,7 +138,7 @@ if $target_can_dprintf { 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\]\tbreakpoint already hit 3 times" "\[\r\n\]3 dprintf" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\] agent-printf \"At foo entry\\\\n\"" --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -140,6 +140,14 @@ gdb_expect { } 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 mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -893,6 +893,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