Commit 0e26bb04 authored by manzagop's avatar manzagop Committed by Commit bot

Record chrome module information

The intent is to store the chrome module's information as early as possible so it's always present in the stability debug data. For information about other modules, see https://chromiumcodereview.appspot.com/2566983009/

BUG=620813

Review-Url: https://codereview.chromium.org/2622863004
Cr-Commit-Position: refs/heads/master@{#442966}
parent 0c8f2729
......@@ -29,10 +29,16 @@
#include "media/media_features.h"
#if defined(OS_WIN)
#include "base/win/pe_image.h"
#include "chrome/install_static/install_util.h"
#include "components/browser_watcher/stability_data_names.h"
#endif
#if defined(OS_WIN)
// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
extern "C" IMAGE_DOS_HEADER __ImageBase;
#endif
namespace chrome {
namespace {
......@@ -109,11 +115,11 @@ void SetupStabilityDebugging() {
stability_file, kMemorySize, kAllocatorId,
browser_watcher::kStabilityDebuggingFeature.name, kStackDepth);
// Record basic information: product, version, channel, special build and
// platform.
// Record basic information.
base::debug::GlobalActivityTracker* global_tracker =
base::debug::GlobalActivityTracker::Get();
if (global_tracker) {
// Record product, version, channel, special build and platform.
wchar_t exe_file[MAX_PATH] = {};
CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file)));
......@@ -136,6 +142,18 @@ void SetupStabilityDebugging() {
#elif defined(ARCH_CPU_X86_64)
global_data.SetString(browser_watcher::kStabilityPlatform, "Win64");
#endif
// Record information about chrome's module.
global_data.SetUint(browser_watcher::kStabilityModuleAddress,
reinterpret_cast<uint64_t>(&__ImageBase));
base::win::PEImage pe(&__ImageBase);
PIMAGE_NT_HEADERS headers = pe.GetNTHeaders();
CHECK(headers);
global_data.SetUint(browser_watcher::kStabilityModuleTimestamp,
headers->FileHeader.TimeDateStamp);
global_data.SetUint(browser_watcher::kStabilityModuleSize,
headers->OptionalHeader.SizeOfImage);
}
}
#endif // defined(OS_WIN)
......
......@@ -8,6 +8,9 @@ namespace browser_watcher {
const char kStabilityChannel[] = "channel";
const char kStabilityExecutionPhase[] = "stability-execution-phase";
const char kStabilityModuleAddress[] = "module-address";
const char kStabilityModuleSize[] = "module-size";
const char kStabilityModuleTimestamp[] = "module-timestamp";
const char kStabilityPlatform[] = "platform";
const char kStabilityProduct[] = "product";
const char kStabilitySpecialBuild[] = "special-build";
......
......@@ -10,6 +10,9 @@ namespace browser_watcher {
// Alphabetical list of stability data names.
extern const char kStabilityChannel[];
extern const char kStabilityExecutionPhase[];
extern const char kStabilityModuleAddress[];
extern const char kStabilityModuleSize[];
extern const char kStabilityModuleTimestamp[];
extern const char kStabilityPlatform[];
extern const char kStabilityProduct[];
extern const char kStabilitySpecialBuild[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment