minidump_to_upload_parameters.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2017 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 HANDLER_MINIDUMP_TO_UPLOAD_PARAMETERS_H_
  15. #define HANDLER_MINIDUMP_TO_UPLOAD_PARAMETERS_H_
  16. #include <map>
  17. #include <string>
  18. #include "snapshot/process_snapshot.h"
  19. namespace crashpad {
  20. //! \brief Given a ProcessSnapshot, returns a map of key-value pairs to use as
  21. //! HTTP form parameters for upload to a Breakpad crash report colleciton
  22. //! server.
  23. //!
  24. //! The map is built by combining the process simple annotations map with
  25. //! each module’s simple annotations map and annotation objects.
  26. //!
  27. //! In the case of duplicate simple map keys or annotation names, the map will
  28. //! retain the first value found for any key, and will log a warning about
  29. //! discarded values. The precedence rules for annotation names are: the two
  30. //! reserved keys discussed below, process simple annotations, module simple
  31. //! annotations, and module annotation objects.
  32. //!
  33. //! For annotation objects, only ones of that are Annotation::Type::kString are
  34. //! included.
  35. //!
  36. //! Each module’s annotations vector is also examined and built into a single
  37. //! string value, with distinct elements separated by newlines, and stored at
  38. //! the key named “list_annotations”, which supersedes any other key found by
  39. //! that name.
  40. //!
  41. //! The client ID stored in the minidump is converted to a string and stored at
  42. //! the key named “guid”, which supersedes any other key found by that name.
  43. //!
  44. //! In the event of an error reading the minidump file, a message will be
  45. //! logged.
  46. //!
  47. //! \param[in] process_snapshot The process snapshot from which annotations
  48. //! will be extracted.
  49. //!
  50. //! \returns A string map of the annotations.
  51. std::map<std::string, std::string> BreakpadHTTPFormParametersFromMinidump(
  52. const ProcessSnapshot* process_snapshot);
  53. } // namespace crashpad
  54. #endif // HANDLER_MINIDUMP_TO_UPLOAD_PARAMETERS_H_