Log crash keys and other info when DumpWithoutCrashing is called.

This CL should slightly improve development experience when debugging
scenarios where a DumpWithoutCrashing is called when running a test, or
when manually trying to repro a bug with a developer build of Chromium.
This CL logs the same information as LOG(FATAL) would (stack trace,
task trace, crash keys).

This CL has been opportunistically put together when working on
https://crbug.com/1038996, but it should be useful in general.
This CL does *not* fix https://crbug.com/1038996.

Example of how test output might look like when it
(accidentally/unexpectedly in this case) triggers a renderer kill:

    [838194:838194:0826/140420.024770:ERROR:bad_message.cc(20)] Terminating extension renderer for bad IPC message, reason 21
    [838194:838194:0826/140420.024971:ERROR:process_posix.cc(337)] Unable to terminate process 838300: Resource temporarily unavailable (11)
    [838194:838194:0826/140420.158002:ERROR:dump_without_crashing.cc(74)] DumpWithoutCrashing:
    #0 0x7f678a4593e2 base::debug::CollectStackTrace()
    #1 0x7f678a34d5d3 base::debug::StackTrace::StackTrace()
    #2 0x7f678a36b533 logging::LogMessage::AppendCrashInfoForDevBuilds()
    #3 0x7f678a34cdae (anonymous namespace)::MaybeLogThatDumpWithoutCrashingHappened()
    #4 0x7f678a34cf2b base::debug::DumpWithoutCrashing()
    #5 0x7f6782feddc6 content::RenderProcessHostImpl::ShutdownForBadMessage()
    #6 0x5645447dc5c4 extensions::bad_message::ReceivedBadMessage()
    #7 0x5645448fd588 extensions::MessagingAPIMessageFilter::OnOpenChannelToExtension()
    #8 0x5645448fcfa7 IPC::MessageT<>::Dispatch<>()
    #9 0x5645448fccc0 extensions::MessagingAPIMessageFilter::OnMessageReceived()
    #10 0x7f678254ccd5 content::BrowserMessageFilter::Internal::DispatchMessage()
    ...
    Task trace:
    #0 0x7f678254ca73 content::BrowserMessageFilter::Internal::OnMessageReceived()
    #1 0x7f6789a8adce mojo::SimpleWatcher::Context::Notify()
    Crash keys:
      "RPH.BadMessageKill-isolation_mode" = "spp "
      "killed_process_origin_lock" = "{ chrome-extension://mbbkmcnhalmicnfjpiigcennjnmlcdja/ }"
      "extension_bad_message_reason" = "21"
      "ExternalConnectionInfo-source_url" = "chrome-extension://mbbkmcnhalmicnfjpiigcennjnmlcdja/background.js"
      "ExternalConnectionInfo-source_origin" = "nullptr"
      "MessagingSource-extension_id" = "mbbkmcnhalmicnfjpiigcennjnmlcdja"
      "MessagingSource-type" = "Extension"
      "ExternalConnectionInfo-target_id" = "mbbkmcnhalmicnfjpiigcennjnmlcdja"
      "ui_scheduler_async_stack" = "0x7F678254CA73 0x7F6789A8ADCE"
      "io_scheduler_async_stack" = "0x7F6789A8ADCE 0x0"

Bug: 1038996
Change-Id: I2172212a42b43f9272ecc86904aeb2ddb3c3b936
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3857528
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ɓukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1040542}
3 files changed
tree: 85137bafa44301092a307945355287f88b88f9e1
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. codelabs/
  13. components/
  14. content/
  15. courgette/
  16. crypto/
  17. dbus/
  18. device/
  19. docs/
  20. extensions/
  21. fuchsia_web/
  22. gin/
  23. google_apis/
  24. google_update/
  25. gpu/
  26. headless/
  27. infra/
  28. ios/
  29. ipc/
  30. media/
  31. mojo/
  32. native_client_sdk/
  33. net/
  34. pdf/
  35. ppapi/
  36. printing/
  37. remoting/
  38. rlz/
  39. sandbox/
  40. services/
  41. skia/
  42. sql/
  43. storage/
  44. styleguide/
  45. testing/
  46. third_party/
  47. tools/
  48. ui/
  49. url/
  50. weblayer/
  51. .clang-format
  52. .clang-tidy
  53. .eslintrc.js
  54. .git-blame-ignore-revs
  55. .gitattributes
  56. .gitignore
  57. .gn
  58. .mailmap
  59. .rustfmt.toml
  60. .vpython
  61. .vpython3
  62. .yapfignore
  63. AUTHORS
  64. BUILD.gn
  65. CODE_OF_CONDUCT.md
  66. codereview.settings
  67. DEPS
  68. DIR_METADATA
  69. ENG_REVIEW_OWNERS
  70. LICENSE
  71. LICENSE.chromium_os
  72. OWNERS
  73. PRESUBMIT.py
  74. PRESUBMIT_test.py
  75. PRESUBMIT_test_mocks.py
  76. README.md
  77. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure .

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.