I'm trying to compile one of my games on Windows, but unfortunately, no matter what, I'm getting this segmentation fault every time I run the program.
Compilation is successful, and without any warning.
Program received signal SIGSEGV, Segmentation fault.
__chkstk_ms () at ../../../../../src/gcc-4.8.1/libgcc/config/i386/cygwin.S:172
172 ../../../../../src/gcc-4.8.1/libgcc/config/i386/cygwin.S: No such file or directory.
I've tried:
Compiling on a Windows x86 machine
Compiling on a Windows x64 machine
nuwen.net's MinGW distro
TDM MinGW 4.8.1 SJLJ
MinGW builds x86 SJLJ
MinGW builds x64 SJLJ
MinGW builds x86 DW2
I've built all dependencies from source multiple times, tried linking both statically and dynamically.
Debugging doesn't help either - GDB gives me that error message just upon entering main(). I've used -g3 and -O0 flags.
How can I figure out what's happening?
On Windows, the default stack size is smaller than Linux. __chkstk_ms appears to be a function that crashes if you overflow your stack.
You may try to figure out where in your code you are creating huge stack variables or doing very deep recursion, and fix that.
Alternately, you may be able to add a compile flag to increase the stack size. See http://trac.sagemath.org/ticket/13960.
Try to increase stack size. Don't ask me how, I don't know.
The failing call (__chkstk_ms) looks like internal routine which checks if there is enough stack space for the function about to be executed.
Related
In one of my C++-projects I found an issue related to a linked library which results in a segfault directly after starting the compiled executable. I tried to dive into the issue using gdb, but it fails with the output:
../../gdb/dwarf2/read.c:1857: internal-error: bool dwarf2_per_objfile::symtab_set_p(const dwarf2_per_cu_data*) const: Assertion `per_cu->index < this->m_symtabs.size ()' failed.
After it is an internal error I am not able to do much (except reporting it), but I still would like to be able to debug the program itself. Which options do I have for that?
Use of a different debugger than gdb?
Manual update to a newer version of gdb (currently on 10.1)?
Somehow catch the segfault before it is damaging the debugger?
?
Most likely this is already fixed gdb bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28160. It has Target Milestone 11.1, so update to a latest version of gdb which is 11.1 now. It should be fixed in that version.
I fully implemented the content of the following webpage:
http://www.gem5.org/documentation/learning_gem5/part3/running/
The program can be compiled under X86 according to webpage requirements,however I want to get an ARM binary file,so I use the following code to compile it:
aarch64-linux-gnu-g++ -o threads threads.cpp -pthread -std = c ++ 11 -static
I can compile and get the binary file, but I get the following error during running:
erminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted
Since the compiled ARM binary file is not provided in gem5's bin folder, does it mean that gem5 does not support running ARM multi-threaded programs, or my compilation options are wrong?
That program fails to run with -static on both qemu-aarch64 and Ubuntu 20.04 amd64 native (always check other more stable platforms :-))
It is known that there are some nongem5-specific problems with -static and threads, see e.g.: when g++ static link pthread, cause Segmentation fault, why?
If workaround mentioned there don't work, you can now also run with dynamic linking as mentioned at: How to run a dynamically linked executable syscall emulation mode se.py in gem5? I've just tested it now and it worked with that example.
And at last note that there is a serious multithread SE Ruby problem which we are not sure how to solve: https://gem5.atlassian.net/browse/GEM5-676
I've been attempting to get address sanitizer working in Xcode to find the source of a memory stomping bug. I've changed my standard compiler to the latest trunk version of Clang, and added -fsanitize=address to the compiler and linker flags for the target. However, when building the target, I the the error Ran out of registers during register allocation. When building without the -fsanitize=address flag I get no problems, only when I use that flag does the problem occur.
What could be the cause of this problem? I've got 16GB of RAM available so I don't think the build is running out of memory, and I can't find an explanation of what this error means anywhere. Could this be a bug in the latest Clang?
c++ program terminated with no exceptions or stacktrace
I have a multi threaded application
If one of my threads has an access violation with reading out of bounds on an array (or any seg fault condition) my entire application immediately terminates.
If this happens on my windows counter part using visual studio I get a nice stacktrace of where the error was, and what the issue was.
I desperately need this type of debugging environment to be able to succeed at my project. I have too many threads and too many developers running different parts of the project to have one person not handle an exception properly and it destroys the entire project.
I am running Fedora Core 14
I am compiling with gcc 4.5.1
gdb is fedora 7.2-16.fc14
My IDE is eclipse Juno I am using the CDT builder
my toolchain is the cross GCC and my builder is the CDT Internal Builder
Is there ANY setting for the gdb or gcc or eclipse that will help me detect these type of situations?
That's what's supposed to happen. Under Unix, you get a full
core dump (which you can examine in the debugger), provided
you've authorized them. (ulimits -c—traditionally, they
were authorized by default, but Linux seems to have changed
this.)
Of course, to get any useful information from the core dump,
you'll need to have compiled the code with symbol information,
and not stripped it later. (On the other hand, you can copy the
core dump from your users machine onto your development machine,
and see what happened there.)
You're definitely looking for core dumps, as James Kanze wrote.
I would just add that core dumps will show you where the program crashed, which is not necessarily the same place as where the problem (memory corruption etc.) occurred. And of course some out-of-bounds reads/writes may not exhibit themselves by crashing immediately.
You can narrow the search by enabling check for incorrect memory allocations/deallocations in glibc. The simplest way is to set environmental variable MALLOC_CHECK_. Set it to 2 and glibc will check for heap corruption with every memory allocation/deallocation and abort the program when it founds any problem (producing a core dump, if enabled). This often helps to get closer to the real problem.
http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html
I encountered following problem:
I write program in c++ using VS2010. Debug build works properly when run with/without debugging in VS. When I launch built executable directly it also works.
Release build works when run with debugging in VS and alsp when I launch build executable directly.
Unfortunately, program does not work when I run release build in VS -without debugging-. Window is created and then program crashes quickly (without any error message). Since it crashes when run without debugging I don't know how to identify what causes the problem.
Any ideas what might be causing this? Thanks :)
It seems most likely you have some sort of memory error/corruption that just happens to work ok in the debugger.
You can try using couts to isolate how far/where it dies, or try a tool like Purify (or valgrind for free if you can port to Linux).