Coverage for /Syzygy/pe/pe_utils_impl.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
84.6%11130.C++source

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // Template implementation of some PE/COFF utilities.
  16    :  
  17    :  #ifndef SYZYGY_PE_PE_UTILS_IMPL_H_
  18    :  #define SYZYGY_PE_PE_UTILS_IMPL_H_
  19    :  
  20    :  namespace pe {
  21    :  
  22    :  template <typename ImageFile>
  23    :  bool CopySectionInfoToBlockGraph(const ImageFile& image_file,
  24  E :                                   block_graph::BlockGraph* block_graph) {
  25    :    // Iterate through the image sections, and create sections in the BlockGraph.
  26  E :    size_t num_sections = image_file.file_header()->NumberOfSections;
  27  E :    for (size_t i = 0; i < num_sections; ++i) {
  28  E :      const IMAGE_SECTION_HEADER* header = image_file.section_header(i);
  29  E :      std::string name = ImageFile::GetSectionName(*header);
  30    :      block_graph::BlockGraph::Section* section = block_graph->AddSection(
  31  E :          name, header->Characteristics);
  32  E :      DCHECK(section != NULL);
  33    :  
  34    :      // For now, we expect them to have been created with the same IDs as those
  35    :      // in the original image.
  36  E :      if (section->id() != i) {
  37  i :        LOG(ERROR) << "Unexpected section ID.";
  38  i :        return false;
  39    :      }
  40  E :    }
  41    :  
  42  E :    return true;
  43  E :  }
  44    :  
  45    :  }  // namespace pe
  46    :  
  47    :  #endif  // SYZYGY_PE_PE_UTILS_IMPL_H_

Coverage information generated Thu Jan 14 17:40:38 2016.