[snapshot] Add support for thread names [crashpad/crashpad : main]

127 views
Skip to first unread message

Ben Hamilton (Gerrit)

unread,
May 27, 2022, 5:45:36 PM5/27/22
to Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen.

View Change

1 comment:

  • File snapshot/fuchsia/thread_snapshot_fuchsia.cc:

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 17
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Comment-Date: Fri, 27 May 2022 21:45:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Ben Hamilton (Gerrit)

unread,
Jun 3, 2022, 6:09:06 PM6/3/22
to Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen.

View Change

1 comment:

  • Patchset:

    • Patch Set #34:

      OK, I updated this CL with tests for all platforms (Linux, Windows, Fuchsia, macOS, and iOS) and made sure the tests all pass.

      PTAL!

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 34
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Jun 2022 22:08:59 +0000

Ben Hamilton (Gerrit)

unread,
Jun 6, 2022, 9:26:40 PM6/6/22
to Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen.

View Change

1 comment:

  • Patchset:

    • Patch Set #39:

      Tested this manually by running `generate_dump` on macOS, then running `minidump_dump` from Breakpad with https://crrev.com/c/3690389 applied.

      Confirmed the dump contained thread names as expected.

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 39
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Comment-Date: Tue, 07 Jun 2022 01:26:33 +0000

Ben Hamilton (Gerrit)

unread,
Jun 8, 2022, 3:26:38 PM6/8/22
to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

View Change

1 comment:

  • Patchset:

    • Patch Set #41:

      Adding mark@ since I had to touch each of the snapshot process_reader implementations.

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 41
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jun 2022 19:26:29 +0000

Joshua Peraza (Gerrit)

unread,
Jun 8, 2022, 4:42:40 PM6/8/22
to Ben Hamilton, Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, crashp...@chromium.org

Attention is currently required from: Ben Hamilton, Justin Cohen, Mark Mentovai.

View Change

3 comments:

  • File minidump/minidump_thread_name_list_writer.cc:

  • File snapshot/linux/process_reader_linux.h:

    • Patch Set #41, Line 64: std::string name;

      nit: These (and any other structs) are meant to be in tightly packable order and I generally assume heap-allocating types are some multiple of 64-bits, which would place this member before |tid|.

  • File test/fuchsia/thread_name.cc:

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 41
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Ben Hamilton <benha...@google.com>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jun 2022 20:42:32 +0000

Mark Mentovai (Gerrit)

unread,
Jun 8, 2022, 5:04:45 PM6/8/22
to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Ben Hamilton, Justin Cohen.

View Change

14 comments:

  • File snapshot/linux/process_reader_linux.cc:

  • File snapshot/mac/process_reader_mac.h:

  • File snapshot/mac/process_reader_mac.cc:

    • Patch Set #43, Line 79: name(),

      …thus here too.

    • Patch Set #43, Line 379: MAXTHREADNAMESIZE

      You want to write “size of the thing I’m holding”, not “some constant that hopefully is the size of the thing I’m holding”:

        sizeof(extended_info.pth_name)

      Same in the iOS implementation.

  • File snapshot/mac/thread_snapshot_mac.h:

  • File snapshot/mac/thread_snapshot_mac.cc:

  • File snapshot/win/process_reader_win.h:

  • File snapshot/win/process_reader_win.cc:

    • Patch Set #43, Line 288: name() {}

      also here.

    • Patch Set #43, Line 466:

          static const auto get_thread_description = []() {
      HINSTANCE kernel32 = GetModuleHandleW(L"Kernel32.dll");
      return reinterpret_cast<decltype(GetThreadDescription)*>(
      GetProcAddress(kernel32, "GetThreadDescription"));
      }();

      Don’t roll your own. Use our `GET_FUNCTION` macro from `util/win/get_function.h`. And spell `kernel32` with a lowercase `k` like we do everywhere else in Crashpad.

    • Patch Set #43, Line 472: PWSTR thread_description;

      Crashpad style is to use `WSTR*` instead of the more obtuse `PWSTR`.

    • Patch Set #43, Line 477: LocalFree(thread_description);

      Don’t do the C thing, you’re in C++. `#include "util/win/scoped_local_alloc.h"` and use `ScopedLocalAlloc`.

    • Patch Set #43, Line 478: }

      otherwise `LOG(WARNING)` as you’ve done on other platforms?

  • File test/BUILD.gn:

    • Patch Set #43, Line 65: "mac/thread_name.cc",

      Do you use any of these outside of the snapshot test?

      If no, they belong in the snapshot test, not in the generic test support library that’s visible to all (including non-snapshot) tests.

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 43
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Ben Hamilton <benha...@google.com>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jun 2022 21:04:37 +0000

Ben Hamilton (Gerrit)

unread,
Jun 8, 2022, 6:32:09 PM6/8/22
to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

View Change

