最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论