crash_handler.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_GWP_ASAN_CRASH_HANDLER_CRASH_HANDLER_H_
  5. #define COMPONENTS_GWP_ASAN_CRASH_HANDLER_CRASH_HANDLER_H_
  6. #include "third_party/crashpad/crashpad/handler/user_stream_data_source.h"
  7. namespace crashpad {
  8. class ProcessSnapshot;
  9. } // namespace crashpad
  10. namespace gwp_asan {
  11. namespace internal {
  12. // The stream type assigned to the minidump stream that holds the serialized
  13. // GWP ASan crash state.
  14. const uint32_t kGwpAsanMinidumpStreamType = 0x4B6B0004;
  15. } // namespace internal
  16. // A crashpad extension installed at crashpad handler start-up to inspect the
  17. // crashing process, see if the crash was caused by a GWP-ASan exception, and
  18. // add a GWP-ASan stream to the minidump if so.
  19. class UserStreamDataSource : public crashpad::UserStreamDataSource {
  20. public:
  21. UserStreamDataSource() = default;
  22. UserStreamDataSource(const UserStreamDataSource&) = delete;
  23. UserStreamDataSource& operator=(const UserStreamDataSource&) = delete;
  24. std::unique_ptr<crashpad::MinidumpUserExtensionStreamDataSource>
  25. ProduceStreamData(crashpad::ProcessSnapshot* process_snapshot) override;
  26. };
  27. } // namespace gwp_asan
  28. #endif // COMPONENTS_GWP_ASAN_CRASH_HANDLER_CRASH_HANDLER_H_