|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
|
2 <html> |
|
3 <head> |
|
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
|
5 <meta http-equiv="Content-Style-Type" content="text/css" /> |
|
6 <title>Launching and debugging an executable </title> |
|
7 <link rel="StyleSheet" href="../../../book.css" type="text/css"/> |
|
8 </head> |
|
9 <body bgcolor="#FFFFFF"> |
|
10 <h2><strong>Launching and debugging an executable </strong></h2> |
|
11 <p>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:</p> |
|
12 <ol> |
|
13 <li><a href="new_proj_from_template_01.htm">Creating</a> a project from a project template</li> |
|
14 <li><a href="new_proj_from_template_02.htm">Building</a> an executable based on the project sources</li> |
|
15 <li><a href="new_proj_from_template_03.htm">Defining</a> a launch configuration for running or debugging the application</li> |
|
16 <li><strong>Launching and debugging an executable using the Carbide debugger</strong></li> |
|
17 </ol> |
|
18 <hr> |
|
19 <p> </p> |
|
20 <p class="note"><b>NOTE</b> You can only debug compiled programs. Use the <a href="../projects/prj_build.htm">Build Project</a> command to compile project sources into a binary file if you do not already have an executable in the project. A symbolics (<span class="code">.sym</span>) file is also required for debugging on a target device. Ensure that a <span class="code">.sym</span> file has been created. If you are importing an existing application, you may have to rebuild the application and create a related <span class="code">.sym</span> file. Make sure a <span class="code">.sym</span> file has been created in the output directory.</p> |
|
21 <div class="step"> |
|
22 <h4><strong></strong>Launching and debugging an executable</h4> |
|
23 <ol> |
|
24 <li>Select the project to debug in the Project Explorer view.<br /> |
|
25 <p>For this example you should choose the HelloWorld project created in <a href="new_proj_from_template_01.htm">Step 1</a> of this tutorial.</p> |
|
26 </li> |
|
27 <li>Set a breakpoint in the project.<br> |
|
28 <p>Open the <span class="code">\src\HelloWorldAppUi.cpp</span> file and <a href="../../debugger/breakpoints/toggling_breakpoints.htm">set</a> a breakpoint in the <span class="code">HandleCommandL</span> routine on Line 103.</p> |
|
29 <p><img src="../images/debugging_project_02.png" alt="Setting a breakpoint" width="577" height="192"></p> |
|
30 </li> |
|
31 <li>Launch the debug session.<br /> |
|
32 <p>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.</p> |
|
33 <ul> |
|
34 <li>Right-click the project and choose Debug As > Debug Symbian OS Application on Emulator.</li> |
|
35 <li>Click the Run > Debug (<span class="code">F11</span>) menu item.</li> |
|
36 <li>Click the Debug (<img src="../images/icon_debug.png" alt="Debug icon" width="17" height="17" align="absmiddle">) icon in the toolbar.</li> |
|
37 </ul> |
|
38 <p>The emulator is launched and the <a href="../../reference/perspective_debug.htm">Debug</a> perspective appears to manage the debug session.</p> |
|
39 </li> |
|
40 <li>Click the Options soft-menu and select any menu option to hit the breakpoint set in Step 2. <br /> |
|
41 <p><img src="../images/debugging_project_04.png" alt="Select menu option" width="360" height="397"></p> |
|
42 <p>Which returns control to the <strong>Debug</strong> perspective in Carbide. Use the various views to examine the program as it runs. Examine variables, set more breakpoints, etc.</p> |
|
43 <p><img src="../images/debugging_project_05.png" alt="Select menu option" width="749" height="626"></p> |
|
44 </li> |
|
45 <li>Use any of the step commands in the Debug view to step through the program source code.<br /> |
|
46 <ul> |
|
47 <li>Click Step Into (<span class="code">F5</span>) to execute the current line and enter a function or method.</li> |
|
48 <li>Click Step Over (<span class="code">F6</span>) to execute the current line.</li> |
|
49 <li>Click Step Return (<span class="code">F7</span>) to execute lines until exiting the function or method.</li> |
|
50 </ul> |
|
51 </li> |
|
52 <li>Click the Resume icon in the Debug view to return control to the program.</li> |
|
53 <li>Click the Exit soft-key in the emulator to exit the debug session.<br /> |
|
54 <p>The HelloWorld program stops, the emulator exits, and control returns to Carbide.</p> |
|
55 </li> |
|
56 </ol> |
|
57 </div> |
|
58 <p>That's it. Congratulations on creating, building, and debugging a Carbide project.</p> |
|
59 <h4>Other references</h4> |
|
60 <ul> |
|
61 |
|
62 <li><a href="./">Creating New Projects Tutorial</a></li> |
|
63 </ul> |
|
64 <div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></div> |
|
65 |
|
66 </body> |
|
67 </html> |