OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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 // BasicSourceLineResolver implements SourceLineResolverInterface, using | |
31 // address map files produced by a compatible writer, e.g. PDBSourceLineWriter. | |
32 | |
33 #ifndef GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__ | |
34 #define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__ | |
35 | |
36 #include <map> | |
37 | |
38 #include "google_breakpad/processor/source_line_resolver_interface.h" | |
39 | |
40 namespace google_breakpad { | |
41 | |
42 using std::string; | |
43 using std::map; | |
44 | |
45 class BasicSourceLineResolver : public SourceLineResolverInterface { | |
46 public: | |
47 BasicSourceLineResolver(); | |
48 virtual ~BasicSourceLineResolver(); | |
49 | |
50 // SourceLineResolverInterface methods, see source_line_resolver_interface.h | |
51 // for more details. | |
52 | |
53 // Adds a module to this resolver, returning true on success. | |
54 // The given map_file is read into memory, and its symbols will be | |
55 // retained until the BasicSourceLineResolver is destroyed. | |
56 virtual bool LoadModule(const string &module_name, const string &map_file); | |
57 | |
58 // Exactly the same as above, except the given map_buffer is used | |
59 // for symbols. | |
60 virtual bool LoadModuleUsingMapBuffer(const string &module_name, | |
61 const string &map_buffer); | |
62 | |
63 virtual bool HasModule(const string &module_name) const; | |
64 virtual void FillSourceLineInfo(StackFrame *frame) const; | |
65 virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) const; | |
66 virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const; | |
67 | |
68 private: | |
69 template<class T> class MemAddrMap; | |
70 struct Line; | |
71 struct Function; | |
72 struct PublicSymbol; | |
73 struct File; | |
74 struct CompareString { | |
75 bool operator()(const string &s1, const string &s2) const; | |
76 }; | |
77 class Module; | |
78 | |
79 // All of the modules we've loaded | |
80 typedef map<string, Module*, CompareString> ModuleMap; | |
81 ModuleMap *modules_; | |
82 | |
83 // Disallow unwanted copy ctor and assignment operator | |
84 BasicSourceLineResolver(const BasicSourceLineResolver&); | |
85 void operator=(const BasicSourceLineResolver&); | |
86 }; | |
87 | |
88 } // namespace google_breakpad | |
89 | |
90 #endif // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__ | |
OLD | NEW |