Commit Graph

186 Commits

Author SHA1 Message Date
Dmitrii Bordukov
00df7c126b gprofng: do not skip weak symbols
PR gprofng/33151

gprofng ignores functions that are compiled as weak symbols. This
heavily affects C++ class methods that are always compiled by g++
and clang++ as weak symbols. In this case 'gprofng display text'
just displays <static>@ADDRESS(<FILENAME>) instead of proper method
name.

The bug has been introduced in the commit 470a0288a8.
2025-07-19 12:54:32 -07:00
Nick Clifton
47fdedbb95 Update version number on mainline 2025-07-13 08:57:08 +01:00
Vladimir Mezentsev
64fae1b70d gprofng: support external debug info
Use bfd_follow_gnu_debuglink() and bfd_follow_gnu_debugaltlink() to find files
with debug info.
If necessary, gprofng-archive copies these files to EXP/archives.

For each executable, gprofng creates the Elf class twice.
One of them was a memory leak.
Fixed this by adding a new argument to Stabs::Stabs().

gprofng/ChangeLog
2025-07-07  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 32147
	PR 30194
	* src/Disasm.cc (get_funcname_in_plt): Use the executable file instead
	of the debug information file.
	* src/Dwarf.h: Define debug_alt_strSec.
	* src/DwarfLib.cc: Add support for DW_FORM_GNU_ref_alt,
	DW_FORM_GNU_strp_alt.
	* src/Elf.h (find_gnu_debug_files, get_dwr_section): New functions.
	* src/Elf.cc: Likewise.
	* src/Experiment.cc (copy_file): Add the const qualifier.
	* src/Experiment.h: Likewise.
	* src/LoadObject.cc (get_elf, openDebugInfo): Find files with debug info.
	* src/LoadObject.h: Remove unused variables.
	* src/Module.cc: Remove an argument in openDebugInfo().
	* src/Stabs.cc (Stabs::Stabs): Add the Elf* argument.
	* src/Stabs.h: Likewise.
	* src/gp-archive.cc: Archive files with debug info.
	* src/gp-archive.h (archive_file): New function.
2025-07-08 10:11:05 -07:00
Vladimir Mezentsev
2f206f4b8a gprofng: remove ElfReloc class and unused functions and declarations
class ElfReloc is not used after we started use libbfd.
Removed ElfReloc and other unused declarations.

gprofng/ChangeLog
2025-07-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/Disasm.cc: Remove unused functions and variables.
	* src/Disasm.h: Likewise.
	* src/Dwarf.cc: Likewise.
	* src/DwarfLib.cc: Likewise.
	* src/DwarfLib.h: Likewise.
	* src/Elf.cc: Likewise.
	* src/Elf.h: Likewise.
	* src/Stabs.cc: Likewise.
	* src/Stabs.h: Likewise.
2025-07-07 13:50:40 -07:00
WANG Xuerui
304662234d RISC-V: [gprofng] Allow building gprofng without asm/hwprobe.h
The code is actually able to gracefully fallback if the syscall number
of riscv_hwprobe is not available at build time, but it still depended
on the <asm/hwprobe.h> header unconditionally. In certain environments
such as one of crosstool-NG's Canadian Cross build step (binutils for
host), or one with very outdated kernel headers, the header will not be
present, causing the build to fail.

While the relevant projects/environments should be fixed nevertheless,
a configure-time check for <asm/hwprobe.h> is helpful for fixing gprofng
builds with released versions of ct-ng etc.

Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-06-30 09:32:05 -07:00
Vladimir Mezentsev
221efb6f54 gprofng: need to know that experiment was created on big-endian machine
gprofng/ChangeLog
2025-06-25  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* configure.ac: Add AC_C_BIGENDIAN.
	* common/config.h.in: Rebuild.
	* configure: Rebuild.
	* libcollector/collector.c (log_header_write): Save big-endian flag.
	* src/DbeSession.h (is_bigendian): New function.
	* src/DbeSession.cc: Likewise.
	* src/Experiment.cc: Set 'bigendian' and 'need_swap_endian'.
	* src/Experiment.h: New field 'bigendian'.
	* src/LoadObject.cc: Remove an unused variable.
	* src/LoadObject.h: Likewise.
