Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/processor/stackwalker_amd64.h

Issue 1408973002: Issue in StackwalkerAMD64::GetCallerByFramePointerRecovery. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Combining IsEndOfStack and rbp checks Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/processor/stackwalker_amd64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 Google Inc. 1 // Copyright (c) 2010 Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual StackFrame* GetContextFrame(); 71 virtual StackFrame* GetContextFrame();
72 virtual StackFrame* GetCallerFrame(const CallStack* stack, 72 virtual StackFrame* GetCallerFrame(const CallStack* stack,
73 bool stack_scan_allowed); 73 bool stack_scan_allowed);
74 74
75 // Use cfi_frame_info (derived from STACK CFI records) to construct 75 // Use cfi_frame_info (derived from STACK CFI records) to construct
76 // the frame that called frames.back(). The caller takes ownership 76 // the frame that called frames.back(). The caller takes ownership
77 // of the returned frame. Return NULL on failure. 77 // of the returned frame. Return NULL on failure.
78 StackFrameAMD64* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames, 78 StackFrameAMD64* GetCallerByCFIFrameInfo(const vector<StackFrame*> &frames,
79 CFIFrameInfo* cfi_frame_info); 79 CFIFrameInfo* cfi_frame_info);
80 80
81 // Checks whether end-of-stack is reached. An instruction address of 0 is an
82 // end-of-stack marker. If the stack pointer of the caller is at a lower
83 // address than the stack pointer of the callee, then that's clearly incorrect
84 // and it is treated as end-of-stack to enforce progress and avoid infinite
85 // loops.
86 bool IsEndOfStack(uint64_t caller_rip, uint64_t caller_rsp,
87 uint64_t callee_rsp);
88
81 // Assumes a traditional frame layout where the frame pointer has not been 89 // Assumes a traditional frame layout where the frame pointer has not been
82 // omitted. The expectation is that caller's %rbp is pushed to the stack 90 // omitted. The expectation is that caller's %rbp is pushed to the stack
83 // after the return address of the callee, and that the callee's %rsp can 91 // after the return address of the callee, and that the callee's %rsp can
84 // be used to find the pushed %rbp. 92 // be used to find the pushed %rbp.
85 // Caller owns the returned frame object. Returns NULL on failure. 93 // Caller owns the returned frame object. Returns NULL on failure.
86 StackFrameAMD64* GetCallerByFramePointerRecovery( 94 StackFrameAMD64* GetCallerByFramePointerRecovery(
87 const vector<StackFrame*>& frames); 95 const vector<StackFrame*>& frames);
88 96
89 // Scan the stack for plausible return addresses. The caller takes ownership 97 // Scan the stack for plausible return addresses. The caller takes ownership
90 // of the returned frame. Return NULL on failure. 98 // of the returned frame. Return NULL on failure.
91 StackFrameAMD64* GetCallerByStackScan(const vector<StackFrame*> &frames); 99 StackFrameAMD64* GetCallerByStackScan(const vector<StackFrame*> &frames);
92 100
93 // Stores the CPU context corresponding to the innermost stack frame to 101 // Stores the CPU context corresponding to the innermost stack frame to
94 // be returned by GetContextFrame. 102 // be returned by GetContextFrame.
95 const MDRawContextAMD64* context_; 103 const MDRawContextAMD64* context_;
96 104
97 // Our register map, for cfi_walker_. 105 // Our register map, for cfi_walker_.
98 static const CFIWalker::RegisterSet cfi_register_map_[]; 106 static const CFIWalker::RegisterSet cfi_register_map_[];
99 107
100 // Our CFI frame walker. 108 // Our CFI frame walker.
101 const CFIWalker cfi_walker_; 109 const CFIWalker cfi_walker_;
102 }; 110 };
103 111
104 112
105 } // namespace google_breakpad 113 } // namespace google_breakpad
106 114
107 115
108 #endif // PROCESSOR_STACKWALKER_AMD64_H__ 116 #endif // PROCESSOR_STACKWALKER_AMD64_H__
OLDNEW
« no previous file with comments | « no previous file | src/processor/stackwalker_amd64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698