Coverage for /Syzygy/bard/events/heap_free_event.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%330.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    :  // Declares an event to represent a HeapFree function call.
  16    :  #ifndef SYZYGY_BARD_EVENTS_HEAP_FREE_EVENT_H_
  17    :  #define SYZYGY_BARD_EVENTS_HEAP_FREE_EVENT_H_
  18    :  
  19    :  #include <windows.h>
  20    :  #include <memory>
  21    :  
  22    :  #include "syzygy/bard/event.h"
  23    :  
  24    :  namespace bard {
  25    :  namespace events {
  26    :  
  27    :  // An event that wraps a call to HeapAlloc, to be played against a
  28    :  // HeapBackdrop.
  29    :  class HeapFreeEvent : public EventInterface {
  30    :   public:
  31    :    HeapFreeEvent(uint32_t stack_trace_id,
  32    :                  HANDLE trace_heap,
  33    :                  DWORD flags,
  34    :                  LPVOID trace_alloc,
  35    :                  BOOL trace_succeeded);
  36    :  
  37    :    // @name EventInterface implementation.
  38    :    // @{
  39  E :    EventType type() const override { return kHeapFreeEvent; }
  40    :    bool Play(void* backdrop) override;
  41    :    bool Equals(const EventInterface* rhs) const override;
  42    :    // @}
  43    :  
  44    :    // @name Serialization methods.
  45    :    // @{
  46    :    static bool Save(const EventInterface* const event,
  47    :                     core::OutArchive* out_archive);
  48    :    static std::unique_ptr<HeapFreeEvent> Load(core::InArchive* in_archive);
  49    :    // @}
  50    :  
  51    :    // @name Accessors.
  52    :    // @{
  53    :    uint32_t stack_trace_id() const { return stack_trace_id_; }
  54  E :    HANDLE trace_heap() const { return trace_heap_; }
  55    :    DWORD flags() const { return flags_; }
  56  E :    LPVOID trace_alloc() const { return trace_alloc_; }
  57    :    BOOL trace_succeeded() const { return trace_succeeded_; }
  58    :    // @}
  59    :  
  60    :   private:
  61    :    // The stack trace ID that will be used during playback.
  62    :    uint32_t stack_trace_id_;
  63    :  
  64    :    // Arguments to HeapFree.
  65    :    HANDLE trace_heap_;
  66    :    DWORD flags_;
  67    :    LPVOID trace_alloc_;
  68    :  
  69    :    // Recorded return value.
  70    :    BOOL trace_succeeded_;
  71    :  
  72    :    DISALLOW_COPY_AND_ASSIGN(HeapFreeEvent);
  73    :  };
  74    :  
  75    :  }  // namespace events
  76    :  }  // namespace bard
  77    :  
  78    :  #endif  // SYZYGY_BARD_EVENTS_HEAP_FREE_EVENT_H_

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