From: Jamie Lokier <jamie@shareable.org>
To: qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] Re: [PATCH 03/12] Refactor and enhance break/watchpoint API
Date: Fri, 14 Nov 2008 02:24:12 +0000 [thread overview]
Message-ID: <20081114022412.GE2055@shareable.org> (raw)
In-Reply-To: <491CB0B2.1040701@web.de>
Jan Kiszka wrote:
> Anthony Liguori wrote:
> > 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.
>
> OK, I see the general problem. Restricting ourselves here is not a big
> issue - but for my other series which tried hard to canonicalizes x86's
> cpu_gdb_read/write_register, sigh...
I think the code would be clearer with separate cases in this instance anyway.
Usuallywhen you have an enumeration which is just labels without a
numerical purpose, seeing "..." or "<" on it is not clear which cases
are included, and it tends to break quietly when someone adds more values.
If there's a long sequence of cases which crops up often, then you can
use a macro "#define cases_FOO case FOO1: case FOO2: case FOO3:".
-- Jamie
next prev parent reply other threads:[~2008-11-14 2:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-03 10:35 [Qemu-devel] [PATCH 00/12] Enhance debugging support - 4th take Jan Kiszka
2008-11-03 10:35 ` [Qemu-devel] [PATCH 01/12] Refactor translation block CPU state handling Jan Kiszka
2008-11-13 20:42 ` Anthony Liguori
2008-11-03 10:36 ` [Qemu-devel] [PATCH 02/12] Return appropriate watch message to gdb Jan Kiszka
2008-11-13 20:45 ` Anthony Liguori
2008-11-13 22:55 ` [Qemu-devel] " Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 03/12] Refactor and enhance break/watchpoint API Jan Kiszka
2008-11-13 20:48 ` Anthony Liguori
2008-11-13 22:56 ` [Qemu-devel] " Jan Kiszka
2008-11-14 2:24 ` Jamie Lokier [this message]
2008-11-13 20:51 ` [Qemu-devel] " Anthony Liguori
2008-11-13 22:58 ` [Qemu-devel] " Jan Kiszka
2008-11-15 8:29 ` Jan Kiszka
2008-11-15 16:12 ` Anthony Liguori
2008-11-03 10:36 ` [Qemu-devel] [PATCH 04/12] Set mem_io_vaddr on io_read Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 05/12] Respect length of watchpoints Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 06/12] Restore pc on watchpoint hits Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 07/12] Remove premature memop TB terminations Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 08/12] qemu: gdbstub: manage CPUs as threads Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 09/12] Introduce BP_WATCHPOINT_HIT flag Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 10/12] Add debug exception hook Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 11/12] Introduce BP_CPU as a breakpoint type Jan Kiszka
2008-11-03 10:36 ` [Qemu-devel] [PATCH 12/12] x86: Debug register emulation Jan Kiszka
2008-11-13 20:38 ` [Qemu-devel] [PATCH 00/12] Enhance debugging support - 4th take Anthony Liguori
2008-11-13 22:55 ` [Qemu-devel] " Jan Kiszka
2008-11-13 22:06 ` [Qemu-devel] " Fabrice Bellard
2008-11-13 22:55 ` [Qemu-devel] " Jan Kiszka
2008-11-13 23:32 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081114022412.GE2055@shareable.org \
--to=jamie@shareable.org \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.