2025-06-26 10:43:50 -07:00
Andrew Pinski
b0a2d9e968 gprofng: Use __x86_64__ instead of __x86_64
With some compilers, only __x86_64__ is defined so use that
instead of __x86_64.

gprofng/ChangeLog
2025-05-30  Andrew Pinski  <quic_apinski@quicinc.com>
	* common/core_pcbe.c: s/__x86_64/__x86_64__/.
	* common/cpu_frequency.h: Likewise.
	* common/cpuid.c: Likewise.
	* common/gp-defs.h: Likewise.
	* common/hwctable.c: Likewise.
	* libcollector/libcol-i386-dis.c: Likewise.
	* libcollector/libcol_util.h: Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-05-30 14:57:23 -07:00
Vladimir Mezentsev
52d8dcccc0 gprofng: fix 32892 source line level information not available with "-g -O2"
gprofng did not read the .debug_rnglists section for dwarf-5.
Another problem was that gprofng ignored DW_AT_abstract_origin
As a result, gprofng skiped Dwarf for all functions declared as:
   <1><e18b>: Abbrev Number: 43 (DW_TAG_subprogram)
      <e18c>   DW_AT_abstract_origin: <0xe168>
      <e190>   DW_AT_linkage_name:  _ZN10Bool_ArrayD2Ev

gprofng/ChangeLog
2025-05-19  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 32892
	* src/Dwarf.cc: Read the .debug_rnglists section.
	Support DW_AT_abstract_origin.
	* src/Dwarf.h: Likewise.
	* src/DwarfLib.cc: Likewise.
	* src/DwarfLib.h: Likewise.
	* src/LoadObject.cc (dump_functions): Print mangled names for aliases.
	* src/Stabs.cc (fixSymtabAlias): Set 'alias' correctly.
	* src/Symbol.cc (find_symbols): Add argument where to collect symbols.
	* src/Symbol.h: Likewise.
2025-05-21 22:50:53 -07:00
Vladimir Mezentsev
4011eaac9a gprofng: remove unused functions, duplicate macros
class Reloc is not used after commit
13f614be23 gprofng: Refactor readSymSec for using BFD's asymbol struct

Many common macros were defined in different sources.
Sometimes a macro was used, sometimes a macros value was used.
Removed unused macros and include files.

gprofng/ChangeLog
2025-05-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* common/gp-experiment.h: Define variables that are passed to
	libcollector. Remove unused macros.
	* libcollector/collector.c: Cleanup macros.
	* libcollector/descendants.h: Likewise.
	* libcollector/envmgmt.c: Likewise.
	* libcollector/linetrace.c: Likewise.
	* src/collect.h: Likewise.
	* src/envsets.cc: Likewise.
	* src/gp-collect-app.cc: Likewise.
	* src/Stabs.cc: Remove class Reloc.
	* src/Stabs.h: Likewise.
	* src/ipcio.cc: Remove unused include files.
2025-05-05 00:07:07 -07:00
Vladimir Mezentsev
470a0288a8 gprofng: fix 32892 source line level information not available with "-g -O2"
gprofng ignored DW_AT_specification.
As a result, gprofng skiped Dwarf for all functions declared as:
  < 2>:<0x0000f725> DW_TAG_subprogram(46)
      DW_AT_linkage_name(110)     "func_name"
      DW_AT_declaration*(60)      0x1 (1)
  < 1>:<0x00015acc> DW_TAG_subprogram(46)
       DW_AT_specification(71)    0xf725 (63269)

Another problem was that gprofng ignored DW_AT_ranges.
As a result, many functions are mapped to the <Unknown> module.

