Coverage for /Syzygy/refinery/process_state/process_state_util.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0021.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    :  #ifndef SYZYGY_REFINERY_PROCESS_STATE_PROCESS_STATE_UTIL_H_
  16    :  #define SYZYGY_REFINERY_PROCESS_STATE_PROCESS_STATE_UTIL_H_
  17    :  
  18    :  #include <string>
  19    :  
  20    :  #include "base/strings/string_piece.h"
  21    :  #include "syzygy/refinery/core/address.h"
  22    :  #include "syzygy/refinery/process_state/layer_data.h"
  23    :  #include "syzygy/refinery/process_state/process_state.h"
  24    :  #include "syzygy/refinery/process_state/refinery.pb.h"
  25    :  #include "syzygy/refinery/types/type.h"
  26    :  
  27  m :  namespace refinery {
  28    :  
  29    :  // A class for interacting with a ProcessState's module layer.
  30  m :  class ModuleLayerAccessor {
  31  m :   public:
  32  m :    explicit ModuleLayerAccessor(ProcessState* process_state);
  33    :  
  34    :    // Adds a module instance record to the process state. Also updates the module
  35    :    // layer's data if the instance is for a new module.
  36    :    // @note If the module is added to the layer's data, it is with a signature
  37    :    // that has a load address of 0, as we fold multiple module instances to a
  38    :    // single module identifier (and signature).
  39    :    // @param range the module instance's memory range.
  40    :    // @param checksum the module's checksum.
  41    :    // @param timestamp the module's timestamp.
  42    :    // @param path the module's path.
  43  m :    void AddModuleRecord(const AddressRange& range,
  44  m :                         const uint32_t checksum,
  45  m :                         const uint32_t timestamp,
  46  m :                         const std::wstring& path);
  47    :  
  48    :    // Retrieves the signature of the module instance containing @p va.
  49    :    // @note On success, the signature's base address is set to the module
  50    :    //     instance's actual load address.
  51    :    // @param va virtual address for which to get a module signature.
  52    :    // @param signature on success, the module signature.
  53    :    // @returns true on success, false on failure.
  54  m :    bool GetModuleSignature(const Address va, pe::PEFile::Signature* signature);
  55    :  
  56    :    // Retrieves the signature of module @p id.
  57    :    // @note On success, the returned signature's base address is 0.
  58    :    // @param id module identifier for which to get a module signature.
  59    :    // @param signature on success, the module signature.
  60    :    // @returns true on success, false on failure.
  61  m :    bool GetModuleSignature(const ModuleId id, pe::PEFile::Signature* signature);
  62    :  
  63    :    // Retrieves the module identifier corresponding to @p va.
  64    :    // @param virtual address for which to get a module identifier.
  65    :    // @returns the module identifier, or kNoModuleId if @p va does not correspond
  66    :    //     to a module.
  67  m :    ModuleId GetModuleId(const Address va);
  68    :  
  69    :    // Retrieves the module identifier corresponding to @p signature.
  70    :    // @param signature for which to get a module identifier.
  71    :    // @returns the module identifier, or kNoModuleId if @p signature does not
  72    :    //     correspond to a module known to the process state.
  73  m :    ModuleId GetModuleId(const pe::PEFile::Signature& signature);
  74    :  
  75  m :   private:
  76  m :    ProcessState* process_state_;  // Not owned, must outlive this class.
  77  m :  };
  78    :  
  79    :  // Adds a typed block record to @p process_state.
  80    :  // TODO(manzagop): avoid adding typed block duplicates. Longer term we may
  81    :  // introduce more complex handling (eg notions of certainty).
  82  m :  bool AddTypedBlockRecord(const AddressRange& range,
  83  m :                           base::StringPiece16 data_name,
  84  m :                           ModuleId module_id,
  85  m :                           TypeId type_id,
  86  m :                           ProcessState* process_state);
  87    :  
  88  m :  }  // namespace refinery
  89    :  
  90    :  #endif  // SYZYGY_REFINERY_PROCESS_STATE_PROCESS_STATE_UTIL_H_

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