etw-stackwalk: track modules in tracing service [chromium/src : main]

0 views
Skip to first unread message

Sean Maher (Gerrit)

unread,
May 16, 2026, 9:19:21 PMMay 16
to Jesse McKenna, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Jesse McKenna

Sean Maher added 4 comments

File components/tracing/common/etw_consumer_win.h
Line 255, Patchset 1: // ⭐⭐⭐ TODO: filenames or full paths?
Sean Maher . unresolved

hmmm

File components/tracing/common/etw_consumer_win.cc
Line 443, Patchset 2 (Latest): static constexpr char kNoDebugId[] = "fffffffffffffffffffffffffffffff";
Sean Maher . unresolved

you should make it something cooler than _this_

Line 462, Patchset 2 (Latest): if (!interned_module.was_emitted) {
Sean Maher . unresolved

to avoid nesting you could do the same early return thing as in the place i commented 'naisu'

File components/tracing/common/etw_system_data_source_win.cc
Line 126, Patchset 2 (Latest): EVENT_TRACE_FLAG_IMAGE_LOAD; // ⭐⭐⭐ TODO: is this needed?
Sean Maher . unresolved

⭐⭐⭐

Open in Gerrit

Related details

Attention is currently required from:
  • Jesse McKenna
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If728bfa9997615112663a2ccb6f0caea1084cbb0
Gerrit-Change-Number: 7794349
Gerrit-PatchSet: 2
Gerrit-Owner: Jesse McKenna <jessem...@google.com>
Gerrit-CC: Sean Maher <sp...@chromium.org>
Gerrit-Attention: Jesse McKenna <jessem...@google.com>
Gerrit-Comment-Date: Sun, 17 May 2026 01:19:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Jesse McKenna (Gerrit)

unread,
Jul 24, 2026, 9:45:09 PM (12 days ago) Jul 24
to Etienne Pierre-Doray, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Etienne Pierre-Doray and Sean Maher

Jesse McKenna voted and added 5 comments

Votes added by Jesse McKenna

Commit-Queue+1

5 comments

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Jesse McKenna . resolved

Thank you for the comments! I've polished this up a lot and I think it's a lot more ready now. : )

File components/tracing/common/etw_consumer_win.h
Line 255, Patchset 1: // ⭐⭐⭐ TODO: filenames or full paths?
Sean Maher . resolved

hmmm

Jesse McKenna

The latest patchset uses full filenames to track the modules (in ActiveProcesses) in case the same DLL is loaded from multiple places (for some reason...?) and trims to just filename when uploading, since the full path leaks user info and I don't see a need for it. It seems like terasymbol just needs the debug ID. Feel free to comment back if any of that sounds wrong, though!

File components/tracing/common/etw_consumer_win.cc
Line 443, Patchset 2: static constexpr char kNoDebugId[] = "fffffffffffffffffffffffffffffff";
Sean Maher . resolved

you should make it something cooler than _this_

Jesse McKenna

Haha fair enough! I put it back to the dummy string from your draft. I was worried that it might not be clear to viewers if it's surfaced in the Perfetto UI, but the "cool code" string is probably well-known enough.