gprofng/ChangeLog
2025-05-01  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 32892
	* src/Dwarf.cc: Handle DW_AT_specification and DW_AT_ranges.
	* src/DwarfLib.cc: Likewise.
	* src/DwarfLib.h: Likewise.
	* src/Dwarf.h (get_ranges): New function.
	* src/Stabs.h (get_symbols): New function.
	* src/Stabs.cc: Move Symbol class to src/Symbol.cc.
	* src/Symbol.cc: New file.
	* src/Symbol.h: New file.
	* src/Makefile.am: Add Symbol.cc in build.
	* src/Makefile.in: Rebuild.
	* src/LoadObject.cc (dump_functions): Improve output for -dfunc option.
2025-05-04 23:57:06 -07:00
Vladimir Mezentsev
b1f0f5b31c gprofng not reading references correctly in Dwarf
Fixed as specified in the DWARF standard:
 The first type of reference can identify any debugging information entry
 within the containing unit. This type of reference is an offset from the first
 byte of the compilation header for the compilation unit containing
 the reference. There are five forms for this type of reference.
 There are fixed length forms for one, two, four and eight byte offsets
 (respectively, DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, and DW_FORM_ref8).
 There is also an unsigned variable length offset encoded form that uses
 unsigned LEB128 numbers (DW_FORM_ref_udata).

gprofng/ChangeLog
2025-04-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/DwarfLib.cc (set_die): Handling DWARF references (DW_FORM_ref1,
	DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata).
	* src/Dwarf.cc: Likewise.
2025-04-28 23:43:20 -07:00
Vladimir Mezentsev
9567087349 gprofng: fix 32889 Typo in documentation
gprofng/ChangeLog
2025-04-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* doc/gprofng_ug.texi: Fix typo.
2025-04-21 22:09:11 -07:00
Vladimir Mezentsev
377d832881 gprofng: fix 32886 wrong mapping from instruction to line number
On Intel, gprofng should adjusts return addresses, including user leaf functions.

gprofng/ChangeLog
2025-04-18  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/CallStack.cc (add_stack): Adjust return addresses on Intel.
2025-04-21 22:09:10 -07:00
Vladimir Mezentsev
03458fc1bb Fix 32885 gprofng --help should state where to report bugs
gprofng/ChangeLog
2025-04-17  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/gp-archive.cc: Fix the --help output.
	* src/gp-collect-app.cc: Likewise.
	* src/gp-display-src.cc: Likewise.
	* src/gp-display-text.cc: Likewise.
	* src/gprofng.cc: Likewise.
2025-04-18 12:51:01 -07:00
Claudiu Zissulescu
50491ef1d3 gprofng: Remove duplicate symbols
Remove all duplicate symbols which can be in SymLst.  The duplication
is due to processing of both static and dynamic symbols.  The
Stabs::removeDupSyms function is called before computing symbol
aliases.

Introduce a new vector function (i.e., truncate()), that truncates a
vector lenght to the given new count.  This functionis used by
removeDupSyms function.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
2025-04-06 18:23:56 -07:00
Claudiu Zissulescu
13f614be23 gprofng: Refactor readSymSec for using BFD's asymbol struct
This patch refactors a number of gprofng internal functions for using
more BFD data types and functions.
Stabs::readSymSec is a function which reads the symbols of an ELF file
mapping them into an internal structure. To use BFD asymbols, the
Elf::elf_getsym is changed from custom reading of the symbols from
.symtab and .dynsym section to BFD enable functions. A new function is
introduced which returns the number of either static or dynamic symbols,
named Elf::elf_getSymCount. Both Elf functions are used by
Stabs::readSymSec refactoring.

Also, this patch removes reading symbols, SUNW_ldnsym section as it is
only used by now defunct Studio compiler. However, it adds the reading
of both static and dynamic symbols, previously, only either one was
processed.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
2025-04-06 18:23:55 -07:00
Claudiu Zissulescu
91fd524499 gprofng: Remove check_Relocs() function
check_Relocs() function is not anylonger required as it can only
handle Studio compiler relocs, now defunct. Remove this function.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
2025-04-06 18:23:54 -07:00
Sam James
8bf41b4c56 gprofng: regenerate Makefile.in
Needed after 90803ffdcc.

gprofng/ChangeLog
	* src/Makefile.in: Regenerate.
