gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.
authorPedro Alves <palves@redhat.com>
Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 2 Jun 2014 21:27:32 +0000 (22:27 +0100)
commit0a261ed82e9b5f6fbc3725258a742515df8f4b42
tree10a28a665a2c108795ffc541271a4c81bb76fa40
parent96ae5695ce2512600524915ace0bfef95a9734fc
gdbserver: on GDB breakpoint reinsertion, also delete the breakpoint's commands.

If GDB decides to change the breakpoint's conditions or commands,
it'll reinsert the same breakpoint again, with the new options
attached, without deleting the previous breakpoint.  E.g.,

 (gdb) set breakpoint always-inserted on
 (gdb) b main if 0
 Breakpoint 1 at 0x400594: file foo.c, line 21.
 Sending packet: $Z0,400594,1;X3,220027#68...Packet received: OK
 (gdb) b main
 Breakpoint 15 at 0x400594: file foo.c, line 21.
 Sending packet: $Z0,400594,1#49...Packet received: OK

GDBserver understands this and deletes the breakpoint's previous
conditions.  But, it forgets to delete the previous commands.

gdb/gdbserver/
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.
gdb/gdbserver/ChangeLog
gdb/gdbserver/ax.c
gdb/gdbserver/ax.h
gdb/gdbserver/mem-break.c
gdb/gdbserver/mem-break.h
gdb/gdbserver/server.c