ntdll!RtlWaitOnAddress exception when gdb starts - c++

When gdb starts in windows 10, error message is received.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffe7c493466 in ntdll!RtlWaitOnAddress () from C:\windows\SYSTEM32\ntdll.dll
enter image description here
Does anyone know how to fix it?

Related

gdb reports Segmentation fault - how to know where?

I'm running my program under gdb, with debuging information and without any optimizations. gdb reports:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeffff700 (LWP 8875)]
0x0000001000000001 in ?? ()
From this message i do not understand where the problem happened. Is it possible to extract stacktrace / problem file and line number?
To get the point where code segmentation fault has happened, you should use backtrace (bt) command.
There are wide range of commands available inside gdb which should be explored to help make you debug your code as efficiently as possible.
e.g. you could record your code flow and replay it in reverse.
explore data types
have breakpoints etc.

issue reg. SIGABRT with input file in FEAPpv

I am running a program to compute the thermo-electro-elastic response of a solid material under certain conditions. Every time I specify the input file after executing the feappv command, I receive the following error message.
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
Aborted (core dumped)
I dont understand the meaning of this error. Please help.
Thank u all
Your program received the SIGABRT signal. This generally happens through invocation of the abort() function from C or by executing call abort from Fortran. See the documentation of your compiler for details. It is common programming practice to call abort when some severe error in the program or inconsistency in input data has been detected.

GDB backtrace without stopping

I am trying to let my program run continously with GDB.
Currently I have a bash script which starts GDB with my program and when it crashes it prints the backtrace and starts GDB again (endless loop).
Now I added a signal handler for my program which kills specific threads when the handler gets a signal from them. Now I can achieve that GDB does not stop by doing this:
handle SIGSEGV nostop
But this leads me to the problem that I do not get a GDB backtrace which I would like to print automatically without stopping the program (or at least continuing automatically).
Any help would be appreciated!
Continue to use handle to suppress ordinary stops from SEGV. Then set a catchpoint that does what you want:
(gdb) catch signal SIGSEGV
(gdb) commands
> silent # this bit is optional
> bt
> continue
> end
This will print a backtrace on SIGSEGV but not otherwise interfere with normal operation. You may also want handle SIGSEGV noprint.

C++ gdb: Program received signal SIGABRT

Here's the message when I run the program through gdb.
Program received signal SIGABRT, Aborted.
0x00000003fd51373c in cygstdc++-6!_Znwm () from /usr/bin/cygstdc++-6.dll
(gdb) bt
#0 0x00000003fd51373c in cygstdc++-6!_Znwm () from /usr/bin/cygstdc++-6.dll
#1 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I have no idea how to go about debugging this error. Any help is appreciated.

OpenAL Segmentation Fault Before Main

I'm writing a game engine in C++ that utilizes SDL for graphics and OpenAL for audio. I'm developing on Windows XP compiling with MinGW and debugging with GDB. I discovered the problem when I ran the debugger and, before even reaching main(), the program received a Segmentation Fault. I was (and still am) confused why a segfault would occur before the program reached main. However, even though GDB said it received SIGSEGV, the program continued happily and ran exactly as I would expect it to (displayed graphics, played sounds, music, etc.)
Of course, being a game engine, there are a lot of different components, so I got rid of all components (excluded them from compiling or commented them out) and added them back in until I discovered that my calls to OpenAL were causing the segfault. Oddly enough though, the segfaults still occurred before main, and commenting out the OpenAL function calls subsequently caused the segfault to stop occurring on the next run.
So, to test out my hypothesis, I made a separate project with minimal code and linked only with OpenAL32, and voila! Segfault. This is literally the code in its entirety:
#include <al.h>
int main()
{
alGetError();
return 0;
}
I can replace alGetError() with any other OpenAL function call (even alcOpenDevice(), which is designed to be the first library call), and the segfault occurs. Remove alGetError(), and the segfault disappears.
The backtrace directly at the point of the segfault shows the following:
Program received signal SIGSEGV, Segmentation fault.
0x7c918af2 in ntdll!RtlpWaitForCriticalSection ()
from C:\WINDOWS\system32\ntdll.dll
(gdb) bt
#0 0x7c918af2 in ntdll!RtlpWaitForCriticalSection ()
from C:\WINDOWS\system32\ntdll.dll
#1 0x7c901046 in ntdll!RtlEnumerateGenericTableLikeADirectory ()
from C:\WINDOWS\system32\ntdll.dll
#2 0x00e461a0 in ?? ()
#3 0x77dd6cd8 in RegCloseKey () from C:\WINDOWS\system32\advapi32.dll
#4 0x77dde88d in RegCreateKeyExA () from C:\WINDOWS\system32\advapi32.dll
#5 0x77de473f in RegCreateKeyA () from C:\WINDOWS\system32\advapi32.dll
#6 0x6650127a in ?? () from C:\WINDOWS\system32\wbsys.dll
#7 0x7c90118a in ntdll!LdrSetAppCompatDllRedirectionCallback ()
from C:\WINDOWS\system32\ntdll.dll
#8 0x66500000 in ?? ()
#9 0x7c91c342 in ntdll!LdrHotPatchRoutine ()
from C:\WINDOWS\system32\ntdll.dll
#10 0x7c915c69 in ntdll!RtlValidateUnicodeString ()
from C:\WINDOWS\system32\ntdll.dll
#11 0x7c915dcb in ntdll!LdrShutdownProcess ()
from C:\WINDOWS\system32\ntdll.dll
#12 0x00000000 in ?? ()
RtlpWaitForCriticalSection() makes it seem like a thread issue, which OpenAL runs in a separate thread if I'm not mistaken. However I'm not too familiar with multithreaded programming.
I compiled my project (the whole game engine, in its current state) under Linux and no segfault message occurs, and the program runs as I would expect it to (this means there are a couple other errors/segfaults that I still have to fix up but I have a handle on them :P).
I'm not sure exactly what my question is. I guess I'll leave it with this question: is the segfault signal I'm receiving a result of the way I'm implementing/linking OpenAL, or is it something beyond my control that the OpenAL library causes? I would assume it's not a problem with OpenAL itself, considering the broad user base of the library, but who knows. Maybe it's a problem with the fact that I am linking my C++ project to a C library?
UPDATE : I've been researching this for a few days now, and I'm getting very frustrated. The only results I can find for "Segfault before main" are: "You have a static constructor, which is called before main" and "Oh, it actually wasn't before main. I need to learn how to use a debugger."
Well, I've never heard of static constructors in C++. And anyway, I reproduced the error without any classes to begin with. And I only run into the segfault signal when I'm using the debugger, because the program runs perfectly if it just blasts through the signal (a.k.a continuing). Putting a breakpoint on the first instruction in main or even on main(), the segfault occurs before the breakpoint is hit.