Segmentation fault (core dumped) when running clang libtooling

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Segmentation fault (core dumped) when running clang libtooling

ignorer
This post has NOT been accepted by the mailing list yet.
I implemented a simple refactoring tool which can replace a function name to a user-specific name.

When I run the tool over the test code (without any header files), it works well.

If I include a header file created by myself, e.g. #include "a.h", it works well.

However, if I include a header files provided by C/C++ in the test code, e.g.

#include <stdio.h>

... then, I run it again. there is a Segmentation fault (core dumped):

$ ./transform -class=Test -method=test -newname=run ./testcode.cpp

./transform(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x33)[0xc76123]
./transform[0xc761b6]
./transform(_ZN4llvm3sys17RunSignalHandlersEv+0x99)[0xc74471]
./transform[0xc75998]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f5a0eec1390]
./transform[0xbd9537]
./transform[0xbd2d7b]
./transform[0x10a7215]
./transform(_ZN5clang12ast_matchers8internal21BoundNodesTreeBuilder12visitMatchesEPNS2_7VisitorE+0x10c)[0x11527fc]
./transform[0x10a665b]
./transform[0x10a67f9]
./transform[0x10aba99]
./transform[0x10a77c3]
./transform[0x1103b1e]
./transform[0x10c3d55]
./transform[0x10ac8b6]
./transform[0x10a77d6]
./transform[0x1103b1e]
./transform[0x10c94d7]
./transform[0x10ad4dd]
./transform[0x10a77d6]
./transform(_ZN5clang12ast_matchers11MatchFinder8matchASTERNS_10ASTContextE+0x9b)[0x10a8377]
./transform[0x10a7a99]
./transform(_ZN5clang8ParseASTERNS_4SemaEbb+0x30d)[0x13b484d]
./transform(_ZN5clang17ASTFrontendAction13ExecuteActionEv+0x143)[0x11e4ac1]
./transform(_ZN5clang14FrontendAction7ExecuteEv+0x96)[0x11e450e]
./transform(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x522)[0x123e956]
./transform(_ZN5clang7tooling21FrontendActionFactory13runInvocationESt10shared_ptrINS_18CompilerInvocationEEPNS_11FileManagerES2_INS_22PCHContainerOperationsEEPNS_18DiagnosticConsumerE+0x19e)[0x13abb66]
./transform(_ZN5clang7tooling14ToolInvocation13runInvocationEPKcPNS_6driver11CompilationESt10shared_ptrINS_18CompilerInvocationEES7_INS_22PCHContainerOperationsEE+0x12c)[0x13ab98c]
./transform(_ZN5clang7tooling14ToolInvocation3runEv+0x5d7)[0x13ab795]
./transform(_ZN5clang7tooling9ClangTool3runEPNS0_10ToolActionE+0xa32)[0x13accb6]
./transform(_ZN5clang7tooling15RefactoringTool10runAndSaveEPNS0_21FrontendActionFactoryE+0x44)[0x13a7ae8]
./transform(main+0x71b)[0xbd3ca0]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f5a0e04c830]
./transform(_start+0x29)[0xbd1c59]
Segmentation fault (core dumped)

I'm confused about that, since I only add a "#include <...>" Could you please help to check the faults info? Thanks in advance!