2025-03-12 21:33:26 +00:00
Zheng Junjie
90803ffdcc gprofng: Fix cross-compilation binary name.
commit d25ba4596e create symbolic link
no care cross-compilation prefix.

gprofng/ChangeLog
2025-02-10  Zheng Junjie  <zhengjunjie@iscas.ac.cn>
	* src/Makefile.am: create symbolic link respect cross-compilation.
	* src/Makefile.in: Rebuild.
2025-03-12 14:06:04 -07:00
Nick Clifton
8c7653ab09 Change version to 2.44.50 and regenerate files 2025-01-19 12:40:46 +00:00
Vladimir Mezentsev
6f5fae607d gprofng: fix Segmentation Fault in DbeInstr::mapPCtoLine
The bug was filed against gprofng-gui (https://savannah.gnu.org/bugs/?66560).

gprofng/ChangeLog
2025-01-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/Hist_data.cc (DbeInstr::mapPCtoLine): Check for null pointer.
2025-01-17 08:26:45 -08:00
Vladimir Mezentsev
ef0802cd1f gprofng: don't check Elf when file is in archive
map.xml contains a checksum for all Elf files.
gprofng-archive archives a file only with the same checksum.
In gprofng-display-text no additional check is required.

gprofng/ChangeLog
2025-01-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/parse.cc: Don't check Elf when file is in archive.
2025-01-16 20:03:41 -08:00
Vladimir Mezentsev
8520cebeb5 Fix 32085 Source file not recognized for gcc 11.4.0-compiled code
gprofng cannot read compressed section.
In the next release we plan to use libbfd everywhere instead of our ELF reader.
But in this release I use bfd_get_full_section_contents() only
when bfd_is_section_compressed() returns true.

gprofng/ChangeLog
2025-01-06  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/32085
	* src/Elf.cc: Use bfd_get_full_section_contents to decompress a section.
	* src/Elf.h: Define SEC_DECOMPRESSED.
2025-01-07 22:27:46 -08:00
Vladimir Mezentsev
63eb193ca4 gprofng: remove the old archiver
The first versions of Performance Analyzer archived only function names.
This is no longer used. We need a real elf-file.

gprofng/ChangeLog
2025-01-01  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/LoadObject.cc: Remove LoadObject::read_archive.
	* src/LoadObject.h: Likewise.
	* src/data_pckts.h: Remove unused declarations.
	* src/parse.cc (process_seg_map_cmd): Don't look for the old archive.
2025-01-02 15:46:48 -08:00
Alan Modra
5e04003fac Regen gprofng after copyright update 2025-01-01 22:19:36 +10:30
Alan Modra
e8e7cf2abe Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
Vladimir Mezentsev
ded4c0a10e gprofng: fix sorting in Hist_data::sort
If the '-name soname' option is used, the fake '<Total>' function is expanded
with the name loadobject.

gprofng/ChangeLog
2024-12-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/Hist_data.cc (Hist_data::sort): Fix sorting.
2024-12-10 12:46:47 -08:00
Alan Modra
df2bd39958 Re: gprofng: use gprofng- prefix for gprofng binaries
Commit d25ba4596e mangled ZLIBINC to ZLIgp-C.  Fix that.
2024-12-10 10:10:57 +10:30
Vladimir Mezentsev
73e931862a Fix 32392 [2.44 Regression] gprofng fails to build on i686-linux-gnu
gprofng/ChangeLog
2024-11-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/32392
	* libcollector/libcol_util.c (__collector_util_init): Fix warning.
2024-11-27 13:55:03 -08:00
Vladimir Mezentsev
194a7cc5e4 gprofng: skip unrecognized input command
gprofng crashes when the GUI sends an invalid command.
Skip unrecognized commands and return an error status to the GUI.

gprofng/ChangeLog
2024-11-26  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/ipc.cc (ipc_doWork): Skip unrecognized commands.
	* src/ipcio.cc (writeError): New function.
	* src/ipcio.h: Add RESPONSE_STATUS_ERROR.
2024-11-27 13:55:02 -08:00
Vladimir Mezentsev
4e943705e3 gprofng: fix build with -std=gnu23
Fix function pointer types accordingly.
Remove unused function pointers.

gprofng/ChangeLog
2024-11-21  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/32374
	PR gprofng/32373
	* common/cpuid.c: Define ATTRIBUTE_UNUSED if necessary.
	* libcollector/libcol_util.c (sysinfo): Remove unused pointer.
	* src/collector_module.h: Likewise.
	* libcollector/dispatcher.c (setitimer): Fix prototype.
	* libcollector/linetrace.c (system, grantpt, ptsname): Likewise.
	* testsuite/gprofng.display/mttest/mttest.c (dump_arrays): Likewise.
	* testsuite/gprofng.display/synprog/endcases.c (xinline_code,
	s_inline_code): Likewise.
	* testsuite/gprofng.display/synprog/inc_inline.h (ext_inline_code):
	Likewise.
	* testsuite/gprofng.display/synprog/synprog.c (doabort): Rename nullptr.
2024-11-22 12:03:45 -08:00
Sam James
a2f774427e gprofng: fix -std=gnu23 compatibility wrt unprototyped functions
C23 removes support for unprototyped functions. Fix function pointer types
accordingly.

This does not fix all instances, there's a few left as I commented on in
PR32374 (e.g. setitimer which I have a local workaround for but it involves
a glibc implementation detail; the Linaro precommit CI tester pointed that
out too, so dropped that).

ChangeLog:
	PR gprofng/32374

	* libcollector/collector.c (collector_sample): Fix prototype.
	* libcollector/envmgmt.c (putenv): Ditto.
	(_putenv): Ditto.
	(__collector_putenv): Ditto.
	(setenv): Ditto.
	(_setenv): Ditto.
	(__collector_setenv): Ditto.
	(unsetenv): Ditto.
	(_unsetenv): Ditto.
	(__collector_unsetenv): Ditto.
	* libcollector/jprofile.c (open_experiment): Ditto.
	(__collector_jprofile_enable_synctrace): Ditto.
	(jprof_find_asyncgetcalltrace): Ditto.
	* libcollector/libcol_util.c (__collector_util_init): Ditto.
	(ARCH): Ditto.
	* libcollector/mmaptrace.c (collector_func_load): Ditto.
	(collector_func_unload): Ditto.
	* libcollector/unwind.c (__collector_ext_unwind_init): Ditto.
	* src/collector_module.h: Ditto.
2024-11-18 05:12:56 +00:00
Vladimir Mezentsev
d25ba4596e gprofng: use gprofng- prefix for gprofng binaries
gprofng application names have a gp- prefix (gp-display-text, gp-archive, etc.).
But our man pages use the gprofng- prefix (gprofng-display-text,
gprofng-archive, etc.).
I renamed the gprofng binaries and temporarily created the gp-* links for
compatibility with the old gprofng-gui.
We plan to remove these links in version 2.46.

gprofng/ChangeLog
2024-10-31  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* doc/gprofng-archive.texi: Rename gprofng application names.
	* doc/gprofng-collect-app.texi: Likewise.
	* doc/gprofng-display-html.texi: Likewise.
	* doc/gprofng-display-src.texi: Likewise.
	* doc/gprofng-display-text.texi: Likewise.
	* doc/gprofng.texi: Likewise.
	* doc/gprofng_ug.texi: Likewise.
	* gp-display-html/Makefile.am: Likewise.
	* gp-display-html/gp-display-html.in: Likewise.
	* libcollector/collector.c: Likewise.
	* src/Application.cc: Likewise.
	* src/Experiment.cc: Likewise.
	* src/Makefile.am: Likewise.
	* src/gp-archive.cc: Likewise.
	* src/gp-collect-app.cc: Likewise.
	* src/gp-display-src.cc: Likewise.
	* src/gp-display-text.cc: Likewise.
	* src/gprofng.cc: Likewise.
	* src/Makefile.in: Rebuild.
	* gp-display-html/Makefile.in: Rebuild.
2024-11-01 16:46:21 -07:00
Ruud van der Pas
d6a07eeabb gprofng: fix a memory leak in the mxv-pthreads example
Fix a bug where the main program does not free the rows of
the matrix. The memory for thread_data_arguments is also
not released. In function check_results, the memory for the
marker vector is not released.
The usage of the verbose veriable has been extended to
print more messages.

gprofng/ChangeLog
2024-10-16  Ruud van der Pas  <ruud.vanderpas@oracle.com>

	PR 32273
	PR 32274
	* mxv-pthreads/src/main.c: add calls to free() to
	release the memory allocated for array A and vector
	marker. Improve the usage of the verbose variable.
	* mxv-pthreads/src/manage_data.c: add a diagnostic
	printf statement.
	* mxv-pthreads/src/mydefs.h: adapt prototype to
	match the changes in main.c.
2024-10-17 20:20:23 -07:00
Vladimir Mezentsev
aaa4688f9d gprofng: fix regression in man page installation
gprofng/ChangeLog
2024-10-14  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* doc/Makefile.am: Use install-data-local to install gprofng examples.
	* doc/Makefile.in: Rebuild.
2024-10-17 08:53:44 -07:00
Andreas Schwab
620d68c984 gprofng: use xmalloc/xrealloc/xcalloc/xstrdup/xstrndup from libiberty
PR gprofng/32241
	* src/Makefile.am (CSOURCES): Remove dbe_memmgr.c
	* src/Makefile.in: Regenerate.
	* src/dbe_memmgr.c: Remove.
	* src/gprofng.cc (main): Call xmalloc_set_program_name.
	* src/gp-archive.cc (main): Likewise.
	* src/gp-collect-app.cc (main): Likewise.
	* src/gp-display-src.cc (main): Likewise.
	* src/gp-display-text.cc (main): Likewise.
	* src/Application.cc: Use xmalloc, xrealloc, xcalloc, xstrdup,
	xstrndup instead of malloc, realloc, calloc, strdup, strndup.
	* src/BaseMetric.cc: Likewise.
	* src/CallStack.cc: Likewise.
	* src/ClassFile.cc: Likewise.
	* src/Data_window.cc: Likewise.
	* src/Dbe.cc: Likewise.
	* src/DbeJarFile.cc: Likewise.
	* src/DbeSession.cc: Likewise.
	* src/DbeView.cc: Likewise.
	* src/DerivedMetrics.cc: Likewise.
	* src/DwarfLib.cc: Likewise.
	* src/Elf.cc: Likewise.
	* src/Emsg.cc: Likewise.
	* src/Experiment.cc: Likewise.
	* src/Function.cc: Likewise.
	* src/Module.cc: Likewise.
	* src/Print.cc: Likewise.
	* src/QLParser.yy: Likewise.
	* src/SAXParserFactory.cc: Likewise.
	* src/Settings.cc: Likewise.
	* src/SourceFile.cc: Likewise.
	* src/StringBuilder.cc: Likewise.
	* src/StringMap.h: Likewise.
	* src/Table.cc: Likewise.
	* src/checks.cc: Likewise.
	* src/collctrl.cc: Likewise.
	* src/comp_com.c: Likewise.
	* src/count.cc: Likewise.
	* src/envsets.cc: Likewise.
	* src/gp-archive.cc: Likewise.
	* src/gp-display-src.cc: Likewise.
	* src/gp-display-text.cc: Likewise.
	* src/gprofng.cc: Likewise.
	* src/ipc.cc: Likewise.
	* src/ipcio.cc: Likewise.
	* src/vec.h: Likewise.
	* src/util.cc: Likewise.
	(get_prog_name): Remove.
	* src/util.h: Likewise.
	* src/dbe_hwc.h (malloc, realloc, calloc, strdup): Define.
2024-10-16 15:34:07 +02:00
Vladimir Mezentsev
d9252a0459 Fix 32110 gprofng segfaults on parsing DWARF of clang++ 18.1.3 produced binary
gprofng does not handle DW_FORM_strx1* forms correctly.

gprofng/ChangeLog
2024-10-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 32110
	* src/DwarfLib.cc: Handle DW_FORM_strx* forms.
2024-10-13 13:02:56 -07:00
H.J. Lu
8789556ab4 gprofng: Use $(DESTDIR) in install-examples
Use $(DESTDIR) in install-examples to fix

mkdir -p -- /usr/share/doc//gprofng
mkdir: cannot create directory ‘/usr/share/doc//gprofng’: Permission denied

for "make install DESTDIR=...".

	* doc/Makefile.am (install-examples): Use $(DESTDIR).
	* doc/Makefile.in: Regenerated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-10-11 06:03:38 +08:00
Vladimir Mezentsev
61621e018c gprofng: install examples to $(docdir)/gprofng
gprofng/ChangeLog
2024-10-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* doc/Makefile.am: Install gprofng examples.
	* doc/Makefile.in: Rebuild.
2024-10-10 10:14:01 -07:00
Vladimir Mezentsev
004d348063 gprofng: add hardware counters for Neoverse-N1 and Ampere-1 processors
gprofng/ChangeLog
2024-10-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Neoverse-N1 and Ampere-1.
	* common/hwctable.c: Add the hwc table for Neoverse-N1 and Ampere-1.
	* src/hwc_arm_ampere_1.h: New file with hwc table for Ampere-1.
	* src/hwc_arm_neoverse_n1.h: New file with hwc table for Neoverse-N1.
2024-10-07 18:41:36 -07:00
Ruud van der Pas
63b5e37fbc gprofng: fix a problem with hardware event counters
Fix a bug where an experiment with hardware event counter data
causes the source and disassembly files not to be generated.
No longer suppress zero valued metrics and change the name
of the man page in a warning message. Adapt line lengths to
not exceed 79.

gprofng/ChangeLog
2024-09-24  Ruud van der Pas  <ruud.vanderpas@oracle.com>

	PR 32193
	PR 32199
	PR 32201
	* gp-display-html/gp-display-html.in: Implement all
	the above changes.
2024-10-02 10:34:52 -07:00
Vladimir Mezentsev
519aef2dae Fix 32207 [gprofng collect app] Error in parsing the -O option
gprofng/ChangeLog
2024-09-25  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR 32207
	* src/collctrl.cc (preprocess_names): Fix the size in strndup.
2024-09-26 11:33:29 -07:00
Vladimir Mezentsev
b6532accdd Fix 32096 UBSAN issues in gprofng
Fixed UBSAN runtime errors such as:
 - member call on address which does not point to an object of type 'Vector'
 - load of misaligned address 0x623e5a670173 for type 'int', which requires 4 byte alignment

gprofng/ChangeLog
2024-09-17  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	PR gprofng/32096
	* libcollector/unwind.c: Fix UBSAN runtime errors.
	* src/CallStack.cc (add_stack_java, add_stack_java_epilogue):
	Change argument type to Vector<Histable*>*.
	* src/Experiment.cc (update_ts_in_maps): Change variable type.
	* src/Experiment.h: Change field type to Vector<Histable*>*.
2024-09-18 20:24:24 -07:00
Sam James
669aeefedb gprofng: avoid use of non-portable which [PR32166]
Distributions like Debian [0] and Gentoo are phasing out the use of
the non-portable `which` utility. Use POSIX's `command -v` instead.

[0] https://lwn.net/Articles/874049/

gprofng/ChangeLog
	PR gprofng/32166
	* testsuite/lib/Makefile.skel (JAVABIN): Replace use of which.
2024-09-12 22:53:22 +01:00
Vladimir Mezentsev
ad0751b6ec Fix 32096 UBSAN issues in gprofng
Fixed UBSAN runtime errors such as:
 - load of value 4294967295, which is not a valid value for type 'Cmsg_warn'
 - null pointer passed as argument 2, which is declared to never be null
 - load of value 4294967295, which is not a valid value for type 'ProfData_type'
 - reference binding to misaligned address 0x00000357583c for type 'long unsigned int', which requires 8 byte alignment

gprofng/ChangeLog
2024-09-09  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	PR gprofng/32096
	* src/BaseMetric.cc: Fix UBSAN runtime errors.
	* src/BaseMetric.h: Likewise.
	* src/Emsg.h: Likewise.
	* src/Experiment.cc: Likewise.
	* src/Table.h: Likewise.
2024-09-11 12:08:16 -07:00
Vladimir Mezentsev
a35d8973e5 Rename gp-* man pages to gprofng-* man pages
gprofng/ChangeLog
2024-09-05  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* doc/gp-archive.texi: Rename to doc/gprofng-archive.texi.
	* doc/gp-collect-app.texi: Rename to doc/gprofng-collect-app.texi.
	* doc/gp-display-html.texi: Rename to doc/gprofng-display-html.texi.
	* doc/gp-display-src.texi: Rename to doc/gprofng-display-src.texi.
	* doc/gp-display-text.texi: Rename to doc/gprofng-display-text.texi.
	* doc/gp-macros.texi: Add new macros.
	* doc/gprofng.texi: Rename man pages.
	* doc/gprofng_ug.texi: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/Makefile.in: Rebuild.
2024-09-06 14:21:54 -07:00
Vladimir Mezentsev
b79c457ca0 Fix 32097 Warnings when building gprofng with Clang
gprofng/ChangeLog
2024-09-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	PR gprofng/32097
	* common/hwcdrv.c: Fix -Wempty-body warnings.
	* common/hwcentry.h: Fix -Wdeprecated-non-prototype warnings.
	* common/hwctable.c: Fix -Wdeprecated-non-prototype warnings.
	* libcollector/collector.c: Likewise.
	* libcollector/collector.h: Likewise.
	* libcollector/collectorAPI.c: Likewise.
	* libcollector/dispatcher.c: Likewise.
	* libcollector/iotrace.c: Likewise.
	* libcollector/libcol_util.c: Fix -Wunused-but-set-variable warnings.
	* libcollector/libcol_util.h: Remove unused declarations.
	* libcollector/linetrace.c: Fix -Wdeprecated-non-prototype warnings.
	* src/BaseMetricTreeNode.h: Fix -Wunused-private-field warnings.
	* src/Dbe.cc: Fix -Wself-assign warnings.
	* src/DbeSession.cc: Fix -Wunused-but-set-variable warnings.
	* src/Disasm.cc: Fix -Wunused-const-variable warnings.
	* src/Experiment.cc: Fix -Wunused-private-field warnings.
	* src/HashMap.h: Fix -Wself-assign warnings.
	* src/IOActivity.h: Fix -Wunused-private-field warnings.
	* src/collctrl.cc: Fix -Wself-assign, -Wparentheses-equality warnings.
	* src/collctrl.h: Fix -Wunused-private-field warnings.
	* src/collector_module.h: Fix -Wdeprecated-non-prototype warnings.
	* src/gp-display-src.cc: Fix -Wunused-private-field warnings.
	* src/gp-print.h: Fix -Wheader-guard warnings.
	* src/hwc_intel_icelake.h: Fix -Winitializer-overrides warnings.
	* src/util.cc: Fix -Wunused-but-set-variable warnings.
2024-09-04 13:49:21 -07:00
Sam James
1ebf4606c2 gprofng: testsuite: fix 'wrapper' typo
gprofng/ChangeLog
            * testsuite/config/default.exp: Fix 'wrapper' typo.
2024-08-22 04:15:16 +01:00
Vladimir Mezentsev
4456cb827f gprofng: add hardware counters for Appliedmicro processor
gprofng/ChangeLog
2024-08-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* common/hwc_cpus.h: New constant for Appliedmicro processor.
	* common/hwctable.c: Add the hwc table for Appliedmicro processor.
	* src/hhwc_arm64_amcc.h: New file.
	* src/collctrl.cc (read_int): Use strtol instead of atoi.
2024-08-19 17:26:20 -07:00
Vladimir Mezentsev
72e96189d8 gprofng: fix typo in src/collctrl.cc
gprofng/ChangeLog
2024-08-13  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/collctrl.cc (read_cpuinfo): Fix typo.
2024-08-14 19:30:29 -07:00