Closed langroodi closed 2 years ago
Without seeing the constructor for the LoggingFramework
object or the stack trace from the segfault we will not be able to help here. Could you produce a Compiler Explorer link reproducing the issue?
Without seeing the constructor for the
LoggingFramework
object or the stack trace from the segfault we will not be able to help here. Could you produce a Compiler Explorer link reproducing the issue?
This is the LoggingFramework
constructor:
LoggingFramework::LoggingFramework(
sink::LogSink *logSink,
LogLevel logLevel) : mLogSink{logSink},
mDefaultLogLevel{logLevel}
{
}
in which the member initializer assigns a pointer and sets the mDefaultLogLevel
enum class.
Following is also the SEGFAULT stack trace generated by the backtrace
function while GCC rdynamic
switch was enabled:
Error: signal 11:
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN3ara3log7handlerEi+0x38)[0x5555555d7a7b]
/lib/x86_64-linux-gnu/libc.so.6(+0x46210)[0x7ffff7a8f210]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN3ara3log16LoggingFramework3LogERKNS0_6LoggerENS0_8LogLevelERKNS0_9LogStreamE+0x87)[0x5555555da501]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN3ara3log35LoggingFrameworkTest_LogMethod_Test8TestBodyEv+0x285)[0x5555555d7d53]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x69)[0x555555619314]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x5e)[0x555555611101]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing4Test3RunEv+0xf2)[0x5555555e5a04]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8TestInfo3RunEv+0x140)[0x5555555e6446]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing9TestSuite3RunEv+0x149)[0x5555555e6d43]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8internal12UnitTestImpl11RunAllTestsEv+0x457)[0x5555555f67e3]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x69)[0x55555561a842]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc+0x5e)[0x55555561233f]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_ZN7testing8UnitTest3RunEv+0xc4)[0x5555555f4f10]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_Z13RUN_ALL_TESTSv+0x15)[0x5555555d8c56]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(main+0x43)[0x5555555d8bd8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7ffff7a700b3]
/tmp/Adaptive-AUTOSAR/build/ara_log_test(_start+0x2e)[0x5555555d1c7e]
[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-usbfsss4.dmm" 1>"/tmp/Microsoft-MIEngine-Out-sxeofyfd.d4i"
This is also the link to the test file which can be built and executed, but I am not sure that Compiler Explorer can support GTest for reproducing the same situation.
The segfault seems to be in the Log member function, which is only passed objects constructed that are not related to googletest, making me think it's likely unrelated to googletest. Given that, I'm going to close this. If you find evidence that the crash is related to googletest, please reopen.
Runing the code with something like Address Sanitizer might be instructive.
I have added a new test to my project as follows which caused a segmentation fault while running 'ctest' command:
at this part of the code:
The code has been compiled in the Debug mode via GCC 9.3.0 x86-64 Linux-GNU. I even disabled the PTHREADS using _gtest_disablepthreads option, but it did not solve the issue. Following is the link to my CMakeLists: https://github.com/langroodi/Adaptive-AUTOSAR/blob/master/CMakeLists.txt
When I changed the compiler type in my pipeline from GCC to Clang 10.0 the issue disappeared. The whole project build workspace is generated by CMake 3.16.
I am still using this commit: 8d51ffdfab10b3fba636ae69bc03da4b54f8c235 of Google Test without using any object mocking. So, I am not sure the issue is solved in the newer commit or not. Or maybe there is a error in my code.
If you need more information, I would be happy to provide that.