Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can't track this SegFault  (Read 3209 times)

0 Members and 1 Guest are viewing this topic.

Tukimitzu

  • Full Member
  • ***
  • Posts: 117
  • Anti-Hero Member
    • View Profile
Can't track this SegFault
« on: September 16, 2016, 02:17:04 am »
Code Blocks debugger callstack shows this:

#0 0x738253bb   ?? () (??:??)
#1 0x73831b13   ?? () (??:??)
#2 0x73766bbb   ?? () (??:??)
#3 0x73766c5b   ?? () (??:??)
#4 0x77145de3   ntdll!RtlUnicodeStringToInteger() (C:\Windows\SYSTEM32\ntdll.dll:??)
#5 ??   ?? () (??:??)

I have my game updating at a constant 60 updates per second. If I call printf("Something...") every update, when the SegFault happens, I will see an incomplete call of the last printf (terminal shows "Someth" or whatever), which indicates to me the SegFault happens in another thread, and not in my game loop. Since I only have one thread and the only library that I'm using that creates threads internally is SFML 2.4.0, I suppose that's where the SegFault is. But where? I don't know how to track it down, if I run drmemory, sometimes it won't even accuse SegFault.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Can't track this SegFault
« Reply #1 on: September 16, 2016, 10:14:44 am »
Use a debug build to get a named callstack. We can'd do anything with these addresses as they're specific to your system, your program and the time it executed.

Only vague hint is there might be some problem converting a string to an integer somewhere.

Tukimitzu

  • Full Member
  • ***
  • Posts: 117
  • Anti-Hero Member
    • View Profile
Re: Can't track this SegFault
« Reply #2 on: September 16, 2016, 06:50:08 pm »
I just got the exact same output when running gdb with the debug build (yes, -g flag is enabled).

More info about the project:
openal32.dll version 1.1 (also tried with the version distributed with SFML 2.4.0, whatever that is)
SFML 2.4.0 (also experienced with 2.3.2)
g++ 6.2.0 (also experienced with 4.9.2)
boost-filesystem 1.60
boost-system 1.60
Windows 10
I do not start any threads aside from the main one.

I'll continue to investigate the issue, if you have the simplest of the suggestions, please go ahead and tell me.

Tukimitzu

  • Full Member
  • ***
  • Posts: 117
  • Anti-Hero Member
    • View Profile
Re: Can't track this SegFault
« Reply #3 on: September 16, 2016, 07:42:59 pm »
all right all right, I've made progress. Drmemory finally cought the error:

Error #3: GDI USAGE ERROR: DC 0x8a011ee0 that contains selected object being deleted
# 0 system call NtGdiDeleteObjectApp
# 1 GDI32.dll!DeleteDC                            +0x154    (0x745b0e65 <GDI32.dll+0x80e65>)
# 2 GDI32.dll!DeleteDC                            +0xd      (0x745b0d1e <GDI32.dll+0x80d1e>)
# 3 GBIEH.DLL!SpecialFunction                     +0xb9302  (0x1070e7ad <GBIEH.DLL+0xee7ad>)
# 4 GBIEH.DLL!SpecialFunction                     +0x56d46  (0x106ac1f1 <GBIEH.DLL+0x8c1f1>)
# 5 GBIEH.DLL!SpecialFunction                     +0x566ae  (0x106abb59 <GBIEH.DLL+0x8bb59>)
# 6 GBIEH.DLL!SpecialFunction                     +0xd11f1  (0x1072669c <GBIEH.DLL+0x10669c>)
# 7 GBIEH.DLL!SpecialFunction                     +0xd0ebd  (0x10726368 <GBIEH.DLL+0x106368>)
# 8 KERNEL32.dll!BaseThreadInitThunk              +0x23     (0x764b38f4 <KERNEL32.dll+0x138f4>)
Note: @0:00:27.386 in thread 5456
Note: DC was allocated here:
Note: # 0 system call NtGdiCreateCompatibleDC
Note: # 1 GDI32.dll!CreateCompatibleDC                      +0x10     (0x745b2031 <GDI32.dll+0x82031>)
Note: # 2 GBIEH.DLL!SpecialFunction                         +0xb9336  (0x1070e7e1 <GBIEH.DLL+0xee7e1>)
Note: # 3 GBIEH.DLL!SpecialFunction                         +0x56c85  (0x106ac130 <GBIEH.DLL+0x8c130>)
Note: # 4 GBIEH.DLL!SpecialFunction                         +0x566ae  (0x106abb59 <GBIEH.DLL+0x8bb59>)
Note: # 5 GBIEH.DLL!SpecialFunction                         +0xd11f1  (0x1072669c <GBIEH.DLL+0x10669c>)
Note: # 6 GBIEH.DLL!SpecialFunction                         +0xd0ebd  (0x10726368 <GBIEH.DLL+0x106368>)
Note: # 7 KERNEL32.dll!BaseThreadInitThunk                  +0x23     (0x764b38f4 <KERNEL32.dll+0x138f4>)

But the question is: what am I looking at?
« Last Edit: September 16, 2016, 07:46:26 pm by Tukimitzu »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't track this SegFault
« Reply #4 on: September 16, 2016, 07:46:14 pm »
Run the debugger with the debug libraries of SFML and their symbols, and show us the call stack of the thread that crashes.

You can try to replace openal32.dll with a newer version (SFML's one is not up-to-date) and see if that makes a difference.

You can also try to write a complete and minimal code that reproduces the problem.
Laurent Gomila - SFML developer

Tukimitzu

  • Full Member
  • ***
  • Posts: 117
  • Anti-Hero Member
    • View Profile
Re: Can't track this SegFault
« Reply #5 on: September 16, 2016, 09:58:30 pm »
Alriiiight, I found the issue. I'm either the smartest man on earth or the dumbest one.

I googled GBIEH.dll and it turns out it is from the security plugin my bank requires to access online banking. It installs itself like a virus, so it took me a while to hunt it down, but I did it and it solved the problem.

Anyway, sorry for taking your time.
Man, don't you hate when your bank interrupts your game development?