Example #1
0
static int
debug_qf_map_symtabs_matching_filename (struct objfile *objfile,
					const char *name,
					const char *real_path,
					int (*callback) (struct symtab *,
							 void *),
					void *data)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);
  int retval;

  fprintf_filtered (gdb_stdlog,
		    "qf->map_symtabs_matching_filename (%s, \"%s\", \"%s\", %s, %s)\n",
		    objfile_debug_name (objfile), name,
		    real_path ? real_path : NULL,
		    host_address_to_string (callback),
		    host_address_to_string (data));

  retval = debug_data->real_sf->qf->map_symtabs_matching_filename
    (objfile, name, real_path, callback, data);

  fprintf_filtered (gdb_stdlog,
		    "qf->map_symtabs_matching_filename (...) = %d\n",
		    retval);

  return retval;
}
Example #2
0
static void
debug_qf_expand_all_symtabs (struct objfile *objfile)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);

  fprintf_filtered (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
		    objfile_debug_name (objfile));

  debug_data->real_sf->qf->expand_all_symtabs (objfile);
}
Example #3
0
static void
debug_qf_forget_cached_source_info (struct objfile *objfile)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);

  fprintf_filtered (gdb_stdlog, "qf->forget_cached_source_info (%s)\n",
		    objfile_debug_name (objfile));

  debug_data->real_sf->qf->forget_cached_source_info (objfile);
}
Example #4
0
static void
debug_qf_expand_symtabs_with_fullname (struct objfile *objfile,
				       const char *fullname)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);

  fprintf_filtered (gdb_stdlog,
		    "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
		    objfile_debug_name (objfile), fullname);

  debug_data->real_sf->qf->expand_symtabs_with_fullname (objfile, fullname);
}
Example #5
0
static int
debug_qf_has_symbols (struct objfile *objfile)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);
  int retval;

  retval = debug_data->real_sf->qf->has_symbols (objfile);

  fprintf_filtered (gdb_stdlog, "qf->has_symbols (%s) = %d\n",
		    objfile_debug_name (objfile), retval);

  return retval;
}
Example #6
0
static void
debug_qf_relocate (struct objfile *objfile,
		   const struct section_offsets *new_offsets,
		   const struct section_offsets *delta)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);

  fprintf_filtered (gdb_stdlog, "qf->relocate (%s, %s, %s)\n",
		    objfile_debug_name (objfile),
		    host_address_to_string (new_offsets),
		    host_address_to_string (delta));

  debug_data->real_sf->qf->relocate (objfile, new_offsets, delta);
}
Example #7
0
static struct symtab *
debug_qf_find_last_source_symtab (struct objfile *objfile)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);
  struct symtab *retval;

  fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (%s)\n",
		    objfile_debug_name (objfile));

  retval = debug_data->real_sf->qf->find_last_source_symtab (objfile);

  fprintf_filtered (gdb_stdlog, "qf->find_last_source_symtab (...) = %s\n",
		    retval ? debug_symtab_name (retval) : "NULL");

  return retval;
}
Example #8
0
static struct compunit_symtab *
debug_qf_lookup_symbol (struct objfile *objfile, int kind, const char *name,
			domain_enum domain)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);
  struct compunit_symtab *retval;

  fprintf_filtered (gdb_stdlog,
		    "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
		    objfile_debug_name (objfile), kind, name,
		    domain_name (domain));

  retval = debug_data->real_sf->qf->lookup_symbol (objfile, kind, name,
						   domain);

  fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
		    retval
		    ? debug_symtab_name (compunit_primary_filetab (retval))
		    : "NULL");

  return retval;
}
Example #9
0
struct bound_minimal_symbol
lookup_minimal_symbol (const char *name, const char *sfile,
		       struct objfile *objf)
{
  struct objfile *objfile;
  found_minimal_symbols found;

  unsigned int mangled_hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;

  auto *mangled_cmp
    = (case_sensitivity == case_sensitive_on
       ? strcmp
       : strcasecmp);

  if (sfile != NULL)
    sfile = lbasename (sfile);

  lookup_name_info lookup_name (name, symbol_name_match_type::FULL);

