User forums > Help

Unable to enter input when stepping line by line in the debugger?

(1/6) > >>

phoenixy:
Hi,

I most recently was using Code::Blocks 10.5 on Windows, and this worked fine.  However, now it doesn't in Code::Blocks 12.11:

I am running a console app line-by-line in the debugger--I have a breakpoint set at the beginning of the function, then use F7 to progress line by line.  However, when I get to a cin statement, I cannot actually input anything; the console window doesn't accept input, even once I am past the cin statement.  If I use F7 again, the debugger seems to get stuck and the only way to exit it is to terminate the Code::Blocks process.  Did this behavior change and is there something different I need to do in order to step line by line through a function?  Thanks.

oBFusCATed:
Does it still fail to work if you use c::b 10.05 or command line gdb, with your current compiler/debugger setup?
I think this should work fine, but I've not tried it on windows.
Can you post the full debugger's log?

phoenixy:
Thanks for the response!  Yeah, it works OK in Code::Blocks 10.05 even with the same debugger and compiler versions.  (Debugger is gdb 7.5, as you can see from the logs; compiler is minGW 4.7.1)

Here's my debugger log from Code::Blocks 12.11:

Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: c:\aaaa\
Adding source dir: c:\aaaa\
Adding file: c:\aaaa\bin\Debug\aaaa.exe
Changing directory to: c:/aaaa/.
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\QuickTime\QTSystem;C:\Windows\System32\WindowsPowerShell\v1.0
Starting debugger: c:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args c:/aaaa/bin/Debug/aaaa.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.5
Child process PID: 6736
At c:\aaaa\main.cpp:19
At c:\aaaa\main.cpp:20
In std::istream::operator>>(double&) () ()
In std::istream& std::istream::_M_extract<double>(double&) () ()
#1  0x004013f5 in main () at c:\aaaa\main.cpp:20
c:\aaaa\main.cpp:20:360:beg:0x4013f5
At c:\aaaa\main.cpp:20

Here's the debugger log from Code::Blocks 10.05 (where it works):

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: c:\aaaa\
Adding source dir: c:\aaaa\
Adding file: bin\Debug\aaaa.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 (GDB) 7.5
Child process PID: 5308
At c:\aaaa\main.cpp:19
At c:\aaaa\main.cpp:20
In std::istream::operator>>(double&) () ()
In std::istream& std::istream::_M_extract<double>(double&) () ()
In TlsGetValue@4 () ()
In KERNEL32!GetPrivateProfileStructA () (C:\Windows\syswow64\kernel32.dll)
In TlsGetValue () (C:\Windows\syswow64\KernelBase.dll)
In SetLastError@4 () ()
In KERNEL32!GetPrivateProfileStructA () (C:\Windows\syswow64\kernel32.dll)
In ntdll!LdrQueryProcessModuleInformation () (C:\Windows\system32\ntdll.dll)
In ntdll!NlsAnsiCodePage () (C:\Windows\system32\ntdll.dll)
In ntdll!LdrQueryProcessModuleInformation () (C:\Windows\system32\ntdll.dll)
In TlsSetValue@8 () ()
In KERNEL32!GetPrivateProfileStructA () (C:\Windows\syswow64\kernel32.dll)
In TlsSetValue () (C:\Windows\syswow64\KernelBase.dll)
In std::istream& std::istream::_M_extract<double>(double&) () ()

And for reference, here's the code:

#include <iostream>
using namespace std;

double computeInterest (double base_val, double rate, int years)
{
   double final_multiplier;
   for ( int i = 0; i < years; i++ )
   {
      final_multiplier *= (1 + rate);
   }
   return base_val * final_multiplier;
}

int main ()
{
   double base_val;
   double rate;
   int years;
   cout << "Enter a base value: ";
   cin >> base_val; //this is line 20
   cout << "Enter an interest rate: ";
   cin >> rate;
   cout << "Enter the number of years to compound: ";
   cin >> years;

   cout << "After " << years << " you will have " << computeInterest( base_val, rate, years ) << " money" << endl;
}

Let me know if there's any other info I can provide!

ollydbg:
@phoenixy
I don't have such issue. Can you enable the debugger-debug log, and paste the full log here. (Enable this by check on: Settings->Debugger->Commom->Full (debug) log)

Also, please use the Code/Quote Tags. (Do not directly paste log message)

phoenixy:
Sure, here you go.  These logs are from a different computer and project name than the logs above, but I can reproduce the problem on both:


--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\la\
Adding source dir: C:\la\
Adding file: C:\la\bin\Debug\la.exe
Changing directory to: C:/la/.
Set variable: PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Program Files (x86)\QuickTime\QTSystem;C:\Windows\System32\WindowsPowerShell\v1.0;c:\Program Files (x86)\Common Files\Adobe\AGL;C:\Program Files\Microsoft SQL Server\110\Tools\Binn

[debug]Command-line: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/la/bin/Debug/la.exe
[debug]Working dir : C:\la

Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/la/bin/Debug/la.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:\la\bin\Debug\la.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:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/la/
[debug]Source directories searched: C:/la;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/la/main.cpp:19"
[debug]Breakpoint 2 at 0x4013ce: file C:\la\main.cpp, line 19.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\la\bin\Debug\la.exe

Child process PID: 6496

[debug][New Thread 6496.0x1940]
[debug]Breakpoint 2, main () at C:\la\main.cpp:19
[debug]C:\la\main.cpp:19:335:beg:0x4013ce
[debug]>>>>>>cb_gdb:

At C:\la\main.cpp:19

[debug]> next
[debug]C:\la\main.cpp:20:369:beg:0x4013e9
[debug]>>>>>>cb_gdb:

At C:\la\main.cpp:20

[debug]> next
[debug]0x00446a8c in std::istream::operator>>(double&) ()
[debug]>>>>>>cb_gdb:

In std::istream::operator>>(double&) () ()

[debug]> bt 30
[debug]#0  0x00446a8c in std::istream::operator>>(double&) ()
[debug]#1  0x770cfaca in ntdll!RtlUpdateClonedSRWLock () from C:\Windows\system32\ntdll.dll
[debug]#2  0x770f1022 in ntdll!LdrLoadAlternateResourceModule () from C:\Windows\system32\ntdll.dll
[debug]#3  0xffffffff in ?? ()
[debug]#4  0x00000024 in ?? ()
[debug]#5  0x0028fe98 in ?? ()
[debug]#6  0x0040bb50 in (anonymous namespace)::generic_error_category::~generic_error_category() ()
[debug]#7  0x0040bb5c in __tcf_0 ()
[debug]#8  0x004037e0 in __cxa_rethrow ()
[debug]#9  0x004166b0 in _pei386_runtime_relocator ()
[debug]#10 0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Single stepping until exit from function _ZNSirsERd,
[debug]which has no line number information.
[debug]0x0044344c in std::istream& std::istream::_M_extract<double>(double&) ()
[debug]>>>>>>cb_gdb:

In std::istream& std::istream::_M_extract<double>(double&) () ()

[debug]> bt 30
[debug]#0  0x0044344c in std::istream& std::istream::_M_extract<double>(double&) ()
[debug]#1  0x004013f9 in main () at C:\la\main.cpp:20
[debug]>>>>>>cb_gdb:
[debug]> frame 1
[debug]#1  0x004013f9 in main () at C:\la\main.cpp:20
[debug]C:\la\main.cpp:20:369:beg:0x4013f9
[debug]>>>>>>cb_gdb:

#1  0x004013f9 in main () at C:\la\main.cpp:20
C:\la\main.cpp:20:369:beg:0x4013f9
At C:\la\main.cpp:20

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


--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version