C++ c++;dwarf标记编号格式
考虑以下侏儒代码示例-C++ c++;dwarf标记编号格式,c++,dwarf,C++,Dwarf,考虑以下侏儒代码示例- <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) <c> DW_AT_producer : (indirect string, offset: 0xd): GNU C++ 4.3.0 20080428 (Red Hat 4.3.0-8) <10> DW_AT_language : 4 (C++) <11> DW_
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_producer : (indirect string, offset: 0xd): GNU C++ 4.3.0 20080428 (Red Hat 4.3.0-8)
<10> DW_AT_language : 4 (C++)
<11> DW_AT_name : (indirect string, offset: 0x75): test.cpp
<15> DW_AT_comp_dir : (indirect string, offset: 0x4d): /home/dwarf
<19> DW_AT_low_pc : 0x0
<21> DW_AT_high_pc : 0xb
<29> DW_AT_stmt_list : 0x0
<1><2d>: Abbrev Number: 2 (DW_TAG_class_type)
<2e> DW_AT_name : C
<30> DW_AT_byte_size : 8
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 1
<33> DW_AT_sibling : <0x86>
<2><37>: Abbrev Number: 3 (DW_TAG_member)
<38> DW_AT_name : x
<3a> DW_AT_decl_file : 1
<3b> DW_AT_decl_line : 7
<3c> DW_AT_type : <0x86>
<40> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<43> DW_AT_accessibility: 3 (private)
<2><44>: Abbrev Number: 3 (DW_TAG_member)
<45> DW_AT_name : y
<47> DW_AT_decl_file : 1
<48> DW_AT_decl_line : 8
<49> DW_AT_type : <0x86>
<4d> DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4)
<50> DW_AT_accessibility: 3 (private)
DWARF模具组织为一棵树-单个文件的顶层
DW\u TAG\u compile\u单元
将包含所有类型定义(DW\u TAG\u class\u type
)、所有函数(DW\u TAG\u子程序
)和全局/静态变量(DW\u TAG\u变量
)。类定义(DW\u TAG\u class\u type
)将是一个父级骰子,并包含子级,如成员变量的DW\u TAG\u member
,或方法的DW\u TAG\u subprogram
您附加的输出是您的特定DWARF转储程序的操作方式—看起来它正在使用该数字来显示父/子关系。这是不是readelf
?其他矮人转储程序可能会选择以不同的方式显示这一点。在Mac OS X上,dwarfdump
显示了这种与缩进的关系-子模具的缩进程度略高于父模具
如果您在上查看DWARF规范,您在标准中找不到关于这个数字的任何信息——但是如果您编写了一个真正的DWARF解析器(与解释
readelf
或任何内容的输出的解析器相反),您将在第2.3节(“调试信息条目的关系”)中看到这个主题以及DWARF4规范中的第7.5.3节“缩写表”(DW\u CHILDREN\u yes
或DW\u CHILDREN\u no
)。我想我的项目正在解析它。
class C {
public:
C();
C(int x, int y);
int getX();
private:
int x;
int y;
};
class SubC : public C {
int z;
};
int f() {return 0;}
C c;
SubC subC;
int i;
double d;