1 /* 2 * Copyright (C) 2012 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 #ifndef _DEBUGGERD_BACKTRACE_H 18 #define _DEBUGGERD_BACKTRACE_H 19 20 #include <sys/types.h> 21 #include <sys/ucontext.h> 22 23 #include <map> 24 #include <string> 25 26 #include <android-base/unique_fd.h> 27 28 #include "types.h" 29 #include "utility.h" 30 31 // Forward delcaration 32 namespace unwindstack { 33 class Unwinder; 34 } 35 36 // Dumps a backtrace using a format similar to what Dalvik uses so that the result 37 // can be intermixed in a bug report. 38 void dump_backtrace(android::base::unique_fd output_fd, unwindstack::Unwinder* unwinder, 39 const std::map<pid_t, ThreadInfo>& thread_info, pid_t target_thread); 40 41 void dump_backtrace_header(int output_fd); 42 void dump_backtrace_thread(int output_fd, unwindstack::Unwinder* unwinder, 43 const ThreadInfo& thread); 44 void dump_backtrace_footer(int output_fd); 45 46 #endif // _DEBUGGERD_BACKTRACE_H 47