Discussion:
SIGSEGV with gdb.exe
Kjow
2011-04-19 17:13:08 UTC
Permalink
Hi all,

I have a problem with debugger, I don't know if it is a my specific
issue, but simply opening Lazarus and hitting F9 to compile and run an
empty project, I get a "External: SIGSEGV" error. But only if I have
gdb.exe as debugger. If I remove it from options, the project works.

Anyway... I can't understand if an issue that I have with a project
where I'm working on, is a Lazarus issue or a my bug: sometime it
works, sometime not. Randomly calling a function, it works, sometime
not... so enabling debugging function, I wanted to see where was the
problem... but I discovered that gdb.exe doesn't works anymore, with
empty project also.
From here the question: it is only a my problem? Is gdb.exe working
and is there a real problem with lazarus/fpc?

I'm on Lazarus 0.9.30 r30385M FPC 2.4.2 i386-win32-win32/win64 (just
updated via svn)

Thanks!
Kjow

--
Martin
2011-04-19 17:34:59 UTC
Permalink
Post by Kjow
ut only if I have
gdb.exe as debugger. If I remove it from options, the project
This may be caused by your anti-virus solution, firewall, or certain
drivers.

BitDefender is known to cause this.
Comodo firewall is known to cause this.
I suspect there may be printer drivers that cause this too, but I am not
sure.

With some anti virus it is possible to switch to game mode, or similar.

This used to be the case for bitdefender until recently.
Now it appears, that bit defender forces itself to be load (as dll) with
*every* application. But if entered while in gdb crashes.

There is nothing (as far as I know) that can be done in Lazarus or FPC.
If those products, (deliberately or not) behave differently, if the host
app is being debugged, then this is to me a fault of the manufacturer of
these products.
Alternatively, there may be an issue in gdb itself, that causes certain
code to rash. I have no idea, but again, it can't be fixed in Lazarus

Best regards
Martin

--
Kjow
2011-04-19 17:51:35 UTC
Permalink
Post by Martin
This may be caused by your anti-virus solution, firewall, or certain
drivers.
BitDefender is known to cause this.
Comodo firewall is known to cause this.
I suspect there may be printer drivers that cause this too, but I am not
sure.
With some anti virus it is possible to switch to game mode, or similar.
This used to be the case for bitdefender until recently.
Now it appears, that bit defender forces itself to be load (as dll) with
*every* application. But if entered while in gdb crashes.
There is nothing (as far as I know) that can be done in Lazarus or FPC. If
those products, (deliberately or not) behave differently, if the host app is
being debugged, then this is to me a fault of the manufacturer of these
products.
Alternatively, there may be an issue in gdb itself, that causes certain code
to rash. I have no idea, but again, it can't be fixed in Lazarus
Best regards
Martin
Thank you for quick reply,

I had no problems until last Friday (15/04/11) and now, also
deactivating my Avira Antivir the problem persist.
As printer I have an Epson PX720WD, but that never caused errors to
gdb until today.

