Книга: Embedded Linux development using Eclipse

6.2.4 Debugging With a Remote Connection

6.2.4 Debugging With a Remote Connection

With a remote connection established, we’ll use the record_sort project to illustrate how to set up a remote debug configuration. Initially, you have to copy the application executable, record_sort, to a location on the remote target. My Home seems like a good place. The main reason for doing this is so you can change the permissions to make the file executable. Eclipse will, in fact, download the executable to the target when you click Debug, but if the file doesn’t already exist, oddly enough it won’t be created with execute permission. While you’re at it, copy datafile to the target as well.

Now go back to the C/C++ perspective and open the Debug Configurations dialog for the record_sort project. You’ll find a new configuration type called C/C++ Remote Application. Create a new configuration of this type.

In the Connection drop-down, select your remote connection. Then click Search Project… next to C/C++ Application and select the Debug binary just as you would for a local debug configuration. Now click Browse next to Remote Absolute File Path for C/C++. This brings up a dialog (Figure 6.11) that lets you specify where the application executable will be downloaded on the remote machine. Expand My Home and select the record_sort executable that you just downloaded.


Figure 6.11: Select remote file location.

The Main tab of Debug Configurations now resembles Figure 6.12. Add “datafile” in the Arguments tab. Take a look at the Debugger tab and note that the only choice for Debugger is remote gdb/mi. Also note under Gdbserver Settings, that the default port number is 2345.


Figure 6.12: Remote debug configuration.

Click Apply and then Debug. Eclipse invokes make all, which may have nothing to do, downloads the executable to the target, starts gdbserver on the target, and switches to the Debug perspective. You’re now debugging on the remote target without having to manually start gdbserver.

Оглавление книги


Генерация: 1.378. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз