kcachegrind 无法打开 callgrind 文件

kcachegrind unable to open callgrind file

我正在使用 callgrind 分析一小段代码。 Callgrind 输出文件生成良好,内容看起来不错,但我无法使用 kcachegrind 打开它们:我收到以下错误消息:

Could not open file "callgrind.out.4953". Check it exists and you have enough permissions to read it.

我对它们所在的文件和目录拥有所有权限,但存在同样的问题。此外,它适用于同一工作区中其他文件夹中的其他项目。我还指出,在这两种情况下,进程都正确终止。

我最近向 kcachegrind 开发人员报告了一个症状完全相同的问题。当 callgrind 与非常长的命令行一起使用时,会触发该问题。这在 valgrind/callgrind 和 kcachegrind 的下一版本中得到修复。 在 valgrind 端的提交日志下方找到。 等待 valgrind 和 kcachegrind 的新版本,如果你的问题 也是由于命令行太长,您可以直接编辑文件并截断​​ cmd: 行。 如果您的问题不是 cmd 行的长度,那么我想您将需要使用 callgrind_annotate(如果可行)或进一步调查为什么 kcachegrind 发现您的文件有问题。

Author: weidendo Date: Tue Jan 10 20:21:21 2017 New Revision: 16196

Log: Add a format marker to callgrind files

KCachegrind currently uses a quick format detection before actually loading a file, and checks for a line starting with "events:" in the first 2kB for that. This obviously is fragile, as shown by an internal bug report by Philippe: before the "events" line, Callgrind puts a "cmd:" line with the command line. If this is very long, the detection fails and the file does not get loaded at all.

While KCachegrind would not need to have this quick format check at all, it is useful if multiple input format filters get supported at some point, to automatically select the correct filter.

Further, for the "file" command, for file managers and desktop environments, having an unique way to detect a file format is important.

It is not too late to fix this issue for the callgrind format.