Coverage for /Syzygy/pdb/pdb_writer.h

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

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc.
   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_PDB_PDB_WRITER_H_
  16    :  #define SYZYGY_PDB_PDB_WRITER_H_
  17    :  
  18    :  #include <vector>
  19    :  
  20    :  #include "base/file_path.h"
  21    :  #include "base/file_util.h"
  22    :  #include "syzygy/pdb/pdb_file.h"
  23    :  #include "syzygy/pdb/pdb_stream.h"
  24    :  
  25  m :  namespace pdb {
  26    :  
  27    :  // This class is used to write a pdb file to disk given a list of PdbStreams.
  28    :  // It will create a header and directory inside the pdb file that describe
  29    :  // the page layout of the streams in the file.
  30  m :  class PdbWriter {
  31  m :   public:
  32  m :    PdbWriter();
  33  m :    ~PdbWriter();
  34    :  
  35    :    // Writes the given PdbFile to disk with the given file name.
  36    :    // @param pdb_path the path of the PDB file to write.
  37    :    // @param pdb_file the PDB file to be written.
  38    :    // @returns true on success, false otherwise.
  39  m :    bool Write(const FilePath& pdb_path, const PdbFile& pdb_file);
  40    :  
  41  m :   protected:
  42    :    // Info about a stream that's been written to the file.
  43  m :    struct StreamInfo {
  44  m :      uint32 offset;    // Byte offset into the file.
  45  m :      uint32 length;    // Length of the stream in bytes.
  46  m :    };
  47  m :    typedef std::vector<StreamInfo> StreamInfoList;
  48    :  
  49    :    // Write an unsigned 32 bit value to the output file.
  50  m :    bool WriteUint32(const char* func,
  51  m :                     const char* desc,
  52  m :                     uint32 value);
  53    :  
  54    :    // Pad the output file with zeros to the boundary of the current page.
  55  m :    bool PadToPageBoundary(const char* func,
  56  m :                           uint32 offset,
  57  m :                           uint32* padding);
  58    :  
  59    :    // Append the contents of the stream onto the file handle at the offset. The
  60    :    // contents of the file are padded to reach the next page boundary in the
  61    :    // output stream.
  62  m :    bool AppendStream(PdbStream* stream,
  63  m :                      uint32* bytes_written);
  64    :  
  65    :    // Write the directory to the file handle.
  66  m :    bool WriteDirectory(const StreamInfoList& stream_info_list,
  67  m :                        uint32* dir_size,
  68  m :                        uint32* bytes_written);
  69    :  
  70    :    // Write the directory pages which form the MSF directory.
  71  m :    bool WriteDirectoryPages(uint32 dir_size,
  72  m :                             uint32 dir_page,
  73  m :                             uint32* dir_pages_size,
  74  m :                             uint32* bytes_written);
  75    :  
  76    :    // Write the MSF/PDB file header once you know where the directory root
  77    :    // pages are and what the directory size and the total size of the file are.
  78  m :    bool WriteHeader(uint32 file_size,
  79  m :                     uint32 dir_size,
  80  m :                     uint32 dir_root_size,
  81  m :                     uint32 dir_root_page);
  82    :  
  83    :    // The current file handle open for writing.
  84  m :    file_util::ScopedFILE file_;
  85    :  
  86  m :   private:
  87  m :    DISALLOW_COPY_AND_ASSIGN(PdbWriter);
  88  m :  };
  89    :  
  90  m :  }  // namespace pdb
  91    :  
  92    :  #endif  // SYZYGY_PDB_PDB_WRITER_H_

Coverage information generated Thu Sep 06 11:30:46 2012.