Author Topic: Debugger hangs on win32 console application  (Read 6592 times)

Offline effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Debugger hangs on win32 console application
« on: December 01, 2009, 03:29:04 pm »
Hi all.
I'm using C::B to develop and test a simple win32 console application.
The toolchain is GNU GCC compiler.
C::B 0.82
Windows XP

I can debug step by step my program with no problem most of the time.
But with a particular input parameter the program has some issues and now I'm trying to debug it to find the bug.
I placed a breakpoint in a loop of my code and made the application run. Then the execution stops due to the breakpoint and I press continue and the application stops again.
I was expecting to go like that for all the cicle, but after some run and stop the debugger doesn't breaks anymore on the breakpoint and the red X button is on and other buttons are greyed out.
If press the red button i get this messages:


Trying to pause the running process...
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgUiConnectToDbg () (C:\WINDOWS\system32\ntdll.dll)


From now on if I try to make a single step I get:

In ntdll!KiIntSystemCall () (C:\WINDOWS\system32\ntdll.dll)


And after another step:

In ntdll!RtlExtendedLargeIntegerDivide () (C:\WINDOWS\system32\ntdll.dll)



I have no idea if this is a problem due to my application or not, someone can help me?
Thanks in advance.
« Last Edit: December 01, 2009, 03:30:36 pm by effemmeffe »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13162
    • Travis build status
Re: Debugger hangs on win32 console application
« Reply #1 on: December 01, 2009, 03:58:40 pm »
What is the version of GDB you're using?
Can you try a nightly build?
(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 effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Debugger hangs on win32 console application
« Reply #2 on: December 01, 2009, 04:15:50 pm »
What is the version of GDB you're using?

When I launch the debugger it shows:
GNU gdb 6.8

I also have cygwin installed, but I'm not sure which gdb version I'm using...
The cygwin version is:
GNU gdb 6.8.0.20080328-cvs (cygwin-special)


All options are the ones that comes with a plain installation of C::B.


Can you try a nightly build?

A nightly build of C::B?
Where can I get it?


Found.
Now I'll try to understand if I can install it on the side of the regular installation or instead of it.

I installed the last nightly build in a different directory: svn build rev 5859.

Launched and loaded my project.
Same problem.
this is the output of the debugger window:


Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Progetti\Interfaccia Metron\Firmware\Programmatore da PC\
Adding source dir: C:\Progetti\Interfaccia Metron\Firmware\Programmatore da PC\
Adding file: bin\Debug\Programmatore da PC.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8
Child process PID: 2684
At C:/Progetti/Interfaccia Metron/Firmware/Programmatore da PC/test.c:197
Continuing...
At C:/Progetti/Interfaccia Metron/Firmware/Programmatore da PC/test.c:197
Continuing...
At C:/Progetti/Interfaccia Metron/Firmware/Programmatore da PC/test.c:197
Continuing...
At C:/Progetti/Interfaccia Metron/Firmware/Programmatore da PC/test.c:197
Continuing...
Trying to pause the running process...
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!DbgUiConnectToDbg () (C:\WINDOWS\system32\ntdll.dll)
Debugger finished with status 0


I also tried to break the program from the console windows that shows up when running: I got the focus and pressed CTRL+C, the debugger stops, but I get the following messages:


Program received signal SIGINT, Interrupt.
In KERNEL32!GetConsoleCharType () (C:\WINDOWS\system32\kernel32.dll)
« Last Edit: December 01, 2009, 04:43:01 pm by effemmeffe »

Offline effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Debugger hangs on win32 console application
« Reply #3 on: December 22, 2009, 11:45:55 am »
Any chance someone can help me?
Thanks in advance.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5325
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger hangs on win32 console application
« Reply #4 on: December 22, 2009, 03:50:57 pm »
if possible, you can supply a simple test code of your console project.
Also, it seems you have "Space" in your file path, that may cause some problems by the debugger. :D
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 effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Debugger hangs on win32 console application
« Reply #5 on: December 22, 2009, 05:01:24 pm »
Thanks, I'll try to remove spaces from filename.
The code I have right now is in a developement status, so I prefer not to post it, it could be full of errors.
The error I was referring to was related to an old version of my code.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugger hangs on win32 console application
« Reply #6 on: December 22, 2009, 05:05:51 pm »
What happens if you run gdb from command-prompt ?