From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7999 invoked by alias); 8 Dec 2013 05:19:30 -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 29896 invoked by uid 89); 8 Dec 2013 05:14:18 -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 Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Dec 2013 05:14:15 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VpWgp-0005CH-K2 from Hui_Zhu@mentor.com ; Sat, 07 Dec 2013 21:13:59 -0800 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); Sat, 7 Dec 2013 21:13:59 -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; Sat, 7 Dec 2013 21:13:58 -0800 Message-ID: <52A40015.207@mentor.com> Date: Sun, 08 Dec 2013 05:19: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> <529C80D2.2080608@mentor.com> <529C9B42.20600@redhat.com> <529D62F7.80701@mentor.com> <52A22582.8040509@redhat.com> In-Reply-To: <52A22582.8040509@redhat.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00293.txt.bz2 On 12/07/13 03:29, Pedro Alves wrote: > Please analyze the insert_bp_location's error handling carefully: > > - if solib_name_from_address is true (the dprintf is set in a > shared library), we won't see this new error message, while > we should. I change all this part to: First, output error message. Second, if it is solib breakpoint, disable breakpoint. > - 'hw_bp_err_string' ends up misnamed after this patch. Change it to "bp_err_string". > Post a new patch according to your comments. This patch is tested and pass the regression test in x86_64 linux. Please help me review it. Thanks, Hui 2013-12-08 Hui Zhu PR gdb/16101 * breakpoint.c (insert_bp_location): Change hw_bp_err_string to bp_err_string. Output error message of software breakpoints. Make solib error message output use same code with hardware breakpoints and software breakpoints. * remote.c (remote_insert_breakpoint): If this breakpoint has target-side commands but this stub doesn't support Z0 packets, throw error. --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2396,7 +2396,7 @@ insert_bp_location (struct bp_location * int *hw_bp_error_explained_already) { int val = 0; - char *hw_bp_err_string = NULL; + char *bp_err_string = NULL; struct gdb_exception e; if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update)) @@ -2501,7 +2501,7 @@ insert_bp_location (struct bp_location * if (e.reason < 0) { val = 1; - hw_bp_err_string = (char *) e.message; + bp_err_string = (char *) e.message; } } else @@ -2543,7 +2543,7 @@ insert_bp_location (struct bp_location * if (e.reason < 0) { val = 1; - hw_bp_err_string = (char *) e.message; + bp_err_string = (char *) e.message; } } else @@ -2557,6 +2557,36 @@ insert_bp_location (struct bp_location * if (val) { /* Can't set the breakpoint. */ + if (bl->loc_type == bp_loc_hardware_breakpoint) + { + *hw_breakpoint_error = 1; + *hw_bp_error_explained_already = bp_err_string != NULL; + fprintf_unfiltered (tmp_error_stream, + "Cannot insert hardware breakpoint %d%s", + bl->owner->number, bp_err_string ? ":" : ".\n"); + if (bp_err_string) + fprintf_unfiltered (tmp_error_stream, "%s.\n", bp_err_string); + } + else if (bp_err_string != NULL) + { + fprintf_unfiltered (tmp_error_stream, + "Cannot insert breakpoint %d:%s\n", + bl->owner->number, bp_err_string); + } + else + { + char *message = memory_error_message (TARGET_XFER_E_IO, + bl->gdbarch, bl->address); + struct cleanup *old_chain = make_cleanup (xfree, message); + + fprintf_unfiltered (tmp_error_stream, + "Cannot insert breakpoint %d.\n" + "%s\n", + bl->owner->number, message); + + do_cleanups (old_chain); + } + if (solib_name_from_address (bl->pspace, bl->address)) { /* See also: disable_breakpoints_in_shlibs. */ @@ -2564,45 +2594,13 @@ insert_bp_location (struct bp_location * bl->shlib_disabled = 1; observer_notify_breakpoint_modified (bl->owner); if (!*disabled_breaks) - { - fprintf_unfiltered (tmp_error_stream, - "Cannot insert breakpoint %d.\n", - bl->owner->number); - fprintf_unfiltered (tmp_error_stream, - "Temporarily disabling shared " - "library breakpoints:\n"); - } + fprintf_unfiltered (tmp_error_stream, + "Temporarily disabling shared " + "library breakpoints:\n"); *disabled_breaks = 1; fprintf_unfiltered (tmp_error_stream, "breakpoint #%d\n", bl->owner->number); } - else - { - if (bl->loc_type == bp_loc_hardware_breakpoint) - { - *hw_breakpoint_error = 1; - *hw_bp_error_explained_already = hw_bp_err_string != NULL; - fprintf_unfiltered (tmp_error_stream, - "Cannot insert hardware breakpoint %d%s", - bl->owner->number, hw_bp_err_string ? ":" : ".\n"); - if (hw_bp_err_string) - fprintf_unfiltered (tmp_error_stream, "%s.\n", hw_bp_err_string); - } - else - { - char *message = memory_error_message (TARGET_XFER_E_IO, - bl->gdbarch, bl->address); - struct cleanup *old_chain = make_cleanup (xfree, message); - - fprintf_unfiltered (tmp_error_stream, - "Cannot insert breakpoint %d.\n" - "%s\n", - bl->owner->number, message); - - do_cleanups (old_chain); - } - - } } else bl->inserted = 1; --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8260,6 +8260,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); }