japaric / cargo-call-stack

Whole program static stack analysis
Apache License 2.0
560 stars 50 forks source link

error: failed to parse application's LLVM IR #75

Closed hudson-ayers closed 1 year ago

hudson-ayers commented 2 years ago

error: failed to parse application's LLVM IR from BUG: failed to parse LLVM IR; please submit a cargo-call-stack bug report and attach the .ll file: Failure("Eof in line 57543")

gist: https://gist.github.com/hudson-ayers/fdaa6daf5db3164ba6b7b2e0715a3135

ryankurte commented 2 years ago

same issue, Failure("Eof in line 368") with rustc 1.65.0-nightly (015a824f2 2022-08-22) and ll file here

lines 366-380 (error is at define internal...):

; core::ops::function::Fn::call
; Function Attrs: inlinehint minsize nounwind optsize
define internal fastcc void @_ZN4core3ops8function2Fn4call17h5ccbb97e9de45563E(ptr noalias nocapture noundef dereferenceable(32) %0, ptr noalias noundef nonnull readonly align 4 %1) unnamed_addr #0 !dbg !5966 {
start:
  call void @llvm.dbg.value(metadata ptr %1, metadata !5984, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !5991
  call void @llvm.dbg.value(metadata i32 3, metadata !5984, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !5991
  call void @llvm.dbg.value(metadata ptr poison, metadata !5982, metadata !DIExpression()), !dbg !5991
  call void @llvm.dbg.declare(metadata ptr %0, metadata !5992, metadata !DIExpression()), !dbg !6001
  call void @llvm.dbg.value(metadata ptr %1, metadata !5999, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !6003
  call void @llvm.dbg.value(metadata i32 3, metadata !5999, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !6003
  tail call void @llvm.memset.p0.i32(ptr noundef nonnull align 1 dereferenceable(32) %0, i8 0, i32 32, i1 false), !dbg !6004, !alias.scope !6005, !noalias !6008
  tail call void @os_perso_derive_node_with_seed_key(i32 1, i8 zeroext 113, ptr nonnull %1, i32 3, ptr nonnull %0, ptr null, ptr null, i32 0) #33, !dbg !6010
  ret void, !dbg !6011
}
japaric commented 1 year ago

this was likely due to the new llvm-ir raw pointer type (ptr) that rustc started using recently. it should have been fixed in PR #76. please try again with cargo-call-stack v0.1.12. if you run into problems, please open a new issue.

lines 366-380 (error is at define internal...):

I checked that this is now accepted by the parser as of v0.1.12