Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Doug Evans <xdje42@gmail.com>
Cc: Hui Zhu <hui_zhu@mentor.com>,
	gdb-patches ml <gdb-patches@sourceware.org>
Subject: breakpoint.c:insert_bp_location: Constify local.  (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet)
Date: Thu, 12 Dec 2013 10:55:00 -0000	[thread overview]
Message-ID: <52A9960C.2070906@redhat.com> (raw)
In-Reply-To: <m31u1lvimb.fsf@sspiff.org>

On 12/09/2013 09:07 PM, Doug Evans wrote:
>> > @@ -2496,12 +2496,16 @@ insert_bp_location (struct bp_location *bl,
>> >  	  /* No overlay handling: just set the breakpoint.  */
>> >  	  TRY_CATCH (e, RETURN_MASK_ALL)
>> >  	    {
>> > +	      int val;
>> > +
>> >  	      val = bl->owner->ops->insert_location (bl);
>> > +	      if (val)
>> > +		bp_err = GENERIC_ERROR;
>> >  	    }
>> >  	  if (e.reason < 0)
>> >  	    {
>> > -	      val = 1;
>> > -	      hw_bp_err_string = (char *) e.message;
>> > +	      bp_err = e.error;
>> > +	      bp_err_message = (char *) e.message;
> Presumably there's a sufficient reason to keep them,
> but the question must be asked. :-)
> Are the casts necessary?
> [does bp_err_message have to be a char *]

A bit of an unrelated change, but OK, I'll bite.  ;-)

Pushed.
----------
breakpoint.c:insert_bp_location: Constify local.

gdb/
2013-12-12  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (insert_bp_location): Make 'hw_bp_err_string' local
	const, and remove casts.
---
 gdb/ChangeLog    | 5 +++++
 gdb/breakpoint.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 637a462..c49895b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2013-12-12  Pedro Alves  <palves@redhat.com>
 
+	* breakpoint.c (insert_bp_location): Make 'hw_bp_err_string' local
+	const, and remove casts.
+
+2013-12-12  Pedro Alves  <palves@redhat.com>
+
 	* cli/cli-cmds.c (source_script_from_stream) Use have_python
 	instead of catching UNSUPPORTED_ERROR.
 	* exceptions.h (UNSUPPORTED_ERROR): Delete.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 111660f..589aa19 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2396,7 +2396,7 @@ insert_bp_location (struct bp_location *bl,
 		    int *hw_bp_error_explained_already)
 {
   int val = 0;
-  char *hw_bp_err_string = NULL;
+  const char *hw_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 *bl,
 	  if (e.reason < 0)
 	    {
 	      val = 1;
-	      hw_bp_err_string = (char *) e.message;
+	      hw_bp_err_string = e.message;
 	    }
 	}
       else
@@ -2543,7 +2543,7 @@ insert_bp_location (struct bp_location *bl,
 	      if (e.reason < 0)
 	        {
 	          val = 1;
-	          hw_bp_err_string = (char *) e.message;
+	          hw_bp_err_string = e.message;
 	        }
 	    }
 	  else
-- 
1.7.11.7



  parent reply	other threads:[~2013-12-12 10:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 10:30 [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Hui Zhu
2013-10-21 15:37 ` Pedro Alves
2013-11-28 10:56   ` Hui Zhu
2013-11-28 17:38     ` Maciej W. Rozycki
2013-11-29  9:41       ` Hui Zhu
2013-11-29 15:27     ` [pushed] Plug target side conditions and commands leaks (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-11-29 16:05     ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2013-12-02 12:45       ` Hui Zhu
2013-12-02 14:38         ` Pedro Alves
2013-12-03  4:50           ` Hui Zhu
2013-12-03  4:54             ` Hui Zhu
2013-12-06 19:29             ` Pedro Alves
2013-12-08  5:19               ` Hui Zhu
2013-12-08  8:34                 ` Doug Evans
2013-12-08 14:18                   ` Hui Zhu
2013-12-09 19:48                 ` Pedro Alves
2013-12-09 21:07                   ` Doug Evans
2013-12-10 17:34                     ` Pedro Alves
2013-12-10 18:14                       ` [PATCH] Eliminate UNSUPPORTED_ERROR Pedro Alves
2013-12-11 16:33                         ` Doug Evans
2013-12-11 19:17                           ` Pedro Alves
2013-12-12  4:23                             ` Doug Evans
2013-12-12 10:23                               ` Pedro Alves
2013-12-11 16:40                       ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Doug Evans
2013-12-12 10:55                     ` Pedro Alves [this message]
2013-12-12 12:55                     ` Pedro Alves
2014-01-09 18:36                       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A9960C.2070906@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hui_zhu@mentor.com \
    --cc=xdje42@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox