This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about other debuginfo reduction possibilities


Hi,

I tried to reduce the "debuginfo" files size (.debug_* sections) as each file
(compilation unit) currently has its own declarations of all the used types
from the include files.  It was briefly suggested by Jakub Jelinek although
his original intention could be more to unify the debuginfo across files.

It was more only a proof of concept (terrible code etc.), I just merged+patched
eu-strip + eu-readelf.  However even while the file format looks fine by
"eu-readelf -w" gdb(1) still segfaults on it, I did not debug it much more.

The only major difference is that there are DWARF2 references (DW_FORM_ref4)
across compilation units (and these references are even relative to the offset
of the compilation unit header).  Right now I found out it is a violation of
TIS-DWARF-2.0, page 73, keyword "reference":
	The offset must refer to an entry within that same compilation unit.

Attached eu-readelf(1) output of the original+compressed files + the source.
(.debug_info + .debug_abbrev are updated, .debug_line is unfortunately intact.)

So is it right there are no more methods for standards compliant DWARF-2.0 size
reduction?



Regards,
Jan Kratochvil
DWARF section '.debug_info' at offset 0x253a:
 [Offset]
 Compilation unit at offset 0:
 Version: 2, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit
           macro_info           0
           stmt_list            0
           high_pc              0x0804836d
           low_pc               0x08048354
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "main.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [    6a]    subprogram
             external             
             name                 "main"
             decl_file            1
             decl_line            2
             prototyped           
             type                 [   1f7]
             low_pc               0x08048354
             high_pc              0x0804836d
             frame_base           location list [     0]
 Compilation unit at offset 133:
 Version: 2, Abbreviation section offset: 56, Address size: 4, Offset size: 4
 [    90]  compile_unit
           macro_info           1941
           stmt_list            54
           high_pc              0x08048370
           low_pc               0x08048370
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "file0.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [    f0]    structure_type
             sibling              [   108]
             byte_size            4
             decl_file            1
             decl_line            7
 [    f8]      member
               name                 "item"
               decl_file            1
               decl_line            8
               type                 [   1f7]
               data_member_location 2 byte block
                [   0] plus_uconst 0
 [   108]    structure_type
             sibling              [   11f]
             name                 "outer"
             byte_size            4
             decl_file            1
             decl_line            6
 [   116]      member
               type                 [    f0]
               data_member_location 2 byte block
                [   0] plus_uconst 0
 [   11f]    variable
             name                 "var0"
             decl_file            1
             decl_line            3
             type                 [   1eb]
             location             5 byte block
              [   0] addr 134518056
 [   131]    variable
             name                 "outer"
             decl_file            1
             decl_line            10
             type                 [   108]
             location             5 byte block
              [   0] addr 134518060
 Compilation unit at offset 325:
 Version: 2, Abbreviation section offset: 169, Address size: 4, Offset size: 4
 [   150]  compile_unit
           macro_info           3886
           stmt_list            104
           high_pc              0x08048370
           low_pc               0x08048370
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "file1.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [   1b0]    variable
             name                 "var1"
             decl_file            1
             decl_line            3
             type                 [   1eb]
             location             5 byte block
              [   0] addr 134518064
 Compilation unit at offset 451:
 Version: 2, Abbreviation section offset: 230, Address size: 4, Offset size: 4
 [   1ce]  compile_unit
           stmt_list            154
           producer             "Red Hat elfutils 0.121"
           language             ISO C89 (1)
 [   1eb]    typedef
             name                 "type"
             decl_file            2
             decl_line            0
             type                 [   1f7]
 [   1f7]    base_type
             name                 "int"
             byte_size            4
             encoding             signed (5)

DWARF section '.debug_abbrev' at offset 0x2739:
 [ Code]

