OLD | NEW |
| (Empty) |
1 // -*- mode: C++ -*- | |
2 | |
3 // Copyright (c) 2010 Google Inc. | |
4 // All rights reserved. | |
5 // | |
6 // Redistribution and use in source and binary forms, with or without | |
7 // modification, are permitted provided that the following conditions are | |
8 // met: | |
9 // | |
10 // * Redistributions of source code must retain the above copyright | |
11 // notice, this list of conditions and the following disclaimer. | |
12 // * Redistributions in binary form must reproduce the above | |
13 // copyright notice, this list of conditions and the following disclaimer | |
14 // in the documentation and/or other materials provided with the | |
15 // distribution. | |
16 // * Neither the name of Google Inc. nor the names of its | |
17 // contributors may be used to endorse or promote products derived from | |
18 // this software without specific prior written permission. | |
19 // | |
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | |
32 // Abstract interface to return function/file/line info for a memory address. | |
33 | |
34 #ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__ | |
35 #define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__ | |
36 | |
37 #include <string> | |
38 #include "google_breakpad/common/breakpad_types.h" | |
39 | |
40 namespace google_breakpad { | |
41 | |
42 using std::string; | |
43 | |
44 struct StackFrame; | |
45 struct WindowsFrameInfo; | |
46 struct CFIFrameInfo; | |
47 | |
48 class SourceLineResolverInterface { | |
49 public: | |
50 typedef u_int64_t MemAddr; | |
51 | |
52 virtual ~SourceLineResolverInterface() {} | |
53 | |
54 // Adds a module to this resolver, returning true on success. | |
55 // | |
56 // module_name may be an arbitrary string. Typically, it will be the | |
57 // filename of the module, optionally with version identifiers. | |
58 // | |
59 // map_file should contain line/address mappings for this module. | |
60 virtual bool LoadModule(const string &module_name, | |
61 const string &map_file) = 0; | |
62 // Same as above, but takes the contents of a pre-read map buffer | |
63 virtual bool LoadModuleUsingMapBuffer(const string &module_name, | |
64 const string &map_buffer) = 0; | |
65 | |
66 // Returns true if a module with the given name has been loaded. | |
67 virtual bool HasModule(const string &module_name) const = 0; | |
68 | |
69 // Fills in the function_base, function_name, source_file_name, | |
70 // and source_line fields of the StackFrame. The instruction and | |
71 // module_name fields must already be filled in. | |
72 virtual void FillSourceLineInfo(StackFrame *frame) const = 0; | |
73 | |
74 // If Windows stack walking information is available covering | |
75 // FRAME's instruction address, return a WindowsFrameInfo structure | |
76 // describing it. If the information is not available, returns NULL. | |
77 // A NULL return value does not indicate an error. The caller takes | |
78 // ownership of any returned WindowsFrameInfo object. | |
79 virtual WindowsFrameInfo *FindWindowsFrameInfo(const StackFrame *frame) | |
80 const = 0; | |
81 | |
82 // If CFI stack walking information is available covering ADDRESS, | |
83 // return a CFIFrameInfo structure describing it. If the information | |
84 // is not available, return NULL. The caller takes ownership of any | |
85 // returned CFIFrameInfo object. | |
86 virtual CFIFrameInfo *FindCFIFrameInfo(const StackFrame *frame) const = 0; | |
87 | |
88 protected: | |
89 // SourceLineResolverInterface cannot be instantiated except by subclasses | |
90 SourceLineResolverInterface() {} | |
91 }; | |
92 | |
93 } // namespace google_breakpad | |
94 | |
95 #endif // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__ | |
OLD | NEW |