Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 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 __CUTILS_DEBUGGER_H |
| 18 | #define __CUTILS_DEBUGGER_H |
| 19 | |
Christopher Ferris | 9774df6 | 2015-01-15 14:47:36 -0800 | [diff] [blame] | 20 | #include <sys/cdefs.h> |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 21 | #include <sys/types.h> |
| 22 | |
Josh Gao | 9c02dc5 | 2016-06-15 17:29:00 -0700 | [diff] [blame] | 23 | #include "debuggerd/client.h" |
| 24 | |
Christopher Ferris | 9774df6 | 2015-01-15 14:47:36 -0800 | [diff] [blame] | 25 | __BEGIN_DECLS |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 26 | |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 27 | /* 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 | */ |
| 31 | int dump_tombstone(pid_t tid, char* pathbuf, size_t pathlen); |
| 32 | |
Christopher Ferris | fa41e0f | 2015-01-13 19:07:12 -0800 | [diff] [blame] | 33 | /* 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 | */ |
| 39 | int dump_tombstone_timeout(pid_t tid, char* pathbuf, size_t pathlen, int timeout_secs); |
| 40 | |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 41 | /* Dumps a process backtrace only to the specified file (requires root). |
| 42 | * Returns 0 on success, -1 on error. |
| 43 | */ |
| 44 | int dump_backtrace_to_file(pid_t tid, int fd); |
| 45 | |
Christopher Ferris | fa41e0f | 2015-01-13 19:07:12 -0800 | [diff] [blame] | 46 | /* 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 | */ |
| 51 | int dump_backtrace_to_file_timeout(pid_t tid, int fd, int timeout_secs); |
| 52 | |
Christopher Ferris | 9774df6 | 2015-01-15 14:47:36 -0800 | [diff] [blame] | 53 | __END_DECLS |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 54 | |
| 55 | #endif /* __CUTILS_DEBUGGER_H */ |