Abbreviation section at offset 0:
 [    1] offset: 0, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0
          attr: stmt_list, form: data4, offset: 0x2
          attr: high_pc, form: addr, offset: 0x4
          attr: low_pc, form: addr, offset: 0x6
          attr: producer, form: string, offset: 0x8
          attr: language, form: data1, offset: 0xa
          attr: name, form: string, offset: 0xc
          attr: comp_dir, form: string, offset: 0xe
 [    2] offset: 21, children: no, tag: subprogram
          attr: external, form: flag, offset: 0x15
          attr: name, form: string, offset: 0x17
          attr: decl_file, form: data1, offset: 0x19
          attr: decl_line, form: data1, offset: 0x1b
          attr: prototyped, form: flag, offset: 0x1d
          attr: type, form: ref4, offset: 0x1f
          attr: low_pc, form: addr, offset: 0x21
          attr: high_pc, form: addr, offset: 0x23
          attr: frame_base, form: data4, offset: 0x25
 [    3] offset: 44, children: no, tag: base_type
          attr: name, form: string, offset: 0x2c
          attr: byte_size, form: data1, offset: 0x2e
          attr: encoding, form: data1, offset: 0x30

Abbreviation section at offset 56:
 [    1] offset: 56, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0x38
          attr: stmt_list, form: data4, offset: 0x3a
          attr: high_pc, form: addr, offset: 0x3c
          attr: low_pc, form: addr, offset: 0x3e
          attr: producer, form: string, offset: 0x40
          attr: language, form: data1, offset: 0x42
          attr: name, form: string, offset: 0x44
          attr: comp_dir, form: string, offset: 0x46
 [    2] offset: 77, children: no, tag: typedef
          attr: name, form: string, offset: 0x4d
          attr: decl_file, form: data1, offset: 0x4f
          attr: decl_line, form: data1, offset: 0x51
          attr: type, form: ref4, offset: 0x53
 [    3] offset: 90, children: no, tag: base_type
          attr: name, form: string, offset: 0x5a
          attr: byte_size, form: data1, offset: 0x5c
          attr: encoding, form: data1, offset: 0x5e
 [    4] offset: 101, children: yes, tag: structure_type
          attr: sibling, form: ref4, offset: 0x65
          attr: byte_size, form: data1, offset: 0x67
          attr: decl_file, form: data1, offset: 0x69
          attr: decl_line, form: data1, offset: 0x6b
 [    5] offset: 114, children: no, tag: member
          attr: name, form: string, offset: 0x72
          attr: decl_file, form: data1, offset: 0x74
          attr: decl_line, form: data1, offset: 0x76
          attr: type, form: ref4, offset: 0x78
          attr: data_member_location, form: block1, offset: 0x7a
 [    6] offset: 129, children: yes, tag: structure_type
          attr: sibling, form: ref4, offset: 0x81
          attr: name, form: string, offset: 0x83
          attr: byte_size, form: data1, offset: 0x85
          attr: decl_file, form: data1, offset: 0x87
          attr: decl_line, form: data1, offset: 0x89
 [    7] offset: 144, children: no, tag: member
          attr: type, form: ref4, offset: 0x90
          attr: data_member_location, form: block1, offset: 0x92
 [    8] offset: 153, children: no, tag: variable
          attr: name, form: string, offset: 0x99
          attr: decl_file, form: data1, offset: 0x9b
          attr: decl_line, form: data1, offset: 0x9d
          attr: type, form: ref4, offset: 0x9f
          attr: location, form: block1, offset: 0xa1

Abbreviation section at offset 169:
 [    1] offset: 169, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0xa9
          attr: stmt_list, form: data4, offset: 0xab
          attr: high_pc, form: addr, offset: 0xad
          attr: low_pc, form: addr, offset: 0xaf
          attr: producer, form: string, offset: 0xb1
          attr: language, form: data1, offset: 0xb3
          attr: name, form: string, offset: 0xb5
          attr: comp_dir, form: string, offset: 0xb7
 [    2] offset: 190, children: no, tag: typedef
          attr: name, form: string, offset: 0xbe
          attr: decl_file, form: data1, offset: 0xc0
          attr: decl_line, form: data1, offset: 0xc2
          attr: type, form: ref4, offset: 0xc4
 [    3] offset: 203, children: no, tag: base_type
          attr: name, form: string, offset: 0xcb
          attr: byte_size, form: data1, offset: 0xcd
          attr: encoding, form: data1, offset: 0xcf
 [    4] offset: 214, children: no, tag: variable
          attr: name, form: string, offset: 0xd6
          attr: decl_file, form: data1, offset: 0xd8
          attr: decl_line, form: data1, offset: 0xda
          attr: type, form: ref4, offset: 0xdc
          attr: location, form: block1, offset: 0xde

