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

@@ -973,7 +973,7 @@ elf_gnu_ifunc_resolver_stop (code_breakpoint *b)
b_return = b_return->related_breakpoint)
{
gdb_assert (b_return->type == bp_gnu_ifunc_resolver_return);
gdb_assert (b_return->loc != NULL && b_return->loc->next == NULL);
gdb_assert (b_return->has_single_location ());
gdb_assert (frame_id_p (b_return->frame_id));
if (b_return->thread == thread_id
@@ -1042,7 +1042,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
b = (code_breakpoint *) b_next;
}
gdb_assert (b->type == bp_gnu_ifunc_resolver);
gdb_assert (b->loc->next == NULL);
gdb_assert (b->has_single_location ());
func_func = value::allocate (func_func_type);
func_func->set_lval (lval_memory);