I was trying to generate the disassembly of a Hello Word C Program. The code is the following:
#include <stdio.h>
int main(int argc, char const *argv[])
{
printf("Hello world\n");
return 0;
}
Then I automatically built the model with the command:
revng model import binary main > model.yml
The model seems to be right: the code segment seems to be of the right size with the right permissions, functions are properly declared with the right address, etc.
However, we i run:
revng artifact disassemble main --model model.yml | revng ptml
I get an assertion failed:
Assertion failed at /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:435
Callee == CallEdge->Destination().notInlinedAddress()
PLEASE submit a bug report to https://github.com/revng/revng and include the crash backtrace
Stack dump:
0. Program arguments: ../../Tools/revng/root/libexec/revng/revng-artifact -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngModelImporterBinary.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcRemoveExtractValues.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngTypeShrinking.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcImportFromCAnalysis.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcModelToHeader.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcDataLayoutAnalysis.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcInitModelTypes.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngModelImporter.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngBasicAnalyses.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcRestructureCFG.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngEarlyFunctionAnalysis.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcHelpersToHeader.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcSupport.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngABI.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcCanonicalize.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngModel.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcRemoveLiftingArtifacts.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcTypeNames.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcMLIRPipes.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngRecompile.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcBackend.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngYieldPipes.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngFunctionIsolation.so -load /home/law/Tools/revng/root/lib64/revng/analyses/librevngcPromoteStackPointer.so -P /home/law/Tools/revng/root/share/revng/pipelines/revng-c-pipelines.yml -P /home/law/Tools/revng/root/share/revng/pipelines/revng-pipelines.yml disassemble main --model model.yml
1. Running pass 'Isolate Functions Pass' on module 'revng.module'.
#0 0x000074957cc0168e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/law/Tools/revng/root/libexec/revng/../../////////////////////////////////////////////////////////////////////////////////lib64/llvm/llvm/lib/libLLVMSupport.so.16+0x20168e)
#1 0x000074957cbff9f4 llvm::sys::RunSignalHandlers() (/home/law/Tools/revng/root/libexec/revng/../../////////////////////////////////////////////////////////////////////////////////lib64/llvm/llvm/lib/libLLVMSupport.so.16+0x1ff9f4)
#2 0x000074957cc01bfd (/home/law/Tools/revng/root/libexec/revng/../../////////////////////////////////////////////////////////////////////////////////lib64/llvm/llvm/lib/libLLVMSupport.so.16+0x201bfd)
#3 0x000074957c642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000074957c6969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x000074957c6969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x000074957c6969fc pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x000074957c642476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x000074957c6287f3 abort ./stdlib/abort.c:81:7
#9 0x0000749580d6cb79 /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/Support/Assert.cpp:18:3
#10 0x0000749580d6cb10 report(char const*, char const*, unsigned int, char const*) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/Support/Assert.cpp:22:0
#11 0x0000749576fcfaef decltype(auto) llvm::dyn_cast<efa::CallEdge, efa::FunctionEdgeBase>(efa::FunctionEdgeBase*) /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Casting.h:663:3
#12 0x0000749576fcfaef efa::CallEdge* CallIsolatedFunction::handleCall(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, MetaAddress, llvm::Value*)::'lambda'(auto const&, auto const&)::operator()<SortedVector<UpcastablePointer<efa::FunctionEdgeBase>, std::__1::less<efa::generated::FunctionEdgeBase::Key const>>, CallIsolatedFunction::handleCall(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, MetaAddress, llvm::Value*)::'lambda'(UpcastablePointer<efa::FunctionEdgeBase> const&)>(auto const&, auto const&) const /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:424:16
#13 0x0000749576fcfaef CallIsolatedFunction::handleCall(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, MetaAddress, llvm::Value*) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:426:28
#14 0x000074957bbee2a3 efa::Outliner::integrateFunctionCallee(efa::CallHandler*, MetaAddress, llvm::BasicBlock*, llvm::CallInst*, llvm::CallInst*, MetaAddress, efa::OutlinedFunctionsMap&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/EarlyFunctionAnalysis/Outliner.cpp:227:21
#15 0x000074957bbefab0 efa::Outliner::outlineFunctionInternal(efa::CallHandler*, llvm::BasicBlock*, efa::OutlinedFunctionsMap&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/EarlyFunctionAnalysis/Outliner.cpp:0:7
#16 0x000074957bbf053c efa::Outliner::outline(llvm::BasicBlock*, efa::CallHandler*) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/EarlyFunctionAnalysis/Outliner.cpp:541:12
#17 0x0000749576fceab7 FunctionOutliner::outline(MetaAddress, efa::CallHandler*) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:488:5
#18 0x0000749576fcd0ff IsolateFunctionsImpl::run() /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:579:45
#19 0x0000749576fcdd2a std::__1::__tree<std::__1::__value_type<llvm::StringRef, llvm::Function*>, std::__1::__map_value_compare<llvm::StringRef, std::__1::__value_type<llvm::StringRef, llvm::Function*>, std::__1::less<llvm::StringRef>, true>, std::__1::allocator<std::__1::__value_type<llvm::StringRef, llvm::Function*>>>::__root[abi:v160001]() const /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/clang-release/bin/../include/c++/v1/__tree:1101:59
#20 0x0000749576fcdd2a std::__1::__tree<std::__1::__value_type<llvm::StringRef, llvm::Function*>, std::__1::__map_value_compare<llvm::StringRef, std::__1::__value_type<llvm::StringRef, llvm::Function*>, std::__1::less<llvm::StringRef>, true>, std::__1::allocator<std::__1::__value_type<llvm::StringRef, llvm::Function*>>>::~__tree() /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/clang-release/bin/../include/c++/v1/__tree:1801:11
#21 0x0000749576fcdd2a std::__1::map<llvm::StringRef, llvm::Function*, std::__1::less<llvm::StringRef>, std::__1::allocator<std::__1::pair<llvm::StringRef const, llvm::Function*>>>::~map[abi:v160001]() /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/clang-release/bin/../include/c++/v1/map:1164:5
#22 0x0000749576fcdd2a IsolateFunctionsImpl::~IsolateFunctionsImpl() /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:138:7
#23 0x0000749576fcdd2a IsolateFunctions::runOnModule(llvm::Module&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/FunctionIsolation/IsolateFunctions.cpp:700:1
#24 0x000074957d7fe772 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/law/Tools/revng/root/libexec/revng/../../////////////////////////////////////////////////////////////////////////////////lib64/llvm/llvm/lib/libLLVMCore.so.16+0x3fe772)
#25 0x00007495815a2536 pipeline::GenericLLVMPipe::run(pipeline::ExecutionContext const&, pipeline::LLVMContainer&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/Pipeline/GenericLLVMPipe.cpp:37:1
#26 0x00007495815b08e3 llvm::Error::setChecked(bool) /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:300:13
#27 0x00007495815b08e3 llvm::Error::operator=(llvm::Error&&) /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:215:5
#28 0x00007495815b08e3 llvm::Error::Error(llvm::Error&&) /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:192:11
#29 0x00007495815b08e3 pipeline::InvokableWrapperImpl<pipeline::GenericLLVMPipe>::run(pipeline::ExecutionContext&, pipeline::ContainerSet&, llvm::StringMap<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, llvm::MallocAllocator> const&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/include/revng/Pipeline/Invokable.h:433:12
#30 0x00007495815afe12 pipeline::detail::PipeWrapperImpl<pipeline::GenericLLVMPipe>::run(pipeline::ExecutionContext&, pipeline::ContainerSet&, llvm::StringMap<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, llvm::MallocAllocator> const&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/include/revng/Pipeline/Pipe.h:181:5
#31 0x00007495815c3c09 llvm::Error::getPtr() const /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:272:42
#32 0x00007495815c3c09 llvm::Error::operator bool() /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:235:16
#33 0x00007495815c3c09 llvm::cantFail(llvm::Error, char const*) /builds/gitlab/revng/orchestra/orchestra/root/lib64/llvm/llvm/include/llvm/Support/Error.h:746:7
#34 0x00007495815c3c09 pipeline::Step::run(pipeline::ContainerSet&&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/Pipeline/Step.cpp:282:5
#35 0x00007495815b7b2a pipeline::Runner::run(llvm::StringRef, pipeline::ContainerToTargetsMap const&) /builds/gitlab/revng/orchestra/orchestra/sources/revng/lib/Pipeline/Runner.cpp:381:5
#36 0x0000572656603369 _init (../../Tools/revng/root/libexec/revng/revng-artifact+0x10369)
#37 0x000074957c629d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#38 0x000074957c629e40 call_init ./csu/../csu/libc-start.c:128:20
#39 0x000074957c629e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#40 0x0000572656601909 _init (../../Tools/revng/root/libexec/revng/revng-artifact+0xe909)
I tried the simple example in the tutorial, and it works. Hope I’m not missing something stupid.