gprofng: Properly generate file offset for gmon.out
Patch to fix gmon.out file offset generation in gprofng is approved.
Claudiu Zissulescu Ianculescu LGTMs (Looks Good To Me) the patch submitted by H.J. Lu, which aims to fix the generation of the file offset for gmon.out in the gprofng tool. The patch corrects an issue where the file offset was not being properly retrieved, causing failures on Linux/x86-64. The fix involves getting the file offset from the filepos field of core_text_sect.
- reviewer
Approved the patch, indicating it meets the criteria for merging.
“LGTM,”
- proposer
Originally submitted the patch to fix gmon.out file offset generation and sought feedback.
“When generating the map file for gmon.out, get the file offset from the filepos field of core_text_sect. This fixes FAIL: tmpdir/gp-gmon on Linux/x86-64. PR gprofng/34502 * src/gp-gmon.cc (gen_gmon_map): Get the file offset from the filepos field of core_text_sect.”
- proposer
Followed up on the patch, asking for comments and feedback.
“Any comments and feedback?”
In Details
This patch for gprofng modifies the gen_gmon_map function in src/gp-gmon.cc. It corrects how the file offset for the gmon.out profiling data file is determined. Previously, it might have used an incorrect method, leading to failures (specifically PR gprofng/34502 on Linux/x86-64). The fix ensures that the filepos field of the core_text_sect is used to obtain the correct file offset, which is crucial for accurate profiling map generation.
- gprofng
- The next-generation version of the gprof profiling tool.
- gmon.out
- The default output file generated by the gprof profiler, containing call graph and timing information.
- File offset
- The position of a byte or group of bytes within a file, measured from the beginning of the file.
- Profiling
- The process of analyzing a program's execution to measure performance metrics like execution time, call counts, and memory usage.
- core_text_sect
- Likely refers to the section in an object file or executable that contains the program's code (text segment), with
sectpossibly indicating a structure representing this section. - filepos
- Likely a field within a section structure that stores the file offset or position of that section within the object file.