Pass aarch64_debug_reg_state to functions
authorYao Qi <yao.qi@linaro.org>
Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)
commitc67ca4de63fb3018a7e21ec4afe709d4c0dd52c4
treebad99de03f148179148431f5a1bcc6282df33cf3
parent25abf97969e50190cb5532b25b8e1deef3ab3bde
Pass aarch64_debug_reg_state to functions

Some functions on handling HW watchpoint in GDB and GDBserver looks the
same except the code getting debug register state from current inferior.
In GDB, we get debug register state like this:

  state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));

while in GDBserver, we get debug register state like this:

  state = aarch64_get_debug_reg_state ();

This patch is to move two lines above out of some functions, and pass
aarch64_debug_reg_state to these functions, in this way, these functions
are the same, and can be moved to a common place.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_handle_breakpoint): Add argument
state and don't call aarch64_get_debug_reg_state.  All callers
update.
(aarch64_linux_insert_hw_breakpoint): Call
aarch64_get_debug_reg_state earlier.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Add argument state and
don't call aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Add argument state.
(aarch64_linux_insert_watchpoint): Call aarch64_get_debug_reg_state
earlier.
(aarch64_linux_remove_watchpoint): Likewise.

gdb/gdbserver:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_handle_breakpoint): Add argument state
and don't aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
(aarch64_insert_point): Call aarch64_get_debug_reg_state earlier.
(aarch64_remove_point): Likewise.
gdb/ChangeLog
gdb/aarch64-linux-nat.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-aarch64-low.c