User forums > Help

Problem with debugging

(1/5) > >>

Piotrek_16:
Hi.
I want to debug this part of code and i have problem with it.
https://imageshack.com/scaled/large/713/otp2.jpg
When I try to debug and press F7 few times, debugger stops.
Here you have debugger logs:
https://imageshack.com/scaled/large/812/5tpl.jpg
If I try to stop debbuger (Shift-F8) I obtain message: Trying to pause the running process...
And It doesn't stop!
There is not a problem with integer value or even with float. There is a problem with double, long e.g.
Please help.
I have C::B 12.11 with minGW

oBFusCATed:
1. enable full logging (see settings -> debugger),
2. then try to debug again
3. then copy-paste the full log using code tags (use the '#' button in the new post interface of the forum)

Have you used the callstack/backtrace window?
Probably gdb is executing step-into instead of next-line, because either you have optimizations enabled or some inlining has happened.

Piotrek_16:

--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\
Adding source dir: C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\
Adding file: C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\bin\Debug\NewProject.exe
Changing directory to: C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject/.
Set variable: PATH=.;C:\CodeBlocks\MinGW\bin;C:\CodeBlocks\MinGW;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\MATLAB\R2013a\runtime\win64;C:\Program Files\MATLAB\R2013a\bin;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit

[debug]Command-line: C:\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject/bin/Debug/NewProject.exe
[debug]Working dir : C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject

Starting debugger: C:\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject/bin/Debug/NewProject.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:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\bin\Debug\NewProject.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]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject/
[debug]Source directories searched: C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Piotrek/Documents/CodeBlocksWorkspace/NewProject/main.cpp:8"
[debug]Breakpoint 2 at 0x40135a: file C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp, line 8.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\bin\Debug\NewProject.exe

Child process PID: 7872

[debug][New Thread 7872.0x1258]
[debug]Breakpoint 2, main () at C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8
[debug]C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8:88:beg:0x40135a
[debug]>>>>>>cb_gdb:

At C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8

[debug]> next
[debug]0x004496c4 in std::ostream::operator<<(double) ()
[debug]>>>>>>cb_gdb:

In std::ostream::operator<<(double) () ()

[debug]> bt 30
[debug]#0  0x004496c4 in std::ostream::operator<<(double) ()
[debug]#1  0x758d1162 in onexit () from C:\Windows\syswow64\msvcrt.dll
[debug]#2  0x75925bc4 in msvcrt!atexit () from C:\Windows\syswow64\msvcrt.dll
[debug]Backtrace stopped: previous frame inner to this frame (corrupt stack?)
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Single stepping until exit from function _ZNSolsEd,
[debug]which has no line number information.
[debug]0x00448018 in std::ostream& std::ostream::_M_insert<double>(double) ()
[debug]>>>>>>cb_gdb:

In std::ostream& std::ostream::_M_insert<double>(double) () ()

[debug]> bt 30
[debug]#0  0x00448018 in std::ostream& std::ostream::_M_insert<double>(double) ()
[debug]#1  0x00401371 in main () at C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8
[debug]>>>>>>cb_gdb:
[debug]> frame 1
[debug]#1  0x00401371 in main () at C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8
[debug]C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8:88:beg:0x401371
[debug]>>>>>>cb_gdb:

#1  0x00401371 in main () at C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8
C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8:88:beg:0x401371
At C:\Users\Piotrek\Documents\CodeBlocksWorkspace\NewProject\main.cpp:8

[debug]> next
[debug]127 ../../../../src/gcc-4.7.1/libgcc/unwind-sjlj.c: No such file or directory.
[debug]Single stepping until exit from function _ZNSo9_M_insertIdEERSoT_,
[debug]which has no line number information.
[debug]_Unwind_SjLj_Register (fc=0x28fe8c) at ../../../../src/gcc-4.7.1/libgcc/unwind-sjlj.c:127
[debug]>>>>>>cb_gdb:

--- End code ---
I used only Watches window.
I have this from Callstack window: std::ostream& std::ostream::_M_insert<double>(double) () (??:??)
I don't know what is backtrace window?!
I've installed C::B on my PC yesterday and I was trying to test this IDE and I obtained this problem.

oBFusCATed:
Do you have optimizations enabled in your target options?

For me this is a problem of gdb/mingw you have installed, not in C::B.
Can you try to use gdb from the command line to see if the problem happens there, too?

Piotrek_16:

--- Quote from: oBFusCATed on June 30, 2013, 04:30:31 pm ---Do you have optimizations enabled in your target options?
Can you try to use gdb from the command line to see if the problem happens there, too?

--- End quote ---
As I mentioned I'm newbie :) Can you tell me what exactly I have to do? I didn't change anything except c++11 option, I set it on in project -> build options.
Where can I find target options?
From the command line I used command
--- Code: ---c++ main.cpp -o file
--- End code ---
I obtain executable file which worked.

Navigation

[0] Message Index

[#] Next page

Go to full version