Name

whocalls

Synopsis

    whocalls [options] function program [arguments ...]

Run program with the given arguments. Using facilities of the dynamic loader show which functions call the named function. See also sotruss and truss.

Options

-l wholib

Use wholib instead of the standard who.so Link-Auditing library.

-s

Use the .symtab symbol table in the ELF file for local symbol tables instead of the default .dynsym symbol table. This is more expensive but can provide more detailed stack tracing information.

Example

Show use of write(2) system call:

    $ cat dontpanic.c                       
                     Show program code
    #include <unistd.h>

    int main(void)
    {
            (void) write(1, "Don't panic!\n", 13);
            return 0;
    }
    $ cc dontpanic.c -O -o dontpanic       
                     Compile program
    $ whocalls write dontpanic             
                     Run with whocalls
    write(0x1, 0x80506cc, 0xd)             Output from whocalls
            /export/u/guest/arnold/dontpanic:main+0x14
            /export/u/guest/arnold/dontpanic:_start+0x7a
    Don't panic!Output from dontpanic

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.