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