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