0

我有这样的场景:

int open_ext2 () {}
int close_ext2 () {}
int read_ext2 () {}
int write_ext2 () {}


const struct fs_callbacks FS = {
    open_file: open_ext2,
    close_file: close_ext2,
    read_bytes: read_ext2,
    write_bytes: write_ext2
};

void main(){
    FS.close_file();
}

当我查看 gimple 表示(用 编译-fdump-tree-all)时,我看到如下内容:

D.1796 = close_ext2;
D.1796 ();

我没有得到的是任务发生在哪里open_file: open_ext2

我的问题

  • GCC 是如何做到这一点的?
  • 它发生在什么阶段?
  • 有没有办法找出映射标签-> 成员函数?
4

1 回答 1

2

找到了答案

gcc 选项-fdump-tree-original-raw转储信息

使用 GCC 插件:

  • 使用通行证 PLUGIN_FINISH_DECL
  • 查看debug_variable文件中函数的 GCC 源代码:gcc/tree-dfa.c
于 2017-11-08T08:33:01.503 回答