Damn... :(

Thanks!
Kjow

PS I noticed that when my program crashes (without gdb) Windows return
this error: StackHash_fdb0
I don't know if it can help to define the situation...

--
José Mejuto
2011-04-19 18:32:21 UTC
Permalink
Hello Lazarus-List,

Tuesday, April 19, 2011, 7:51:35 PM, you wrote:

K> I had no problems until last Friday (15/04/11) and now, also
K> deactivating my Avira Antivir the problem persist.
K> As printer I have an Epson PX720WD, but that never caused errors to
K> gdb until today.

Deactivating Avira is not enougth. I had the same problem a few months
ago, so uninstalled Avira and reinstalled it a few days later. Now
everything is running fine.
--
Best regards,
José


--
Kjow
2011-04-19 18:36:05 UTC
Permalink
Post by José Mejuto
Deactivating Avira is not enougth. I had the same problem a few months
ago, so uninstalled Avira and reinstalled it a few days later. Now
everything is running fine.
--
Best regards,
 José
Thanks you,

I will try to re-install it.

Best Regards,
Kjow

--
Martin
2011-04-19 19:18:45 UTC
Permalink
Post by Kjow
Thank you for quick reply,
I had no problems until last Friday (15/04/11) and now, also
deactivating my Avira Antivir the problem persist.
As printer I have an Epson PX720WD, but that never caused errors to
gdb until today.
Damn... :(
Open the "Menu / View / Debug Windows / Debug output" window (before
running your app), then start it, and copy, zip, and send the content.
Sometimes it gives a clue, sometimes not...

--
Kjow
2011-04-20 08:20:16 UTC
Permalink
Open the "Menu / View / Debug Windows / Debug output" window (before running
your app), then start it, and copy, zip, and send the content. Sometimes it
gives a clue, sometimes not...
Well, I found the problem:

from the log you suggested me:
"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation
fault",frame={addr="0x1000b481",func="CMGxSrv!?removeCOMHook@@YAHXZ",args=[],from="C:\\Windows\\SysWOW64\\HsSrv.dll"},thread-id="1",stopped-threads="all"
"

HsSrv.dll is part of Asus Xonar DX/D2X drivers and looking for it I
found a solution:

"- open msconfig.exe
- go to register "system start" (i have german version of windows 7 64 bit)
- disable HsMgr
- restart windows
READY

The Asus Xonar Driver and Tool works great and the Qt Debugger makes his work"
From here: http://www.qtcentre.org/threads/31948-Segfault-when-running-debug-in-Win7-x64-(gdb-MinGW)?s=2fa738a78700d24096036ca9aa9e02e4
Hoping that this can help someone else.



It works, but unfortunately this disables OpenAL surround... needed to
me (in my project). :(

Is it possible to avoid pass a specific dll to gdb?

Thank you!
Kjow

--
Marc Weustink
2011-04-20 10:14:22 UTC
Permalink
Post by Kjow
Open the "Menu / View / Debug Windows / Debug output" window (before running
your app), then start it, and copy, zip, and send the content. Sometimes it
gives a clue, sometimes not...
"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation
"
HsSrv.dll is part of Asus Xonar DX/D2X drivers and looking for it I
"- open msconfig.exe
- go to register "system start" (i have german version of windows 7 64 bit)
- disable HsMgr
- restart windows
READY
The Asus Xonar Driver and Tool works great and the Qt Debugger makes his work"
From here: http://www.qtcentre.org/threads/31948-Segfault-when-running-debug-in-Win7-x64-(gdb-MinGW)?s=2fa738a78700d24096036ca9aa9e02e4
Hoping that this can help someone else.
It works, but unfortunately this disables OpenAL surround... needed to
me (in my project). :(
Is it possible to avoid pass a specific dll to gdb?
Unfortunately not. This kind of software wants to hook into applications
for "better" interaction with this software.
As software you register a dll to be hooked. Then windows loads this dll
in all applications loaded.

Marc

--
Martin
2011-04-20 10:24:58 UTC
Permalink
Post by Kjow
"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation
"
HsSrv.dll is part of Asus Xonar DX/D2X drivers and looking for it I
...
Post by Kjow
It works, but unfortunately this disables OpenAL surround... needed to
me (in my project). :(
Is it possible to avoid pass a specific dll to gdb?
I have no idea. I thought about the same, when I encountered the issue
with bitdefender....
I also know that it does not happen in every debugger, bitdefender works
in the delphi debugger....

Anyway, I couldn't solve it yet, and for now I got rid of bitdefender,
so I am not going to do any work on it soon.

Another idea...
GDB is ot very good at signal handling (SigSegV). Well it catches them
reliable, but gdb can not continue afterwards. If those DLL
intentionally throw a sigsegv, after installing their own handler, then
that may throw off gdb, but not other debuggers. This may be a means off
those DLL to protect them self against reverse engineering.

http://www.delorie.com/gnu/docs/gdb/gdb_39.html
You could play with the settings, but you would have to modify the IDE,
(debugger/gdbmidebugger.pp)
You can insert code before the line 2950 " ExecuteCommand('set width
50000', []);"

Or maybe easier, run the app in gdb, by hand.

I am not going to reinstall bitdefender to test that.... Maybe one day
on my laptop, but not to soon.

Martin

--
Kjow
2011-04-20 15:28:02 UTC
Permalink
I have no idea. I thought about the same, when I encountered the issue with
bitdefender....
[cut]

Thank you all,

I'll look for the best way for me.

Best Regards,
Kjow

--

Loading...