backtrace.h revision 7c89f9e955ddd79312113f83cb4c210a68a940aa
1053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown/*
2053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * Copyright (C) 2012 The Android Open Source Project
3053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown *
4053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * Licensed under the Apache License, Version 2.0 (the "License");
5053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * you may not use this file except in compliance with the License.
6053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * You may obtain a copy of the License at
7053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown *
8053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown *      http://www.apache.org/licenses/LICENSE-2.0
9053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown *
10053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * Unless required by applicable law or agreed to in writing, software
11053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * distributed under the License is distributed on an "AS IS" BASIS,
12053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * See the License for the specific language governing permissions and
14053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown * limitations under the License.
15053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown */
16053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown
17053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown#ifndef _DEBUGGERD_BACKTRACE_H
18053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown#define _DEBUGGERD_BACKTRACE_H
19053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown
20053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown#include <sys/types.h>
21053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown
227c89f9e955ddd79312113f83cb4c210a68a940aaJosh Gao#include <set>
237c89f9e955ddd79312113f83cb4c210a68a940aaJosh Gao
24365e4ae74568274ffd692c12fd7285a230d49a67Christopher Ferris#include "utility.h"
25053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown
2620303f856f1f1cdb5af58af0b116b8c598f0ea5cChristopher Ferrisclass Backtrace;
277c89f9e955ddd79312113f83cb4c210a68a940aaJosh Gaoclass BacktraceMap;
2820303f856f1f1cdb5af58af0b116b8c598f0ea5cChristopher Ferris
2920303f856f1f1cdb5af58af0b116b8c598f0ea5cChristopher Ferris// Dumps a backtrace using a format similar to what Dalvik uses so that the result
3020303f856f1f1cdb5af58af0b116b8c598f0ea5cChristopher Ferris// can be intermixed in a bug report.
317c89f9e955ddd79312113f83cb4c210a68a940aaJosh Gaovoid dump_backtrace(int fd, int amfd, BacktraceMap* map, pid_t pid, pid_t tid,
327c89f9e955ddd79312113f83cb4c210a68a940aaJosh Gao                    const std::set<pid_t>& siblings);
33053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown
34365e4ae74568274ffd692c12fd7285a230d49a67Christopher Ferris/* Dumps the backtrace in the backtrace data structure to the log. */
3562ba489ba00a2689d4e257bc178cff87495f99d7Brigid Smithvoid dump_backtrace_to_log(Backtrace* backtrace, log_t* log, const char* prefix);
36365e4ae74568274ffd692c12fd7285a230d49a67Christopher Ferris
37053b865412d1982ad1dc0e840898d82527deeb99Jeff Brown#endif // _DEBUGGERD_BACKTRACE_H
38