Книга: Embedded Linux development using Eclipse

4.6 Debugging the Project

Execute Run?Debug. If you executed Build Configurations?Build?All, you’ll be asked to choose a local application to debug. Select the binary with the “bug” icon and click OK. Next you’re asked if you want to open the Debug perspective, shown in Figure 4.5. Yes, you do. This may also automatically create a debug launch configuration as discussed in the previous chapter. If not, the launch configuration dialog will pop up and you can create a new configuration named record_sort under C/C++ Local Application.


Figure 4.5: Debug perspective.

If the launch configuration dialog did not come up, execute Run?Debug Configurations… because we need to modify the configuration in any case. Select the Arguments tab as shown in Figure 4.6 and enter “datafile” into the Program arguments: window. datafile is a set of sample data records for the program to sort. It was imported into the project along with sort_utils.c and record_sort.h.


Figure 4.6: Debug launch configuration.

Note that the first line of main() is highlighted in the Editor window and a green arrow in the marker bar identifies this as the current execution point. That’s because, by default, Stop on startup at: main is selected in the launch configuration.

For now, go ahead and run the program by clicking the Resume icon in the Debug view toolbar. Hmmm, we didn’t get exactly the results we expected. datafile has twelve records, but only one record is output to the Console view. That’s because a couple of run-time errors have been built into the program to offer some practice using the debugger.

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


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