blob: 20e8796b731ebce0deccf8ed605c6816123f7acd [file] [log] [blame]
Jeff Brown053b8652012-06-06 16:25:03 -07001/*
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 __CUTILS_DEBUGGER_H
18#define __CUTILS_DEBUGGER_H
19
Christopher Ferris9774df62015-01-15 14:47:36 -080020#include <sys/cdefs.h>
Jeff Brown053b8652012-06-06 16:25:03 -070021#include <sys/types.h>
22
Josh Gao9c02dc52016-06-15 17:29:00 -070023#include "debuggerd/client.h"
24
Christopher Ferris9774df62015-01-15 14:47:36 -080025__BEGIN_DECLS
Jeff Brown053b8652012-06-06 16:25:03 -070026
Jeff Brown053b8652012-06-06 16:25:03 -070027/* Dumps a process backtrace, registers, and stack to a tombstone file (requires root).
28 * Stores the tombstone path in the provided buffer.
29 * Returns 0 on success, -1 on error.
30 */
31int dump_tombstone(pid_t tid, char* pathbuf, size_t pathlen);
32
Christopher Ferrisfa41e0f2015-01-13 19:07:12 -080033/* Dumps a process backtrace, registers, and stack to a tombstone file (requires root).
34 * Stores the tombstone path in the provided buffer.
35 * If reading debugger data from debuggerd ever takes longer than timeout_secs
36 * seconds, then stop and return an error.
37 * Returns 0 on success, -1 on error.
38 */
39int dump_tombstone_timeout(pid_t tid, char* pathbuf, size_t pathlen, int timeout_secs);
40
Jeff Brown053b8652012-06-06 16:25:03 -070041/* Dumps a process backtrace only to the specified file (requires root).
42 * Returns 0 on success, -1 on error.
43 */
44int dump_backtrace_to_file(pid_t tid, int fd);
45
Christopher Ferrisfa41e0f2015-01-13 19:07:12 -080046/* Dumps a process backtrace only to the specified file (requires root).
47 * If reading debugger data from debuggerd ever takes longer than timeout_secs
48 * seconds, then stop and return an error.
49 * Returns 0 on success, -1 on error.
50 */
51int dump_backtrace_to_file_timeout(pid_t tid, int fd, int timeout_secs);
52
Christopher Ferris9774df62015-01-15 14:47:36 -080053__END_DECLS
Jeff Brown053b8652012-06-06 16:25:03 -070054
55#endif /* __CUTILS_DEBUGGER_H */