aboutsummaryrefslogtreecommitdiff
path: root/gprof
AgeCommit message (Collapse)AuthorFilesLines
2025-05-01asan: null pointer as arg 2 of memcpyAlan Modra1-12/+2
Replace xmalloc+memcpy+free with xrealloc, avoiding the asan warning on the initial allocation where we had memcpy(p,0,0). * cg_arcs.c (arc_add): Use xrealloc.
2025-03-29gprof: Always compile tests with -gH.J. Lu2-12/+10
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>
2025-03-14gprof: only process line numbers for intersection of vmas and histogramsRichard Allen19-185/+334
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>
2025-03-10gprof: Append -l to tst-gmon-gprof-l.sh data filesH.J. Lu1-3/+3
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>
2025-03-10gprof: Add a simple test for gprof -lH.J. Lu3-2/+90
Verify that "gprof -l" works properly. * testsuite/Makefile.am (check_SCRIPTS): Add tst-gmon-gprof-l.sh. * testsuite/Makefile.in: Regenerated. * testsuite/tst-gmon-gprof-l.sh: New. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-08gprof: Compile tst-gmon.c with -O2 -fno-omit-frame-pointerH.J. Lu4-11/+13
Compile tst-gmon.c with -O2 -fno-omit-frame-pointer to ensure proper call graph generation. PR gprof/32768 * configure.ac: Compile tst-gmon.c with -fno-omit-frame-pointer. * configure: Regenerated. * testsuite/Makefile.am (GPROF_FLAGS): Add -O2 -fno-omit-frame-pointer. (AM_CFLAGS): Removed. (COMPILE): Append $(GPROF_FLAGS). (LINK): Likewise. * testsuite/Makefile.in: Regenerated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07gprof: Update PR gprof/32764 testH.J. Lu6-5/+5
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>
2025-03-07gprof: Copy a simple test from glibcH.J. Lu8-7/+1102
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>
2025-03-06Revert "gprof: only process line numbers for intersection of vmas and ↵H.J. Lu2-63/+56
histograms" This reverts commit b8189cf9e40bd90502c9a2ce0df39dd54419bea4 to fix PR gprof/32764: https://sourceware.org/bugzilla/show_bug.cgi?id=32764
2025-03-03gprof: only process line numbers for intersection of vmas and histogramsRichard Allen2-56/+63
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>
2025-03-01gprof: fix symbol miscount by merging passesRichard Allen1-79/+27
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>
2025-03-01gprof: remove unused variablesRichard Allen1-21/+1
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
2025-03-01gprof: speed up line-by-line for MIPS/PowerPC/RISCV/SuperHRichard Allen1-0/+7
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>
2025-03-01gprof: rename min_insn_size to insn_boundaryRichard Allen1-5/+6
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>
2025-03-01gprof: remove ASCII formfeed/0x0C bytes from source codeRichard Allen26-26/+26
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
2025-02-10gprof: fix odd inst len hist scale calculationRichard Allen1-1/+1
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>
2025-02-10gprof: print values of mismatched histogram scalesRichard Allen1-2/+2
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
2025-02-10gprof: fix comment typosRichard Allen1-3/+3
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
2025-02-10gprof: add missing newline to error textRichard Allen1-1/+1
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
2025-01-19Change version to 2.44.50 and regenerate filesNick Clifton2-11/+11
2025-01-19Add markers for bihnutils 2.44 branchNick Clifton1-0/+4
2025-01-01Update year range in copyright notice of binutils filesAlan Modra39-41/+41
2024-09-26Updated Brazilian Portuguese translation for the gprof directory.Nick Clifton1-58/+59
2024-07-20Change version to 2.43.50Nick Clifton2-11/+11
2024-07-20Add markers for 2.43 branch/releaseNick Clifton1-0/+4
2024-06-20Revert "Remove LIBINTL_DEP"Alan Modra3-4/+7
This reverts commit e874cbd3879843a83e4bcc4b54cd7107387b1df6. The patch was wrong. LIBINTL_DEP is needed with an in-tree gettext.
2024-06-20Remove LIBINTL_DEPAlan Modra3-7/+4
The intl directory in the source no longer exists. LIBINTL_DEP is thus always empty. Remove references to it. config/ * gettext-sister.m4: Don't AC_SUBST LIBINTL_DEP. bfd/ * Makefile.in: Regenerate. * configure: Regenerate. binutils/ * Makefile.am (*_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. gas/ * Makefile.am (as_new_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. gdb/ * Makefile.in (INTL_DEPS): Don't set or reference. * configure: Regenerate. gdbserver/ * Makefile.in (INTL_DEPS): Don't set or reference. gdbsupport/ * Makefile.in: Regenerate. * configure: Regenerate. gold/ * Makefile.am (deps_var): Remove LIBINTL_DEP. (incremental_dump_DEPENDENCIES, dwp_DEPENDENCIES): Likewise. * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.am (DEPENDENCIES): Remove LIBINTL_DEP. * testsuite/Makefile.in: Regenerate. gprof/ * Makefile.am (gprof_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. ld/ * Makefile.am (ld_new_DEPENDENCIES): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate. libctf/ * Makefile.in: Regenerate. * configure: Regenerate. opcodes/ * configure.ac (BUILD_LIBS): Remove LIBINTL. (BUILD_LIB_DEPS): Remove LIBINTL_DEP. * Makefile.in: Regenerate. * configure: Regenerate.
2024-06-10autoupdate: regen after replacing obsolete macrosMatthieu Longo1-4/+2
2024-06-10autoupdate: add square brackets around arguments of AC_INITMatthieu Longo1-1/+1
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fINIT-2
2024-06-10autoupdate: replace obsolete macros AC_AIX, AC_MINIX, and AC_GNU_SOURCEMatthieu Longo1-1/+0
- AC_AIX, AC_MINIX, and AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fAIX https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fMINIX-1 https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fGNU_005fSOURCE-1
2024-04-05Add missing install-dvi and install-ps Makefie targets.Christophe Lyon1-0/+2
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.
2024-01-18Updated translations for various sub-directoriesNick Clifton1-38/+43
2024-01-15Change version to 2.42.50 and regenerate filesNick Clifton3-11/+16
2024-01-15Add markers for 2.42 branchNick Clifton1-0/+4
2024-01-04Update year range in copyright notice of binutils filesAlan Modra39-41/+41
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.
2023-11-15Finalized intl-update patchesArsen Arsenovi?6-64/+2116
* intl: Remove directory. Replaced with out-of-tree GNU gettext. * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. * src-release.sh: Remove references to the intl/ directory.
2023-08-12regen configAlan Modra1-21/+52
This regenerates config files changed by the previous 44 commits. Note that subject lines in these commits mostly match the gcc git originating commit.
2023-08-03gprof: sprintf sanitizer null destination pointerAlan Modra1-8/+4
* basic_blocks.c (annotate_with_count): Use output of sprintf rather than strlen.
2023-08-02Revert "2.41 Release sources"Sam James11-71/+94
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d. See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-022.41 Release sourcesbinutils-2_41-releaseNick Clifton11-94/+71
2023-07-31Updated Spanish translation for the gprof directoryNick Clifton1-42/+42
2023-07-26PR30657, gprof heap buffer overflowAlan Modra7-10/+37
PR 30657 * cg_arcs.c (cg_assemble): Sanity check find_call addresses. * i386.c (i386_find_call): Don't access past end of core_text_space. * aarch64.c (aarch64_find_call): Round up lowpc, round down highpc. * alpha.c (alpha_find_call): Likewise. * mips.c (mips_find_call): Likewise. * sparc.c (sparc_find_call): Likewise. * vax.c (vax_find_call): Sanity check core_text_space accesses.
2023-07-03Change version number to 2.41.50 and regenerate filesNick Clifton2-10/+14
2023-07-03Add markers for the 2.41 branchNick Clifton1-0/+4
2023-06-26Updated French translation for the gprof sub-directoryNick Clifton2-47/+52
2023-04-19Updated Hungarian translation for the gprof directoryNick Clifton2-44/+48
2023-04-11Fix an illegal memorty access when running gprof over corrupt data.Nick Clifton2-1/+7
PR 30324 * symtab.c (symtab_finalize): Only change the end address if dst has been updated.
2023-02-27Updated Serbian translations for gold, gprof and opcodes sub-directoriesNick Clifton1-53/+54
2023-02-21Updated translatios for the bfd and gprof directories.Nick Clifton2-45/+49
2023-01-09Updated transaltions for the gprof and binutils sub-directoriesNick Clifton2-48/+52