| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |