dwarf - How to get Rust debuginfo to include full filepaths? - Stack Overflow

Even when building with the default development profile (cargo build), the generated debuginfo often on

Even when building with the default development profile (cargo build), the generated debuginfo often only includes the last segment of paths to source files. This then affects the output of perf, where it only gives me the bare filename in its perf script output. How can I get the full filepaths to be emitted in the debuginfo?

For example, if I run

❯ eu-readelf -w target/debug/mybinary | rg parse.rs

The output looks like this (only a piece of it since it's very long):

                 decl_file            (data1) parse.rs (16)
               decl_file            (data1) parse.rs (16)
               call_file            (data1) parse.rs (16)
                     decl_file            (data1) parse.rs (18)
                       decl_file            (data1) parse.rs (18)
                         decl_file            (data1) parse.rs (18)
                           decl_file            (data1) parse.rs (18)
                           decl_file            (data1) parse.rs (18)

Or, if I instead grep for main.rs, I get a bunch of results that are just main.rs like above, although there are also a few paths like src/main.rs/@/ followed by a long string of arbitrary alphanumeric characters.

Even when building with the default development profile (cargo build), the generated debuginfo often only includes the last segment of paths to source files. This then affects the output of perf, where it only gives me the bare filename in its perf script output. How can I get the full filepaths to be emitted in the debuginfo?

For example, if I run

❯ eu-readelf -w target/debug/mybinary | rg parse.rs

The output looks like this (only a piece of it since it's very long):

                 decl_file            (data1) parse.rs (16)
               decl_file            (data1) parse.rs (16)
               call_file            (data1) parse.rs (16)
                     decl_file            (data1) parse.rs (18)
                       decl_file            (data1) parse.rs (18)
                         decl_file            (data1) parse.rs (18)
                           decl_file            (data1) parse.rs (18)
                           decl_file            (data1) parse.rs (18)

Or, if I instead grep for main.rs, I get a bunch of results that are just main.rs like above, although there are also a few paths like src/main.rs/@/ followed by a long string of arbitrary alphanumeric characters.

Share Improve this question asked Mar 3 at 17:42 CamelidCamelid 1,5951 gold badge12 silver badges22 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The fix turns out to be passing --full-source-path to perf script.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745080076a4610071.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信