From f45c82da381e0ce5ce51b7fb24d0d28611d266b8 Mon Sep 17 00:00:00 2001 From: Yufeng Zhang Date: Wed, 18 Dec 2013 16:47:33 +0000 Subject: gdb/ * aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set iov.iov_len with the real length in use. gdb/gdbserver/ * linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set iov.iov_len with the real length in use. --- gdb/gdbserver/linux-aarch64-low.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gdb/gdbserver/linux-aarch64-low.c') diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 93246b3..c2d271a 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -602,10 +602,13 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state, memset (®s, 0, sizeof (regs)); iov.iov_base = ®s; - iov.iov_len = sizeof (regs); count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs; addr = watchpoint ? state->dr_addr_wp : state->dr_addr_bp; ctrl = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp; + if (count == 0) + return; + iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count - 1]) + + sizeof (regs.dbg_regs [count - 1])); for (i = 0; i < count; i++) { -- cgit v1.1