* core.c (core_create_function_syms): Move filename and func_name

inside ifdef where they are used.

	* core.c (core_sym_class): Parenthesize && within ||.
	* symtab.c (symtab_finalize): Correct parenthesization.

	* cg_print.h (cg_print_file_ordering): Declare.
	(cg_print_function_ordering): Declare.

	* __bb_exit_func.c (__bb_exit_func): Replace bcopy with memcpy.
	* cg_arcs.c (arc_add): Likewise.
	* cg_print.c (cg_print_function_ordering): Likewise.
This commit is contained in:
Ian Lance Taylor 1996-03-21 22:21:30 +00:00
parent 0f579087ab
commit df928c8f28
7 changed files with 47 additions and 27 deletions

View File

@ -1,3 +1,18 @@
Thu Mar 21 17:18:25 1996 Ian Lance Taylor <ian@cygnus.com>
* core.c (core_create_function_syms): Move filename and func_name
inside ifdef where they are used.
* core.c (core_sym_class): Parenthesize && within ||.
* symtab.c (symtab_finalize): Correct parenthesization.
* cg_print.h (cg_print_file_ordering): Declare.
(cg_print_function_ordering): Declare.
* __bb_exit_func.c (__bb_exit_func): Replace bcopy with memcpy.
* cg_arcs.c (arc_add): Likewise.
* cg_print.c (cg_print_function_ordering): Likewise.
Thu Mar 21 17:02:02 1996 David Mosberger-Tang <davidm@azstarnet.com> Thu Mar 21 17:02:02 1996 David Mosberger-Tang <davidm@azstarnet.com>
* gprof.c (default_excluded_list): Add "__mcount". * gprof.c (default_excluded_list): Add "__mcount".

View File

@ -54,8 +54,8 @@ __bb_exit_func (void)
perror(OUT_NAME); perror(OUT_NAME);
return; return;
} /* if */ } /* if */
bcopy(GMON_MAGIC, &ghdr.cookie[0], 4); memcpy(&ghdr.cookie[0], GMON_MAGIC, 4);
bcopy(&version, &ghdr.version, sizeof(version)); memcpy(&ghdr.version, &version, sizeof(version));
fwrite(&ghdr, sizeof(ghdr), 1, fp); fwrite(&ghdr, sizeof(ghdr), 1, fp);
for (ptr = __bb_head; ptr != 0; ptr = ptr->next) { for (ptr = __bb_head; ptr != 0; ptr = ptr->next) {

View File

@ -106,7 +106,7 @@ DEFUN (arc_add, (parent, child, count),
newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs); newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs);
/* Copy the old array's contents into the new array. */ /* Copy the old array's contents into the new array. */
bcopy (arcs, newarcs, numarcs * sizeof (Arc *)); memcpy (newarcs, arcs, numarcs * sizeof (Arc *));
/* Free up the old array. */ /* Free up the old array. */
free (arcs); free (arcs);

View File

@ -844,7 +844,7 @@ DEFUN_VOID (cg_print_function_ordering)
/* Now sort a temporary symbol table based on the number of /* Now sort a temporary symbol table based on the number of
times each function was used in the highest used arcs. */ times each function was used in the highest used arcs. */
bcopy (used_syms, scratch_syms, used * sizeof (Sym *)); memcpy (scratch_syms, used_syms, used * sizeof (Sym *));
qsort (scratch_syms, used, sizeof (Sym *), cmp_fun_nuses); qsort (scratch_syms, used, sizeof (Sym *), cmp_fun_nuses);
/* Now pick out those symbols we're going to emit as /* Now pick out those symbols we're going to emit as

View File

@ -8,5 +8,7 @@ extern double print_time; /* total of time being printed */
extern void cg_print PARAMS ((Sym ** cg)); extern void cg_print PARAMS ((Sym ** cg));
extern void cg_print_index PARAMS ((void)); extern void cg_print_index PARAMS ((void));
extern void cg_print_file_ordering PARAMS ((void));
extern void cg_print_function_ordering PARAMS ((void));
#endif /* cg_print_h */ #endif /* cg_print_h */

View File

@ -270,7 +270,7 @@ DEFUN (core_sym_class, (sym), asymbol * sym)
* other systems. Perhaps it should be made configurable. * other systems. Perhaps it should be made configurable.
*/ */
sym_prefix = bfd_get_symbol_leading_char (core_bfd); sym_prefix = bfd_get_symbol_leading_char (core_bfd);
if (sym_prefix && sym_prefix != sym->name[0] if ((sym_prefix && sym_prefix != sym->name[0])
/* /*
* GCC may add special symbols to help gdb figure out the file * GCC may add special symbols to help gdb figure out the file
* language. We want to ignore these, since sometimes they mask * language. We want to ignore these, since sometimes they mask
@ -332,7 +332,6 @@ void
DEFUN (core_create_function_syms, (core_bfd), bfd * core_bfd) DEFUN (core_create_function_syms, (core_bfd), bfd * core_bfd)
{ {
bfd_vma min_vma = ~0, max_vma = 0; bfd_vma min_vma = ~0, max_vma = 0;
const char *filename, *func_name;
int class; int class;
long i, j, found, skip; long i, j, found, skip;
@ -431,24 +430,28 @@ DEFUN (core_create_function_syms, (core_bfd), bfd * core_bfd)
* labels do not appear in the symbol table info, so this isn't * labels do not appear in the symbol table info, so this isn't
* necessary. * necessary.
*/ */
if (get_src_info (symtab.limit->addr, &filename, &func_name, {
&symtab.limit->line_num)) const char *filename, *func_name;
{
symtab.limit->file = source_file_lookup_path (filename);
if (strcmp (symtab.limit->name, func_name) != 0) if (get_src_info (symtab.limit->addr, &filename, &func_name,
{ &symtab.limit->line_num))
/* {
* The symbol's address maps to a different name, so symtab.limit->file = source_file_lookup_path (filename);
* it can't be a function-entry point. This happens
* for labels, for example. if (strcmp (symtab.limit->name, func_name) != 0)
*/ {
DBG (AOUTDEBUG, /*
printf ("[core_create_function_syms: rej %s (maps to %s)\n", * The symbol's address maps to a different name, so
symtab.limit->name, func_name)); * it can't be a function-entry point. This happens
continue; * for labels, for example.
} */
} DBG (AOUTDEBUG,
printf ("[core_create_function_syms: rej %s (maps to %s)\n",
symtab.limit->name, func_name));
continue;
}
}
}
#endif #endif
symtab.limit->is_func = TRUE; symtab.limit->is_func = TRUE;

View File

@ -93,10 +93,10 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab)
* symbols (such as __gnu_compiled, __c89_used, etc.). * symbols (such as __gnu_compiled, __c89_used, etc.).
*/ */
if ((!src->is_static && dst[-1].is_static) if ((!src->is_static && dst[-1].is_static)
|| ((src->is_static == dst[-1].is_static) && || ((src->is_static == dst[-1].is_static)
(src->name[0] != '_' && dst[-1].name[0] == '_') && ((src->name[0] != '_' && dst[-1].name[0] == '_')
|| (src->name[0] || (src->name[0]
&& src->name[1] != '_' && dst[-1].name[1] == '_'))) && src->name[1] != '_' && dst[-1].name[1] == '_'))))
{ {
DBG (AOUTDEBUG | IDDEBUG, DBG (AOUTDEBUG | IDDEBUG,
printf ("[symtab_finalize] favor %s@%c%c over %s@%c%c", printf ("[symtab_finalize] favor %s@%c%c over %s@%c%c",