17 comments:

  • File minidump/minidump_thread_name_list_writer.cc:

    • Hmm. Looks like there's no `ostream` `operator<<` for a map iterator:

      ```
      In file included from ../../third_party/mini_chromium/mini_chromium/base/logging.h:16:
      ../../third_party/mini_chromium/mini_chromium/base/check_op.h:15:23: error: invalid operands to binary expression ('basic_ostream<char>' and 'const std::__map_const_iterator<std::__tree_const_iterator<std::__value_type<unsigned long long, unsigned int>, std::__tree_node<std::__value_type<unsigned long long, unsigned int>, void *> *, long>>')
      ss << names << " (" << v1 << " vs. " << v2 << ")";
      ~~~~~~~~~~~~~~~~~~~ ^ ~~

      (snip)

      ../../minidump/minidump_thread_name_list_writer.cc:38:3: note: in instantiation of function template specialization 'logging::CheckNEImpl<std::__map_const_iterator<std::__tree_const_iterator<std::__value_type<unsigned long long, unsigned int>, std::__tree_node<std::__value_type<unsigned long long, unsigned int>, void *> *, long>>, std::__map_const_iterator<std::__tree_const_iterator<std::__value_type<unsigned long long, unsigned int>, std::__tree_node<std::__value_type<unsigned long long, unsigned int>, void *> *, long>>>' requested here
      DCHECK_NE(it, thread_id_map.end());
      ^
      ```

      I couldn't find any other examples of using `DCHECK_NE()` on a map iterator in Chromium or Crashpad, so I left this one as-is.

  • File snapshot/linux/process_reader_linux.h:

    • nit: These (and any other structs) are meant to be in tightly packable order and I generally assume […]

      Great point, I didn't know that. Fixed here and elsewhere.

  • File snapshot/linux/process_reader_linux.cc:

    • Oops, I used `snprintf()` in an earlier revision but replaced it with `base::StringPrintf()`. Fixed.

    • `name. […]

      Done

  • File snapshot/mac/process_reader_mac.h:

    • Done

  • File snapshot/mac/process_reader_mac.cc:

    • Done

    • You want to write “size of the thing I’m holding”, not “some constant that hopefully is the size of […]

      Done

  • File snapshot/mac/thread_snapshot_mac.h:

    • Done

  • File snapshot/mac/thread_snapshot_mac.cc:

    • Done

  • File snapshot/win/process_reader_win.h:

    • Done

  • File snapshot/win/process_reader_win.cc:

    • Done

    • Patch Set #43, Line 466:

          static const auto get_thread_description = []() {
      HINSTANCE kernel32 = GetModuleHandleW(L"Kernel32.dll");
      return reinterpret_cast<decltype(GetThreadDescription)*>(
      GetProcAddress(kernel32, "GetThreadDescription"));
      }();

    • Don’t roll your own. Use our `GET_FUNCTION` macro from `util/win/get_function.h`. […]

      Fixed here and above in call to get `InitializeContext2()`.

    • Done

    • Don’t do the C thing, you’re in C++. `#include "util/win/scoped_local_alloc. […]

      Done

    • Done

  • File test/BUILD.gn:

    • Done

To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Gerrit-Change-Number: 3671776
Gerrit-PatchSet: 43
Gerrit-Owner: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Attention: Justin Cohen <justi...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jun 2022 22:32:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Peraza <jpe...@chromium.org>
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Gerrit-MessageType: comment

Ben Hamilton (Gerrit)

unread,
Jun 8, 2022, 6:32:11 PM6/8/22
to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

Patch set 44:Code-Review +1

