+2014-06-02 Pedro Alves <palves@redhat.com>
+
+ * ax.c (gdb_free_agent_expr): New function.
+ * ax.h (gdb_free_agent_expr): New declaration.
+ * mem-break.c (delete_gdb_breakpoint_1): Also clear the commands
+ list.
+ (clear_breakpoint_conditions, clear_breakpoint_commands): Make
+ static.
+ (clear_breakpoint_conditions_and_commands): New function.
+ * mem-break.h (clear_breakpoint_conditions): Delete declaration.
+ (clear_breakpoint_conditions_and_commands): New declaration.
+
2014-05-23 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* linux-aarch64-low.c (asm/ptrace.h): Include.
return aexpr;
}
+void
+gdb_free_agent_expr (struct agent_expr *aexpr)
+{
+ if (aexpr != NULL)
+ {
+ free (aexpr->bytes);
+ free (aexpr);
+ }
+}
+
/* Convert the bytes of an agent expression back into hex digits, so
they can be printed or uploaded. This allocates the buffer,
callers should free when they are done with it. */
of bytes in expression, a comma, and then the bytes. */
struct agent_expr *gdb_parse_agent_expr (char **actparm);
+/* Release an agent expression. */
+void gdb_free_agent_expr (struct agent_expr *aexpr);
+
/* Convert the bytes of an agent expression back into hex digits, so
they can be printed or uploaded. This allocates the buffer,
callers should free when they are done with it. */
if (bp == NULL)
return -1;
- /* Before deleting the breakpoint, make sure to free
- its condition list. */
- clear_breakpoint_conditions (bp);
+ /* Before deleting the breakpoint, make sure to free its condition
+ and command lists. */
+ clear_breakpoint_conditions_and_commands (bp);
err = delete_breakpoint (bp);
if (err != 0)
return -1;
/* Clear all conditions associated with a breakpoint. */
-void
+static void
clear_breakpoint_conditions (struct breakpoint *bp)
{
struct point_cond_list *cond;
struct point_cond_list *cond_next;
cond_next = cond->next;
- free (cond->cond->bytes);
- free (cond->cond);
+ gdb_free_agent_expr (cond->cond);
free (cond);
cond = cond_next;
}
bp->cond_list = NULL;
}
+/* Clear all commands associated with a breakpoint. */
+
+static void
+clear_breakpoint_commands (struct breakpoint *bp)
+{
+ struct point_command_list *cmd;
+
+ if (bp->command_list == NULL)
+ return;
+
+ cmd = bp->command_list;
+
+ while (cmd != NULL)
+ {
+ struct point_command_list *cmd_next;
+
+ cmd_next = cmd->next;
+ gdb_free_agent_expr (cmd->cmd);
+ free (cmd);
+ cmd = cmd_next;
+ }
+
+ bp->command_list = NULL;
+}
+
+void
+clear_breakpoint_conditions_and_commands (struct breakpoint *bp)
+{
+ clear_breakpoint_conditions (bp);
+ clear_breakpoint_commands (bp);
+}
+
/* Add condition CONDITION to GDBserver's breakpoint BP. */
static void
int breakpoint_inserted_here (CORE_ADDR addr);
-/* Clear all breakpoint conditions associated with this address. */
+/* Clear all breakpoint conditions and commands associated with a
+ breakpoint. */
-void clear_breakpoint_conditions (struct breakpoint *bp);
+void clear_breakpoint_conditions_and_commands (struct breakpoint *bp);
/* Set target-side condition CONDITION to the breakpoint at ADDR.
Returns false on failure. On success, advances CONDITION pointer
here. If we already have a list of parameters, GDB
is telling us to drop that list and use this one
instead. */
- clear_breakpoint_conditions (bp);
+ clear_breakpoint_conditions_and_commands (bp);
process_point_options (bp, &dataptr);
}
}