Eclipse CDT and input/output redirection with GDB [message #521251] |
Tue, 16 March 2010 18:18  |
Luigi Cotignano Messages: 3 Registered: March 2010 Location: Italy |
Junior Member |
|
|
Hi all,
I'm using a customized version of Eclipse with CDT ("Esbox" for Nokia Maemo 5 with the Ubuntu distribution) to debug an application on a remote Linux target (Maemo 5).
I succeeded to execute/debug my application on the target using a Scratchbox Remote Shell (SBRSH) but I'm currently not able to redirect the input/output to a separate console (gnu-terminal) to interact with the application.
Note : The application uses ncurses libraries for graphics management.
I have just tried to edit the ".gdbinit" file and adding something like "tty /dev/pts/x" where the "x" is the ID number of my terminal instance, but it doesn't work. 
Can someone help me to solve this issue?
Many thanks in advance!
Regards,
Luigi
[Updated on: Thu, 20 May 2010 03:58] Report message to a moderator
|
|
|
|
|
|
| Re: Eclipse CDT and input/output redirection with GDB [message #536021 is a reply to message #521251] |
Wed, 26 May 2010 12:40   |
James Messages: 3 Registered: May 2010 |
Junior Member |
|
|
I also had this same problem, and this is what I did to solve it:
Launch the application in a separate window. I put this code segment in the main to stop execution until I can attach the debugger. Mostly my bugs are after the first input prompt, so I don't need this anymore.
int debug = 1;
int main() {
while (debug == 1) sleep(1);
...
}
Now, in Eclipse, create a "C/C++ Attach to Application" configuration. Fill out all the information (go through all the tabs), then hit apply, then Debug.
A window will pop up and you select the name of the running application to attach to. There is a bug in the current Galileo CDT in that it takes a long time to launch the debugger, but it will start. For me it sits at 36% complete in the lower right hand corner of the screen for a while. Then the prospective will switch to debug and your application is paused. Simply modify the "debug" variable from above to be zero (or whatever, not 1) and continue the app (the vcr play button at the top). Now the app will continue on to your bugs and breakpoints within the debugger!
For future launches of the debugger, you will have to select the specific debug configuration that you created, because the default always the regular terminal debug.
Cheers,
James.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02237 seconds