From: Yufeng Zhang Date: Wed, 18 Dec 2013 16:47:33 +0000 (+0000) Subject: gdb/ X-Git-Tag: hjl/linux/release/2.24.51.0.3~1^2~24^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f45c82da381e0ce5ce51b7fb24d0d28611d266b8;p=thirdparty%2Fbinutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d9308f515c..513c593c6d0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-12-18 Yufeng Zhang + + * aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set + iov.iov_len with the real length in use. + 2013-12-18 Yao Qi * target.h (target_xfer_partial_ftype): New typedef. diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 256725b5178..7d76833509c 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -314,10 +314,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++) { diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index c73840feae8..28477963064 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2013-12-18 Yufeng Zhang + + * linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set + iov.iov_len with the real length in use. + 2013-12-13 Joel Brobecker * Makefile.in (safe-ctype.o, lbasename.o): New rules. diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 93246b35df0..c2d271a9d2d 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++) {