MCPcopy Create free account
hub / github.com/lief-project/LIEF / parse_code_view

Method parse_code_view

src/PE/Parser.cpp:755–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755std::unique_ptr<Debug>
756 Parser::parse_code_view(const details::pe_debug& debug_info, Section* sec,
757 span<uint8_t> payload)
758{
759 LIEF_DEBUG("Parsing Debug Code View (payload: {} bytes)", payload.size());
760 SpanStream stream(payload);
761
762 auto res_sig = stream.peek<uint32_t>();
763 if (!res_sig) {
764 return nullptr;
765 }
766
767 const auto signature = static_cast<CodeView::SIGNATURES>(*res_sig);
768 auto default_value = std::make_unique<CodeView>(debug_info, signature, sec);
769
770 switch (signature) {
771 case CodeView::SIGNATURES::PDB_70:
772 {
773 const auto pdb_s = stream.read<details::pe_pdb_70>();
774 if (!pdb_s) {
775 return default_value;
776 }
777
778 auto cv_pdb70 = std::make_unique<CodeViewPDB>(debug_info, *pdb_s, sec);
779 if (auto fname = stream.read_string()) {
780 cv_pdb70->filename(std::move(*fname));
781 }
782 return cv_pdb70;
783 }
784
785
786 case CodeView::SIGNATURES::PDB_20:
787 {
788 const auto pdb_s = stream.read<details::pe_pdb_20>();
789 if (!pdb_s) {
790 return default_value;
791 }
792
793 auto cv_pdb20 = std::make_unique<CodeViewPDB>(debug_info, *pdb_s, sec);
794 if (auto fname = stream.read_string()) {
795 cv_pdb20->filename(std::move(*fname));
796 }
797 return cv_pdb20;
798 }
799
800 default:
801 {
802 LIEF_INFO("CodeView signature '{}' is not implemented yet!",
803 to_string(signature));
804 }
805 }
806 return default_value;
807}
808
809std::unique_ptr<Debug>
810 Parser::parse_pogo(const details::pe_debug& debug_info, Section* sec,

Callers

nothing calls this directly

Calls 4

read_stringMethod · 0.80
to_stringFunction · 0.70
sizeMethod · 0.45
filenameMethod · 0.45

Tested by

no test coverage detected