I am running the nirgam 3.0, which is a open source SystemC based NoC simulator in my MacBook(Mac OS X 10.10). I successfully compile the nirgam source code, but when is try to run it, it throws the "segmentation fault" as showing:
╰─$ ./nirgam
SystemC 2.3.1-Accellera --- May 3 2015 19:32:31
Copyright (c) 1996-2014 by all Contributors,
ALL RIGHTS RESERVED
[1] 5067 segmentation fault ./nirgam
(lldb) r
Process 5076 launched: './nirgam' (x86_64)
I tried to using lldb to find out the error, and I got following hints:
SystemC 2.3.1-Accellera --- May 3 2015 19:32:31
Copyright (c) 1996-2014 by all Contributors,
ALL RIGHTS RESERVED
Process 5076 stopped
* thread #1: tid = 0x7321, 0x00000001000c9d8d nirgam`sc_main(argc=1, argv=0x00000001004060f0) + 45 at main.cpp:62, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5eb2dd18)
frame #0: 0x00000001000c9d8d nirgam`sc_main(argc=1, argv=0x00000001004060f0) + 45 at main.cpp:62
59
60 int sc_main(int argc, char *argv[])
61 {
-> 62 system("rm -rf *.txt");
63 system("rm -rf jitter/GT/*");
64 system("rm -rf jitter/BE/*");
65 cout<<"---------------------------------------------------------------------------"<<endl;
(lldb) bt
* thread #1: tid = 0x7321, 0x00000001000c9d8d nirgam`sc_main(argc=1, argv=0x00000001004060f0) + 45 at main.cpp:62, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5eb2dd18)
* frame #0: 0x00000001000c9d8d nirgam`sc_main(argc=1, argv=0x00000001004060f0) + 45 at main.cpp:62
frame #1: 0x0000000100238778 libsystemc-2.3.1.dylib`sc_elab_and_sim + 184
frame #2: 0x00007fff879a65c9 libdyld.dylib`start + 1
frame #3: 0x00007fff879a65c9 libdyld.dylib`start + 1
Following fact can be a hint:
I can compile and run other SystemC based including Noxim and other code I have writed in my system enviroment.
The lldb information show that there is an error occured when going to sc_main, which is a main function in SystemC based modeling.
My question is:
What does EXC_BAD_ACCESS mean when calling the sc_main function?
Is there any method I can use to get closer to the source of this bug ?
Related
The Vulkan under QML example runs for at most a couple of seconds before crashing with the following error:
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
While the animation looks correct during operation, the QML label is not displayed correctly:
I'm running macOS Catalina with MoltenVK 1.1.130 (LunarG Vulkan SDK) and Qt 5.14.0. I've also tried MoltenVK 1.2.131, with the same result. When using MoltenVK with MVK_LOG_LEVEL_INFO enabled, the following message is printed twice every frame:
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
Question
Does anyone know what could cause this? Is this a bug? Has anyone run this example successfully?
The MVK error message makes it appear a though the Vulkan integration of Qt is broken: Not only is vkCreateMacOSSurfaceMVK called twice every frame, but it also seems to be called from the render thread (not the GUI thread/main thread).
Details
In order to even use Qt with Vulkan, you must compile Qt from source and provide the Vulkan headers. The configuration call I used to compile Qt is:
../qt5/configure -developer-build -skip qtquick3d -skip qtwebengine -opensource -nomake examples -nomake tests -confirm-license -vulkan -I $VULKAN_SDK/../MoltenVK/include -L $VULKAN_SDK/lib
My environment variables are set according to the LunarG documentation:
export VULKAN_SDK="$HOME/SDK/vulkansdk-macos-1.1.130.0/macOS"
export PATH="$VULKAN_SDK/bin:$PATH"
export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH"
export VK_ICD_FILENAMES="$VULKAN_SDK/etc/vulkan/icd.d/MoltenVK_icd.json"
export VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d"
export VK_INSTANCE_LAYERS="VK_LAYER_KHRONOS_validation"
export QT_VULKAN_LIB="$VULKAN_SDK/lib/libMoltenVK.dylib"
(Qt requires the QT_VULKAN_LIB to dlopen the library.)
lldb backtrace:
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Process 83453 stopped
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff648c57fa <+10>: jae 0x7fff648c5804 ; <+20>
0x7fff648c57fc <+12>: movq %rax, %rdi
0x7fff648c57ff <+15>: jmp 0x7fff648bfa89 ; cerror_nocancel
0x7fff648c5804 <+20>: retq
Target 0: (main) stopped.
(lldb) frame info
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
(lldb) frame variable
(lldb) bt
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
* frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff64982bc1 libsystem_pthread.dylib`pthread_kill + 432
frame #2: 0x00007fff6484ca1c libsystem_c.dylib`abort + 120
frame #3: 0x00007fff618e6be8 libc++abi.dylib`abort_message + 231
frame #4: 0x00007fff618e6d84 libc++abi.dylib`demangling_terminate_handler() + 238
frame #5: 0x00007fff63412792 libobjc.A.dylib`_objc_terminate() + 104
frame #6: 0x00007fff618f3dc7 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x00007fff618f3d79 libc++abi.dylib`std::terminate() + 41
frame #8: 0x0000000103942439 libQt5Core_debug.5.dylib`qTerminate() at qglobal.cpp:3333:5
frame #9: 0x000000010341f5f8 libQt5Core_debug.5.dylib`QThreadPrivate::start(arg=0x000000011721cfb0) at qthread_unix.cpp:354:9
frame #10: 0x00007fff64982e65 libsystem_pthread.dylib`_pthread_start + 148
frame #11: 0x00007fff6497e83b libsystem_pthread.dylib`thread_start + 15
I've reported the issue: QTBUG-82600
The fix was merged into Qt 5.15.0 beta2. Although the crashes no longer occur, the text remains mangled. The fix for that is postponed until Qt6: QTBUG-83072
My application randomly and rarely crashes with segmentation fault signal.
When coredump is opened in GDB following can be seen:
arm instruction leading to crash is:
0x7f8ea08130 fd 7b b7 a9 stp x29, x30, [sp,#-144]!
When code of crashed frame is browsed in GDB, breakpoint stops at opening curly brace of a function:
void SomeClass::someMethod(const std::string& s, int i)
>{
...
}
examining of 'sp' register gives following output:
x $sp
>~"0x7fc761a070:\t0xc761a270\n"
x $sp-144\n"
>~"0x7fc7619fe0:\t"
>&"Cannot access memory at address 0x7fc7619fe0\n"
>169^error,msg="Cannot access memory at address 0x7fc7619fe0"
stack trace seems fine and not corrupted
there are roughly 300 frames in stack and stack size limit is set to be 8192K
UPD: the pagesize in the system is 4k:
>grep -i pagesize /proc/1/smaps
KernelPageSize: 4 kB
MMUPageSize: 4 kB
What else I can check to debug this issue?
I'm running an app on iOS and periodical (not very often) it crashes with EXC_BAD_ACCESS.
The crash occurs while starting boost::thread:
boost::thread(boost::bind(&SomeClass::someStaticFunction, someParam));
and the call stack i see is:
* thread #35: tid = 0x2a822, 0x00d2469e NdsVgconnectTestApp`boost::(anonymous namespace)::thread_proxy(param=<unavailable>) + 246 at thread.cpp:164, stop reason = EXC_BAD_ACCESS (code=1, address=0x20000008)
* frame #0: 0x00d2469e NdsVgconnectTestApp`boost::(anonymous namespace)::thread_proxy(param=<unavailable>) + 246 at thread.cpp:164
frame #1: 0x3b877918 libsystem_pthread.dylib`_pthread_body + 140
frame #2: 0x3b87788a libsystem_pthread.dylib`_pthread_start + 102
I'm passing to boost::thread a static function so its hard to believe that there is some problem with addressing or pointer corruption. So my question is: Can EXC_BAD_ACCESS crash be an artifact of iOS device running out of memory or the app exceeding the memory limit given by the OS?
I'm running on the Mavericks GM with Xcode 5.0.1 GM. The OS X SDK used to compile against doesn't seem to matter. I've tried recompiling my company's software with both the 10.8 and 10.9 SDKs. I get the same result compiling for Debug and Release. Oddly enough, if I compile on 10.7 or 10.8 and bring the binaries over to a 10.9 machine, everything works fine.
The software I work on is written in C++ and runs about 600K lines of code. Nothing in our codebase uses lbxpc directly. Some of the biggest external libraries used:
Qt 4.8.5
Boost 1.49.0
OpenCL (dynamically loaded at runtime)
OpenEXR
Growl 1.2.1
Whenever the crash happens, it's at a seemingly random place in the application's main thread.
Has anyone else run into this issue? If so, what was the cause, and how did you fix it?
Disassembly of where the crash happens:
0x7fff8f2e1e3b: leaq 98519(%rip), %rax ; "Bug in libxpc: Domain environment context has overflowed maximum inline message size."
0x7fff8f2e1e42: movq %rax, -389938449(%rip) ; gCRAnnotations + 8
0x7fff8f2e1e49: ud2 <-- crash
Backtrace from lldb:
* thread #4: tid = 0x122764, 0x00007fff8f2e1e49 libxpc.dylib`_xpc_domain_serialize + 496, queue = 'com.apple.root.default-overcommit-priority, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x00007fff8f2e1e49 libxpc.dylib`_xpc_domain_serialize + 496
frame #1: 0x00007fff8f2e18ca libxpc.dylib`_xpc_dictionary_serialize_apply + 84
frame #2: 0x00007fff8f2e1497 libxpc.dylib`_xpc_dictionary_apply_node_f + 105
frame #3: 0x00007fff8f2e16af libxpc.dylib`_xpc_dictionary_serialize + 161
frame #4: 0x00007fff8f2e1184 libxpc.dylib`_xpc_serializer_pack + 423
frame #5: 0x00007fff8f2e0f81 libxpc.dylib`_xpc_pipe_pack_message + 118
frame #6: 0x00007fff8f2e0985 libxpc.dylib`xpc_pipe_routine + 99
frame #7: 0x00007fff8f2dff2a libxpc.dylib`_xpc_runtime_init_once + 827
frame #8: 0x00007fff9076c2ad libdispatch.dylib`_dispatch_client_callout + 8
frame #9: 0x00007fff9076c21c libdispatch.dylib`dispatch_once_f + 79
frame #10: 0x00007fff8f2e4144 libxpc.dylib`_xpc_connection_init + 64
frame #11: 0x00007fff8f2e40f6 libxpc.dylib`_xpc_connection_resume_init + 14
frame #12: 0x00007fff9076c2ad libdispatch.dylib`_dispatch_client_callout + 8
frame #13: 0x00007fff9076e09e libdispatch.dylib`_dispatch_root_queue_drain + 326
frame #14: 0x00007fff9076f193 libdispatch.dylib`_dispatch_worker_thread2 + 40
frame #15: 0x00007fff922f0ef8 libsystem_pthread.dylib`_pthread_wqthread + 314
frame #16: 0x00007fff922f3fb9 libsystem_pthread.dylib`start_wqthread + 13
Update with some more information:
I just found out something rather interesting. This issue only happens when the application is launched by Xcode. If I launch it via lldb on the command line, this crash does not occur. Likewise, if I double click on it in Finder, the issue does not occur.
I have notice pretty bizare bahaviour of gdb when debugging a straight block of code.
I ran gdb normally with following commands.
gdb ./exe
break main
run
next
then [enter] a few times.
What I got a as result was
35 world.generations(generations);
(gdb)
36 world.popSize(100);
(gdb)
37 world.eliteSize(5);
(gdb)
41 world.setEvaluationFnc( eval );
(gdb)
37 world.eliteSize(5);
(gdb)
39 world.pXOver(0.9);
(gdb)
38 world.pMut(0.9);
(gdb)
41 world.setEvaluationFnc( eval );
(gdb)
There is absolutely no reason to run over those lines twice. I do not understand this behaviour. The code looks as follows:
(gdb) list 39
34 SimpleGA<MySpecimen> world;
35 world.generations(generations);
36 world.popSize(100);
37 world.eliteSize(5);
38 world.pMut(0.9);
39 world.pXOver(0.9);
40
41 world.setEvaluationFnc( eval );
42
43 world.setErrorSink(stderrSink);
I am not sure if i should disregard it or there something wicked going on in my code. The app uses OpenMP and is compiled to use it. However, the info thread says there is only one thread running. Also, everything seems to give proper results, but even executed twice there should be no problems as those are mostly some plain setters.
Did anyone seen something like this or have any hints where to investigate ? I failed on my own =).
Thanks for hints,
luk32.
Most likely the compiler rearranging the code. I suppose the "new" order still works correctly?
If possible, try to debug with optimizations turned off; that increases the likelyhood of the executable staying closer to the source code.