From df928c8f28aab3867ae2283c7425d1a9480c20a1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 21 Mar 1996 22:21:30 +0000 Subject: [PATCH] * 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. --- gprof/ChangeLog | 15 +++++++++++++++ gprof/__bb_exit_func.c | 4 ++-- gprof/cg_arcs.c | 2 +- gprof/cg_print.c | 2 +- gprof/cg_print.h | 2 ++ gprof/core.c | 43 ++++++++++++++++++++++-------------------- gprof/symtab.c | 8 ++++---- 7 files changed, 48 insertions(+), 28 deletions(-) diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 0cee8528817..8fd3b562147 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,18 @@ +Thu Mar 21 17:18:25 1996 Ian Lance Taylor + + * 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 * gprof.c (default_excluded_list): Add "__mcount". diff --git a/gprof/__bb_exit_func.c b/gprof/__bb_exit_func.c index 512056ed4af..813321566c7 100644 --- a/gprof/__bb_exit_func.c +++ b/gprof/__bb_exit_func.c @@ -54,8 +54,8 @@ __bb_exit_func (void) perror(OUT_NAME); return; } /* if */ - bcopy(GMON_MAGIC, &ghdr.cookie[0], 4); - bcopy(&version, &ghdr.version, sizeof(version)); + memcpy(&ghdr.cookie[0], GMON_MAGIC, 4); + memcpy(&ghdr.version, &version, sizeof(version)); fwrite(&ghdr, sizeof(ghdr), 1, fp); for (ptr = __bb_head; ptr != 0; ptr = ptr->next) { diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c index c6431e4b2ed..b63102948b0 100644 --- a/gprof/cg_arcs.c +++ b/gprof/cg_arcs.c @@ -106,7 +106,7 @@ DEFUN (arc_add, (parent, child, count), newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs); /* 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 (arcs); diff --git a/gprof/cg_print.c b/gprof/cg_print.c index 236e01b11fa..015f710ce32 100644 --- a/gprof/cg_print.c +++ b/gprof/cg_print.c @@ -844,7 +844,7 @@ DEFUN_VOID (cg_print_function_ordering) /* Now sort a temporary symbol table based on the number of 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); /* Now pick out those symbols we're going to emit as diff --git a/gprof/cg_print.h b/gprof/cg_print.h index 13511c728a0..782c4aa04c2 100644 --- a/gprof/cg_print.h +++ b/gprof/cg_print.h @@ -8,5 +8,7 @@ extern double print_time; /* total of time being printed */ extern void cg_print PARAMS ((Sym ** cg)); 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 */ diff --git a/gprof/core.c b/gprof/core.c index b54c86e3ba9..3117599eba0 100644 --- a/gprof/core.c +++ b/gprof/core.c @@ -270,7 +270,7 @@ DEFUN (core_sym_class, (sym), asymbol * sym) * other systems. Perhaps it should be made configurable. */ 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 * 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) { bfd_vma min_vma = ~0, max_vma = 0; - const char *filename, *func_name; int class; 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 * necessary. */ - if (get_src_info (symtab.limit->addr, &filename, &func_name, - &symtab.limit->line_num)) - { - symtab.limit->file = source_file_lookup_path (filename); - - if (strcmp (symtab.limit->name, func_name) != 0) - { - /* - * The symbol's address maps to a different name, so - * it can't be a function-entry point. This happens - * for labels, for example. - */ - DBG (AOUTDEBUG, - printf ("[core_create_function_syms: rej %s (maps to %s)\n", - symtab.limit->name, func_name)); - continue; - } - } + { + const char *filename, *func_name; + + if (get_src_info (symtab.limit->addr, &filename, &func_name, + &symtab.limit->line_num)) + { + symtab.limit->file = source_file_lookup_path (filename); + + if (strcmp (symtab.limit->name, func_name) != 0) + { + /* + * The symbol's address maps to a different name, so + * it can't be a function-entry point. This happens + * for labels, for example. + */ + DBG (AOUTDEBUG, + printf ("[core_create_function_syms: rej %s (maps to %s)\n", + symtab.limit->name, func_name)); + continue; + } + } + } #endif symtab.limit->is_func = TRUE; diff --git a/gprof/symtab.c b/gprof/symtab.c index 6fd48c3c8f5..b38ae6a62de 100644 --- a/gprof/symtab.c +++ b/gprof/symtab.c @@ -93,10 +93,10 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab) * symbols (such as __gnu_compiled, __c89_used, etc.). */ if ((!src->is_static && dst[-1].is_static) - || ((src->is_static == dst[-1].is_static) && - (src->name[0] != '_' && dst[-1].name[0] == '_') - || (src->name[0] - && src->name[1] != '_' && dst[-1].name[1] == '_'))) + || ((src->is_static == dst[-1].is_static) + && ((src->name[0] != '_' && dst[-1].name[0] == '_') + || (src->name[0] + && src->name[1] != '_' && dst[-1].name[1] == '_')))) { DBG (AOUTDEBUG | IDDEBUG, printf ("[symtab_finalize] favor %s@%c%c over %s@%c%c", -- 2.30.2