Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

The following are examples of sh_calls.d.

This is a simple script to count Bourne shell calls. Here it traces an
example program, Code/Perl/func_abc.sh.

   # sh_calls.d 
   Tracing... Hit Ctrl-C to end.
   ^C
    FILE                   TYPE       NAME                                COUNT
    func_abc.sh            func       func_a                                  1
    func_abc.sh            func       func_b                                  1
    func_abc.sh            func       func_c                                  1
    func_abc.sh            builtin    echo                                    3
    func_abc.sh            cmd        sleep                                   3

While tracing, function func_a() from the program "func_abc.sh" was executed
once, along with func_b() and func_c(). The "echo" builtin was called 3
times, as was the "sleep" command.


The following traced the firefox start script,

   # sh_calls.d 
   Tracing... Hit Ctrl-C to end.
   ^C
    FILE                   TYPE       NAME                                COUNT
    firefox                builtin    .                                       1
    firefox                builtin    break                                   1
    firefox                builtin    exit                                    1
    firefox                builtin    pwd                                     1
    firefox                builtin    test                                    1
    firefox                cmd        /usr/lib/firefox/run-mozilla.sh         1
    run-mozilla.sh         builtin    break                                   1
    run-mozilla.sh         builtin    exit                                    1
    run-mozilla.sh         builtin    return                                  1
    run-mozilla.sh         builtin    shift                                   1
    run-mozilla.sh         builtin    type                                    1
    run-mozilla.sh         cmd        /usr/lib/firefox/firefox-bin            1
    run-mozilla.sh         func       moz_run_program                         1
    run-mozilla.sh         func       moz_test_binary                         1
    firefox                builtin    echo                                    2
    firefox                func       moz_pis_startstop_scripts               2
    firefox                builtin    cd                                      3
    firefox                builtin    export                                  3
    run-mozilla.sh         builtin    export                                  3
    firefox                builtin    :                                       6
    firefox                func       moz_spc_verbose_echo                    6
    run-mozilla.sh         subsh      -                                       9
    firefox                builtin    [                                      18
    firefox                subsh      -                                      20
    run-mozilla.sh         builtin    [                                      20

The firefox start script called run-mozilla.sh, which can be seen both
as a "cmd" call in the above output from the "firefox" script, and as
additionall calls from the "run-mozilla.sh" script.

The builtin called "[" is the test builtin, and was called 20 times by
"run-mozilla.sh" and 18 times by "firefox". The "firefox" script also called
20 subshells.