contrib/gdb-7/gdb/linespec.c
static VEC (symtab_p) *
symtabs_from_filename (char **argptr, char *p, int is_quote_enclosed,
		       char **user_filename)
{
  char *p1;
  char *copy;
  struct cleanup *outer;
  VEC (symtab_p) *result;
  
  p1 = p;
  while (p != *argptr && p[-1] == ' ')
    --p;
  if ((*p == '"') && is_quote_enclosed)
    --p;
  copy = xmalloc (p - *argptr + 1);
  outer = make_cleanup (xfree, copy);
  memcpy (copy, *argptr, p - *argptr);
  /* It may have the ending quote right after the file name.  */
  if ((is_quote_enclosed && copy[p - *argptr - 1] == '"')
      || copy[p - *argptr - 1] == '\'')
    copy[p - *argptr - 1] = 0;
  else
    copy[p - *argptr] = 0;

  result = collect_symtabs_from_filename (copy);

  if (VEC_empty (symtab_p, result))
    {
      if (!have_full_symbols () && !have_partial_symbols ())
	throw_error (NOT_FOUND_ERROR,
		     _("No symbol table is loaded.  "
		       "Use the \"file\" command."));
      throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy);
    }

  /* Discard the file name from the arg.  */
  if (*p1 == '\0')
    *argptr = p1;
  else
    *argptr = skip_spaces (p1 + 1);

  discard_cleanups (outer);
  *user_filename = copy;
  return result;
}
/* Return all the symtabs associated to the filename given by the
   substring of *ARGPTR ending at P, and advance ARGPTR past that
   filename.  */
Return all the symtabs associated to the filename given by the
substring of *ARGPTR ending at P, and advance ARGPTR past that
filename.
Return all the symtabs associated to the filename given by the substring of * ARGPTR ending at P and advance ARGPTR past that filename .
static VEC (symtab_p) *
symtabs_from_filename (char **argptr, char *p, int is_quote_enclosed,
		       char **user_filename)
{
  char *p1;
  char *copy;
  struct cleanup *outer;
  VEC (symtab_p) *result;
  p1 = p;
  while (p != *argptr && p[-1] == ' ')
    --p;
  if ((*p == '"') && is_quote_enclosed)
    --p;
  copy = xmalloc (p - *argptr + 1);
  outer = make_cleanup (xfree, copy);
  memcpy (copy, *argptr, p - *argptr);
  if ((is_quote_enclosed && copy[p - *argptr - 1] == '"')
      || copy[p - *argptr - 1] == '\'')
    copy[p - *argptr - 1] = 0;
  else
    copy[p - *argptr] = 0;
  result = collect_symtabs_from_filename (copy);
  if (VEC_empty (symtab_p, result))
    {
      if (!have_full_symbols () && !have_partial_symbols ())
	throw_error (NOT_FOUND_ERROR,
		     _("No symbol table is loaded.  "
		       "Use the \"file\" command."));
      throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy);
    }
  if (*p1 == '\0')
    *argptr = p1;
  else
    *argptr = skip_spaces (p1 + 1);
  discard_cleanups (outer);
  *user_filename = copy;
  return result;
}
static VEC ( symtab_p ) * symtabs_from_filename ( char * * argptr , char * p , int is_quote_enclosed , char * * user_filename ) { char * p1 ; char * copy ; struct cleanup * outer ; VEC ( symtab_p ) * result ; p1 = p ; while ( p != * argptr && p [ -1 ] == ' ' ) -- p ; if ( ( * p == ' ' ) && is_quote_enclosed ) -- p ; copy = xmalloc ( p - * argptr + 1 ) ; outer = make_cleanup ( xfree , copy ) ; memcpy ( copy , * argptr , p - * argptr ) ; if ( ( is_quote_enclosed && copy [ p - * argptr - 1 ] == ' ' ) || copy [ p - * argptr - 1 ] == ' \' ' ) copy [ p - * argptr - 1 ] = 0 ; else copy [ p - * argptr ] = 0 ; result = collect_symtabs_from_filename ( copy ) ; if ( VEC_empty ( symtab_p , result ) ) { if ( ! have_full_symbols ( ) && ! have_partial_symbols ( ) ) throw_error ( NOT_FOUND_ERROR , _ ( " " " \" \" " ) ) ; throw_error ( NOT_FOUND_ERROR , _ ( " " ) , copy ) ; } if ( * p1 == ' \0 ' ) * argptr = p1 ; else * argptr = skip_spaces ( p1 + 1 ) ; discard_cleanups ( outer ) ; * user_filename = copy ; return result ; }
Return all the symtabs associated to the filename given by the
substring of *ARGPTR ending at P, and advance ARGPTR past that
filename.
Return all the symtabs associated to the filename given by the substring of * ARGPTR ending at P and advance ARGPTR past that filename .
/* It may have the ending quote right after the file name.  */ /* Discard the file name from the arg.  */