From 9dc1523b573cc065d6124e3127009c1d7cb8317b Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 9 May 2023 10:23:44 -0400 Subject: 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 --- gdb/tracectf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/tracectf.c') diff --git a/gdb/tracectf.c b/gdb/tracectf.c index d8d0f05..ab513b1 100644 --- a/gdb/tracectf.c +++ b/gdb/tracectf.c @@ -1535,7 +1535,7 @@ ctf_get_traceframe_address (void) struct tracepoint *tp = get_tracepoint_by_number_on_target (tpnum); - if (tp && tp->loc) + if (tp != nullptr && tp->has_locations ()) addr = tp->loc->address; } -- cgit v1.1