From f5951b9ff8a018c9234656e9b26b372c6b3d238b Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 9 May 2023 10:28:09 -0400 Subject: gdb: add breakpoint::first_loc methods Add convenience first_loc methods to struct breakpoint (const and non-const overloads). A subsequent patch changes the list of locations to be an intrusive_list and makes the actual list private, so these spots would need to change from: b->loc to something ugly like: *b->locations ().begin () That would make the code much heavier and not readable. There is a surprisingly big number of places that access the first location of breakpoints. Whether this is correct, or these spots fail to consider the possibility of multi-location breakpoints, I don't know. But anyhow, I think that using this instead: b->first_loc () conveys the intention better than the other two forms. Change-Id: Ibbefe3e4ca6cdfe570351fe7e2725f2ce11d1e95 Reviewed-By: Andrew Burgess --- gdb/elfread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/elfread.c') diff --git a/gdb/elfread.c b/gdb/elfread.c index 83b20a3..799e3b9 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -977,7 +977,7 @@ elf_gnu_ifunc_resolver_stop (code_breakpoint *b) gdb_assert (frame_id_p (b_return->frame_id)); if (b_return->thread == thread_id - && b_return->loc->requested_address == prev_pc + && b_return->first_loc ().requested_address == prev_pc && b_return->frame_id == prev_frame_id) break; } @@ -1046,7 +1046,7 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b) func_func = value::allocate (func_func_type); func_func->set_lval (lval_memory); - func_func->set_address (b->loc->related_address); + func_func->set_address (b->first_loc ().related_address); value = value::allocate (value_type); gdbarch_return_value_as_value (gdbarch, func_func, value_type, regcache, -- cgit v1.1