Line 462, Patchset 2: if (!interned_module.was_emitted) {
Sean Maher . resolved

to avoid nesting you could do the same early return thing as in the place i commented 'naisu'

Jesse McKenna

Good idea, I reduced nesting throughout this block and I think that does make it way easier to read.

File components/tracing/common/etw_system_data_source_win.cc
Line 126, Patchset 2: EVENT_TRACE_FLAG_IMAGE_LOAD; // ⭐⭐⭐ TODO: is this needed?
Sean Maher . resolved

⭐⭐⭐

Jesse McKenna

Done (removed) - it's just my "don't forget to fix this" placeholder : )

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Sean Maher
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: If728bfa9997615112663a2ccb6f0caea1084cbb0
    Gerrit-Change-Number: 7794349
    Gerrit-PatchSet: 7
    Gerrit-Owner: Jesse McKenna <jessem...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Jesse McKenna <jessem...@google.com>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Attention: Sean Maher <sp...@chromium.org>
    Gerrit-Comment-Date: Sat, 25 Jul 2026 01:44:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Sean Maher <sp...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Jul 28, 2026, 3:21:55 PM (9 days ago) Jul 28
    to Jesse McKenna, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Jesse McKenna and Sean Maher

    Etienne Pierre-Doray added 6 comments

    Patchset-level comments
    Etienne Pierre-Doray . resolved

    Cool dude!

    File components/tracing/common/active_processes_win.h
    Line 196, Patchset 7 (Latest): absl::flat_hash_map<base::FilePath, std::string> known_debug_ids_;
    Etienne Pierre-Doray . unresolved

    TODO: fill known_debug_ids_ from browser?

    Line 150, Patchset 7 (Latest): absl::flat_hash_map<base::FilePath, Image> loaded_images;
    Etienne Pierre-Doray . unresolved

    Can we make this a (sorted) map based on base_address? This would allow binary search in GetImageForAddress.
    And still support lookup in RemoveLoadedImage.

    File components/tracing/common/etw_consumer_win.cc
    Line 438, Patchset 7 (Latest): if (!inclusion_policy_.ShouldRecordImageEvents(process_id)) {
    Etienne Pierre-Doray . unresolved

    This could probably just be ShouldRecordCallStacks().

    Line 558, Patchset 7 (Latest): InterningIndexEntry interned_frame = interned_frames_.LookupOrAdd(
    std::make_pair(relative_address, debug_id.value_or(kNoDebugId)));
    Etienne Pierre-Doray . unresolved

    I think we could keep interned_frames_ keyed on instruction_pointer, this would make hashing cheaper (and code slightly simpler); we don't actually emit interned value.
    Could this also collide (same debug id across different processes)?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jesse McKenna
    • Sean Maher
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: If728bfa9997615112663a2ccb6f0caea1084cbb0
      Gerrit-Change-Number: 7794349
      Gerrit-PatchSet: 7
      Gerrit-Owner: Jesse McKenna <jessem...@google.com>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Jesse McKenna <jessem...@google.com>
      Gerrit-CC: Sean Maher <sp...@chromium.org>
      Gerrit-Attention: Jesse McKenna <jessem...@google.com>
      Gerrit-Attention: Sean Maher <sp...@chromium.org>
      Gerrit-Comment-Date: Tue, 28 Jul 2026 19:21:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      Jul 28, 2026, 3:27:45 PM (9 days ago) Jul 28
      to Jesse McKenna, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Jesse McKenna and Sean Maher

      Etienne Pierre-Doray added 1 comment

      File components/tracing/common/etw_consumer_win.cc
      Line 434, Patchset 7 (Latest): auto process_id = *iterator.CopyObject<uint32_t>();
      Etienne Pierre-Doray . unresolved

      This will crash if packet is invalid?
      We should probably check kMinimumSize similar to other functions.

      Gerrit-Comment-Date: Tue, 28 Jul 2026 19:27:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      Jul 28, 2026, 4:08:10 PM (9 days ago) Jul 28
      to Jesse McKenna, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Jesse McKenna and Sean Maher

      Etienne Pierre-Doray added 1 comment

      File components/tracing/common/active_processes_win.h
      Line 61, Patchset 7 (Latest): uintptr_t base_address_ = 0;
      Etienne Pierre-Doray . unresolved

      This should be uint64_t for correctness (x86 target can trace a x64 target)

      Gerrit-Comment-Date: Tue, 28 Jul 2026 20:07:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jesse McKenna (Gerrit)

      unread,
      Jul 30, 2026, 7:25:21 PM (6 days ago) Jul 30
      to Etienne Pierre-Doray, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Etienne Pierre-Doray and Sean Maher

      Jesse McKenna added 8 comments

      Patchset-level comments
      File-level comment, Patchset 9 (Latest):
      Jesse McKenna . resolved

      Thank you for reviewing!

      File components/tracing/common/active_processes_win.h
      Line 196, Patchset 7: absl::flat_hash_map<base::FilePath, std::string> known_debug_ids_;
      Etienne Pierre-Doray . resolved

      TODO: fill known_debug_ids_ from browser?

      Jesse McKenna

      Done

      Line 150, Patchset 7: absl::flat_hash_map<base::FilePath, Image> loaded_images;
      Etienne Pierre-Doray . resolved

      Can we make this a (sorted) map based on base_address? This would allow binary search in GetImageForAddress.
      And still support lookup in RemoveLoadedImage.

      Jesse McKenna

      Done

      Line 61, Patchset 7: uintptr_t base_address_ = 0;
      Etienne Pierre-Doray . resolved

      This should be uint64_t for correctness (x86 target can trace a x64 target)

      Jesse McKenna

      Done

      File components/tracing/common/etw_consumer_win.cc
      Line 434, Patchset 7: auto process_id = *iterator.CopyObject<uint32_t>();
      Etienne Pierre-Doray . resolved

      This will crash if packet is invalid?
      We should probably check kMinimumSize similar to other functions.

      Jesse McKenna

      Oops, done - thanks!

      Line 438, Patchset 7: if (!inclusion_policy_.ShouldRecordImageEvents(process_id)) {
      Etienne Pierre-Doray . resolved

      This could probably just be ShouldRecordCallStacks().

      Jesse McKenna

      That makes sense, done

      Line 558, Patchset 7: InterningIndexEntry interned_frame = interned_frames_.LookupOrAdd(
      std::make_pair(relative_address, debug_id.value_or(kNoDebugId)));
      Etienne Pierre-Doray . unresolved

      I think we could keep interned_frames_ keyed on instruction_pointer, this would make hashing cheaper (and code slightly simpler); we don't actually emit interned value.
      Could this also collide (same debug id across different processes)?

      Jesse McKenna

      I'm open to this, but re: collision: I think the same [rel_pc, debug ID] could plausibly appear in more than one process, but I think that would also be true of a given instruction pointer. Also, if the same [rel_pc, debug ID] appeared in more than one process, the info associated with the frame would still be the same (rel_pc, debug ID, and module file path). On the other hand, if the same instruction pointer appeared in multiple processes, that info would also be different. That makes it seem like instruction pointer alone isn't suitable to identify a frame.

      Please feel free to let me know if I'm just misunderstanding. : )

      Line 594, Patchset 7: reinterpret_cast<const uint8_t*>(debug_id_str.data()),
      Etienne Pierre-Doray . resolved
      Jesse McKenna

      Done (not needed) - I was using the `set_str(data, length)` overload, but the `set_str(string)` one is shorter and doesn't require casting. Thanks for noticing this.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      • Sean Maher
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: If728bfa9997615112663a2ccb6f0caea1084cbb0
      Gerrit-Change-Number: 7794349
      Gerrit-PatchSet: 9
      Gerrit-Owner: Jesse McKenna <jessem...@google.com>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Jesse McKenna <jessem...@google.com>
      Gerrit-CC: Sean Maher <sp...@chromium.org>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Attention: Sean Maher <sp...@chromium.org>
      Gerrit-Comment-Date: Thu, 30 Jul 2026 23:25:09 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      Jul 31, 2026, 1:11:15 PM (6 days ago) Jul 31
      to Jesse McKenna, Chromium LUCI CQ, Sean Maher, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, droger+w...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Jesse McKenna and Sean Maher

      Etienne Pierre-Doray voted and added 5 comments

      Votes added by Etienne Pierre-Doray

      Code-Review+1

      5 comments

      Patchset-level comments
      File-level comment, Patchset 10 (Latest):
      Etienne Pierre-Doray . resolved

      LGTM

      File components/tracing/common/active_processes_win.cc
      Line 246, Patchset 10 (Latest): iter->second.loaded_images.insert(
      Etienne Pierre-Doray . unresolved

      To make this more robust against missing Unload, this could use insert_or_assign.

      File components/tracing/common/etw_consumer_win.cc
      Line 459, Patchset 10 (Latest): const auto file_name = *CopyWString(iterator);
      Etienne Pierre-Doray . unresolved

      If CopyWString can't find null character, it returns nullopt. It might be a good idea to guard this against invalid data:

      ```
      auto file_name = CopyWString(iterator);
      if (!file_name) {
      return; // Safety exit if not null-terminated or truncated
      }
      ```
      Line 558, Patchset 7: InterningIndexEntry interned_frame = interned_frames_.LookupOrAdd(
      std::make_pair(relative_address, debug_id.value_or(kNoDebugId)));
      Etienne Pierre-Doray . resolved

      I think we could keep interned_frames_ keyed on instruction_pointer, this would make hashing cheaper (and code slightly simpler); we don't actually emit interned value.
      Could this also collide (same debug id across different processes)?

      Jesse McKenna

      I'm open to this, but re: collision: I think the same [rel_pc, debug ID] could plausibly appear in more than one process, but I think that would also be true of a given instruction pointer. Also, if the same [rel_pc, debug ID] appeared in more than one process, the info associated with the frame would still be the same (rel_pc, debug ID, and module file path). On the other hand, if the same instruction pointer appeared in multiple processes, that info would also be different. That makes it seem like instruction pointer alone isn't suitable to identify a frame.

      Please feel free to let me know if I'm just misunderstanding. : )

      Etienne Pierre-Doray

      Ah makes sense, let's keep debug_id then.

      Line 586, Patchset 10 (Latest): InterningIndexEntry interned_module = interned_modules_.LookupOrAdd(
      std::make_pair(stack_process, module->base_address_));
      Etienne Pierre-Doray . unresolved

      I guess this could also be keyed by `debug_id`?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Jesse McKenna
      • Sean Maher
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: If728bfa9997615112663a2ccb6f0caea1084cbb0
      Gerrit-Change-Number: 7794349
      Gerrit-PatchSet: 10
      Gerrit-Owner: Jesse McKenna <jessem...@google.com>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Jesse McKenna <jessem...@google.com>
      Gerrit-CC: Sean Maher <sp...@chromium.org>
      Gerrit-Attention: Jesse McKenna <jessem...@google.com>
      Gerrit-Attention: Sean Maher <sp...@chromium.org>
      Gerrit-Comment-Date: Fri, 31 Jul 2026 17:11:04 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Jesse McKenna <jessem...@google.com>
      Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages