Coverage for /Syzygy/refinery/analyzers/module_analyzer.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0030.C++source

Line-by-line coverage:

   1    :  // Copyright 2015 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    :  #include "syzygy/refinery/analyzers/module_analyzer.h"
  16    :  
  17    :  #include <dbghelp.h>
  18    :  
  19    :  #include <memory>
  20    :  #include <string>
  21    :  #include <vector>
  22    :  
  23    :  #include "base/strings/utf_string_conversions.h"
  24    :  #include "syzygy/refinery/process_state/process_state_util.h"
  25    :  #include "syzygy/refinery/process_state/refinery.pb.h"
  26    :  
  27  m :  namespace refinery {
  28    :  
  29    :  // static
  30  m :  const char ModuleAnalyzer::kModuleAnalyzerName[] = "ModuleAnalyzer";
  31    :  
  32  m :  Analyzer::AnalysisResult ModuleAnalyzer::Analyze(
  33  m :      const minidump::Minidump& minidump,
  34  m :      const ProcessAnalysis& process_analysis) {
  35  m :    DCHECK(process_analysis.process_state() != nullptr);
  36    :  
  37  m :    ModuleLayerAccessor layer_accessor(process_analysis.process_state());
  38    :  
  39  m :    minidump::Minidump::TypedModuleList modules = minidump.GetModuleList();
  40  m :    if (!modules.IsValid())
  41  m :        return ANALYSIS_ERROR;
  42    :  
  43  m :    for (const auto& module : modules) {
  44  m :      AddressRange range(module.BaseOfImage, module.SizeOfImage);
  45  m :      if (!range.IsValid())
  46  m :        return ANALYSIS_ERROR;
  47    :  
  48    :      // Determine module's name.
  49  m :      MINIDUMP_LOCATION_DESCRIPTOR name_location = {};
  50  m :      name_location.DataSize =
  51  m :          static_cast<ULONG32>(-1);  // Note: actual size is in the stream.
  52  m :      name_location.Rva = module.ModuleNameRva;
  53  m :      minidump::Minidump::Stream name_stream =
  54  m :          minidump.GetStreamFor(name_location);
  55  m :      DCHECK(name_stream.IsValid());
  56  m :      std::wstring module_name;
  57  m :      if (!name_stream.ReadAndAdvanceString(&module_name))
  58  m :        return ANALYSIS_ERROR;
  59    :  
  60    :      // TODO(manzagop): get version / debug info by also reading VersionInfo,
  61    :      // CvRecord and MiscRecord.
  62    :  
  63  m :      layer_accessor.AddModuleRecord(range, module.CheckSum, module.TimeDateStamp,
  64  m :                                     module_name);
  65  m :    }
  66    :  
  67  m :    return ANALYSIS_COMPLETE;
  68  m :  }
  69    :  
  70  m :  }  // namespace refinery

Coverage information generated Fri Jul 29 11:00:21 2016.