]> git.saurik.com Git - apple/libdispatch.git/blame_incremental - tools/voucher_trace.d
libdispatch-913.30.4.tar.gz
[apple/libdispatch.git] / tools / voucher_trace.d
... / ...
CommitLineData
1#!/usr/sbin/dtrace -s
2
3/*
4 * Copyright (c) 2017 Apple Inc. All rights reserved.
5 *
6 * @APPLE_APACHE_LICENSE_HEADER_START@
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 * @APPLE_APACHE_LICENSE_HEADER_END@
21 */
22
23/*
24 * Usage: voucher_trace.d -p [pid]
25 * traced process must have been executed with
26 * DYLD_LIBRARY_PATH=/usr/lib/system/introspection or with
27 * DYLD_IMAGE_SUFFIX=_profile or DYLD_IMAGE_SUFFIX=_debug
28 */
29
30#pragma D option quiet
31#pragma D option zdefs
32#pragma D option bufsize=16m
33
34BEGIN {
35 printf("Starting to trace voucher operations...\n");
36}
37
38voucher$target:libdispatch*.dylib::create
39{
40 printf("ALLOC voucher 0x%p, thread %#llx, ref 1, port %#x, aid %#llx", arg0, tid, arg1, arg2);
41 ustack(10);
42 printf("\n")
43}
44
45voucher$target:libdispatch*.dylib::dispose
46{
47 printf("FREE voucher 0x%p, thread %#llx, ref 0", arg0, tid);
48 ustack(10);
49 printf("\n")
50}
51
52voucher$target:libdispatch*.dylib::retain
53{
54 printf("RETAIN voucher 0x%p, thread %#llx, ref %d", arg0, tid, arg1);
55 ustack(10);
56 printf("\n")
57}
58
59voucher$target:libdispatch*.dylib::release
60{
61 printf("RELEASE voucher 0x%p, thread %#llx, ref %d", arg0, tid, arg1);
62 ustack(10);
63 printf("\n")
64}
65
66voucher$target:libdispatch*.dylib::adopt
67{
68 printf("ADOPT voucher 0x%p, thread %#llx", arg0, tid);
69 ustack(10);
70 printf("\n")
71}
72
73voucher$target:libdispatch*.dylib::orphan
74{
75 printf("ORPHAN voucher 0x%p, thread %#llx", arg0, tid);
76 ustack(10);
77 printf("\n")
78}