Abbreviation section at offset 230:
 [    1] offset: 230, children: yes, tag: compile_unit
          attr: stmt_list, form: data4, offset: 0xe6
          attr: producer, form: string, offset: 0xe8
          attr: language, form: data1, offset: 0xea
 [    2] offset: 241, children: no, tag: typedef
          attr: name, form: string, offset: 0xf1
          attr: decl_file, form: data1, offset: 0xf3
          attr: decl_line, form: data1, offset: 0xf5
          attr: type, form: ref4, offset: 0xf7
 [    3] offset: 254, children: no, tag: base_type
          attr: name, form: string, offset: 0xfe
          attr: byte_size, form: data1, offset: 0x100
          attr: encoding, form: data1, offset: 0x102
DWARF section '.debug_info' at offset 0x6c7:
 [Offset]
 Compilation unit at offset 0:
 Version: 2, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit
           macro_info           0
           stmt_list            0
           high_pc              0x0804836d
           low_pc               0x08048354
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "main.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [    6a]    subprogram
             external             
             name                 "main"
             decl_file            1
             decl_line            2
             prototyped           
             type                 [    84]
             low_pc               0x08048354
             high_pc              0x0804836d
             frame_base           location list [     0]
 [    84]    base_type
             name                 "int"
             byte_size            4
             encoding             signed (5)
 Compilation unit at offset 140:
 Version: 2, Abbreviation section offset: 56, Address size: 4, Offset size: 4
 [    97]  compile_unit
           macro_info           1941
           stmt_list            54
           high_pc              0x08048370
           low_pc               0x08048370
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "file0.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [    f7]    typedef
             name                 "type"
             decl_file            2
             decl_line            1
             type                 [   103]
 [   103]    base_type
             name                 "int"
             byte_size            4
             encoding             signed (5)
 [   10a]    structure_type
             sibling              [   122]
             byte_size            4
             decl_file            1
             decl_line            7
 [   112]      member
               name                 "item"
               decl_file            1
               decl_line            8
               type                 [   103]
               data_member_location 2 byte block
                [   0] plus_uconst 0
 [   122]    structure_type
             sibling              [   139]
             name                 "outer"
             byte_size            4
             decl_file            1
             decl_line            6
 [   130]      member
               type                 [   10a]
               data_member_location 2 byte block
                [   0] plus_uconst 0
 [   139]    variable
             name                 "var0"
             decl_file            1
             decl_line            3
             type                 [    f7]
             location             5 byte block
              [   0] addr 134518056
 [   14b]    variable
             name                 "outer"
             decl_file            1
             decl_line            10
             type                 [   122]
             location             5 byte block
              [   0] addr 134518060
 Compilation unit at offset 351:
 Version: 2, Abbreviation section offset: 169, Address size: 4, Offset size: 4
 [   16a]  compile_unit
           macro_info           3886
           stmt_list            104
           high_pc              0x08048370
           low_pc               0x08048370
           producer             "GNU C 4.1.1 20060525 (Red Hat 4.1.1-1)"
           language             ISO C89 (1)
           name                 "file1.c"
           comp_dir             "/home/lace/redhat/my/debugpack"
 [   1ca]    typedef
             name                 "type"
             decl_file            2
             decl_line            1
             type                 [   1d6]
 [   1d6]    base_type
             name                 "int"
             byte_size            4
             encoding             signed (5)
 [   1dd]    variable
             name                 "var1"
             decl_file            1
             decl_line            3
             type                 [   1ca]
             location             5 byte block
              [   0] addr 134518064

DWARF section '.debug_abbrev' at offset 0x8b7:
 [ Code]

Abbreviation section at offset 0:
 [    1] offset: 0, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0
          attr: stmt_list, form: data4, offset: 0x2
          attr: high_pc, form: addr, offset: 0x4
          attr: low_pc, form: addr, offset: 0x6
          attr: producer, form: string, offset: 0x8
          attr: language, form: data1, offset: 0xa
          attr: name, form: string, offset: 0xc
          attr: comp_dir, form: string, offset: 0xe
 [    2] offset: 21, children: no, tag: subprogram
          attr: external, form: flag, offset: 0x15
          attr: name, form: string, offset: 0x17
          attr: decl_file, form: data1, offset: 0x19
          attr: decl_line, form: data1, offset: 0x1b
          attr: prototyped, form: flag, offset: 0x1d
          attr: type, form: ref4, offset: 0x1f
          attr: low_pc, form: addr, offset: 0x21
          attr: high_pc, form: addr, offset: 0x23
          attr: frame_base, form: data4, offset: 0x25
 [    3] offset: 44, children: no, tag: base_type
          attr: name, form: string, offset: 0x2c
          attr: byte_size, form: data1, offset: 0x2e
          attr: encoding, form: data1, offset: 0x30

