MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ScanForFunctions

Method ScanForFunctions

pcsx2/DebugTools/SymbolImporter.cpp:618–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618void SymbolImporter::ScanForFunctions(
619 ccc::SymbolDatabase& database, const ccc::ElfSymbolFile& elf, const Pcsx2Config::DebugAnalysisOptions& options)
620{
621 MipsExpressionFunctions expression_functions(&r5900Debug, &database, true);
622
623 u32 start_address = 0;
624 u32 end_address = 0;
625 if (options.CustomFunctionScanRange)
626 {
627 u64 expression_result = 0;
628 std::string error;
629
630 if (!parseExpression(options.FunctionScanStartAddress.c_str(), &expression_functions, expression_result, error))
631 {
632 Console.Error("Failed to evaluate start address expression '%s' while scanning for functions: %s",
633 options.FunctionScanStartAddress.c_str(), error.c_str());
634 return;
635 }
636
637 start_address = static_cast<u32>(expression_result);
638
639 if (!parseExpression(options.FunctionScanEndAddress.c_str(), &expression_functions, expression_result, error))
640 {
641 Console.Error("Failed to evaluate end address expression '%s' while scanning for functions: %s",
642 options.FunctionScanEndAddress.c_str(), error.c_str());
643 return;
644 }
645
646 end_address = static_cast<u32>(expression_result);
647 }
648 else
649 {
650 const ccc::ElfProgramHeader* entry_segment = elf.elf().entry_point_segment();
651 if (!entry_segment)
652 return;
653
654 start_address = entry_segment->vaddr;
655 end_address = entry_segment->vaddr + entry_segment->filesz;
656 }
657
658 switch (options.FunctionScanMode)
659 {
660 case DebugFunctionScanMode::SCAN_ELF:
661 {
662 ElfMemoryReader reader(elf.elf());
663 MIPSAnalyst::ScanForFunctions(database, reader, start_address, end_address, options.GenerateFunctionHashes);
664 break;
665 }
666 case DebugFunctionScanMode::SCAN_MEMORY:
667 {
668 MIPSAnalyst::ScanForFunctions(database, r5900Debug, start_address, end_address, options.GenerateFunctionHashes);
669 break;
670 }
671 case DebugFunctionScanMode::SKIP:
672 {
673 break;
674 }
675 }

Callers

nothing calls this directly

Calls 5

parseExpressionFunction · 0.85
ScanForFunctionsFunction · 0.85
entry_point_segmentMethod · 0.80
c_strMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected