1 //===-- SymbolFileDWARFDebugMap.cpp ----------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "SymbolFileDWARFDebugMap.h" 11 12 #include "lldb/Core/Module.h" 13 #include "lldb/Core/ModuleList.h" 14 #include "lldb/Core/PluginManager.h" 15 #include "lldb/Core/RegularExpression.h" 16 #include "lldb/Core/StreamFile.h" 17 #include "lldb/Core/Timer.h" 18 19 #include "lldb/Symbol/ClangExternalASTSourceCallbacks.h" 20 #include "lldb/Symbol/ObjectFile.h" 21 #include "lldb/Symbol/SymbolVendor.h" 22 #include "lldb/Symbol/VariableList.h" 23 24 #include "SymbolFileDWARF.h" 25 26 using namespace lldb; 27 using namespace lldb_private; 28 29 void 30 SymbolFileDWARFDebugMap::Initialize() 31 { 32 PluginManager::RegisterPlugin (GetPluginNameStatic(), 33 GetPluginDescriptionStatic(), 34 CreateInstance); 35 } 36 37 void 38 SymbolFileDWARFDebugMap::Terminate() 39 { 40 PluginManager::UnregisterPlugin (CreateInstance); 41 } 42 43 44 const char * 45 SymbolFileDWARFDebugMap::GetPluginNameStatic() 46 { 47 return "dwarf-debugmap"; 48 } 49 50 const char * 51 SymbolFileDWARFDebugMap::GetPluginDescriptionStatic() 52 { 53 return "DWARF and DWARF3 debug symbol file reader (debug map)."; 54 } 55 56 SymbolFile* 57 SymbolFileDWARFDebugMap::CreateInstance (ObjectFile* obj_file) 58 { 59 return new SymbolFileDWARFDebugMap (obj_file); 60 } 61 62 63 SymbolFileDWARFDebugMap::SymbolFileDWARFDebugMap (ObjectFile* ofile) : 64 SymbolFile(ofile), 65 m_flags(), 66 m_compile_unit_infos(), 67 m_func_indexes(), 68 m_glob_indexes(), 69 m_supports_DW_AT_APPLE_objc_complete_type (eLazyBoolCalculate) 70 { 71 } 72 73 74 SymbolFileDWARFDebugMap::~SymbolFileDWARFDebugMap() 75 { 76 } 77 78 void 79 SymbolFileDWARFDebugMap::InitializeObject() 80 { 81 // Install our external AST source callbacks so we can complete Clang types. 82 llvm::OwningPtr<clang::ExternalASTSource> ast_source_ap ( 83 new ClangExternalASTSourceCallbacks (SymbolFileDWARFDebugMap::CompleteTagDecl, 84 SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl, 85 NULL, 86 SymbolFileDWARFDebugMap::LayoutRecordType, 87 this)); 88 89 GetClangASTContext().SetExternalSource (ast_source_ap); 90 } 91 92 93 94 void 95 SymbolFileDWARFDebugMap::InitOSO () 96 { 97 if (m_flags.test(kHaveInitializedOSOs)) 98 return; 99 100 m_flags.set(kHaveInitializedOSOs); 101 // In order to get the abilities of this plug-in, we look at the list of 102 // N_OSO entries (object files) from the symbol table and make sure that 103 // these files exist and also contain valid DWARF. If we get any of that 104 // then we return the abilities of the first N_OSO's DWARF. 105 106 Symtab* symtab = m_obj_file->GetSymtab(); 107 if (symtab) 108 { 109 std::vector<uint32_t> oso_indexes; 110 // StreamFile s(stdout); 111 // symtab->Dump(&s, NULL, eSortOrderNone); 112 113 // When a mach-o symbol is encoded, the n_type field is encoded in bits 114 // 23:16, and the n_desc field is encoded in bits 15:0. 115 // 116 // To find all N_OSO entries that are part of the DWARF + debug map 117 // we find only object file symbols with the flags value as follows: 118 // bits 23:16 == 0x66 (N_OSO) 119 // bits 15: 0 == 0x0001 (specifies this is a debug map object file) 120 const uint32_t k_oso_symbol_flags_value = 0x660001u; 121 122 const uint32_t oso_index_count = symtab->AppendSymbolIndexesWithTypeAndFlagsValue(eSymbolTypeObjectFile, k_oso_symbol_flags_value, oso_indexes); 123 124 if (oso_index_count > 0) 125 { 126 symtab->AppendSymbolIndexesWithType (eSymbolTypeCode, Symtab::eDebugYes, Symtab::eVisibilityAny, m_func_indexes); 127 symtab->AppendSymbolIndexesWithType (eSymbolTypeData, Symtab::eDebugYes, Symtab::eVisibilityAny, m_glob_indexes); 128 129 symtab->SortSymbolIndexesByValue(m_func_indexes, true); 130 symtab->SortSymbolIndexesByValue(m_glob_indexes, true); 131 132 m_compile_unit_infos.resize(oso_index_count); 133 // s.Printf("%s N_OSO symbols:\n", __PRETTY_FUNCTION__); 134 // symtab->Dump(&s, oso_indexes); 135 136 for (uint32_t i=0; i<oso_index_count; ++i) 137 { 138 m_compile_unit_infos[i].so_symbol = symtab->SymbolAtIndex(oso_indexes[i] - 1); 139 if (m_compile_unit_infos[i].so_symbol->GetSiblingIndex() == 0) 140 m_compile_unit_infos[i].so_symbol = symtab->SymbolAtIndex(oso_indexes[i] - 2); 141 m_compile_unit_infos[i].oso_symbol = symtab->SymbolAtIndex(oso_indexes[i]); 142 uint32_t sibling_idx = m_compile_unit_infos[i].so_symbol->GetSiblingIndex(); 143 assert (sibling_idx != 0); 144 assert (sibling_idx > i + 1); 145 m_compile_unit_infos[i].last_symbol = symtab->SymbolAtIndex (sibling_idx - 1); 146 m_compile_unit_infos[i].first_symbol_index = symtab->GetIndexForSymbol(m_compile_unit_infos[i].so_symbol); 147 m_compile_unit_infos[i].last_symbol_index = symtab->GetIndexForSymbol(m_compile_unit_infos[i].last_symbol); 148 } 149 } 150 } 151 } 152 153 Module * 154 SymbolFileDWARFDebugMap::GetModuleByOSOIndex (uint32_t oso_idx) 155 { 156 const uint32_t cu_count = GetNumCompileUnits(); 157 if (oso_idx < cu_count) 158 return GetModuleByCompUnitInfo (&m_compile_unit_infos[oso_idx]); 159 return NULL; 160 } 161 162 Module * 163 SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_info) 164 { 165 if (comp_unit_info->oso_module_sp.get() == NULL) 166 { 167 Symbol *oso_symbol = comp_unit_info->oso_symbol; 168 if (oso_symbol) 169 { 170 FileSpec oso_file_spec(oso_symbol->GetMangled().GetName().AsCString(), true); 171 // Always create a new module for .o files. Why? Because we 172 // use the debug map, to add new sections to each .o file and 173 // even though a .o file might not have changed, the sections 174 // that get added to the .o file can change. 175 comp_unit_info->oso_module_sp.reset (new Module (oso_file_spec, 176 m_obj_file->GetModule()->GetArchitecture(), 177 NULL, 178 0)); 179 } 180 } 181 return comp_unit_info->oso_module_sp.get(); 182 } 183 184 185 bool 186 SymbolFileDWARFDebugMap::GetFileSpecForSO (uint32_t oso_idx, FileSpec &file_spec) 187 { 188 if (oso_idx < m_compile_unit_infos.size()) 189 { 190 if (!m_compile_unit_infos[oso_idx].so_file) 191 { 192 193 if (m_compile_unit_infos[oso_idx].so_symbol == NULL) 194 return false; 195 196 std::string so_path (m_compile_unit_infos[oso_idx].so_symbol->GetMangled().GetName().AsCString()); 197 if (m_compile_unit_infos[oso_idx].so_symbol[1].GetType() == eSymbolTypeSourceFile) 198 so_path += m_compile_unit_infos[oso_idx].so_symbol[1].GetMangled().GetName().AsCString(); 199 m_compile_unit_infos[oso_idx].so_file.SetFile(so_path.c_str(), true); 200 } 201 file_spec = m_compile_unit_infos[oso_idx].so_file; 202 return true; 203 } 204 return false; 205 } 206 207 208 209 ObjectFile * 210 SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex (uint32_t oso_idx) 211 { 212 Module *oso_module = GetModuleByOSOIndex (oso_idx); 213 if (oso_module) 214 return oso_module->GetObjectFile(); 215 return NULL; 216 } 217 218 SymbolFileDWARF * 219 SymbolFileDWARFDebugMap::GetSymbolFile (const SymbolContext& sc) 220 { 221 CompileUnitInfo *comp_unit_info = GetCompUnitInfo (sc); 222 if (comp_unit_info) 223 return GetSymbolFileByCompUnitInfo (comp_unit_info); 224 return NULL; 225 } 226 227 ObjectFile * 228 SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo (CompileUnitInfo *comp_unit_info) 229 { 230 Module *oso_module = GetModuleByCompUnitInfo (comp_unit_info); 231 if (oso_module) 232 return oso_module->GetObjectFile(); 233 return NULL; 234 } 235 236 237 uint32_t 238 SymbolFileDWARFDebugMap::GetCompUnitInfoIndex (const CompileUnitInfo *comp_unit_info) 239 { 240 if (!m_compile_unit_infos.empty()) 241 { 242 const CompileUnitInfo *first_comp_unit_info = &m_compile_unit_infos.front(); 243 const CompileUnitInfo *last_comp_unit_info = &m_compile_unit_infos.back(); 244 if (first_comp_unit_info <= comp_unit_info && comp_unit_info <= last_comp_unit_info) 245 return comp_unit_info - first_comp_unit_info; 246 } 247 return UINT32_MAX; 248 } 249 250 SymbolFileDWARF * 251 SymbolFileDWARFDebugMap::GetSymbolFileByOSOIndex (uint32_t oso_idx) 252 { 253 if (oso_idx < m_compile_unit_infos.size()) 254 return GetSymbolFileByCompUnitInfo (&m_compile_unit_infos[oso_idx]); 255 return NULL; 256 } 257 258 SymbolFileDWARF * 259 SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit_info) 260 { 261 if (comp_unit_info->oso_symbol_vendor == NULL) 262 { 263 ObjectFile *oso_objfile = GetObjectFileByCompUnitInfo (comp_unit_info); 264 265 if (oso_objfile) 266 { 267 comp_unit_info->oso_symbol_vendor = oso_objfile->GetModule()->GetSymbolVendor(); 268 // SymbolFileDWARF *oso_dwarf = new SymbolFileDWARF(oso_objfile); 269 // comp_unit_info->oso_dwarf_sp.reset (oso_dwarf); 270 if (comp_unit_info->oso_symbol_vendor) 271 { 272 // Set a a pointer to this class to set our OSO DWARF file know 273 // that the DWARF is being used along with a debug map and that 274 // it will have the remapped sections that we do below. 275 SymbolFileDWARF *oso_symfile = (SymbolFileDWARF *)comp_unit_info->oso_symbol_vendor->GetSymbolFile(); 276 oso_symfile->SetDebugMapSymfile(this); 277 // Set the ID of the symbol file DWARF to the index of the OSO 278 // shifted left by 32 bits to provide a unique prefix for any 279 // UserID's that get created in the symbol file. 280 oso_symfile->SetID (((uint64_t)GetCompUnitInfoIndex(comp_unit_info) + 1ull) << 32ull); 281 comp_unit_info->debug_map_sections_sp.reset(new SectionList); 282 283 Symtab *exe_symtab = m_obj_file->GetSymtab(); 284 ModuleSP oso_module_sp (oso_objfile->GetModule()); 285 Symtab *oso_symtab = oso_objfile->GetSymtab(); 286 //#define DEBUG_OSO_DMAP // Do not check in with this defined... 287 #if defined(DEBUG_OSO_DMAP) 288 StreamFile s(stdout); 289 s << "OSO symtab:\n"; 290 oso_symtab->Dump(&s, NULL); 291 s << "OSO sections before:\n"; 292 oso_objfile->GetSectionList()->Dump(&s, NULL, true); 293 #endif 294 295 ///const uint32_t fun_resolve_flags = SymbolContext::Module | eSymbolContextCompUnit | eSymbolContextFunction; 296 //SectionList *oso_sections = oso_objfile->Sections(); 297 // Now we need to make sections that map from zero based object 298 // file addresses to where things eneded up in the main executable. 299 uint32_t oso_start_idx = exe_symtab->GetIndexForSymbol (comp_unit_info->oso_symbol); 300 assert (oso_start_idx != UINT32_MAX); 301 oso_start_idx += 1; 302 const uint32_t oso_end_idx = comp_unit_info->so_symbol->GetSiblingIndex(); 303 uint32_t sect_id = 0x10000; 304 for (uint32_t idx = oso_start_idx; idx < oso_end_idx; ++idx) 305 { 306 Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx); 307 if (exe_symbol) 308 { 309 if (exe_symbol->IsDebug() == false) 310 continue; 311 312 switch (exe_symbol->GetType()) 313 { 314 default: 315 break; 316 317 case eSymbolTypeCode: 318 { 319 // For each N_FUN, or function that we run into in the debug map 320 // we make a new section that we add to the sections found in the 321 // .o file. This new section has the file address set to what the 322 // addresses are in the .o file, and the load address is adjusted 323 // to match where it ended up in the final executable! We do this 324 // before we parse any dwarf info so that when it goes get parsed 325 // all section/offset addresses that get registered will resolve 326 // correctly to the new addresses in the main executable. 327 328 // First we find the original symbol in the .o file's symbol table 329 Symbol *oso_fun_symbol = oso_symtab->FindFirstSymbolWithNameAndType(exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny); 330 if (oso_fun_symbol) 331 { 332 // If we found the symbol, then we 333 SectionSP exe_fun_section (exe_symbol->GetAddress().GetSection()); 334 SectionSP oso_fun_section (oso_fun_symbol->GetAddress().GetSection()); 335 if (oso_fun_section) 336 { 337 // Now we create a section that we will add as a child of the 338 // section in which the .o symbol (the N_FUN) exists. 339 340 // We use the exe_symbol size because the one in the .o file 341 // will just be a symbol with no size, and the exe_symbol 342 // size will reflect any size changes (ppc has been known to 343 // shrink function sizes when it gets rid of jump islands that 344 // aren't needed anymore). 345 SectionSP oso_fun_section_sp (new Section (oso_fun_symbol->GetAddress().GetSection(), 346 oso_module_sp, // Module (the .o file) 347 sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs 348 exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated! 349 eSectionTypeDebug, 350 oso_fun_symbol->GetAddress().GetOffset(), // File VM address offset in the current section 351 exe_symbol->GetByteSize(), // File size (we need the size from the executable) 352 0, 0, 0)); 353 354 oso_fun_section_sp->SetLinkedLocation (exe_fun_section, 355 exe_symbol->GetAddress().GetFileAddress() - exe_fun_section->GetFileAddress()); 356 oso_fun_section->GetChildren().AddSection(oso_fun_section_sp); 357 comp_unit_info->debug_map_sections_sp->AddSection(oso_fun_section_sp); 358 } 359 } 360 } 361 break; 362 363 case eSymbolTypeData: 364 { 365 // For each N_GSYM we remap the address for the global by making 366 // a new section that we add to the sections found in the .o file. 367 // This new section has the file address set to what the 368 // addresses are in the .o file, and the load address is adjusted 369 // to match where it ended up in the final executable! We do this 370 // before we parse any dwarf info so that when it goes get parsed 371 // all section/offset addresses that get registered will resolve 372 // correctly to the new addresses in the main executable. We 373 // initially set the section size to be 1 byte, but will need to 374 // fix up these addresses further after all globals have been 375 // parsed to span the gaps, or we can find the global variable 376 // sizes from the DWARF info as we are parsing. 377 378 // Next we find the non-stab entry that corresponds to the N_GSYM in the .o file 379 Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType (exe_symbol->GetMangled().GetName(), 380 eSymbolTypeData, 381 Symtab::eDebugNo, 382 Symtab::eVisibilityAny); 383 384 if (exe_symbol && oso_gsym_symbol && exe_symbol->ValueIsAddress() && oso_gsym_symbol->ValueIsAddress()) 385 { 386 // If we found the symbol, then we 387 SectionSP exe_gsym_section (exe_symbol->GetAddress().GetSection()); 388 SectionSP oso_gsym_section (oso_gsym_symbol->GetAddress().GetSection()); 389 if (oso_gsym_section) 390 { 391 SectionSP oso_gsym_section_sp (new Section (oso_gsym_symbol->GetAddress().GetSection(), 392 oso_module_sp, // Module (the .o file) 393 sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs 394 exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated! 395 eSectionTypeDebug, 396 oso_gsym_symbol->GetAddress().GetOffset(), // File VM address offset in the current section 397 1, // We don't know the size of the global, just do the main address for now. 398 0, 0, 0)); 399 400 oso_gsym_section_sp->SetLinkedLocation (exe_gsym_section, 401 exe_symbol->GetAddress().GetFileAddress() - exe_gsym_section->GetFileAddress()); 402 oso_gsym_section->GetChildren().AddSection(oso_gsym_section_sp); 403 comp_unit_info->debug_map_sections_sp->AddSection(oso_gsym_section_sp); 404 } 405 } 406 } 407 break; 408 } 409 } 410 } 411 #if defined(DEBUG_OSO_DMAP) 412 s << "OSO sections after:\n"; 413 oso_objfile->GetSectionList()->Dump(&s, NULL, true); 414 #endif 415 } 416 } 417 } 418 if (comp_unit_info->oso_symbol_vendor) 419 return (SymbolFileDWARF *)comp_unit_info->oso_symbol_vendor->GetSymbolFile(); 420 return NULL; 421 } 422 423 uint32_t 424 SymbolFileDWARFDebugMap::CalculateAbilities () 425 { 426 // In order to get the abilities of this plug-in, we look at the list of 427 // N_OSO entries (object files) from the symbol table and make sure that 428 // these files exist and also contain valid DWARF. If we get any of that 429 // then we return the abilities of the first N_OSO's DWARF. 430 431 const uint32_t oso_index_count = GetNumCompileUnits(); 432 if (oso_index_count > 0) 433 { 434 const uint32_t dwarf_abilities = SymbolFile::CompileUnits | 435 SymbolFile::Functions | 436 SymbolFile::Blocks | 437 SymbolFile::GlobalVariables | 438 SymbolFile::LocalVariables | 439 SymbolFile::VariableTypes | 440 SymbolFile::LineTables; 441 442 for (uint32_t oso_idx=0; oso_idx<oso_index_count; ++oso_idx) 443 { 444 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 445 if (oso_dwarf) 446 { 447 uint32_t oso_abilities = oso_dwarf->GetAbilities(); 448 if ((oso_abilities & dwarf_abilities) == dwarf_abilities) 449 return oso_abilities; 450 } 451 } 452 } 453 return 0; 454 } 455 456 uint32_t 457 SymbolFileDWARFDebugMap::GetNumCompileUnits() 458 { 459 InitOSO (); 460 return m_compile_unit_infos.size(); 461 } 462 463 464 CompUnitSP 465 SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) 466 { 467 CompUnitSP comp_unit_sp; 468 const uint32_t cu_count = GetNumCompileUnits(); 469 470 if (cu_idx < cu_count) 471 { 472 if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == NULL) 473 { 474 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (cu_idx); 475 if (oso_dwarf) 476 { 477 // There is only one compile unit for N_OSO entry right now, so 478 // it will always exist at index zero. 479 m_compile_unit_infos[cu_idx].oso_compile_unit_sp = m_compile_unit_infos[cu_idx].oso_symbol_vendor->GetCompileUnitAtIndex (0); 480 } 481 482 if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == NULL) 483 { 484 // We weren't able to get the DWARF for this N_OSO entry (the 485 // .o file may be missing or not at the specified path), make 486 // one up as best we can from the debug map. We set the uid 487 // of the compile unit to the symbol index with the MSBit set 488 // so that it doesn't collide with any uid values from the DWARF 489 Symbol *so_symbol = m_compile_unit_infos[cu_idx].so_symbol; 490 if (so_symbol) 491 { 492 m_compile_unit_infos[cu_idx].oso_compile_unit_sp.reset(new CompileUnit (m_obj_file->GetModule(), 493 NULL, 494 so_symbol->GetMangled().GetName().AsCString(), 495 cu_idx, 496 eLanguageTypeUnknown)); 497 498 // Let our symbol vendor know about this compile unit 499 m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex (m_compile_unit_infos[cu_idx].oso_compile_unit_sp, 500 cu_idx); 501 } 502 } 503 } 504 comp_unit_sp = m_compile_unit_infos[cu_idx].oso_compile_unit_sp; 505 } 506 507 return comp_unit_sp; 508 } 509 510 SymbolFileDWARFDebugMap::CompileUnitInfo * 511 SymbolFileDWARFDebugMap::GetCompUnitInfo (const SymbolContext& sc) 512 { 513 const uint32_t cu_count = GetNumCompileUnits(); 514 for (uint32_t i=0; i<cu_count; ++i) 515 { 516 if (sc.comp_unit == m_compile_unit_infos[i].oso_compile_unit_sp.get()) 517 return &m_compile_unit_infos[i]; 518 } 519 return NULL; 520 } 521 522 size_t 523 SymbolFileDWARFDebugMap::ParseCompileUnitFunctions (const SymbolContext& sc) 524 { 525 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 526 if (oso_dwarf) 527 return oso_dwarf->ParseCompileUnitFunctions (sc); 528 return 0; 529 } 530 531 bool 532 SymbolFileDWARFDebugMap::ParseCompileUnitLineTable (const SymbolContext& sc) 533 { 534 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 535 if (oso_dwarf) 536 return oso_dwarf->ParseCompileUnitLineTable (sc); 537 return false; 538 } 539 540 bool 541 SymbolFileDWARFDebugMap::ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList &support_files) 542 { 543 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 544 if (oso_dwarf) 545 return oso_dwarf->ParseCompileUnitSupportFiles (sc, support_files); 546 return false; 547 } 548 549 550 size_t 551 SymbolFileDWARFDebugMap::ParseFunctionBlocks (const SymbolContext& sc) 552 { 553 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 554 if (oso_dwarf) 555 return oso_dwarf->ParseFunctionBlocks (sc); 556 return 0; 557 } 558 559 560 size_t 561 SymbolFileDWARFDebugMap::ParseTypes (const SymbolContext& sc) 562 { 563 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 564 if (oso_dwarf) 565 return oso_dwarf->ParseTypes (sc); 566 return 0; 567 } 568 569 570 size_t 571 SymbolFileDWARFDebugMap::ParseVariablesForContext (const SymbolContext& sc) 572 { 573 SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 574 if (oso_dwarf) 575 return oso_dwarf->ParseTypes (sc); 576 return 0; 577 } 578 579 580 581 Type* 582 SymbolFileDWARFDebugMap::ResolveTypeUID(lldb::user_id_t type_uid) 583 { 584 const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid); 585 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 586 if (oso_dwarf) 587 oso_dwarf->ResolveTypeUID (type_uid); 588 return NULL; 589 } 590 591 lldb::clang_type_t 592 SymbolFileDWARFDebugMap::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type) 593 { 594 // We have a struct/union/class/enum that needs to be fully resolved. 595 return NULL; 596 } 597 598 uint32_t 599 SymbolFileDWARFDebugMap::ResolveSymbolContext (const Address& exe_so_addr, uint32_t resolve_scope, SymbolContext& sc) 600 { 601 uint32_t resolved_flags = 0; 602 Symtab* symtab = m_obj_file->GetSymtab(); 603 if (symtab) 604 { 605 const addr_t exe_file_addr = exe_so_addr.GetFileAddress(); 606 sc.symbol = symtab->FindSymbolContainingFileAddress (exe_file_addr, &m_func_indexes[0], m_func_indexes.size()); 607 608 if (sc.symbol != NULL) 609 { 610 resolved_flags |= eSymbolContextSymbol; 611 612 uint32_t oso_idx = 0; 613 CompileUnitInfo* comp_unit_info = GetCompileUnitInfoForSymbolWithID (sc.symbol->GetID(), &oso_idx); 614 if (comp_unit_info) 615 { 616 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 617 ObjectFile *oso_objfile = GetObjectFileByOSOIndex (oso_idx); 618 if (oso_dwarf && oso_objfile) 619 { 620 SectionList *oso_section_list = oso_objfile->GetSectionList(); 621 622 SectionSP oso_symbol_section_sp (oso_section_list->FindSectionContainingLinkedFileAddress (exe_file_addr, UINT32_MAX)); 623 624 if (oso_symbol_section_sp) 625 { 626 const addr_t linked_file_addr = oso_symbol_section_sp->GetLinkedFileAddress(); 627 Address oso_so_addr (oso_symbol_section_sp, exe_file_addr - linked_file_addr); 628 if (oso_so_addr.IsSectionOffset()) 629 resolved_flags |= oso_dwarf->ResolveSymbolContext (oso_so_addr, resolve_scope, sc); 630 } 631 } 632 } 633 } 634 } 635 return resolved_flags; 636 } 637 638 639 uint32_t 640 SymbolFileDWARFDebugMap::ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) 641 { 642 uint32_t initial = sc_list.GetSize(); 643 const uint32_t cu_count = GetNumCompileUnits(); 644 645 FileSpec so_file_spec; 646 for (uint32_t i=0; i<cu_count; ++i) 647 { 648 if (GetFileSpecForSO (i, so_file_spec)) 649 { 650 // By passing false to the comparison we will be able to match 651 // and files given a filename only. If both file_spec and 652 // so_file_spec have directories, we will still do a full match. 653 if (FileSpec::Compare (file_spec, so_file_spec, false) == 0) 654 { 655 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (i); 656 if (oso_dwarf) 657 oso_dwarf->ResolveSymbolContext(file_spec, line, check_inlines, resolve_scope, sc_list); 658 } 659 } 660 } 661 return sc_list.GetSize() - initial; 662 } 663 664 uint32_t 665 SymbolFileDWARFDebugMap::PrivateFindGlobalVariables 666 ( 667 const ConstString &name, 668 const ClangNamespaceDecl *namespace_decl, 669 const std::vector<uint32_t> &indexes, // Indexes into the symbol table that match "name" 670 uint32_t max_matches, 671 VariableList& variables 672 ) 673 { 674 const uint32_t original_size = variables.GetSize(); 675 const size_t match_count = indexes.size(); 676 for (size_t i=0; i<match_count; ++i) 677 { 678 uint32_t oso_idx; 679 CompileUnitInfo* comp_unit_info = GetCompileUnitInfoForSymbolWithIndex (indexes[i], &oso_idx); 680 if (comp_unit_info) 681 { 682 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 683 if (oso_dwarf) 684 { 685 if (oso_dwarf->FindGlobalVariables(name, namespace_decl, true, max_matches, variables)) 686 if (variables.GetSize() > max_matches) 687 break; 688 } 689 } 690 } 691 return variables.GetSize() - original_size; 692 } 693 694 uint32_t 695 SymbolFileDWARFDebugMap::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) 696 { 697 698 // If we aren't appending the results to this list, then clear the list 699 if (!append) 700 variables.Clear(); 701 702 // Remember how many variables are in the list before we search in case 703 // we are appending the results to a variable list. 704 const uint32_t original_size = variables.GetSize(); 705 706 uint32_t total_matches = 0; 707 SymbolFileDWARF *oso_dwarf; 708 for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 709 { 710 const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (name, 711 namespace_decl, 712 true, 713 max_matches, 714 variables); 715 if (oso_matches > 0) 716 { 717 total_matches += oso_matches; 718 719 // Are we getting all matches? 720 if (max_matches == UINT32_MAX) 721 continue; // Yep, continue getting everything 722 723 // If we have found enough matches, lets get out 724 if (max_matches >= total_matches) 725 break; 726 727 // Update the max matches for any subsequent calls to find globals 728 // in any other object files with DWARF 729 max_matches -= oso_matches; 730 } 731 } 732 // Return the number of variable that were appended to the list 733 return variables.GetSize() - original_size; 734 } 735 736 737 uint32_t 738 SymbolFileDWARFDebugMap::FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) 739 { 740 // If we aren't appending the results to this list, then clear the list 741 if (!append) 742 variables.Clear(); 743 744 // Remember how many variables are in the list before we search in case 745 // we are appending the results to a variable list. 746 const uint32_t original_size = variables.GetSize(); 747 748 uint32_t total_matches = 0; 749 SymbolFileDWARF *oso_dwarf; 750 for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 751 { 752 const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (regex, 753 true, 754 max_matches, 755 variables); 756 if (oso_matches > 0) 757 { 758 total_matches += oso_matches; 759 760 // Are we getting all matches? 761 if (max_matches == UINT32_MAX) 762 continue; // Yep, continue getting everything 763 764 // If we have found enough matches, lets get out 765 if (max_matches >= total_matches) 766 break; 767 768 // Update the max matches for any subsequent calls to find globals 769 // in any other object files with DWARF 770 max_matches -= oso_matches; 771 } 772 } 773 // Return the number of variable that were appended to the list 774 return variables.GetSize() - original_size; 775 } 776 777 778 int 779 SymbolFileDWARFDebugMap::SymbolContainsSymbolWithIndex (uint32_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info) 780 { 781 const uint32_t symbol_idx = *symbol_idx_ptr; 782 783 if (symbol_idx < comp_unit_info->first_symbol_index) 784 return -1; 785 786 if (symbol_idx <= comp_unit_info->last_symbol_index) 787 return 0; 788 789 return 1; 790 } 791 792 793 int 794 SymbolFileDWARFDebugMap::SymbolContainsSymbolWithID (user_id_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info) 795 { 796 const user_id_t symbol_id = *symbol_idx_ptr; 797 798 if (symbol_id < comp_unit_info->so_symbol->GetID()) 799 return -1; 800 801 if (symbol_id <= comp_unit_info->last_symbol->GetID()) 802 return 0; 803 804 return 1; 805 } 806 807 808 SymbolFileDWARFDebugMap::CompileUnitInfo* 809 SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithIndex (uint32_t symbol_idx, uint32_t *oso_idx_ptr) 810 { 811 const uint32_t oso_index_count = m_compile_unit_infos.size(); 812 CompileUnitInfo *comp_unit_info = NULL; 813 if (oso_index_count) 814 { 815 comp_unit_info = (CompileUnitInfo*)bsearch(&symbol_idx, 816 &m_compile_unit_infos[0], 817 m_compile_unit_infos.size(), 818 sizeof(CompileUnitInfo), 819 (ComparisonFunction)SymbolContainsSymbolWithIndex); 820 } 821 822 if (oso_idx_ptr) 823 { 824 if (comp_unit_info != NULL) 825 *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0]; 826 else 827 *oso_idx_ptr = UINT32_MAX; 828 } 829 return comp_unit_info; 830 } 831 832 SymbolFileDWARFDebugMap::CompileUnitInfo* 833 SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithID (user_id_t symbol_id, uint32_t *oso_idx_ptr) 834 { 835 const uint32_t oso_index_count = m_compile_unit_infos.size(); 836 CompileUnitInfo *comp_unit_info = NULL; 837 if (oso_index_count) 838 { 839 comp_unit_info = (CompileUnitInfo*)::bsearch (&symbol_id, 840 &m_compile_unit_infos[0], 841 m_compile_unit_infos.size(), 842 sizeof(CompileUnitInfo), 843 (ComparisonFunction)SymbolContainsSymbolWithID); 844 } 845 846 if (oso_idx_ptr) 847 { 848 if (comp_unit_info != NULL) 849 *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0]; 850 else 851 *oso_idx_ptr = UINT32_MAX; 852 } 853 return comp_unit_info; 854 } 855 856 857 static void 858 RemoveFunctionsWithModuleNotEqualTo (const ModuleSP &module_sp, SymbolContextList &sc_list, uint32_t start_idx) 859 { 860 // We found functions in .o files. Not all functions in the .o files 861 // will have made it into the final output file. The ones that did 862 // make it into the final output file will have a section whose module 863 // matches the module from the ObjectFile for this SymbolFile. When 864 // the modules don't match, then we have something that was in a 865 // .o file, but doesn't map to anything in the final executable. 866 uint32_t i=start_idx; 867 while (i < sc_list.GetSize()) 868 { 869 SymbolContext sc; 870 sc_list.GetContextAtIndex(i, sc); 871 if (sc.function) 872 { 873 const SectionSP section_sp (sc.function->GetAddressRange().GetBaseAddress().GetSection()); 874 if (section_sp->GetModule() != module_sp) 875 { 876 sc_list.RemoveContextAtIndex(i); 877 continue; 878 } 879 } 880 ++i; 881 } 882 } 883 884 uint32_t 885 SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list) 886 { 887 Timer scoped_timer (__PRETTY_FUNCTION__, 888 "SymbolFileDWARFDebugMap::FindFunctions (name = %s)", 889 name.GetCString()); 890 891 uint32_t initial_size = 0; 892 if (append) 893 initial_size = sc_list.GetSize(); 894 else 895 sc_list.Clear(); 896 897 uint32_t oso_idx = 0; 898 SymbolFileDWARF *oso_dwarf; 899 while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) 900 { 901 uint32_t sc_idx = sc_list.GetSize(); 902 if (oso_dwarf->FindFunctions(name, namespace_decl, name_type_mask, include_inlines, true, sc_list)) 903 { 904 RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx); 905 } 906 } 907 908 return sc_list.GetSize() - initial_size; 909 } 910 911 912 uint32_t 913 SymbolFileDWARFDebugMap::FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list) 914 { 915 Timer scoped_timer (__PRETTY_FUNCTION__, 916 "SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')", 917 regex.GetText()); 918 919 uint32_t initial_size = 0; 920 if (append) 921 initial_size = sc_list.GetSize(); 922 else 923 sc_list.Clear(); 924 925 uint32_t oso_idx = 0; 926 SymbolFileDWARF *oso_dwarf; 927 while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) 928 { 929 uint32_t sc_idx = sc_list.GetSize(); 930 931 if (oso_dwarf->FindFunctions(regex, include_inlines, true, sc_list)) 932 { 933 RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx); 934 } 935 } 936 937 return sc_list.GetSize() - initial_size; 938 } 939 940 TypeSP 941 SymbolFileDWARFDebugMap::FindDefinitionTypeForDIE (DWARFCompileUnit* cu, 942 const DWARFDebugInfoEntry *die, 943 const ConstString &type_name) 944 { 945 TypeSP type_sp; 946 SymbolFileDWARF *oso_dwarf; 947 for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 948 { 949 type_sp = oso_dwarf->FindDefinitionTypeForDIE (cu, die, type_name); 950 if (type_sp) 951 break; 952 } 953 return type_sp; 954 } 955 956 957 958 bool 959 SymbolFileDWARFDebugMap::Supports_DW_AT_APPLE_objc_complete_type (SymbolFileDWARF *skip_dwarf_oso) 960 { 961 if (m_supports_DW_AT_APPLE_objc_complete_type == eLazyBoolCalculate) 962 { 963 m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolNo; 964 SymbolFileDWARF *oso_dwarf; 965 for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 966 { 967 if (skip_dwarf_oso != oso_dwarf && oso_dwarf->Supports_DW_AT_APPLE_objc_complete_type(NULL)) 968 { 969 m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolYes; 970 break; 971 } 972 } 973 } 974 return m_supports_DW_AT_APPLE_objc_complete_type == eLazyBoolYes; 975 } 976 977 TypeSP 978 SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE (const DWARFDebugInfoEntry *die, 979 const ConstString &type_name, 980 bool must_be_implementation) 981 { 982 TypeSP type_sp; 983 SymbolFileDWARF *oso_dwarf; 984 for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 985 { 986 type_sp = oso_dwarf->FindCompleteObjCDefinitionTypeForDIE (die, type_name, must_be_implementation); 987 if (type_sp) 988 break; 989 } 990 return type_sp; 991 } 992 993 uint32_t 994 SymbolFileDWARFDebugMap::FindTypes 995 ( 996 const SymbolContext& sc, 997 const ConstString &name, 998 const ClangNamespaceDecl *namespace_decl, 999 bool append, 1000 uint32_t max_matches, 1001 TypeList& types 1002 ) 1003 { 1004 if (!append) 1005 types.Clear(); 1006 1007 const uint32_t initial_types_size = types.GetSize(); 1008 SymbolFileDWARF *oso_dwarf; 1009 1010 if (sc.comp_unit) 1011 { 1012 oso_dwarf = GetSymbolFile (sc); 1013 if (oso_dwarf) 1014 return oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types); 1015 } 1016 else 1017 { 1018 uint32_t oso_idx = 0; 1019 while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) 1020 oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types); 1021 } 1022 1023 return types.GetSize() - initial_types_size; 1024 } 1025 1026 // 1027 //uint32_t 1028 //SymbolFileDWARFDebugMap::FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types) 1029 //{ 1030 // SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc); 1031 // if (oso_dwarf) 1032 // return oso_dwarf->FindTypes (sc, regex, append, max_matches, encoding, udt_uid, types); 1033 // return 0; 1034 //} 1035 1036 1037 ClangNamespaceDecl 1038 SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc, 1039 const lldb_private::ConstString &name, 1040 const ClangNamespaceDecl *parent_namespace_decl) 1041 { 1042 ClangNamespaceDecl matching_namespace; 1043 SymbolFileDWARF *oso_dwarf; 1044 1045 if (sc.comp_unit) 1046 { 1047 oso_dwarf = GetSymbolFile (sc); 1048 if (oso_dwarf) 1049 matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl); 1050 } 1051 else 1052 { 1053 for (uint32_t oso_idx = 0; 1054 ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); 1055 ++oso_idx) 1056 { 1057 matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl); 1058 1059 if (matching_namespace) 1060 break; 1061 } 1062 } 1063 1064 return matching_namespace; 1065 } 1066 1067 //------------------------------------------------------------------ 1068 // PluginInterface protocol 1069 //------------------------------------------------------------------ 1070 const char * 1071 SymbolFileDWARFDebugMap::GetPluginName() 1072 { 1073 return "SymbolFileDWARFDebugMap"; 1074 } 1075 1076 const char * 1077 SymbolFileDWARFDebugMap::GetShortPluginName() 1078 { 1079 return GetPluginNameStatic(); 1080 } 1081 1082 uint32_t 1083 SymbolFileDWARFDebugMap::GetPluginVersion() 1084 { 1085 return 1; 1086 } 1087 1088 void 1089 SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompUnitSP &cu_sp) 1090 { 1091 const uint32_t cu_count = GetNumCompileUnits(); 1092 for (uint32_t i=0; i<cu_count; ++i) 1093 { 1094 if (m_compile_unit_infos[i].oso_symbol_vendor && 1095 m_compile_unit_infos[i].oso_symbol_vendor->GetSymbolFile() == oso_dwarf) 1096 { 1097 if (m_compile_unit_infos[i].oso_compile_unit_sp) 1098 { 1099 assert (m_compile_unit_infos[i].oso_compile_unit_sp.get() == cu_sp.get()); 1100 } 1101 else 1102 { 1103 m_compile_unit_infos[i].oso_compile_unit_sp = cu_sp; 1104 } 1105 } 1106 } 1107 } 1108 1109 1110 void 1111 SymbolFileDWARFDebugMap::CompleteTagDecl (void *baton, clang::TagDecl *decl) 1112 { 1113 SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; 1114 clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl); 1115 if (clang_type) 1116 { 1117 SymbolFileDWARF *oso_dwarf; 1118 1119 for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 1120 { 1121 if (oso_dwarf->HasForwardDeclForClangType (clang_type)) 1122 { 1123 oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type); 1124 return; 1125 } 1126 } 1127 } 1128 } 1129 1130 void 1131 SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *decl) 1132 { 1133 SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; 1134 clang_type_t clang_type = symbol_file_dwarf->GetClangASTContext().GetTypeForDecl (decl); 1135 if (clang_type) 1136 { 1137 SymbolFileDWARF *oso_dwarf; 1138 1139 for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 1140 { 1141 if (oso_dwarf->HasForwardDeclForClangType (clang_type)) 1142 { 1143 oso_dwarf->ResolveClangOpaqueTypeDefinition (clang_type); 1144 return; 1145 } 1146 } 1147 } 1148 } 1149 1150 bool 1151 SymbolFileDWARFDebugMap::LayoutRecordType (void *baton, 1152 const clang::RecordDecl *record_decl, 1153 uint64_t &size, 1154 uint64_t &alignment, 1155 llvm::DenseMap <const clang::FieldDecl *, uint64_t> &field_offsets, 1156 llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, 1157 llvm::DenseMap <const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets) 1158 { 1159 SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton; 1160 SymbolFileDWARF *oso_dwarf; 1161 for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) 1162 { 1163 if (oso_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets)) 1164 return true; 1165 } 1166 return false; 1167 } 1168 1169 1170 1171 clang::DeclContext* 1172 SymbolFileDWARFDebugMap::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) 1173 { 1174 const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid); 1175 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 1176 if (oso_dwarf) 1177 return oso_dwarf->GetClangDeclContextContainingTypeUID (type_uid); 1178 return NULL; 1179 } 1180 1181 clang::DeclContext* 1182 SymbolFileDWARFDebugMap::GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid) 1183 { 1184 const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid); 1185 SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); 1186 if (oso_dwarf) 1187 return oso_dwarf->GetClangDeclContextForTypeUID (sc, type_uid); 1188 return NULL; 1189 } 1190 1191 1192