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] Remove same-pc breakpoint notification for internal BPs


On Thursday 21 April 2011 15:17:26, Tom Tromey wrote:
> I wonder if this code should be using user_breakpoint_p instead.

I never understood why we need that function (as is implemented) though.

  /* Return non-zero if B is user settable (breakpoints, watchpoints,
     catchpoints, et.al.).  */

  static int
  user_settable_breakpoint (const struct breakpoint *b)
  {
      return (b->type == bp_breakpoint
  	  || b->type == bp_catchpoint
  	  || b->type == bp_hardware_breakpoint
  	  || is_tracepoint (b)
  	  || is_watchpoint (b)
  	  || b->type == bp_gnu_ifunc_resolver);
  }

  /* Return true if this breakpoint was set by the user, false if it is
     internal or momentary.  */

  int
  user_breakpoint_p (struct breakpoint *b)
  {
    return user_settable_breakpoint (b) && b->number > 0;
  }

What could be !user_settable_breakpoint whose b->number is > 0?
IOW, why isn't that just :

  int
  user_breakpoint_p (struct breakpoint *b)
  {
    return b->number > 0;
  }

?

There are a bunch of places that check b->number directly.

-- 
Pedro Alves


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