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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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.
    30 // basic_code_module.h: Carries information about code modules that are loaded
    31 // into a process.
    32 //
    33 // This is a basic concrete implementation of CodeModule.  It cannot be
    34 // instantiated directly, only based on other objects that implement
    35 // the CodeModule interface.  It exists to provide a CodeModule implementation
    36 // a place to store information when the life of the original object (such as
    37 // a MinidumpModule) cannot be guaranteed.
    38 //
    39 // Author: Mark Mentovai
    41 #ifndef PROCESSOR_BASIC_CODE_MODULE_H__
    42 #define PROCESSOR_BASIC_CODE_MODULE_H__
    44 #include <string>
    46 #include "common/using_std_string.h"
    47 #include "google_breakpad/processor/code_module.h"
    49 namespace google_breakpad {
    51 class BasicCodeModule : public CodeModule {
    52  public:
    53   // Creates a new BasicCodeModule given any existing CodeModule
    54   // implementation.  This is useful to make a copy of the data relevant to
    55   // the CodeModule interface without requiring all of the resources that
    56   // other CodeModule implementations may require.
    57   explicit BasicCodeModule(const CodeModule *that)
    58       : base_address_(that->base_address()),
    59         size_(that->size()),
    60         code_file_(that->code_file()),
    61         code_identifier_(that->code_identifier()),
    62         debug_file_(that->debug_file()),
    63         debug_identifier_(that->debug_identifier()),
    64         version_(that->version()) {}
    66   BasicCodeModule(uint64_t base_address, uint64_t size,
    67 		  const string &code_file,
    68 		  const string &code_identifier,
    69 		  const string &debug_file,
    70 		  const string &debug_identifier,
    71 		  const string &version)
    72     : base_address_(base_address),
    73       size_(size),
    74       code_file_(code_file),
    75       code_identifier_(code_identifier),
    76       debug_file_(debug_file),
    77       debug_identifier_(debug_identifier),
    78       version_(version)
    79     {}
    80   virtual ~BasicCodeModule() {}
    82   // See code_module.h for descriptions of these methods and the associated
    83   // members.
    84   virtual uint64_t base_address() const { return base_address_; }
    85   virtual uint64_t size() const { return size_; }
    86   virtual string code_file() const { return code_file_; }
    87   virtual string code_identifier() const { return code_identifier_; }
    88   virtual string debug_file() const { return debug_file_; }
    89   virtual string debug_identifier() const { return debug_identifier_; }
    90   virtual string version() const { return version_; }
    91   virtual const CodeModule* Copy() const { return new BasicCodeModule(this); }
    93  private:
    94   uint64_t base_address_;
    95   uint64_t size_;
    96   string code_file_;
    97   string code_identifier_;
    98   string debug_file_;
    99   string debug_identifier_;
   100   string version_;
   102   // Disallow copy constructor and assignment operator.
   103   BasicCodeModule(const BasicCodeModule &that);
   104   void operator=(const BasicCodeModule &that);
   105 };
   107 }  // namespace google_breakpad
   109 #endif  // PROCESSOR_BASIC_CODE_MODULE_H__

mercurial