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.
29 
30 #ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
31 #define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
32 
33 #include <string>
34 #include "google_breakpad/common/breakpad_types.h"
35 
36 namespace google_breakpad {
37 
38 class CodeModule;
39 
40 using std::string;
41 
42 struct StackFrame {
StackFrameStackFrame43   StackFrame()
44       : instruction(),
45         module(NULL),
46         function_name(),
47         function_base(),
48         source_file_name(),
49         source_line(),
50         source_line_base() {}
~StackFrameStackFrame51   virtual ~StackFrame() {}
52 
53   // The program counter location as an absolute virtual address.  For the
54   // innermost called frame in a stack, this will be an exact program counter
55   // or instruction pointer value.  For all other frames, this will be within
56   // the instruction that caused execution to branch to a called function,
57   // but may not necessarily point to the exact beginning of that instruction.
58   u_int64_t instruction;
59 
60   // The module in which the instruction resides.
61   const CodeModule *module;
62 
63   // The function name, may be omitted if debug symbols are not available.
64   string function_name;
65 
66   // The start address of the function, may be omitted if debug symbols
67   // are not available.
68   u_int64_t function_base;
69 
70   // The source file name, may be omitted if debug symbols are not available.
71   string source_file_name;
72 
73   // The (1-based) source line number, may be omitted if debug symbols are
74   // not available.
75   int source_line;
76 
77   // The start address of the source line, may be omitted if debug symbols
78   // are not available.
79   u_int64_t source_line_base;
80 };
81 
82 }  // namespace google_breakpad
83 
84 #endif  // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
85