toolkit/crashreporter/google-breakpad/src/processor/basic_code_module.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/google-breakpad/src/processor/basic_code_module.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +// Copyright (c) 2006, Google Inc.
     1.5 +// All rights reserved.
     1.6 +//
     1.7 +// Redistribution and use in source and binary forms, with or without
     1.8 +// modification, are permitted provided that the following conditions are
     1.9 +// met:
    1.10 +//
    1.11 +//     * Redistributions of source code must retain the above copyright
    1.12 +// notice, this list of conditions and the following disclaimer.
    1.13 +//     * Redistributions in binary form must reproduce the above
    1.14 +// copyright notice, this list of conditions and the following disclaimer
    1.15 +// in the documentation and/or other materials provided with the
    1.16 +// distribution.
    1.17 +//     * Neither the name of Google Inc. nor the names of its
    1.18 +// contributors may be used to endorse or promote products derived from
    1.19 +// this software without specific prior written permission.
    1.20 +//
    1.21 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.22 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.23 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.24 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.25 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.26 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.27 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.28 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.29 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.30 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.31 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.32 +
    1.33 +// basic_code_module.h: Carries information about code modules that are loaded
    1.34 +// into a process.
    1.35 +//
    1.36 +// This is a basic concrete implementation of CodeModule.  It cannot be
    1.37 +// instantiated directly, only based on other objects that implement
    1.38 +// the CodeModule interface.  It exists to provide a CodeModule implementation
    1.39 +// a place to store information when the life of the original object (such as
    1.40 +// a MinidumpModule) cannot be guaranteed.
    1.41 +//
    1.42 +// Author: Mark Mentovai
    1.43 +
    1.44 +#ifndef PROCESSOR_BASIC_CODE_MODULE_H__
    1.45 +#define PROCESSOR_BASIC_CODE_MODULE_H__
    1.46 +
    1.47 +#include <string>
    1.48 +
    1.49 +#include "common/using_std_string.h"
    1.50 +#include "google_breakpad/processor/code_module.h"
    1.51 +
    1.52 +namespace google_breakpad {
    1.53 +
    1.54 +class BasicCodeModule : public CodeModule {
    1.55 + public:
    1.56 +  // Creates a new BasicCodeModule given any existing CodeModule
    1.57 +  // implementation.  This is useful to make a copy of the data relevant to
    1.58 +  // the CodeModule interface without requiring all of the resources that
    1.59 +  // other CodeModule implementations may require.
    1.60 +  explicit BasicCodeModule(const CodeModule *that)
    1.61 +      : base_address_(that->base_address()),
    1.62 +        size_(that->size()),
    1.63 +        code_file_(that->code_file()),
    1.64 +        code_identifier_(that->code_identifier()),
    1.65 +        debug_file_(that->debug_file()),
    1.66 +        debug_identifier_(that->debug_identifier()),
    1.67 +        version_(that->version()) {}
    1.68 +
    1.69 +  BasicCodeModule(uint64_t base_address, uint64_t size,
    1.70 +		  const string &code_file,
    1.71 +		  const string &code_identifier,
    1.72 +		  const string &debug_file,
    1.73 +		  const string &debug_identifier,
    1.74 +		  const string &version)
    1.75 +    : base_address_(base_address),
    1.76 +      size_(size),
    1.77 +      code_file_(code_file),
    1.78 +      code_identifier_(code_identifier),
    1.79 +      debug_file_(debug_file),
    1.80 +      debug_identifier_(debug_identifier),
    1.81 +      version_(version)
    1.82 +    {}
    1.83 +  virtual ~BasicCodeModule() {}
    1.84 +
    1.85 +  // See code_module.h for descriptions of these methods and the associated
    1.86 +  // members.
    1.87 +  virtual uint64_t base_address() const { return base_address_; }
    1.88 +  virtual uint64_t size() const { return size_; }
    1.89 +  virtual string code_file() const { return code_file_; }
    1.90 +  virtual string code_identifier() const { return code_identifier_; }
    1.91 +  virtual string debug_file() const { return debug_file_; }
    1.92 +  virtual string debug_identifier() const { return debug_identifier_; }
    1.93 +  virtual string version() const { return version_; }
    1.94 +  virtual const CodeModule* Copy() const { return new BasicCodeModule(this); }
    1.95 +
    1.96 + private:
    1.97 +  uint64_t base_address_;
    1.98 +  uint64_t size_;
    1.99 +  string code_file_;
   1.100 +  string code_identifier_;
   1.101 +  string debug_file_;
   1.102 +  string debug_identifier_;
   1.103 +  string version_;
   1.104 +
   1.105 +  // Disallow copy constructor and assignment operator.
   1.106 +  BasicCodeModule(const BasicCodeModule &that);
   1.107 +  void operator=(const BasicCodeModule &that);
   1.108 +};
   1.109 +
   1.110 +}  // namespace google_breakpad
   1.111 +
   1.112 +#endif  // PROCESSOR_BASIC_CODE_MODULE_H__

mercurial