User forums > General (but related to Code::Blocks)
diff between run terminal and debug terminal???
(1/1)
iamk2:
Learing on my own => C++.
Using codeblocks as my IDE. Arch linux
I use the following function to clear my terminal throughout my program.
--- Code: ---void Clear_Screen(bool RESET)
{
if (!cur_term)
{
int result = 0;
setupterm(NULL,STDOUT_FILENO,&result);
if (result <=0)
return;
}
putp(tigetstr( "clear"));
if (RESET == true)
putp(tigetstr( "rs1"));
}
--- End code ---
no errors building.
whenever I run the program it works flawless!
When I use debug the "clear" does not perform as I would like but instead the output just scrolls.
This is because the "int result;" is returning a -1 when observed through the debugger - hence no clear.
I found that -1 is the return value for "An error occurred while locating the terminfo database."??
I used devilspie to find that the XTerm window opened when the program is ran - is called "CB_Console_Runner" and when in Debug it is called "sleep".
What is behind the no clear in debug??
oBFusCATed:
When you use "Run" cb starts the terminal through cb_console_runner.
When you debug your program cb starts the terminal directly and executes a long sleep command in it. Then when the debugger (gdb) is started, we tell it to use the tty provided by this instance of xterm.
iamk2:
1. When my application is ran directly through XTerm with no use of CB it uses the Standard Pseudo TTY definitions set by XTerm - or the Pseudo TTY definitions provided by whatever virtual term I use at the time - therefore setupterm() finds the terminfo database properly and 1 is returned and the rest of the functions commands operate properly because they have all the info they require??
2. When I execute it through CB with RUN and it uses cb_console_runner does it not use the XTerm definitions also?? Therefore it would behave exactly the same as from within CB??
3. When I use debug (GDB) through CB it still goes to terminal but is held back from starting until after the debugger starts - got it - but I am reading it as it still uses the tty definitions from XTerm??? I was thinking gdb or CB was providing the tty defs therefore setuptrerm could not find what it needed???
I am missing something? - could I get a bit more explanation of why it is not finding the terminfo database. and the remaining commands are not working.
So confused
iamk2:
Edit to #2 above - outside CB not within.
oBFusCATed:
--- Quote from: iamk2 on October 15, 2013, 03:06:10 am ---I am missing something? - could I get a bit more explanation of why it is not finding the terminfo database. and the remaining commands are not working.
--- End quote ---
C::B uses tty gdb command to redirect the output of your program to the terminal during debugging.
See here for details: https://sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html
I don't know if this is the same as running your program in terminal, so you'll have to ask GDB or TermInfo people.
If you find something interesting, you can post it here. If it is something we need to do we can try to do it in C::B, if we're not doing it already.
Navigation
[0] Message Index
Go to full version