aboutsummaryrefslogtreecommitdiff
path: root/gprof/symtab.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1998-02-04 00:30:48 +0000
committerIan Lance Taylor <ian@airs.com>1998-02-04 00:30:48 +0000
commit7862d7d065c91e32b2d1d12590b0b6219034c7cf (patch)
tree7bfb85a6bfb8c0c2cfe349a141e1696916a442f7 /gprof/symtab.c
parent70b3329c0cdaac62bf1ea1b8bc8b133439420234 (diff)
downloadfsf-binutils-gdb-7862d7d065c91e32b2d1d12590b0b6219034c7cf.zip
fsf-binutils-gdb-7862d7d065c91e32b2d1d12590b0b6219034c7cf.tar.gz
fsf-binutils-gdb-7862d7d065c91e32b2d1d12590b0b6219034c7cf.tar.bz2
Tue Feb 3 14:25:25 1998 Brent Baccala <baccala@freesoft.org>
* symtab.c (symtab_finalize): Prefer function symbols over line symbols. (dbg_sym_lookup): Correct debugging messages. * gprof.c (main): --sum implies --line. * cg_print.c (cg_print): When doing line by line profiling, don't use a non-function as a main listing item. * call_graph.c (cg_tally): When using line by line profiling, use the function symbol as the child. * symtab.h (NBBS): Define. (Sym): Add bb_addr and bb_calls fields. * basic_blocks.c (bb_read_rec): Save multiple basic blocks per symbol. (bb_write_blocks): Adjust for multiple basic blocks per symbol. (print_exec_counts): Don't check whether a symbol is the start of a basic block. Print all basic blocks for a symbol. (annotate_with_count): Rewrite to print all basic block counts and to pay attention to width argument. (print_annotated_source): Don't check whether symbol is the start of a basic block.
Diffstat (limited to 'gprof/symtab.c')
-rw-r--r--gprof/symtab.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gprof/symtab.c b/gprof/symtab.c
index b38ae6a..0b6a4af 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -85,8 +85,9 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab)
if (src->addr == prev_addr)
{
/*
- * If same address, favor global symbol over static one.
- * If both symbols are either static or global, check
+ * If same address, favor global symbol over static one,
+ * then function over line number. If both symbols are
+ * either static or global and either function or line, check
* whether one has name beginning with underscore while
* the other doesn't. In such cases, keep sym without
* underscore. This takes cares of compiler generated
@@ -94,9 +95,12 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab)
*/
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_func && !dst[-1].is_func)
+ || ((src->is_func == dst[-1].is_func)
+ && ((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",
@@ -166,7 +170,7 @@ DEFUN (dbg_sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address
long low, mid, high;
Sym *sym;
- fprintf (stderr, "[sym_lookup] address 0x%lx\n", address);
+ fprintf (stderr, "[dbg_sym_lookup] address 0x%lx\n", address);
sym = symtab->base;
for (low = 0, high = symtab->len - 1; low != high;)
@@ -189,7 +193,7 @@ DEFUN (dbg_sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address
low = mid + 1;
}
}
- fprintf (stderr, "[sym_lookup] binary search fails???\n");
+ fprintf (stderr, "[dbg_sym_lookup] binary search fails???\n");
return 0;
}