Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: base/debug/activity_tracker.h

Issue 2566983009: Support storing information about what modules are loaded in the process. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/activity_tracker.cc » ('j') | base/debug/activity_tracker.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/activity_tracker.h
diff --git a/base/debug/activity_tracker.h b/base/debug/activity_tracker.h
index 20d35473ddd15cb2981e2659824aef405f86aeb9..fa0143bafdd8388c1fdb031dd7319894d8dc5609 100644
--- a/base/debug/activity_tracker.h
+++ b/base/debug/activity_tracker.h
@@ -632,6 +632,7 @@ class BASE_EXPORT GlobalActivityTracker {
enum : uint32_t {
kTypeIdActivityTracker = 0x5D7381AF + 3, // SHA1(ActivityTracker) v3
kTypeIdUserDataRecord = 0x615EDDD7 + 2, // SHA1(UserDataRecord) v2
+ kTypeIdModulesRecord = 0x484E2E03 + 1, // SHA1(ModulesRecord) v1
kTypeIdGlobalLogMessage = 0x4CF434F9 + 1, // SHA1(GlobalLogMessage) v1
kTypeIdGlobalDataRecord = kTypeIdUserDataRecord + 1000,
@@ -639,6 +640,17 @@ class BASE_EXPORT GlobalActivityTracker {
kTypeIdUserDataRecordFree = ~kTypeIdUserDataRecord,
};
+ struct ModuleInfo {
+ bool is_loaded = false;
+ uintptr_t address = 0;
+ size_t size = 0;
+ std::string file;
+ std::string version;
+ std::string identifier;
+ std::string debug_file;
+ std::string debug_identifier;
+ };
+
// This is a thin wrapper around the thread-tracker's ScopedActivity that
// accesses the global tracker to provide some of the information, notably
// which thread-tracker to use. It is safe to create even if activity
@@ -742,6 +754,10 @@ class BASE_EXPORT GlobalActivityTracker {
// only store critical messages such as FATAL ones.
void RecordLogMessage(StringPiece message);
+ // Records a module load/unload event. This is safe to call multiple times
+ // even with the same information.
+ void RecordModuleInfo(const ModuleInfo& info);
+
// Accesses the global data record for storing arbitrary key/value pairs.
ActivityUserData& user_data() { return user_data_; }
@@ -818,6 +834,10 @@ class BASE_EXPORT GlobalActivityTracker {
// be written from the main UI thread.
ActivityUserData user_data_;
+ // A map of global module information, keyed by module path.
+ std::map<const std::string, PersistentMemoryAllocator::Reference> modules_;
manzagop (departed) 2016/12/14 20:08:54 I believe it's possible to have the same module lo
bcwhite 2016/12/14 21:59:05 That would be annoying. How about we wait to see
manzagop (departed) 2016/12/16 16:09:31 Totally. :( IIRC Siggi said this is to be expected
bcwhite 2016/12/16 18:35:15 Done. If it comes to it, I'll probably support mu
+ base::Lock modules_lock_;
+
// The active global activity tracker.
static GlobalActivityTracker* g_tracker_;
« no previous file with comments | « no previous file | base/debug/activity_tracker.cc » ('j') | base/debug/activity_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698