OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <span class="target" id="sdk-examples-2"></span><section id="examples"> | 3 <span class="target" id="sdk-examples-2"></span><section id="examples"> |
4 <h1 id="examples">Examples</h1> | 4 <h1 id="examples">Examples</h1> |
5 <p>Every Native Client SDK bundle comes with a folder of example applications. | 5 <p>Every Native Client SDK bundle comes with a folder of example applications. |
6 Each example demonstrates one or two key Native Client programming concepts. | 6 Each example demonstrates one or two key Native Client programming concepts. |
7 After you’ve <a class="reference internal" href="/native-client/sdk/downlo
ad.html"><em>downloaded the SDK</em></a>, follow the instructions | 7 After you’ve <a class="reference internal" href="/native-client/sdk/downlo
ad.html"><em>downloaded the SDK</em></a>, follow the instructions |
8 on this page to build and run the examples.</p> | 8 on this page to build and run the examples.</p> |
9 <p>Your version of Chrome must be equal to or greater than the version of your S
DK | 9 <p>Your version of Chrome must be equal to or greater than the version of your S
DK |
10 bundle. For example, if you’re developing with the <code>pepper_35</code>
bundle, you | 10 bundle. For example, if you’re developing with the <code>pepper_35</code>
bundle, you |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 <code>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</code> for | 157 <code>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</code> for |
158 Chrome Stable and | 158 Chrome Stable and |
159 <code>Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary<
/code> | 159 <code>Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary<
/code> |
160 for Chrome Canary. Note that you have to reference the executable inside the | 160 for Chrome Canary. Note that you have to reference the executable inside the |
161 application bundle, not the top-level <code>.app</code> directory:</p> | 161 application bundle, not the top-level <code>.app</code> directory:</p> |
162 <pre class="prettyprint"> | 162 <pre class="prettyprint"> |
163 $ export CHROME_PATH=<Path to Google Chrome> | 163 $ export CHROME_PATH=<Path to Google Chrome> |
164 </pre> | 164 </pre> |
165 </li> | 165 </li> |
166 </ul> | 166 </ul> |
167 <h2 id="run-the-sdk-examples-as-packaged-apps"><span id="run-sdk-examples-as-pac
kaged"></span>Run the SDK examples as packaged apps</h2> | 167 <h2 id="run-the-sdk-examples-as-chrome-apps"><span id="run-sdk-examples-as-packa
ged"></span>Run the SDK examples as Chrome apps</h2> |
168 <p>Each example can also be launched as a packaged application. A packaged | 168 <p>Each example can also be launched as a Chrome apps. A Chrome app is a special |
169 application is a special zip file (with a .crx extension) hosted in the Chrome | 169 zip file (with a .crx extension) hosted in the Chrome Web Store. This file |
170 Web Store. This file contains all of the application parts: A Chrome Web Store | 170 contains all of the application parts: A Chrome Web Store manifest file |
171 manifest file (<code>manifest.json</code>), an icon, and all of the regular Nati
ve Client | 171 (<code>manifest.json</code>), an icon, and all of the regular Native Client appl
ication |
172 application files. Refer to <a class="reference external" href="/apps/about_apps
">What are Chrome Apps</a> for more | 172 files. Refer to <a class="reference external" href="/apps">What are Chrome Apps<
/a> for more information about |
173 information about creating a packaged application.</p> | 173 creating a Chrome app.</p> |
174 <p>Some Pepper features, such as <a class="reference external" href="pepper_stab
le/cpp/classpp_1_1_t_c_p_socket">TCP</a> or <a class="reference external" href="
pepper_stable/cpp/classpp_1_1_u_d_p_socket">UDP</a> socket access, are only allo
wed | 174 <p>Some Pepper features, such as <a class="reference external" href="pepper_stab
le/cpp/classpp_1_1_t_c_p_socket">TCP</a> or <a class="reference external" href="
pepper_stable/cpp/classpp_1_1_u_d_p_socket">UDP</a> socket access, are only allo
wed |
175 in <a class="reference external" href="/apps/about_apps">packaged applications</
a>. The examples that use these | 175 in <a class="reference external" href="/apps">Chrome apps</a>. The examples that
use these features must be run as |
176 features must be run as <a class="reference external" href="/apps/about_apps">pa
ckaged applications</a>, by using | 176 <a class="reference external" href="/apps">Chrome apps</a>, by using the followi
ng command:</p> |
177 the following command:</p> | |
178 <pre class="prettyprint"> | 177 <pre class="prettyprint"> |
179 $ make run_package | 178 $ make run_package |
180 </pre> | 179 </pre> |
181 <p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as desc
ribed above to run | 180 <p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as desc
ribed above to run |
182 with a different toolchain or configuration.</p> | 181 with a different toolchain or configuration.</p> |
183 <h2 id="debugging-the-sdk-examples"><span id="id5"></span>Debugging the SDK exam
ples</h2> | 182 <h2 id="debugging-the-sdk-examples"><span id="id5"></span>Debugging the SDK exam
ples</h2> |
184 <p>The NaCl SDK uses <a class="reference external" href="https://www.gnu.org/sof
tware/gdb/">GDB</a> to debug Native | 183 <p>The NaCl SDK uses <a class="reference external" href="https://www.gnu.org/sof
tware/gdb/">GDB</a> to debug Native |
185 Client code. The SDK includes a prebuilt version of GDB that is compatible with | 184 Client code. The SDK includes a prebuilt version of GDB that is compatible with |
186 NaCl code. To use it, run the <code>make debug</code> command from an example di
rectory:</p> | 185 NaCl code. To use it, run the <code>make debug</code> command from an example di
rectory:</p> |
187 <pre class="prettyprint"> | 186 <pre class="prettyprint"> |
(...skipping 13 matching lines...) Expand all Loading... |
201 0x000000000fa00080 in ?? () | 200 0x000000000fa00080 in ?? () |
202 </pre> | 201 </pre> |
203 <p>At this point, you can use the standard GDB commands to debug your NaCl modul
e. | 202 <p>At this point, you can use the standard GDB commands to debug your NaCl modul
e. |
204 The most common commands you will use to debug are <code>continue</code>, <code>
step</code>, | 203 The most common commands you will use to debug are <code>continue</code>, <code>
step</code>, |
205 <code>next</code>, <code>break</code> and <code>backtrace</code>. See | 204 <code>next</code>, <code>break</code> and <code>backtrace</code>. See |
206 <a class="reference internal" href="/native-client/devguide/devcycle/debugging.h
tml"><em>Debugging</em></a> for more information about | 205 <a class="reference internal" href="/native-client/devguide/devcycle/debugging.h
tml"><em>Debugging</em></a> for more information about |
207 debugging a Native Client application.</p> | 206 debugging a Native Client application.</p> |
208 </section> | 207 </section> |
209 | 208 |
210 {{/partials.standard_nacl_article}} | 209 {{/partials.standard_nacl_article}} |
OLD | NEW |