User forums > Using Code::Blocks
Problem with debugger
Pecan:
Here is the debugger console working with cout/cin in SVN 3659
Now I'll update to the latest svn.
Could you please attach a minimal pgm that fails for you.
Pecan:
Try this source with the console and see if it runs for you.
--- Code: ---#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
int upstring(char *value);
int main()
{
//asm("int3");
char value[81]={'\0'};
int upper_count;
// perform i/o operation
do
{ cout << "Please type in a String (max. 80 characters): ";
cin.getline(value, 80);
//strcpy(value,"FakeReply");
upper_count = upstring(value);
cout << upper_count << " characters are converted" << endl;
cout << "The new string is now: " << value << endl;
if ( (strlen(value) >3) && (0==strncmp(value,"LOOP",4) ))
break;
}while(upper_count);
// perform infinite loop if user entered text "loop"
if ( (strlen(value) >3) && (0==strncmp(value,"LOOP",4)) )
{
int i = 0;
while(true){
cout<<".";cout.flush();
++i;
sleep(1);
}
}
return EXIT_SUCCESS;
}
int upstring(char *value)
{
int i=0;
while(*value)
{
if(islower(*value))
{
*value=toupper(*value);
i++;
}
value++;
}
return(i);
}
--- End code ---
kramed:
I am running Slackware 11 Kernel 2.6.20.
I am not sure if you mean a screen capture when you say PGM. It would be extremely difficult for me to catch the popup for you to see.
I tried executing your code. Works fine build/run but when I add a breakpoint and try to debug the console just pops up and dies again.
The patch was applied successfully in case you are wondering.
kramed:
I checked if X reported any problem.
--- Code: ----------------- Build: Debug in test ---------------
Compiling: test.cpp
Linking console executable: bin/Debug/test
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
X Error: BadWindow (invalid Window parameter) 3
Major opcode: 2
Minor opcode: 0
Resource id: 0x1000009
--- End code ---
Pecan:
Uh oh,
This patch issues xterm -e sleep 80000+some pid number
in order to put the shell into a coma. Then it tells gdb to use the tty that it finds sleeping.
I guess the Slackware console starts running, but never sleeps on Slack.
So... how does Slack put a shell to sleep?
Can you issue an
xterm
sleep 60
Can you issue an xterm -e sleep 60
what happens?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version