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

Side by Side Diff: syzygy/agent/asan/runtime.h

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Fix comments. Created 3 years, 11 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 | « syzygy/agent/asan/rtl_impl_unittest.cc ('k') | syzygy/agent/asan/runtime.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 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Sets the allocation-filter flag to the specified value. 143 // Sets the allocation-filter flag to the specified value.
144 // @param value the new value for the flag. 144 // @param value the new value for the flag.
145 // @note The flag is stored per-thread using TLS. Multiple threads do not 145 // @note The flag is stored per-thread using TLS. Multiple threads do not
146 // share the same flag. 146 // share the same flag.
147 void set_allocation_filter_flag(bool value); 147 void set_allocation_filter_flag(bool value);
148 148
149 // @names Accessors. 149 // @names Accessors.
150 // { 150 // {
151 uint64_t random_key() const { return random_key_; } 151 uint64_t random_key() const { return random_key_; }
152 bool crash_reporter_initialized() const {
153 return crash_reporter_initialized_;
154 }
152 // @} 155 // @}
153 156
154 // Observes a given thread ID, adding it to thread ID set. 157 // Observes a given thread ID, adding it to thread ID set.
155 // @param thread_id The thread ID that has been observed. 158 // @param thread_id The thread ID that has been observed.
156 void AddThreadId(uint32_t thread_id); 159 void AddThreadId(uint32_t thread_id);
157 160
158 // Determines if a thread ID has already been seen. 161 // Determines if a thread ID has already been seen.
159 // @param thread_id The thread ID to be queried. 162 // @param thread_id The thread ID to be queried.
160 // @returns true if a given thread ID is valid for this process. 163 // @returns true if a given thread ID is valid for this process.
161 bool ThreadIdIsValid(uint32_t thread_id); 164 bool ThreadIdIsValid(uint32_t thread_id);
(...skipping 25 matching lines...) Expand all
187 190
188 // Enables the deferred free thread. 191 // Enables the deferred free thread.
189 void EnableDeferredFreeThread(); 192 void EnableDeferredFreeThread();
190 193
191 // Disables the deferred free thread. 194 // Disables the deferred free thread.
192 void DisableDeferredFreeThread(); 195 void DisableDeferredFreeThread();
193 196
194 // @returns the list of enabled features. 197 // @returns the list of enabled features.
195 AsanFeatureSet GetEnabledFeatureSet(); 198 AsanFeatureSet GetEnabledFeatureSet();
196 199
200 // Initialize the crash reporter used by the runtime.
201 //
202 // This function should only be called once during the runtime's lifetime,
203 // it could either be called at setup time if the deferred initialization
204 // flag hasn't been set on the command line or later by the instrumented
205 // image.
206 //
207 // Calling this when the crash reporter has already been initialized will
208 // terminate the process.
209 void InitializeCrashReporter();
210
197 protected: 211 protected:
198 // Propagate the values of the flags to the target modules. 212 // Propagate the values of the flags to the target modules.
199 void PropagateParams(); 213 void PropagateParams();
200 214
201 // @returns the space required to write the provided corrupt heap info. 215 // @returns the space required to write the provided corrupt heap info.
202 // @param corrupt_ranges The corrupt range info. 216 // @param corrupt_ranges The corrupt range info.
203 size_t CalculateCorruptHeapInfoSize( 217 size_t CalculateCorruptHeapInfoSize(
204 const HeapChecker::CorruptRangesVector& corrupt_ranges); 218 const HeapChecker::CorruptRangesVector& corrupt_ranges);
205 219
206 // Writes corrupt heap information to the provided buffer. This will write 220 // Writes corrupt heap information to the provided buffer. This will write
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 std::unordered_set<uint32_t> thread_ids_; // Under thread_ids_lock_. 334 std::unordered_set<uint32_t> thread_ids_; // Under thread_ids_lock_.
321 335
322 // A random key that is generated on object creation. This is used for 336 // A random key that is generated on object creation. This is used for
323 // correlating duplicate crash reports on the back-end. 337 // correlating duplicate crash reports on the back-end.
324 const uint64_t random_key_; 338 const uint64_t random_key_;
325 339
326 // The crash reporter in use. This will be left null if no crash reporter 340 // The crash reporter in use. This will be left null if no crash reporter
327 // is available. 341 // is available.
328 std::unique_ptr<ReporterInterface> crash_reporter_; 342 std::unique_ptr<ReporterInterface> crash_reporter_;
329 343
344 // Indicates if the crash reporter has been initialized.
345 bool crash_reporter_initialized_;
346
330 DISALLOW_COPY_AND_ASSIGN(AsanRuntime); 347 DISALLOW_COPY_AND_ASSIGN(AsanRuntime);
331 }; 348 };
332 349
333 } // namespace asan 350 } // namespace asan
334 } // namespace agent 351 } // namespace agent
335 352
336 #endif // SYZYGY_AGENT_ASAN_RUNTIME_H_ 353 #endif // SYZYGY_AGENT_ASAN_RUNTIME_H_
OLDNEW
« no previous file with comments | « syzygy/agent/asan/rtl_impl_unittest.cc ('k') | syzygy/agent/asan/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698