Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse CDT and input/output redirection with GDB(How to redirect GDB in/out to a separate console)
icon5.gif  Eclipse CDT and input/output redirection with GDB [message #521251] Tue, 16 March 2010 18:18 Go to next message
Luigi Cotignano is currently offline 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. Sad

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 #534682 is a reply to message #521251] Wed, 19 May 2010 17:03 Go to previous messageGo to next message
Carlos Navarrette is currently offline Carlos Navarrette
Messages: 1
Registered: May 2010
Location: Oak Park, California, USA
Junior Member
Hi Luigi,
I have the same problem - getting Eclipse/gdb to debug an ncurses application. Did you ever figure out how to resolve the problem?

Thanks,

Carlos
Re: Eclipse CDT and input/output redirection with GDB [message #534730 is a reply to message #534682] Thu, 20 May 2010 03:36 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1949
Registered: July 2009
Senior Member
Quote:
I have just tried to edit the ".gdbinit" file and adding something like "/dev/pts/x" where the "x" is the ID number of my terminal instance, but it doesn't work.

You must add "tty /dev/pts/x".
See
http://wiki.eclipse.org/CDT/User/FAQ#HOWTO_debug_application s_which_require_a_real_terminal


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse CDT and input/output redirection with GDB [message #534732 is a reply to message #534730] Thu, 20 May 2010 03:57 Go to previous messageGo to next message
Luigi Cotignano is currently offline Luigi Cotignano
Messages: 3
Registered: March 2010
Location: Italy
Junior Member
Hi Alex,
yes you are right. The line I added into the .gdbinit file was what you have indicated. I made a mistake in my first post. I'll fix it.

Thanks the same, but unfortunately it didn't solve the issue.

[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 Go to previous messageGo to next message
James  is currently offline 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.
Re: Eclipse CDT and input/output redirection with GDB [message #536045 is a reply to message #536021] Wed, 26 May 2010 14:37 Go to previous messageGo to next message
Luigi Cotignano is currently offline Luigi Cotignano
Messages: 3
Registered: March 2010
Location: Italy
Junior Member
Hi James,
oh finally a solution! Many thanks for your reply. I'll use this trick to debug my app Smile

Cheers,
Luigi
Re: Eclipse CDT and input/output redirection with GDB [message #536116 is a reply to message #536021] Thu, 27 May 2010 03:08 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1949
Registered: July 2009
Senior Member
Quote:
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.

You should update (Menu Help->Check for Updates) to CDT 6.0.2. This bug is fixed there.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Eclipse CDT and input/output redirection with GDB [message #536252 is a reply to message #521251] Thu, 27 May 2010 09:30 Go to previous message
James  is currently offline James
Messages: 3
Registered: May 2010
Junior Member
Yes, thank you. I updated and fixed the issue with the long debug startup time.

James.
Previous Topic:Project template: fill existing wizard page
Next Topic:What happened to "GDB Hardware Debugging" in the debug configurations?
Goto Forum:
  


Current Time: Tue Jul 29 11:03:24 EDT 2014

Powered by FUDForum. Page generated in 0.03078 seconds