summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-31 11:31:52 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-31 11:31:52 +0000
commitd00ac17e8e06fa06acde570d89ac6a90126359c8 (patch)
treeeee6311ebd70f252ade73066a53228bc52c5fac8 /src
parent0de78ed02c7e2caaf96eafb814c6059ceb9582b2 (diff)
downloadopenocd_libswd-d00ac17e8e06fa06acde570d89ac6a90126359c8.tar.gz
openocd_libswd-d00ac17e8e06fa06acde570d89ac6a90126359c8.tar.bz2
openocd_libswd-d00ac17e8e06fa06acde570d89ac6a90126359c8.tar.xz
openocd_libswd-d00ac17e8e06fa06acde570d89ac6a90126359c8.zip
Add target breakpoint and watchpoint wrapper:
- replaces all calls to target->type->{add,remove}_{break,watch}point. git-svn-id: svn://svn.berlios.de/openocd/trunk@1967 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/breakpoints.c8
-rw-r--r--src/target/target.c21
-rw-r--r--src/target/target.h30
3 files changed, 55 insertions, 4 deletions
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index 106095cd..55524a76 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -61,7 +61,7 @@ int breakpoint_add(target_t *target, u32 address, u32 length, enum breakpoint_ty
(*breakpoint_p)->orig_instr = malloc(length);
(*breakpoint_p)->next = NULL;
- if ((retval = target->type->add_breakpoint(target, *breakpoint_p)) != ERROR_OK)
+ if ((retval = target_add_breakpoint(target, *breakpoint_p)) != ERROR_OK)
{
switch (retval)
{
@@ -108,7 +108,7 @@ static void breakpoint_free(target_t *target, breakpoint_t *breakpoint_remove)
if (breakpoint==NULL)
return;
- target->type->remove_breakpoint(target, breakpoint);
+ target_remove_breakpoint(target, breakpoint);
(*breakpoint_p) = breakpoint->next;
free(breakpoint->orig_instr);
@@ -184,7 +184,7 @@ int watchpoint_add(target_t *target, u32 address, u32 length, enum watchpoint_rw
(*watchpoint_p)->set = 0;
(*watchpoint_p)->next = NULL;
- if ((retval = target->type->add_watchpoint(target, *watchpoint_p)) != ERROR_OK)
+ if ((retval = target_add_watchpoint(target, *watchpoint_p)) != ERROR_OK)
{
switch (retval)
{
@@ -229,7 +229,7 @@ static void watchpoint_free(target_t *target, watchpoint_t *watchpoint_remove)
if (watchpoint==NULL)
return;
- target->type->remove_watchpoint(target, watchpoint);
+ target_remove_watchpoint(target, watchpoint);
(*watchpoint_p) = watchpoint->next;
free(watchpoint);
}
diff --git a/src/target/target.c b/src/target/target.c
index a54e0654..16d28727 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -546,6 +546,27 @@ int target_bulk_write_memory(struct target_s *target,
return target->type->bulk_write_memory(target, address, count, buffer);
}
+int target_add_breakpoint(struct target_s *target,
+ struct breakpoint_s *breakpoint)
+{
+ return target->type->add_breakpoint(target, breakpoint);
+}
+int target_remove_breakpoint(struct target_s *target,
+ struct breakpoint_s *breakpoint)
+{
+ return target->type->remove_breakpoint(target, breakpoint);
+}
+
+int target_add_watchpoint(struct target_s *target,
+ struct watchpoint_s *watchpoint)
+{
+ return target->type->add_watchpoint(target, watchpoint);
+}
+int target_remove_watchpoint(struct target_s *target,
+ struct watchpoint_s *watchpoint)
+{
+ return target->type->remove_watchpoint(target, watchpoint);
+}
int target_get_gdb_reg_list(struct target_s *target,
struct reg_s **reg_list[], int *reg_list_size)
diff --git a/src/target/target.h b/src/target/target.h
index 91dd1b15..6e282d9e 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -413,6 +413,36 @@ extern void target_set_examined(struct target_s *target);
/// Reset the @c examined flag for the given target.
extern void target_reset_examined(struct target_s *target);
+
+/**
+ * Add the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_breakpoint.
+ */
+extern int target_add_breakpoint(struct target_s *target,
+ struct breakpoint_s *breakpoint);
+/**
+ * Remove the @a breakpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_breakpoint.
+ */
+extern int target_remove_breakpoint(struct target_s *target,
+ struct breakpoint_s *breakpoint);
+/**
+ * Add the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->add_watchpoint.
+ */
+extern int target_add_watchpoint(struct target_s *target,
+ struct watchpoint_s *watchpoint);
+/**
+ * Remove the @a watchpoint for @a target.
+ *
+ * This routine is a wrapper for target->type->remove_watchpoint.
+ */
+extern int target_remove_watchpoint(struct target_s *target,
+ struct watchpoint_s *watchpoint);
+
/**
* Obtain the registers for GDB.
*