@@ -14059,9 +14059,9 @@ static struct cmd_list_element *show_ada_list;
/* This module's 'new_objfile' observer. */
static void
-ada_new_objfile_observer (struct objfile *objfile)
+ada_new_objfile_observer (struct objfile &objfile)
{
- ada_clear_symbol_cache (objfile->pspace ());
+ ada_clear_symbol_cache (objfile.pspace ());
}
/* This module's 'free_objfile' observer. */
@@ -1466,9 +1466,9 @@ ada_tasks_clear_pspace_data (program_space *pspace)
/* Called when a new objfile was added. */
static void
-ada_tasks_new_objfile_observer (objfile *objfile)
+ada_tasks_new_objfile_observer (objfile &objfile)
{
- ada_tasks_clear_pspace_data (objfile->pspace ());
+ ada_tasks_clear_pspace_data (objfile.pspace ());
}
/* The qcs command line flags for the "task apply" commands. Keep
@@ -62,7 +62,7 @@ set_can_use_agent (const char *args, int from_tty, struct cmd_list_element *c)
}
static void
-agent_new_objfile (struct objfile *objfile)
+agent_new_objfile (struct objfile &objfile)
{
if (agent_loaded_p ())
return;
@@ -70,7 +70,7 @@ agent_new_objfile (struct objfile *objfile)
if (can_use_agent == can_use_agent_off)
return;
- agent_look_up_symbols (objfile);
+ agent_look_up_symbols (&objfile);
}
INIT_GDB_FILE (agent)
@@ -1011,7 +1011,7 @@ pd_disable (inferior *inf)
for thread debugging. */
static void
-new_objfile (struct objfile *objfile)
+new_objfile (struct objfile &objfile)
{
pd_enable (current_inferior ());
}
@@ -2530,7 +2530,7 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
retrieval by the arm_find_exidx_entry routine. */
static void
-arm_exidx_new_objfile (struct objfile *objfile)
+arm_exidx_new_objfile (struct objfile &objfile)
{
struct arm_exidx_data *data;
asection *exidx, *extab;
@@ -2538,11 +2538,11 @@ arm_exidx_new_objfile (struct objfile *objfile)
LONGEST i;
/* If we've already touched this file, do nothing. */
- if (arm_exidx_data_key.get (objfile->obfd.get ()) != nullptr)
+ if (arm_exidx_data_key.get (objfile.obfd.get ()) != nullptr)
return;
/* Read contents of exception table and index. */
- exidx = bfd_get_section_by_name (objfile->obfd.get (),
+ exidx = bfd_get_section_by_name (objfile.obfd.get (),
ELF_STRING_ARM_unwind);
gdb::byte_vector exidx_data;
if (exidx)
@@ -2550,35 +2550,35 @@ arm_exidx_new_objfile (struct objfile *objfile)
exidx_vma = bfd_section_vma (exidx);
exidx_data.resize (bfd_section_size (exidx));
- if (!bfd_get_section_contents (objfile->obfd.get (), exidx,
+ if (!bfd_get_section_contents (objfile.obfd.get (), exidx,
exidx_data.data (), 0,
exidx_data.size ()))
return;
}
- extab = bfd_get_section_by_name (objfile->obfd.get (), ".ARM.extab");
+ extab = bfd_get_section_by_name (objfile.obfd.get (), ".ARM.extab");
gdb::byte_vector extab_data;
if (extab)
{
extab_vma = bfd_section_vma (extab);
extab_data.resize (bfd_section_size (extab));
- if (!bfd_get_section_contents (objfile->obfd.get (), extab,
+ if (!bfd_get_section_contents (objfile.obfd.get (), extab,
extab_data.data (), 0,
extab_data.size ()))
return;
}
/* Allocate exception table data structure. */
- data = &arm_exidx_data_key.emplace (objfile->obfd.get ());
- data->section_maps.resize (objfile->obfd->section_count);
+ data = &arm_exidx_data_key.emplace (objfile.obfd.get ());
+ data->section_maps.resize (objfile.obfd->section_count);
/* Fill in exception table. */
for (i = 0; i < exidx_data.size () / 8; i++)
{
struct arm_exidx_entry new_exidx_entry;
- bfd_vma idx = bfd_h_get_32 (objfile->obfd, exidx_data.data () + i * 8);
- bfd_vma val = bfd_h_get_32 (objfile->obfd,
+ bfd_vma idx = bfd_h_get_32 (objfile.obfd, exidx_data.data () + i * 8);
+ bfd_vma val = bfd_h_get_32 (objfile.obfd,
exidx_data.data () + i * 8 + 4);
bfd_vma addr = 0, word = 0;
int n_bytes = 0, n_words = 0;
@@ -2590,7 +2590,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
idx += exidx_vma + i * 8;
/* Find section containing function and compute section offset. */
- sec = arm_obj_section_from_vma (objfile, idx);
+ sec = arm_obj_section_from_vma (&objfile, idx);
if (sec == NULL)
continue;
idx -= bfd_section_vma (sec->the_bfd_section);
@@ -2615,7 +2615,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
if (addr >= extab_vma && addr + 4 <= extab_vma + extab_data.size ())
{
- word = bfd_h_get_32 (objfile->obfd,
+ word = bfd_h_get_32 (objfile.obfd,
extab_data.data () + addr - extab_vma);
addr += 4;
@@ -2643,7 +2643,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
/* Check whether we've got one of the variants of the
GNU personality routines. */
- pers_sec = arm_obj_section_from_vma (objfile, pers);
+ pers_sec = arm_obj_section_from_vma (&objfile, pers);
if (pers_sec)
{
static const char *personality[] =
@@ -2660,7 +2660,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
for (k = 0; personality[k]; k++)
if (lookup_minimal_symbol_by_pc_name
- (pc, personality[k], objfile))
+ (pc, personality[k], &objfile))
{
gnu_personality = 1;
break;
@@ -2673,7 +2673,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
if (gnu_personality
&& addr + 4 <= extab_vma + extab_data.size ())
{
- word = bfd_h_get_32 (objfile->obfd,
+ word = bfd_h_get_32 (objfile.obfd,
(extab_data.data ()
+ addr - extab_vma));
addr += 4;
@@ -2696,7 +2696,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
if (n_bytes || n_words)
{
gdb_byte *p = entry
- = (gdb_byte *) obstack_alloc (&objfile->per_bfd->storage_obstack,
+ = (gdb_byte *) obstack_alloc (&objfile.per_bfd->storage_obstack,
n_bytes + n_words * 4 + 1);
while (n_bytes--)
@@ -2704,7 +2704,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
while (n_words--)
{
- word = bfd_h_get_32 (objfile->obfd,
+ word = bfd_h_get_32 (objfile.obfd,
extab_data.data () + addr - extab_vma);
addr += 4;
@@ -1199,23 +1199,23 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
2) from .debug_gdb_scripts section */
void
-load_auto_scripts_for_objfile (struct objfile *objfile)
+load_auto_scripts_for_objfile (struct objfile &objfile)
{
/* Return immediately if auto-loading has been globally disabled.
This is to handle sequencing of operations during gdb startup.
Also return immediately if OBJFILE was not created from a file
on the local filesystem. */
if (!global_auto_load
- || (objfile->flags & OBJF_NOT_FILENAME) != 0
- || is_target_filename (objfile->original_name))
+ || (objfile.flags & OBJF_NOT_FILENAME) != 0
+ || is_target_filename (objfile.original_name))
return;
/* Load any extension language scripts for this objfile.
E.g., foo-gdb.gdb, foo-gdb.py. */
- auto_load_ext_lang_scripts_for_objfile (objfile);
+ auto_load_ext_lang_scripts_for_objfile (&objfile);
/* Load any scripts mentioned in AUTO_SECTION_NAME (.debug_gdb_scripts). */
- auto_load_section_scripts (objfile, AUTO_SECTION_NAME);
+ auto_load_section_scripts (&objfile, AUTO_SECTION_NAME);
}
/* Collect scripts to be printed in a vec. */
@@ -54,7 +54,7 @@ extern struct auto_load_pspace_info *
get_auto_load_pspace_data_for_loading (struct program_space *pspace);
extern void auto_load_objfile_script (struct objfile *objfile,
const struct extension_language_defn *);
-extern void load_auto_scripts_for_objfile (struct objfile *objfile);
+extern void load_auto_scripts_for_objfile (struct objfile &objfile);
extern char auto_load_info_scripts_pattern_nl[];
extern void auto_load_info_scripts (program_space *pspace, const char *pattern,
int from_tty,
@@ -1269,7 +1269,7 @@ check_for_thread_db (void)
/* This function is called via the new_objfile observer. */
static void
-thread_db_new_objfile (struct objfile *objfile)
+thread_db_new_objfile (struct objfile &objfile)
{
/* This observer must always be called with inferior_ptid set
correctly. */
@@ -1279,7 +1279,7 @@ thread_db_new_objfile (struct objfile *objfile)
the time gdb::observers::new_objfile.notify is called for the library itself.
Static executables have their separate debug info loaded already
before the inferior has started. */
- objfile->separate_debug_objfile_backlink == NULL
+ objfile.separate_debug_objfile_backlink == NULL
/* Only check for thread_db if we loaded libpthread,
or if this is the main symbol file.
We need to check OBJF_MAINLINE to handle the case of debugging
@@ -1288,8 +1288,8 @@ thread_db_new_objfile (struct objfile *objfile)
For dynamically linked executables, libpthread can be near the end
of the list of shared libraries to load, and in an app of several
thousand shared libraries, this can otherwise be painful. */
- && ((objfile->flags & OBJF_MAINLINE) != 0
- || libpthread_objfile_p (objfile)))
+ && ((objfile.flags & OBJF_MAINLINE) != 0
+ || libpthread_objfile_p (&objfile)))
check_for_thread_db ();
}
@@ -1336,7 +1336,7 @@ captured_main_1 (struct captured_main_args *context)
path in local_gdbinit. */
global_auto_load = save_auto_load;
for (objfile &objfile : current_program_space->objfiles ())
- load_auto_scripts_for_objfile (&objfile);
+ load_auto_scripts_for_objfile (objfile);
/* Process '-x' and '-ex' options. */
execute_cmdargs (&cmdarg_vec, CMDARG_FILE, CMDARG_COMMAND, &ret);
@@ -112,7 +112,7 @@ extern observable<program_space *, const solib &/* solib */,
bool /* still_in_use */, bool /* silent */> solib_unloaded;
/* The symbol file specified by OBJFILE has been loaded. */
-extern observable<struct objfile */* objfile */> new_objfile;
+extern observable<struct objfile &/* objfile */> new_objfile;
/* All objfiles from PSPACE were removed. */
extern observable<program_space */* pspace */> all_objfiles_removed;
@@ -163,19 +163,18 @@ python_inferior_exit (struct inferior *inf)
gdbpy_print_stack ();
}
-/* Callback used to notify Python listeners about new objfiles loaded in the
- inferior. OBJFILE may be NULL which means that the objfile list has been
- cleared (emptied). */
+/* Callback used to notify Python listeners that OBJFILE has been loaded in
+ to the current inferior. */
static void
-python_new_objfile (struct objfile *objfile)
+python_new_objfile (struct objfile &objfile)
{
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (objfile->arch ());
+ gdbpy_enter enter_py (objfile.arch ());
- if (emit_new_objfile_event (objfile) < 0)
+ if (emit_new_objfile_event (&objfile) < 0)
gdbpy_print_stack ();
}
@@ -16226,9 +16226,9 @@ remote_objfile_changed_check_symbols (program_space *pspace)
/* Function to be called whenever a new objfile (shlib) is detected. */
static void
-remote_new_objfile (struct objfile *objfile)
+remote_new_objfile (struct objfile &objfile)
{
- remote_objfile_changed_check_symbols (objfile->pspace ());
+ remote_objfile_changed_check_symbols (objfile.pspace ());
}
/* Pull all the tracepoints defined on the target and create local
@@ -666,7 +666,7 @@ check_for_thread_db (void)
the library gets mapped and the symbol table is read in. */
static void
-sol_thread_new_objfile (struct objfile *objfile)
+sol_thread_new_objfile (struct objfile &objfile)
{
check_for_thread_db ();
}
@@ -1102,7 +1102,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
if (objfile->sf != nullptr)
finish_new_objfile (objfile, add_flags);
- gdb::observers::new_objfile.notify (objfile);
+ gdb::observers::new_objfile.notify (*objfile);
return objfile;
}
@@ -2662,11 +2662,11 @@ reread_symbols (int from_tty)
{
clear_symtab_users (0);
- /* The registry for each objfile was cleared and
- gdb::observers::new_objfile.notify (NULL) has been called by
+ /* The registry for each objfile was cleared and the
+ all_objfiles_removed observer was notified by the call to
clear_symtab_users above. Notify the new files now. */
for (auto iter : new_objfiles)
- gdb::observers::new_objfile.notify (iter);
+ gdb::observers::new_objfile.notify (*iter);
}
}
@@ -1698,9 +1698,9 @@ maintenance_print_symbol_cache_statistics (const char *args, int from_tty)
/* This module's 'new_objfile' observer. */
static void
-symtab_new_objfile_observer (struct objfile *objfile)
+symtab_new_objfile_observer (struct objfile &objfile)
{
- symbol_cache_flush (objfile->pspace ());
+ symbol_cache_flush (objfile.pspace ());
}
/* This module's 'all_objfiles_removed' observer. */
@@ -38,7 +38,7 @@
#include "tui/tui-wingeneral.h"
static void
-tui_new_objfile_hook (struct objfile* objfile)
+tui_new_objfile_hook (struct objfile &objfile)
{
if (tui_active)
tui_display_main ();