gdb: add breakpoint "has locations" methods

Add three convenience methods to struct breakpoint:

 - has_locations: returns true if the breakpoint has at least one
   location
 - has_single_location: returns true if the breakpoint has exactly one
   location
 - has_multiple_locations: returns true if the breakpoint has more than
   one location

A subsequent patch changes the list of breakpoints to be an
intrusive_list, so all these spots would need to change.  But in any
case, I think that this:

  if (b->has_multiple_locations ())

conveys the intention better than:

  if (b->loc != nullptr && b->loc->next != nullptr)

Change-Id: Ib18c3605fd35d425ef9df82cb7aacff1606c6747
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Simon Marchi
2023-05-09 10:23:44 -04:00
parent 5e632eca05
commit 9dc1523b57
8 changed files with 53 additions and 37 deletions

View File

@@ -12218,7 +12218,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
return;
/* Same if there are no locations... */
if (c->loc == NULL)
if (!c->has_locations ())
return;
/* Compute the condition expression in text form, from the specific