+
+ retval = 1;
+ }
+ else
+ retval = 0;
+
+ do_cleanups (cleanups);
+ return retval;
+}
+
+/* Look for the auto-load script in LANGUAGE associated with OBJFILE and load
+ it. */
+
+void
+auto_load_objfile_script (struct objfile *objfile,
+ const struct script_language *language)
+{
+ char *realname = gdb_realpath (objfile->name);
+ struct cleanup *cleanups = make_cleanup (xfree, realname);
+
+ if (!auto_load_objfile_script_1 (objfile, realname, language))
+ {
+ /* For Windows/DOS .exe executables, strip the .exe suffix, so that
+ FOO-gdb.gdb could be used for FOO.exe, and try again. */
+
+ size_t len = strlen (realname);
+ const size_t lexe = sizeof (".exe") - 1;
+
+ if (len > lexe && strcasecmp (realname + len - lexe, ".exe") == 0)
+ {
+ len -= lexe;
+ realname[len] = '\0';
+ if (debug_auto_load)
+ fprintf_unfiltered (gdb_stdlog, _("auto-load: Stripped .exe suffix, "
+ "retrying with \"%s\".\n"),
+ realname);
+ auto_load_objfile_script_1 (objfile, realname, language);
+ }