Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Format option summary-by-line broken #361

@dgollahon

Description

@dgollahon

Hi,

I was trying to use the summary-by-line format option but I am getting a crash.

sudo rbspy record -- ruby -e 'sleep(1)'

works fine but

sudo rbspy record --format summary-by-line -- ruby -e 'sleep(1)'

results in:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: ErrorInner { kind: ValueValidation, context: [(InvalidArg, String("format")), (InvalidValue, String("summary-by-line"))], message: None, source: Some("The argument 'summary-by-line' isn't a valid value for 'format': Unknown output format: summary-by-line"), help_flag: None, color_when: Never, wait_on_exit: false, backtrace: None }, kind: ValueValidation, info: ["format", "summary-by-line", "The argument 'summary-by-line' isn't a valid value for 'format': Unknown output format: summary-by-line"] }', src/main.rs:399:89
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here's the trace from RUST_BACKTRACE=1:

stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: rbspy::main

and the backtrace from RUST_BACKTRACE=full:

stack backtrace:
   0:        0x104a8db4c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd6a6e3b094c481b1
   1:        0x104aa6364 - core::fmt::write::h55deb439a2fa505d
   2:        0x104a7c5f8 - std::io::Write::write_fmt::hdd0ccc220f7ec3f7
   3:        0x104a853b8 - std::panicking::default_hook::{{closure}}::haecbbf48cd1ad553
   4:        0x104a84fc0 - std::panicking::default_hook::hdf33d6d87b6673e5
   5:        0x104a85890 - std::panicking::rust_panic_with_hook::ha19270fc750e5dcf
   6:        0x104a8df78 - std::panicking::begin_panic_handler::{{closure}}::h520977148193b087
   7:        0x104a8dc70 - std::sys_common::backtrace::__rust_end_short_backtrace::h563c939a775416b3
   8:        0x104a8544c - _rust_begin_unwind
   9:        0x104ac0880 - core::panicking::panic_fmt::h0908dd8514c30916
  10:        0x104ac0d4c - core::result::unwrap_failed::ha509accbcac71268
  11:        0x10487d89c - rbspy::main::haff1507f9ee6a7f1
  12:        0x10488a190 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23bd3a683d67c68b
  13:        0x10488d260 - std::rt::lang_start::{{closure}}::h71d3f4d77e40655e
  14:        0x104a78390 - std::rt::lang_start_internal::hdb95dc8049556d44
  15:        0x1048897fc - _main

I thought I must have had some kind of typo but when I deliberately introduce a typo:

sudo rbspy record --format summary-by-lineX -- ruby -e 'sleep(1)'

I get this helpful output instead:

error: "summary-by-lineX" isn't a valid value for '--format <FORMAT>'
	[possible values: flamegraph, collapsed, callgrind, speedscope, pprof, summary, summary-by-line]

	Did you mean "summary-by-line"?

USAGE:
    rbspy record --pid <PID> --format <FORMAT> <cmd>...

For more information try --help

rbspy --version: rbspy 0.12.0

I am on a 2022 M1 mac running Monterey, installed rbspy via brew.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions