aboutsummaryrefslogtreecommitdiff
path: root/gprof/basic_blocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'gprof/basic_blocks.c')
-rw-r--r--gprof/basic_blocks.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index bca6862..d865938 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-
+
#include "gprof.h"
#include "libiberty.h"
#include "filenames.h"
@@ -122,6 +122,7 @@ bb_read_rec (FILE *ifp, const char *filename)
unsigned int nblocks, b;
bfd_vma addr, ncalls;
Sym *sym;
+ Sym_Table *symtab;
if (gmon_io_read_32 (ifp, &nblocks))
{
@@ -130,6 +131,8 @@ bb_read_rec (FILE *ifp, const char *filename)
done (1);
}
+ symtab = get_symtab ();
+
nblocks = bfd_get_32 (core_bfd, (bfd_byte *) & nblocks);
if (gmon_file_version == 0)
fskip_string (ifp);
@@ -163,7 +166,7 @@ bb_read_rec (FILE *ifp, const char *filename)
profiling at the line-by-line level: */
if (line_granularity)
{
- sym = sym_lookup (&symtab, addr);
+ sym = sym_lookup (symtab, addr);
if (sym)
{
@@ -210,9 +213,10 @@ bb_write_blocks (FILE *ofp, const char *filename)
unsigned int nblocks = 0;
Sym *sym;
int i;
+ Sym_Table *symtab = get_symtab ();
/* Count how many non-zero blocks with have: */
- for (sym = symtab.base; sym < symtab.limit; ++sym)
+ for (sym = symtab->base; sym < symtab->limit; ++sym)
{
for (i = 0; i < NBBS && sym->bb_addr[i]; i++)
;
@@ -228,7 +232,7 @@ bb_write_blocks (FILE *ofp, const char *filename)
}
/* Write counts: */
- for (sym = symtab.base; sym < symtab.limit; ++sym)
+ for (sym = symtab->base; sym < symtab->limit; ++sym)
{
for (i = 0; i < NBBS && sym->bb_addr[i]; i++)
{
@@ -252,6 +256,7 @@ print_exec_counts (void)
{
Sym **sorted_bbs, *sym;
unsigned int i, j, len;
+ Sym_Table *symtab = get_symtab ();
if (first_output)
first_output = false;
@@ -259,10 +264,10 @@ print_exec_counts (void)
printf ("\f\n");
/* Sort basic-blocks according to function name and line number: */
- sorted_bbs = (Sym **) xmalloc (symtab.len * sizeof (sorted_bbs[0]));
+ sorted_bbs = (Sym **) xmalloc (symtab->len * sizeof (sorted_bbs[0]));
len = 0;
- for (sym = symtab.base; sym < symtab.limit; ++sym)
+ for (sym = symtab->base; sym < symtab->limit; ++sym)
{
/* Accept symbol if it's in the INCL_EXEC table
or there is no INCL_EXEC table
@@ -461,10 +466,11 @@ print_annotated_source (void)
Source_File *sf;
int i, table_len;
FILE *ofp;
+ Sym_Table *symtab = get_symtab ();
/* Find maximum line number for each source file that user is
interested in: */
- for (sym = symtab.base; sym < symtab.limit; ++sym)
+ for (sym = symtab->base; sym < symtab->limit; ++sym)
{
/* Accept symbol if it's file is known, its line number is
bigger than anything we have seen for that file so far and
@@ -490,7 +496,7 @@ print_annotated_source (void)
}
/* Count executions per line: */
- for (sym = symtab.base; sym < symtab.limit; ++sym)
+ for (sym = symtab->base; sym < symtab->limit; ++sym)
{
if (sym->file && sym->file->num_lines
&& (sym_lookup (&syms[INCL_ANNO], sym->addr)