diff -r 231c47d08fe4 -r 5e244b89116e core/com.nokia.carbide.cpp.doc.user/html/projects/tutorials/new_proj_from_template_04.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/com.nokia.carbide.cpp.doc.user/html/projects/tutorials/new_proj_from_template_04.htm Tue Jul 13 13:38:18 2010 -0500 @@ -0,0 +1,67 @@ + + + + + +Launching and debugging an executable + + + +

Launching and debugging an executable

+

In this example we show how to create a new project using one of the built-in Carbide templates, how to build it into an executable, and how to launch the debugger to verify program accuracy. The steps to do this include:

+
    +
  1. Creating a project from a project template
  2. +
  3. Building an executable based on the project sources
  4. +
  5. Defining a launch configuration for running or debugging the application
  6. +
  7. Launching and debugging an executable using the Carbide debugger
  8. +
+
+

 

+

NOTE You can only debug compiled programs. Use the Build Project command to compile project sources into a binary file if you do not already have an executable in the project. A symbolics (.sym) file is also required for debugging on a target device. Ensure that a .sym file has been created. If you are importing an existing application, you may have to rebuild the application and create a related .sym file. Make sure a .sym file has been created in the output directory.

+
+

Launching and debugging an executable

+
    +
  1. Select the project to debug in the Project Explorer view.
    +

    For this example you should choose the HelloWorld project created in Step 1 of this tutorial.

    +
  2. +
  3. Set a breakpoint in the project.
    +

    Open the \src\HelloWorldAppUi.cpp file and set a breakpoint in the HandleCommandL routine on Line 103.

    +

    Setting a breakpoint

    +
  4. +
  5. Launch the debug session.
    +

    To run the project on the chosen target and start a debug session use one of the following actions. Clicking Debug is the most common choice as it enables you to assume control of the executable should you encounter a problem.

    +
      +
    • Right-click the project and choose Debug As > Debug Symbian OS Application on Emulator.
    • +
    • Click the Run > Debug (F11) menu item.
    • +
    • Click the Debug (Debug icon) icon in the toolbar.
    • +
    +

    The emulator is launched and the Debug perspective appears to manage the debug session.

    +
  6. +
  7. Click the Options soft-menu and select any menu option to hit the breakpoint set in Step 2.
    +

    Select menu option

    +

    Which returns control to the Debug perspective in Carbide. Use the various views to examine the program as it runs. Examine variables, set more breakpoints, etc.

    +

    Select menu option

    +
  8. +
  9. Use any of the step commands in the Debug view to step through the program source code.
    +
      +
    • Click Step Into (F5) to execute the current line and enter a function or method.
    • +
    • Click Step Over (F6) to execute the current line.
    • +
    • Click Step Return (F7) to execute lines until exiting the function or method.
    • +
    +
  10. +
  11. Click the Resume icon in the Debug view to return control to the program.
  12. +
  13. Click the Exit soft-key in the emulator to exit the debug session.
    +

    The HelloWorld program stops, the emulator exits, and control returns to Carbide.

    +
  14. +
+
+

That's it. Congratulations on creating, building, and debugging a Carbide project.

+

Other references

+ + + + + \ No newline at end of file