contrib/gdb-7/gdb/python/py-auto-load.c
static void
source_section_scripts (struct objfile *objfile, const char *source_name,
			const char *start, const char *end)
{
  const char *p;
  struct auto_load_pspace_info *pspace_info;

  pspace_info = get_auto_load_pspace_data_for_loading (current_program_space);

  for (p = start; p < end; ++p)
    {
      const char *file;
      FILE *stream;
      char *full_path;
      int opened, in_hash_table;

      if (*p != 1)
	{
	  warning (_("Invalid entry in %s section"), GDBPY_AUTO_SECTION_NAME);
	  /* We could try various heuristics to find the next valid entry,
	     but it's safer to just punt.  */
	  break;
	}
      file = ++p;

      while (p < end && *p != '\0')
	++p;
      if (p == end)
	{
	  char *buf = alloca (p - file + 1);

	  memcpy (buf, file, p - file);
	  buf[p - file] = '\0';
	  warning (_("Non-null-terminated path in %s: %s"),
		   source_name, buf);
	  /* Don't load it.  */
	  break;
	}
      if (p == file)
	{
	  warning (_("Empty path in %s"), source_name);
	  continue;
	}

      opened = find_and_open_script (file, 1 /*search_path*/,
				     &stream, &full_path);

      /* If one script isn't found it's not uncommon for more to not be
	 found either.  We don't want to print an error message for each
	 script, too much noise.  Instead, we print the warning once and tell
	 the user how to find the list of scripts that weren't loaded.

	 IWBN if complaints.c were more general-purpose.  */

      in_hash_table = maybe_add_script (pspace_info->loaded_scripts, file,
					opened ? full_path : NULL);

      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 section %s\n\
of file %s\n\
Use `info auto-load-scripts [REGEXP]' to list them."),
		       GDBPY_AUTO_SECTION_NAME, objfile->name);
	      pspace_info->script_not_found_warning_printed = TRUE;
	    }
	}
      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);
	}
    }
}
/* Load scripts specified in OBJFILE.
   START,END delimit a buffer containing a list of nul-terminated
   file names.
   SOURCE_NAME is used in error messages.

   Scripts are found per normal "source -s" command processing.
   First the script is looked for in $cwd.  If not found there the
   source search path is used.

   The section contains a list of path names of files containing
   python code to load.  Each path is null-terminated.  */
Load scripts specified in OBJFILE.
START,END delimit a buffer containing a list of nul-terminated
file names.
SOURCE_NAME is used in error messages.

Scripts are found per normal "source -s" command processing.
First the script is looked for in $cwd.  If not found there the
source search path is used.

The section contains a list of path names of files containing
python code to load.  Each path is null-terminated.
Load scripts specified in OBJFILE . START END delimit a buffer containing a list of nul - terminated file names . SOURCE_NAME is used in error messages . Scripts are found per normal " source - s " command processing . First the script is looked for in $cwd . If not found there the source search path is used . The section contains a list of path names of files containing python code to load . Each path is null - terminated .
static void
source_section_scripts (struct objfile *objfile, const char *source_name,
			const char *start, const char *end)
{
  const char *p;
  struct auto_load_pspace_info *pspace_info;
  pspace_info = get_auto_load_pspace_data_for_loading (current_program_space);
  for (p = start; p < end; ++p)
    {
      const char *file;
      FILE *stream;
      char *full_path;
      int opened, in_hash_table;
      if (*p != 1)
	{
	  warning (_("Invalid entry in %s section"), GDBPY_AUTO_SECTION_NAME);
	  break;
	}
      file = ++p;
      while (p < end && *p != '\0')
	++p;
      if (p == end)
	{
	  char *buf = alloca (p - file + 1);
	  memcpy (buf, file, p - file);
	  buf[p - file] = '\0';
	  warning (_("Non-null-terminated path in %s: %s"),
		   source_name, buf);
	  break;
	}
      if (p == file)
	{
	  warning (_("Empty path in %s"), source_name);
	  continue;
	}
      opened = find_and_open_script (file, 1 ,
				     &stream, &full_path);
      in_hash_table = maybe_add_script (pspace_info->loaded_scripts, file,
					opened ? full_path : NULL);
      if (! opened)
	{
	  if (! pspace_info->script_not_found_warning_printed)
	    {
	      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, objfile->name);
	      pspace_info->script_not_found_warning_printed = TRUE;
	    }
	}
      else
	{
	  if (! in_hash_table)
	    source_python_script_for_objfile (objfile, full_path);
	  fclose (stream);
	  xfree (full_path);
	}
    }
}
static void source_section_scripts ( struct objfile * objfile , const char * source_name , const char * start , const char * end ) { const char * p ; struct auto_load_pspace_info * pspace_info ; pspace_info = get_auto_load_pspace_data_for_loading ( current_program_space ) ; for ( p = start ; p < end ; ++ p ) { const char * file ; FILE * stream ; char * full_path ; int opened , in_hash_table ; if ( * p != 1 ) { warning ( _ ( " " ) , GDBPY_AUTO_SECTION_NAME ) ; break ; } file = ++ p ; while ( p < end && * p != ' \0 ' ) ++ p ; if ( p == end ) { char * buf = alloca ( p - file + 1 ) ; memcpy ( buf , file , p - file ) ; buf [ p - file ] = ' \0 ' ; warning ( _ ( " " ) , source_name , buf ) ; break ; } if ( p == file ) { warning ( _ ( " " ) , source_name ) ; continue ; } opened = find_and_open_script ( file , 1 , & stream , & full_path ) ; in_hash_table = maybe_add_script ( pspace_info -> loaded_scripts , file , opened ? full_path : NULL ) ; if ( ! opened ) { if ( ! pspace_info -> script_not_found_warning_printed ) { warning ( _ ( " \n \
 \n \
 " ) , GDBPY_AUTO_SECTION_NAME , objfile -> name ) ; pspace_info -> script_not_found_warning_printed = TRUE ; } } else { if ( ! in_hash_table ) source_python_script_for_objfile ( objfile , full_path ) ; fclose ( stream ) ; xfree ( full_path ) ; } } }
Load scripts specified in OBJFILE.
Load scripts specified in OBJFILE .
/* We could try various heuristics to find the next valid entry,
	     but it's safer to just punt.  */ /* Don't load it.  */ /*search_path*/ /* If one script isn't found it's not uncommon for more to not be
	 found either.  We don't want to print an error message for each
	 script, too much noise.  Instead, we print the warning once and tell
	 the user how to find the list of scripts that weren't loaded.

	 IWBN if complaints.c were more general-purpose.  */ /* We don't throw an error, the program is still debuggable.  */ /* If this file is not currently loaded, load it.  */