Author Topic: SIGSEGV only while debug  (Read 6968 times)

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
SIGSEGV only while debug
« 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: SIGSEGV only while debug
« Reply #1 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").
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: SIGSEGV only while debug
« Reply #2 on: March 29, 2007, 09:30:49 pm »
Ok, but a Segmentation fault is something wrong, isn't it?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: SIGSEGV only while debug
« Reply #3 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: SIGSEGV only while debug
« Reply #4 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?

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: SIGSEGV only while debug
« Reply #5 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.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 836
Re: SIGSEGV only while debug
« Reply #6 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

Offline cyplo

  • Single posting newcomer
  • *
  • Posts: 7
    • Cyryl Plotnicki-Chudyk
Re: SIGSEGV only while debug
« Reply #7 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
Cyryl Plotnicki-Chudyk