[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 4/7] break/watchpoints: store inside array
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 4/7] break/watchpoints: store inside array |
Date: |
Fri, 17 Jun 2016 19:15:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 |
On 17/06/2016 18:33, Alex Bennée wrote:
> @@ -807,18 +807,17 @@ int cpu_watchpoint_insert_with_ref(CPUState *cpu, vaddr
> addr, vaddr len,
> wp->flags = flags;
> wp->ref = ref;
> } else {
> - wp = g_malloc(sizeof(*wp));
> -
> - wp->vaddr = addr;
> - wp->len = len;
> - wp->flags = flags;
> - wp->ref = ref;
> + CPUWatchpoint watch;
> + watch.vaddr = addr;
> + watch.len = len;
> + watch.flags = flags;
> + watch.ref = ref;
>
> /* keep all GDB-injected watchpoints in front */
> if (flags & BP_GDB) {
> - g_array_prepend_val(cpu->watchpoints, wp);
> + g_array_prepend_val(cpu->watchpoints, watch);
> } else {
> - g_array_append_val(cpu->watchpoints, wp);
> + g_array_append_val(cpu->watchpoints, watch);
> }
Please define "watch" outside the "if", so that the "then" side can do just
*wp = watch;
and there is less duplication.
Paolo
- [Qemu-devel] [RFC 0/7] Safe watch and breakpoint manipulation, Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 1/7] cpu: move break/watchpoints into arrays., Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 5/7] breakpoints: put breakpoints under RCU control, Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 3/7] exec: keep CPUBreakpoint references internal, Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 6/7] linux-user: don't clone watchpoints, Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 4/7] break/watchpoints: store inside array, Alex Bennée, 2016/06/17
- Re: [Qemu-devel] [RFC 4/7] break/watchpoints: store inside array,
Paolo Bonzini <=
- [Qemu-devel] [RFC 2/7] exec: keep CPUWatchpoint references internal, Alex Bennée, 2016/06/17
- [Qemu-devel] [RFC 7/7] watchpoints: put watchpoints under RCU control, Alex Bennée, 2016/06/17
- Re: [Qemu-devel] [RFC 0/7] Safe watch and breakpoint manipulation, Paolo Bonzini, 2016/06/17
- Re: [Qemu-devel] [RFC 0/7] Safe watch and breakpoint manipulation, Sergey Fedorov, 2016/06/20