User forums > Help

Debugger sometimes stalls when using "Step Into".

(1/7) > >>

and4cb:
I am grateful for any clue you can give me to solve this problem.  If I am using the wrong wording to describe this problem, I apologize in advance.

I am trying to use C::B to update a C program, and I need to "Step Into" each function.  Please let me know why sometimes, when I "Step Into" a function, all of the debug options are disabled (greyed out).

When this happens, the "Stop Debugger" button also does not work, and the Command box in the Debugger window will no longer accept commands?

When I click on the "Stop Debugging" box, the only message I receive is: "Trying to pause the running process..."

Here is a simple program that demonstrates the problem.  I have placed comments in the code to indicate where the debugger gets hung up.


--- Code: ---#include <stdio.h>
#include <stdlib.h>

int INUM1 = 0;

int main(void);  //prototype
void Initialize(void);  //prototype
int InitNum(int num);  //prototype

int main(void)       // "Run to cursor" here, then "Next line"
{
    Initialize();    // "Step into"

    return 0;
}

void Initialize(void)
{
    printf("\nBefore call to InitNum(), INUM1 = %d", INUM1);

    //When I Step Into this next line
    // the Debug buttons become disabled
    // and to "kill" gdb, I must use Task Manager
    INUM1 = InitNum(4);

    printf("\nAfter call to InitNum(), INUM1 = %d", INUM1);
}

int InitNum(int num)
{
    num = (num + 4);
    return num;
}


--- End code ---

Debugger Log:

--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Code\test5\
Adding source dir: C:\Code\test5\
Adding file: C:\Code\test5\bin\Debug\test5.exe
Changing directory to: C:/Code/test5/.
Set variable: PATH=.;C:\MinGW32\bin;C:\MinGW32;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared;C:\Program Files (x86)\Common Files\DivX Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\QuickTime\QTSystem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared

[debug]Command-line: C:\MinGW32\bin\gdb.exe -nx -fullname  -quiet  -args C:/Code/test5/bin/Debug/test5.exe
[debug]Working dir : C:\Code\test5

Starting debugger: C:\MinGW32\bin\gdb.exe -nx -fullname  -quiet  -args C:/Code/test5/bin/Debug/test5.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from C:\Code\test5\bin\Debug\test5.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> source C:\cb20121112\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Code/test5/
[debug]Source directories searched: C:/Code/test5;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> tbreak "C:/Code/test5/main.c:10"
[debug]Temporary breakpoint 1 at 0x40133f: file C:\Code\test5\main.c, line 10.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Code\test5\bin\Debug\test5.exe

Child process PID: 2540

[debug][New Thread 2540.0x1450]
[debug]Temporary breakpoint 1, main () at C:\Code\test5\main.c:12
[debug]C:\Code\test5\main.c:12:233:beg:0x40133f
[debug]>>>>>>cb_gdb:

At C:\Code\test5\main.c:12

[debug]> bt 30
[debug]#0  main () at C:\Code\test5\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]Initialize () at C:\Code\test5\main.c:19
[debug]C:\Code\test5\main.c:19:312:beg:0x401351
[debug]>>>>>>cb_gdb:

At C:\Code\test5\main.c:19

[debug]> bt 30
[debug]#0  Initialize () at C:\Code\test5\main.c:19
[debug]#1  0x00401344 in main () at C:\Code\test5\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]C:\Code\test5\main.c:24:508:beg:0x401366
[debug]>>>>>>cb_gdb:

At C:\Code\test5\main.c:24

[debug]> bt 30
[debug]#0  Initialize () at C:\Code\test5\main.c:24
[debug]#1  0x00401344 in main () at C:\Code\test5\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]InitNum (num=4) at C:\Code\test5\main.c:31
[debug]>>>>>>cb_gdb:

Trying to pause the running process...

--- End code ---

Is there any other information that I should provide in order to help you to help me?

OS = Vista Home Premium
CB Version = svn build rev 8549 (2012/11/11 14:17:30)
Compiler = MinGW gcc 4.7.1 Windows/unicode - 32 bit
Debugger name and version: GNU gdb (GDB) 7.5
Coding Language: C

Jenna:
I just tested your code and it works flawlessly on xp and win7.
Do you have any special debugger or compiler/linker settings ?

oBFusCATed:
Jens can you paste your full log from the debugger?

Jenna:

--- Quote from: oBFusCATed on November 20, 2012, 09:17:59 am ---Jens can you paste you full debugger log?

