Re: gdb can't handle a DIE with both sibling and children

H. J. Lu
2003-07-31T18:27:14Z

On Thu, Jul 31, 2003 at 02:20:49PM -0400, Daniel Jacobowitz wrote:
>
> Why don't you be more specific? What problem is it causing, on what
> input?
>

I am trying to add support for DW_TAG_entry_point.

<1><8e>: Abbrev Number: 4 (DW_TAG_subprogram)

has both sibling and children. Since we skip to sibling, we miss the
children, which is

<2><c3>: Abbrev Number: 6 (DW_TAG_entry_point)

H.J.
----
The section .debug_info contains:

Compilation Unit @ 0:
Length: 304
Version: 2
Abbrev Offset: 0
Pointer Size: 4
<0>: Abbrev Number: 1 (DW_TAG_compile_unit)
DW_AT_comp_dir : /home/cmplr/usr2/mtokugaw
DW_AT_language : 8 (Fortran 90)
DW_AT_name : test.f
DW_AT_producer : EPC Fortran-95 Version F95 Intel:200200:131124
DW_AT_stmt_list : 0
<1><61>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_byte_size : 0
DW_AT_encoding : 5 (signed)
DW_AT_name : void
<1><69>: Abbrev Number: 3 (DW_TAG_subprogram)
DW_AT_decl_line : 1
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_sibling : <8e>
DW_AT_accessibility: 1 (public)
DW_AT_calling_convention: 2 (program)
DW_AT_name : main.program
DW_AT_type : <61>
DW_AT_prototyped : 0
DW_AT_high_pc : 0x8049206 134517254
DW_AT_low_pc : 0x8049198 134517144
DW_AT_external : 1
<1><8e>: Abbrev Number: 4 (DW_TAG_subprogram)
DW_AT_decl_line : 6
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_sibling : <125>
DW_AT_accessibility: 1 (public)
DW_AT_name : wkinit
DW_AT_type : <61>
DW_AT_prototyped : 0
DW_AT_high_pc : 0x8049456 134517846
DW_AT_low_pc : 0x8049206 134517254
DW_AT_external : 1
<2><ac>: Abbrev Number: 5 (DW_TAG_formal_parameter)
DW_AT_decl_line : 31
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_type : <125>
DW_AT_variable_parameter: 1
DW_AT_name : wksize
DW_AT_location : 6 byte block: 3 8 a0 7 8 6 (DW_OP_addr: 807a008; DW_OP_deref)
<2><c3>: Abbrev Number: 6 (DW_TAG_entry_point)
DW_AT_decl_line : 20
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_sibling : <f2>
DW_AT_name : wkprnt
DW_AT_type : <61>
DW_AT_low_pc : 0x80492ac 134517420
<3><da>: Abbrev Number: 5 (DW_TAG_formal_parameter)
DW_AT_decl_line : 31
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_type : <125>
DW_AT_variable_parameter: 1
DW_AT_name : jprint
DW_AT_location : 6 byte block: 3 14 a0 7 8 6 (DW_OP_addr: 807a014; DW_OP_deref)
<2><f2>: Abbrev Number: 7 (DW_TAG_variable)
DW_AT_decl_line : 31
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_accessibility: 1 (public)
DW_AT_name : jpr
DW_AT_type : <125>
DW_AT_location : 5 byte block: 3 c a0 7 8 (DW_OP_addr: 807a00c)
DW_AT_external : 0
DW_AT_start_scope : 0x8049454 134517844
<2><10a>: Abbrev Number: 7 (DW_TAG_variable)
DW_AT_decl_line : 31
DW_AT_decl_column : 0
DW_AT_decl_file : 1
DW_AT_accessibility: 1 (public)
DW_AT_name : nsize
DW_AT_type : <125>
DW_AT_location : 5 byte block: 3 10 a0 7 8 (DW_OP_addr: 807a010)
DW_AT_external : 0
DW_AT_start_scope : 0x8049454 134517844
<1><125>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_byte_size : 4
DW_AT_encoding : 5 (signed)
DW_AT_name : integer

Contents of the .debug_abbrev section:

Number TAG
1 DW_TAG_compile_unit [has children]
DW_AT_comp_dir DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_stmt_list DW_FORM_data4
2 DW_TAG_base_type [no children]
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT_name DW_FORM_string
3 DW_TAG_subprogram [no children]
DW_AT_decl_line DW_FORM_data1
DW_AT_decl_column DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_sibling DW_FORM_ref4
DW_AT_accessibility DW_FORM_data1
DW_AT_calling_convention DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_prototyped DW_FORM_flag
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_external DW_FORM_flag
4 DW_TAG_subprogram [has children]
DW_AT_decl_line DW_FORM_data1
DW_AT_decl_column DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_sibling DW_FORM_ref4
DW_AT_accessibility DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_prototyped DW_FORM_flag
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_external DW_FORM_flag
5 DW_TAG_formal_parameter [no children]
DW_AT_decl_line DW_FORM_data1
DW_AT_decl_column DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_type DW_FORM_ref4
DW_AT_variable_parameter DW_FORM_flag
DW_AT_name DW_FORM_string
DW_AT_location DW_FORM_block1
6 DW_TAG_entry_point [has children]
DW_AT_decl_line DW_FORM_data1
DW_AT_decl_column DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_sibling DW_FORM_ref4
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_low_pc DW_FORM_addr
7 DW_TAG_variable [no children]
DW_AT_decl_line DW_FORM_data1
DW_AT_decl_column DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_accessibility DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_location DW_FORM_block1
DW_AT_external DW_FORM_flag
DW_AT_start_scope DW_FORM_addr

Dump of debug contents of section .debug_line:

Length: 94
DWARF Version: 2
Prologue Length: 31
Minimum Instruction Length: 1
Initial value of 'is_stmt': 0
Line Base: -1
Line Range: 4
Opcode Base: 10

Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args

The Directory Table is empty.

The File Name Table:
Entry Dir Time Size Name
1 0 1059586658 583 test.f

Line Number Statements:
Extended opcode 2: set Address to 0x8049198
Copy
Special opcode 158: advance Address by 39 to 0x80491bf and Line by 1 to 2
Special opcode 82: advance Address by 20 to 0x80491d3 and Line by 1 to 3
Special opcode 82: advance Address by 20 to 0x80491e7 and Line by 1 to 4
Special opcode 127: advance Address by 31 to 0x8049206 and Line by 2 to 6
Advance PC by 11 to 8049211
Advance Line by 7 to 13
Copy
Special opcode 51: advance Address by 12 to 0x804921d and Line by 2 to 15
Advance PC by 126 to 804929b
Advance Line by 2 to 17
Copy
Advance PC by 17 to 80492ac
Advance Line by 3 to 20
Copy
Special opcode 46: advance Address by 11 to 0x80492b7 and Line by 1 to 21
Advance PC by 124 to 8049333
Advance Line by 1 to 22
Copy
Advance PC by 126 to 80493b1
Advance Line by 1 to 23
Copy
Special opcode 50: advance Address by 12 to 0x80493bd and Line by 1 to 24
Special opcode 63: advance Address by 15 to 0x80493cc and Line by 2 to 26
Special opcode 51: advance Address by 12 to 0x80493d8 and Line by 2 to 28
Advance PC by 124 to 8049454
Advance Line by 3 to 31
Copy
Extended opcode 2: set Address to 0x8049456
Extended opcode 1: End of Sequence