+2013-05-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup: constification.
+ * solib.c (solib_ops): Make return type and ops variable type const.
+ (set_solib_ops): Make the new_ops parameter and ops variable const.
+ (solib_find, solib_map_sections, clear_so, free_so, update_solib_list)
+ (solib_add, solib_keep_data_in_core, clear_solib)
+ (solib_create_inferior_hook, in_solib_dynsym_resolve_code)
+ (reload_shared_libraries, solib_global_lookup): Make the ops variable
+ const.
+ * solib.h (set_solib_ops): Make the new_ops parameter const.
+
2013-05-21 Joel Brobecker <brobecker@adacore.com>
* data-directory/Makefile.in (SYSTEM_GDBINIT_SRCDIR): New
return ops;
}
-static struct target_so_ops *
+static const struct target_so_ops *
solib_ops (struct gdbarch *gdbarch)
{
- struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+ const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
return *ops;
}
/* Set the solib operations for GDBARCH to NEW_OPS. */
void
-set_solib_ops (struct gdbarch *gdbarch, struct target_so_ops *new_ops)
+set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
{
- struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+ const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
*ops = new_ops;
}
char *
solib_find (char *in_pathname, int *fd)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
int found_file = -1;
char *temp_pathname = NULL;
int gdb_sysroot_is_empty;
static int
solib_map_sections (struct so_list *so)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
char *filename;
struct target_section *p;
struct cleanup *old_chain;
static void
clear_so (struct so_list *so)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
if (so->sections)
{
void
free_so (struct so_list *so)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
clear_so (so);
ops->free_so (so);
static void
update_solib_list (int from_tty, struct target_ops *target)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
if (loaded_any_symbols)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
/* Getting new symbols may change our opinion about what is
frameless. */
int
solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
if (ops->keep_data_in_core)
return ops->keep_data_in_core (vaddr, size);
void
clear_solib (void)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
/* This function is expected to handle ELF shared libraries. It is
also used on Solaris, which can run either ELF or a.out binaries
void
solib_create_inferior_hook (int from_tty)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
ops->solib_create_inferior_hook (from_tty);
}
int
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
return ops->in_dynsym_resolve_code (pc);
}
reload_shared_libraries (char *ignored, int from_tty,
struct cmd_list_element *e)
{
- struct target_so_ops *ops;
+ const struct target_so_ops *ops;
reload_shared_libraries_1 (from_tty);
const char *name,
const domain_enum domain)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch ());
+ const struct target_so_ops *ops = solib_ops (target_gdbarch ());
if (ops->lookup_lib_global_symbol != NULL)
return ops->lookup_lib_global_symbol (objfile, name, domain);