@@ -32,9 +32,11 @@ RECORD OPTIONS
32
32
Implies \- -srcline. See * ARGUMENTS* .
33
33
34
34
-P * FUNC* , \- -patch=* FUNC*
35
- : Patch FUNC dynamically. This is only applicable binaries built by
36
- gcc with ` -pg -mfentry -mnop-mcount ` or clang with ` -fxray-instrument ` .
37
- This option can be used more than once. See * DYNAMIC TRACING* .
35
+ : Patch FUNC dynamically. This option can be used more than once.
36
+ See * DYNAMIC TRACING* .
37
+
38
+ -Z * SIZE* , \- -size-filter=* SIZE*
39
+ : Patch functions bigger than SIZE bytes dynamically. See * DYNAMIC TRACING* .
38
40
39
41
-E * EVENT* , \- -event=* EVENT*
40
42
: Enable event tracing. The event should be available on the system.
@@ -541,19 +543,25 @@ normally you need to build the target program with `-pg` (or
541
543
funtions call ` mcount() ` .
542
544
543
545
With dynamic tracing, you can trace specific functions only given by the
544
- ` -P ` /` --patch ` option. However you need to add some more compiler (gcc) options
545
- when building the target program. The gcc 5.1 or more recent versions provide
546
- ` -mfentry ` and ` -mnop-mcount ` options which add instrumentation code (i.e.
547
- calling ` mcount() ` function) at the very beginning of a function and convert
548
- the instruction to a NOP. Then it has almost zero performance overhead when
549
- running in a normal condition. The uftrace can convert it back to call
550
- ` mcount() ` if users want to (using ` -P ` option).
551
-
552
- The following example shows a error message when normally running uftrace with
553
- the excutable built with ` -pg -mfentry -mnop-mcount ` . Because the binary doesn't
554
- call any instrumentation code (i.e. 'mcount').
555
-
556
- $ gcc -o abc -pg -mfentry -mnop-mcount tests/s-abc.c
546
+ ` -P ` /` --patch ` option. With capstone disassembly engine you even don't need to
547
+ (re)compile the target with the option above. Now uftrace can analyze the
548
+ instructions and (if possible) it can copy them to a different place and rewrite
549
+ it to call ` mcount() ` function) so that it can be traced by uftrace. After that
550
+ the control is passed to the copied instructions and then returned back to the
551
+ remaining instructions.
552
+
553
+ If the capstone is not available, you need to add some more compiler (gcc)
554
+ options when building the target program. The gcc 5.1 or more recent versions
555
+ provide ` -mfentry ` and ` -mnop-mcount ` options which add instrumentation code
556
+ (i.e. calling ` mcount() ` function) at the very beginning of a function and
557
+ convert the instruction to a NOP. Then it has almost zero performance overhead
558
+ when running in a normal condition. The uftrace can selectively convert it
559
+ back to call ` mcount() ` using ` -P ` option.
560
+
561
+ The following example shows an error message when normally running uftrace.
562
+ Because the binary doesn't call any instrumentation code (i.e. 'mcount').
563
+
564
+ $ gcc -o abc tests/s-abc.c
557
565
$ uftrace abc
558
566
uftrace: /home/namhyung/project/uftrace/cmd-record.c:1305:check_binary
559
567
ERROR: Can't find 'mcount' symbol in the 'abc'.
@@ -568,8 +576,8 @@ trace `a()`.
568
576
# DURATION TID FUNCTION
569
577
0.923 us [19379] | a();
570
578
571
- In addition, you can enable all functions at load time using '.' that matches to
572
- any character in a regex pattern with ` P ` option.
579
+ In addition, you can enable all functions using '.' (for glob, ' * ') that
580
+ matches to any character in a regex pattern with ` P ` option.
573
581
574
582
$ uftrace record --no-libcall -P . abc
575
583
$ uftrace replay
0 commit comments