| OLD | NEW |
| 1 .. _devcycle-debugging: | 1 .. _devcycle-debugging: |
| 2 | 2 |
| 3 ######### | 3 ######### |
| 4 Debugging | 4 Debugging |
| 5 ######### | 5 ######### |
| 6 | 6 |
| 7 This document describes tools and techniques you can use to debug, monitor, | 7 This document describes tools and techniques you can use to debug, monitor, |
| 8 and measure your application's performance. | 8 and measure your application's performance. |
| 9 | 9 |
| 10 .. contents:: Table Of Contents | 10 .. contents:: Table Of Contents |
| 11 :local: | 11 :local: |
| 12 :backlinks: none | 12 :backlinks: none |
| 13 :depth: 3 | 13 :depth: 3 |
| 14 | 14 |
| 15 Diagnostic information | 15 Diagnostic information |
| 16 ====================== | 16 ====================== |
| 17 | 17 |
| 18 Viewing process statistics with the task manager | 18 Viewing process statistics with the task manager |
| 19 ------------------------------------------------ | 19 ------------------------------------------------ |
| 20 | 20 |
| 21 You can use Chrome's Task Manager to display information about a Native Client | 21 You can use Chrome's Task Manager to display information about a Native Client |
| 22 application: | 22 application: |
| 23 | 23 |
| 24 #. Open the Task Manager by clicking the menu icon |menu-icon| and choosing | 24 #. Open the Task Manager by clicking the menu icon |menu-icon| and choosing |
| 25 **Tools > Task manager**. | 25 **Tools > Task manager**. |
| 26 #. When the Task Manager window appears, verify that the columns displaying | 26 #. When the Task Manager window appears, verify that the columns displaying |
| 27 memory information are visible. If they are not, right click in the header | 27 memory information are visible. If they are not, right click in the header |
| 28 row and select the memory items from the popup menu that appears. | 28 row and select the memory items from the popup menu that appears. |
| 29 | 29 |
| 30 A browser window running a Native Client application will have at least two | 30 A browser window running a Native Client application has at least two processes |
| 31 processes associated with it: a process for the app's top level (the render | 31 associated with it: a process for the app's top level (the render process |
| 32 process managing the page including its HTML and any JavaScript) and one or | 32 managing the page including its HTML and JavaScript) and one or more |
| 33 more processes for each instance of a Native Client module embedded in the page | 33 processes for each instance of a Native Client module embedded in the page |
| 34 (each process running native code from one nexe file). The top-level process | 34 (each process running native code from one nexe or pexe file). The top-level |
| 35 appears with the application's icon and begins with the text "App:". A Native | 35 process appears with the application's icon and begins with the text "Tab:". |
| 36 Client process appears with a Chrome extension icon (a jigsaw puzzle piece | 36 A Native Client process appears with a Chrome extension icon (a jigsaw puzzle |
| 37 |puzzle|) and begins with the text "Native Client module" followed by the URL | 37 piece |puzzle|) and begins with the text "Native Client module:" followed by the |
| 38 of its manifest file. | 38 URL of its manifest file. |
| 39 | 39 |
| 40 From the Task Manager you can view the changing memory allocations of all the | 40 From the Task Manager you can view the changing memory allocations of all the |
| 41 processes associated with a Native Client application. Each process has its own | 41 processes associated with a Native Client application. Each process has its own |
| 42 memory footprint. You can also see the rendering rate displayed as frames per | 42 memory footprint. You can also see the rendering rate displayed as frames per |
| 43 second (FPS). Note that the computation of render frames can be performed in | 43 second (FPS). Note that the computation of render frames can be performed in |
| 44 any process, but the rendering itself is always done in the top level | 44 any process, but the rendering itself is always done in the top level |
| 45 application process, so look for the rendering rate there. | 45 application process, so look for the rendering rate there. |
| 46 | 46 |
| 47 Controlling the level of Native Client error and warning messages | 47 Controlling the level of Native Client error and warning messages |
| 48 ----------------------------------------------------------------- | 48 ----------------------------------------------------------------- |
| 49 | 49 |
| 50 Native Client prints warning and error messages to stdout and stderr. You can | 50 Native Client prints warning and error messages to stdout and stderr. You can |
| 51 increase the amount of Native Client's diagnostic output by setting the | 51 increase the amount of Native Client's diagnostic output by setting the |
| 52 following `environment variables | 52 following `environment variables |
| 53 <http://en.wikipedia.org/wiki/Environment_variable>`_: | 53 <http://en.wikipedia.org/wiki/Environment_variable>`_: |
| 54 | 54 |
| 55 * NACL_PLUGIN_DEBUG=1 | 55 * ``NACL_PLUGIN_DEBUG=1`` |
| 56 * NACL_SRPC_DEBUG=[1-255] (use a higher number for more verbose debug output) | 56 * ``NACL_SRPC_DEBUG=[1-255]`` (use a higher number for more verbose debug |
| 57 * NACLVERBOSITY=[1-255] | 57 output) |
| 58 * ``NACLVERBOSITY=[1-255]`` |
| 58 | 59 |
| 59 Basic debugging | 60 Basic debugging |
| 60 =============== | 61 =============== |
| 61 | 62 |
| 62 Writing messages to the JavaScript console | 63 Writing messages to the JavaScript console |
| 63 ------------------------------------------ | 64 ------------------------------------------ |
| 64 | 65 |
| 65 You can send messages from your C/C++ code to JavaScript using the PostMessage | 66 You can send messages from your C/C++ code to JavaScript using the |
| 66 call in the :doc:`Pepper messaging system <../coding/message-system>`. When the | 67 ``PostMessage()`` call in the :doc:`Pepper messaging system |
| 67 JavaScript code receives a message, its message event handler can call | 68 <../coding/message-system>`. When the JavaScript code receives a message, its |
| 68 `console.log() <https://developer.mozilla.org/en/DOM/console.log>`_ to write | 69 message event handler can call `console.log() |
| 69 the message to the JavaScript `console </devtools/docs/console-api>`_ in | 70 <https://developer.mozilla.org/en/DOM/console.log>`_ to write the message to the |
| 70 Chrome's Developer Tools. | 71 JavaScript `console </devtools/docs/console-api>`_ in Chrome's Developer Tools. |
| 71 | 72 |
| 72 Debugging with printf | 73 Debugging with printf |
| 73 --------------------- | 74 --------------------- |
| 74 | 75 |
| 75 Your C/C++ code can perform inline printf debugging to stdout and stderr by | 76 Your C/C++ code can perform inline printf debugging to stdout and stderr by |
| 76 calling fprintf() directly, or by using cover functions like these: | 77 calling fprintf() directly, or by using cover functions like these: |
| 77 | 78 |
| 78 .. naclcode:: | 79 .. naclcode:: |
| 79 | 80 |
| 80 #include <stdio.h> | 81 #include <stdio.h> |
| 81 void logmsg(const char* pMsg){ | 82 void logmsg(const char* pMsg){ |
| 82 fprintf(stdout,"logmsg: %s\n",pMsg); | 83 fprintf(stdout,"logmsg: %s\n",pMsg); |
| 83 } | 84 } |
| 84 void errormsg(const char* pMsg){ | 85 void errormsg(const char* pMsg){ |
| 85 fprintf(stderr,"logerr: %s\n",pMsg); | 86 fprintf(stderr,"logerr: %s\n",pMsg); |
| 86 } | 87 } |
| 87 | 88 |
| 88 By default stdout and stderr will appear in Chrome's stdout and stderr stream | 89 By default stdout and stderr will appear in Chrome's stdout and stderr stream |
| 89 but they can also be redirected as described below. | 90 but they can also be redirected as described below. |
| 90 | 91 |
| 92 |
| 91 Redirecting output to log files | 93 Redirecting output to log files |
| 92 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 94 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 93 | 95 |
| 94 You can redirect stdout and stderr to output files by setting these environment
variables: | 96 You can redirect stdout and stderr to output files by setting these environment |
| 97 variables: |
| 95 | 98 |
| 96 * ``NACL_EXE_STDOUT=c:\nacl_stdout.log`` | 99 * ``NACL_EXE_STDOUT=c:\nacl_stdout.log`` |
| 97 * ``NACL_EXE_STDERR=c:\nacl_stderr.log`` | 100 * ``NACL_EXE_STDERR=c:\nacl_stderr.log`` |
| 98 | 101 |
| 99 There is another variable, ``NACLLOG``, that you can use to redirect Native | 102 There is another variable, ``NACLLOG``, that you can use to redirect Native |
| 100 Client's internally-generated messages. This variable is set to stderr by | 103 Client's internally-generated messages. This variable is set to stderr by |
| 101 default; you can redirect these messages to an output file by setting the | 104 default; you can redirect these messages to an output file by setting the |
| 102 variable as follows: | 105 variable as follows: |
| 103 | 106 |
| 104 * ``NACLLOG=c:\nacl.log`` | 107 * ``NACLLOG=c:\nacl.log`` |
| 105 | 108 |
| 106 .. Note:: | 109 .. Note:: |
| 107 :class: note | 110 :class: note |
| 108 | 111 |
| 109 **Note:** If you set the NACL_EXE_STDOUT, NACL_EXE_STDERR, or NACLLOG | 112 **Note:** If you set the ``NACL_EXE_STDOUT``, ``NACL_EXE_STDERR``, or |
| 110 variables to redirect output to a file, you must run Chrome with the | 113 ``NACLLOG`` variables to redirect output to a file, you must run Chrome with |
| 111 ``--no-sandbox`` flag. You must also be careful that each variable points to | 114 the ``--no-sandbox`` flag. You must also be careful that each variable points |
| 112 a different file. | 115 to a different file. |
| 113 | 116 |
| 114 Redirecting output to the JavaScript console | 117 Redirecting output to the JavaScript console |
| 115 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 118 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 116 | 119 |
| 117 You can also cause output from printf statements in your C/C++ code to be | 120 You can also cause output from printf statements in your C/C++ code to be |
| 118 relayed to the JavaScript side of your application through the Pepper messaging | 121 relayed to the JavaScript side of your application through the Pepper messaging |
| 119 system, where you can then write the output to the JavaScript console. Follow | 122 system, where you can then write the output to the JavaScript console. Follow |
| 120 these steps: | 123 these steps: |
| 121 | 124 |
| 122 #. Set the NACL_EXE_STDOUT and NACL_EXE_STDERR environment variables as | 125 #. Set the ``NACL_EXE_STDOUT`` and ``NACL_EXE_STDERR`` environment variables as |
| 123 follows: | 126 follows: |
| 124 | 127 |
| 125 * NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage | 128 * ``NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage`` |
| 126 * NACL_EXE_STDERR=DEBUG_ONLY:dev://postmessage | 129 * ``NACL_EXE_STDERR=DEBUG_ONLY:dev://postmessage`` |
| 127 | 130 |
| 128 These settings tell Native Client to use PostMessage() to send output that | 131 These settings tell Native Client to use ``PostMessage()`` to send output |
| 129 your Native Client module writes to stdout and stderr to the JavaScript side | 132 that your Native Client module writes to stdout and stderr to the JavaScript |
| 130 of your application. | 133 side of your application. |
| 131 | 134 |
| 132 #. Register a JavaScript handler to receive messages from your Native Client | 135 #. Register a JavaScript handler to receive messages from your Native Client |
| 133 module: | 136 module: |
| 134 | 137 |
| 135 .. naclcode:: | 138 .. naclcode:: |
| 136 | 139 |
| 137 <div id="nacl_container"> | 140 <div id="nacl_container"> |
| 138 <script type="text/javascript"> | 141 <script type="text/javascript"> |
| 139 var container = document.getElementById('nacl_container'); | 142 var container = document.getElementById('nacl_container'); |
| 140 container.addEventListener('message', handleMessage, true); | 143 container.addEventListener('message', handleMessage, true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 154 } | 157 } |
| 155 | 158 |
| 156 This handler works in the simple case where the only messages your Native | 159 This handler works in the simple case where the only messages your Native |
| 157 Client module sends to JavaScript are messages with the output from stdout | 160 Client module sends to JavaScript are messages with the output from stdout |
| 158 and stderr. If your Native Client module also sends other messages to | 161 and stderr. If your Native Client module also sends other messages to |
| 159 JavaScript, your handler will need to be more complex. | 162 JavaScript, your handler will need to be more complex. |
| 160 | 163 |
| 161 Once you've implemented a message handler and set up the environment | 164 Once you've implemented a message handler and set up the environment |
| 162 variables as described above, you can check the JavaScript console to see | 165 variables as described above, you can check the JavaScript console to see |
| 163 output that your Native Client module prints to stdout and stderr. Keep in | 166 output that your Native Client module prints to stdout and stderr. Keep in |
| 164 mind that your module makes a call to PostMessage() every time it flushes | 167 mind that your module makes a call to ``PostMessage()`` every time it flushes |
| 165 stdout or stderr. Your application's performance will degrade considerably | 168 stdout or stderr. Your application's performance will degrade considerably |
| 166 if your module prints and flushes frequently, or if it makes frequent Pepper | 169 if your module prints and flushes frequently, or if it makes frequent Pepper |
| 167 calls to begin with (e.g., to render). | 170 calls to begin with (e.g., to render). |
| 168 | 171 |
| 169 Logging calls to Pepper interfaces | 172 Logging calls to Pepper interfaces |
| 170 ---------------------------------- | 173 ---------------------------------- |
| 171 | 174 |
| 172 You can log all Pepper calls your module makes by passing the following flags | 175 You can log all Pepper calls your module makes by passing the following flags |
| 173 to Chrome on startup:: | 176 to Chrome on startup:: |
| 174 | 177 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 194 link it to the running code. | 197 link it to the running code. |
| 195 | 198 |
| 196 .. _using_gdb: | 199 .. _using_gdb: |
| 197 | 200 |
| 198 Debugging with nacl-gdb | 201 Debugging with nacl-gdb |
| 199 ----------------------- | 202 ----------------------- |
| 200 | 203 |
| 201 The Native Client SDK includes a command-line debugger that you can use to | 204 The Native Client SDK includes a command-line debugger that you can use to |
| 202 debug Native Client modules. The debugger is based on the GNU debugger `gdb | 205 debug Native Client modules. The debugger is based on the GNU debugger `gdb |
| 203 <http://www.gnu.org/software/gdb/>`_, and is located at | 206 <http://www.gnu.org/software/gdb/>`_, and is located at |
| 204 ``toolchain/<platform>_x86_newlib/bin/x86_64-nacl-gdb`` (where *<platform>* | 207 ``pepper_<version>/toolchain/<platform>_x86_newlib/bin/x86_64-nacl-gdb`` (where |
| 205 is the platform of your development machine: ``win``, ``mac``, or | 208 *<platform>* is the platform of your development machine: ``win``, ``mac``, or |
| 206 ``linux``). | 209 ``linux``). |
| 207 | 210 |
| 208 Note that this same copy of GDB can be used to debug any NaCl program, | 211 Note that this same copy of GDB can be used to debug any NaCl program, |
| 209 whether built using newlib or glibc for x86-32, x86-64 or ARM. In the SDK, | 212 whether built using newlib or glibc for x86-32, x86-64 or ARM. In the SDK, |
| 210 ``i686-nacl-gdb`` is an alias for ``x86_64-nacl-gdb``, and the ``newlib`` | 213 ``i686-nacl-gdb`` is an alias for ``x86_64-nacl-gdb``, and the ``newlib`` |
| 211 and ``glibc`` toolchains both contain the same version of GDB. | 214 and ``glibc`` toolchains both contain the same version of GDB. |
| 212 | 215 |
| 213 .. _debugging_pnacl_pexes: | 216 .. _debugging_pnacl_pexes: |
| 214 | 217 |
| 215 Debugging PNaCl pexes (with Pepper 35+) | 218 Debugging PNaCl pexes (Pepper 35 or later) |
| 216 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 219 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 217 | 220 |
| 218 If you want to use GDB to debug a program that is compiled with the PNaCl | 221 If you want to use GDB to debug a program that is compiled with the PNaCl |
| 219 toolchain, you must have a copy of the pexe from **before** running | 222 toolchain, you must have a copy of the pexe from **before** running |
| 220 ``pnacl-finalize``. The ``pnacl-finalize`` tool converts LLVM bitcode | 223 ``pnacl-finalize``. The ``pnacl-finalize`` tool converts LLVM bitcode |
| 221 to the stable PNaCl bitcode format, but it also strips out debug | 224 to the stable PNaCl bitcode format, but it also strips out debug |
| 222 metadata, which we need for debugging. In this section we'll give the | 225 metadata, which we need for debugging. In this section we'll give the |
| 223 LLVM bitcode file a ``.bc`` file extension, and the PNaCl bitcode file | 226 LLVM bitcode file a ``.bc`` file extension, and the PNaCl bitcode file |
| 224 a ``.pexe`` file extension. The actual extension should not matter, but | 227 a ``.pexe`` file extension. The actual extension should not matter, but |
| 225 it helps distinguish between the two types of files. | 228 it helps distinguish between the two types of files. |
| 226 | 229 |
| 227 **Note** unlike the finalized copy of the pexe, the non-finalized debug copy | 230 **Note** unlike the finalized copy of the pexe, the non-finalized debug copy |
| 228 is not considered stable. This means that a debug copy of the PNaCl | 231 is not considered stable. This means that a debug copy of the PNaCl |
| 229 application created by a Pepper N SDK is only guaranteed to run | 232 application created by a Pepper N SDK is only guaranteed to run |
| 230 with a matching Chrome version N. If the version of the debug bitcode pexe | 233 with a matching Chrome version N. If the version of the debug bitcode pexe |
| 231 does not match that of Chrome then the translation process may fail, and | 234 does not match that of Chrome then the translation process may fail, and |
| 232 you will see and error message in the JavaScript console. | 235 you will see an error message in the JavaScript console. |
| 233 | 236 |
| 234 Also, make sure you are passing the ``-g`` :ref:`compile option | 237 Also, make sure you are passing the ``-g`` :ref:`compile option |
| 235 <compile_flags>` to ``pnacl-clang`` to enable generating debugging info. | 238 <compile_flags>` to ``pnacl-clang`` to enable generating debugging info. |
| 236 You might also want to omit ``-O2`` from the compile-time and link-time | 239 You might also want to omit ``-O2`` from the compile-time and link-time |
| 237 options, otherwise GDB not might be able to print variables' values when | 240 options, otherwise GDB not might be able to print variables' values when |
| 238 debugging (this is more of a problem with the PNaCl/LLVM toolchain than | 241 debugging (this is more of a problem with the PNaCl/LLVM toolchain than |
| 239 with GCC). | 242 with GCC). |
| 240 | 243 |
| 241 Once you have built a non-stable debug copy of the pexe, list the URL of | 244 Once you have built a non-stable debug copy of the pexe, list the URL of |
| 242 that copy in your application's manifest file: | 245 that copy in your application's manifest file: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 <compile_flags>` to ``pnacl-clang`` to enable generating debugging info. | 289 <compile_flags>` to ``pnacl-clang`` to enable generating debugging info. |
| 287 You might also want to omit ``-O2`` from the compile-time and link-time | 290 You might also want to omit ``-O2`` from the compile-time and link-time |
| 288 options. | 291 options. |
| 289 | 292 |
| 290 * Secondly, use ``pnacl-translate`` to convert your ``pexe`` to one or more | 293 * Secondly, use ``pnacl-translate`` to convert your ``pexe`` to one or more |
| 291 ``nexe`` files. For example: | 294 ``nexe`` files. For example: |
| 292 | 295 |
| 293 .. naclcode:: | 296 .. naclcode:: |
| 294 :prettyprint: 0 | 297 :prettyprint: 0 |
| 295 | 298 |
| 296 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-translate ^ | 299 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-translate \ |
| 297 --allow-llvm-bitcode-input hello_world.pexe -arch x86-32 -o hello_world_x8
6_32.nexe | 300 --allow-llvm-bitcode-input hello_world.pexe -arch x86-32 \ |
| 298 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-translate ^ | 301 -o hello_world_x86_32.nexe |
| 299 --allow-llvm-bitcode-input hello_world.pexe -arch x86-64 -o hello_world_x8
6_64.nexe | 302 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-translate \ |
| 303 --allow-llvm-bitcode-input hello_world.pexe -arch x86-64 \ |
| 304 -o hello_world_x86_64.nexe |
| 300 | 305 |
| 301 For this, use the non-finalized ``pexe`` file produced by | 306 For this, use the non-finalized ``pexe`` file produced by |
| 302 ``pnacl-clang``, not the ``pexe`` file produced by ``pnacl-finalize``. | 307 ``pnacl-clang``, not the ``pexe`` file produced by ``pnacl-finalize``. |
| 303 The latter ``pexe`` has debugging info stripped out. The option | 308 The latter ``pexe`` has debugging info stripped out. The option |
| 304 ``--allow-llvm-bitcode-input`` tells ``pnacl-translate`` to accept a | 309 ``--allow-llvm-bitcode-input`` tells ``pnacl-translate`` to accept a |
| 305 non-finalized ``pexe``. | 310 non-finalized ``pexe``. |
| 306 | 311 |
| 307 * Replace the ``nmf`` :ref:`manifest file <manifest_file>` that points to | 312 * Replace the ``nmf`` :ref:`manifest file <manifest_file>` that points to |
| 308 your ``pexe`` file with one that points to the ``nexe`` files. For the | 313 your ``pexe`` file with one that points to the ``nexe`` files. For the |
| 309 example ``nexe`` filenames above, the new ``nmf`` file would contain: | 314 example ``nexe`` filenames above, the new ``nmf`` file would contain: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 in the directory where that page is located). | 417 in the directory where that page is located). |
| 413 | 418 |
| 414 #. Navigate to your application's page in Chrome. (You don't need to do this if | 419 #. Navigate to your application's page in Chrome. (You don't need to do this if |
| 415 you specified a URL when you launched Chrome in the previous step.) Chrome | 420 you specified a URL when you launched Chrome in the previous step.) Chrome |
| 416 will start loading the application, then pause and wait until you start | 421 will start loading the application, then pause and wait until you start |
| 417 nacl-gdb and run the ``continue`` command. | 422 nacl-gdb and run the ``continue`` command. |
| 418 | 423 |
| 419 #. Go to the directory with your source code, and run nacl-gdb from there. For | 424 #. Go to the directory with your source code, and run nacl-gdb from there. For |
| 420 example:: | 425 example:: |
| 421 | 426 |
| 422 cd <NACL_SDK_ROOT>/examples/hello_world_gles | 427 cd nacl_sdk/pepper_<version>/examples/demo/drive |
| 423 <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb | 428 nacl_sdk/pepper_<version>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb |
| 424 | 429 |
| 425 The debugger will start and show you a gdb prompt:: | 430 The debugger will start and show you a gdb prompt:: |
| 426 | 431 |
| 427 (gdb) | 432 (gdb) |
| 428 | 433 |
| 429 #. For debugging PNaCl pexes run the following gdb command lines | 434 #. Run the debugging command lines. |
| 430 (skip to the next item if you are using NaCl instead of PNaCl):: | |
| 431 | 435 |
| 436 **For PNaCl**:: |
| 437 |
| 432 (gdb) target remote localhost:4014 | 438 (gdb) target remote localhost:4014 |
| 433 (gdb) remote get nexe <path-to-save-translated-nexe-with-debug-info> | 439 (gdb) remote get nexe <path-to-save-translated-nexe-with-debug-info> |
| 434 (gdb) file <path-to-save-translated-nexe-with-debug-info> | 440 (gdb) file <path-to-save-translated-nexe-with-debug-info> |
| 435 (gdb) remote get irt <path-to-save-NaCl-integrated-runtime> | 441 (gdb) remote get irt <path-to-save-NaCl-integrated-runtime> |
| 436 (gdb) nacl-irt <path-to-saved-NaCl-integrated-runtime> | 442 (gdb) nacl-irt <path-to-saved-NaCl-integrated-runtime> |
| 437 | 443 |
| 438 #. For NaCl nexes, run the following commands from the gdb command line:: | 444 **For NaCl**:: |
| 439 | 445 |
| 440 (gdb) target remote localhost:4014 | 446 (gdb) target remote localhost:4014 |
| 441 (gdb) nacl-manifest <path-to-your-.nmf-file> | 447 (gdb) nacl-manifest <path-to-your-.nmf-file> |
| 442 (gdb) remote get irt <path-to-save-NaCl-integrated-runtime> | 448 (gdb) remote get irt <path-to-save-NaCl-integrated-runtime> |
| 443 (gdb) nacl-irt <path-to-saved-NaCl-integrated-runtime> | 449 (gdb) nacl-irt <path-to-saved-NaCl-integrated-runtime> |
| 444 | 450 |
| 445 #. The command used for PNaCl and NaCl are described below: | 451 #. The command used for PNaCl and NaCl are described below: |
| 446 | 452 |
| 447 ``target remote localhost:4014`` | 453 ``target remote localhost:4014`` |
| 448 Tells the debugger how to connect to the debug stub in the Native Client | 454 Tells the debugger how to connect to the debug stub in the Native Client |
| 449 application loader. This connection occurs through TCP port 4014 (note | 455 application loader. This connection occurs through TCP port 4014 (note |
| (...skipping 17 matching lines...) Expand all Loading... |
| 467 | 473 |
| 468 ``remote get irt <path>`` | 474 ``remote get irt <path>`` |
| 469 This saves the Native Client Integrated Runtime (IRT). Normally, | 475 This saves the Native Client Integrated Runtime (IRT). Normally, |
| 470 the IRT is located in the same directory as the Chrome executable, | 476 the IRT is located in the same directory as the Chrome executable, |
| 471 or in a subdirectory named after the Chrome version. For example, if | 477 or in a subdirectory named after the Chrome version. For example, if |
| 472 you're running Chrome canary on Windows, the path to the IRT typically | 478 you're running Chrome canary on Windows, the path to the IRT typically |
| 473 looks something like ``C:/Users/<username>/AppData/Local/Google/Chrome | 479 looks something like ``C:/Users/<username>/AppData/Local/Google/Chrome |
| 474 SxS/Application/23.0.1247.1/nacl_irt_x86_64.nexe``. | 480 SxS/Application/23.0.1247.1/nacl_irt_x86_64.nexe``. |
| 475 The ``remote get irt <path>`` saves that to the current working | 481 The ``remote get irt <path>`` saves that to the current working |
| 476 directory so that you do not need to find where exactly the IRT | 482 directory so that you do not need to find where exactly the IRT |
| 477 is stored alongside Chrome. | 483 is stored. |
| 478 | 484 |
| 479 ``nacl-irt <path>`` | 485 ``nacl-irt <path>`` |
| 480 Tells the debugger where to find the Native Client Integrated Runtime | 486 Tells the debugger where to find the Native Client Integrated Runtime |
| 481 (IRT). ``<path>`` can either be the location of the copy saved by | 487 (IRT). ``<path>`` can either be the location of the copy saved by |
| 482 ``remote get irt <path>`` or the copy that is installed alongside Chrome. | 488 ``remote get irt <path>`` or the copy that is installed alongside Chrome. |
| 483 | 489 |
| 484 A couple of notes on how to specify path names in the nacl-gdb commands | 490 A couple of notes on how to specify path names in the nacl-gdb commands |
| 485 above: | 491 above: |
| 486 | 492 |
| 487 * You can use a forward slash to separate directories on Linux, Mac, and | 493 * You can use a forward slash to separate directories on Linux, Mac, and |
| 488 Windows. If you use a backslash to separate directories on Windows, you | 494 Windows. If you use a backslash to separate directories on Windows, you |
| 489 must escape the backslash by using a double backslash "\\" between | 495 must escape the backslash by using a double backslash "\\" between |
| 490 directories. | 496 directories. |
| 491 * If any directories in the path have spaces in their name, you must put | 497 * If any directories in the path have spaces in their name, you must put |
| 492 quotation marks around the path. | 498 quotation marks around the path. |
| 493 | 499 |
| 494 As an example, here is a what these nacl-gdb commands might look like on | 500 As an example, here is a what these nacl-gdb commands might look like on |
| 495 Windows:: | 501 Windows:: |
| 496 | 502 |
| 497 target remote localhost:4014 | 503 target remote localhost:4014 |
| 498 nacl-manifest "C:/<NACL_SDK_ROOT>/examples/hello_world_gles/newlib/Debug/he
llo_world_gles.nmf" | 504 nacl-manifest "C:/nacl_sdk/pepper_<version>/examples/hello_world_gles/newli
b/Debug/hello_world_gles.nmf" |
| 499 nacl-irt "C:/Users/<username>/AppData/Local/Google/Chrome SxS/Application/2
3.0.1247.1/nacl_irt_x86_64.nexe" | 505 nacl-irt "C:/Users/<username>/AppData/Local/Google/Chrome SxS/Application/2
3.0.1247.1/nacl_irt_x86_64.nexe" |
| 500 | 506 |
| 501 To save yourself some typing, you can put put these nacl-gdb commands in a | 507 To save yourself some typing, you can put put these nacl-gdb commands in a |
| 502 script file, and execute the file when you run nacl-gdb, like so:: | 508 script file, and execute the file when you run nacl-gdb, like so:: |
| 503 | 509 |
| 504 <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb -x <nacl-scrip
t-file> | 510 nacl_sdk/pepper_<version>/toolchain/win_x86_newlib/bin/x86_64-nacl-gdb -x <
nacl-script-file> |
| 505 | 511 |
| 506 If nacl-gdb connects successfully to Chrome, it displays a message such as | 512 If nacl-gdb connects successfully to Chrome, it displays a message such as |
| 507 the one below, followed by a gdb prompt:: | 513 the one below, followed by a gdb prompt:: |
| 508 | 514 |
| 509 0x000000000fc00200 in _start () | 515 0x000000000fc00200 in _start () |
| 510 (gdb) | 516 (gdb) |
| 511 | 517 |
| 512 If nacl-gdb can't connect to Chrome, it displays a message such as | 518 If nacl-gdb can't connect to Chrome, it displays a message such as |
| 513 "``localhost:4014: A connection attempt failed``" or "``localhost:4014: | 519 "``localhost:4014: A connection attempt failed``" or "``localhost:4014: |
| 514 Connection timed out.``" If you see a message like that, make sure that you | 520 Connection timed out.``" If you see a message like that, make sure that you |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 <http://www.chromium.org/nativeclient>`_ that describe how to do profiling on | 596 <http://www.chromium.org/nativeclient>`_ that describe how to do profiling on |
| 591 `64-bit Windows | 597 `64-bit Windows |
| 592 <https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl
-apps-on-64-bit-windows>`_ | 598 <https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl
-apps-on-64-bit-windows>`_ |
| 593 and `Linux | 599 and `Linux |
| 594 <http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on
-x86-64>`_ | 600 <http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on
-x86-64>`_ |
| 595 machines. | 601 machines. |
| 596 | 602 |
| 597 | 603 |
| 598 .. |menu-icon| image:: /images/menu-icon.png | 604 .. |menu-icon| image:: /images/menu-icon.png |
| 599 .. |puzzle| image:: /images/puzzle.png | 605 .. |puzzle| image:: /images/puzzle.png |
| OLD | NEW |