DW_TAG_variable {
DW_AT_name "comp"
DW_AT_type :$complete_label
- DW_AT_location [subst {DW_OP_addr [gdb_target_symbol "comp"]}] \
- SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "comp"]
+ } SPECIAL_expr
DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
DW_AT_name "cp"
DW_AT_type :$ptr_comp_label
- DW_AT_location [subst {DW_OP_addr [gdb_target_symbol "cp"]}] \
- SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "cp"]
+ } SPECIAL_expr
DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
DW_AT_name "inc"
DW_AT_type :$ptr_inc_label
- DW_AT_location [subst {DW_OP_addr [gdb_target_symbol "inc"]}] \
- SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "inc"]
+ } SPECIAL_expr
DW_AT_external 1 DW_FORM_flag
}
DW_TAG_variable {
DW_AT_name "ip"
DW_AT_type :$ptr_int_label
- DW_AT_location [subst {DW_OP_addr [gdb_target_symbol "ip"]}] \
- SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "ip"]
+ } SPECIAL_expr
DW_AT_external 1 DW_FORM_flag
}
tag_variable {
DW_AT_name my_data
DW_AT_type :$watch_struct_label
- DW_AT_location [subst {
- addr [gdb_target_symbol my_data]
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol my_data]
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name i64_var
DW_AT_type :$i64_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_constu $::c64
DW_OP_stack_value
DW_OP_GNU_uninit
DW_OP_piece 8
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name i32_var
DW_AT_type :$i32_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_constu $::c32
DW_OP_stack_value
DW_OP_GNU_uninit
DW_OP_piece 4
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name "value"
DW_AT_type :$struct
DW_AT_external 1 DW_FORM_flag
- DW_AT_location \
- [subst {DW_OP_addr [gdb_target_symbol "our_data"]}] \
- SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol "our_data"]
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name fd__global
DW_AT_type :$ref_type_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol fd__global]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name the_table
DW_AT_type :$array_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_array]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
DW_AT_name foo
DW_AT_type :$float_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_regx $::st0_dwarf_regnum
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
vla_length_label:
DW_TAG_variable {
DW_AT_location {
- lit6
- stack_value
+ DW_OP_lit6
+ DW_OP_stack_value
} SPECIAL_expr
DW_AT_name "__vla_array_length"
DW_AT_type :$long_unsigned_int_label
DW_AT_type :$b_l
DW_AT_external 1 flag
DW_AT_name global_var
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
} {
DW_TAG_subrange_type {
DW_AT_type :$integer_label
- DW_AT_lower_bound [subst {
+ DW_AT_lower_bound {
DW_OP_push_object_address
DW_OP_plus_uconst $voidp_size
DW_OP_deref
DW_OP_deref_size $int_size
- }] SPECIAL_expr
- DW_AT_upper_bound [subst {
+ } SPECIAL_expr
+ DW_AT_upper_bound {
DW_OP_push_object_address
DW_OP_plus_uconst $voidp_size
DW_OP_deref
DW_OP_plus_uconst $int_size
DW_OP_deref_size $int_size
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
array_ptr_label: DW_TAG_typedef {
DW_TAG_variable {
DW_AT_name foo__three
DW_AT_type :$array_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_1]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__three_tdef
DW_AT_type :$array_ptr_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_1]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__five
DW_AT_type :$array_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_2]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__five_tdef
DW_AT_type :$array_ptr_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_2]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
formal_parameter {
DW_AT_name I
DW_AT_type :$int_label
- DW_AT_location [subst {addr $global_I}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_I
+ } SPECIAL_expr
}
formal_parameter {
DW_AT_name J
DW_AT_type :$int_label
- DW_AT_location [subst {addr $global_J}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
entry_point {
DW_AT_name foo
formal_parameter {
DW_AT_name J
DW_AT_type :$int_label
- DW_AT_location [subst {addr $global_J}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
formal_parameter {
DW_AT_name K
DW_AT_type :$int_label
- DW_AT_location [subst {addr $global_K}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_K
+ } SPECIAL_expr
}
}
entry_point {
formal_parameter {
DW_AT_name J
DW_AT_type :$int_label
- DW_AT_location [subst {addr $global_J}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
}
}
formal_parameter {
DW_AT_name I
DW_AT_type :$int2_label
- DW_AT_location [subst {addr $global_I}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_I
+ } SPECIAL_expr
}
formal_parameter {
DW_AT_name J
DW_AT_type :$int2_label
- DW_AT_location [subst {addr $global_J}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
entry_point {
DW_AT_name fooso
formal_parameter {
DW_AT_name J
DW_AT_type :$int2_label
- DW_AT_location [subst {addr $global_J}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_J
+ } SPECIAL_expr
}
formal_parameter {
DW_AT_name K
DW_AT_type :$int2_label
- DW_AT_location [subst {addr $global_K}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_K
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name argc
DW_AT_type :$integer
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_entry_value {
DW_OP_regx $::dwarf_regnum
}
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
DW_TAG_variable {
DW_AT_name foo
DW_AT_type :$integer
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_entry_value {
DW_OP_bregx $::dwarf_regnum 0
DW_OP_deref_size 4
}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name pck__fp1_var
DW_AT_type :$fp1_base_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol pck__fp1_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name pck__fp1_var2
DW_AT_type :$fp1_base_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol pck__fp1_var2]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name pck__fp2_var
DW_AT_type :$fp2_base_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol pck__fp2_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name pck__fp3_var
DW_AT_type :$fp3_base_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol pck__fp3_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name pck__fp1_range_var
DW_AT_type :$fp1_range_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol pck__fp1_range_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_AT_name param
DW_AT_variable_parameter 1 flag
DW_AT_type :$int_label
- DW_AT_location [subst {
- addr [gdb_target_symbol ptr]
- deref
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr [gdb_target_symbol ptr]
+ DW_OP_deref
+ } SPECIAL_expr
}
}
}
} {
DW_TAG_variable {
DW_AT_abstract_origin %$num_label
- DW_AT_location [subst {addr $global_num_addr}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_num_addr
+ } SPECIAL_expr
}
lexical_block {
DW_AT_low_pc scope_label1 addr
} {
DW_TAG_variable {
DW_AT_abstract_origin %$value_label
- DW_AT_location [subst {addr $global_value_addr}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $global_value_addr
+ } SPECIAL_expr
}
}
}
DW_AT_name testvar
DW_AT_type :$integer_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name v
DW_AT_linkage_name _ZN12_GLOBAL__N_11vE
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol _ZN12_GLOBAL__N_11vE]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_type :$myint
}
}
DW_TAG_variable {
DW_AT_name file_locaddr_resolvable
DW_AT_type :$integer_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name file_locaddr_unresolvable
DW_AT_type :$integer_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name file_extern_locaddr_resolvable
DW_AT_type :$integer_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_extern_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name file_extern_locaddr_unresolvable
DW_AT_type :$integer_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol file_extern_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_TAG_variable {
DW_AT_name main_local_locaddr_resolvable
DW_AT_type :$integer_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_local_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name main_local_locaddr_unresolvable
DW_AT_type :$integer_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_local_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name main_extern_locaddr_resolvable
DW_AT_type :$integer_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_extern_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name main_extern_locaddr_unresolvable
DW_AT_type :$integer_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol main_extern_locaddr_resolvable]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name e
DW_AT_external 1 flag
DW_AT_type :$volatile_label
- DW_AT_location [subst {addr $e_var}] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $e_var
+ } SPECIAL_expr
}
subprogram {
DW_AT_external 1 flag
DW_TAG_variable {
DW_AT_name obj
DW_AT_type :$stype
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol obj]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name ptr
DW_AT_type :$ptype
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol ptr]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
DW_AT_name global_var DW_FORM_strp
DW_AT_type :$struct_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol global_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol dyn_object]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_name "dyn_object"
DW_AT_type :$array_type_label
}
DW_AT_name "value"
DW_AT_type :$struct
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "our_data"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
} {
DW_TAG_subrange_type {
DW_AT_type :$integer_label
- DW_AT_lower_bound [subst {
+ DW_AT_lower_bound {
DW_OP_push_object_address
DW_OP_const1u [expr {2 * $int_size}]
DW_OP_minus
DW_OP_deref_size $int_size
- }] SPECIAL_expr
- DW_AT_upper_bound [subst {
+ } SPECIAL_expr
+ DW_AT_upper_bound {
DW_OP_push_object_address
DW_OP_const1u $int_size
DW_OP_minus
DW_OP_deref_size $int_size
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
array_ptr_label: DW_TAG_pointer_type {
DW_TAG_variable {
DW_AT_name foo__three_ptr
DW_AT_type :$array_ptr_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_1_ptr]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__three_ptr_tdef
DW_AT_type :$array_typedef_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_1_ptr]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__five_ptr
DW_AT_type :$array_ptr_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_2_ptr]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_variable {
DW_AT_name foo__five_ptr_tdef
DW_AT_type :$array_typedef_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol table_2_ptr]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
DW_AT_name global_var
DW_AT_type :$struct_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_TAG_formal_parameter {
DW_AT_name arg
DW_AT_type :$int4_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_param]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name global_var
DW_AT_type :$struct_type
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_addr_index [gdb_target_symbol global_var]
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
DW_AT_external 1 flag
} {
DW_TAG_variable {
- DW_AT_name p
- DW_AT_location [subst {
- GNU_implicit_pointer $variable_label 0
- }] SPECIAL_expr
- DW_AT_type :$pointer_label "DW_FORM_ref$ref_addr_size"
+ DW_AT_name p
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type :$pointer_label "DW_FORM_ref$ref_addr_size"
}
}
}
DW_AT_external 1 flag
} {
DW_TAG_variable {
- DW_AT_name p
- DW_AT_location [subst {
- GNU_implicit_pointer $variable_label 0
- }] SPECIAL_expr
- DW_AT_type %$pointer_label
+ DW_AT_name p
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
+ DW_AT_type %$pointer_label
}
}
}
DW_TAG_variable {
DW_AT_name p
- DW_AT_location [subst {
- GNU_implicit_pointer $variable_label 0
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
DW_AT_type :$pointer_label
}
}
DW_TAG_variable {
DW_AT_name c
DW_AT_type :$ptr_label
- DW_AT_location [subst {
- GNU_implicit_pointer $var_label 0
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 0
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name d
DW_AT_type :$ptr_label
- DW_AT_location [subst {
- GNU_implicit_pointer $var_label 2
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 2
+ } SPECIAL_expr
}
}
}
DW_AT_name s
DW_AT_type :$struct_label
DW_AT_location {
- const2u 0x5678
- stack_value
- piece 2
- const1u 2
- stack_value
- piece 1
- const1u 3
- stack_value
- piece 1
+ DW_OP_const2u 0x5678
+ DW_OP_stack_value
+ DW_OP_piece 2
+ DW_OP_const1u 2
+ DW_OP_stack_value
+ DW_OP_piece 1
+ DW_OP_const1u 3
+ DW_OP_stack_value
+ DW_OP_piece 1
} SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name p
DW_AT_type :$ptr_label
- DW_AT_location [subst {
- GNU_implicit_pointer $var_label 2
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $var_label 2
+ } SPECIAL_expr
}
}
}
DW_AT_name "array"
DW_AT_type :${array_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "array"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_subprogram {
DW_TAG_variable {
DW_AT_name "ref"
DW_AT_type :${ref_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_implicit_pointer ${variable_label} 0
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name "ref"
DW_AT_type :${const_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_implicit_pointer ${variable_label} 0
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name "global_var"
DW_AT_type :${int_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "global_var"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_subprogram {
DW_TAG_variable {
DW_AT_name "ref"
DW_AT_type :${ref_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_implicit_pointer ${variable_label} 0
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name "s1"
DW_AT_type :${struct_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "s1"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "s2"
DW_AT_type :${struct_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "s2"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_subprogram {
DW_TAG_variable {
DW_AT_name "ref"
DW_AT_type :${ref_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_implicit_pointer ${variable_label} 0
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name "v_i16_m1"
DW_AT_type :${i7_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "i16_m1"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u1_type: DW_TAG_base_type {
DW_AT_name "v_u16_1"
DW_AT_type :${u1_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u16_1"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u17_type: DW_TAG_base_type {
DW_AT_name "v_u32_m2"
DW_AT_type :${u17_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u32_m2"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u31_type: DW_TAG_base_type {
DW_AT_name "v_u32_1"
DW_AT_type :${u31_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u32_1"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u31_1_type: DW_TAG_base_type {
DW_AT_name "v_u32_1_off"
DW_AT_type :${u31_1_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u32_1_off"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
be30_1_type: DW_TAG_base_type {
DW_AT_name "v_be30_1_off"
DW_AT_type :${be30_1_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "be30_1_off"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u32_0_type: DW_TAG_base_type {
DW_AT_name "v_u32_0"
DW_AT_type :${u32_0_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u32_0"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
u0_0_type: DW_TAG_base_type {
DW_AT_name "v_u0_0"
DW_AT_type :${u0_0_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "u32_0"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
just_bit_type: DW_TAG_base_type {
DW_AT_name "v_just_bit"
DW_AT_type :${just_bit_type}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "just_bit_0"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
# chosen.
DW_TAG_inheritance {
DW_AT_type :$class_A_label
- DW_AT_data_member_location [subst {
+ DW_AT_data_member_location {
DW_OP_constu ${::B_a}
DW_OP_plus
DW_OP_pick 0
- DW_OP_drop}] SPECIAL_expr
+ DW_OP_drop
+ } SPECIAL_expr
DW_AT_accessibility 1 DW_FORM_data1
}
DW_TAG_member {
DW_AT_name "g_A"
DW_AT_type :$class_A_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "g_A"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "g_B"
DW_AT_type :$class_B_label
DW_AT_external 1 flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "g_B"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
# We can't use MACRO_AT for the definitions of foo and bar
DW_AT_name "var_a"
DW_AT_type :$main_type
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_a"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "var_ptr"
DW_AT_type :$ptr_type
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_ptr"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name "s"
DW_AT_type :$struct_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "s"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name def_s
DW_AT_type :$struct_s_label
DW_AT_location {
- const1u 0
- stack_value
- bit_piece 8 0
- const1s -1
- stack_value
- bit_piece 24 0
+ DW_OP_const1u 0
+ DW_OP_stack_value
+ DW_OP_bit_piece 8 0
+ DW_OP_const1s -1
+ DW_OP_stack_value
+ DW_OP_bit_piece 24 0
} SPECIAL_expr
}
# Composite location: non-byte-aligned pieces.
DW_AT_name def_t
DW_AT_type :$struct_t_label
DW_AT_location {
- const2s -184
- stack_value
- bit_piece 9 0
- const4u 1752286
- stack_value
- bit_piece 23 0
+ DW_OP_const2s -184
+ DW_OP_stack_value
+ DW_OP_bit_piece 9 0
+ DW_OP_const4u 1752286
+ DW_OP_stack_value
+ DW_OP_bit_piece 23 0
} SPECIAL_expr
}
# Composite location with some empty pieces.
DW_AT_name part_def_a
DW_AT_type :$array_a9_label
DW_AT_location {
- piece 3
- const4u 0xf1927314
- stack_value
- piece 4
- piece 2
+ DW_OP_piece 3
+ DW_OP_const4u 0xf1927314
+ DW_OP_stack_value
+ DW_OP_piece 4
+ DW_OP_piece 2
} SPECIAL_expr
}
# Implicit location: immediate value.
DW_AT_name def_implicit_s
DW_AT_type :$struct_s_label
DW_AT_location {
- implicit_value 0x12 0x34 0x56 0x78
+ DW_OP_implicit_value 0x12 0x34 0x56 0x78
} SPECIAL_expr
}
# Implicit location: immediate value for whole array, with
DW_AT_name def_implicit_a
DW_AT_type :$array_a9_label
DW_AT_location {
- implicit_value 0x1 0x12 0x23 0x34 0x45 \
+ DW_OP_implicit_value 0x1 0x12 0x23 0x34 0x45 \
0x56 0x67 0x78 0x89 0x9a 0xab
} SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name implicit_a_ptr
DW_AT_type :$char_ptr_label
- DW_AT_location [subst {
- implicit_pointer $implicit_a_label 5
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_implicit_pointer $implicit_a_label 5
+ } SPECIAL_expr
}
# Stack-value location.
stack_b_label: DW_TAG_variable {
DW_AT_name def_stack_b
DW_AT_type :$struct_t_label
DW_AT_location {
- const4u 0x1a2b3c4d
- stack_value
+ DW_OP_const4u 0x1a2b3c4d
+ DW_OP_stack_value
} SPECIAL_expr
}
# Implicit pointer into stack value.
DW_TAG_variable {
DW_AT_name implicit_b_ptr
DW_AT_type :$char_ptr_label
- DW_AT_location [subst {
- implicit_pointer $stack_b_label 1
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_implicit_pointer $stack_b_label 1
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name i64_noptr
DW_AT_type :$i64_array
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_constu $::c64
DW_OP_stack_value
DW_OP_piece 8
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name i32_noptr
DW_AT_type :$i32_array
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_constu $::c32
DW_OP_stack_value
DW_OP_piece 4
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name ~S
DW_AT_external 1 flag
DW_AT_virtuality @DW_VIRTUALITY_virtual
- DW_AT_vtable_elem_location {const1u 1} SPECIAL_expr
+ DW_AT_vtable_elem_location {
+ DW_OP_const1u 1
+ } SPECIAL_expr
}
}
}
DW_TAG_variable {
DW_AT_name a
DW_AT_type :$int_type_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr $exec_mask_var
DW_OP_deref_size $int_size
DW_OP_skip 3
DW_OP_bregx $dwarf_regnum 0
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
DW_AT_name exec_mask
DW_AT_type :$int_type_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr $exec_mask_var
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
# add info for subprogram main
DW_TAG_subprogram {
MACRO_AT_func { main }
- DW_AT_frame_base [subst {
+ DW_AT_frame_base {
DW_OP_regx $dwarf_regnum
- }] SPECIAL_expr
+ } SPECIAL_expr
} {
# define artificial variable a
DW_TAG_variable {
DW_AT_name a
DW_AT_type :$int_type_label
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_lit1
DW_OP_addr $exec_mask_var
DW_OP_deref_size $int_size
# conditional jump to DW_OP_drop
DW_OP_bra -9
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
DW_AT_external 1 flag
}
}
DW_TAG_variable {
DW_AT_name "a"
DW_AT_type :$array_a8_label
- DW_AT_location [subst {
- addr $buf_var
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $buf_var
+ } SPECIAL_expr
}
# Memory pieces: two bytes from &buf[2], and two bytes
# from &buf[0].
DW_TAG_variable {
DW_AT_name "s1"
DW_AT_type :$struct_s_label
- DW_AT_location [subst {
- addr $buf_var
- plus_uconst 2
- piece 2
- addr $buf_var
- piece 2
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_addr $buf_var
+ DW_OP_plus_uconst 2
+ DW_OP_piece 2
+ DW_OP_addr $buf_var
+ DW_OP_piece 2
+ } SPECIAL_expr
}
# Register- and memory pieces: one byte each from r0,
# &buf[4], r1, and &buf[5].
DW_TAG_variable {
DW_AT_name "s2"
DW_AT_type :$struct_s_label
- DW_AT_location [subst {
- regx [lindex $dwarf_regnum 0]
- piece 1
- addr "$buf_var + 4"
- piece 1
- regx [lindex $dwarf_regnum 1]
- piece 1
- addr "$buf_var + 5"
- piece 1
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_piece 1
+ DW_OP_addr "$buf_var + 4"
+ DW_OP_piece 1
+ DW_OP_regx [lindex $dwarf_regnum 1]
+ DW_OP_piece 1
+ DW_OP_addr "$buf_var + 5"
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# Memory pieces for bitfield access: 8 bytes optimized
# out, 3 bytes from &buf[3], and 1 byte from &buf[1].
DW_TAG_variable {
DW_AT_name "st1"
DW_AT_type :$struct_st_label
- DW_AT_location [subst {
- piece 8
- addr "$buf_var + 3"
- piece 3
- addr "$buf_var + 1"
- piece 1
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_piece 8
+ DW_OP_addr "$buf_var + 3"
+ DW_OP_piece 3
+ DW_OP_addr "$buf_var + 1"
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# Register pieces for bitfield access: 4 bytes optimized
# out, 3 bytes from r0, and 1 byte from r1.
DW_TAG_variable {
DW_AT_name "t2"
DW_AT_type :$struct_t_label
- DW_AT_location [subst {
- piece 4
- regx [lindex $dwarf_regnum 0]
- piece 3
- regx [lindex $dwarf_regnum 1]
- piece 1
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_piece 4
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_piece 3
+ DW_OP_regx [lindex $dwarf_regnum 1]
+ DW_OP_piece 1
+ } SPECIAL_expr
}
# One piece per bitfield, using piece offsets: 32 bits of
# an implicit value, 9 bits of a stack value, 13 bits of
DW_TAG_variable {
DW_AT_name "t3"
DW_AT_type :$struct_t_label
- DW_AT_location [subst {
- implicit_value 0x12 0x34 0x56 0x78 0x9a
- bit_piece 32 4
- const2s -280
- stack_value
- bit_piece 9 2
- regx [lindex $dwarf_regnum 0]
- bit_piece 13 14
- addr $buf_var
- bit_piece 10 42
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_implicit_value 0x12 0x34 0x56 0x78 0x9a
+ DW_OP_bit_piece 32 4
+ DW_OP_const2s -280
+ DW_OP_stack_value
+ DW_OP_bit_piece 9 2
+ DW_OP_regx [lindex $dwarf_regnum 0]
+ DW_OP_bit_piece 13 14
+ DW_OP_addr $buf_var
+ DW_OP_bit_piece 10 42
+ } SPECIAL_expr
}
}
}
DW_AT_name "var_a"
DW_AT_type :${int_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_a"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
var_a_abstract_label: DW_TAG_variable {
DW_AT_name "var_b"
DW_AT_type :${int_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_b"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
var_c_label: DW_TAG_variable {
DW_AT_name "var_p"
DW_AT_type :${ptr_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_p"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
if { $bad } {
DW_AT_name "var_s"
DW_AT_type :${struct_label}
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_s"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
var_untyped_label: DW_TAG_variable {
DW_AT_name "var_untyped"
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_b"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
int_array_label: DW_TAG_array_type {
DW_AT_name "varval3"
DW_AT_external 1 DW_FORM_flag
DW_AT_type :${int_array_of_1_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_a"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_subprogram {
varval_label: DW_TAG_variable {
DW_AT_name "varval"
DW_AT_type :${int_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_a_label}
DW_OP_const1s 0
DW_OP_or
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
varval2_label: DW_TAG_variable {
DW_AT_name "varval2"
DW_AT_type :${int_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_a_abstract_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
var_a_concrete_label: DW_TAG_variable {
DW_AT_abstract_origin :${var_a_abstract_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_a"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "constval"
DW_AT_type :${int_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_c_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "mixedval"
DW_AT_type :${int_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_c_label}
DW_OP_GNU_variable_value ${var_b_label}
DW_OP_div
DW_OP_GNU_variable_value ${varval_label}
DW_OP_minus
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "pointerval"
DW_AT_type :${ptr_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_p_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
if { $bad } {
DW_TAG_variable {
DW_AT_name "badval"
DW_AT_type :${int_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_bad_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
DW_TAG_variable {
DW_AT_name "structval"
DW_AT_type :${struct_label}
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_s_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "untypedval"
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${var_untyped_label}
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
if { $bad } {
DW_TAG_variable {
}
DW_TAG_variable {
DW_AT_name "bad_die_val2"
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_GNU_variable_value ${ptr_label}+1
DW_OP_stack_value
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
DW_AT_name "var_a"
DW_AT_type :$int_type
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_a"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
DW_TAG_variable {
DW_AT_name "var_ptr"
DW_AT_type :$ptr_type
DW_AT_external 1 DW_FORM_flag
- DW_AT_location [subst {
+ DW_AT_location {
DW_OP_addr [gdb_target_symbol "var_ptr"]
- }] SPECIAL_expr
+ } SPECIAL_expr
}
}
}
# Used for testing synthetic pointers.
DW_TAG_variable {
DW_AT_name synthptr
- DW_AT_location [subst {
- GNU_implicit_pointer $variable_label 0
- }] SPECIAL_expr
+ DW_AT_location {
+ DW_OP_GNU_implicit_pointer $variable_label 0
+ } SPECIAL_expr
DW_AT_type :$pointer_label
}
GNU_call_site_parameter {
DW_AT_location {DW_OP_reg0} SPECIAL_expr
DW_AT_GNU_call_site_value {
- addr global1
- deref_size 4
+ DW_OP_addr global1
+ DW_OP_deref_size 4
} SPECIAL_expr
}
GNU_call_site_parameter {
DW_AT_location {DW_OP_reg1} SPECIAL_expr
DW_AT_GNU_call_site_value {
- addr global2
- deref_size 4
+ DW_OP_addr global2
+ DW_OP_deref_size 4
} SPECIAL_expr
}
}
# section automatically.
#
# If FORM is 'SPECIAL_expr', then VALUE is treated as a location
-# expression. The effective form is then DW_FORM_block or DW_FORM_exprloc
-# for DWARF version >= 4, and VALUE is passed to the (internal)
-# '_location' proc to be translated.
-# This proc implements a miniature DW_OP_ assembler.
+# expression. The effective form is then DW_FORM_block or
+# DW_FORM_exprloc for DWARF version >= 4, and VALUE is treated as
+# code, using DW_OP_* procs and evaluated in the appropriate scope.
#
# If FORM is not given, it is guessed:
# * If VALUE starts with the "@" character, the rest of VALUE is
variable _constants
# DW_FORM short names.
variable _FORM
- # DW_OP short names.
- variable _OP
# The current output file.
variable _output_file
# code should be evaluated.
variable _level
+ # Variables used when processing a location expression. These are
+ # set by _location and may be used by the various DW_OP-handlers.
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
+
proc _process_one_constant {name value} {
variable _constants
variable _FORM
- variable _OP
set _constants($name) $value
}
OP {
- set _OP($name2) $name
+ set handler _handle_default_OP
+ if {[llength [info procs _handle_DW_OP_$name2]] > 0} {
+ set handler _handle_DW_OP_$name2
+ }
+ # Each DW_OP_* proc emits the opcode and then
+ # delegates to the argument handler.
+ # tclint-disable-next-line command-args
+ proc $name {args} [format {
+ variable _constants
+ _op .byte $_constants(%s) %s
+ %s {*}$args
+ } $name $name $handler]
}
default {
}
}
- # This is a miniature assembler for location expressions. It is
- # suitable for use in the attributes to a DIE. Its output is
- # prefixed with "=" to make it automatically use DW_FORM_block.
#
- # BODY is split by lines, and each line is taken to be a list.
- #
- # DWARF_VERSION is the DWARF version for the section where the location
- # description is found.
+ # Handlers for DW_OP_* opcodes.
#
- # ADDR_SIZE is the length in bytes (4 or 8) of an address on the target
- # machine (typically found in the header of the section where the location
- # description is found).
+ # A handler is only needed if the opcode requires a parameter, or
+ # some sort of special handling. Generic code handles emitting
+ # the actual opcode itself, so a handler should not do this.
#
- # OFFSET_SIZE is the length in bytes (4 or 8) of an offset into a DWARF
- # section. This typically depends on whether 32-bit or 64-bit DWARF is
- # used, as indicated in the header of the section where the location
- # description is found.
+ # Handlers are found by name when parsing the .def file. If a
+ # handler isn't found, the default (_handle_default_OP) is used.
#
- # Each list's first element is the opcode, either short or long
- # forms are accepted.
- # FIXME argument handling
- # FIXME move docs
- proc _location { body dwarf_version addr_size offset_size } {
- variable _constants
- set collected_lines ""
- foreach line [split $body \n] {
- # Ignore blank lines, and allow embedded comments.
- if { [regexp -- {^[ \t]*$} $line] || [regexp -- {^[ \t]*#} $line] } {
- continue
- }
- if { $collected_lines != "" } {
- set line "$collected_lines\n$line"
- set collected_lines ""
- }
- if { ! [info complete $line] } {
- set collected_lines $line
- continue
- }
- set opcode [_map_name [lindex $line 0] _OP]
- _op .byte $_constants($opcode) $opcode
+ proc _handle_DW_OP_addr {size} {
+ variable _loc_addr_size
+ _op .${_loc_addr_size}byte $size
+ }
- array unset argvec *
- switch -exact -- $opcode {
- DW_OP_addr {
- _get_args $line $opcode size
- _op .${addr_size}byte $argvec(size)
- }
+ proc _handle_DW_OP_GNU_addr_index {symbol} {
+ variable _debug_addr_index
+ variable _cu_addr_size
- DW_OP_GNU_addr_index {
- variable _debug_addr_index
- variable _cu_addr_size
+ _op .uleb128 ${_debug_addr_index}
+ incr _debug_addr_index
- _op .uleb128 ${_debug_addr_index}
- incr _debug_addr_index
+ _defer_output .debug_addr {
+ _op .${_cu_addr_size}byte $symbol
+ }
+ }
- _defer_output .debug_addr {
- _op .${_cu_addr_size}byte [lindex $line 1]
- }
- }
+ proc _handle_DW_OP_regx {register} {
+ _op .uleb128 $register
+ }
- DW_OP_regx {
- _get_args $line $opcode register
- _op .uleb128 $argvec(register)
- }
+ proc _handle_DW_OP_pick {const} {
+ _op .byte $const
+ }
+ proc _handle_DW_OP_const1u {const} {
+ _op .byte $const
+ }
+ proc _handle_DW_OP_const1s {const} {
+ _op .byte $const
+ }
- DW_OP_pick -
- DW_OP_const1u -
- DW_OP_const1s {
- _get_args $line $opcode const
- _op .byte $argvec(const)
- }
+ proc _handle_DW_OP_const2u {const} {
+ _op .2byte $const
+ }
+ proc _handle_DW_OP_const2s {const} {
+ _op .2byte $const
+ }
- DW_OP_const2u -
- DW_OP_const2s {
- _get_args $line $opcode const
- _op .2byte $argvec(const)
- }
+ proc _handle_DW_OP_const4u {const} {
+ _op .4byte $const
+ }
+ proc _handle_DW_OP_const4s {const} {
+ _op .4byte $const
+ }
- DW_OP_const4u -
- DW_OP_const4s {
- _get_args $line $opcode const
- _op .4byte $argvec(const)
- }
+ proc _handle_DW_OP_const8u {const} {
+ _op .8byte $const
+ }
+ proc _handle_DW_OP_const8s {const} {
+ _op .8byte $const
+ }
- DW_OP_const8u -
- DW_OP_const8s {
- _get_args $line $opcode const
- _op .8byte $argvec(const)
- }
+ proc _handle_DW_OP_constu {const} {
+ _op .uleb128 $const
+ }
+ proc _handle_DW_OP_consts {const} {
+ _op .sleb128 $const
+ }
- DW_OP_constu {
- _get_args $line $opcode const
- _op .uleb128 $argvec(const)
- }
- DW_OP_consts {
- _get_args $line $opcode const
- _op .sleb128 $argvec(const)
- }
+ proc _handle_DW_OP_plus_uconst {const} {
+ _op .uleb128 $const
+ }
- DW_OP_plus_uconst {
- _get_args $line $opcode const
- _op .uleb128 $argvec(const)
- }
+ proc _handle_DW_OP_piece {size} {
+ _op .uleb128 $size
+ }
- DW_OP_piece {
- _get_args $line $opcode size
- _op .uleb128 $argvec(size)
- }
+ proc _handle_DW_OP_bit_piece {size offset} {
+ _op .uleb128 $size
+ _op .uleb128 $offset
+ }
- DW_OP_bit_piece {
- _get_args $line $opcode size offset
- _op .uleb128 $argvec(size)
- _op .uleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_skip {label} {
+ _op .2byte $label
+ }
+ proc _handle_DW_OP_bra {label} {
+ _op .2byte $label
+ }
- DW_OP_skip -
- DW_OP_bra {
- _get_args $line $opcode label
- _op .2byte $argvec(label)
- }
+ proc _handle_DW_OP_entry_value {body} {
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
- DW_OP_entry_value {
- _get_args $line $opcode body
- set l1 [new_label "expr_start"]
- set l2 [new_label "expr_end"]
- _op .uleb128 "$l2 - $l1" "expression"
- define_label $l1
- _location $argvec(body) $dwarf_version $addr_size \
- $offset_size
- define_label $l2
+ set l1 [new_label "expr_start"]
+ set l2 [new_label "expr_end"]
+ _op .uleb128 "$l2 - $l1" "expression"
+ define_label $l1
+ variable _level
+ uplevel $_level [list _location $body $_loc_dwarf_version \
+ $_loc_addr_size $_loc_offset_size]
+ define_label $l2
+ }
+
+ proc _handle_DW_OP_implicit_value {args} {
+ set l1 [new_label "value_start"]
+ set l2 [new_label "value_end"]
+ _op .uleb128 "$l2 - $l1"
+ define_label $l1
+ foreach value $args {
+ switch -regexp -- $value {
+ {^0x[[:xdigit:]]{1,2}$} {_op .byte $value}
+ {^0x[[:xdigit:]]{4}$} {_op .2byte $value}
+ {^0x[[:xdigit:]]{8}$} {_op .4byte $value}
+ {^0x[[:xdigit:]]{16}$} {_op .8byte $value}
+ default {
+ error "bad value '$value' in DW_OP_implicit_value"
}
+ }
+ }
+ define_label $l2
+ }
- DW_OP_implicit_value {
- set l1 [new_label "value_start"]
- set l2 [new_label "value_end"]
- _op .uleb128 "$l2 - $l1"
- define_label $l1
- foreach value [lrange $line 1 end] {
- switch -regexp -- $value {
- {^0x[[:xdigit:]]{1,2}$} {_op .byte $value}
- {^0x[[:xdigit:]]{4}$} {_op .2byte $value}
- {^0x[[:xdigit:]]{8}$} {_op .4byte $value}
- {^0x[[:xdigit:]]{16}$} {_op .8byte $value}
- default {
- error "bad value '$value' in DW_OP_implicit_value"
- }
- }
- }
- define_label $l2
- }
+ proc _handle_DW_OP_implicit_pointer {label offset} {
+ variable _loc_dwarf_version
+ variable _loc_addr_size
+ variable _loc_offset_size
+ # Here label is a section offset.
+ if { $_loc_dwarf_version == 2 } {
+ _op .${_loc_addr_size}byte $label
+ } else {
+ _op_offset $_loc_offset_size $label
+ }
+ _op .sleb128 $offset
+ }
- DW_OP_implicit_pointer -
- DW_OP_GNU_implicit_pointer {
- _get_args $line $opcode label offset
+ proc _handle_DW_OP_GNU_implicit_pointer {label offset} {
+ _handle_DW_OP_implicit_pointer $label $offset
+ }
- # Here label is a section offset.
- if { $dwarf_version == 2 } {
- _op .${addr_size}byte $argvec(label)
- } else {
- _op_offset $offset_size $argvec(label)
- }
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_GNU_variable_value {label} {
+ variable _loc_addr_size
+ variable _loc_offset_size
+ variable _loc_dwarf_version
+ # Here label is a section offset.
+ if { $_loc_dwarf_version == 2 } {
+ _op .${_loc_addr_size}byte $label
+ } else {
+ _op_offset $_loc_offset_size $label
+ }
+ }
- DW_OP_GNU_variable_value {
- _get_args $line $opcode label
+ proc _handle_DW_OP_deref_size {size} {
+ _op .byte $size
+ }
- # Here label is a section offset.
- if { $dwarf_version == 2 } {
- _op .${addr_size}byte $argvec(label)
- } else {
- _op_offset $offset_size $argvec(label)
- }
- }
+ proc _handle_DW_OP_bregx {register offset} {
+ _op .uleb128 $register
+ _op .sleb128 $offset
+ }
- DW_OP_deref_size {
- _get_args $line $opcode size
- _op .byte $argvec(size)
- }
+ proc _handle_DW_OP_fbreg {offset} {
+ _op .sleb128 $offset
+ }
- DW_OP_bregx {
- _get_args $line $opcode register offset
- _op .uleb128 $argvec(register)
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_DW_OP_fbreg {reg} {
+ _op .sleb128 $reg
+ }
- DW_OP_fbreg {
- _get_args $line $opcode offset
- _op .sleb128 $argvec(offset)
- }
+ proc _handle_default_OP {} {
+ # Do nothing; if arguments are passed, Tcl will cause an
+ # error.
+ }
- DW_OP_fbreg {
- _op .sleb128 [lindex $line 1]
- }
+ # This is a miniature assembler for location expressions. It is
+ # suitable for use in the attributes to a DIE.
+ #
+ # BODY is evaluated as code in the appropriate scope.
+ #
+ # DWARF_VERSION is the DWARF version for the section where the location
+ # description is found.
+ #
+ # ADDR_SIZE is the length in bytes (4 or 8) of an address on the target
+ # machine (typically found in the header of the section where the location
+ # description is found).
+ #
+ # OFFSET_SIZE is the length in bytes (4 or 8) of an offset into a DWARF
+ # section. This typically depends on whether 32-bit or 64-bit DWARF is
+ # used, as indicated in the header of the section where the location
+ # description is found.
+ #
+ # FIXME move docs
+ proc _location { body dwarf_version addr_size offset_size } {
+ variable _loc_dwarf_version
+ set _loc_dwarf_version $dwarf_version
- default {
- if {[llength $line] > 1} {
- error "Unimplemented: operands in location for $opcode"
- }
- }
- }
- }
+ variable _loc_addr_size
+ set _loc_addr_size $addr_size
+
+ variable _loc_offset_size
+ set _loc_offset_size $offset_size
+
+ variable _level
+ uplevel $_level $body
}
# Return a label that references the current position in the