Always compile gprof testsuite with -g for line number info checked by
tst-gmon-gprof-l.sh.
PR gprof/32779
* testsuite/Makefile.am (GPROF_FLAGS): Add -g.
(COMPILE): Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS)".
(LINK) Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS)
$(LDFLAGS) -o $@".
* testsuite/Makefile.in: Regenerated.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Some programs like RTOS firmware may have a large number of symbols.
The profile information in the profile data file includes histogram
records, which capture low PC and high PC of program execution. If all
histogram records come in the profile data file before any call-graph
records and basic-block records, we can look up only the line numbers
within low PC and high PC in histogram records, which reduces processing
time for such a firmware from ~2 minutes to ~2 seconds.
Add symbol table access function, get_symtab, get_symtab_direct and
set_symtab to delay loading the symbol table until its first use.
* aarch64.c (aarch64_find_call): Call get_symtab to get the
symbol table pointer
* alpha.c (alpha_find_call): Likewise.
* basic_blocks.c (bb_read_rec): Likewise.
(bb_write_blocks): Likewise.
(print_exec_counts): Likewise.
(print_annotated_source): Likewise.
* call_graph.c (cg_tally): Likewise.
(cg_write_arcs): Likewise.
* cg_arcs.c (cycle_link): Likewise.
(propagate_flags): Likewise.
(cg_assemble): Likewise.
* cg_print.c (cg_print): Likewise.
(cg_print_index): Likewise.
(cg_print_function_ordering): Likewise.
* corefile.c: Include "gmon_io.h".
(core_create_syms_from): Call get_symtab_direct to get the
symbol table pointer.
(core_create_function_syms): Likewise.
(core_create_line_syms): Likewise. If all histogram records
come in the profile data file before any call-graph records and
basic-block records, we can look up only the line numbers within
low PC and high PC in histogram records.
* gmon_io.c (gmon_histograms_first): New.
(gmon_out_read): Set gmon_histograms_first to true if all
histogram records come first.
(gmon_out_write): Call get_symtab to get the symbol table
pointer.
* hist.c (scale_and_align_entries): Likewise.
(hist_assign_samples_1): Likewise.
(hist_print): Likewise.
* i386.c (i386_find_call): Likewise.
* mips.c (mips_find_call): Likewise.
* sparc.c (sparc_find_call): Likewise.
* sym_ids.c (sym_id_parse): Likewise.
* vax.c (vax_find_call): Likewise.
* gmon_io.h (gmon_histograms_first): New.
* gprof.c (man): Don't create profile info.
(symtab_init): New.
* gprof.h (symtab_init): New.
* symtab.c (symtab): Changed to static.
(get_symtab_direct): New.
(get_symtab): Likewise.
(set_symtab): Likewise.
* symtab.h (symtab): Removed.
(get_symtab_direct): New.
(get_symtab): Likewise.
(set_symtab): Likewise.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Append -l to tst-gmon-gprof-l.sh data files to avoid conflicts with
tst-gmon-gprof.sh data files.
* testsuite/tst-gmon-gprof-l.sh (actual): Append -l.
(expected): Likewise.
(expected_dot): Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
1. Remove gmon.out first before generating it in the configure check.
2. Make tst-gmon-gprof.out depend on the gprof binary.
3. Check that gmon.out is non-empty.
4. Don't include <sys/cdefs.h> in tst-gmon.c.
PR gprof/32764
* configure.ac: Remove gmon.out first.
* configure: Regenerated.
* testsuite/Makefile.am (tst-gmon-gprof.out): Depend on
$(GPROF).
* testsuite/Makefile.in: Regenerated.
* testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty.
* testsuite/tst-gmon.c: Don't include <sys/cdefs.h>.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Copy a simple gprof test from glibc to test the basic gprof functionality.
1. Tested natively on Linux/x86-64 and Linux/i686.
2. Tested for the x86_64-solaris cross target without cross-compiler.
3. Tested for the aarch64-linux-gnu cross target with cross-compiler.
PR gprof/32764
* Makefile.am (SUBDIRS): Add testsuite
* configure.ac (AC_CONFIG_FILES): Removed.
(AC_OUTPUT): Add Makefile testsuite/Makefile
po/Makefile.in:po/Make-in.
(AM_CONDITIONAL): Add NATIVE.
* Makefile.in: Regenerated.
* configure: Likewise.
* testsuite/Makefile.am: New file.
* testsuite/tst-gmon-gprof.sh: Likewise.
* testsuite/tst-gmon.c: Likewise.
* testsuite/Makefile.in: Generated.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Some programs like RTOS firmware may have a large number of symbols.
By loading the histograms before loading symbols, we can look up
only the line numbers that were captured in the histogram file,
which reduces processing time for such a firmware from ~2 minutes
to ~2 seconds.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Instead of fixing "somebody miscounted" errors,
this patch combines the core_create_line_syms()
passes, and dynamically expands the ltab buffer.
Reducing the number of passes will make future
optimizations simpler.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Roughly halves the number of bfd_find_nearest_line() calls,
about 40% less time for a few different large ELF files.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
This distinction is important for architecures like Xtensa,
where 2B and 3B instructions are common, but the correct
value for instruction iteration is 1B, not 2B.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
With even instruction sizes, this rounding never truncated.
Xtensa CPUs mostly use 2-3 byte instructions, and this can lead
to a histogram being captured with an odd length address range.
This small truncation prevented gprof from parsing gmon.out files
containing multiple histograms when at least one of them has an
odd address range length and another has any other address range.
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
For some reason, these targets are missing although others from the
same family are present. This looks like an oversight.
This enables calling 'make install-dvi' from the top-level build
directory.
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:
1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
author I haven't committed, 'Kalray SA.', to cover gas testsuite
files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
This regenerates config files changed by the previous 44 commits.
Note that subject lines in these commits mostly match the gcc git
originating commit.