  for (objfile = object_files;
       objfile != NULL && found.external_symbol.minsym == NULL;
       objfile = objfile->next)
    {
      if (objf == NULL || objf == objfile
	  || objf == objfile->separate_debug_objfile_backlink)
	{
	  if (symbol_lookup_debug)
	    {
	      fprintf_unfiltered (gdb_stdlog,
				  "lookup_minimal_symbol (%s, %s, %s)\n",
				  name, sfile != NULL ? sfile : "NULL",
				  objfile_debug_name (objfile));
	    }

	  /* Do two passes: the first over the ordinary hash table,
	     and the second over the demangled hash table.  */
	  lookup_minimal_symbol_mangled (name, sfile, objfile,
					 objfile->per_bfd->msymbol_hash,
					 mangled_hash, mangled_cmp, found);

	  /* If not found, try the demangled hash table.  */
	  if (found.external_symbol.minsym == NULL)
	    {
	      /* Once for each language in the demangled hash names
		 table (usually just zero or one languages).  */
	      for (auto lang : objfile->per_bfd->demangled_hash_languages)
		{
		  unsigned int hash
		    = (lookup_name.search_name_hash (lang)
		       % MINIMAL_SYMBOL_HASH_SIZE);

		  symbol_name_matcher_ftype *match
		    = get_symbol_name_matcher (language_def (lang),
					       lookup_name);
		  struct minimal_symbol **msymbol_demangled_hash
		    = objfile->per_bfd->msymbol_demangled_hash;

		  lookup_minimal_symbol_demangled (lookup_name, sfile, objfile,
						   msymbol_demangled_hash,
						   hash, match, found);

		  if (found.external_symbol.minsym != NULL)
		    break;
		}
	    }
	}
    }

  /* External symbols are best.  */
  if (found.external_symbol.minsym != NULL)
    {
      if (symbol_lookup_debug)
	{
	  minimal_symbol *minsym = found.external_symbol.minsym;

	  fprintf_unfiltered (gdb_stdlog,
			      "lookup_minimal_symbol (...) = %s (external)\n",
			      host_address_to_string (minsym));
	}
      return found.external_symbol;
    }

  /* File-local symbols are next best.  */
  if (found.file_symbol.minsym != NULL)
    {
      if (symbol_lookup_debug)
	{
	  minimal_symbol *minsym = found.file_symbol.minsym;

	  fprintf_unfiltered (gdb_stdlog,
			      "lookup_minimal_symbol (...) = %s (file-local)\n",
			      host_address_to_string (minsym));
	}
      return found.file_symbol;
    }

  /* Symbols for shared library trampolines are next best.  */
  if (found.trampoline_symbol.minsym != NULL)
    {
      if (symbol_lookup_debug)
	{
	  minimal_symbol *minsym = found.trampoline_symbol.minsym;

	  fprintf_unfiltered (gdb_stdlog,
			      "lookup_minimal_symbol (...) = %s (trampoline)\n",
			      host_address_to_string (minsym));
	}

      return found.trampoline_symbol;
    }

  /* Not found.  */
  if (symbol_lookup_debug)
    fprintf_unfiltered (gdb_stdlog, "lookup_minimal_symbol (...) = NULL\n");
  return {};
}
Example #10
0
static void
debug_qf_map_matching_symbols (struct objfile *objfile,
			       const char *name, domain_enum namespace,
			       int global,
			       int (*callback) (struct block *,
						struct symbol *, void *),
			       void *data,
			       symbol_compare_ftype *match,
			       symbol_compare_ftype *ordered_compare)
{
  const struct debug_sym_fns_data *debug_data =
    objfile_data (objfile, symfile_debug_objfile_data_key);

  fprintf_filtered (gdb_stdlog,
		    "qf->map_matching_symbols (%s, \"%s\", %s, %d, %s, %s, %s, %s)\n",
		    objfile_debug_name (objfile), name,
		    domain_name (namespace), global,
		    host_address_to_string (callback),
		    host_address_to_string (data),
		    host_address_to_string (match),
		    host_address_to_string (ordered_compare));

  debug_data->real_sf->qf->map_matching_symbols (objfile, name,
						 namespace, global,
						 callback, data,
						 match,
						 ordered_compare);
}

static void
debug_qf_expand_symtabs_matching