■ ■ ■ ■ ■ ■
src/PE/debug/CodeViewPDB.cpp
| skipped 14 lines |
15 | 15 | | */ |
16 | 16 | | #include "LIEF/PE/debug/CodeViewPDB.hpp" |
17 | 17 | | #include "LIEF/Visitor.hpp" |
| 18 | + | #include "LIEF/BinaryStream/SpanStream.hpp" |
18 | 19 | | |
19 | 20 | | #include "spdlog/fmt/fmt.h" |
20 | 21 | | #include "spdlog/fmt/ranges.h" |
| skipped 22 lines |
43 | 44 | | visitor.visit(*this); |
44 | 45 | | } |
45 | 46 | | |
| 47 | + | std::string CodeViewPDB::guid() const { |
| 48 | + | auto stream = SpanStream::from_array(signature_); |
| 49 | + | if (!stream) { |
| 50 | + | return ""; |
| 51 | + | } |
| 52 | + | stream->set_endian_swap(true); |
| 53 | + | return fmt::format("{:08x}-{:04x}-{:04x}-{:04x}-{:04x}{:08x}", |
| 54 | + | stream->read<uint32_t>().value_or(0), |
| 55 | + | stream->read<uint16_t>().value_or(0), |
| 56 | + | stream->read<uint16_t>().value_or(0), |
| 57 | + | stream->read_conv<uint16_t>().value_or(0), |
| 58 | + | stream->read_conv<uint16_t>().value_or(0), |
| 59 | + | stream->read_conv<uint32_t>().value_or(0) |
| 60 | + | ); |
| 61 | + | } |
| 62 | + | |
46 | 63 | | std::ostream& operator<<(std::ostream& os, const CodeViewPDB& entry) { |
47 | 64 | | os << static_cast<const CodeView&>(entry) << '\n' |
48 | 65 | | << fmt::format("[CV][PDB] age: {}\n", entry.age()) |
49 | 66 | | << fmt::format("[CV][PDB] signature: {}\n", entry.signature()) |
| 67 | + | << fmt::format("[CV][PDB] GUID: {}\n", entry.guid()) |
50 | 68 | | << fmt::format("[CV][PDB] filename: {}\n", entry.filename()) |
51 | 69 | | ; |
52 | 70 | | return os; |
| skipped 5 lines |