1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #if defined(USE_SCUDO) 20 21 #include "types.h" 22 #include "utility.h" 23 24 #include <memory.h> 25 26 #include "scudo/interface.h" 27 28 // Forward delcarations 29 class Cause; 30 class Tombstone; 31 32 namespace unwindstack { 33 class AndroidUnwinder; 34 class Memory; 35 } // namespace unwindstack 36 37 class ScudoCrashData { 38 public: 39 ScudoCrashData() = delete; 40 ~ScudoCrashData() = default; 41 ScudoCrashData(unwindstack::Memory* process_memory, const ProcessInfo& process_info); 42 43 bool CrashIsMine() const; 44 45 void AddCauseProtos(Tombstone* tombstone, unwindstack::AndroidUnwinder* unwinder) const; 46 47 private: 48 scudo_error_info error_info_ = {}; 49 uintptr_t untagged_fault_addr_; 50 51 void FillInCause(Cause* cause, const scudo_error_report* report, 52 unwindstack::AndroidUnwinder* unwinder) const; 53 }; 54 55 #endif // USE_SCUDO 56