//===-- LVReader.cpp ------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This implements the LVReader class. // //===----------------------------------------------------------------------===// #include "llvm/DebugInfo/LogicalView/Core/LVReader.h" #include "llvm/DebugInfo/LogicalView/Core/LVLine.h" #include "llvm/DebugInfo/LogicalView/Core/LVScope.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" #include <tuple> usingnamespacellvm; usingnamespacellvm::logicalview; #define DEBUG_TYPE … // Detect elements that are inserted more than once at different scopes, // causing a crash on the reader destruction, as the element is already // deleted from other scope. Helper for CodeView reader. bool checkIntegrityScopesTree(LVScope *Root) { … } //===----------------------------------------------------------------------===// // Class to represent a split context. //===----------------------------------------------------------------------===// Error LVSplitContext::createSplitFolder(StringRef Where) { … } std::error_code LVSplitContext::open(std::string ContextName, std::string Extension, raw_ostream &OS) { … } LVReader *CurrentReader = …; LVReader &LVReader::getInstance() { … } void LVReader::setInstance(LVReader *Reader) { … } Error LVReader::createSplitFolder() { … } // Get the filename for given object. StringRef LVReader::getFilename(LVObject *Object, size_t Index) const { … } // The Reader is the module that creates the logical view using the debug // information contained in the binary file specified in the command line. // This is the main entry point for the Reader and performs the following // steps: // - Process any patterns collected from the '--select' options. // - For each compile unit in the debug information: // * Create the logical elements (scopes, symbols, types, lines). // * Collect debug ranges and debug locations. // * Move the collected logical lines to their associated scopes. // - Once all the compile units have been processed, traverse the scopes // tree in order to: // * Calculate symbol coverage. // * Detect invalid ranges and locations. // * "resolve" the logical elements. During this pass, the names and // file information are updated, to reflect any dependency with other // logical elements. Error LVReader::doLoad() { … } // Default handler for a generic reader. Error LVReader::doPrint() { … } Error LVReader::printScopes() { … } Error LVReader::printMatchedElements(bool UseMatchedElements) { … } void LVReader::print(raw_ostream &OS) const { … }