From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14902 invoked by alias); 2 Dec 2013 12:45:28 -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 14891 invoked by uid 89); 2 Dec 2013 12:45:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Dec 2013 12:45:25 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VnSsA-0005Xu-1j from Hui_Zhu@mentor.com ; Mon, 02 Dec 2013 04:45:10 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 2 Dec 2013 04:45:09 -0800 Received: from [127.0.0.1] (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; Mon, 2 Dec 2013 04:45:07 -0800 Message-ID: <529C80D2.2080608@mentor.com> Date: Mon, 02 Dec 2013 12:45:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches ml Subject: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet References: <5265022F.8060203@mentor.com> <52654A2C.9010202@redhat.com> <529707C7.4040504@mentor.com> <5298AE7C.6020607@redhat.com> In-Reply-To: <5298AE7C.6020607@redhat.com> Content-Type: multipart/mixed; boundary="------------040404020507090105060101" X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00033.txt.bz2 --------------040404020507090105060101 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1571 On 11/29/13 23:10, Pedro Alves wrote: > On 11/28/2013 09:07 AM, Hui Zhu wrote: > >> + if (have_target_target_side_commands) > > This can now just be: > > if (!VEC_empty (agent_expr_p, bp_tgt->tcommands)) > > OK with that change. > >> + { >> + warning (_("\ >> +Target doesn't support breakpoints that have target side commands.")); > > I was doing to suggest making this an error instead, that > insert_bp_location would print the error string, but that's > only true for hw breakpoints... insert_bp_location's error > handling is quite messy. For instance, if this breakpoint > is in a a shared library, this will disable the breakpoint, > even though the cause of the error is clearly not that the > shared library disappeared (i.e., not a memory error). > >> + return -1; >> + } Updated the patch according to your comments. And I make a patch for dprintf.exp and mi-dprintf.exp to make test OK on the target that doesn't support "Zx" packets. The patches were tested and pass regression test on X86_64 and PPC. Please help me review it. Thanks, Hui 2013-12-02 Hui Zhu PR gdb/16101 * remote.c (remote_insert_breakpoint): If this breakpoint has target-side commands but this stub doesn't support Z0 packets, throw error. 2013-12-02 Hui Zhu PR gdb/16101 * gdb.base/dprintf.exp: Add check for the the gdbserver of some architecture doesn't support some "Zx" doesn't support some "Zx" packets. * gdb.mi/mi-dprintf.exp: Ditto. * lib/mi-support.exp: Add check for continue get error. --------------040404020507090105060101 Content-Type: text/plain; charset="us-ascii"; name="fix-dprintf-test-v2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-dprintf-test-v2.txt" Content-length: 433 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8244,6 +8244,12 @@ remote_insert_breakpoint (struct gdbarch } } + /* If this breakpoint has target-side commands but this stub doesn't + support Z0 packets, throw error. */ + if (!VEC_empty (agent_expr_p, bp_tgt->tcommands)) + error (_("\ +Target doesn't support breakpoints that have target side commands.")); + return memory_insert_breakpoint (gdbarch, bp_tgt); } --------------040404020507090105060101 Content-Type: text/plain; charset="us-ascii"; name="dprintf-test.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dprintf-test.txt" Content-length: 2033 --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -108,6 +108,26 @@ gdb_test_multiple "set dprintf-style age } } +# Continue with target-side breakpoint commands will get error if GDB +# work with the gdbserver of some architecture doesn't support some "Zx" +# packets. +if $target_can_dprintf { + gdb_run_cmd + + gdb_test "" "Breakpoint" + + set msg "continue with target-side breakpoint commands" + gdb_test_multiple "continue" $msg { + -re "Cannot insert breakpoint $decimal\.\r\n.*\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 @@ -120,7 +140,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 @@ -139,6 +139,16 @@ gdb_expect { } } +# Continue with target-side breakpoint commands will get error if GDB +# work with The gdbserver of some architecture doesn't support some "Zx" +# packets. +if $target_can_dprintf { + if {[mi_run_cmd] == -1} { + pass "continue with target-side breakpoint commands - cannot do" + set target_can_dprintf 0 + } +} + if $target_can_dprintf { mi_run_cmd --- 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 "\\^error.*\r\n$mi_gdb_prompt" { return -1 } default {} } return 0 --------------040404020507090105060101--