/ src / google_breakpad / processor / code_module.h
code_module.h
  1  // Copyright 2006 Google LLC
  2  //
  3  // Redistribution and use in source and binary forms, with or without
  4  // modification, are permitted provided that the following conditions are
  5  // met:
  6  //
  7  //     * Redistributions of source code must retain the above copyright
  8  // notice, this list of conditions and the following disclaimer.
  9  //     * Redistributions in binary form must reproduce the above
 10  // copyright notice, this list of conditions and the following disclaimer
 11  // in the documentation and/or other materials provided with the
 12  // distribution.
 13  //     * Neither the name of Google LLC nor the names of its
 14  // contributors may be used to endorse or promote products derived from
 15  // this software without specific prior written permission.
 16  //
 17  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 21  // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 22  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 23  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 24  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 25  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28  
 29  // code_module.h: Carries information about code modules that are loaded
 30  // into a process.
 31  //
 32  // Author: Mark Mentovai
 33  
 34  #ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
 35  #define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
 36  
 37  #include <string>
 38  
 39  #include "common/using_std_string.h"
 40  #include "google_breakpad/common/breakpad_types.h"
 41  
 42  namespace google_breakpad {
 43  
 44  class CodeModule {
 45   public:
 46    virtual ~CodeModule() {}
 47  
 48    // The base address of this code module as it was loaded by the process.
 49    // (uint64_t)-1 on error.
 50    virtual uint64_t base_address() const = 0;
 51  
 52    // The size of the code module.  0 on error.
 53    virtual uint64_t size() const = 0;
 54  
 55    // The path or file name that the code module was loaded from.  Empty on
 56    // error.
 57    virtual string code_file() const = 0;
 58  
 59    // An identifying string used to discriminate between multiple versions and
 60    // builds of the same code module.  This may contain a uuid, timestamp,
 61    // version number, or any combination of this or other information, in an
 62    // implementation-defined format.  Empty on error.
 63    virtual string code_identifier() const = 0;
 64  
 65    // The filename containing debugging information associated with the code
 66    // module.  If debugging information is stored in a file separate from the
 67    // code module itself (as is the case when .pdb or .dSYM files are used),
 68    // this will be different from code_file.  If debugging information is
 69    // stored in the code module itself (possibly prior to stripping), this
 70    // will be the same as code_file.  Empty on error.
 71    virtual string debug_file() const = 0;
 72  
 73    // An identifying string similar to code_identifier, but identifies a
 74    // specific version and build of the associated debug file.  This may be
 75    // the same as code_identifier when the debug_file and code_file are
 76    // identical or when the same identifier is used to identify distinct
 77    // debug and code files.
 78    virtual string debug_identifier() const = 0;
 79  
 80    // A human-readable representation of the code module's version.  Empty on
 81    // error.
 82    virtual string version() const = 0;
 83  
 84    // Creates a new copy of this CodeModule object, which the caller takes
 85    // ownership of.  The new CodeModule may be of a different concrete class
 86    // than the CodeModule being copied, but will behave identically to the
 87    // copied CodeModule as far as the CodeModule interface is concerned.
 88    virtual CodeModule* Copy() const = 0;
 89  
 90    // Getter and setter for shrink_down_delta.  This is used when the address
 91    // range for a module is shrunk down due to address range conflicts with
 92    // other modules.  The base_address and size fields are not updated and they
 93    // should always reflect the original values (reported in the minidump).
 94    virtual uint64_t shrink_down_delta() const = 0;
 95    virtual void SetShrinkDownDelta(uint64_t shrink_down_delta) = 0;
 96  
 97    // Whether the module was unloaded from memory.
 98    virtual bool is_unloaded() const = 0;
 99  };
100  
101  }  // namespace google_breakpad
102  
103  #endif  // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__