in_hash_table = maybe_add_script (pspace_info->loaded_scripts, file,
opened ? full_path : NULL);
- if (opened)
- free (full_path);
-
if (! opened)
{
/* We don't throw an error, the program is still debuggable. */
if (! pspace_info->script_not_found_warning_printed)
{
- warning (_("Missing auto-load scripts referenced in %s.\n\
+ warning (_("Missing auto-load scripts referenced in section %s\n\
+of file %s\n\
Use `info auto-load-scripts [REGEXP]' to list them."),
- GDBPY_AUTO_SECTION_NAME);
+ GDBPY_AUTO_SECTION_NAME, objfile->name);
pspace_info->script_not_found_warning_printed = TRUE;
}
- continue;
}
-
- /* If this file is not currently loaded, load it. */
- if (! in_hash_table)
- source_python_script_for_objfile (objfile, stream, file);
+ else
+ {
+ /* If this file is not currently loaded, load it. */
+ if (! in_hash_table)
+ source_python_script_for_objfile (objfile, full_path);
+ fclose (stream);
+ xfree (full_path);
+ }
}
}
It's highly unlikely that we'd ever load it twice,
and these scripts are required to be idempotent under multiple
loads anyway. */
- source_python_script_for_objfile (objfile, input, debugfile);
+ source_python_script_for_objfile (objfile, debugfile);
fclose (input);
}
collect_matching_scripts (void **slot, void *info)
{
struct loaded_script *script = *slot;
- VEC (loaded_script_ptr) *scripts = info;
+ VEC (loaded_script_ptr) **scripts_ptr = info;
if (re_exec (script->name))
- VEC_safe_push (loaded_script_ptr, scripts, script);
+ VEC_safe_push (loaded_script_ptr, *scripts_ptr, script);
return 1;
}
static void
print_script (struct loaded_script *script)
{
+ struct ui_out *uiout = current_uiout;
struct cleanup *chain;
chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
- ui_out_field_string (uiout, "loaded", script->full_path ? "Yes" : "No");
+ ui_out_field_string (uiout, "loaded", script->full_path ? "Yes" : "Missing");
ui_out_field_string (uiout, "script", script->name);
ui_out_text (uiout, "\n");
static void
info_auto_load_scripts (char *pattern, int from_tty)
{
+ struct ui_out *uiout = current_uiout;
struct auto_load_pspace_info *pspace_info;
struct cleanup *script_chain;
VEC (loaded_script_ptr) *scripts;
if (pspace_info != NULL && pspace_info->loaded_scripts != NULL)
{
immediate_quit++;
+ /* Pass a pointer to scripts as VEC_safe_push can realloc space. */
htab_traverse_noresize (pspace_info->loaded_scripts,
- collect_matching_scripts, scripts);
+ collect_matching_scripts, &scripts);
immediate_quit--;
}
make_cleanup_ui_out_table_begin_end (uiout, 2, nr_scripts,
"AutoLoadedScriptsTable");
- ui_out_table_header (uiout, 6, ui_center, "loaded", "Loaded");
+ ui_out_table_header (uiout, 7, ui_left, "loaded", "Loaded");
ui_out_table_header (uiout, 70, ui_left, "script", "Script");
ui_out_table_body (uiout);