4.6. Deploying and Debugging the Application

Once the QEMU emulator is running the image, you can deploy your application using the Eclipse IDE and then use the emulator to perform debugging. Follow these steps to deploy the application.

Note

Currently, Eclipse does not support SSH port forwarding. Consequently, if you need to run or debug a remote application using the host display, you must create a tunneling connection from outside Eclipse and keep that connection alive during your work. For example, in a new terminal, run the following:
     $ ssh -XY user_name@remote_host_ip
                
Using the above form, here is an example:
     $ ssh -XY root@192.168.7.2
                
After running the command, add the command to be executed in Eclipse's run configuration before the application as follows:
     export DISPLAY=:10.0
                
Be sure to not destroy the connection during your QEMU session (i.e. do not exit out of or close that shell).

  1. Select "Debug Configurations..." from the "Run" menu.

  2. In the left area, expand "C/C++Remote Application".

  3. Locate your project and select it to bring up a new tabbed view in the Debug Configurations Dialog.

  4. Click on the "Debugger" tab to see the cross-tool debugger you are using. Be sure to change to the debugger perspective in Eclipse.

  5. Click on the "Main" tab.

  6. Create a new connection to the QEMU instance by clicking on "new".

  7. Select "SSH", which means Secure Socket Shell. Optionally, you can select a TCF connection instead.

  8. Click "Next".

  9. Clear out the "Connection name" field and enter any name you want for the connection.

  10. Put the IP address for the connection in the "Host" field. For QEMU, the default is "192.168.7.2". However, if a previous QEMU session did not exit cleanly, the IP address increments (e.g. "192.168.7.3").

    Note

    You can find the IP address for the current QEMU session by looking in the xterm that opens when you launch QEMU.

  11. Enter "root", which is the default for QEMU, for the "User" field. Be sure to leave the password field empty.

  12. Click "Finish" to close the New Connections Dialog.

  13. If necessary, use the drop-down menu now in the "Connection" field and pick the IP Address you entered.

  14. Assuming you are connecting as the root user, which is the default for QEMU x86-64 SDK images provided by the Yocto Project, in the "Remote Absolute File Path for C/C++ Application" field, browse to /home/root/ProjectName (e.g. /home/root/hello). You could also browse to any other path you have write access to on the target such as /usr/bin. This location is where your application will be located on the QEMU system. If you fail to browse to and specify an appropriate location, QEMU will not understand what to remotely launch. Eclipse is helpful in that it auto fills your application name for you assuming you browsed to a directory.

    Tips

    • If you are prompted to provide a username and to optionally set a password, be sure you provide "root" as the username and you leave the password field blank.

    • If browsing to a directory fails or times out, but you can ssh into your QEMU or target from the command line and you have proxies set up, it is likely that Eclipse is sending the SSH traffic to a proxy. In this case, either use TCF , or click on "Configure proxy settings" in the connection dialog and add the target IP address to the "bypass proxy" section. You might also need to change "Active Provider" from Native to Manual.

  15. Be sure you change to the "Debug" perspective in Eclipse.

  16. Click "Debug"

  17. Accept the debug perspective.