相关疑难解决方法(0)

为什么`-finstrument-functions`对我不起作用?

根据这个答案,它应该打印所有函数名称:

[root@ test]# cat hw.c
#include <stdio.h>

int func(void)
{  
  return 1;
}
int main(void)
{
  func();
  printf("%d",6);
  return 6;
}
[root@ test]# gcc -Wall hw.c -o hw -finstrument-functions
[root@ test]# ./hw 
6
[root@ test]# gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
Copyright (C) 2006 Free Software Foundation, Inc.
Run Code Online (Sandbox Code Playgroud)

但为什么它不适合我呢?

gcc

5
推荐指数
1
解决办法
6121
查看次数

任何人都可以建议跟踪函数的每个调用吗?

我想跟踪函数调用的每个路径.例如:

int a()
{
    b();
    return 1;
}
void b()
{
}
int main()
{
    int x=a();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

所以我的调用跟踪是main-> a-> b这样我想跟踪每个设置的调用路径.我想到了深度优先搜索.但我不确定这会怎样.任何人都可以建议我在perl中实现任何具体方法吗?我将拥有C程序文件,并将在其上运行perl脚本以获取调用跟踪.

c linux perl

3
推荐指数
1
解决办法
399
查看次数

标签 统计

c ×1

gcc ×1

linux ×1

perl ×1