Author Topic: Debugging session gets frozen  (Read 6803 times)

Offline VincentB

  • Multiple posting newcomer
  • *
  • Posts: 28
Debugging session gets frozen
« on: March 13, 2007, 06:28:00 pm »
Dear Code::Blocks experts,

I am a new comer to Code::Blocks, I am working with svn build 3677, on top of MinGW/MSYS, WindowXP.
The debugger is GNU gdb 5.2.1

What happens to me is with the following code :

Code
#include <iostream>

int main()
{
    int a = 0;

    {for(int i = 0; i < 10; ++i)
    {
        a += i;
    }}


std::cout << "Hello world!" << std::endl;
return 0;
}

I set a breakpoint on the line {for(int i = 0; i < 10; ++i), then I start the program by pressing F8, then I press F7 once to get on line a += i;, then I open the watch window and click right into it, select "Add Watch" and add "i" variable as a watch, and select "decimal" for output format.
Then I press F7 something like 20 times, until I get on the line    std::cout << "Hello world!" << std::endl;, just when I get there the "i" symbol in the watches window becomes red, and the F7 key is no longer operative, and all the debugging is like frozzen (all are greyed in the Debug menu). The only thing that I can do then is go to Menu:Debug-> Stop Debugger

This happened to me in a more complicate program, but I could reproduce it with this very simple one, so I think that this may be a bug of Code::Block or of gdb.

Could any one help me, :?

Very best regards,
                            Vincent.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Debugging session gets frozen
« Reply #1 on: March 14, 2007, 12:31:19 am »
On XP, I'm not able to reproduce the problem. Seems to work for me.
GDB 6.3

« Last Edit: March 14, 2007, 12:37:20 am by Pecan »

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Debugging session gets frozen
« Reply #2 on: March 14, 2007, 02:16:45 am »
I can confirm some weird behaviour of debugger in few latest nightlies. Sometimes when debugger stuff should be active it's not, it occured when I was debugging program with few breakpoints. First break worked OK, when second should be reached, it looked like GDB catches it but debuger plugin doesn't see this which resulted in disabled debugger stuff.

I'm almost sure it's related to lastest Break-When-Running feature. I had few situations when debugger plugin tried to break into program which has already been stopped.

Currently I'm working on Centrino 700 Mhz laptop, sometimes it looks like there's big latency between gdb and debugger plugin so maybe here's the problem.

Regards
   BYO

Offline VincentB

  • Multiple posting newcomer
  • *
  • Posts: 28
Re: Debugging session gets frozen
« Reply #3 on: March 14, 2007, 08:53:22 am »
Dear Mr Pecan,

Thank you for your kind answer.

Could you make me know where you got GDB 6.3, I went on the MinGW site http://www.mingw.org/download.shtml and the latest GDB version available is 5.2.1-1, which is the one I downloaded on my machine.

Are you based on MinGW or on Cygwin ?

Which version of Code::blocks are you using ?

Regards,
                     Vincent.

PS : for providing similar information as Mr Byo, I am working with an Intel(R) Pentium(R) 4CPU 2.80GHz desktop PC
« Last Edit: March 14, 2007, 08:57:45 am by VincentB »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Debugging session gets frozen
« Reply #4 on: March 14, 2007, 08:58:55 am »
Download GDB 6.3 from the following link.

Quote
http://prdownloads.sf.net/mingw/gdb-6.3-2.exe?download

Regards,

Biplab
Be a part of the solution, not a part of the problem.

dr snuggles

  • Guest
Re: Debugging session gets frozen
« Reply #5 on: March 14, 2007, 09:41:55 am »
I'm having the same issues as VincentB. I was using the g++ and gdb from my dev-cpp directory so I thought these could cause problems. After downloading and installing MinGW 5.1.3 and GDB 6.3, I changed the compiler and debugger path in C::B.

Compiling goes well, but debugging gives some weird errors:
Code
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.3
Child process PID: 2932                <--- Never got this message with the old debugger
At *removed_filename*.cpp:49           <--- Normal message, but debugger hangs from here, as it always did
Trying to pause the running process... <--- Can't abord, have to shut down C::B
Trying to pause the running process...
So this is even worse then the old behaviour: I can't stop de debugger anymore :o. Replacing gdb.exe (6.3) with gdb.exe (5.2.1) gives me the random hanging behaviour I'm used to, so I'll use that for the moment.

Edit: Changing the default compiler doesn't work either. Plus: the auto detect function forgets to update the search directories, resulting in some weird errors if you don't change it manually. Is there a way I can report all my bugs in an easy way without having to register at a website again?
« Last Edit: March 14, 2007, 10:30:27 am by dr snuggles »

tmt

  • Guest
Re: Debugging session gets frozen
« Reply #6 on: March 14, 2007, 10:09:15 am »
I have this bug too. I've found two possible workarounds:

1. Disable 'evaluate expression under cursor' feature - this often caused the discussed error, though not always the reason.

2. When debugger gets frozen, open task manager and kill gdb manually. C::B continues normally.

 :shock:

Offline VincentB

  • Multiple posting newcomer
  • *
  • Posts: 28
Re: Debugging session gets frozen
« Reply #7 on: March 14, 2007, 04:28:44 pm »
Dear all,

I have installed nightly build 3683 (11th March) and the situation got worse, as with some big project I am currently working on, the breakpoints set through C::B do not cause any break. This is happening with nightly build 3683 both with gdb 5.2.1 and with gdb 6.3 which I have just installed according to isntructions from Mr Biplab.

With the "Hello world!" program that contains a loop which I sent in a previous e-mail + the GDB 6.3, the breakpoint on row 7 ({for(int i = 0; i < 10; ++i)) causes a break as wanted both with nighly build 3677 and 3683, and the 3683 still has the same freezing problem as 3677 on row 13.

Furthermore, the 3683 has an additional problem compared to 3677, as when the freezing problem occurs it is not possible to stop the debugger (GDB 6.3) by the menu "Stop Debugger", and the only solution is to kill everything. I tested nightly build 3683 only with gdb 6.3 and no gdb 5.2.1.

With 3677 it was possible, on occurrence of the freezing problem on row 13 to stop the debugger by the "Stop Debugger" menu, both with gdb 5.2.1 and gdb 6.3.

Here is the output of nighly build 3677 with gdb 6.3 when I make the freezing problem test and I exit by "Stop Debugger":

Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug
Adding source dir: D:\users\vbl\local_dev\test_CB\Test_CB\
Adding source dir: D:\users\vbl\local_dev\test_CB\Test_CB\
Adding file: .\test_CB.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.3
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:9
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:7
At D:/users/vbl/local_dev/test_CB/Test_CB/main.cpp:13
Debugger finished with status 1


The line Debugger finished with status 1 is caused by my invoking "Stop Debugger" because I am frozen on row 13 (std::cout << "Hello world!" << std::endl;). The "i" variable appears in the Watches window in red as i = no symbol "i" in current context

With nighly build 3683 + gdb 6.3 when I make the freezing problem test, I get almost the same output, except that when I am stuck on line 13, and I try to exit by "Stop Debugger" , the line "Debugger finished with status 1" in the debugger output pannel, is replaced by "Trying to pause the running process...", and the debugger is not stopped, and I have to kill it by the task manager.

Hoping that these information can help to solve this issue,
                             Vincent.