Bug 207777 - Userspace frames are missing despite -fno-omit-frame-pointer
Summary: Userspace frames are missing despite -fno-omit-frame-pointer
Status: NEW
Alias: None
Product: Tracing/Profiling
Classification: Unclassified
Component: Perf tool (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Arnaldo Carvalho de Melo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-18 15:29 UTC by Konstantin Kharlamov
Modified: 2020-05-18 20:08 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.6.13
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Konstantin Kharlamov 2020-05-18 15:29:17 UTC
# Steps to reproduce (in terms of terminal commands)

    $ gcc test.c -o test -O0 -g3 -fno-omit-frame-pointer
    $ sudo sysctl kernel.sched_schedstats=1
    kernel.sched_schedstats = 1
    $ sudo perf record -e sched:sched_stat_sleep,sched:sched_switch,sched:sched_process_exit -g ./test
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.033 MB perf.data (34 samples) ]
    $ sudo perf script | grep -E "main|\bg\b|\bf\b"

## Expected

Last command should've printed lines that accord to frames inside `main`, `g`, `f` functions

## Actual

No output from the last command
Comment 1 Konstantin Kharlamov 2020-05-18 15:29:55 UTC
Omg, sorry, forgot to put the code in the description

    #include <unistd.h>

    void f() {
        for (size_t i = 0; i < 5; ++i) {
            sleep(1);
        }
    }

    void g() {
        f();
    }

    int main() {
        g();
    }
Comment 2 Konstantin Kharlamov 2020-05-18 15:36:43 UTC
I just remember that there's an alternative way to get stack traces: by using `--callgraph=X`. When that X is dwarf, I get the correct output.

Note You need to log in before you can comment on or make changes to this bug.