View Change

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 44
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Jun 2022 22:32:05 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 8, 2022, 6:32:35 PM6/8/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #44:

        Patch Set 44: Code-Review+1

        The vote Code-Review+1 is ignored as code-owner approval since the label doesn't allow self approval of the patch set uploader.

        Dang it, I hit it again! That button is not so useful and it's right next to CQ dry run..

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 44
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Jun 2022 22:32:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 8, 2022, 6:45:41 PM6/8/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 46:Code-Review +1Commit-Queue +1

    View Change

    1 comment:

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 46
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Jun 2022 22:45:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Ben Hamilton <benha...@google.com>

    Ben Hamilton (Gerrit)

    unread,
    Jun 8, 2022, 10:21:38 PM6/8/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 49:Code-Review +1

    View Change

    1 comment:

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 49
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 02:21:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 8, 2022, 11:33:17 PM6/8/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 50:Code-Review +1

    View Change

    1 comment:

    • Patchset:

      • Patch Set #50:

        I updated this CL to:

        1) Add tests for `MINIDUMP_THREAD_NAME`s containing strings with leading padding bytes
        2) Re-implement `MinidumpThreadNameListWriter` and `MinidumpThreadNameWriter` to go back to using `MinidumpWritable::RegisterRVA()` to register the RVA64, but use an (aligned) `RVA64` member variable of `MinidumpThreadNameWriter` instead of a (packed, unaligned) member variable of `MINIDUMP_THREAD_NAME`

        PTAL!

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 50
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 03:33:11 +0000

    Mark Mentovai (Gerrit)

    unread,
    Jun 9, 2022, 9:49:01 AM6/9/22
    to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    30 comments:

    • File client/ios_handler/in_process_intermediate_dump_handler.cc:

    • File minidump/minidump_thread_name_list_writer.cc:

      • Patch Set #50, Line 174: minidump_thread_names.resize(thread_names_.size());

        I think this would be cleaner if you used `.reserve` instead of `.resize` here, and then built up the vector by calling `.emplace_back` (or, if you have to, `.push_back`) in the loop body below. That way, the vector won’t ever have ambiguously bogus elements while you’re building it.

        As it is now, the 7 lines of loop body that you have are just enough of a reading assignment to have to prove that nothing is being mishandled because the vector will have bogus elements while being built.

      • Patch Set #50, Line 175: for (size_t i = 0; i < thread_names_.size(); ++i) {

        That would also let you iterate directly over thread_names_ (`for const auto& thread_name : thread_names_)`) since you would no longer need a loop variable (`i`). That’s nicer too.

      • Patch Set #50, Line 182: iovecs.emplace_back(iov);

        Since you already have a `WritableIoVec` object in your hands, why are you emplacing without move?

        (move wouldn’t be valid here either, unless `iov` was declared inside the loop body.)

    • File snapshot/linux/process_reader_linux.h:

    • File snapshot/linux/process_reader_linux.cc:

    • File snapshot/linux/thread_snapshot_linux.h:

    • File snapshot/win/process_reader_win.cc:

      •     static const auto get_thread_description = []() {
        HINSTANCE kernel32 = GetModuleHandleW(L"Kernel32.dll");
        return reinterpret_cast<decltype(GetThreadDescription)*>(
        GetProcAddress(kernel32, "GetThreadDescription"));
        }();

      • Fixed here and above in call to get `InitializeContext2()`.

        Thanks for catching that also.

      • Hmm, looks like there is no such type `WSTR` in Win32, only `PWSTR` and `LPWSTR`:

      • This is fine.

    • File snapshot/win/process_reader_win.cc:

      • Patch Set #50, Line 475: LOG(WARNING) << "GetThreadDescription failed: "

        Local style is just `”GetThreadDescription: “`. The message that follows will make clear that there was a failure.

    • File test/fuchsia/thread_name.cc:

    • File test/linux/thread_name.cc:

      • Patch Set #50, Line 28: // From TASK_COMM_LEN in <linux/sched.h>. Includes the trailing NUL byte.

        Why can’t you #include <linux/sched.h> and use `TASK_COMM_LEN`, then?

      • Patch Set #50, Line 31: }

        // namespace

      • Patch Set #50, Line 36: PCHECK(pthread_getname_np(pthread_self(), result.data(), result.length()) ==

        (Relatively) recent POSIX additions, including the pthreads family, don’t _set_ `errno` but instead _return_ an error number. `PCHECK` operates on `errno`. So what this really needs to do is:

          PCHECK((errno = pthread_getname_np(…)) == 0) << “pthread_getname_np”;

        Same deal on lines 52 and 57.

      • Patch Set #50, Line 40: PCHECK(result_nul_idx != std::string::npos)

        `PCHECK` is for when you want to carry information from `errno` to the message. This condition has nothing to do with `errno`, and `errno` will be indeterminate, resulting in a confusing message. You want a regular `CHECK`.

      • Patch Set #50, Line 49: CHECK_LT(new_thread_name.length(), kPthreadNameMaxLen)

        Doesn’t this need “base/check_op.h” now?

    • File test/mac/thread_name.cc:

      • Patch Set #50, Line 21: #include <mach/thread_info.h> // for MAXTHREADNAMESIZE

        We don’t need to know why you included it.

        This kind of comment becomes outdated even before it’s checked in, as you often wind up relying on that header for more things without even realizing.

      • Patch Set #50, Line 31: PCHECK(pthread_getname_np(pthread_self(), result.data(), result.length()) ==

        Same comments as in the Linux file apply here.

        In fact, this file seems to be entirely identical to the Linux file except for the maximum. Seems like you should just have a single scoped_set_thread_name_posix.cc and, if necessary, use an #ifdef to select the proper constant on a per-OS basis.

      • Patch Set #50, Line 45: static_cast<const unsigned long>(MAXTHREADNAMESIZE))

        size_t

      • Patch Set #50, Line 46: << "pthread_setname_np() only supports strings up to "

        This is really wordy. I don’t really think you need all of this. The CHECK_LT will already show the parameters that failed the comparison. You can have a little text if you want and you think it helps (although I wouldn’t have complained if there was no extra text at all), but you definitely don’t need to stream any parameters.

    • File test/thread_name.h:

      • Patch Set #50:

        Seems like all of these files should be named scoped_set_thread_name.{h,cc} (impact to #include guards too).

      • Patch Set #50, Line 24: std::string CurrentThreadName();

        Why do you need this exposed as a public interface? Why isn’t it a private implementation detail of the class?

        (You may have used it somewhere, but I’m not on a real computer and “find” actually isn’t working, so I can’t check easily. Seems that it isn’t necessary as a public interface, though.)

      • Patch Set #50, Line 27: class ScopedThreadNameOverride final {

        Probably just `ScopedSetThreadName`, seems clearer. You’re not really “overriding” anything, you’re just setting it during the lifetime of the object.

      • Patch Set #50, Line 29: ScopedThreadNameOverride(const std::string& new_thread_name);

        `explicit`

    • File test/win/thread_name.cc:

      • Patch Set #50, Line 26: PWSTR thread_description;

        `wchar_t*`

      • Patch Set #50, Line 28: CHECK(SUCCEEDED(hr)) << "GetThreadDescription failed: " << hr;

        Formatting per my other comment, also on lines 40 and 47.

      • Patch Set #50, Line 30: LocalFree(thread_description);

        Use the scoper.

      • Patch Set #50, Line 40: CHECK(SUCCEEDED(hr)) << "SetThreadDescription(" << new_thread_name

        Also, we don’t really need to see new_thread_name. Same with original_name_ on line 47.

      • Patch Set #50, Line 45: const std::wstring woriginal_name = base::UTF8ToWide(original_name_);

        Why didn’t you just save the original name as a wstring, instead of converting it to and from UTF-8?

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 50
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 13:48:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Ben Hamilton (Gerrit)

    unread,
    Jun 9, 2022, 1:15:19 PM6/9/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 50:Code-Review +1

    View Change

    28 comments:

    • File client/ios_handler/in_process_intermediate_dump_handler.cc:

      • Done

    • File minidump/minidump_thread_name_list_writer.cc:

      • I think this would be cleaner if you used `.reserve` instead of `. […]

        Good call, done.

      • That would also let you iterate directly over thread_names_ (`for const auto& thread_name : thread_n […]

        Done

      • Since you already have a `WritableIoVec` object in your hands, why are you emplacing without move? […]

        Fixed to directly `emplace_back()` in a proper fashion.

    • File snapshot/linux/process_reader_linux.h:

      • Done

    • File snapshot/linux/process_reader_linux.cc:

      • Looks like Linux added `/proc/$pid/comm` in Linux 2.6.33, released on 2010-02-24:

        https://man7.org/linux/man-pages/man5/proc.5.html

        /proc/[pid]/comm (since Linux 2.6.33)

        In addition, glibc added its `pthread_getname_np()` / `pthread_setname_np()` wrappers in glibc 2.12, released on 2011-02-01.

        I couldn't find Crashpad's system requirements anywhere, but I'm guessing 2010 is old enough to not have to worry about.

        Anyway, I changed this to warn and continue on rather than fail if it can't read the thread name.

    • File snapshot/linux/thread_snapshot_linux.h:

      • Done

    • File snapshot/win/process_reader_win.cc:

      • Local style is just `”GetThreadDescription: “`. […]

        Done

    • File test/fuchsia/thread_name.cc:

      • Done

      • Patch Set #50, Line 48: CHECK_EQ(status, ZX_OK) << "set_property(ZX_PROP_NAME)";

        This should be ZX_CHECK. Same on line 54.

      • Done

    • File test/linux/thread_name.cc:

      • Why can’t you #include <linux/sched. […]

        For some reason I thought nothing else `#include`d kernel headers here, but it looks like there are a few. Fixed.

      • Done

      • (Relatively) recent POSIX additions, including the pthreads family, don’t _set_ `errno` but instead […]

        Got it, fixed all of them.

      • `PCHECK` is for when you want to carry information from `errno` to the message. […]

        Whoops! Fixed, thanks.

      • Doesn’t this need “base/check_op. […]

        Sure enough, fixed.

    • File test/mac/thread_name.cc:

      • We don’t need to know why you included it. […]

        Merged this file into `thread_name_posix.cc`.

      • Same comments as in the Linux file apply here. […]

        Yep! There's one other difference (`pthread_setname_np()` takes 2 arguments on Linux and 1 arguments on Apple), but I was able to merge them into a `thread_name_posix.cc` file.

      • Merged into `scoped_set_thread_name_posix.cc`.

      • This is really wordy. I don’t really think you need all of this. […]

        Merged into `scoped_set_thread_name_posix.cc`.

    • File test/thread_name.h:

      • Patch Set #50:

        Seems like all of these files should be named scoped_set_thread_name. […]

        Done

      • Why do you need this exposed as a public interface? Why isn’t it a private implementation detail of […]

        Moved to a private implementation detail.

      • Probably just `ScopedSetThreadName`, seems clearer. […]

        Done

      • Done

    • File test/win/thread_name.cc:

      • Done

      • Patch Set #50, Line 28: CHECK(SUCCEEDED(hr)) << "GetThreadDescription failed: " << hr;

        Formatting per my other comment, also on lines 40 and 47.

      • Done

      • Done

      • Patch Set #50, Line 40: CHECK(SUCCEEDED(hr)) << "SetThreadDescription(" << new_thread_name

        Also, we don’t really need to see new_thread_name. Same with original_name_ on line 47.

      • Done

      • Patch Set #50, Line 45: const std::wstring woriginal_name = base::UTF8ToWide(original_name_);

        Why didn’t you just save the original name as a wstring, instead of converting it to and from UTF-8?

      • Sure, added an `#if BUILDFLAG(IS_WIN)` in the header to toggle the name to a wstring on Windows.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 50
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 17:15:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Mark Mentovai (Gerrit)

    unread,
    Jun 9, 2022, 2:05:43 PM6/9/22
    to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    18 comments:

    • File minidump/minidump_thread_name_list_writer.cc:

      • Patch Set #51, Line 169:

          iovecs.emplace_back(
        WritableIoVec{&thread_name_list_, sizeof(thread_name_list_)});

        This still isn’t what you want.

        `WritableIoVec{…}` instantiates an automatic `WritableIoVec` object. You then feed that to `emplace_back`, which forwards it to the constructor of another `WritableIoVec`. This loses all of the benefit of `emplace_back` over `push_back`.

        What you want to do is invoke `emplace_back` with the constructor arguments directly. That’s where `emplace_back` is the winner.

        It’s unlikely to make any difference for this `WritableIoVec` class because it’s so trivial and everything is visible to the compiler, but you should get into the habit of emplacing correctly.

        Please review the rest of this change (and any other recent changes, if appropriate) for your use of emplace and correct where needed.

    • File snapshot/linux/process_reader_linux.cc:

      • Patch Set #51, Line 83: PLOG(WARNING) << "ReadFileContents";

        ReadFileContents doesn’t promise to leave errno set to anything in particular, so you can’t use `PLOG`. But it does promise to log something for you if it fails, so you don’t actually need to do anything here.

        I just wanted to make sure that you weren’t going to return early if the file might not exist, if its existence was in question. No other error handling is really necessary.

    • File snapshot/linux/process_reader_linux_test.cc:

      • Patch Set #52, Line 75: // From TASK_COMM_LEN in <linux/sched.h>. Includes the trailing NUL byte.

        Use that constant here too, then.

    • File snapshot/linux/thread_snapshot_linux.h:

      • Patch Set #52, Line 84: std::string thread_name_;

        Not ordered properly here either.

        When reviewers provide comments like this, please ensure that the fix is applied uniformly across the entire change. Joshua mentioned the ordering once and I’ve already mentioned it twice before this comment.

    • File snapshot/mac/process_reader_mac_test.cc:

      • Patch Set #52, Line 491: char expected_thread_name[256];

        This 256 should be a constant shared by the two things that use it. But see below.

      • Patch Set #52, Line 536:

            char expected_thread_name[256];
        snprintf(expected_thread_name,
        sizeof(expected_thread_name),
        "%s",
        current_thread_name.c_str());

        `snprintf` won’t zero out the rest of the buffer, so you should start `expected_thread_name[]` out with a `= {}` initializer to avoid passing garbage around.

        But (and considering that the same concern appears again below): it would be preferable to not have to pass all of that padding around at all. Why don’t you pass this as a (size_t, bytes) pair? Then you could do the formatting here and below with base::StringPrintf.

        It’s two writes and reads instead of one, but it’s also less quirky than this recycled fixed-size buffer that’s more likely to trip up some future maintainer.

      • Patch Set #52, Line 556:

              snprintf(expected_thread_name,
        sizeof(expected_thread_name),
        "%s-%zu",
        thread_name_prefix_.c_str(),
        thread_index);

        You should have something to clean up the trailing garbage in the buffer here too.

    • File test/BUILD.gn:

      • Patch Set #52, Line 124: "fuchsia/scoped_set_thread_name.cc",

        Move this into the parent directory as scoped_set_thread_name_fuchsia.cc. That follows the pattern of the multiprocess_exec_fuchsia.cc file above.

        Do the same for the Windows implementation on line 111.

        The theory here is: for interfaces common to multiple platforms, where the implementations are in different files, put the files all in the same directory, and add a _platform tail to the filename. For interfaces that only make sense on a single platform, put everything into a platform-specific subdirectory.

        This follows general Chromium practice.

    • File test/fuchsia/scoped_set_thread_name.cc:

      • Patch Set #52, Line 33: ZX_CHECK(zx::thread::self()->get_property(

        This use of `ZX_CHECK` doesn’t look right to me. `ZX_CHECK` takes two parameters. Same on line 50.

    • File test/scoped_set_thread_name_posix.cc:

      • Patch Set #52, Line 17: #include <string>

        C++ system headers go after C system headers: swap this with `<pthread.h>`.

      • Patch Set #52, Line 26: #define CRASHPAD_THREAD_NAME_MAX_SIZE TASK_COMM_LEN

        We should avoid yet another macro (`CRASHPAD_THREAD_NAME_MAX_SIZE`) here, at the expense of having to repeat `#if BUILDFLAG` where you have `kPthreadNameMaxLen` below.

        Two reasons:

        1. macros.

        2. This section up here is for #includes. Readers will gloss over it because they don’t expect to find any interesting declarations up here.

      • Patch Set #52, Line 27:

        #else
        #define CRASHPAD_THREAD_NAME_MAX_SIZE 16

        What’s this `#ifdef` about? I thought we were trusting `<linux/sched.h>` to provide `TASK_COMM_LEN`.

      • Patch Set #52, Line 37:

        #include "base/check.h"
        #include "base/check_op.h"

        These belong in the same block as the build_config.h #include above.

      • Patch Set #52, Line 49:

          PCHECK(pthread_setname_np(pthread_self(), thread_name.c_str()) == 0)
        << "pthread_setname_np";
        #elif BUILDFLAG(IS_APPLE)
        PCHECK(pthread_setname_np(thread_name.c_str()) == 0) << "pthread_setname_np";

        Referring back to https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3671776/50/test/linux/thread_name.cc#b36, that comment was incompletely addressed. I wrote at the bottom:

      • Same deal on lines 52 and 57.

      • You wrote:

        Got it, fixed all of them.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 52
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 18:05:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 9, 2022, 3:34:43 PM6/9/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 55:Code-Review +1

    View Change

    18 comments:

    • File minidump/minidump_thread_name_list_writer.cc:

      • This still isn’t what you want. […]

        Sorry for the churn, I appreciate your patient explanation.

        Since there's no applicable constructor for `WritableIoVec`, I had previously used automatic instantiation, assuming the optimizer would do the right thing to construct the value in place.

        I see now that I can't avoid the copy, so I just rewrote it to use push_back(), since this isn't worth optimizing.

    • File snapshot/linux/process_reader_linux.cc:

      • ReadFileContents doesn’t promise to leave errno set to anything in particular, so you can’t use `PLO […]

        Ah, that makes sense. Removed the log here so we can rely on the one in `ReadFileContents` instead.

    • File snapshot/linux/process_reader_linux_test.cc:

      • Patch Set #52, Line 75: // From TASK_COMM_LEN in <linux/sched.h>. Includes the trailing NUL byte.

        Use that constant here too, then.

      • I removed this in favor of the strategy you mentioned in the Mac test of writing the thread name length and then the bytes of the thread name.

    • File snapshot/linux/thread_snapshot_linux.h:

      • Not ordered properly here either. […]

        Thanks for your patience. I synced up with jperaza@ who explained the requirement is to put strings after 64-bit values but before 32-bit values (like `pid_t` and `int`).

        This was definitely wrong in a number of places in this change (which I think I've fixed now, but do double-check my work.)

        For the case of this specific data structure, jperaza@ mentioned that the order seems correct here (`CPUContext`, `MemorySnapshotGeneric`, and `LinuxVMAddress` should all be 64-bit aligned, so it ought to be OK to put a `std::string` after them), but please let me know if I'm off base there.

    • File snapshot/mac/process_reader_mac_test.cc:

      • Patch Set #52, Line 491: char expected_thread_name[256];

        This 256 should be a constant shared by the two things that use it. But see below.

      • Fixed to write the size and then the bytes.

      • Patch Set #52, Line 536:

            char expected_thread_name[256];
        snprintf(expected_thread_name,
        sizeof(expected_thread_name),
        "%s",
        current_thread_name.c_str());

      • `snprintf` won’t zero out the rest of the buffer, so you should start `expected_thread_name[]` out w […]

        Thanks, that's a great idea. I fixed this to write the size and then the bytes afterwards.

      • Patch Set #52, Line 556:

              snprintf(expected_thread_name,
        sizeof(expected_thread_name),
        "%s-%zu",
        thread_name_prefix_.c_str(),
        thread_index);

        You should have something to clean up the trailing garbage in the buffer here too.

      • Removed in favor of `base::StringPrintf()`.

    • File test/BUILD.gn:

      • Move this into the parent directory as scoped_set_thread_name_fuchsia.cc. […]

        Makes sense, done.

    • File test/fuchsia/scoped_set_thread_name.cc:

      • Patch Set #52, Line 33: ZX_CHECK(zx::thread::self()->get_property(

        This use of `ZX_CHECK` doesn’t look right to me. `ZX_CHECK` takes two parameters. Same on line 50.

      • Yep, CI caught me here as well. Fixed each place to pass the boolean separately from the status.

    • File test/scoped_set_thread_name_posix.cc:

      • Patch Set #52, Line 17: #include <string>

        C++ system headers go after C system headers: swap this with `<pthread.h>`.

      • Done

      • We should avoid yet another macro (`CRASHPAD_THREAD_NAME_MAX_SIZE`) here, at the expense of having t […]

        Done

      • Patch Set #52, Line 27:

        #else
        #define CRASHPAD_THREAD_NAME_MAX_SIZE 16

        What’s this `#ifdef` about? I thought we were trusting `<linux/sched.h>` to provide `TASK_COMM_LEN`.

      • Patch Set #52, Line 37:

        #include "base/check.h"
        #include "base/check_op.h"

        These belong in the same block as the build_config.h #include above.

      • Done

      • Patch Set #52, Line 49:

          PCHECK(pthread_setname_np(pthread_self(), thread_name.c_str()) == 0)
        << "pthread_setname_np";
        #elif BUILDFLAG(IS_APPLE)
        PCHECK(pthread_setname_np(thread_name.c_str()) == 0) << "pthread_setname_np";

      • name `GetCurrentThreadName` for optimal contrast with the existing `SetCurrentThreadName` above. […]

        Done

      • Do in one step: […]

        Done here and in `process_reader_mac_test.cc` as well.

      • `#include <errno. […]

        Done

      • Patch Set #52, Line 75:

          CHECK_LT(new_thread_name.length(), kPthreadNameMaxLen)
        << "pthread_setname_np() only supports names up to "
        << kPthreadNameMaxLen - 1 << " bytes in length";

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 55
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 19:34:37 +0000

    Mark Mentovai (Gerrit)

    unread,
    Jun 9, 2022, 4:41:10 PM6/9/22
    to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    3 comments:

    • Patchset:

      • Patch Set #59:

        I didn't reread the code yet, am just responding to comments.

    • File minidump/minidump_thread_name_list_writer.cc:

      • Sorry for the churn, I appreciate your patient explanation. […]

        You will be able to achieve this with emplace_back in C++20, but I agree that it's not worth futzing with. As I said, since everything is visible to the compiler, it's likely to optimize away the unnecessary operations even when you've written push_back with a temporary.

    • File snapshot/linux/thread_snapshot_linux.h:

      • Thanks for your patience. I synced up with jperaza@ who explained the requirement is to put strings after 64-bit values but before 32-bit values (like `pid_t` and `int`).

      • This was definitely wrong in a number of places in this change (which I think I've fixed now, but do double-check my work.)

        For the case of this specific data structure, jperaza@ mentioned that the order seems correct here (`CPUContext`, `MemorySnapshotGeneric`, and `LinuxVMAddress` should all be 64-bit aligned, so it ought to be OK to put a `std::string` after them), but please let me know if I'm off base there.

      • I guess I'm in a 64-bit mindset now, and put pointer-aligned structs ahead of 64-bit integers.

        Joshua, have I advanced too far in my thinking? Are we putting things like std::string that are pointer-aligned in between the fixed 64- and 32-bit-aligned members because sometimes pointers are 64 and sometimes they're 32?

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 20:41:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ben Hamilton <benha...@google.com>

    Joshua Peraza (Gerrit)

    unread,
    Jun 9, 2022, 4:55:15 PM6/9/22
    to Ben Hamilton, Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Justin Cohen, Mark Mentovai.

    View Change

    1 comment:

    • File snapshot/linux/thread_snapshot_linux.h:

      • > Thanks for your patience. […]

        The possibility of things like std::string not being fully 64-bits wide has sometimes factored into my placing them between 64 and 32-bit things. We don't do this all the time though, sometimes placing them before 64-bit values and usually clumping them together when there are multiple.

        For Android, we're almost always using 32-bit pointers and I think other platforms were also using 32-bit pointers when a lot of this code was written.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 20:55:07 +0000

    Joshua Peraza (Gerrit)

    unread,
    Jun 9, 2022, 5:01:18 PM6/9/22
    to Ben Hamilton, Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Justin Cohen, Mark Mentovai.

    View Change

    1 comment:

    • File snapshot/linux/thread_snapshot_linux.h:

      • The possibility of things like std::string not being fully 64-bits wide has sometimes factored into […]

        Why place 64-bit pointer aligned structs before 64-bit values?

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 21:01:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joshua Peraza <jpe...@chromium.org>

    Mark Mentovai (Gerrit)

    unread,
    Jun 9, 2022, 5:39:58 PM6/9/22
    to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    1 comment:

    • File snapshot/linux/thread_snapshot_linux.h:

      • Why place 64-bit pointer aligned structs before 64-bit values?

        Doesn't make any difference for packing, but on the assumption that most structs (under a 64-bit pointer ABI) will be 64-bit-aligned, it helps with organization to put all the structs together, and then all the ints together.

        (I'd like it if, in cases where order is insignificant, there was enough leeway for the compiler to reorder things. Sometimes there's tension between declaration order for optimum packing and required construction/destruction order. This could help. Mostly unrelated musings, though.)

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jun 2022 21:39:49 +0000

    Ben Hamilton (Gerrit)

    unread,
    Jun 10, 2022, 10:59:22 AM6/10/22
    to Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 59:Code-Review +1

    View Change

    1 comment:

    • File snapshot/linux/thread_snapshot_linux.h:

      • > Why place 64-bit pointer aligned structs before 64-bit values? […]

        OK! I'll consider this one resolved for now — maybe we can automate some of these checks with ClangTidy or a similar static analyzer in the future.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Fri, 10 Jun 2022 14:59:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Mark Mentovai (Gerrit)

    unread,
    Jun 13, 2022, 1:37:14 PM6/13/22
    to Ben Hamilton, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    5 comments:

    • File minidump/minidump_thread_name_list_writer.cc:

      • Patch Set #59, Line 112: for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {

        We’ll probably see threads with empty names on some platforms. Do we want to exclude them from the thread name list? What do dbghelp-produced minidumps do here?

    • File test/scoped_set_thread_name_fuchsia.cc:

      • Patch Set #59, Line 47: CHECK_LT(new_thread_name.length(), ZX_MAX_NAME_LEN);

        Will `set_property` have its own failure if the name is too long?

        See the comment in the POSIX file for more on this thought.

    • File test/scoped_set_thread_name_posix.cc:

      • Patch Set #59, Line 50:

          PCHECK((errno = pthread_setname_np(thread_name.c_str())) == 0)
        << "pthread_setname_np";

        Turns out that on Apples, this behaves “traditionally”: on failure, it returns nonzero and has already set `errno` for you. So this Apple branch should leave `errno` alone and just do:

          PCHECK(pthread_setname_np(…) != 0) << "pthread_setname_np";
      • Patch Set #59, Line 59: PCHECK((errno = pthread_getname_np(

        but I verified that this one does behave in line with expectations for the pthread_* family even on Apples, so this is correct as now written. Go figure.

      • Patch Set #59, Line 73: CHECK_LT(new_thread_name.length(), kPthreadNameMaxLen);

        Leave this to the `pthread_setname_np` to fail.

        If you want to keep your own check, make it a `DCHECK`, since it’s otherwise redundant.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 17:37:00 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 13, 2022, 2:37:52 PM6/13/22
    to Bruce Dawson, Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 59:Code-Review +1

    View Change

    5 comments:

    • Patchset:

    • File minidump/minidump_thread_name_list_writer.cc:

      • We’ll probably see threads with empty names on some platforms. […]

        Great question. I tried using `windbg`'s `.dump /mt` command on Chrome, but the resulting minidump was missing the `THREAD_NAME_LIST_STREAM`.

        Let's revisit this after this review to see if we should exclude empty thread names from the thread name list.

    • File test/scoped_set_thread_name_fuchsia.cc:

      • Turns out that on Apples, this behaves “traditionally”: on failure, it returns nonzero and has alrea […]

        Done

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 59
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 18:37:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Mark Mentovai (Gerrit)

    unread,
    Jun 13, 2022, 4:05:30 PM6/13/22
    to Ben Hamilton, Bruce Dawson, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    View Change

    2 comments:

    • File test/scoped_set_thread_name_fuchsia.cc:

      • Looks like Fuchsia behaves the same as Apple — both silently truncate names that are too long (unlike Linux, which fails with `ERANGE`).

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 60
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 20:05:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ben Hamilton <benha...@google.com>

    Ben Hamilton (Gerrit)

    unread,
    Jun 13, 2022, 4:35:13 PM6/13/22
    to Bruce Dawson, Mark Mentovai, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen, Mark Mentovai.

    Patch set 60:Code-Review +1

    View Change

    1 comment:

    • File test/scoped_set_thread_name_posix.cc:

      • > TIL that glibc returns `ERANGE` instead of truncating: […]

        Sure enough! I was lazy and didn't trace `__proc_info(5, getpid(), 2, (uint64_t)0, (void*)name, (int)len);` fully. (In my defense, that is just the tiniest bit impenetrable).

        Removed check and updated comments here and above.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 60
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 20:35:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Mark Mentovai (Gerrit)

    unread,
    Jun 13, 2022, 4:38:15 PM6/13/22
    to Ben Hamilton, Bruce Dawson, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Ben Hamilton, Joshua Peraza, Justin Cohen.

    Patch set 61:Code-Review +1

    View Change

    3 comments:

    • Patchset:

      • Patch Set #61:

        I hereby award the coveted LGTM prize to one Ben Hamilton, right in the nick of time. Congratulations, Ben!

    • File test/scoped_set_thread_name_fuchsia.cc:

    • File test/scoped_set_thread_name_posix.cc:

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 61
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
    Gerrit-Attention: Ben Hamilton <benha...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 20:38:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ben Hamilton (Gerrit)

    unread,
    Jun 13, 2022, 4:44:47 PM6/13/22
    to Mark Mentovai, Bruce Dawson, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen.

    Patch set 61:Code-Review +1Commit-Queue +1

    View Change

    3 comments:

    • Patchset:

      • Patch Set #61:

        I hereby award the coveted LGTM prize to one Ben Hamilton, right in the nick of time. […]

        Huzzah! I learned quite a lot about C++ in this CL stack. I'm not sure if I should feel proud or foolish about that, considering I've been coding C++ since some time in the previous millennium..

    • File test/scoped_set_thread_name_fuchsia.cc:

      • Fixed.

    • File test/scoped_set_thread_name_posix.cc:

      • Removed.

    To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
    Gerrit-Change-Number: 3671776
    Gerrit-PatchSet: 61
    Gerrit-Owner: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Mon, 13 Jun 2022 20:44:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Ben Hamilton (Gerrit)

    unread,
    Jun 13, 2022, 4:44:57 PM6/13/22
    to Mark Mentovai, Bruce Dawson, Crashpad LUCI CQ, Justin Cohen, Joshua Peraza, crashp...@chromium.org

    Attention is currently required from: Joshua Peraza, Justin Cohen.

    Patch set 62:Commit-Queue +2

    View Change

      To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
      Gerrit-Change-Number: 3671776
      Gerrit-PatchSet: 62
      Gerrit-Owner: Ben Hamilton <benha...@google.com>
      Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
      Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
      Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Attention: Justin Cohen <justi...@chromium.org>
      Gerrit-Comment-Date: Mon, 13 Jun 2022 20:44:51 +0000

      Crashpad LUCI CQ (Gerrit)

      unread,
      Jun 13, 2022, 4:58:49 PM6/13/22
      to Ben Hamilton, Mark Mentovai, Bruce Dawson, Justin Cohen, Joshua Peraza, crashp...@chromium.org

      Crashpad LUCI CQ submitted this change.

      View Change



      61 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: test/scoped_set_thread_name_posix.cc
      Insertions: 0, Deletions: 1.

      @@ -20,7 +20,6 @@
      #include <string>

      #include "base/check.h"
      -#include "base/check_op.h"
      #include "build/build_config.h"

      #if BUILDFLAG(IS_APPLE)
      ```
      ```
      The name of the file: test/scoped_set_thread_name_fuchsia.cc
      Insertions: 1, Deletions: 1.

      @@ -20,7 +20,7 @@
      #include <zircon/syscalls/object.h>
      #include <zircon/types.h>

      -#include "base/check.h"
      +#include "base/check_op.h"
      #include "base/fuchsia/fuchsia_logging.h"

      namespace crashpad {
      ```

      Approvals: Mark Mentovai: Looks good to me Ben Hamilton: Looks good to me; Commit
      [snapshot] Add support for thread names

      This CL adds a new method ThreadSnapshot::ThreadName(), implements
      it in each snapshot implementation, and adds tests for iOS, macOS,
      Linux, Windows, and Fuchsia.

      Bug: crashpad:327
      Change-Id: I35031975223854c19d977e057dd026a40d33fd41
      Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3671776
      Reviewed-by: Mark Mentovai <ma...@chromium.org>
      Commit-Queue: Ben Hamilton <benha...@google.com>
      Reviewed-by: Ben Hamilton <benha...@google.com>
      ---
      M client/ios_handler/in_process_intermediate_dump_handler.cc
      M client/ios_handler/in_process_intermediate_dump_handler_test.cc
      M minidump/minidump_file_writer.cc
      M minidump/minidump_thread_name_list_writer.cc
      M minidump/minidump_thread_name_list_writer.h
      M minidump/minidump_thread_name_list_writer_test.cc
      M snapshot/fuchsia/process_reader_fuchsia_test.cc
      M snapshot/fuchsia/thread_snapshot_fuchsia.cc
      M snapshot/fuchsia/thread_snapshot_fuchsia.h
      M snapshot/ios/process_snapshot_ios_intermediate_dump_test.cc
      M snapshot/ios/thread_snapshot_ios_intermediate_dump.cc
      M snapshot/ios/thread_snapshot_ios_intermediate_dump.h
      M snapshot/linux/process_reader_linux.cc
      M snapshot/linux/process_reader_linux.h
      M snapshot/linux/process_reader_linux_test.cc
      M snapshot/linux/thread_snapshot_linux.cc
      M snapshot/linux/thread_snapshot_linux.h
      M snapshot/mac/process_reader_mac.cc
      M snapshot/mac/process_reader_mac.h
      M snapshot/mac/process_reader_mac_test.cc
      M snapshot/mac/thread_snapshot_mac.cc
      M snapshot/mac/thread_snapshot_mac.h
      M snapshot/minidump/process_snapshot_minidump.cc
      M snapshot/minidump/process_snapshot_minidump.h
      M snapshot/minidump/process_snapshot_minidump_test.cc
      M snapshot/minidump/thread_snapshot_minidump.cc
      M snapshot/minidump/thread_snapshot_minidump.h
      M snapshot/sanitized/thread_snapshot_sanitized.cc
      M snapshot/sanitized/thread_snapshot_sanitized.h
      M snapshot/test/test_thread_snapshot.cc
      M snapshot/test/test_thread_snapshot.h
      M snapshot/thread_snapshot.h
      M snapshot/win/process_reader_win.cc
      M snapshot/win/process_reader_win.h
      M snapshot/win/process_reader_win_test.cc
      M snapshot/win/process_snapshot_win.cc
      M snapshot/win/thread_snapshot_win.cc
      M snapshot/win/thread_snapshot_win.h
      M test/BUILD.gn
      A test/scoped_set_thread_name.h
      A test/scoped_set_thread_name_fuchsia.cc
      A test/scoped_set_thread_name_posix.cc
      A test/scoped_set_thread_name_win.cc
      M util/ios/ios_intermediate_dump_format.h
      44 files changed, 992 insertions(+), 79 deletions(-)


      To view, visit change 3671776. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: I35031975223854c19d977e057dd026a40d33fd41
      Gerrit-Change-Number: 3671776
      Gerrit-PatchSet: 63
      Gerrit-Owner: Ben Hamilton <benha...@google.com>
      Gerrit-Reviewer: Ben Hamilton <benha...@google.com>
      Gerrit-Reviewer: Crashpad LUCI CQ <crashpa...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-CC: Bruce Dawson <bruce...@chromium.org>
      Gerrit-MessageType: merged
      Reply all
      Reply to author
      Forward
      0 new messages