[patch] Renaming: {insert,remove} += _location [Re: [patch 1/2] Convert hardware watchpoints to use breakpoint_ops]

Jan Kratochvil
2010-11-17T03:47:54Z

On Tue, 16 Nov 2010 19:51:01 +0100, Jan Kratochvil wrote:
> On Tue, 16 Nov 2010 09:07:21 +0100, Joel Brobecker wrote:
> > How about doing such a rename as a patch on its own?
>
> OK, going to send one today.

I will check it in after the Thiago's check-in.

Regards,
Jan

gdb/
2010-11-17 Jan Kratochvil <jan.kratochvil@redhat.com>

Code cleanup - renaming.
* breakpoint.c (insert_bp_location): Use the new name
breakpoint_ops->insert_location.
(remove_breakpoint_1): Use the new name
breakpoint_ops->remove_location.
* breakpoint.h (struct breakpoint_ops): Rename insert to
insert_location and remove to remove_location.

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1757,7 +1757,7 @@ Note: automatically using hardware breakpoints for read-only addresses.\n"));
watchpoints. It's not clear that it's necessary... */
&& bl->owner->disposition != disp_del_at_next_stop)
{
- val = bl->owner->ops->insert (bl);
+ val = bl->owner->ops->insert_location (bl);

/* If trying to set a read-watchpoint, and it turns out it's not
supported, try emulating one with an access watchpoint. */
@@ -1784,7 +1784,7 @@ Note: automatically using hardware breakpoints for read-only addresses.\n"));
if (val == 1)
{
bl->watchpoint_type = hw_access;
- val = bl->owner->ops->insert (bl);
+ val = bl->owner->ops->insert_location (bl);

if (val)
/* Back to the original value. */
@@ -1797,9 +1797,10 @@ Note: automatically using hardware breakpoints for read-only addresses.\n"));

else if (bl->owner->type == bp_catchpoint)
{
- gdb_assert (bl->owner->ops != NULL && bl->owner->ops->insert != NULL);
+ gdb_assert (bl->owner->ops != NULL
+ && bl->owner->ops->insert_location != NULL);

- val = bl->owner->ops->insert (bl);
+ val = bl->owner->ops->insert_location (bl);
if (val)
{
bl->owner->enable_state = bp_disabled;
@@ -2478,7 +2479,7 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
else if (bl->loc_type == bp_loc_hardware_watchpoint)
{
bl->inserted = (is == mark_inserted);
- bl->owner->ops->remove (bl);
+ bl->owner->ops->remove_location (bl);

/* Failure to remove any of the hardware watchpoints comes here. */
if ((is == mark_uninserted) && (bl->inserted))
@@ -2489,9 +2490,10 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
&& breakpoint_enabled (bl->owner)
&& !bl->duplicate)
{
- gdb_assert (bl->owner->ops != NULL && bl->owner->ops->remove != NULL);
+ gdb_assert (bl->owner->ops != NULL
+ && bl->owner->ops->remove_location != NULL);

- val = bl->owner->ops->remove (bl);
+ val = bl->owner->ops->remove_location (bl);
if (val)
return val;

--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -355,13 +355,13 @@ struct breakpoint_ops
/* Insert the breakpoint or watchpoint or activate the catchpoint.
Return 0 for success, 1 if the breakpoint, watchpoint or catchpoint
type is not supported, -1 for failure. */
- int (*insert) (struct bp_location *);
+ int (*insert_location) (struct bp_location *);

/* Remove the breakpoint/catchpoint that was previously inserted
with the "insert" method above. Return 0 for success, 1 if the
breakpoint, watchpoint or catchpoint type is not supported,
-1 for failure. */
- int (*remove) (struct bp_location *);
+ int (*remove_location) (struct bp_location *);

/* Return non-zero if the debugger should tell the user that this
breakpoint was hit. */