【问题标题】:How to print the compilation directory recored in linux elf binary?如何打印linux elf二进制中的编译目录记录?
【发布时间】:2020-04-01 10:39:56
【问题描述】:

gdb 文档说编译目录可能记录在可执行文件https://sourceware.org/gdb/current/onlinedocs/gdb/Source-Path.html

可执行程序有时不记录目录 编译它们的源文件,只是名称。即使当 他们这样做了,目录可以在编译和 您的调试会话。

假设可执行文件记录编译目录。如何打印编译目录?

【问题讨论】:

    标签: linux gdb elf


    【解决方案1】:

    像这样:

    cd /tmp
    gcc -g t.c
    readelf -Wwi a.out | grep DW_AT_comp_dir
    
        <15>   DW_AT_comp_dir    : (indirect string, offset: 0x2ab): /tmp
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-07
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 2015-01-11
      • 2017-10-11
      相关资源
      最近更新 更多