Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: MoonKid on March 29, 2007, 09:21:53 pm

Title: SIGSEGV only while debug
Post by: MoonKid on March 29, 2007, 09:21:53 pm
I got a program that runs (F9) normal without any errors.
But If I start it with a a debug (F8) it recieves a SIGSEGV.

<err>
Program received signal SIGSEGV, Segmentation fault.
In RpcRaiseException () (C:\WINDOWS\system32\rpcrt4.dll)
</err>

I do not know what it is. Any idea?

I am using the nightlys with gcc under WinXPSP2.
Title: Re: SIGSEGV only while debug
Post by: thomas on March 29, 2007, 09:25:20 pm
This is a "feature".

Windows sends signals, exceptions, and whatever during normal operation, for example during drag-and-drop, file selection dialogs, RPC, and some other actions. The debugger catches them, and shows them (not knowing that they are "normal").
Title: Re: SIGSEGV only while debug
Post by: MoonKid on March 29, 2007, 09:30:49 pm
Ok, but a Segmentation fault is something wrong, isn't it?
Title: Re: SIGSEGV only while debug
Post by: thomas on March 29, 2007, 10:17:00 pm
Possibly, but not necessarily. Try dragging a file over Code::Blocks when it runs in the debugger, it will segfault, too.

Most of the time (99%), if it crashes in "normal" mode but runs fine in the debugger, you forgot to zero-initialise a variable. The debugger initialises all variables, thus the bug is hidden.

Most of the time (99%), if it runs fine in "normal" mode but crashes only in the debugger, it's plain normal.
Title: Re: SIGSEGV only while debug
Post by: MoonKid on March 29, 2007, 10:26:21 pm
Possibly, but not necessarily. Try dragging a file over Code::Blocks when it runs in the debugger, it will segfault, too.

My application just crashes on startup before I see any window/dialog!

I checked some older versions in my svn. There is the same behavior.
I checke some older versions of code::blocks (from 1.february). There is the same behavior.
I am driving crazy! ;)

Most of the time (99%), if it runs fine in "normal" mode but crashes only in the debugger, it's plain normal.

It is normal, ok! But I need to debug my application?
How can I do this?
Title: Re: SIGSEGV only while debug
Post by: MoonKid on March 29, 2007, 10:39:40 pm
Hm... I just restarted my WinXP. That's all.
I do not shutdown my system. I did a supend-to-disk for two weeks.
Title: Re: SIGSEGV only while debug
Post by: byo on March 30, 2007, 12:03:48 am
If debugger gets some possible SEGFAULT which is normal due to situations Thomas described, after recieving such signal you should simply select continue and it will work. If it's really a bug, it will rethrow SEGFAULT.

BYO
Title: Re: SIGSEGV only while debug
Post by: cyplo on May 06, 2007, 04:32:47 pm
same problem with 5th May 2007 build on windows XP ; gdb 6.5 with cygwin environ
there is infinite number of sigsevs after clicking continue
all refer to ntdll.dll