gdb: remove BLOCK_RANGE_{START,END} macros

Replace with equivalent methods on blockrange.

Change-Id: I20fd8f624e0129782c36768291891e7582d77c74
This commit is contained in:
Simon Marchi
2022-02-06 22:21:21 -05:00
committed by Simon Marchi
parent 3fe38936f6
commit 6dd5a4bd44
4 changed files with 35 additions and 26 deletions

View File

@ -38,19 +38,35 @@ struct addrmap;
struct blockrange struct blockrange
{ {
blockrange (CORE_ADDR startaddr_, CORE_ADDR endaddr_) blockrange (CORE_ADDR start, CORE_ADDR end)
: startaddr (startaddr_), : m_start (start),
endaddr (endaddr_) m_end (end)
{ {
} }
/* Return this blockrange's start address. */
CORE_ADDR start () const
{ return m_start; }
/* Set this blockrange's start address. */
void set_start (CORE_ADDR start)
{ m_start = start; }
/* Return this blockrange's end address. */
CORE_ADDR end () const
{ return m_end; }
/* Set this blockrange's end address. */
void set_end (CORE_ADDR end)
{ m_end = end; }
/* Lowest address in this range. */ /* Lowest address in this range. */
CORE_ADDR startaddr; CORE_ADDR m_start;
/* One past the highest address in the range. */ /* One past the highest address in the range. */
CORE_ADDR endaddr; CORE_ADDR m_end;
}; };
/* Two or more non-contiguous ranges in the same order as that provided /* Two or more non-contiguous ranges in the same order as that provided
@ -203,14 +219,6 @@ struct global_block
#define BLOCK_CONTIGUOUS_P(bl) (BLOCK_RANGES (bl) == nullptr \ #define BLOCK_CONTIGUOUS_P(bl) (BLOCK_RANGES (bl) == nullptr \
|| BLOCK_NRANGES (bl) <= 1) || BLOCK_NRANGES (bl) <= 1)
/* Obtain the start address of the Nth range for block BL. */
#define BLOCK_RANGE_START(bl,n) (BLOCK_RANGE (bl)[n].startaddr)
/* Obtain the end address of the Nth range for block BL. */
#define BLOCK_RANGE_END(bl,n) (BLOCK_RANGE (bl)[n].endaddr)
/* Define the "entry pc" for a block BL to be the lowest (start) address /* Define the "entry pc" for a block BL to be the lowest (start) address
for the block when all addresses within the block are contiguous. If for the block when all addresses within the block are contiguous. If
non-contiguous, then use the start address for the first range in the non-contiguous, then use the start address for the first range in the
@ -227,7 +235,7 @@ struct global_block
#define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ #define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \
? bl->start () \ ? bl->start () \
: BLOCK_RANGE_START (bl,0)) : BLOCK_RANGE (bl)[0].start ())
struct blockvector struct blockvector
{ {

View File

@ -286,11 +286,11 @@ find_pc_partial_function_sym (CORE_ADDR pc,
int i; int i;
for (i = 0; i < BLOCK_NRANGES (b); i++) for (i = 0; i < BLOCK_NRANGES (b); i++)
{ {
if (BLOCK_RANGE_START (b, i) <= mapped_pc if (BLOCK_RANGE (b)[i].start () <= mapped_pc
&& mapped_pc < BLOCK_RANGE_END (b, i)) && mapped_pc < BLOCK_RANGE (b)[i].end ())
{ {
cache_pc_function_low = BLOCK_RANGE_START (b, i); cache_pc_function_low = BLOCK_RANGE (b)[i].start ();
cache_pc_function_high = BLOCK_RANGE_END (b, i); cache_pc_function_high = BLOCK_RANGE (b)[i].end ();
break; break;
} }
} }
@ -396,14 +396,14 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
for (int i = 0; i < BLOCK_NRANGES (block); i++) for (int i = 0; i < BLOCK_NRANGES (block); i++)
{ {
if (BLOCK_RANGE_START (block, i) <= entry_pc if (BLOCK_RANGE (block)[i].start () <= entry_pc
&& entry_pc < BLOCK_RANGE_END (block, i)) && entry_pc < BLOCK_RANGE (block)[i].end ())
{ {
if (address != nullptr) if (address != nullptr)
*address = BLOCK_RANGE_START (block, i); *address = BLOCK_RANGE (block)[i].start ();
if (endaddr != nullptr) if (endaddr != nullptr)
*endaddr = BLOCK_RANGE_END (block, i); *endaddr = BLOCK_RANGE (block)[i].end ();
return status; return status;
} }

View File

@ -1444,8 +1444,8 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
{ {
for (int i = 0; i < BLOCK_NRANGES (block); i++) for (int i = 0; i < BLOCK_NRANGES (block); i++)
{ {
CORE_ADDR range_low = BLOCK_RANGE_START (block, i); CORE_ADDR range_low = BLOCK_RANGE (block)[i].start ();
CORE_ADDR range_high = BLOCK_RANGE_END (block, i); CORE_ADDR range_high = BLOCK_RANGE (block)[i].end ();
gdb_printf (_("Address range %ps to %ps:\n"), gdb_printf (_("Address range %ps to %ps:\n"),
styled_string (address_style.style (), styled_string (address_style.style (),
paddress (gdbarch, range_low)), paddress (gdbarch, range_low)),

View File

@ -683,8 +683,9 @@ objfile_relocate1 (struct objfile *objfile,
if (BLOCK_RANGES (b) != nullptr) if (BLOCK_RANGES (b) != nullptr)
for (int j = 0; j < BLOCK_NRANGES (b); j++) for (int j = 0; j < BLOCK_NRANGES (b); j++)
{ {
BLOCK_RANGE_START (b, j) += delta[block_line_section]; blockrange &r = BLOCK_RANGE (b)[j];
BLOCK_RANGE_END (b, j) += delta[block_line_section]; r.set_start (r.start () + delta[block_line_section]);
r.set_end (r.end () + delta[block_line_section]);
} }
/* We only want to iterate over the local symbols, not any /* We only want to iterate over the local symbols, not any