https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89273
Bug ID: 89273 Summary: Count inlined functions in skip parm for backtrace_full and backtrace_print Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libbacktrace Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org CC: ian at gcc dot gnu.org Target Milestone: --- [ Proposed here: https://gcc.gnu.org/ml/gcc-patches/2019-02/msg00579.html ] The btest test-case modified like this: ... diff --git a/libbacktrace/btest.c b/libbacktrace/btest.c index b1c2a2a860d..0925882aed1 100644 --- a/libbacktrace/btest.c +++ b/libbacktrace/btest.c @@ -140,7 +140,7 @@ f13 (int f1line, int f2line) data.failed = 0; f3line = __LINE__ + 1; - i = backtrace_full (state, 0, callback_one, error_callback_one, &data); + i = backtrace_full (state, 1, callback_one, error_callback_one, &data); if (i != 0) { @@ -148,9 +148,9 @@ f13 (int f1line, int f2line) data.failed = 1; } - check ("test2", 0, all, f3line, "f13", "btest.c", &data.failed); - check ("test2", 1, all, f2line, "f12", "btest.c", &data.failed); - check ("test2", 2, all, f1line, "test2", "btest.c", &data.failed); + //check ("test2", 0, all, f3line, "f13", "btest.c", &data.failed); + check ("test2", 0, all, f2line, "f12", "btest.c", &data.failed); + check ("test2", 1, all, f1line, "test2", "btest.c", &data.failed); printf ("%s: backtrace_full inline\n", data.failed ? "FAIL" : "PASS"); ... fails like this: ... PASS: backtrace_full noinline test2: [0]: got ../csu/libc-start.c expected btest.c test2: [0]: got 308 expected 126 test2: [0]: got __libc_start_main expected f12 FAIL: backtrace_full inline PASS: backtrace_simple noinline PASS: backtrace_simple inline PASS: backtrace_syminfo variable ... This is expected behaviour: "SKIP is the number of frames to skip", so the inline functions don't count. But arguably, it would be more intuitive if the skip parameter matched the reduction in number of callbacks in backtrace_full.