:::::::::::::: t.h :::::::::::::: struct foo { int count; long *bars; }; extern int frob (struct foo *f); :::::::::::::: f.c :::::::::::::: #include "t.h" int frob (struct foo *f) { int i = f->count; if (f && f->count > 0) { int j = f->bars[f->count -1]; i += j; } return i; } :::::::::::::: m.c :::::::::::::: #include "t.h" int main (int argc, char **argv) { int res; struct foo f; f.count = argc; res = frob (&f); return res; } $ gcc -g -c f.c $ gcc -g -c m.c $ gcc -g -o m f.o m.o $ eu-readelf --debug-dump=info m DWARF section [27] '.debug_info' at offset 0x10a5: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 [ b] compile_unit abbrev: 1 producer (strp) "GNU C11 7.2.0 -g" language (data1) C99 (12) name (string) "f.c" comp_dir (strp) "/home/mark/build" low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) stmt_list (sec_offset) 0 [ 2d] structure_type abbrev: 2 name (string) "foo" byte_size (data1) 16 decl_file (data1) t.h (2) decl_line (data1) 1 sibling (ref4) [ 52] [ 39] member abbrev: 3 name (strp) "count" decl_file (data1) t.h (2) decl_line (data1) 3 type (ref4) [ 52] data_member_location (data1) 0 [ 45] member abbrev: 3 name (strp) "bars" decl_file (data1) t.h (2) decl_line (data1) 4 type (ref4) [ 59] data_member_location (data1) 8 [ 52] base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" [ 59] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 5f] [ 5f] base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (strp) "long int" [ 66] subprogram abbrev: 7 external (flag_present) yes name (strp) "frob" decl_file (data1) f.c (1) decl_line (data1) 3 prototyped (flag_present) yes type (ref4) [ 52] low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) [ bd] [ 87] formal_parameter abbrev: 8 name (string) "f" decl_file (data1) f.c (1) decl_line (data1) 3 type (ref4) [ bd] location (exprloc) [ 0] reg5 [ 92] variable abbrev: 9 name (string) "i" decl_file (data1) f.c (1) decl_line (data1) 5 type (ref4) [ 52] location (exprloc) [ 0] reg0 [ 9d] lexical_block abbrev: 10 low_pc (addr) +0x0000000000000605 high_pc (data8) 11 (+0x0000000000000610 ) [ ae] variable abbrev: 11 name (string) "j" decl_file (data1) f.c (1) decl_line (data1) 8 type (ref4) [ 52] location (sec_offset) location list [ 0] [ bd] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 2d] Compilation unit at offset 196: Version: 4, Abbreviation section offset: 163, Address size: 8, Offset size: 4 [ cf] compile_unit abbrev: 1 producer (strp) "GNU C11 7.2.0 -g" language (data1) C99 (12) name (string) "m.c" comp_dir (strp) "/home/mark/build" low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) stmt_list (sec_offset) 65 [ f1] structure_type abbrev: 2 name (string) "foo" byte_size (data1) 16 decl_file (data1) t.h (2) decl_line (data1) 1 sibling (ref4) [ 116] [ fd] member abbrev: 3 name (strp) "count" decl_file (data1) t.h (2) decl_line (data1) 3 type (ref4) [ 116] data_member_location (data1) 0 [ 109] member abbrev: 3 name (strp) "bars" decl_file (data1) t.h (2) decl_line (data1) 4 type (ref4) [ 11d] data_member_location (data1) 8 [ 116] base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" [ 11d] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 123] [ 123] base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (strp) "long int" [ 12a] subprogram abbrev: 7 external (flag_present) yes name (strp) "main" decl_file (data1) m.c (1) decl_line (data1) 3 prototyped (flag_present) yes type (ref4) [ 116] low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) [ 197] [ 14b] formal_parameter abbrev: 8 name (strp) "argc" decl_file (data1) m.c (1) decl_line (data1) 3 type (ref4) [ 116] location (sec_offset) location list [ 2b] [ 15a] formal_parameter abbrev: 8 name (strp) "argv" decl_file (data1) m.c (1) decl_line (data1) 3 type (ref4) [ 197] location (sec_offset) location list [ 78] [ 169] variable abbrev: 9 name (string) "res" decl_file (data1) m.c (1) decl_line (data1) 5 type (ref4) [ 116] location (exprloc) [ 0] reg0 [ 176] variable abbrev: 9 name (string) "f" decl_file (data1) m.c (1) decl_line (data1) 6 type (ref4) [ f1] location (exprloc) [ 0] fbreg -32 [ 182] GNU_call_site abbrev: 10 low_pc (addr) +0x0000000000000621 abstract_origin (ref4) [ 1aa] [ 18f] GNU_call_site_parameter abbrev: 11 location (exprloc) [ 0] reg5 GNU_call_site_value (exprloc) [ 0] breg7 0 [ 197] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 19d] [ 19d] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 1a3] [ 1a3] base_type abbrev: 6 byte_size (data1) 1 encoding (data1) signed_char (6) name (strp) "char" [ 1aa] subprogram abbrev: 12 external (flag_present) yes declaration (flag_present) yes linkage_name (strp) "frob" name (strp) "frob" decl_file (data1) t.h (2) decl_line (data1) 7 $ gcc -g -fdebug-types-section -c f.c $ gcc -g -fdebug-types-section -c m.c $ gcc -g -o mt f.o m.o $ eu-readelf --debug-dump=info mt DWARF section [27] '.debug_info' at offset 0x10a5: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 [ b] compile_unit abbrev: 7 producer (strp) "GNU C11 7.2.0 -g -fdebug-types-section" language (data1) C99 (12) name (string) "f.c" comp_dir (strp) "/home/mark/build" low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) stmt_list (sec_offset) 0 [ 2d] base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" [ 34] base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (strp) "long int" [ 3b] subprogram abbrev: 8 external (flag_present) yes name (strp) "frob" decl_file (data1) f.c (1) decl_line (data1) 3 prototyped (flag_present) yes type (ref4) [ 2d] low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) [ 92] [ 5c] formal_parameter abbrev: 9 name (string) "f" decl_file (data1) f.c (1) decl_line (data1) 3 type (ref4) [ 92] location (exprloc) [ 0] reg5 [ 67] variable abbrev: 10 name (string) "i" decl_file (data1) f.c (1) decl_line (data1) 5 type (ref4) [ 2d] location (exprloc) [ 0] reg0 [ 72] lexical_block abbrev: 11 low_pc (addr) +0x0000000000000605 high_pc (data8) 11 (+0x0000000000000610 ) [ 83] variable abbrev: 12 name (string) "j" decl_file (data1) f.c (1) decl_line (data1) 8 type (ref4) [ 2d] location (sec_offset) location list [ 0] [ 92] pointer_type abbrev: 13 byte_size (data1) 8 type (ref_sig8) {d7ebc2c07d8f4513} Compilation unit at offset 157: Version: 4, Abbreviation section offset: 181, Address size: 8, Offset size: 4 [ a8] compile_unit abbrev: 7 producer (strp) "GNU C11 7.2.0 -g -fdebug-types-section" language (data1) C99 (12) name (string) "m.c" comp_dir (strp) "/home/mark/build" low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) stmt_list (sec_offset) 65 [ ca] base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" [ d1] base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (strp) "long int" [ d8] subprogram abbrev: 8 external (flag_present) yes name (strp) "main" decl_file (data1) m.c (1) decl_line (data1) 3 prototyped (flag_present) yes type (ref4) [ ca] low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) [ 149] [ f9] formal_parameter abbrev: 9 name (strp) "argc" decl_file (data1) m.c (1) decl_line (data1) 3 type (ref4) [ ca] location (sec_offset) location list [ 2b] [ 108] formal_parameter abbrev: 9 name (strp) "argv" decl_file (data1) m.c (1) decl_line (data1) 3 type (ref4) [ 149] location (sec_offset) location list [ 78] [ 117] variable abbrev: 10 name (string) "res" decl_file (data1) m.c (1) decl_line (data1) 5 type (ref4) [ ca] location (exprloc) [ 0] reg0 [ 124] variable abbrev: 11 name (string) "f" decl_file (data1) m.c (1) decl_line (data1) 6 type (ref_sig8) {d7ebc2c07d8f4513} location (exprloc) [ 0] fbreg -32 [ 134] GNU_call_site abbrev: 12 low_pc (addr) +0x0000000000000621 abstract_origin (ref4) [ 15c] [ 141] GNU_call_site_parameter abbrev: 13 location (exprloc) [ 0] reg5 GNU_call_site_value (exprloc) [ 0] breg7 0 [ 149] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 14f] [ 14f] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 155] [ 155] base_type abbrev: 6 byte_size (data1) 1 encoding (data1) signed_char (6) name (strp) "char" [ 15c] subprogram abbrev: 14 external (flag_present) yes declaration (flag_present) yes linkage_name (strp) "frob" name (strp) "frob" decl_file (data1) t.h (2) decl_line (data1) 7 DWARF section [32] '.debug_types' at offset 0x1550: [Offset] Type unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Type signature: 0xd7ebc2c07d8f4513, Type offset: 0x1d [1d] [ 17] type_unit abbrev: 1 language (data1) C99 (12) stmt_list (sec_offset) 0 [ 1d] structure_type abbrev: 2 name (string) "foo" byte_size (data1) 16 decl_file (data1) t.h (2) decl_line (data1) 1 sibling (ref4) [ 42] [ 29] member abbrev: 3 name (strp) "count" decl_file (data1) t.h (2) decl_line (data1) 3 type (ref4) [ 42] data_member_location (data1) 0 [ 35] member abbrev: 3 name (strp) "bars" decl_file (data1) t.h (2) decl_line (data1) 4 type (ref4) [ 49] data_member_location (data1) 8 [ 42] base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" [ 49] pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) [ 4f] [ 4f] base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (strp) "long int" $ gcc -g -gsplit-dwarf -fdebug-types-section -c f.c $ gcc -g -gsplit-dwarf -fdebug-types-section -c m.c $ gcc -g -o msd f.o m.o $ eu-readelf --debug-dump=info msd DWARF section [27] '.debug_info' at offset 0x10a5: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0xce3162402c63b311 [ b] compile_unit abbrev: 1 low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) stmt_list (sec_offset) 0 GNU_dwo_name (strp) "f.dwo" comp_dir (strp) "/home/mark/build" GNU_pubnames (flag_present) yes GNU_addr_base (sec_offset) 0 GNU_dwo_id (data8) 0xce3162402c63b311 Compilation unit at offset 52: Version: 4, Abbreviation section offset: 26, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0x3a665130154a6a0e [ 3f] compile_unit abbrev: 1 low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) stmt_list (sec_offset) 65 GNU_dwo_name (strp) "m.dwo" comp_dir (strp) "/home/mark/build" GNU_pubnames (flag_present) yes GNU_addr_base (sec_offset) 24 GNU_dwo_id (data8) 0x3a665130154a6a0e $ eu-readelf --debug-dump=info+ msd DWARF section [27] '.debug_info' at offset 0x10a5: [Offset] Compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0xce3162402c63b311 [ b] compile_unit abbrev: 1 low_pc (addr) +0x00000000000005fa high_pc (data8) 24 (+0x0000000000000612
) stmt_list (sec_offset) 0 GNU_dwo_name (strp) "f.dwo" comp_dir (strp) "/home/mark/build" GNU_pubnames (flag_present) yes GNU_addr_base (sec_offset) 0 GNU_dwo_id (data8) 0xce3162402c63b311 Split compilation unit at offset 0: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0xce3162402c63b311 { b} compile_unit abbrev: 7 producer (GNU_str_index) "GNU C11 7.2.0 -g -gsplit-dwarf" language (data1) C99 (12) name (string) "f.c" comp_dir (GNU_str_index) "/home/mark/build" GNU_dwo_id (data8) 0xce3162402c63b311 { 1b} base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" { 22} base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (GNU_str_index) "long int" { 26} subprogram abbrev: 8 external (flag_present) yes name (GNU_str_index) "frob" decl_file (data1) 1 decl_line (data1) 3 prototyped (flag_present) yes type (ref4) { 1b} low_pc (GNU_addr_index) ??? high_pc (data8) 24 frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) { 6c} { 3d} formal_parameter abbrev: 9 name (string) "f" decl_file (data1) 1 decl_line (data1) 3 type (ref4) { 6c} location (exprloc) [ 0] reg5 { 48} variable abbrev: 10 name (string) "i" decl_file (data1) 1 decl_line (data1) 5 type (ref4) { 1b} location (exprloc) [ 0] reg0 { 53} lexical_block abbrev: 11 low_pc (GNU_addr_index) ??? high_pc (data8) 11 { 5d} variable abbrev: 12 name (string) "j" decl_file (data1) 1 decl_line (data1) 8 type (ref4) { 1b} location (sec_offset) location list [ 0] { 6c} pointer_type abbrev: 13 byte_size (data1) 8 type (ref_sig8) {d7ebc2c07d8f4513} Compilation unit at offset 52: Version: 4, Abbreviation section offset: 26, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0x3a665130154a6a0e [ 3f] compile_unit abbrev: 1 low_pc (addr) +0x0000000000000612
high_pc (data8) 20 (+0x0000000000000626) stmt_list (sec_offset) 65 GNU_dwo_name (strp) "m.dwo" comp_dir (strp) "/home/mark/build" GNU_pubnames (flag_present) yes GNU_addr_base (sec_offset) 24 GNU_dwo_id (data8) 0x3a665130154a6a0e Split compilation unit at offset 52: Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Unit type: skeleton (4), Unit id: 0x3a665130154a6a0e { b} compile_unit abbrev: 7 producer (GNU_str_index) "GNU C11 7.2.0 -g -gsplit-dwarf" language (data1) C99 (12) name (string) "m.c" comp_dir (GNU_str_index) "/home/mark/build" GNU_dwo_id (data8) 0x3a665130154a6a0e { 1b} base_type abbrev: 4 byte_size (data1) 4 encoding (data1) signed (5) name (string) "int" { 22} base_type abbrev: 6 byte_size (data1) 8 encoding (data1) signed (5) name (GNU_str_index) "long int" { 26} subprogram abbrev: 8 external (flag_present) yes name (GNU_str_index) "main" decl_file (data1) 1 decl_line (data1) 3 prototyped (flag_present) yes type (ref4) { 1b} low_pc (GNU_addr_index) ??? high_pc (data8) 20 frame_base (exprloc) [ 0] call_frame_cfa GNU_all_call_sites (flag_present) yes sibling (ref4) { 80} { 3d} formal_parameter abbrev: 9 name (GNU_str_index) "argc" decl_file (data1) 1 decl_line (data1) 3 type (ref4) { 1b} location (sec_offset) location list [ 0] { 49} formal_parameter abbrev: 9 name (GNU_str_index) "argv" decl_file (data1) 1 decl_line (data1) 3 type (ref4) { 80} location (sec_offset) location list [ 20] { 55} variable abbrev: 10 name (string) "res" decl_file (data1) 1 decl_line (data1) 5 type (ref4) { 1b} location (exprloc) [ 0] reg0 { 62} variable abbrev: 11 name (string) "f" decl_file (data1) 1 decl_line (data1) 6 type (ref_sig8) {d7ebc2c07d8f4513} location (exprloc) [ 0] fbreg -32 { 72} GNU_call_site abbrev: 12 low_pc (GNU_addr_index) ??? abstract_origin (ref4) { 90} { 78} GNU_call_site_parameter abbrev: 13 location (exprloc) [ 0] reg5 GNU_call_site_value (exprloc) [ 0] breg7 0 { 80} pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) { 86} { 86} pointer_type abbrev: 5 byte_size (data1) 8 type (ref4) { 8c} { 8c} base_type abbrev: 6 byte_size (data1) 1 encoding (data1) signed_char (6) name (GNU_str_index) "char" { 90} subprogram abbrev: 14 external (flag_present) yes declaration (flag_present) yes linkage_name (GNU_str_index) "frob" name (GNU_str_index) "frob" decl_file (data1) 2 decl_line (data1) 7 $ dwp --exec msd => msd.dwp Contents of the .debug_cu_index section: Version: 2 Number of columns: 5 Number of used entries: 2 Number of slots: 16 Offset table slot dwo_id info abbrev line loc str_off [ 1] 0xce3162402c63b311 0 0 0 0 0 [ 14] 0x3a665130154a6a0e 119 185 44 18 24 Size table slot dwo_id info abbrev line loc str_off [ 1] 0xce3162402c63b311 119 185 44 18 24 [ 14] 0x3a665130154a6a0e 150 210 44 54 40 Contents of the .debug_tu_index section: Version: 2 Number of columns: 5 Number of used entries: 1 Number of slots: 16 Offset table slot signature types abbrev line loc str_off [ 3] 0xd7ebc2c07d8f4513 0 0 0 0 0 Size table slot signature types abbrev line loc str_off [ 3] 0xd7ebc2c07d8f4513 78 185 44 18 24