Replace FilePath declaration with file_path.h include
Fixes a clang error. Also use "base::FilePath" since FilePath has been moved to the base namespace. BUG=chromium-os:39046 TEST=The following command passes: USE="chrome_internal" CFLAGS="-clang -print-cmdline" CXXFLAGS="-clang -print-cmdline" emerge-x86-alex crash-reporter Change-Id: I7da82093c5685b5b556cba971b1e1b14ac0f59c4 Signed-off-by: Simon Que <sque@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43577 Reviewed-by: Ben Chan <benchan@chromium.org>
This commit is contained in:
parent
1a8780d309
commit
9f90acaa4d
16 changed files with 54 additions and 40 deletions
|
|
@ -54,6 +54,8 @@ static const uid_t kRootGroup = 0;
|
|||
// number of core files or minidumps reaches this number.
|
||||
const int CrashCollector::kMaxCrashDirectorySize = 32;
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
CrashCollector::CrashCollector()
|
||||
: forced_crash_directory_(NULL),
|
||||
lsb_release_(kLsbRelease),
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class CrashCollector {
|
|||
// Writes |data| of |size| to |filename|, which must be a new file.
|
||||
// If the file already exists or writing fails, return a negative value.
|
||||
// Otherwise returns the number of bytes written.
|
||||
int WriteNewFile(const FilePath &filename, const char *data, int size);
|
||||
int WriteNewFile(const base::FilePath &filename, const char *data, int size);
|
||||
|
||||
// Return a filename that has only [a-z0-1_] characters by mapping
|
||||
// all others into '_'.
|
||||
|
|
@ -72,7 +72,7 @@ class CrashCollector {
|
|||
forced_crash_directory_ = forced_directory;
|
||||
}
|
||||
|
||||
FilePath GetCrashDirectoryInfo(uid_t process_euid,
|
||||
base::FilePath GetCrashDirectoryInfo(uid_t process_euid,
|
||||
uid_t default_user_id,
|
||||
gid_t default_user_group,
|
||||
mode_t *mode,
|
||||
|
|
@ -88,7 +88,7 @@ class CrashCollector {
|
|||
// true whether or not directory needed to be created, false on any
|
||||
// failure. If the crash directory is at capacity, returns false.
|
||||
bool GetCreatedCrashDirectoryByEuid(uid_t euid,
|
||||
FilePath *crash_file_path,
|
||||
base::FilePath *crash_file_path,
|
||||
bool *out_of_capacity);
|
||||
|
||||
// Format crash name based on components.
|
||||
|
|
@ -98,28 +98,28 @@ class CrashCollector {
|
|||
|
||||
// Create a file path to a file in |crash_directory| with the given
|
||||
// |basename| and |extension|.
|
||||
FilePath GetCrashPath(const FilePath &crash_directory,
|
||||
const std::string &basename,
|
||||
const std::string &extension);
|
||||
base::FilePath GetCrashPath(const base::FilePath &crash_directory,
|
||||
const std::string &basename,
|
||||
const std::string &extension);
|
||||
|
||||
// Check given crash directory still has remaining capacity for another
|
||||
// crash.
|
||||
bool CheckHasCapacity(const FilePath &crash_directory);
|
||||
bool CheckHasCapacity(const base::FilePath &crash_directory);
|
||||
|
||||
// Checks if the line starts with '#' after optional whitespace.
|
||||
static bool IsCommentLine(const std::string &line);
|
||||
|
||||
// Read the given file of form [<key><separator><value>\n...] and return
|
||||
// a map of its contents.
|
||||
bool ReadKeyValueFile(const FilePath &file,
|
||||
bool ReadKeyValueFile(const base::FilePath &file,
|
||||
char separator,
|
||||
std::map<std::string, std::string> *dictionary);
|
||||
|
||||
// Write a log applicable to |exec_name| to |output_file| based on the
|
||||
// log configuration file at |config_path|.
|
||||
bool GetLogContents(const FilePath &config_path,
|
||||
bool GetLogContents(const base::FilePath &config_path,
|
||||
const std::string &exec_name,
|
||||
const FilePath &output_file);
|
||||
const base::FilePath &output_file);
|
||||
|
||||
// Add non-standard meta data to the crash metadata file. Call
|
||||
// before calling WriteCrashMetaData. Key must not contain "=" or
|
||||
|
|
@ -127,7 +127,7 @@ class CrashCollector {
|
|||
void AddCrashMetaData(const std::string &key, const std::string &value);
|
||||
|
||||
// Write a file of metadata about crash.
|
||||
void WriteCrashMetaData(const FilePath &meta_path,
|
||||
void WriteCrashMetaData(const base::FilePath &meta_path,
|
||||
const std::string &exec_name,
|
||||
const std::string &payload_path);
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ class CrashCollector {
|
|||
std::string extra_metadata_;
|
||||
const char *forced_crash_directory_;
|
||||
const char *lsb_release_;
|
||||
FilePath log_config_path_;
|
||||
base::FilePath log_config_path_;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_CRASH_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ static const char kBinCp[] = "/bin/cp";
|
|||
static const char kBinEcho[] = "/bin/echo";
|
||||
static const char kBinFalse[] = "/bin/false";
|
||||
|
||||
using base::FilePath;
|
||||
using chromeos::FindLog;
|
||||
|
||||
void CountCrash() {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ static const char kKernelCrashDetected[] = "/var/run/kernel-crash-detected";
|
|||
static const char kUncleanShutdownDetected[] =
|
||||
"/var/run/unclean-shutdown-detected";
|
||||
|
||||
|
||||
// Enumeration of kinds of crashes to be used in the CrashCounter histogram.
|
||||
enum CrashKinds {
|
||||
kCrashKindUncleanShutdown = 1,
|
||||
|
|
@ -53,6 +52,8 @@ enum CrashKinds {
|
|||
|
||||
static MetricsLibrary s_metrics_lib;
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
static bool IsFeedbackAllowed() {
|
||||
return s_metrics_lib.AreMetricsEnabled();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ static const char *s_pc_regex[] = {
|
|||
" RIP \\[<.*>\\] ([^\\+ ]+).*", // X86_64 uses RIP for the program counter
|
||||
};
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
COMPILE_ASSERT(arraysize(s_pc_regex) == KernelCollector::archCount,
|
||||
missing_arch_pc_regexp);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@
|
|||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
class FilePath;
|
||||
|
||||
// Kernel crash collector.
|
||||
class KernelCollector : public CrashCollector {
|
||||
public:
|
||||
|
|
@ -32,7 +30,7 @@ class KernelCollector : public CrashCollector {
|
|||
|
||||
virtual ~KernelCollector();
|
||||
|
||||
void OverridePreservedDumpPath(const FilePath &file_path);
|
||||
void OverridePreservedDumpPath(const base::FilePath &file_path);
|
||||
|
||||
// Enable collection.
|
||||
bool Enable();
|
||||
|
|
@ -66,7 +64,7 @@ class KernelCollector : public CrashCollector {
|
|||
bool LoadPreservedDump(std::string *contents);
|
||||
void StripSensitiveData(std::string *kernel_dump);
|
||||
|
||||
void GetRamoopsRecordPath(FilePath *path, size_t record);
|
||||
void GetRamoopsRecordPath(base::FilePath *path, size_t record);
|
||||
virtual bool LoadParameters();
|
||||
bool HasMoreRecords();
|
||||
|
||||
|
|
@ -98,7 +96,7 @@ class KernelCollector : public CrashCollector {
|
|||
enum ArchKind GetCompilerArch(void);
|
||||
|
||||
bool is_enabled_;
|
||||
FilePath ramoops_dump_path_;
|
||||
base::FilePath ramoops_dump_path_;
|
||||
size_t records_;
|
||||
|
||||
// The architecture of kernel dump strings we are working with.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ static bool s_metrics = false;
|
|||
static const char kTestKCrash[] = "test/kcrash";
|
||||
static const char kTestCrashDirectory[] = "test/crash_directory";
|
||||
|
||||
using base::FilePath;
|
||||
using chromeos::FindLog;
|
||||
using chromeos::GetLog;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ static const char kGzipPath[] = "/bin/gzip";
|
|||
static const char kUdevExecName[] = "udev";
|
||||
static const char kUdevSignatureKey[] = "sig";
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
UdevCollector::UdevCollector() {}
|
||||
|
||||
UdevCollector::~UdevCollector() {}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "base/file_path.h"
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
class FilePath;
|
||||
|
||||
// Udev crash collector.
|
||||
class UdevCollector : public CrashCollector {
|
||||
public:
|
||||
|
|
@ -30,7 +29,7 @@ class UdevCollector : public CrashCollector {
|
|||
|
||||
// Mutator for unit testing.
|
||||
void set_log_config_path(const std::string& path) {
|
||||
log_config_path_ = FilePath(path);
|
||||
log_config_path_ = base::FilePath(path);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
#include "crash-reporter/udev_collector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
namespace {
|
||||
|
||||
// Dummy log config file name.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ static const char kPowerdSuspended[] = "powerd_suspended";
|
|||
// Presence of this file indicates that the battery was critically low.
|
||||
static const char kPowerdLowBattery[] = "powerd_low_battery";
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
UncleanShutdownCollector::UncleanShutdownCollector()
|
||||
: unclean_shutdown_file_(kUncleanShutdownFile),
|
||||
powerd_trace_path_(kPowerdTracePath),
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ class UncleanShutdownCollector : public CrashCollector {
|
|||
bool DeadBatteryCausedUncleanShutdown();
|
||||
|
||||
const char *unclean_shutdown_file_;
|
||||
FilePath powerd_trace_path_;
|
||||
FilePath powerd_suspended_file_;
|
||||
FilePath powerd_low_battery_file_;
|
||||
base::FilePath powerd_trace_path_;
|
||||
base::FilePath powerd_suspended_file_;
|
||||
base::FilePath powerd_low_battery_file_;
|
||||
};
|
||||
|
||||
#endif // _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ static const char kTestLowBattery[] = "test/low_battery";
|
|||
static const char kTestSuspended[] = "test/suspended";
|
||||
static const char kTestUnclean[] = "test/unclean";
|
||||
|
||||
using base::FilePath;
|
||||
using ::chromeos::FindLog;
|
||||
|
||||
void CountCrash() {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ static const uid_t kUnknownUid = -1;
|
|||
const char *UserCollector::kUserId = "Uid:\t";
|
||||
const char *UserCollector::kGroupId = "Gid:\t";
|
||||
|
||||
using base::FilePath;
|
||||
|
||||
UserCollector::UserCollector()
|
||||
: generate_diagnostics_(false),
|
||||
core_pattern_file_(kCorePatternFile),
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/file_path.h"
|
||||
#include "crash-reporter/crash_collector.h"
|
||||
#include "gtest/gtest_prod.h" // for FRIEND_TEST
|
||||
|
||||
class FilePath;
|
||||
class SystemLogging;
|
||||
|
||||
// User crash collector.
|
||||
|
|
@ -101,9 +101,9 @@ class UserCollector : public CrashCollector {
|
|||
std::string GetPattern(bool enabled) const;
|
||||
bool SetUpInternal(bool enabled);
|
||||
|
||||
FilePath GetProcessPath(pid_t pid);
|
||||
bool GetSymlinkTarget(const FilePath &symlink,
|
||||
FilePath *target);
|
||||
base::FilePath GetProcessPath(pid_t pid);
|
||||
bool GetSymlinkTarget(const base::FilePath &symlink,
|
||||
base::FilePath *target);
|
||||
bool GetExecutableBaseNameFromPid(pid_t pid,
|
||||
std::string *base_name);
|
||||
// Returns, via |line|, the first line in |lines| that starts with |prefix|.
|
||||
|
|
@ -129,38 +129,38 @@ class UserCollector : public CrashCollector {
|
|||
void EnqueueCollectionErrorLog(pid_t pid, ErrorType error_type,
|
||||
const std::string &exec_name);
|
||||
|
||||
bool CopyOffProcFiles(pid_t pid, const FilePath &container_dir);
|
||||
bool CopyOffProcFiles(pid_t pid, const base::FilePath &container_dir);
|
||||
|
||||
// Validates the proc files at |container_dir| and returns true if they
|
||||
// are usable for the core-to-minidump conversion later. For instance, if
|
||||
// a process is reaped by the kernel before the copying of its proc files
|
||||
// takes place, some proc files like /proc/<pid>/maps may contain nothing
|
||||
// and thus become unusable.
|
||||
bool ValidateProcFiles(const FilePath &container_dir) const;
|
||||
bool ValidateProcFiles(const base::FilePath &container_dir) const;
|
||||
|
||||
// Validates the core file at |core_path| and returns kErrorNone if
|
||||
// the file contains the ELF magic bytes and an ELF class that matches the
|
||||
// platform (i.e. 32-bit ELF on a 32-bit platform or 64-bit ELF on a 64-bit
|
||||
// platform), which is due to the limitation in core2md. It returns an error
|
||||
// type otherwise.
|
||||
ErrorType ValidateCoreFile(const FilePath &core_path) const;
|
||||
ErrorType ValidateCoreFile(const base::FilePath &core_path) const;
|
||||
|
||||
// Determines the crash directory for given pid based on pid's owner,
|
||||
// and creates the directory if necessary with appropriate permissions.
|
||||
// Returns true whether or not directory needed to be created, false on
|
||||
// any failure.
|
||||
bool GetCreatedCrashDirectory(pid_t pid, uid_t supplied_ruid,
|
||||
FilePath *crash_file_path,
|
||||
base::FilePath *crash_file_path,
|
||||
bool *out_of_capacity);
|
||||
bool CopyStdinToCoreFile(const FilePath &core_path);
|
||||
bool RunCoreToMinidump(const FilePath &core_path,
|
||||
const FilePath &procfs_directory,
|
||||
const FilePath &minidump_path,
|
||||
const FilePath &temp_directory);
|
||||
bool CopyStdinToCoreFile(const base::FilePath &core_path);
|
||||
bool RunCoreToMinidump(const base::FilePath &core_path,
|
||||
const base::FilePath &procfs_directory,
|
||||
const base::FilePath &minidump_path,
|
||||
const base::FilePath &temp_directory);
|
||||
ErrorType ConvertCoreToMinidump(pid_t pid,
|
||||
const FilePath &container_dir,
|
||||
const FilePath &core_path,
|
||||
const FilePath &minidump_path);
|
||||
const base::FilePath &container_dir,
|
||||
const base::FilePath &core_path,
|
||||
const base::FilePath &minidump_path);
|
||||
ErrorType ConvertAndEnqueueCrash(pid_t pid, const std::string &exec_name,
|
||||
uid_t supplied_ruid, bool *out_of_capacity);
|
||||
bool ParseCrashAttributes(const std::string &crash_attributes,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ static bool s_metrics = false;
|
|||
|
||||
static const char kFilePath[] = "/my/path";
|
||||
|
||||
using base::FilePath;
|
||||
using chromeos::FindLog;
|
||||
|
||||
void CountCrash() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue