This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
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)
- From: Pedro Alves <palves at redhat dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: Hui Zhu <hui_zhu at mentor dot com>, gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 12 Dec 2013 10:55:08 +0000
- 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)
- Authentication-results: sourceware.org; auth=none
- References: <5265022F dot 8060203 at mentor dot com> <52654A2C dot 9010202 at redhat dot com> <529707C7 dot 4040504 at mentor dot com> <5298AE7C dot 6020607 at redhat dot com> <529C80D2 dot 2080608 at mentor dot com> <529C9B42 dot 20600 at redhat dot com> <529D62F7 dot 80701 at mentor dot com> <52A22582 dot 8040509 at redhat dot com> <52A40015 dot 207 at mentor dot com> <52A61E86 dot 3020005 at redhat dot com> <m31u1lvimb dot fsf at sspiff dot 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