crashpad_info_client_options.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2015 The Crashpad Authors. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef CRASHPAD_SNAPSHOT_CRASHPAD_INFO_CLIENT_OPTIONS_H_
  15. #define CRASHPAD_SNAPSHOT_CRASHPAD_INFO_CLIENT_OPTIONS_H_
  16. #include <stdint.h>
  17. #include "util/misc/tri_state.h"
  18. namespace crashpad {
  19. //! \brief Options represented in a client’s CrashpadInfo structure.
  20. //!
  21. //! The CrashpadInfo structure is not suitable to expose client options
  22. //! in a generic way at the snapshot level. This structure duplicates
  23. //! option-related fields from the client structure for general use within the
  24. //! snapshot layer and by users of this layer.
  25. //!
  26. //! For objects of this type corresponding to a module, option values are taken
  27. //! from the module’s CrashpadInfo structure directly. If the module has no such
  28. //! such structure, option values appear unset.
  29. //!
  30. //! For objects of this type corresponding to an entire process, option values
  31. //! are taken from the CrashpadInfo structures of modules within the process.
  32. //! The first module found with a set value (enabled or disabled) will provide
  33. //! an option value for the process. Different modules may provide values for
  34. //! different options. If no module in the process sets a value for an option,
  35. //! the option will appear unset for the process. If no module in the process
  36. //! has a CrashpadInfo structure, all option values will appear unset.
  37. struct CrashpadInfoClientOptions {
  38. public:
  39. //! \brief Converts `uint8_t` value to a TriState value.
  40. //!
  41. //! The process_types layer exposes TriState as a `uint8_t` rather than an
  42. //! enum type. This function converts these values into the equivalent enum
  43. //! values used in the snapshot layer.
  44. //!
  45. //! \return The TriState equivalent of \a crashpad_info_tri_state, if it is a
  46. //! valid TriState value. Otherwise, logs a warning and returns
  47. //! TriState::kUnset.
  48. static TriState TriStateFromCrashpadInfo(uint8_t crashpad_info_tri_state);
  49. CrashpadInfoClientOptions();
  50. //! \sa CrashpadInfo::set_crashpad_handler_behavior()
  51. TriState crashpad_handler_behavior;
  52. //! \sa CrashpadInfo::set_system_crash_reporter_forwarding()
  53. TriState system_crash_reporter_forwarding;
  54. //! \sa CrashpadInfo::set_gather_indirectly_referenced_memory()
  55. TriState gather_indirectly_referenced_memory;
  56. //! \sa CrashpadInfo::set_gather_indirectly_referenced_memory()
  57. uint32_t indirectly_referenced_memory_cap;
  58. };
  59. } // namespace crashpad
  60. #endif // CRASHPAD_SNAPSHOT_CRASHPAD_INFO_CLIENT_OPTIONS_H_