gdb: replace some so_list parameters to use references

A subsequent patch changes so_list to be linked using
intrusive_list.  Iterating an intrusive_list yields some references to
the list elements.  Convert some functions accepting so_list objects to
take references, to make things easier and more natural.  Add const
where possible and convenient.

Change-Id: Id5ab5339c3eb6432e809ad14782952d6a45806f3
Approved-By: Pedro Alves <pedro@palves.net>
Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
This commit is contained in:
Simon Marchi
2023-09-29 22:59:22 -04:00
committed by Simon Marchi
parent c1d21880e9
commit bb86ab837e
23 changed files with 183 additions and 191 deletions

View File

@@ -608,9 +608,9 @@ darwin_clear_solib (program_space *pspace)
}
static void
darwin_free_so (struct so_list *so)
darwin_free_so (so_list &so)
{
lm_info_darwin *li = (lm_info_darwin *) so->lm_info;
lm_info_darwin *li = (lm_info_darwin *) so.lm_info;
delete li;
}
@@ -619,25 +619,24 @@ darwin_free_so (struct so_list *so)
Relocate these VMAs according to solib info. */
static void
darwin_relocate_section_addresses (struct so_list *so,
struct target_section *sec)
darwin_relocate_section_addresses (so_list &so, target_section *sec)
{
lm_info_darwin *li = (lm_info_darwin *) so->lm_info;
lm_info_darwin *li = (lm_info_darwin *) so.lm_info;
sec->addr += li->lm_addr;
sec->endaddr += li->lm_addr;
/* Best effort to set addr_high/addr_low. This is used only by
'info sharedlibary'. */
if (so->addr_high == 0)
if (so.addr_high == 0)
{
so->addr_low = sec->addr;
so->addr_high = sec->endaddr;
so.addr_low = sec->addr;
so.addr_high = sec->endaddr;
}
if (sec->endaddr > so->addr_high)
so->addr_high = sec->endaddr;
if (sec->addr < so->addr_low)
so->addr_low = sec->addr;
if (sec->endaddr > so.addr_high)
so.addr_high = sec->endaddr;
if (sec->addr < so.addr_low)
so.addr_low = sec->addr;
}
static gdb_bfd_ref_ptr