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

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: Remove unused function declaration 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') | no next file with comments »
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_CLIENT_CRASHPAD_INFO_H_ 15 #ifndef CRASHPAD_CLIENT_CRASHPAD_INFO_H_
16 #define CRASHPAD_CLIENT_CRASHPAD_INFO_H_ 16 #define CRASHPAD_CLIENT_CRASHPAD_INFO_H_
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 19
20 #include <stdint.h> 20 #include <stdint.h>
21 21
22 #include "client/simple_string_dictionary.h" 22 #include "client/simple_string_dictionary.h"
23 #include "util/misc/tri_state.h"
23 24
24 namespace crashpad { 25 namespace crashpad {
25 26
26 //! \brief A structure that can be used by a Crashpad-enabled program to 27 //! \brief A structure that can be used by a Crashpad-enabled program to
27 //! provide information to the Crashpad crash handler. 28 //! provide information to the Crashpad crash handler.
28 //! 29 //!
29 //! It is possible for one CrashpadInfo structure to appear in each loaded code 30 //! 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 31 //! 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 32 //! interface, there is only one global CrashpadInfo structure, located in the
32 //! module that contains the client interface code. 33 //! module that contains the client interface code.
33 struct CrashpadInfo { 34 struct CrashpadInfo {
34 public: 35 public:
35 //! \brief Returns the global CrashpadInfo structure. 36 //! \brief Returns the global CrashpadInfo structure.
36 static CrashpadInfo* GetCrashpadInfo(); 37 static CrashpadInfo* GetCrashpadInfo();
37 38
38 CrashpadInfo(); 39 CrashpadInfo();
39 40
40 void set_simple_annotations(SimpleStringDictionary* simple_annotations) { 41 void set_simple_annotations(SimpleStringDictionary* simple_annotations) {
41 simple_annotations_ = simple_annotations; 42 simple_annotations_ = simple_annotations;
42 } 43 }
43 44
45 //! \brief Enables or disables Crashpad handler processing.
46 //!
47 //! When handling an exception, the Crashpad handler will scan all modules in
48 //! a process. The first one that has a CrashpadInfo structure populated with
49 //! a value other than #kUnset for this field will dictate whether the handler
50 //! is functional or not. If all modules with a CrashpadInfo structure specify
51 //! #kUnset, the handler will be enabled. If disabled, the Crashpad handler
52 //! will still run and receive exceptions, but will not take any action on an
53 //! exception on its own behalf, except for the action necessary to determine
54 //! that it has been disabled.
55 //!
56 //! The Crashpad handler should not normally be disabled. More commonly, it
57 //! is appropraite to disable crash report upload by calling
58 //! Settings::SetUploadsEnabled().
59 void set_crashpad_handler_behavior(TriState crashpad_handler_behavior) {
60 crashpad_handler_behavior_ = crashpad_handler_behavior;
61 }
62
63 //! \brief Enables or disables Crashpad forwarding of exceptions to the
64 //! system’s crash reporter.
65 //!
66 //! When handling an exception, the Crashpad handler will scan all modules in
67 //! a process. The first one that has a CrashpadInfo structure populated with
68 //! a value other than #kUnset for this field will dictate whether the
69 //! exception is forwarded to the system’s crash reporter. If all modules with
70 //! a CrashpadInfo structure specify #kUnset, forwarding will be enabled.
71 //! Unless disabled, forwarding may still occur if the Crashpad handler is
72 //! disabled by SetCrashpadHandlerState(). Even when forwarding is enabled,
73 //! the Crashpad handler may choose not to forward all exceptions to the
74 //! system’s crash reporter in cases where it has reason to believe that the
75 //! system’s crash reporter would not normally have handled the exception in
76 //! Crashpad’s absence.
77 void set_system_crash_reporter_forwarding(
78 TriState system_crash_reporter_forwarding) {
79 system_crash_reporter_forwarding_ = system_crash_reporter_forwarding;
80 }
81
44 static const uint32_t kSignature = 'CPad'; 82 static const uint32_t kSignature = 'CPad';
45 83
46 private: 84 private:
47 // The compiler won’t necessarily see anyone using these fields, but it 85 // 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 86 // 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 87 // process they’re found in, they’re supposed to be read by the crash
50 // reporting process. 88 // reporting process.
51 #if defined(__clang__) 89 #if defined(__clang__)
52 #pragma clang diagnostic push 90 #pragma clang diagnostic push
53 #pragma clang diagnostic ignored "-Wunused-private-field" 91 #pragma clang diagnostic ignored "-Wunused-private-field"
54 #endif 92 #endif
55 93
56 // Fields present in version 1: 94 // Fields present in version 1:
57 uint32_t signature_; // kSignature 95 uint32_t signature_; // kSignature
58 uint32_t size_; // The size of the entire CrashpadInfo structure. 96 uint32_t size_; // The size of the entire CrashpadInfo structure.
59 uint32_t version_; // kVersion 97 uint32_t version_; // kVersion
60 uint32_t padding_0_; 98 TriState crashpad_handler_behavior_;
99 TriState system_crash_reporter_forwarding_;
100 uint16_t padding_0_;
61 SimpleStringDictionary* simple_annotations_; // weak 101 SimpleStringDictionary* simple_annotations_; // weak
62 102
63 #if defined(__clang__) 103 #if defined(__clang__)
64 #pragma clang diagnostic pop 104 #pragma clang diagnostic pop
65 #endif 105 #endif
66 106
67 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo); 107 DISALLOW_COPY_AND_ASSIGN(CrashpadInfo);
68 }; 108 };
69 109
70 } // namespace crashpad 110 } // namespace crashpad
71 111
72 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_ 112 #endif // CRASHPAD_CLIENT_CRASHPAD_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | client/crashpad_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698