使用分析工具的函数调用图选项时出现日食 CDT 错误

Eclipse CDT error while using Function Callgraph option of Profiling Tools

本文关键字:错误 CDT 选项 工具 函数调用      更新时间:2023-10-16

我在使用分析工具的函数调用图选项时在 Eclipse CDT 中收到以下错误

/tmp/org.eclipse.linuxtools.profiling.launch14272008124383356638983332386495.sh: 2: /tmp/org.eclipse.linuxtools.profiling.launch14272008124383356638983332386495.sh: Syntax error: Bad fd number

我用谷歌搜索了这个错误。我发现问题出在>&.答案表明,可以通过将其替换为&>来解决该问题。但是如何做到这一点,因为日食会创建文件?

下面是我使用分析工具的示例 C 代码。但是我有一个巨大的代码,我面临着同样的问题。

/*
 ============================================================================
 Name        : hello.c
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */
#include <stdio.h>
#include <stdlib.h>
void abc() {
}
int main(void) {
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    abc();
    return EXIT_SUCCESS;
}

下面是错误中提到的 shell 脚本

#!/bin/sh
exec stap -c '/home/tejus/workspaces/testC/hello/Debug/hello' /home/tejus/workspaces/testC/.metadata/.plugins/org.eclipse.linuxtools.callgraph.core/callgraphGen.stp --runtime=dyninst /home/tejus/workspaces/testC/hello/Debug/hello >& /home/tejus/workspaces/testC/.metadata/.plugins/org.eclipse.linuxtools.callgraph.core/callgraph.out

我在两个 C/C++ 代码中都面临同样的问题。

这可能是因为 bash 和 sh 中的样式不同。 试试这个:将/bin/sh 的旧链接重命名为 bash,并将/bin/sh 的新链接重命名为 bash。

cd /bin
sudo mv sh sh_orig
sudo ln -s /bin/bash sh