From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0j74-0005Lf-J8 for qemu-devel@nongnu.org; Thu, 13 Nov 2008 15:48:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0j74-0005LP-1P for qemu-devel@nongnu.org; Thu, 13 Nov 2008 15:48:26 -0500 Received: from [199.232.76.173] (port=59747 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0j73-0005LM-Se for qemu-devel@nongnu.org; Thu, 13 Nov 2008 15:48:25 -0500 Received: from qw-out-1920.google.com ([74.125.92.146]:38634) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0j73-0005SE-6k for qemu-devel@nongnu.org; Thu, 13 Nov 2008 15:48:25 -0500 Received: by qw-out-1920.google.com with SMTP id 5so842483qwc.4 for ; Thu, 13 Nov 2008 12:48:24 -0800 (PST) Message-ID: <491C9293.2090603@codemonkey.ws> Date: Thu, 13 Nov 2008 14:48:19 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 03/12] Refactor and enhance break/watchpoint API References: <20081103103558.213902776@mchn012c.ww002.siemens.net> <20081103103559.071243441@mchn012c.ww002.siemens.net> In-Reply-To: <20081103103559.071243441@mchn012c.ww002.siemens.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka Jan Kiszka wrote: > Index: b/gdbstub.c > =================================================================== > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -1145,10 +1145,64 @@ void gdb_register_coprocessor(CPUState * > } > } > > +/* GDB breakpoint/watchpoint types */ > +#define GDB_BREAKPOINT_SW 0 > +#define GDB_BREAKPOINT_HW 1 > +#define GDB_WATCHPOINT_WRITE 2 > +#define GDB_WATCHPOINT_READ 3 > +#define GDB_WATCHPOINT_ACCESS 4 > + > +#ifndef CONFIG_USER_ONLY > +static const int xlat_gdb_type[] = { > + [GDB_WATCHPOINT_WRITE] = BP_GDB | BP_MEM_WRITE, > + [GDB_WATCHPOINT_READ] = BP_GDB | BP_MEM_READ, > + [GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS, > +}; > +#endif > + > +static int gdb_breakpoint_insert(CPUState *env, target_ulong addr, > + target_ulong len, int type) > +{ > + switch (type) { > + case GDB_BREAKPOINT_SW ... GDB_BREAKPOINT_HW: > We've avoided this GCCism pretty much. I don't think the code is significantly cleaner with it so I think it's best to avoid it. > +typedef struct CPUWatchpoint { > + target_ulong vaddr; > + target_ulong len_mask; > + int flags; /* BP_* */ > + struct CPUWatchpoint *prev, *next; > +} CPUWatchpoint; > + > #define CPU_TEMP_BUF_NLONGS 128 > #define CPU_COMMON \ > struct TranslationBlock *current_tb; /* currently executing TB */ \ > @@ -174,16 +185,11 @@ typedef struct icount_decr_u16 { > \ > /* from this point: preserved by CPU reset */ \ > /* ice debug support */ \ > - target_ulong breakpoints[MAX_BREAKPOINTS]; \ > - int nb_breakpoints; \ > + CPUBreakpoint *breakpoints; \ > int singlestep_enabled; \ > \ > - struct { \ > - target_ulong vaddr; \ > - int type; /* PAGE_READ/PAGE_WRITE */ \ > - } watchpoint[MAX_WATCHPOINTS]; \ > - int nb_watchpoints; \ > - int watchpoint_hit; \ > + CPUWatchpoint *watchpoints; \ > + CPUWatchpoint *watchpoint_hit; \ > The previous patch doesn't build because this patch is where you introduce flags into watch points. Please make sure the whole series builds and works at each patch. Otherwise bisecting breaks. Regards, Anthony Liguori