Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / cld / base / crash.h
blobf5c256ade7f233f0884b001c2219b5dfd428385b
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Support for collecting useful information when crashing.
7 #ifndef BASE_CRASH_H_
8 #define BASE_CRASH_H_
10 namespace base {
12 struct CrashReason {
13 CrashReason() : filename(0), line_number(0), message(0), depth(0) {}
15 const char* filename;
16 int line_number;
17 const char* message;
19 // We'll also store a bit of stack trace context at the time of crash as
20 // it may not be available later on.
21 void* stack[32];
22 int depth;
24 // We'll try to store some trace information if it's available - this should
25 // reflect information from TraceContext::Thread()->tracer()->ToString().
26 // This field should probably not be set from within a signal handler or
27 // low-level code unless absolutely safe to do so.
28 char trace_info[512];
31 // Stores "reason" as an explanation for why the process is about to
32 // crash. The reason and its contents must remain live for the life
33 // of the process. Only the first reason is kept.
34 void SetCrashReason(const CrashReason* reason);
36 // Returns first reason passed to SetCrashReason(), or NULL.
37 const CrashReason* GetCrashReason();
39 } // namespace base
41 #endif // BASE_CRASH_H_