DependableSystemsLab / LLFI

LLFI is an LLVM based fault injection tool, that injects faults into the LLVM IR of the application source code. The faults can be injected into specific program points, and the effect can be easily tracked back to the source code. Please refer to the paper below. NOTE: If you publish a paper using LLFI, please add it to PaperLLFI.bib
http://blogs.ubc.ca/karthik/2014/02/23/quantifying-the-accuracy-of-high-level-fault-injection-techniques/
Other
66 stars 36 forks source link

Profiling file not generated #62

Open flyree opened 9 years ago

flyree commented 9 years ago

I found a case when I was running llfi. This is the generated profiling IR:

%178 = landingpad { i8, i32 } personality i8 bitcast (i32 (...)* @__gxx_personalityv0 to i8) catch i8_ null, !llfiindex !15416 call void @doProfiling(i32 59) %179 = extractvalue { i8, i32 } %178, 0, !llfi_index !15417 call void @doProfiling(i32 57) call void @__clang_callterminate(i8 %179) #11, !llfi_index !15418 call void @endProfiling() unreachable, !llfi_index !15419

I am not sure this endProfiling function would be called. This has something to do with the exception handling in c++. I think endProfiling should be added before that terminate call.

chipbuster commented 9 years ago

I've been getting a similar issue, though not entirely identical (the symptom is the same as the title of this issue, so I'll leave it here). In my case, main() is not having an endProfiling call placed before the return (following snippet is from main() in IR):

; <label>:157                                  ; preds = %151, %147, %144
  ret i32 0                                    ; corresponds to `return 0` at the end of main()

; <label>:158                                  ; preds = %113
  %159 = load i8** %4
  %160 = load i32* %5
  %161 = insertvalue { i8*, i32 } undef, i8* %159, 0
  %162 = insertvalue { i8*, i32 } %161, i32 %160, 1
  resume { i8*, i32 } %162
}

Curiously, when the code is compiled under -O3 or -O2, the correct endProfiling() call is inserted.

The code is the single-threaded LULESH benchmark.

karfair commented 9 years ago

@flyree Could you point me to the file you were using so that I can reproduce this bug? Thanks.

flyree commented 9 years ago

Hi Phil,

I have found that it might be because that LLFI cannot deal with exception handling in C++ well. The program I am using is complex, but I guess you can find a c++ file with exception blocks (try/catch) and see how it goes.

Bo