Bug 253972

Summary: Debugging C++ console programs with std::cin keyboard inputs aborts the debug.
Product: [Applications] kdevelop Reporter: Javier G. <jagarni1983>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED DUPLICATE    
Severity: normal CC: niko.sams
Priority: NOR    
Version: 4.0.2   
Target Milestone: 4.1.0   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Javier G. 2010-10-12 15:28:13 UTC
Version:           4.0.2 (using KDE 4.5.1) 
OS:                Linux

If you try to debug a c++ program that use the C++ input command std::cin the debugged program automatically ends when arrives to that std::cin line and is executed.

Reproducible: Always

Steps to Reproduce:
// Very simple test of this problem
#include <iostream>
using namespace std ;

int main () { 
    int i;
    cout << "Example of how debug abort execution when arrives to a simple cin command." << endl;
    cin >> i;
    cout << "You wrote: " << i << endl;
    
    return 0;
}


Actual Results:  
Example of how debug abort execution when arrives to a simple cin command.

Expected Results:  
Example of how debug abort execution when arrives to a simple cin command.
3
You wrote: 3


If I follow the workaround posted time ago for this bug from  http://www.kdevelop.org/phorum5/read.php?2,33015 it says:
"One solution reported in IRC:
1) In KDevelop4: Build your program
2) Start your program in Konsole
3) In KDevelop4: Run -> Attach to Process and select your program

Now the gdb is connected to your program"


Not works because if I reproduce the same steps always I get a error window with the message:
"No se puede adjuntar el depurador.
ptrace: Operaci\303\263n no permitida."
traslated would be:
"Can not be attached the debugger.
ptrace: Operation not allowed."
Comment 1 Milian Wolff 2010-10-12 16:09:30 UTC
kdevelop 4.2 should have the ability to run an application in an external terminal, left to be tested whether that makes it work though :)
Comment 2 Niko Sams 2011-12-30 20:00:46 UTC

*** This bug has been marked as a duplicate of bug 236516 ***