blob: 3734a5022470f9bd704d0e246b88f12777d45a6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
#
# Copyright (C) 2006 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)
#
# To update:
#
# git remote add strace git://git.code.sf.net/p/strace/code
# git fetch strace
# git merge strace/master
# mm -j32
# # (Make any necessary Android.mk changes and test the new strace.)
# git push aosp HEAD:master # Push directly, avoiding gerrit.
# git push aosp HEAD:refs/for/master # Push to gerrit.
#
# # Now commit any necessary Android.mk changes like normal:
# repo start post-sync .
# git commit -a
#
# -------------------------------------------------------------------------
strace_version := $(shell grep Version $(LOCAL_PATH)/strace.spec | cut -d " " -f 2)
strace_SOURCES := \
aio.c \
bjm.c \
block.c \
count.c \
desc.c \
fanotify.c \
file.c \
inotify.c \
io.c \
ioctl.c \
ioprio.c \
ipc.c \
kexec.c \
keyctl.c \
ldt.c \
loop.c \
mem.c \
mtd.c \
net.c \
pathtrace.c \
process.c \
ptp.c \
quota.c \
reboot.c \
resource.c \
scsi.c \
signal.c \
sock.c \
strace.c \
stream.c \
syscall.c \
system.c \
term.c \
time.c \
util.c \
vsprintf.c \
common_cflags := \
-DGETGROUPS_T=gid_t \
-DHAVE_ASM_SIGCONTEXT_H=1 \
-DHAVE_DECL_PTRACE_EVENT_FORK=1 \
-DHAVE_DECL_PTRACE_EVENT_VFORK=1 \
-DHAVE_DECL_PTRACE_EVENT_CLONE=1 \
-DHAVE_DECL_PTRACE_EVENT_EXEC=1 \
-DHAVE_DECL_PTRACE_EVENT_VFORK_DONE=1 \
-DHAVE_DECL_PTRACE_EVENT_EXIT=1 \
-DHAVE_DECL_PTRACE_GETEVENTMSG=1 \
-DHAVE_DECL_PTRACE_GETSIGINFO=1 \
-DHAVE_DECL_PTRACE_O_TRACECLONE=1 \
-DHAVE_DECL_PTRACE_O_TRACEEXEC=1 \
-DHAVE_DECL_PTRACE_O_TRACEEXIT=1 \
-DHAVE_DECL_PTRACE_O_TRACEFORK=1 \
-DHAVE_DECL_PTRACE_O_TRACESYSGOOD=1 \
-DHAVE_DECL_PTRACE_O_TRACEVFORK=1 \
-DHAVE_DECL_PTRACE_SETOPTIONS=1 \
-UHAVE_DECL_IO_CMD_PWRITE \
-UHAVE_DECL_IO_CMD_PWRITEV \
-UHAVE_DECL_LO_FLAGS_AUTOCLEAR \
-UHAVE_DECL_LO_FLAGS_PARTSCAN \
-DHAVE_DECL_SYS_ERRLIST=1 \
-DHAVE_ELF_H=1 \
-DHAVE_FORK=1 \
-DHAVE_IF_INDEXTONAME=1 \
-DHAVE_INET_NTOP=1 \
-DHAVE_LINUX_CAPABILITY_H=1 \
-DHAVE_LINUX_ICMP_H=1 \
-DHAVE_LINUX_IF_PACKET_H=1 \
-DHAVE_LINUX_IN6_H=1 \
-DHAVE_LINUX_NETLINK_H=1 \
-DHAVE_LITTLE_ENDIAN_LONG_LONG=1 \
-DHAVE_LONG_LONG=1 \
-DHAVE_NETINET_TCP_H=1 \
-DHAVE_NETINET_UDP_H=1 \
-DHAVE_POLL_H=1 \
-DHAVE_PRCTL=1 \
-DHAVE_SENDMSG=1 \
-DHAVE_SIGACTION=1 \
-DHAVE_SIGINFO_T=1 \
-DHAVE_SIG_ATOMIC_T=1 \
-DHAVE_STATFS64=1 \
-DHAVE_STDBOOL_H=1 \
-DHAVE_STRERROR=1 \
-DHAVE_STRUCT_FLOCK64=1 \
-DHAVE_STRUCT_MSGHDR_MSG_CONTROL=1 \
-DHAVE_STRUCT_SIGCONTEXT=1 \
-DHAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD=1 \
-DHAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID=1 \
-DHAVE_STRUCT_STAT_ST_BLKSIZE=1 \
-DHAVE_STRUCT_STAT_ST_BLOCKS=1 \
-DHAVE_STRUCT_STAT_ST_RDEV=1 \
-DHAVE_STRUCT_USER_DESC=1 \
-DHAVE_SYS_EPOLL_H=1 \
-DHAVE_SYS_IOCTL_H=1 \
-DHAVE_SYS_POLL_H=1 \
-DHAVE_SYS_REG_H=1 \
-DHAVE_SYS_VFS_H=1 \
-DMAJOR_IN_SYSMACROS \
-DPACKAGE_NAME='"strace"' \
-DVERSION='"$(strace_version)"' \
-DSIZEOF_OFF_T=SIZEOF_LONG \
-DSIZEOF_LONG_LONG=8 \
-DSTDC_HEADERS=1 \
-DSTRACE_KNOWS_ONLY_EABI=1 \
-D_LFS64_LARGEFILE=1 \
common_cflags += -D_GNU_SOURCE=1 -D_POSIX_SOURCE=1
common_cflags_32 += -DSIZEOF_LONG=4 -DSIZEOF_RLIM_T=4 -DHAVE_STAT64=1
common_cflags_64 += -DSIZEOF_LONG=8 -DSIZEOF_RLIM_T=8
common_cflags_arm += -DARM=1
common_cflags_arm += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
common_cflags_arm64 += -DAARCH64=1
common_cflags_mips += -DMIPS=1
common_cflags_mips += -DHAVE_ASM_SYSMIPS_H=1
common_cflags_x86 += -DI386=1
common_cflags_x86 += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
common_cflags_x86_64 += -DX86_64=1
common_cflags += \
-Wall \
-Wno-missing-field-initializers \
-Wno-unused-parameter \
-Wno-sign-compare \
common_c_includes := \
$(LOCAL_PATH)/linux
common_c_includes_arm := $(LOCAL_PATH)/linux/arm
common_c_includes_arm64 := $(LOCAL_PATH)/linux/aarch64
common_c_includes_mips := $(LOCAL_PATH)/linux/mips
common_c_includes_mips64 := $(LOCAL_PATH)/linux/mips
common_c_includes_x86 := $(LOCAL_PATH)/linux/i386
common_c_includes_x86_64 := $(LOCAL_PATH)/linux/x86_64
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(strace_SOURCES)
LOCAL_CFLAGS := $(common_cflags)
LOCAL_CFLAGS_32 := $(common_cflags_32)
LOCAL_CFLAGS_64 := $(common_cflags_64)
LOCAL_CFLAGS_arm := $(common_cflags_arm)
LOCAL_CFLAGS_arm64 := $(common_cflags_arm64)
LOCAL_CFLAGS_mips := $(common_cflags_mips)
LOCAL_CFLAGS_x86 := $(common_cflags_x86)
LOCAL_CFLAGS_x86_64 := $(common_cflags_x86_64)
LOCAL_SHARED_LIBRARIES :=
LOCAL_MODULE := strace
LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_C_INCLUDES_arm := $(common_c_includes_arm)
LOCAL_C_INCLUDES_arm64 := $(common_c_includes_arm64)
LOCAL_C_INCLUDES_mips := $(common_c_includes_mips)
LOCAL_C_INCLUDES_mips64 := $(common_c_includes_mips64)
LOCAL_C_INCLUDES_x86 := $(common_c_includes_x86)
LOCAL_C_INCLUDES_x86_64 := $(common_c_includes_x86_64)
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(strace_SOURCES)
LOCAL_CFLAGS := $(common_cflags)
LOCAL_CFLAGS_32 := $(common_cflags_32)
LOCAL_CFLAGS_64 := $(common_cflags_64)
LOCAL_CFLAGS_arm := $(common_cflags_arm)
LOCAL_CFLAGS_arm64 := $(common_cflags_arm64)
LOCAL_CFLAGS_mips := $(common_cflags_mips)
LOCAL_CFLAGS_x86 := $(common_cflags_x86)
LOCAL_CFLAGS_x86_64 := $(common_cflags_x86_64)
LOCAL_MODULE := strace_static
LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_C_INCLUDES_arm := $(common_c_includes_arm)
LOCAL_C_INCLUDES_arm64 := $(common_c_includes_arm64)
LOCAL_C_INCLUDES_mips := $(common_c_includes_mips)
LOCAL_C_INCLUDES_mips64 := $(common_c_includes_mips64)
LOCAL_C_INCLUDES_x86 := $(common_c_includes_x86)
LOCAL_C_INCLUDES_x86_64 := $(common_c_includes_x86_64)
LOCAL_MODULE_STEM := strace
LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities
LOCAL_MODULE_TAGS := eng
LOCAL_STATIC_LIBRARIES := libc
LOCAL_FORCE_STATIC_EXECUTABLE := true
include $(BUILD_EXECUTABLE)
# -------------------------------------------------------------------------
.PHONY: update-ioctls
update-ioctls:
# Build the generated .h files needed by ioctlsort from the current bionic uapi headers.
cd external/strace; ./linux/ioctlent.sh ../../bionic/libc/kernel/uapi/
# Build the ioctlsort tool.
ONE_SHOT_MAKEFILE=external/strace/Android.mk make -f build/core/main.mk $(TARGET_OUT_EXECUTABLES)/ioctlsort
# Remove the generated .h files now we've built ioctlsort.
rm external/strace/ioctls.h external/strace/ioctldefs.h
# Run the ioctlsort tool on the target to generate the one file we do want to check in.
adb sync
adb shell ioctlsort | tr -d '\r' > external/strace/linux/ioctlent.h
# Rebuild strace with the new "ioctlent.h".
ONE_SHOT_MAKEFILE=external/strace/Android.mk make -f build/core/main.mk
# We don't build ioctlsort unless really necessary, because we don't check
# in the temporary files needed to build it. This tool is only necessary
# when updating strace's list of ioctls.
ifneq (,$(filter $(TARGET_OUT_EXECUTABLES)/ioctlsort,$(MAKECMDGOALS)))
include $(CLEAR_VARS)
LOCAL_SRC_FILES := linux/ioctlsort.c
LOCAL_CFLAGS += -include asm/types.h -include linux/ashmem.h
LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_MODULE := ioctlsort
LOCAL_MODULE_TAGS := optional
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_EXECUTABLE)
endif
# -------------------------------------------------------------------------
include $(LOCAL_PATH)/test/Android.mk
|