crash-reporter: Fix coding style and cpplint issues.
BUG=chromium:385849 TEST=`FEATURES=test emerge-$BOARD platform2` TEST=`cpplint.py --filter=--build/header_guard,-build/include_order *.h *.cc` Change-Id: I3c24dd9487df50cdb22fc1c7739c9e95e452afae Reviewed-on: https://chromium-review.googlesource.com/204487 Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Ben Chan <benchan@chromium.org>
This commit is contained in:
parent
f7181dfe7a
commit
7e77690375
24 changed files with 198 additions and 182 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <pcrecpp.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -13,10 +14,10 @@
|
|||
#include <base/logging.h>
|
||||
#include <base/strings/string_number_conversions.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include "chromeos/process.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/dbus/dbus.h"
|
||||
#include "chromeos/dbus/service_constants.h"
|
||||
#include <chromeos/dbus/dbus.h>
|
||||
#include <chromeos/dbus/service_constants.h>
|
||||
#include <chromeos/process.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
|
||||
const char kDefaultMinidumpName[] = "upload_file_minidump";
|
||||
const char kTarPath[] = "/bin/tar";
|
||||
|
|
@ -125,7 +126,8 @@ bool GetAdditionalLogs(const FilePath &log_path) {
|
|||
|
||||
return true;
|
||||
}
|
||||
} //namespace
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
ChromeCollector::ChromeCollector() : output_file_ptr_(stdout) {}
|
||||
|
|
@ -205,13 +207,13 @@ bool ChromeCollector::ParseCrashLog(const std::string &data,
|
|||
LOG(ERROR) << "Can't find : after name @ offset " << at;
|
||||
break;
|
||||
}
|
||||
at += name.size() + 1; // Skip the name & : delimiter.
|
||||
at += name.size() + 1; // Skip the name & : delimiter.
|
||||
|
||||
if (!GetDelimitedString(data, ':', at, &size_string)) {
|
||||
LOG(ERROR) << "Can't find : after size @ offset " << at;
|
||||
break;
|
||||
}
|
||||
at += size_string.size() + 1; // Skip the size & : delimiter.
|
||||
at += size_string.size() + 1; // Skip the size & : delimiter.
|
||||
|
||||
size_t size;
|
||||
if (!base::StringToSizeT(size_string, &size)) {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_CHROME_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_CHROME_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_CHROME_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_CHROME_COLLECTOR_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
class SystemLogging;
|
||||
|
||||
|
|
@ -49,4 +50,4 @@ class ChromeCollector : public CrashCollector {
|
|||
FILE *output_file_ptr_;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // CRASH_REPORTER_CHROME_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "crash-reporter/chrome_collector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include "crash-reporter/chrome_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <base/auto_reset.h>
|
||||
#include <base/file_util.h>
|
||||
#include <base/files/scoped_temp_dir.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,25 +10,26 @@
|
|||
#include <sys/types.h> // for mode_t.
|
||||
#include <sys/wait.h> // For waitpid.
|
||||
#include <unistd.h> // For execv and fork.
|
||||
#define __STDC_FORMAT_MACROS // PRId64
|
||||
#define __STDC_FORMAT_MACROS // PRId64
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chromeos/cryptohome.h"
|
||||
#include "chromeos/dbus/dbus.h"
|
||||
#include "chromeos/dbus/service_constants.h"
|
||||
#include "chromeos/process.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/posix/eintr_wrapper.h>
|
||||
#include <base/strings/string_split.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include <chromeos/cryptohome.h>
|
||||
#include <chromeos/dbus/dbus.h>
|
||||
#include <chromeos/dbus/service_constants.h>
|
||||
#include <chromeos/process.h>
|
||||
|
||||
static const char kCollectChromeFile[] =
|
||||
"/mnt/stateful_partition/etc/collect_chrome_crashes";
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
// User crash collector.
|
||||
class CrashCollector {
|
||||
|
|
@ -172,4 +172,4 @@ class CrashCollector {
|
|||
base::FilePath log_config_path_;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@
|
|||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using base::FilePath;
|
||||
using base::StringPrintf;
|
||||
|
|
@ -115,12 +116,12 @@ TEST_F(CrashCollectorTest, GetCrashDirectoryInfo) {
|
|||
EXPECT_EQ(kRootGid, directory_group);
|
||||
|
||||
// No need to destroy the hash as GetCrashDirectoryInfo() will do it for us.
|
||||
GHashTable *active_sessions = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
GHashTable *active_sessions = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
char kUser[] = "chicken@butt.com";
|
||||
char kHash[] = "hashcakes";
|
||||
g_hash_table_insert (active_sessions,
|
||||
static_cast<gpointer>(kUser),
|
||||
static_cast<gpointer>(kHash));
|
||||
g_hash_table_insert(active_sessions,
|
||||
static_cast<gpointer>(kUser),
|
||||
static_cast<gpointer>(kHash));
|
||||
EXPECT_CALL(collector_, GetActiveUserSessions())
|
||||
.WillOnce(Return(active_sessions));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
#define _CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
#ifndef CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
#define CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
class CrashCollectorMock : public CrashCollector {
|
||||
public:
|
||||
MOCK_METHOD0(GetActiveUserSessions, GHashTable *());
|
||||
MOCK_METHOD0(GetActiveUserSessions, GHashTable*());
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
#endif // CRASH_REPORTER_CRASH_COLLECTOR_TEST_H_
|
||||
|
|
|
|||
|
|
@ -3,27 +3,27 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include <fcntl.h> // for open
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <base/file_util.h>
|
||||
#include <base/command_line.h>
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/strings/string_split.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
#include <metrics/metrics_library.h>
|
||||
|
||||
#include "crash-reporter/chrome_collector.h"
|
||||
#include "crash-reporter/kernel_collector.h"
|
||||
#include "crash-reporter/kernel_warning_collector.h"
|
||||
#include "crash-reporter/udev_collector.h"
|
||||
#include "crash-reporter/unclean_shutdown_collector.h"
|
||||
#include "crash-reporter/user_collector.h"
|
||||
#include "gflags/gflags.h"
|
||||
#include "metrics/metrics_library.h"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
DEFINE_bool(init, false, "Initialize crash logging");
|
||||
|
|
@ -252,7 +252,7 @@ static void OpenStandardFileDescriptors() {
|
|||
// invalid fd.
|
||||
do {
|
||||
new_fd = open("/dev/null", 0);
|
||||
CHECK(new_fd >= 0) << "Unable to open /dev/null";
|
||||
CHECK_GE(new_fd, 0) << "Unable to open /dev/null";
|
||||
} while (new_fd >= 0 && new_fd <= 2);
|
||||
close(new_fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@
|
|||
|
||||
#include "crash-reporter/kernel_collector.h"
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include <map>
|
||||
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
|
||||
static const char kDefaultKernelStackSignature[] =
|
||||
"kernel-UnspecifiedStackSignature";
|
||||
|
|
@ -27,17 +29,17 @@ static const int kSignatureTimestampWindow = 2;
|
|||
// Kernel log timestamp regular expression.
|
||||
static const std::string kTimestampRegex("^<.*>\\[\\s*(\\d+\\.\\d+)\\]");
|
||||
|
||||
/*
|
||||
* These regular expressions enable to us capture the PC in a backtrace.
|
||||
* The backtrace is obtained through dmesg or the kernel's preserved/kcrashmem
|
||||
* feature.
|
||||
*
|
||||
* For ARM we see:
|
||||
* "<5>[ 39.458982] PC is at write_breakme+0xd0/0x1b4"
|
||||
* For x86:
|
||||
* "<0>[ 37.474699] EIP: [<790ed488>] write_breakme+0x80/0x108 \
|
||||
* SS:ESP 0068:e9dd3efc
|
||||
*/
|
||||
//
|
||||
// These regular expressions enable to us capture the PC in a backtrace.
|
||||
// The backtrace is obtained through dmesg or the kernel's preserved/kcrashmem
|
||||
// feature.
|
||||
//
|
||||
// For ARM we see:
|
||||
// "<5>[ 39.458982] PC is at write_breakme+0xd0/0x1b4"
|
||||
// For x86:
|
||||
// "<0>[ 37.474699] EIP: [<790ed488>] write_breakme+0x80/0x108
|
||||
// SS:ESP 0068:e9dd3efc"
|
||||
//
|
||||
static const char *s_pc_regex[] = {
|
||||
0,
|
||||
" PC is at ([^\\+ ]+).*",
|
||||
|
|
@ -85,7 +87,7 @@ bool KernelCollector::ReadRecordToString(std::string *contents,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (record_re.FullMatch(record, &captured)){
|
||||
if (record_re.FullMatch(record, &captured)) {
|
||||
// Found a match, append it to the content, and remove from pstore.
|
||||
contents->append(captured);
|
||||
base::DeleteFile(ramoops_record, false);
|
||||
|
|
@ -231,8 +233,7 @@ bool KernelCollector::Enable() {
|
|||
s_pc_regex[arch_] == NULL) {
|
||||
LOG(WARNING) << "KernelCollector does not understand this architecture";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
FilePath ramoops_record;
|
||||
GetRamoopsRecordPath(&ramoops_record, 0);
|
||||
if (!base::PathExists(ramoops_record)) {
|
||||
|
|
@ -349,8 +350,7 @@ void KernelCollector::ProcessStackTrace(
|
|||
}
|
||||
}
|
||||
|
||||
enum KernelCollector::ArchKind KernelCollector::GetCompilerArch(void)
|
||||
{
|
||||
enum KernelCollector::ArchKind KernelCollector::GetCompilerArch(void) {
|
||||
#if defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY)
|
||||
return archArm;
|
||||
#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_64)
|
||||
|
|
@ -362,8 +362,7 @@ enum KernelCollector::ArchKind KernelCollector::GetCompilerArch(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void KernelCollector::SetArch(enum ArchKind arch)
|
||||
{
|
||||
void KernelCollector::SetArch(enum ArchKind arch) {
|
||||
arch_ = arch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
|
||||
#include <pcrecpp.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
// Kernel crash collector.
|
||||
class KernelCollector : public CrashCollector {
|
||||
|
|
@ -103,4 +104,4 @@ class KernelCollector : public CrashCollector {
|
|||
enum ArchKind arch_;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_KERNEL_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "crash-reporter/kernel_collector.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include "crash-reporter/kernel_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/files/scoped_temp_dir.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
static int s_crashes = 0;
|
||||
static bool s_metrics = false;
|
||||
|
|
@ -280,7 +281,6 @@ TEST_F(KernelCollectorTest, CollectOK) {
|
|||
std::string contents;
|
||||
ASSERT_TRUE(base::ReadFileToString(FilePath(filename), &contents));
|
||||
ASSERT_EQ("something", contents);
|
||||
|
||||
}
|
||||
|
||||
// Perform tests which are common across architectures
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "crash-reporter/kernel_warning_collector.h"
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/strings/string_number_conversions.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
|
||||
namespace {
|
||||
const char kExecName[] = "kernel-warning";
|
||||
|
|
@ -34,7 +34,7 @@ bool KernelWarningCollector::LoadKernelWarning(std::string *content,
|
|||
LOG(ERROR) << "Could not open " << kKernelWarningPath;
|
||||
return false;
|
||||
}
|
||||
/* The signature is in the first line. */
|
||||
// The signature is in the first line.
|
||||
std::string::size_type end_position = content->find('\n');
|
||||
if (end_position == std::string::npos) {
|
||||
LOG(ERROR) << "unexpected kernel warning format";
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
#include <string>
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
|
||||
|
|
@ -28,4 +29,4 @@ class KernelWarningCollector : public CrashCollector {
|
|||
bool LoadKernelWarning(std::string *content, std::string *signature);
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_KERNEL_WARNING_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -3,21 +3,20 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include <unistd.h> // for isatty()
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/string_tokenizer.h"
|
||||
#include "base/values.h"
|
||||
#include "chromeos/dbus/dbus.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include <base/command_line.h>
|
||||
#include <base/file_util.h>
|
||||
#include <base/strings/string_number_conversions.h>
|
||||
#include <base/strings/string_tokenizer.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/values.h>
|
||||
#include <chromeos/dbus/dbus.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
|
||||
const char kLibCrosProxyResolveSignalInterface[] =
|
||||
"org.chromium.CrashReporterLibcrosProxyResolvedInterface";
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@
|
|||
|
||||
#include "crash-reporter/udev_collector.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chromeos/process.h"
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <base/basictypes.h>
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/strings/string_split.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <chromeos/process.h>
|
||||
|
||||
static const char kCollectUdevSignature[] = "crash_reporter-udev-collection";
|
||||
static const char kGzipPath[] = "/bin/gzip";
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
// Udev crash collector.
|
||||
class UdevCollector : public CrashCollector {
|
||||
|
|
@ -22,7 +23,7 @@ class UdevCollector : public CrashCollector {
|
|||
// "ACTION=[action]:KERNEL=[name]:SUBSYSTEM=[subsystem]"
|
||||
// The values don't have to be in any particular order. One or more of them
|
||||
// could be omitted, in which case it would be treated as a wildcard (*).
|
||||
bool HandleCrash(const std::string &udev_event);
|
||||
bool HandleCrash(const std::string& udev_event);
|
||||
|
||||
private:
|
||||
friend class UdevCollectorTest;
|
||||
|
|
@ -33,4 +34,4 @@ class UdevCollector : public CrashCollector {
|
|||
}
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_UDEV_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/files/file_enumerator.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/files/file_enumerator.h>
|
||||
#include <base/files/scoped_temp_dir.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "crash-reporter/udev_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "crash-reporter/unclean_shutdown_collector.h"
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
|
||||
static const char kUncleanShutdownFile[] =
|
||||
"/var/lib/crash_reporter/pending_clean_shutdown";
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
// Unclean shutdown collector.
|
||||
class UncleanShutdownCollector : public CrashCollector {
|
||||
|
|
@ -43,4 +44,4 @@ class UncleanShutdownCollector : public CrashCollector {
|
|||
base::FilePath powerd_suspended_file_;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "crash-reporter/unclean_shutdown_collector.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include "crash-reporter/unclean_shutdown_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
static int s_crashes = 0;
|
||||
static bool s_metrics = true;
|
||||
|
|
|
|||
|
|
@ -12,19 +12,20 @@
|
|||
#include <pwd.h> // For struct passwd.
|
||||
#include <sys/types.h> // For getpwuid_r, getgrnam_r, WEXITSTATUS.
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chromeos/process.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "gflags/gflags.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/posix/eintr_wrapper.h>
|
||||
#include <base/stl_util.h>
|
||||
#include <base/strings/string_split.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include <chromeos/process.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
DEFINE_bool(core2md_failure, false, "Core2md failure test");
|
||||
|
|
@ -440,7 +441,7 @@ UserCollector::ErrorType UserCollector::ConvertAndEnqueueCrash(
|
|||
|
||||
// Directory like /tmp/crash_reporter/1234 which contains the
|
||||
// procfs entries and other temporary files used during conversion.
|
||||
FilePath container_dir(StringPrintf("/tmp/crash_reporter/%d", (int)pid));
|
||||
FilePath container_dir(StringPrintf("/tmp/crash_reporter/%d", pid));
|
||||
// Delete a pre-existing directory from crash reporter that may have
|
||||
// been left around for diagnostics from a failed conversion attempt.
|
||||
// If we don't, existing files can cause forking to fail.
|
||||
|
|
@ -495,19 +496,19 @@ bool UserCollector::ParseCrashAttributes(const std::string &crash_attributes,
|
|||
kernel_supplied_name);
|
||||
}
|
||||
|
||||
/* Returns true if the given executable name matches that of Chrome. This
|
||||
* includes checks for threads that Chrome has renamed. */
|
||||
// Returns true if the given executable name matches that of Chrome. This
|
||||
// includes checks for threads that Chrome has renamed.
|
||||
static bool IsChromeExecName(const std::string &exec) {
|
||||
static const char *kChromeNames[] = {
|
||||
"chrome",
|
||||
/* These are additional thread names seen in http://crash/ */
|
||||
// These are additional thread names seen in http://crash/
|
||||
"MediaPipeline",
|
||||
/* These come from the use of base::PlatformThread::SetName() directly */
|
||||
// These come from the use of base::PlatformThread::SetName() directly
|
||||
"CrBrowserMain", "CrRendererMain", "CrUtilityMain", "CrPPAPIMain",
|
||||
"CrPPAPIBrokerMain", "CrPluginMain", "CrWorkerMain", "CrGpuMain",
|
||||
"BrokerEvent", "CrVideoRenderer", "CrShutdownDetector",
|
||||
"UsbEventHandler", "CrNaClMain", "CrServiceMain",
|
||||
/* These thread names come from the use of base::Thread */
|
||||
// These thread names come from the use of base::Thread
|
||||
"Gamepad polling thread", "Chrome_InProcGpuThread",
|
||||
"Chrome_DragDropThread", "Renderer::FILE", "VC manager",
|
||||
"VideoCaptureModuleImpl", "JavaBridge", "VideoCaptureManagerThread",
|
||||
|
|
@ -536,29 +537,29 @@ static bool IsChromeExecName(const std::string &exec) {
|
|||
"ServiceProcess_IO", "ServiceProcess_File",
|
||||
"extension_crash_uploader", "gpu-process_crash_uploader",
|
||||
"plugin_crash_uploader", "renderer_crash_uploader",
|
||||
/* These come from the use of webkit_glue::WebThreadImpl */
|
||||
// These come from the use of webkit_glue::WebThreadImpl
|
||||
"Compositor", "Browser Compositor",
|
||||
// "WorkerPool/%d", // not easy to check because of "%d"
|
||||
/* These come from the use of base::Watchdog */
|
||||
// These come from the use of base::Watchdog
|
||||
"Startup watchdog thread Watchdog", "Shutdown watchdog thread Watchdog",
|
||||
/* These come from the use of AudioDeviceThread::Start */
|
||||
// These come from the use of AudioDeviceThread::Start
|
||||
"AudioDevice", "AudioInputDevice", "AudioOutputDevice",
|
||||
/* These come from the use of MessageLoopFactory::GetMessageLoop */
|
||||
// These come from the use of MessageLoopFactory::GetMessageLoop
|
||||
"GpuVideoDecoder", "RtcVideoDecoderThread", "PipelineThread",
|
||||
"AudioDecoderThread", "VideoDecoderThread",
|
||||
/* These come from the use of MessageLoopFactory::GetMessageLoopProxy */
|
||||
// These come from the use of MessageLoopFactory::GetMessageLoopProxy
|
||||
"CaptureVideoDecoderThread", "CaptureVideoDecoder",
|
||||
/* These come from the use of base::SimpleThread */
|
||||
// These come from the use of base::SimpleThread
|
||||
"LocalInputMonitor/%d", // "%d" gets lopped off for kernel-supplied
|
||||
/* These come from the use of base::DelegateSimpleThread */
|
||||
// These come from the use of base::DelegateSimpleThread
|
||||
"ipc_channel_nacl reader thread/%d", "plugin_audio_input_thread/%d",
|
||||
"plugin_audio_thread/%d",
|
||||
/* These come from the use of base::SequencedWorkerPool */
|
||||
// These come from the use of base::SequencedWorkerPool
|
||||
"BrowserBlockingWorker%d/%d", // "%d" gets lopped off for kernel-supplied
|
||||
};
|
||||
static std::set<std::string> chrome_names;
|
||||
|
||||
/* Initialize a set of chrome names, for efficient lookup */
|
||||
// Initialize a set of chrome names, for efficient lookup
|
||||
if (chrome_names.empty()) {
|
||||
for (size_t i = 0; i < arraysize(kChromeNames); i++) {
|
||||
std::string check_name(kChromeNames[i]);
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
#define _CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
#ifndef CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
#define CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include <base/files/file_path.h>
|
||||
#include <gtest/gtest_prod.h> // for FRIEND_TEST
|
||||
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
class SystemLogging;
|
||||
|
||||
|
|
@ -178,4 +179,4 @@ class UserCollector : public CrashCollector {
|
|||
static const char *kGroupId;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
#endif // CRASH_REPORTER_USER_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "crash-reporter/user_collector.h"
|
||||
|
||||
#include <bits/wordsize.h>
|
||||
#include <elf.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "chromeos/syslog_logging.h"
|
||||
#include "chromeos/test_helpers.h"
|
||||
#include "crash-reporter/user_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <base/file_util.h>
|
||||
#include <base/files/scoped_temp_dir.h>
|
||||
#include <base/strings/string_split.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <chromeos/test_helpers.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
static int s_crashes = 0;
|
||||
static bool s_metrics = false;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
int main(int ac, char **av) {
|
||||
int status = system("exec \"${SRC}\"/warn_collector_test.sh");
|
||||
return status < 0 ? EXIT_FAILURE : WEXITSTATUS(status);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue