@@ -2476,42 +2476,53 @@ bool SymbolFileDWARF::ResolveFunction(const DWARFDIE &orig_die,
2476
2476
}
2477
2477
2478
2478
llvm::Error
2479
- SymbolFileDWARF::FindAndResolveFunction (SymbolContextList &sc_list,
2480
- llvm::StringRef lookup_name ) {
2479
+ SymbolFileDWARF::ResolveFunctionCallLabel (SymbolContextList &sc_list,
2480
+ const FunctionCallLabel &label ) {
2481
2481
std::lock_guard<std::recursive_mutex> guard (GetModuleMutex ());
2482
2482
2483
- DWARFDIE die;
2484
- Module::LookupInfo info (ConstString (lookup_name), lldb::eFunctionNameTypeFull,
2485
- lldb::eLanguageTypeUnknown);
2483
+ DWARFDIE die = GetDIE (label.symbol_id );
2484
+ if (!die.IsValid ())
2485
+ return llvm::createStringError (
2486
+ llvm::formatv (" invalid DIE ID in {0}" , label));
2486
2487
2487
- m_index->GetFunctions (info, *this , {}, [&](DWARFDIE entry) {
2488
- if (entry.GetAttributeValueAsUnsigned (llvm::dwarf::DW_AT_declaration, 0 ))
2489
- return true ;
2488
+ // Label was created using a declaration DIE. Need to fetch the definition
2489
+ // to resolve the function call.
2490
+ if (die.GetAttributeValueAsUnsigned (llvm::dwarf::DW_AT_declaration, 0 )) {
2491
+ Module::LookupInfo info (ConstString (label.lookup_name ),
2492
+ lldb::eFunctionNameTypeFull,
2493
+ lldb::eLanguageTypeUnknown);
2490
2494
2491
- // We don't check whether the specification DIE for this function
2492
- // corresponds to the declaration DIE because the declaration might be in
2493
- // a type-unit but the definition in the compile-unit (and it's
2494
- // specifcation would point to the declaration in the compile-unit). We
2495
- // rely on the mangled name within the module to be enough to find us the
2496
- // unique definition.
2497
- die = entry;
2498
- return false ;
2499
- });
2495
+ m_index->GetFunctions (info, *this , {}, [&](DWARFDIE entry) {
2496
+ if (entry.GetAttributeValueAsUnsigned (llvm::dwarf::DW_AT_declaration, 0 ))
2497
+ return true ;
2500
2498
2501
- if (!die.IsValid ())
2502
- return llvm::createStringError (
2503
- llvm::formatv (" failed to find definition DIE for '{0}'" , lookup_name));
2499
+ // We don't check whether the specification DIE for this function
2500
+ // corresponds to the declaration DIE because the declaration might be in
2501
+ // a type-unit but the definition in the compile-unit (and it's
2502
+ // specifcation would point to the declaration in the compile-unit). We
2503
+ // rely on the mangled name within the module to be enough to find us the
2504
+ // unique definition.
2505
+ die = entry;
2506
+ return false ;
2507
+ });
2504
2508
2505
- if (!ResolveFunction (die, false , sc_list))
2506
- return llvm::createStringError (" failed to resolve function DIE" );
2509
+ if (die.GetAttributeValueAsUnsigned (llvm::dwarf::DW_AT_declaration, 0 ))
2510
+ return llvm::createStringError (
2511
+ llvm::formatv (" failed to find definition DIE for {0}" , label));
2512
+ }
2513
+
2514
+ if (!ResolveFunction (die, /* include_inlines=*/ false , sc_list))
2515
+ return llvm::createStringError (
2516
+ llvm::formatv (" failed to resolve function for {0}" , label));
2507
2517
2508
2518
if (sc_list.IsEmpty ())
2509
- return llvm::createStringError (" no definition DIE found" );
2519
+ return llvm::createStringError (
2520
+ llvm::formatv (" failed to find function for {0}" , label));
2510
2521
2511
2522
if (sc_list.GetSize () > 1 )
2512
2523
return llvm::createStringError (
2513
- " found %d functions for %s but expected only 1" , sc_list. GetSize () ,
2514
- lookup_name. data ( ));
2524
+ llvm::formatv ( " found {0} functions for {1} but expected only 1" ,
2525
+ sc_list. GetSize (), label ));
2515
2526
2516
2527
return llvm::Error::success ();
2517
2528
}
0 commit comments