--- End quote ---
Here is the xp log.

--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\new\testc\
Adding source dir: C:\new\testc\
Adding file: C:\new\testc\bin\Debug\testc.exe
Changing directory to: C:/new/testc/.
Set variable: PATH=.;C:\Programme\CodeBlocks-12.11\MinGW\bin;C:\Programme\CodeBlocks-12.11\MinGW;C:\MinGW\bin;C:\wxWidgets-2.8.12\lib\gcc_dll;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\Programme\Borland\BDS\4.0\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Programme\Microsoft SQL Server\80\Tools\Binn;C:\Programme\Gemeinsame Dateien\GTK\2.0\bin;C:\Programme\codeblocks;C:\Programme\Support Tools;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Programme\Gammu 1.32.0\bin;C:\Programme\Python26;C:\Dokumente und Einstellungen\jens\Eigene Dateien\Borland Studio-Projekte\Bpl

[debug]Command-line: C:\Programme\CodeBlocks-12.11\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/new/testc/bin/Debug/testc.exe
[debug]Working dir : C:\new\testc

Starting debugger: C:\Programme\CodeBlocks-12.11\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/new/testc/bin/Debug/testc.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from C:\new\testc\bin\Debug\testc.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.5
[debug]Copyright (C) 2012 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.5

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Function "__cxa_throw" not defined.
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Programme\codeblocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/new/testc/
[debug]Source directories searched: C:/new/testc;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> tbreak "C:/new/testc/main.c:10"
[debug]Temporary breakpoint 2 at 0x40133f: file C:\new\testc\main.c, line 10.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\new\testc\bin\Debug\testc.exe

Child process PID: 180

[debug][New Thread 180.0x598]
[debug]Temporary breakpoint 2, main () at C:\new\testc\main.c:12
[debug]C:\new\testc\main.c:12:233:beg:0x40133f
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:12

[debug]> bt 30
[debug]#0  main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]Initialize () at C:\new\testc\main.c:19
[debug]C:\new\testc\main.c:19:318:beg:0x401351
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:19

[debug]> bt 30
[debug]#0  Initialize () at C:\new\testc\main.c:19
[debug]#1  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]C:\new\testc\main.c:24:514:beg:0x401366
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:24

[debug]> bt 30
[debug]#0  Initialize () at C:\new\testc\main.c:24
[debug]#1  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]InitNum (num=4) at C:\new\testc\main.c:31
[debug]C:\new\testc\main.c:31:632:beg:0x401391
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:31

[debug]> bt 30
[debug]#0  InitNum (num=4) at C:\new\testc\main.c:31
[debug]#1  0x00401372 in Initialize () at C:\new\testc\main.c:24
[debug]#2  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]C:\new\testc\main.c:32:654:beg:0x401395
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:32

[debug]> bt 30
[debug]#0  InitNum (num=8) at C:\new\testc\main.c:32
[debug]#1  0x00401372 in Initialize () at C:\new\testc\main.c:24
[debug]#2  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]C:\new\testc\main.c:33:671:beg:0x401398
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:33

[debug]> bt 30
[debug]#0  InitNum (num=8) at C:\new\testc\main.c:33
[debug]#1  0x00401372 in Initialize () at C:\new\testc\main.c:24
[debug]#2  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> step
[debug]Initialize () at C:\new\testc\main.c:26
[debug]C:\new\testc\main.c:26:541:beg:0x401377
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:26

[debug]> bt 30
[debug]#0  Initialize () at C:\new\testc\main.c:26
[debug]#1  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]C:\new\testc\main.c:27:602:beg:0x40138c
[debug]>>>>>>cb_gdb:

At C:\new\testc\main.c:27

[debug]> bt 30
[debug]#0  Initialize () at C:\new\testc\main.c:27
[debug]#1  0x00401344 in main () at C:\new\testc\main.c:12
[debug]>>>>>>cb_gdb:

Continuing...

[debug]> cont
[debug]Continuing.
[debug][Inferior 1 (process 180) exited normally]
[debug]>>>>>>cb_gdb:

[Inferior 1 (process 180) exited normally]

[debug]> quit

Debugger finished with status 0

--- End code ---

MortenMacFly:
...he may have been hit by the "function out of bound" issue. I've committed a fix for it in SVN.

@obfus: After such a long time bugging you - I had to do it... ;-)

Navigation

[0] Message Index

[#] Next page

Go to full version