| 635 | } |
| 636 | |
| 637 | bool SymbolMappingLoader::LoadCondition(tinyxml2::XMLElement* ele, Pattern const& pattern, SymbolMappings::Condition& condition) |
| 638 | { |
| 639 | auto type = ele->Attribute("Type"); |
| 640 | if (strcmp(type, "String") == 0) { |
| 641 | condition.Type = SymbolMappings::MatchType::kString; |
| 642 | } else if (strcmp(type, "WString") == 0) { |
| 643 | condition.Type = SymbolMappings::MatchType::kWString; |
| 644 | } else if (strcmp(type, "FixedString") == 0) { |
| 645 | condition.Type = SymbolMappings::MatchType::kFixedString; |
| 646 | } else if (strcmp(type, "FixedStringIndirect") == 0) { |
| 647 | condition.Type = SymbolMappings::MatchType::kFixedStringIndirect; |
| 648 | } else { |
| 649 | ERR("Unsupported mapping condition type: %s", type); |
| 650 | return false; |
| 651 | } |
| 652 | |
| 653 | auto offset = GetOffsetAttribute(ele, pattern, "Offset"); |
| 654 | if (offset) { |
| 655 | condition.Offset = *offset; |
| 656 | } else { |
| 657 | return false; |
| 658 | } |
| 659 | |
| 660 | auto str = ele->Attribute("Value"); |
| 661 | if (!str) { |
| 662 | ERR("String value missing from condition"); |
| 663 | return false; |
| 664 | } |
| 665 | condition.String = str; |
| 666 | |
| 667 | if (condition.Type == SymbolMappings::MatchType::kWString) { |
| 668 | condition.WString = FromStdUTF8(str).c_str(); |
| 669 | } |
| 670 | |
| 671 | return true; |
| 672 | } |
| 673 | |
| 674 | |
| 675 | bool SymbolMapper::IsValidModulePtr(uint8_t const * ref) const |
nothing calls this directly
no test coverage detected