blob: 8d31e5edfd18b4e8161c34d2f676b5f173576dd5 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001/* 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 Brown13e715b2011-10-21 12:14:56 -070018#ifndef _DEBUGGERD_UTILITY_H
19#define _DEBUGGERD_UTILITY_H
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080020
21#include <stddef.h>
22#include <stdbool.h>
Jeff Brown053b8652012-06-06 16:25:03 -070023
24typedef struct {
25 /* tombstone file descriptor */
26 int tfd;
Christopher Tateded2e5a2013-03-19 13:12:23 -070027 /* Activity Manager socket file descriptor */
28 int amfd;
29 /* if true, does not log anything to the Android logcat or Activity Manager */
Jeff Brown053b8652012-06-06 16:25:03 -070030 bool quiet;
31} log_t;
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080032
Jeff Brown13e715b2011-10-21 12:14:56 -070033/* Log information onto the tombstone. */
Jeff Brown053b8652012-06-06 16:25:03 -070034void _LOG(log_t* log, bool in_tombstone_only, const char *fmt, ...)
Jeff Brown13e715b2011-10-21 12:14:56 -070035 __attribute__ ((format(printf, 3, 4)));
Andy McFadden136dcc52011-09-22 16:37:06 -070036
Jeff Brown053b8652012-06-06 16:25:03 -070037#define LOG(fmt...) _LOG(NULL, 0, fmt)
David 'Digit' Turner2c259912011-01-26 15:11:04 +010038
39/* Set to 1 for normal debug traces */
Bruce Beare84924902010-10-13 14:21:30 -070040#if 0
Jeff Brown053b8652012-06-06 16:25:03 -070041#define XLOG(fmt...) _LOG(NULL, 0, fmt)
Bruce Beare84924902010-10-13 14:21:30 -070042#else
43#define XLOG(fmt...) do {} while(0)
44#endif
45
David 'Digit' Turner2c259912011-01-26 15:11:04 +010046/* Set to 1 for chatty debug traces. Includes all resolved dynamic symbols */
47#if 0
Jeff Brown053b8652012-06-06 16:25:03 -070048#define XLOG2(fmt...) _LOG(NULL, 0, fmt)
David 'Digit' Turner2c259912011-01-26 15:11:04 +010049#else
50#define XLOG2(fmt...) do {} while(0)
51#endif
52
Jeff Brown053b8652012-06-06 16:25:03 -070053int wait_for_signal(pid_t tid, int* total_sleep_time_usec);
54void wait_for_stop(pid_t tid, int* total_sleep_time_usec);
Jeff Brown13e715b2011-10-21 12:14:56 -070055
56#endif // _DEBUGGERD_UTILITY_H