aboutsummaryrefslogtreecommitdiff
path: root/gprofng/src
AgeCommit message (Collapse)AuthorFilesLines
3 daysgprofng: support external debug infoVladimir Mezentsev15-185/+279
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.
4 daysgprofng: remove ElfReloc class and unused functions and declarationsVladimir Mezentsev9-498/+6
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-06-26gprofng: need to know that experiment was created on big-endian machineVladimir Mezentsev6-4/+20
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-05-21gprofng: fix 32892 source line level information not available with "-g -O2"Vladimir Mezentsev8-94/+442
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-05gprofng: remove unused functions, duplicate macrosVladimir Mezentsev6-102/+1
class Reloc is not used after commit 13f614be23a 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-04gprofng: fix 32892 source line level information not available with "-g -O2"Vladimir Mezentsev11-153/+563
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-04-28gprofng not reading references correctly in DwarfVladimir Mezentsev2-9/+9
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-21gprofng: fix 32886 wrong mapping from instruction to line numberVladimir Mezentsev1-7/+3
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-18Fix 32885 gprofng --help should state where to report bugsVladimir Mezentsev5-5/+10
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-06gprofng: Remove duplicate symbolsClaudiu Zissulescu3-0/+43
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-06gprofng: Refactor readSymSec for using BFD's asymbol structClaudiu Zissulescu5-81/+59
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-06gprofng: Remove check_Relocs() functionClaudiu Zissulescu2-140/+2
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-03-12gprofng: regenerate Makefile.inSam James1-0/+1
Needed after 90803ffdcc4d8c3d17566bf8dccadbad312f07a9. gprofng/ChangeLog * src/Makefile.in: Regenerate.
2025-03-12gprofng: Fix cross-compilation binary name.Zheng Junjie2-14/+10
commit d25ba4596e85da6d8af78c88b5917e14763afbe1 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-01-17gprofng: fix Segmentation Fault in DbeInstr::mapPCtoLineVladimir Mezentsev1-2/+5
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-16gprofng: don't check Elf when file is in archiveVladimir Mezentsev1-14/+0
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-07Fix 32085 Source file not recognized for gcc 11.4.0-compiled codeVladimir Mezentsev2-8/+31
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-02gprofng: remove the old archiverVladimir Mezentsev4-358/+11
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-01Regen gprofng after copyright updateAlan Modra1-1/+1
2025-01-01Update year range in copyright notice of binutils filesAlan Modra196-197/+197
2024-12-10gprofng: fix sorting in Hist_data::sortVladimir Mezentsev1-2/+1
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-10Re: gprofng: use gprofng- prefix for gprofng binariesAlan Modra2-2/+2
Commit d25ba4596e85 mangled ZLIBINC to ZLIgp-C. Fix that.
2024-11-27gprofng: skip unrecognized input commandVladimir Mezentsev3-3/+18
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-22gprofng: fix build with -std=gnu23Vladimir Mezentsev1-1/+0
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-18gprofng: fix -std=gnu23 compatibility wrt unprototyped functionsSam James1-1/+1
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-01gprofng: use gprofng- prefix for gprofng binariesVladimir Mezentsev9-143/+151
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-10-16gprofng: use xmalloc/xrealloc/xcalloc/xstrdup/xstrndup from libibertyAndreas Schwab43-497/+356
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-13Fix 32110 gprofng segfaults on parsing DWARF of clang++ 18.1.3 produced binaryVladimir Mezentsev1-5/+33
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-07gprofng: add hardware counters for Neoverse-N1 and Ampere-1 processorsVladimir Mezentsev2-0/+639
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-09-26Fix 32207 [gprofng collect app] Error in parsing the -O optionVladimir Mezentsev1-1/+1
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-18Fix 32096 UBSAN issues in gprofngVladimir Mezentsev3-17/+24
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-11Fix 32096 UBSAN issues in gprofngVladimir Mezentsev5-24/+40
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-04Fix 32097 Warnings when building gprofng with ClangVladimir Mezentsev14-54/+30
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-08-19gprofng: add hardware counters for Appliedmicro processorVladimir Mezentsev2-1/+187
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-14gprofng: fix typo in src/collctrl.ccVladimir Mezentsev1-1/+2
gprofng/ChangeLog 2024-08-13 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/collctrl.cc (read_cpuinfo): Fix typo.
2024-08-12gprofng: specify the heap data collection rangeVladimir Mezentsev4-137/+48
Extend the -H option: -H {off|on|N1[-N2]} disable , or enable heap tracing, or specify the heap data collection range. The default is "-H off". gprofng/ChangeLog 2024-08-08 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * libcollector/heaptrace.c: Read the range in the -H option. Do not collect data if the allocated memory is out of range. * src/collctrl.h (heaptrace_mode): Define as char * value. * src/envsets.cc: Updated since heaptrace_mode is changed. * src/collctrl.cc: Accept the extended -H option. * src/gp-collect-app.cc: Accept the extended -H option. Remove unused code.
2024-07-10RISC-V:[gprofng] Minimal support gprofng for riscv.Yixuan Chen6-2/+16
ChangeLog: Add target riscv to --enable-gprofng. 2024-07-04 Yixuan Chen <chenyixuan@iscas.ac.cn> * configure: Add riscv. * configure.ac: Add riscv. gprofng/ChangeLog: Minimal support gprofng for riscv. 2024-07-04 Yixuan Chen <chenyixuan@iscas.ac.cn> * gprofng/common/core_pcbe.c (core_pcbe_init): Add RISC-V vendor conditon. (defined): Add riscv. * gprofng/common/cpuid.c (defined): Add risc-v hwprobe. * gprofng/common/gp-defs.h (TOK_A_RISCV): Add riscv. (defined): Add riscv. (ARCH_RISCV): Add riscv. * gprofng/common/hwc_cpus.h: Add RISC-V vendor. * gprofng/common/hwcfuncs.h (HW_INTERVAL_TYPE): Remove useless defination. * gprofng/configure: Add riscv. * gprofng/configure.ac: Add riscv. * gprofng/libcollector/hwprofile.h (ARCH): Add RISC-V register. (CONTEXT_PC): Add RISC-V register. (CONTEXT_FP): Add RISC-V register. (CONTEXT_SP): Add RISC-V register. (SETFUNCTIONCONTEXT): * gprofng/libcollector/libcol_util.c (__collector_util_init): Fix libc open condition. * gprofng/libcollector/libcol_util.h (ARCH): Add RISC-V. * gprofng/libcollector/unwind.c (ARCH): Add RISC-V register. (GET_PC): Add RISC-V register. (GET_SP): Add RISC-V register. (GET_FP): Add RISC-V register. (FILL_CONTEXT): * gprofng/src/DbeSession.cc (ARCH): Add RISC-V. * gprofng/src/Disasm.cc (Disasm::disasm_open): Add RISC-V. * gprofng/src/Experiment.cc (Experiment::ExperimentHandler::startElement): Add RISC-V. * gprofng/src/checks.cc (ARCH): Add RISC-V. * gprofng/src/collctrl.cc (defined): Set risc-v cpu frequency to 1000MHz as default for now, will fix when I find a better method to get cpu frequency. (read_cpuinfo): Add "mvendorid" condition according to risc-v /proc/cpuinfo file content. * gprofng/src/dbe_types.h (enum Platform_t): Add RISC-V.
2024-07-09gprofng: add hardware counters for Intel Ice Lake processorVladimir Mezentsev2-1/+1173
gprofng/ChangeLog 2024-07-07 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>. * common/hwc_cpus.h: New constant for Intel Ice Lake processor. * common/hwcdrv.c: Add a new argument to hwcfuncs_get_x86_eventsel. Set config1 in perf_event_attr. Remove the use of memset. * common/core_pcbe.c (core_pcbe_get_eventnum): Return 0. * common/hwcentry.h: Add config1. * src/collctrl.cc (Coll_Ctrl::build_data_desc):Set config1. * common/hwcfuncs.c (process_data_descriptor): Set config1. * common/hwctable.c: Add the hwc table for Intel Ice Lake processor. * src/hwc_intel_icelake.h: New file.
2024-06-03gprofng: add hardware counters for AMD Zen4Vladimir Mezentsev2-1/+867
ChangeLog 2024-06-01 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * common/hwctable.c: Add the hwc table for AMD Zen4. * src/hwc_amd_zen4.h: New file. * src/hwc_amd_zen3.h: Define _HWC_AMD_ZEN3_H.
2024-05-21gprofng: use StringBuilder to create long messagesVladimir Mezentsev2-283/+179
ChangeLog 2024-05-20 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/collctrl.cc: Use StringBuilder to create messages. Remove unused variables and arrays. * src/collctrl.h: Remove unused variables.
2024-05-17gprofng: add hardware counters for AMD Zen3Vladimir Mezentsev3-4/+636
Historically, we have used several APIs (perfctr, libcpc, perf_event_open) for profiling. For each hardware we have several tables of hardware counters. Some information is duplicated in these tables. Some of the information is no longer used. I did not touch the existing hwc tables. I added a new hwc table for an AMD Zen3 machine. ChangeLog 2024-05-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31123 * common/core_pcbe.c (core_pcbe_get_events): Add new argument. * common/hwc_cpus.h: New constants for AMD hardware. * common/hwcdrv.c: Add new argument to hwcdrv_get_descriptions. Clean up the code. * common/hwcdrv.h: Likewise. * common/hwcfuncs.c (hwcdrv_get_descriptions): Add new argument. * common/hwctable.c: Add the hwc table for AMD Zen3. * src/hwc_amd_zen3.h: New file. * common/opteron_pcbe.c: Add new argument to opt_pcbe_get_events. * src/collctrl.cc: Remove unused variable. * src/collctrl.h: Likewise.
2024-05-17gprofng: remove old interface with libcpcVladimir Mezentsev2-18/+1
interface with libcpc was used on Solaris. gprofng doesn't support profiling on Solaris. I removed this old code and other unused macros and variables. gprofng/ChangeLog 2024-04-29 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31123 * common/hwcdrv.c: remove old interface with libcpc. * common/hwcdrv.h: Likewise. * common/hwcentry.h: Likewise. * common/hwcfuncs.c: Likewise. * common/hwcfuncs.h: Likewise. * common/hwctable.c: Likewise. * src/Dbe.cc: Likewise. * src/collctrl.cc: Likewise.
2024-05-08Fix hard-coded bash path in gprofngVladimir Mezentsev1-0/+1
When running 'make check', the default gprofng test suite creates a shell script for which it used a hardcoded shebang of '/usr/bin/bash' this script would not run if bash is in a different location, like /bin/bash This commit adds 'AC_PATH_PROG(BASH, bash)' to configure.ac so the installation path of bash is detected at configuration time. The configuration is propagated to the runtest command line where it is needed.
2024-01-22Fix 31252 gprofng causes testsuite parallel jobs failVladimir Mezentsev1-7/+29
Before running our tests, we made a fake installation into ./tmpdir. This installation changes libopcodes.la in the build area. Gas testing may fail if gas and gprofng tests are run in parallel. I create a script to run gprofng. Inside this script, LD_LIBRARY_PATH, GPROFNG_SYSCONFDIR are set. putenv_libcollector_ld_misc() first uses $GPROFNG_PRELOAD_LIBDIRS to create directories for SP_COLLECTOR_LIBRARY_PATH ($SP_COLLECTOR_LIBRARY_PATH is used to set up LD_PRELOAD). gprofng/ChangeLog 2024-01-19 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31252 PR gprofng/30808 * src/envsets.cc (putenv_libcollector_ld_misc): Use $GPROFNG_PRELOAD_LIBDIRS first to build SP_COLLECTOR_LIBRARY_PATH. * testsuite/config/default.exp: Create a script to run gprofng. * testsuite/lib/display-lib.exp: Fix typo.
2024-01-12gprofng: 30889 can't compile without large file supportVladimir Mezentsev1-0/+4
gprofng/ChangeLog 2024-01-12 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR 30889 * src/util.h (O_LARGEFILE): Define to 0, if not defined.
2024-01-10gprofng: 31123 improvements to hardware event implementationVladimir Mezentsev1-100/+111
Our hardware counter profiling is based on perf_event_open(). Our HWC tables are absent for new machines. I have added HWC tables for the following events: PERF_TYPE_HARDWARE, PERF_TYPE_SOFTWARE, PERF_TYPE_HW_CACHE. Other events require additional fixes. Did a little cleaning: marked the symbols as static, used Stringbuilder, created a function to read /proc/cpuinfo. gprofng/ChangeLog 2024-01-08 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31123 * common/core_pcbe.c: Mark the symbols as static. Add events_generic[]. * common/hwc_cpus.h: Declare a new function read_cpuinfo. * common/hwcdrv.c: Add a new parameter in init_perf_event(). * common/hwcentry.h: Add use_perf_event_type in Hwcentry. * common/hwcfuncs.c (process_data_descriptor): Read use_perf_event_type, type, config. * common/hwctable.c: Add a new HWC table generic_list[]. * common/opteron_pcbe.c (opt_pcbe_init): Accept AMD machines. * src/collctrl.cc: Use StringBuilder in Coll_Ctrl::build_data_desc(). Add a new function read_cpuinfo.
2024-01-04Update year range in copyright notice of binutils filesAlan Modra192-193/+193
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-12-22gprofng: fix build problems on linux-muslVladimir Mezentsev9-25/+31
ino64_t, off64_t, fpos64_t, stat64, __u64 are not defined on linux-musl. Fixed by declaring these types for linux-musl. 2023-12-21 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/30779 PR gprofng/29593 * common/gp-defs.h: Define ino64_t, off64_t, fpos64_t for linux-musl. * libcollector/unwind.c: Define __u64 for linux-musl. * src/util.h: Define dbe_stat_t. * src/ClassFile.cc: Use dbe_stat_t instead of "struct stat64". * src/Dbe.cc: Likewise. * src/DbeFile.cc: Likewise. * src/DbeFile.h: Likewise. * src/DbeSession.cc: Likewise. * src/Experiment.cc: Likewise. * src/checks.cc: Likewise. * src/util.cc: Likewise.
2023-12-20gprofng: 31169 Source code locations can not be found in a C++ applicationVladimir Mezentsev1-1/+4
gprofng incorrectly reads the form of the DW_FORM_ref_addr attribute for DWARF Version 3 or later. From DWARF specification: References that use the attribute form DW_FORM_ref_addr are specified to be four bytes in the DWARF 32-bit format and eight bytes in the DWARF 64-bit format, while DWARF Version 2 specifies that such references have the same size as an address on the target system. 2023-12-18 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31169 * src/DwarfLib.cc: Fix the reader for DW_FORM_ref_addr.
2023-12-14gprofng: fix -Wuse-after-free warningVladimir Mezentsev1-4/+0
Removed incorrect unnecessary code. gprofng/ChangeLog 2023-12-13 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/collctrl.cc (set_synctrace): Fix -Wuse-after-free warning.