Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / features / feature_util.h
blobb8d04fe84b2eef678b3176519b9c2739eb05c7d3
1 // Copyright 2013 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 #ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_UTIL_H_
6 #define EXTENSIONS_COMMON_FEATURES_FEATURE_UTIL_H_
8 #include "base/debug/alias.h"
9 #include "base/logging.h"
10 #include "base/strings/string_util.h"
12 // Writes |message| to the stack so that it shows up in the minidump, then
13 // crashes the current process.
15 // The prefix "e::" is used so that the crash can be quickly located.
17 // This is provided in feature_util because for some reason features are prone
18 // to mysterious crashes in named map lookups. For example see crbug.com/365192
19 // and crbug.com/461915.
20 #define CRASH_WITH_MINIDUMP(message) \
21 { \
22 std::string message_copy(message); \
23 char minidump[BUFSIZ]; \
24 base::debug::Alias(&minidump); \
25 base::snprintf(minidump, arraysize(minidump), "e::%s:%d:\"%s\"", __FILE__, \
26 __LINE__, message_copy.c_str()); \
27 LOG(FATAL) << message_copy; \
30 #endif // EXTENSIONS_COMMON_FEATURES_FEATURE_UTIL_H_