static int
lookup_symtab_callback (struct symtab *symtab, void *data)
{
- struct symtab **result_ptr = data;
+ struct symtab **result_ptr = (struct symtab **) data;
*result_ptr = symtab;
return 1;
else
{
gsymbol->ada_mangled = 1;
- gsymbol->language_specific.mangled_lang.demangled_name = name;
+ gsymbol->language_specific.demangled_name = name;
}
}
else
- gsymbol->language_specific.mangled_lang.demangled_name = name;
+ gsymbol->language_specific.demangled_name = name;
}
/* Return the demangled name of GSYMBOL. */
/* Fall through. */
}
- return gsymbol->language_specific.mangled_lang.demangled_name;
+ return gsymbol->language_specific.demangled_name;
}
\f
static hashval_t
hash_demangled_name_entry (const void *data)
{
- const struct demangled_name_entry *e = data;
+ const struct demangled_name_entry *e
+ = (const struct demangled_name_entry *) data;
return htab_hash_string (e->mangled);
}
static int
eq_demangled_name_entry (const void *a, const void *b)
{
- const struct demangled_name_entry *da = a;
- const struct demangled_name_entry *db = b;
+ const struct demangled_name_entry *da
+ = (const struct demangled_name_entry *) a;
+ const struct demangled_name_entry *db
+ = (const struct demangled_name_entry *) b;
return strcmp (da->mangled, db->mangled) == 0;
}
gsymbol->name = linkage_name;
else
{
- char *name = obstack_alloc (&per_bfd->storage_obstack, len + 1);
+ char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
+ len + 1);
memcpy (name, linkage_name, len);
name[len] = '\0';
char *alloc_name;
lookup_len = len + JAVA_PREFIX_LEN;
- alloc_name = alloca (lookup_len + 1);
+ alloc_name = (char *) alloca (lookup_len + 1);
memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN);
memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len);
alloc_name[lookup_len] = '\0';
char *alloc_name;
lookup_len = len;
- alloc_name = alloca (lookup_len + 1);
+ alloc_name = (char *) alloca (lookup_len + 1);
memcpy (alloc_name, linkage_name, len);
alloc_name[lookup_len] = '\0';
us better bcache hit rates for partial symbols. */
if (!copy_name && lookup_name == linkage_name)
{
- *slot = obstack_alloc (&per_bfd->storage_obstack,
- offsetof (struct demangled_name_entry,
- demangled)
- + demangled_len + 1);
+ *slot
+ = ((struct demangled_name_entry *)
+ obstack_alloc (&per_bfd->storage_obstack,
+ offsetof (struct demangled_name_entry, demangled)
+ + demangled_len + 1));
(*slot)->mangled = lookup_name;
}
else
/* If we must copy the mangled name, put it directly after
the demangled name so we can have a single
allocation. */
- *slot = obstack_alloc (&per_bfd->storage_obstack,
- offsetof (struct demangled_name_entry,
- demangled)
- + lookup_len + demangled_len + 2);
+ *slot
+ = ((struct demangled_name_entry *)
+ obstack_alloc (&per_bfd->storage_obstack,
+ offsetof (struct demangled_name_entry, demangled)
+ + lookup_len + demangled_len + 2));
mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
strcpy (mangled_ptr, lookup_name);
(*slot)->mangled = mangled_ptr;
{
size_t total_size = symbol_cache_byte_size (new_size);
- cache->global_symbols = xcalloc (1, total_size);
- cache->static_symbols = xcalloc (1, total_size);
+ cache->global_symbols
+ = (struct block_symbol_cache *) xcalloc (1, total_size);
+ cache->static_symbols
+ = (struct block_symbol_cache *) xcalloc (1, total_size);
cache->global_symbols->size = new_size;
cache->static_symbols->size = new_size;
}
static struct symbol_cache *
get_symbol_cache (struct program_space *pspace)
{
- struct symbol_cache *cache = program_space_data (pspace, symbol_cache_key);
+ struct symbol_cache *cache
+ = (struct symbol_cache *) program_space_data (pspace, symbol_cache_key);
if (cache == NULL)
{
static void
symbol_cache_cleanup (struct program_space *pspace, void *data)
{
- struct symbol_cache *cache = data;
+ struct symbol_cache *cache = (struct symbol_cache *) data;
free_symbol_cache (cache);
}
ALL_PSPACES (pspace)
{
struct symbol_cache *cache
- = program_space_data (pspace, symbol_cache_key);
+ = (struct symbol_cache *) program_space_data (pspace, symbol_cache_key);
/* The pspace could have been created but not have a cache yet. */
if (cache != NULL)
static void
symbol_cache_flush (struct program_space *pspace)
{
- struct symbol_cache *cache = program_space_data (pspace, symbol_cache_key);
+ struct symbol_cache *cache
+ = (struct symbol_cache *) program_space_data (pspace, symbol_cache_key);
int pass;
size_t total_size;
: "(no object file)");
/* If the cache hasn't been created yet, avoid creating one. */
- cache = program_space_data (pspace, symbol_cache_key);
+ cache
+ = (struct symbol_cache *) program_space_data (pspace, symbol_cache_key);
if (cache == NULL)
printf_filtered (" <empty>\n");
else
: "(no object file)");
/* If the cache hasn't been created yet, avoid creating one. */
- cache = program_space_data (pspace, symbol_cache_key);
+ cache
+ = (struct symbol_cache *) program_space_data (pspace, symbol_cache_key);
if (cache == NULL)
printf_filtered (" empty, no stats available\n");
else
&& (COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (sal.symtab))
|| SYMTAB_LANGUAGE (sal.symtab) == language_asm))
{
+ struct gdbarch *gdbarch = symbol_arch (sym);
+
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
+ if (gdbarch_skip_entrypoint_p (gdbarch))
+ sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
return sal;
}
static struct filename_seen_cache *
create_filename_seen_cache (void)
{
- struct filename_seen_cache *cache;
+ struct filename_seen_cache *cache = XNEW (struct filename_seen_cache);
- cache = XNEW (struct filename_seen_cache);
cache->tab = htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE,
filename_hash, filename_eq,
NULL, xcalloc, xfree);
static void
delete_filename_seen_cache (void *ptr)
{
- struct filename_seen_cache *cache = ptr;
+ struct filename_seen_cache *cache = (struct filename_seen_cache *) ptr;
htab_delete (cache->tab);
xfree (cache);
output_partial_symbol_filename (const char *filename, const char *fullname,
void *data)
{
- output_source_filename (fullname ? fullname : filename, data);
+ output_source_filename (fullname ? fullname : filename,
+ (struct output_source_filename_data *) data);
}
static void
gdb_assert (found != NULL && nfound > 0);
/* Build an array out of the list so we can easily sort them. */
- symbols = (struct symbol_search **) xmalloc (sizeof (struct symbol_search *)
- * nfound);
+ symbols = XNEWVEC (struct symbol_search *, nfound);
+
symp = found;
for (i = 0; i < nfound; i++)
{
search_symbols_file_matches (const char *filename, void *user_data,
int basenames)
{
- struct search_symbols_data *data = user_data;
+ struct search_symbols_data *data = (struct search_symbols_data *) user_data;
return file_matches (filename, data->files, data->nfiles, basenames);
}
static int
search_symbols_name_matches (const char *symname, void *user_data)
{
- struct search_symbols_data *data = user_data;
+ struct search_symbols_data *data = (struct search_symbols_data *) user_data;
return !data->preg_p || regexec (&data->preg, symname, 0, NULL, 0) == 0;
}
&& SYMBOL_CLASS (sym) == LOC_TYPEDEF))))
{
/* match */
- struct symbol_search *psr = (struct symbol_search *)
- xmalloc (sizeof (struct symbol_search));
+ struct symbol_search *psr = XCNEW (struct symbol_search);
+
psr->block = i;
psr->symbol = sym;
- memset (&psr->msymbol, 0, sizeof (psr->msymbol));
psr->next = NULL;
if (tail == NULL)
found = psr;
.symbol == NULL)
{
/* match */
- struct symbol_search *psr = (struct symbol_search *)
- xmalloc (sizeof (struct symbol_search));
+ struct symbol_search *psr = XNEW (struct symbol_search);
psr->block = i;
psr->msymbol.minsym = msymbol;
psr->msymbol.objfile = objfile;
char *local_name;
colon_index = colon - regexp;
- local_name = alloca (colon_index + 1);
+ local_name = (char *) alloca (colon_index + 1);
memcpy (local_name, regexp, colon_index);
local_name[colon_index--] = 0;
while (isspace (local_name[colon_index]))
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, fullname);
if (newlen > len)
{
- string = xrealloc (string, newlen);
+ string = (char *) xrealloc (string, newlen);
len = newlen;
}
strcpy (string, "'");
static void
do_free_completion_list (void *list)
{
- free_completion_list (list);
+ free_completion_list ((VEC (char_ptr) **) list);
}
/* Helper routine for make_symbol_completion_list. */
if (word == sym_text)
{
- newobj = xmalloc (strlen (symname) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + 5);
strcpy (newobj, symname);
}
else if (word > sym_text)
{
/* Return some portion of symname. */
- newobj = xmalloc (strlen (symname) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + 5);
strcpy (newobj, symname + (word - sym_text));
}
else
{
/* Return some of SYM_TEXT plus symname. */
- newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+ newobj = (char *) xmalloc (strlen (symname) + (sym_text - word) + 5);
strncpy (newobj, word, sym_text - word);
newobj[sym_text - word] = '\0';
strcat (newobj, symname);
tmplen = 1024;
else
tmplen *= 2;
- tmp = xrealloc (tmp, tmplen);
+ tmp = (char *) xrealloc (tmp, tmplen);
}
selector = strchr (method, ' ');
if (selector != NULL)
/* Like make_symbol_completion_list, but returns a list of symbols
defined in a source file FILE. */
-VEC (char_ptr) *
-make_file_symbol_completion_list (const char *text, const char *word,
- const char *srcfile)
+static VEC (char_ptr) *
+make_file_symbol_completion_list_1 (const char *text, const char *word,
+ const char *srcfile)
{
struct symbol *sym;
struct symtab *s;
sym_text_len = strlen (sym_text);
- return_val = NULL;
-
/* Find the symtab for SRCFILE (this loads it if it was not yet read
in). */
s = lookup_symtab (srcfile);
return (return_val);
}
+/* Wrapper around make_file_symbol_completion_list_1
+ to handle MAX_COMPLETIONS_REACHED_ERROR. */
+
+VEC (char_ptr) *
+make_file_symbol_completion_list (const char *text, const char *word,
+ const char *srcfile)
+{
+ struct cleanup *back_to, *cleanups;
+
+ completion_tracker = new_completion_tracker ();
+ cleanups = make_cleanup_free_completion_tracker (&completion_tracker);
+ return_val = NULL;
+ back_to = make_cleanup (do_free_completion_list, &return_val);
+
+ TRY
+ {
+ make_file_symbol_completion_list_1 (text, word, srcfile);
+ }
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
+ throw_exception (except);
+ }
+ END_CATCH
+
+ discard_cleanups (back_to);
+ do_cleanups (cleanups);
+ return return_val;
+}
+
/* A helper function for make_source_files_completion_list. It adds
another file name to a list of possible completions, growing the
list as necessary. */
if (word == text)
{
/* Return exactly fname. */
- newobj = xmalloc (fnlen + 5);
+ newobj = (char *) xmalloc (fnlen + 5);
strcpy (newobj, fname);
}
else if (word > text)
{
/* Return some portion of fname. */
- newobj = xmalloc (fnlen + 5);
+ newobj = (char *) xmalloc (fnlen + 5);
strcpy (newobj, fname + (word - text));
}
else
{
/* Return some of TEXT plus fname. */
- newobj = xmalloc (fnlen + (text - word) + 5);
+ newobj = (char *) xmalloc (fnlen + (text - word) + 5);
strncpy (newobj, word, text - word);
newobj[text - word] = '\0';
strcat (newobj, fname);
maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
void *user_data)
{
- struct add_partial_filename_data *data = user_data;
+ struct add_partial_filename_data *data
+ = (struct add_partial_filename_data *) user_data;
if (not_interesting_fname (filename))
return;
static struct main_info *
get_main_info (void)
{
- struct main_info *info = program_space_data (current_program_space,
+ struct main_info *info
+ = (struct main_info *) program_space_data (current_program_space,
main_progspace_key);
if (info == NULL)
static void
main_info_cleanup (struct program_space *pspace, void *data)
{
- struct main_info *info = data;
+ struct main_info *info = (struct main_info *) data;
if (info != NULL)
xfree (info->name_of_main);
int i;
for (i = 0; i < LOC_FINAL_VALUE; ++i)
- symbol_impl[i].aclass = i;
+ symbol_impl[i].aclass = (enum address_class) i;
}
\f