This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR cli/15603


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]