Skip to content

Show source line numbers for function callsites. #2027

@ITWOI

Description

@ITWOI

Thanks for the excellent tool — it has been extremely helpful in my workflow. I’m wondering whether uftrace can report the source line of each callsite, not just the source line of the callee’s definition.

Consider the following simple workflow:

gcc -o t-abc -g -pg tests/s-abc.c
uftrace record --srcline t-abc
uftrace replay --srcline

This produces output such as:

# DURATION     TID      FUNCTION [SOURCE]
   0.918 us [   5280] | __monstartup();
   0.570 us [   5280] | __cxa_atexit();
            [   5280] | main() { /* tests/s-abc.c:26 */
            [   5280] |   a() { /* tests/s-abc.c:11 */
            [   5280] |     b() { /* tests/s-abc.c:16 */
            [   5280] |       c() { /* tests/s-abc.c:21 */
   1.225 us [   5280] |         getpid();
   1.947 us [   5280] |       } /* c */
   2.500 us [   5280] |     } /* b */
   2.893 us [   5280] |   } /* a */
   3.316 us [   5280] | } /* main */

For example, in the line:

            [   5280] |   a() { /* tests/s-abc.c:11 */

uftrace shows the definition of a() at line 11.
Is it possible for uftrace to also report the callsite location, such as /* tests/s-abc.c:33 */, indicating where a() was invoked within main()?

This would be very useful for understanding call relationships in more complex codebases.

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions