Skip to content

Instantly share code, notes, and snippets.

@alarcher
Created May 22, 2018 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alarcher/0dfaac187a6fbebd1e35c6a1fac07a69 to your computer and use it in GitHub Desktop.
Save alarcher/0dfaac187a6fbebd1e35c6a1fac07a69 to your computer and use it in GitHub Desktop.
#32-bit
> ./xgcc -c -g -save-temps -o t.o t.S && cat t.s && readelf -w t.o
foo: ret
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 45
DWARF Version: 2
Prologue Length: 26
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 arg
Opcode 3 has 1 arg
Opcode 4 has 1 arg
Opcode 5 has 1 arg
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 arg
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 arg
The Directory Table is empty.
The File Name Table (offset 0x1c):
Entry Dir Time Size Name
1 0 0 0 t.s
Line Number Statements:
[0x00000024] Extended opcode 2: set Address to 0x0
[0x0000002b] Copy
[0x0000002c] Advance PC by 1 to 0x1
[0x0000002e] Extended opcode 1: End of Sequence
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x22 (32-bit)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_low_pc : 0x0
<14> DW_AT_high_pc : 0x1
<18> DW_AT_name : (indirect string, offset: 0x0): t.s
<1c> DW_AT_comp_dir : (indirect string, offset: 0x4): /scratch/alarcher/oi-userland/components/developer/gcc-8/build/i86/gcc
<20> DW_AT_producer : (indirect string, offset: 0x4b): GNU AS 2.30
<24> DW_AT_language : 32769 (MIPS assembler)
Contents of the .debug_abbrev section:
Number TAG (0x0)
1 DW_TAG_compile_unit [no children]
DW_AT_stmt_list DW_FORM_data4
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_name DW_FORM_strp
DW_AT_comp_dir DW_FORM_strp
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data2
DW_AT value: 0 DW_FORM value: 0
Contents of the .debug_aranges section:
Length: 28
Version: 2
Offset into .debug_info: 0x0
Pointer Size: 4
Segment Size: 0
Address Length
00000000 00000001
00000000 00000000
Contents of the .debug_str section:
0x00000000 742e7300 2f736372 61746368 2f616c61 t.s./scratch/ala
0x00000010 72636865 722f6f69 2d757365 726c616e rcher/oi-userlan
0x00000020 642f636f 6d706f6e 656e7473 2f646576 d/components/dev
0x00000030 656c6f70 65722f67 63632d38 2f627569 eloper/gcc-8/bui
0x00000040 6c642f69 38362f67 63630047 4e552041 ld/i86/gcc.GNU A
0x00000050 5320322e 333000 S 2.30.
#64-bit
> ./xgcc -m64 -c -g -save-temps -o t64.o t.S && cat t.s && readelf -w t64.o
foo: ret
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 49
DWARF Version: 2
Prologue Length: 26
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 arg
Opcode 3 has 1 arg
Opcode 4 has 1 arg
Opcode 5 has 1 arg
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 arg
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 arg
The Directory Table is empty.
The File Name Table (offset 0x1c):
Entry Dir Time Size Name
1 0 0 0 t.s
Line Number Statements:
[0x00000024] Extended opcode 2: set Address to 0x0
[0x0000002f] Copy
[0x00000030] Advance PC by 1 to 0x1
[0x00000032] Extended opcode 1: End of Sequence
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x2a (32-bit)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 8
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_low_pc : 0x0
<18> DW_AT_high_pc : 0x1
<20> DW_AT_name : (indirect string, offset: 0x0): t.s
<24> DW_AT_comp_dir : (indirect string, offset: 0x4): /scratch/alarcher/oi-userland/components/developer/gcc-8/build/i86/gcc
<28> DW_AT_producer : (indirect string, offset: 0x4b): GNU AS 2.30
<2c> DW_AT_language : 32769 (MIPS assembler)
Contents of the .debug_abbrev section:
Number TAG (0x0)
1 DW_TAG_compile_unit [no children]
DW_AT_stmt_list DW_FORM_data4
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_name DW_FORM_strp
DW_AT_comp_dir DW_FORM_strp
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data2
DW_AT value: 0 DW_FORM value: 0
Contents of the .debug_aranges section:
Length: 44
Version: 2
Offset into .debug_info: 0x0
Pointer Size: 8
Segment Size: 0
Address Length
0000000000000000 0000000000000001
0000000000000000 0000000000000000
Contents of the .debug_str section:
0x00000000 742e7300 2f736372 61746368 2f616c61 t.s./scratch/ala
0x00000010 72636865 722f6f69 2d757365 726c616e rcher/oi-userlan
0x00000020 642f636f 6d706f6e 656e7473 2f646576 d/components/dev
0x00000030 656c6f70 65722f67 63632d38 2f627569 eloper/gcc-8/bui
0x00000040 6c642f69 38362f67 63630047 4e552041 ld/i86/gcc.GNU A
0x00000050 5320322e 333000 S 2.30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment