https://bugs.kde.org/show_bug.cgi?id=419087

            Bug ID: 419087
           Summary: cachegrind file name output is bad for Go programs
           Product: valgrind
           Version: 3.15 SVN
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: cachegrind
          Assignee: n...@valgrind.org
          Reporter: mgrit...@gmail.com
  Target Milestone: ---

SUMMARY
cachegrind outputs file names like this:
fl=.//usr/local/go/src/errors/errors.go 
which cg_annotate cannot then parse

STEPS TO REPRODUCE
1. Compile a Go program (I used go 1.12.4)
2. valgrind --tool=cachegrind <program>, with Valgrind 3.16-GIT (Valgrind 3.13
fails to parse the debug info entirely, I think.)
3. Look at resulting cachegrind.out, or try to use it with cg_annotate

OBSERVED RESULT

The following files chosen for auto-annotation could not be found:
--------------------------------------------------------------------------------
  .//home/mark/profiling/main.go

EXPECTED RESULT

Find the file in /home/mark/profiling/main.go

SOFTWARE/OS VERSIONS
Ubuntu 18.04 LTS
Valgrind 3.16
Go 1.12.4

ADDITIONAL INFORMATION

Here's a quick patch that correctly handles a non-null directory if the
filename is already an absolute path. 

diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 927f3fb32..fdd3be2c3 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -248,7 +248,7 @@ static LineCC* get_lineCC(Addr origAddr)
    // Form an absolute pathname if a directory is available
    HChar absfile[VG_(strlen)(dir) + 1 + VG_(strlen)(file) + 1];

-   if (dir[0]) {
+   if (dir[0] && file[0] != '/') {
       VG_(sprintf)(absfile, "%s/%s", dir, file);
    } else {
       VG_(sprintf)(absfile, "%s", file);

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to