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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
|
.\" Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.if n .tr \--
.TH dumpbind 1 "18 Nov 1996"
.SH NAME
dumpbind \- dump the bindings found in a bindings.so.1 output file
.SH SYNOPSIS
.B dumpbind
[
.B -pqsc
]
.I bindings_file
.SH AVAILABILITY
.LP
SUNWosdem
.SH DESCRIPTION
.B dumpbind
parses the output file created by the
.B bindings.so.1
.I Link-Auditing
library and displays a summary of all of the bindings that are
are recorded in it.
.LP
.B bindings.so.1
is a
.I Link-Auditing
library which monitors the bindings of function calls and stores
the data in a common buffer pointed to by BT_OUTPUT. Because this
library tracks procedure calls via the
.I la_pltenter()
.I Link-Auditing
interface this library will record which functions are called as part of
the execution of a program. This differs from the
.B symbindrep
example which performs a static analysis of all of the bindings that are
recorded in a program without actually executing it. Also note that it
is safe to use the same BT_BUFFER for multiple processes running
concurrently. This means that a whole suite of applications can be
run and the interfaces that are used as part of that suite are recorded.
.LP
The
.B bindings.so.1
library is enabled by the setting of the following environment variables.
.LP
.TP 10
.B LD_AUDIT
set this to the value of the bindings.so.1
.I Link-Auditing
library. By setting this environment variable the gathering of
bindings data is enabled.
.TP
.B BT_OUTPUT
set this to the name of the common output buffer which will be maintained
during the data gathering period. If this is not set the
output buffer will default to
.I /tmp/bindings.data.
.TP
.B BT_BINDFROM
a colon separated list of libraries that are to be traced. Only calls from
these libraries will be traced. The default is to trace all calls.
.TP
.B BT_BINDTO
a colon separated list of libraries that are to be traced. Only calls to
these libraries will be traced. The default is to trace all calls.
.SH OPTIONS
.TP 10
.B \-p
display output in parseable format.
.TP
.B \-q
query mutex_locks in bindings buffer and display there current status. This is
when querying a problem with the bindings buffer.
.TP
.B \-c
clear all mutex_locks currently held in the bindings buffer.
.TP
.B \-s
set master mutex_lock in bindings buffer. This will cause any processes
currently using this bindings buffer to hang until the lock is freed.
.TP
.B \-b
print hash bucket usage statistics for the bindings buffer.
.SH EXAMPLES
Here is a sample of gathering data using the
.B bindings.so.1
.I Link-Auditing
library and then the examination of that data with the
.B dumpbind
command.
.LP
.nf
.ft 3
polyslo 131% export BT_OUTPUT=/tmp/bindings.data
polyslo 3563% LD_AUDIT=/opt/SUNWonld/lib/bindings.so.1
polyslo 3564% export LD_AUDIT
polyslo 3565% ls /usr/ccs/bin
admin gprof.flat.blurb nrform strip.orig
ar help prof symorder
ar.orig ld prs tsort
as ld.orig prt unget
cdc lex ranlib unifdef
comb lorder regcmp val
delta m4 rmdel vc
dis make sact what
dump mcs sccs yacc
error mcs.orig sccsdiff yaccpar
get nceucform size
gprof ncform stanswer
gprof.callg.blurb nm strip
polyslo 3566% nm /usr/lib/libdl.so.1
/usr/lib/libdl.so.1:
[Index] Value Size Type Bind Other Shndx Name
...
[27] | 1788| 8|FUNC |GLOB |0 |7 |_dladdr
[32] | 1772| 8|FUNC |GLOB |0 |7 |_dlclose
[44] | 1796| 8|FUNC |GLOB |0 |7 |_dldump
[29] | 1780| 8|FUNC |GLOB |0 |7 |_dlerror
[26] | 1732| 8|FUNC |GLOB |0 |7 |_dlinfo
[17] | 1740| 8|FUNC |LOCL |0 |7 |_dlmap
[24] | 1748| 8|FUNC |GLOB |0 |7 |_dlmopen
[23] | 1756| 8|FUNC |GLOB |0 |7 |_dlopen
[48] | 1764| 8|FUNC |GLOB |0 |7 |_dlsym
[38] | 0| 0|OBJT |GLOB |0 |ABS |_edata
[21] | 1824| 0|OBJT |GLOB |0 |8 |_end
[42] | 1820| 0|OBJT |GLOB |0 |8 |_etext
[30] | 1804| 8|FUNC |GLOB |0 |7 |_ld_concurrency
[34] | 1812| 8|FUNC |GLOB |0 |7 |bind_guard
[47] | 1820| 4|OBJT |GLOB |0 |8 |dbg_mask
[20] | 0| 0|FILE |LOCL |0 |ABS |dl.c
[43] | 1788| 8|FUNC |WEAK |0 |7 |dladdr
[22] | 1772| 8|FUNC |WEAK |0 |7 |dlclose
[31] | 1796| 8|FUNC |WEAK |0 |7 |dldump
[45] | 1780| 8|FUNC |WEAK |0 |7 |dlerror
...
polyslo 136% unset LD_AUDIT
.ft
.fi
.LP
Unsetting LD_AUDIT has turned off the bindings data gathering
and the output can now safely be examined by dumpbind.
.LP
.nf
.ft3
polyslo 3567% unset LD_AUDIT
polyslo 3568% dumpbind /tmp/bindings.data
Bindings Summary Report
Library Symbol Call Count
------------------------------------------------------------------------
/usr/lib/libc.so.1 textdomain 2
/usr/lib/libelf.so.1 elf_kind 1
/usr/lib/libc.so.1 munmap 1
/usr/lib/libc.so.1 strlen 353
/usr/lib/libc.so.1 .urem 3
/usr/lib/libc.so.1 iswprint 444
/usr/lib/libc.so.1 .udiv 11
/usr/lib/libc.so.1 time 1
/usr/lib/libc.so.1 .mul 361
/usr/lib/libc.so.1 closedir 1
/usr/lib/libc.so.1 _rw_read_held 36
/usr/lib/libelf.so.1 elf_strptr 34
/usr/lib/libc.so.1 lstat64 1
/usr/lib/libc.so.1 _realbufend 1203
/usr/lib/libc.so.1 qsort 3
/usr/lib/libc.so.1 _write 64
/usr/lib/libelf.so.1 _elf32_fsize 7
/usr/lib/libc.so.1 close 1
/usr/lib/libelf.so.1 elf_begin 1
/usr/lib/libelf.so.1 elf_version 1
/usr/lib/libc.so.1 _isatty 2
/usr/lib/libc.so.1 mmap 1
/usr/lib/libelf.so.1 elf_end 1
/usr/lib/libc.so.1 printf 628
/usr/lib/libc.so.1 calloc 2
...
/usr/lib/libc.so.1 __flsbuf 511
/usr/lib/libc.so.1 _close 1
/usr/lib/libc.so.1 _doprnt 630
/usr/lib/libc.so.1 ___errno 3
/usr/lib/libc.so.1 .umul 23
/usr/lib/libc.so.1 _thr_main 7
/usr/lib/libc.so.1 open 1
/usr/lib/libc.so.1 _sbrk_unlocked 8
/usr/lib/libc.so.1 mutex_lock 1
/usr/lib/libc.so.1 _setbufend 2
/usr/lib/libc.so.1 sprintf 2
/usr/lib/libc.so.1 setlocale 2
/usr/lib/libelf.so.1 elf_nextscn 15
/usr/lib/ld.so.1 dlsym 2
/usr/lib/libelf.so.1 _elf_getscn 34
/usr/lib/libc.so.1 _sbrk 8
/usr/lib/libc.so.1 _open64 1
/usr/lib/libc.so.1 _mutex_lock 88
/usr/lib/libc.so.1 exit 2
/usr/lib/libc.so.1 ioctl 1
/usr/lib/libc.so.1 getenv 17
/usr/lib/libc.so.1 _mutex_held 36
------------------------------------------------------------------------
Symbol Count: 87 Call Count: 8272
polyslo 3570%
.ft
.fi
.SH SEE ALSO
.BR ld.so.1 (1)
.br
.TZ LLM
.\" Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.if n .tr \--
.TH perfcnt 1 "18 Nov 1996"
.SH NAME
perfcnt \- trace the amount of time spent in each function call
.SH SYNOPSIS
.B perfcnt
[
.B -f
.I bindfromlist
] [
.B t
.I bindtolist
] [
.B -l
.I perfcntlib
] executable [executable arguments ...]
.SH AVAILABILITY
.LP
SUNWosdem
.SH DESCRIPTION
.B perfcnt
executes the specified command and tracks the amount of time
that is spent in each procedure call.
.B perfcnt
traces all of the procedure calls that occur between dynamic objects
via the
.I Procedure Linkage Table, so only those procedure calls which are
bound to the
.I Procedure Linkage Table
will be traced.
.LP
.B perfcnt
has the limitation that it does not work with a threaded program nor
any programs which use procedures which are dependent upon the
stack frame. See
.I NOTES
below
.SH OPTIONS
.TP 10
.BI \-f " bindfromlist"
A colon separated list of libraries that are to be
traced. Only calls from these libraries will be traced. The default
is to trace all calls.
.TP
.BI \-t " bindtolist"
A colon separated list of libraries taht are to be traced.
Only calls to these libraries will be traced. The default is
to trace all calls.
.TP
.BI \-l " perfcntlib"
specify an alternate perfcnt.so
.I Link-Auditing
library to use.
.SH EXAMPLES
The example tracks the usage of the libelf.so.1 library when performing
a nm.
.LP
.nf
.ft 3
% perfcnt -t/usr/lib/libelf.so.1 nm /usr/lib/libc.so.1
/usr/lib/libc.so.1:
[Index] Value Size Type Bind Other Shndx Name
[457] | 0| 0|NOTY |LOCL |0 |UNDEF |
[2] | 148| 0|SECT |LOCL |0 |1 |
[3] | 15232| 0|SECT |LOCL |0 |2 |
[4] | 45120| 0|SECT |LOCL |0 |3 |
[5] | 64024| 0|SECT |LOCL |0 |4 |
\.\.\.
[1893] | 347660| 88|FUNC |LOCL |0 |12 |ypstub_perror
[1895] | 347280| 380|FUNC |LOCL |0 |12 |ypstub_sperror
[714] | 663472| 8|OBJT |LOCL |0 |22 |zero
Perf Counts for: nm
SYMBOL c_count tim avg. tim tot. %
---------------------------------------------------------------------
elf_getscn 1 4.03 4.03 0.01%
elf_kind 1 4.36 4.36 0.01%
_elf32_fsize 7 50.80 7.26 0.09%
_elf32_xlatetom 6 67.47 11.24 0.11%
elf_version 1 72.50 72.50 0.12%
elf32_getshdr 33 77.42 2.35 0.13%
elf_nextscn 33 83.36 2.53 0.14%
elf_end 1 131.91 131.91 0.22%
elf_getdata 2 138.74 69.37 0.23%
elf_begin 1 171.74 171.74 0.29%
elf32_getehdr 1 214.81 214.81 0.36%
_elf_getscn 4254 9755.89 2.29 16.38%
elf_strptr 4254 48784.97 11.47 81.91%
---------------------------------------------------------------------
Total Time: 59557.98
.ft
.fi
.SH NOTES
The
.B perfcnt
command is a demonstration of the
.I Link-Auditing
interface of the run-time linker (which is documented in
.TZ LLM
\), and it is not useful in all environments. This program
will not work with a threaded application and should not be
used with one. Also, in order to track the
time spent in a procedure both the
entry and exit of the procedure must be tracked. Because this causes
an additional stack frame to be created for each procedure call
it is not compatible with all library routines.
More details on this can be found in the
.I Link-Auditing
section of
.TZ LLM
.SH SEE ALSO
.BR ld.so.1 (1)
.br
.TZ LLM
.\" Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.if n .tr \--
.TH symbindrep 1 "18 Nov 1996"
.SH NAME
symbindrep \- report on all symbol bindings required to load this object
.SH SYNOPSIS
.B symbindrep
[
.B -f
.I bindfromlist
] [
.B -t
.I bindtolist
] [
.B -l
.I symbindreplib
]
.I funcname
executable
.SH AVAILABILITY
.LP
SUNWosdem
.SH DESCRIPTION
.B symbindrep
is a simple example of a
.I Link-Auditing
library which reports on the symbol bindings performed by
the run-time linker (ld.so.1) when loading an object.
.B symbindrep
will display all of the symbol bindings that occur
between the executable and all of it's dependencies. After all symbol
bindings have been performed
.B symbindrep
will terminate. No code from the executable is ever executed.
.SH OPTIONS
.TP 10
.BI \-f " bindfromlist"
A colon separated list of libraries that are to be traced. Only symbol
bindings from these libraries will be traced. The default is
to report on all symbol bindings.
.BI \-t " bindtolib"
A colon separated list of libraries that are to be traced. Only symbol
bindings to these libraries will be reported. The default is to trace
all libraries.
.BI \-l " symbindrep"
specify an alternate symbindrep.so
.I Link-Auditing
library to use.
.SH EXAMPLES
This example reports on only the symbol bindings between nm and
libelf.so.1.
.LP
.nf
.ft 3
% symbindrep -t /usr/lib/libelf.so.1 -f nm nm
Symbol Bindings
Referencing Defining
Object Object Symbol
------------------------------------------------------------------
nm /usr/lib/libelf.so.1 elf_version
nm /usr/lib/libelf.so.1 elf_begin
nm /usr/lib/libelf.so.1 elf_errmsg
nm /usr/lib/libelf.so.1 elf_kind
nm /usr/lib/libelf.so.1 elf_end
nm /usr/lib/libelf.so.1 elf32_getehdr
nm /usr/lib/libelf.so.1 elf_getscn
nm /usr/lib/libelf.so.1 elf32_getshdr
nm /usr/lib/libelf.so.1 elf_getdata
nm /usr/lib/libelf.so.1 elf_nextscn
nm /usr/lib/libelf.so.1 elf_getarhdr
nm /usr/lib/libelf.so.1 elf_next
nm /usr/lib/libelf.so.1 elf_strptr
.ft
.fi
.SH SEE ALSO
.BR ld.so.1 (1)
.br
.TZ LLM
|