mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-03-01 10:47:06 +00:00
Don't print an error when a user-set max frames limit has been reached in the stackwalker
Patch by Julian Seward <jseward@acm.org>, R=ted at https://bugzilla.mozilla.org/show_bug.cgi?id=859745 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1150 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
1974aaba51
commit
91c9518af2
|
@ -88,7 +88,10 @@ class Stackwalker {
|
|||
const CodeModules* modules,
|
||||
StackFrameSymbolizer* resolver_helper);
|
||||
|
||||
static void set_max_frames(uint32_t max_frames) { max_frames_ = max_frames; }
|
||||
static void set_max_frames(uint32_t max_frames) {
|
||||
max_frames_ = max_frames;
|
||||
max_frames_set_ = true;
|
||||
}
|
||||
static uint32_t max_frames() { return max_frames_; }
|
||||
|
||||
protected:
|
||||
|
@ -196,6 +199,11 @@ class Stackwalker {
|
|||
// The maximum number of frames Stackwalker will walk through.
|
||||
// This defaults to 1024 to prevent infinite loops.
|
||||
static uint32_t max_frames_;
|
||||
|
||||
// Keep track of whether max_frames_ has been set by the user, since
|
||||
// it affects whether or not an error message is printed in the case
|
||||
// where an unwind got stopped by the limit.
|
||||
static bool max_frames_set_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace google_breakpad {
|
|||
|
||||
const int Stackwalker::kRASearchWords = 30;
|
||||
uint32_t Stackwalker::max_frames_ = 1024;
|
||||
bool Stackwalker::max_frames_set_ = false;
|
||||
|
||||
Stackwalker::Stackwalker(const SystemInfo* system_info,
|
||||
MemoryRegion* memory,
|
||||
|
@ -126,7 +127,10 @@ bool Stackwalker::Walk(CallStack* stack,
|
|||
// over the frame, because the stack now owns it.
|
||||
stack->frames_.push_back(frame.release());
|
||||
if (stack->frames_.size() > max_frames_) {
|
||||
BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
|
||||
// Only emit an error message in the case where the limit
|
||||
// reached is the default limit, not set by the user.
|
||||
if (!max_frames_set_)
|
||||
BPLOG(ERROR) << "The stack is over " << max_frames_ << " frames.";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue