@@ -993,209 +993,6 @@ DWARFDebugInfoEntry::GetQualifiedName(DWARFUnit *cu,
993
993
return storage.c_str ();
994
994
}
995
995
996
- bool DWARFDebugInfoEntry::LookupAddress (const dw_addr_t address, DWARFUnit *cu,
997
- DWARFDebugInfoEntry **function_die,
998
- DWARFDebugInfoEntry **block_die) {
999
- bool found_address = false ;
1000
- if (m_tag) {
1001
- bool check_children = false ;
1002
- bool match_addr_range = false ;
1003
- // printf("0x%8.8x: %30s: address = 0x%8.8x - ", m_offset,
1004
- // DW_TAG_value_to_name(tag), address);
1005
- switch (m_tag) {
1006
- case DW_TAG_array_type:
1007
- break ;
1008
- case DW_TAG_class_type:
1009
- check_children = true ;
1010
- break ;
1011
- case DW_TAG_entry_point:
1012
- case DW_TAG_enumeration_type:
1013
- case DW_TAG_formal_parameter:
1014
- case DW_TAG_imported_declaration:
1015
- case DW_TAG_label:
1016
- break ;
1017
- case DW_TAG_lexical_block:
1018
- check_children = true ;
1019
- match_addr_range = true ;
1020
- break ;
1021
- case DW_TAG_member:
1022
- case DW_TAG_pointer_type:
1023
- case DW_TAG_reference_type:
1024
- break ;
1025
- case DW_TAG_compile_unit:
1026
- match_addr_range = true ;
1027
- break ;
1028
- case DW_TAG_string_type:
1029
- break ;
1030
- case DW_TAG_structure_type:
1031
- check_children = true ;
1032
- break ;
1033
- case DW_TAG_subroutine_type:
1034
- case DW_TAG_typedef:
1035
- case DW_TAG_union_type:
1036
- case DW_TAG_unspecified_parameters:
1037
- case DW_TAG_variant:
1038
- break ;
1039
- case DW_TAG_common_block:
1040
- check_children = true ;
1041
- break ;
1042
- case DW_TAG_common_inclusion:
1043
- case DW_TAG_inheritance:
1044
- break ;
1045
- case DW_TAG_inlined_subroutine:
1046
- check_children = true ;
1047
- match_addr_range = true ;
1048
- break ;
1049
- case DW_TAG_module:
1050
- match_addr_range = true ;
1051
- break ;
1052
- case DW_TAG_ptr_to_member_type:
1053
- case DW_TAG_set_type:
1054
- case DW_TAG_subrange_type:
1055
- case DW_TAG_with_stmt:
1056
- case DW_TAG_access_declaration:
1057
- case DW_TAG_base_type:
1058
- break ;
1059
- case DW_TAG_catch_block:
1060
- match_addr_range = true ;
1061
- break ;
1062
- case DW_TAG_const_type:
1063
- case DW_TAG_constant:
1064
- case DW_TAG_enumerator:
1065
- case DW_TAG_file_type:
1066
- case DW_TAG_friend:
1067
- case DW_TAG_namelist:
1068
- case DW_TAG_namelist_item:
1069
- case DW_TAG_packed_type:
1070
- break ;
1071
- case DW_TAG_subprogram:
1072
- match_addr_range = true ;
1073
- break ;
1074
- case DW_TAG_template_type_parameter:
1075
- case DW_TAG_template_value_parameter:
1076
- case DW_TAG_GNU_template_parameter_pack:
1077
- case DW_TAG_thrown_type:
1078
- break ;
1079
- case DW_TAG_try_block:
1080
- match_addr_range = true ;
1081
- break ;
1082
- case DW_TAG_variant_part:
1083
- case DW_TAG_variable:
1084
- case DW_TAG_volatile_type:
1085
- case DW_TAG_dwarf_procedure:
1086
- case DW_TAG_restrict_type:
1087
- case DW_TAG_interface_type:
1088
- break ;
1089
- case DW_TAG_namespace:
1090
- check_children = true ;
1091
- break ;
1092
- case DW_TAG_imported_module:
1093
- case DW_TAG_unspecified_type:
1094
- break ;
1095
- case DW_TAG_partial_unit:
1096
- match_addr_range = true ;
1097
- break ;
1098
- case DW_TAG_imported_unit:
1099
- case DW_TAG_shared_type:
1100
- default :
1101
- break ;
1102
- }
1103
-
1104
- if (match_addr_range) {
1105
- dw_addr_t lo_pc =
1106
- GetAttributeValueAsAddress (cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
1107
- if (lo_pc != LLDB_INVALID_ADDRESS) {
1108
- dw_addr_t hi_pc = GetAttributeHighPC (cu, lo_pc, LLDB_INVALID_ADDRESS);
1109
- if (hi_pc != LLDB_INVALID_ADDRESS) {
1110
- // printf("\n0x%8.8x: %30s: address = 0x%8.8x [0x%8.8x - 0x%8.8x) ",
1111
- // m_offset, DW_TAG_value_to_name(tag), address, lo_pc, hi_pc);
1112
- if ((lo_pc <= address) && (address < hi_pc)) {
1113
- found_address = true ;
1114
- // puts("***MATCH***");
1115
- switch (m_tag) {
1116
- case DW_TAG_compile_unit: // File
1117
- case DW_TAG_partial_unit: // File
1118
- check_children =
1119
- ((function_die != nullptr ) || (block_die != nullptr ));
1120
- break ;
1121
-
1122
- case DW_TAG_subprogram: // Function
1123
- if (function_die)
1124
- *function_die = this ;
1125
- check_children = (block_die != nullptr );
1126
- break ;
1127
-
1128
- case DW_TAG_inlined_subroutine: // Inlined Function
1129
- case DW_TAG_lexical_block: // Block { } in code
1130
- if (block_die) {
1131
- *block_die = this ;
1132
- check_children = true ;
1133
- }
1134
- break ;
1135
-
1136
- default :
1137
- check_children = true ;
1138
- break ;
1139
- }
1140
- }
1141
- } else {
1142
- // Compile units may not have a valid high/low pc when there
1143
- // are address gaps in subroutines so we must always search
1144
- // if there is no valid high and low PC.
1145
- check_children =
1146
- (m_tag == DW_TAG_compile_unit || m_tag == DW_TAG_partial_unit) &&
1147
- ((function_die != nullptr ) || (block_die != nullptr ));
1148
- }
1149
- } else {
1150
- DWARFRangeList ranges;
1151
- if (GetAttributeAddressRanges (cu, ranges, /* check_hi_lo_pc*/ false ) &&
1152
- ranges.FindEntryThatContains (address)) {
1153
- found_address = true ;
1154
- // puts("***MATCH***");
1155
- switch (m_tag) {
1156
- case DW_TAG_compile_unit: // File
1157
- case DW_TAG_partial_unit: // File
1158
- check_children =
1159
- ((function_die != nullptr ) || (block_die != nullptr ));
1160
- break ;
1161
-
1162
- case DW_TAG_subprogram: // Function
1163
- if (function_die)
1164
- *function_die = this ;
1165
- check_children = (block_die != nullptr );
1166
- break ;
1167
-
1168
- case DW_TAG_inlined_subroutine: // Inlined Function
1169
- case DW_TAG_lexical_block: // Block { } in code
1170
- if (block_die) {
1171
- *block_die = this ;
1172
- check_children = true ;
1173
- }
1174
- break ;
1175
-
1176
- default :
1177
- check_children = true ;
1178
- break ;
1179
- }
1180
- } else {
1181
- check_children = false ;
1182
- }
1183
- }
1184
- }
1185
-
1186
- if (check_children) {
1187
- // printf("checking children\n");
1188
- DWARFDebugInfoEntry *child = GetFirstChild ();
1189
- while (child) {
1190
- if (child->LookupAddress (address, cu, function_die, block_die))
1191
- return true ;
1192
- child = child->GetSibling ();
1193
- }
1194
- }
1195
- }
1196
- return found_address;
1197
- }
1198
-
1199
996
lldb::offset_t DWARFDebugInfoEntry::GetFirstAttributeOffset () const {
1200
997
return GetOffset () + llvm::getULEB128Size (m_abbr_idx);
1201
998
}
0 commit comments