flamegraph: Random/intermittent "Input data ends in the middle of a stack." error on Windows with softbuffer

I am trying to profile a softbuffer application, because I have to implement my own color blending (among other things). I’m using flamegraph directly like so:

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04-WSL2\home\logandark> flamegraph -- .\.cargo\target\x86_64-pc-windows-gnu\release\application.exe
Error: unable to collapse generated profile data

Caused by:
    Input data ends in the middle of a stack.

due to cargo being unable to run a normal build in Windows-land because of the WSL filesystem.

If I go through the work (and look up the command -_-) to set up a CARGO_TARGET_DIR to run cargo flamegraph in Windows-land, it completes successfully:

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04-WSL2\home\logandark\CLionProjects\application> New-Item -Name 'CARGO_TARGET_DIR' -Value 'C:\Users\LoganDark\.cargo\target' -ItemType Variable -Path Env: -Force

Name                           Value
----                           -----
CARGO_TARGET_DIR               C:\Users\LoganDark\.cargo\target


PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04-WSL2\home\logandark\CLionProjects\application> cargo flamegraph
WARNING: profiling without debuginfo. Enable symbol information by adding the following lines to Cargo.toml:

[profile.release]
debug = true

Or set this environment variable:

CARGO_PROFILE_RELEASE_DEBUG=true

writing flamegraph to "flamegraph.svg"

I’m like 99% sure this is because the exe I was trying to use before was cross-compiled by mingw on WSL.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Published 0.6.3.

@Bjohnson131 I don’t think 6.2 includes the change that closed this. Could you check if cargo-flamegraph manually built from the latest commit fixes the problem?