diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-02-06 22:30:06 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-27 22:05:03 -0400 |
commit | f73b4922a06f5455c1f0173d3b2026dba957d1b7 (patch) | |
tree | b27b5f8b748788fcf1b22dffad546ad5e83de0d4 /gdb/blockframe.c | |
parent | f5cb8afdd297dd68273d98a10fbfd350dff918d8 (diff) | |
download | binutils-f73b4922a06f5455c1f0173d3b2026dba957d1b7.zip binutils-f73b4922a06f5455c1f0173d3b2026dba957d1b7.tar.gz binutils-f73b4922a06f5455c1f0173d3b2026dba957d1b7.tar.bz2 |
gdb: remove BLOCK_NRANGES macro
Replace with range for loops.
Change-Id: Icbe04f9b6f9e6ddae2e15b2409c61f7a336bc3e3
Diffstat (limited to 'gdb/blockframe.c')
-rw-r--r-- | gdb/blockframe.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gdb/blockframe.c b/gdb/blockframe.c index e91faaa..78c9daa 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -283,19 +283,19 @@ find_pc_partial_function_sym (CORE_ADDR pc, } else { - int i; - for (i = 0; i < BLOCK_NRANGES (b); i++) + bool found = false; + for (const blockrange &range : b->ranges ()) { - if (BLOCK_RANGE (b)[i].start () <= mapped_pc - && mapped_pc < BLOCK_RANGE (b)[i].end ()) + if (range.start () <= mapped_pc && mapped_pc < range.end ()) { - cache_pc_function_low = BLOCK_RANGE (b)[i].start (); - cache_pc_function_high = BLOCK_RANGE (b)[i].end (); + cache_pc_function_low = range.start (); + cache_pc_function_high = range.end (); + found = true; break; } } /* Above loop should exit via the break. */ - gdb_assert (i < BLOCK_NRANGES (b)); + gdb_assert (found); } @@ -394,16 +394,15 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name, { CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block); - for (int i = 0; i < BLOCK_NRANGES (block); i++) + for (const blockrange &range : block->ranges ()) { - if (BLOCK_RANGE (block)[i].start () <= entry_pc - && entry_pc < BLOCK_RANGE (block)[i].end ()) + if (range.start () <= entry_pc && entry_pc < range.end ()) { if (address != nullptr) - *address = BLOCK_RANGE (block)[i].start (); + *address = range.start (); if (endaddr != nullptr) - *endaddr = BLOCK_RANGE (block)[i].end (); + *endaddr = range.end (); return status; } |