Abbreviation section at offset 56:
 [    1] offset: 56, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0x38
          attr: stmt_list, form: data4, offset: 0x3a
          attr: high_pc, form: addr, offset: 0x3c
          attr: low_pc, form: addr, offset: 0x3e
          attr: producer, form: string, offset: 0x40
          attr: language, form: data1, offset: 0x42
          attr: name, form: string, offset: 0x44
          attr: comp_dir, form: string, offset: 0x46
 [    2] offset: 77, children: no, tag: typedef
          attr: name, form: string, offset: 0x4d
          attr: decl_file, form: data1, offset: 0x4f
          attr: decl_line, form: data1, offset: 0x51
          attr: type, form: ref4, offset: 0x53
 [    3] offset: 90, children: no, tag: base_type
          attr: name, form: string, offset: 0x5a
          attr: byte_size, form: data1, offset: 0x5c
          attr: encoding, form: data1, offset: 0x5e
 [    4] offset: 101, children: yes, tag: structure_type
          attr: sibling, form: ref4, offset: 0x65
          attr: byte_size, form: data1, offset: 0x67
          attr: decl_file, form: data1, offset: 0x69
          attr: decl_line, form: data1, offset: 0x6b
 [    5] offset: 114, children: no, tag: member
          attr: name, form: string, offset: 0x72
          attr: decl_file, form: data1, offset: 0x74
          attr: decl_line, form: data1, offset: 0x76
          attr: type, form: ref4, offset: 0x78
          attr: data_member_location, form: block1, offset: 0x7a
 [    6] offset: 129, children: yes, tag: structure_type
          attr: sibling, form: ref4, offset: 0x81
          attr: name, form: string, offset: 0x83
          attr: byte_size, form: data1, offset: 0x85
          attr: decl_file, form: data1, offset: 0x87
          attr: decl_line, form: data1, offset: 0x89
 [    7] offset: 144, children: no, tag: member
          attr: type, form: ref4, offset: 0x90
          attr: data_member_location, form: block1, offset: 0x92
 [    8] offset: 153, children: no, tag: variable
          attr: name, form: string, offset: 0x99
          attr: decl_file, form: data1, offset: 0x9b
          attr: decl_line, form: data1, offset: 0x9d
          attr: type, form: ref4, offset: 0x9f
          attr: location, form: block1, offset: 0xa1

Abbreviation section at offset 169:
 [    1] offset: 169, children: yes, tag: compile_unit
          attr: macro_info, form: data4, offset: 0xa9
          attr: stmt_list, form: data4, offset: 0xab
          attr: high_pc, form: addr, offset: 0xad
          attr: low_pc, form: addr, offset: 0xaf
          attr: producer, form: string, offset: 0xb1
          attr: language, form: data1, offset: 0xb3
          attr: name, form: string, offset: 0xb5
          attr: comp_dir, form: string, offset: 0xb7
 [    2] offset: 190, children: no, tag: typedef
          attr: name, form: string, offset: 0xbe
          attr: decl_file, form: data1, offset: 0xc0
          attr: decl_line, form: data1, offset: 0xc2
          attr: type, form: ref4, offset: 0xc4
 [    3] offset: 203, children: no, tag: base_type
          attr: name, form: string, offset: 0xcb
          attr: byte_size, form: data1, offset: 0xcd
          attr: encoding, form: data1, offset: 0xcf
 [    4] offset: 214, children: no, tag: variable
          attr: name, form: string, offset: 0xd6
          attr: decl_file, form: data1, offset: 0xd8
          attr: decl_line, form: data1, offset: 0xda
          attr: type, form: ref4, offset: 0xdc
          attr: location, form: block1, offset: 0xde

Attachment: debugpack-0.patch
Description: Text document

Attachment: debugpack-test-0.tar.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]