| 616 | } |
| 617 | |
| 618 | void 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 | } |
nothing calls this directly
no test coverage detected