The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | /* system/debuggerd/utility.h |
| 2 | ** |
| 3 | ** Copyright 2008, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
Jeff Brown | 13e715b | 2011-10-21 12:14:56 -0700 | [diff] [blame] | 18 | #ifndef _DEBUGGERD_UTILITY_H |
| 19 | #define _DEBUGGERD_UTILITY_H |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 20 | |
| 21 | #include <stddef.h> |
| 22 | #include <stdbool.h> |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 23 | |
| 24 | typedef struct { |
| 25 | /* tombstone file descriptor */ |
| 26 | int tfd; |
| 27 | /* if true, does not log anything to the Android logcat */ |
| 28 | bool quiet; |
| 29 | } log_t; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 30 | |
Jeff Brown | 13e715b | 2011-10-21 12:14:56 -0700 | [diff] [blame] | 31 | /* Log information onto the tombstone. */ |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 32 | void _LOG(log_t* log, bool in_tombstone_only, const char *fmt, ...) |
Jeff Brown | 13e715b | 2011-10-21 12:14:56 -0700 | [diff] [blame] | 33 | __attribute__ ((format(printf, 3, 4))); |
Andy McFadden | 136dcc5 | 2011-09-22 16:37:06 -0700 | [diff] [blame] | 34 | |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 35 | #define LOG(fmt...) _LOG(NULL, 0, fmt) |
David 'Digit' Turner | 2c25991 | 2011-01-26 15:11:04 +0100 | [diff] [blame] | 36 | |
| 37 | /* Set to 1 for normal debug traces */ |
Bruce Beare | 8492490 | 2010-10-13 14:21:30 -0700 | [diff] [blame] | 38 | #if 0 |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 39 | #define XLOG(fmt...) _LOG(NULL, 0, fmt) |
Bruce Beare | 8492490 | 2010-10-13 14:21:30 -0700 | [diff] [blame] | 40 | #else |
| 41 | #define XLOG(fmt...) do {} while(0) |
| 42 | #endif |
| 43 | |
David 'Digit' Turner | 2c25991 | 2011-01-26 15:11:04 +0100 | [diff] [blame] | 44 | /* Set to 1 for chatty debug traces. Includes all resolved dynamic symbols */ |
| 45 | #if 0 |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 46 | #define XLOG2(fmt...) _LOG(NULL, 0, fmt) |
David 'Digit' Turner | 2c25991 | 2011-01-26 15:11:04 +0100 | [diff] [blame] | 47 | #else |
| 48 | #define XLOG2(fmt...) do {} while(0) |
| 49 | #endif |
| 50 | |
Jeff Brown | 053b865 | 2012-06-06 16:25:03 -0700 | [diff] [blame] | 51 | int wait_for_signal(pid_t tid, int* total_sleep_time_usec); |
| 52 | void wait_for_stop(pid_t tid, int* total_sleep_time_usec); |
Jeff Brown | 13e715b | 2011-10-21 12:14:56 -0700 | [diff] [blame] | 53 | |
| 54 | #endif // _DEBUGGERD_UTILITY_H |