1
// Copyright (c) 2006, Google Inc.
2
// All rights reserved.
4
// Redistribution and use in source and binary forms, with or without
5
// modification, are permitted provided that the following conditions are
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
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.
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
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
31
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
34
#include "google_breakpad/common/breakpad_types.h"
36
namespace google_breakpad {
43
// Indicates how well the instruction pointer derived during
44
// stack walking is trusted. Since the stack walker can resort to
45
// stack scanning, it can wind up with dubious frames.
46
// In rough order of "trust metric".
48
FRAME_TRUST_NONE, // Unknown
49
FRAME_TRUST_SCAN, // Scanned the stack, found this
50
FRAME_TRUST_CFI_SCAN, // Scanned the stack using call frame info, found this
51
FRAME_TRUST_FP, // Derived from frame pointer
52
FRAME_TRUST_CFI, // Derived from call frame info
53
FRAME_TRUST_CONTEXT // Given as instruction pointer in a context
64
trust(FRAME_TRUST_NONE) {}
65
virtual ~StackFrame() {}
67
// Return a string describing how this stack frame was found
68
// by the stackwalker.
69
string trust_description() const {
71
case StackFrame::FRAME_TRUST_CONTEXT:
72
return "given as instruction pointer in context";
73
case StackFrame::FRAME_TRUST_CFI:
74
return "call frame info";
75
case StackFrame::FRAME_TRUST_CFI_SCAN:
76
return "call frame info with scanning";
77
case StackFrame::FRAME_TRUST_FP:
78
return "previous frame's frame pointer";
79
case StackFrame::FRAME_TRUST_SCAN:
80
return "stack scanning";
86
// The program counter location as an absolute virtual address. For the
87
// innermost called frame in a stack, this will be an exact program counter
88
// or instruction pointer value. For all other frames, this will be within
89
// the instruction that caused execution to branch to a called function,
90
// but may not necessarily point to the exact beginning of that instruction.
91
u_int64_t instruction;
93
// The module in which the instruction resides.
94
const CodeModule *module;
96
// The function name, may be omitted if debug symbols are not available.
99
// The start address of the function, may be omitted if debug symbols
100
// are not available.
101
u_int64_t function_base;
103
// The source file name, may be omitted if debug symbols are not available.
104
string source_file_name;
106
// The (1-based) source line number, may be omitted if debug symbols are
110
// The start address of the source line, may be omitted if debug symbols
111
// are not available.
112
u_int64_t source_line_base;
114
// Amount of trust the stack walker has in the instruction pointer
119
} // namespace google_breakpad
121
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__