japaric / cargo-call-stack

Whole program static stack analysis
Apache License 2.0
579 stars 52 forks source link

failed to parse .ll file #16

Closed kornelski closed 5 years ago

kornelski commented 5 years ago

When I run

cargo +nightly call-stack --bin my-binary

I get:

error: BUG: failed to parse .ll file; please submit a bug report. Details: Error(Code(CompleteStr("…

followed by 177 megabytes of code. Pasting that much into a bug report probably wouldn't be helpful. Besides, this project contains some proprietary code, so I'm not allowed to disclose all of it.

Perhaps you could change this error case to quote the unparsable input more precisely?

apmanol commented 5 years ago

Same issue here:

$rustc --version rustc 1.34.0 (91856ed52 2019-04-10)

$cargo call-stack --version cargo-call-stack 0.1.3

Error: BUG: failed to parse .ll file; please submit a bug report. Details:
Error(Code(CompleteStr("define internal fastcc void @_ZN7funcmod7funcmod17h4d3d2f225276ade8E(%\"core::result::Result<(),  

...........  +23MB of code
vi commented 5 years ago

One more similar 20MB report: https://vi-server.org/pub/ccs_bugreport.xz

jleni commented 5 years ago

are there any updates or workarounds with respect to this issue?

jleni commented 5 years ago

just in case this is useful, I have this problem even with cortex-m-examples such as fn.rs

cargo +nightly call-stack --example fn > cg.dot

Output:

error: BUG: failed to parse .ll file; please submit a bug report. Details:
Error(Code(CompleteStr("define void @main() unnamed_addr #1 !dbg !1220
....
rustc 1.40.0-nightly (1423bec54 2019-11-05)
binary: rustc
commit-hash: 1423bec54cf2db283b614e527cfd602b481485d1
commit-date: 2019-11-05
host: x86_64-unknown-linux-gnu
release: 1.40.0-nightly
LLVM version: 9.0
jleni commented 5 years ago

Somehow newer versions seem to be broken. I tried going back to a nightly that depends on LLVM 8.0 (nightly-2018-12-27) and it works!

japaric commented 5 years ago

Try v0.1.4; it supports the new identifiers that rustc is producing in the llvm ir.

If you run into problems with that version open a new issue including the Rust source code that reproduces the problem. If you want to include the llvm-ir in the bug report include only the first llvm item (e.g. define void .. { .. } that appears in the output.