Author Topic: Debugger doesn't work on Windows 10  (Read 6223 times)

Offline layee99

  • Single posting newcomer
  • *
  • Posts: 5
Debugger doesn't work on Windows 10
« on: September 09, 2016, 10:17:14 pm »
I installed Code::Blocks on my Windows 7 32 bit and everything works fine, but when I installed it on a Windows 10 64 bit system, the debugger doesn't work. I'm using Cygwin GCC Compiler and the Default GDB/CDB debugger installed on C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe. Here are some outputs from the debugger window:
[debug]> show version
[debug]GNU gdb (GDB) 7.6.1
[debug]> run
[debug]Starting program: C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe

Child process PID: 11032

[debug][New Thread 11032.0x2330]
[debug][New Thread 11032.0x157c]
[debug][New Thread 11032.0x19ec]
[debug][New Thread 11032.0x15d0]
[debug][New Thread 11032.0x1b5c]
[debug]Program received signal ?, Unknown signal.
[debug]0x748296c2 in RaiseException () from C:\WINDOWS\SysWoW64\KernelBase.dll
[debug]>>>>>>cb_gdb:

In RaiseException () (C:\WINDOWS\SysWoW64\KernelBase.dll)

[debug]> bt 30
[debug]#0  0x748296c2 in RaiseException () from C:\WINDOWS\SysWoW64\KernelBase.dll
[debug]#1  0x61081614 in SetThreadName(unsigned long, char const*) () from C:\cygwin\bin\cygwin1.dll
[debug]#2  0x61004a6b in cygthread::create () from C:\cygwin\bin\cygwin1.dll
[debug]#3  0x61004b5f in cygthread::async_create () from C:\cygwin\bin\cygwin1.dll
[debug]#4  0x7719655b in ?? ()
[debug]#5  0x7717fe1d in ?? ()
[debug]#6  0x77176bc0 in ?? ()
[debug]#7  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:

Does anyone know how to fix this? It works perfectly with the same config on my Windows 7 32 bit system though.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger doesn't work on Windows 10
« Reply #1 on: September 10, 2016, 02:02:18 am »
You try to debug a cygwin based executable by mingw based GDB. This may cause some issue. Can you debug the executable under command line? What is the log message? Why not use the cygwin based GDB?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline layee99

  • Single posting newcomer
  • *
  • Posts: 5
Re: Debugger doesn't work on Windows 10
« Reply #2 on: September 12, 2016, 05:41:58 pm »
The above issue was related to compiling the code with 32bit g++. When it calls 64bit DLLs causing the above error. After I changed the compiler to 64bit, this issue was disappeared, but I have a new issue:
[debug]Command-line: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe
[debug]Working dir : C:\Users\layee\Documents\CodeBlocks\SGXData

Starting debugger: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe
done

[debug]Reading symbols from C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe...
[debug]done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1

[debug]> break "C:/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64"
[debug]Breakpoint 2 at 0x401b0b: file C:/Users/layee/Documents/CodeBlocks/SGXData/main.cpp, line 64.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /home/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe
[debug]During startup program exited with code 0xc000007b.

Child process PID: 13656

[debug][New Thread 13656.0x2a34]
[debug][New Thread 13656.0xbec]
[debug][New Thread 13656.0x3610]
[debug][New Thread 13656.0x28c4]
[debug][Thread 13656.0x28c4 exited with code 3221225595]
[debug][Thread 13656.0xbec exited with code 3221225595]
[debug]>>>>>>cb_gdb:

During startup program exited with code 0xc000007b.

[debug]> quit

Debugger finished with status 0


Command line debugging with gdb is fine.
C:\Users\layee>C:\cygwin64\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe
Reading symbols from C:/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe...done.
(gdb) b main.cpp:64
Breakpoint 1 at 0x401b0b: file C:/Users/layee/Documents/CodeBlocks/SGXData/main.cpp, line 64.
(gdb) run
..........
Breakpoint 1, main () at C:/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64
/home/layee/Documents/CodeBlocks/SGXData/main.cpp:64:1959:beg:0x401b0b
(gdb)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger doesn't work on Windows 10
« Reply #3 on: September 12, 2016, 08:32:38 pm »
Most probably your executable cannot find one of its dependant dlls and fails to load.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline layee99

  • Single posting newcomer
  • *
  • Posts: 5
Re: Debugger doesn't work on Windows 10
« Reply #4 on: September 12, 2016, 09:44:04 pm »
After I added cygwin64 DLL path to %PATH%, this error is gone. Now it can not open source files:

[debug]> run
[debug]Starting program: /cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/bin/Debug/SGXData.exe

Child process PID: 896

[debug][New Thread 896.0x2bb8]
[debug][New Thread 896.0x2b60]
[debug][New Thread 896.0x2fe4]
[debug][New Thread 896.0xe50]
[debug]Breakpoint 2, main () at C:/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64
[debug]||/cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64:1959:beg:0x401b0b
[debug]>>>>>>cb_gdb:

Cannot open file: /cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/main.cpp
At /cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64
------------------
Before /cygdrive/c is actually two unprintable hollow bars. I added /cygdrive to cycgdrive prefix in Regsitry, but it doesn't help.

Offline layee99

  • Single posting newcomer
  • *
  • Posts: 5
Re: Debugger doesn't work on Windows 10
« Reply #5 on: September 13, 2016, 10:22:43 pm »
Gave up on Cygwin GCC. Revert to default GNU GCC Compiler and default GDB/CDB debugger, then it works.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Debugger doesn't work on Windows 10
« Reply #6 on: September 14, 2016, 09:57:07 pm »
Quote
Cannot open file: /cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/main.cpp
At /cygdrive/c/Users/layee/Documents/CodeBlocks/SGXData/main.cpp:64

For your info:
Codeblocks can obviously not find any files with cygwin paths....
Codeblocks does not know how to handle "/cygdrive/" paths, because it uses the default windows (OS) path structure...

greetings