This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix PR cli/15603
- From: Yao Qi <yao at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Mon, 17 Jun 2013 22:00:04 +0800
- Subject: Re: [PATCH] Fix PR cli/15603
- References: <1371224682-19919-1-git-send-email-tromey at redhat dot com>
On 06/14/2013 11:44 PM, Tom Tromey wrote:
+/* Implement the "explains_signal" breakpoint_ops method for
+ watchpoints. */
+
+static enum bpstat_signal_value
+explains_signal_watchpoint (struct breakpoint *b, enum gdb_signal sig)
+{
+ if (b->type != bp_watchpoint || sig == GDB_SIGNAL_TRAP)
+ return BPSTAT_SIGNAL_HIDE;
+
+ /* A software watchpoint cannot cause a signal other than
+ GDB_SIGNAL_TRAP. */
+ return BPSTAT_SIGNAL_NO;
+}
A nit here. The function is short, but not easy to understand. IMO,
the reversed condition checking is more readable, like this,
/* A software watchpoint cannot cause a signal other than
GDB_SIGNAL_TRAP. */
if ((b->type == bp_watchpoint && sig != GDB_SIGNAL_TRAP))
return BPSTAT_SIGNAL_NO;
return BPSTAT_SIGNAL_HIDE;
--
Yao (éå)