Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: client/crashpad_info.h

Issue 997713002: Allow exception forwarding to the system’s native crash reporter to be disabled (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | client/crashpad_info.cc » ('j') | client/crashpad_info.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 14 matching lines...) Expand all
25 25
26 //! \brief A structure that can be used by a Crashpad-enabled program to 26 //! \brief A structure that can be used by a Crashpad-enabled program to
27 //! provide information to the Crashpad crash handler. 27 //! provide information to the Crashpad crash handler.
28 //! 28 //!
29 //! It is possible for one CrashpadInfo structure to appear in each loaded code 29 //! It is possible for one CrashpadInfo structure to appear in each loaded code
30 //! module in a process, but from the perspective of the user of the client 30 //! module in a process, but from the perspective of the user of the client
31 //! interface, there is only one global CrashpadInfo structure, located in the 31 //! interface, there is only one global CrashpadInfo structure, located in the
32 //! module that contains the client interface code. 32 //! module that contains the client interface code.
33 struct CrashpadInfo { 33 struct CrashpadInfo {
34 public: 34 public:
35 //! \brief Options to enable and disable features.
36 enum TriState {
37 //! \brief No special behavior is requested, and the defaults are desired.
38 kDefault = 0,
39
40 //! \brief The behavior should be enabled.
41 kEnabled,
42
43 //! \brief The behavior should be disabled.
44 kDisabled,
45 };
46
35 //! \brief Returns the global CrashpadInfo structure. 47 //! \brief Returns the global CrashpadInfo structure.
36 static CrashpadInfo* GetCrashpadInfo(); 48 static CrashpadInfo* GetCrashpadInfo();
37 49
38 CrashpadInfo(); 50 CrashpadInfo();
39 51
40 void set_simple_annotations(SimpleStringDictionary* simple_annotations) { 52 void set_simple_annotations(SimpleStringDictionary* simple_annotations) {
41 simple_annotations_ = simple_annotations; 53 simple_annotations_ = simple_annotations;
42 } 54 }
43 55
56 //! \brief Enables or disables Crashpad handler processing.
57 //!
58 //! When handling an exception, the Crashpad handler will scan all modules in
59 //! a process. The first one that has a CrashpadInfo structure populated with
60 //! a value other than #kDefault for \a state will dictate whether the handler
61 //! is functional or not. If all modules with a CrashpadInfo structure specify
62 //! #kDefault, the handler will be enabled. If disabled, the Crashpad handler
63 //! will still run and receive exceptions, but will not take any action on an
64 //! exception on its own behalf, except for the action necessary to determine
65 //! that it has been disabled.
66 //!
67 //! The Crashpad handler should not normally be disabled. More commonly, it
68 //! is appropraite to disable crash report upload by calling
69 //! Settings::SetUploadsEnabled().
70 void SetCrashpadHandlerState(TriState state);
71
72 //! \brief Enables or disables Crashpad forwarding of exceptions to the
73 //! system’s native crash reporter.
74 //!
75 //! When handling an exception, the Crashpad handler will scan all modules in
76 //! a process. The first one that has a CrashpadInfo structure populated with
77 //! a value other than #kDefault for \a state will dictate whether the
78 //! exception is forwarded to the system’s native crash reporter. If all
79 //! modules with a CrashpadInfo structure specify #kDefault, forwarding will
80 //! be enabled. Unless disabled, forwarding may still occur if the Crashpad
81 //! handler is disabled by SetCrashpadHandlerState(). Even when forwarding is
82 //! enabled, the Crashpad handler may choose not to forward all exceptions to
83 //! the system’s native crash reporter in cases where it has reason to believe
84 //! that the system’s native crash reporter would not normally have handled
85 //! the exception in Crashpad’s absence.
86 void SetNativeCrashReporterForwarding(TriState state);
87
44 static const uint32_t kSignature = 'CPad'; 88 static const uint32_t kSignature = 'CPad';
45 89
46 private: 90 private:
47 // The compiler won’t necessarily see anyone using these fields, but it 91 // The compiler won’t necessarily see anyone using these fields, but it
48 // shouldn’t warn about that. These fields aren’t intended for use by the 92 // shouldn’t warn about that. These fields aren’t intended for use by the
49 // process they’re found in, they’re supposed to be read by the crash 93 // process they’re found in, they’re supposed to be read by the crash
50 // reporting process. 94 // reporting process.
51 #if defined(__clang__) 95 #if defined(__clang__)
52 #pragma clang diagnostic push 96 #pragma clang diagnostic push
53 #pragma clang diagnostic ignored "-Wunused-private-field" 97 #pragma clang diagnostic ignored "-Wunused-private-field"
54 #endif 98 #endif
55 99
56 // Fields present in version 1: 100 // Fields present in version 1:
57 uint32_t signature_; // kSignature 101 uint32_t signature_; // kSignature
58 uint32_t size_; // The size of the entire CrashpadInfo structure. 102 uint32_t size_; // The size of the entire CrashpadInfo structure.
59 uint32_t version_; // kVersion 103 uint32_t version_; // kVersion
60 uint32_t padding_0_; 104
105 // options_ stores the state for SetCrashpadHandlerState() and
106 // SetNativeCrashReporterForwarding().
107 uint8_t options_;
108
109 uint8_t padding_0_;
110 uint16_t padding_1_;
61 SimpleStringDictionary* simple_annotations_; // weak 111 SimpleStringDictionary* simple_annotations_; // weak
62 112
63 #if defined(__clang__) 113 #if defined(__clang__)
64 #pragma clang diagnostic pop 114 #pragma clang diagnostic pop
65 #endif 115 #endif
66 116
67 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); 117 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo);
68 }; 118 };
69 119
70 } // namespace crashpad 120 } // namespace crashpad
71 121
72 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ 122 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | client/crashpad_info.cc » ('j') | client/crashpad_info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698