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 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 Basic debugging | 62 Basic debugging |
63 =============== | 63 =============== |
64 | 64 |
65 Writing messages to the JavaScript console | 65 Writing messages to the JavaScript console |
66 ------------------------------------------ | 66 ------------------------------------------ |
67 | 67 |
68 You can send messages from your C/C++ code to JavaScript using the PostMessage | 68 You can send messages from your C/C++ code to JavaScript using the PostMessage |
69 call in the :doc:`Pepper messaging system <../coding/message-system>`. When the | 69 call in the :doc:`Pepper messaging system <../coding/message-system>`. When the |
70 JavaScript code receives a message, its message event handler can call | 70 JavaScript code receives a message, its message event handler can call |
71 `console.log() <https://developer.mozilla.org/en/DOM/console.log>`_ to write | 71 `console.log() <https://developer.mozilla.org/en/DOM/console.log>`_ to write |
72 the message to the JavaScript `console | 72 the message to the JavaScript `console </devtools/docs/console-api>`_ in |
73 <https://developers.google.com/chrome-developer-tools/docs/console>`_ in | |
74 Chrome's Developer Tools. | 73 Chrome's Developer Tools. |
75 | 74 |
76 Debugging with printf | 75 Debugging with printf |
77 --------------------- | 76 --------------------- |
78 | 77 |
79 Your C/C++ code can perform inline printf debugging to stdout and stderr by | 78 Your C/C++ code can perform inline printf debugging to stdout and stderr by |
80 calling fprintf() directly, or by using cover functions like these: | 79 calling fprintf() directly, or by using cover functions like these: |
81 | 80 |
82 .. naclcode:: | 81 .. naclcode:: |
83 | 82 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 ``--user-data-dir=<directory>`` | 385 ``--user-data-dir=<directory>`` |
387 Specifies the `user data directory | 386 Specifies the `user data directory |
388 <http://www.chromium.org/user-experience/user-data-directory>`_ from which | 387 <http://www.chromium.org/user-experience/user-data-directory>`_ from which |
389 Chrome should load its state. You can specify a different user data | 388 Chrome should load its state. You can specify a different user data |
390 directory so that changes you make to Chrome in your debugging session do | 389 directory so that changes you make to Chrome in your debugging session do |
391 not affect your personal Chrome data (history, cookies, bookmarks, themes, | 390 not affect your personal Chrome data (history, cookies, bookmarks, themes, |
392 and settings). | 391 and settings). |
393 | 392 |
394 ``--nacl-debug-mask=<nmf_url_mask1,nmf_url_mask2,...>`` | 393 ``--nacl-debug-mask=<nmf_url_mask1,nmf_url_mask2,...>`` |
395 Specifies a set of debug mask patterns. This allows you to selectively | 394 Specifies a set of debug mask patterns. This allows you to selectively |
396 choose to debug certain applications and not debug others. For example, | 395 choose to debug certain applications and not debug others. For example, if |
397 if you only want to debug the NMF files for your applications at | 396 you only want to debug the NMF files for your applications at |
398 ``https://example.com/app``, and no other NaCl applications found | 397 ``https://example.com/app``, and no other NaCl applications found on the |
399 on the web, specify ``--nacl-debug-mask=https://example.com/app/*.nmf``. | 398 web, specify ``--nacl-debug-mask=https://example.com/app/*.nmf``. This |
400 This helps prevent accidentally debugging other NaCl applications if | 399 helps prevent accidentally debugging other NaCl applications if you like |
401 you like to leave the ``--enable-nacl-debug`` flag turned on. | 400 to leave the ``--enable-nacl-debug`` flag turned on. The pattern language |
402 The pattern language for the mask follows `chrome extension match patterns | 401 for the mask follows `chrome extension match patterns |
403 <http://developer.chrome.com/extensions/match_patterns>`_. | 402 </extensions/match_patterns>`_. The pattern set can be inverted by |
404 The pattern set can be inverted by prefixing the pattern set with | 403 prefixing the pattern set with the ``!`` character. |
405 the ``!`` character. | |
406 | 404 |
407 ``<URL>`` | 405 ``<URL>`` |
408 Specifies the URL Chrome should open when it launches. The local server | 406 Specifies the URL Chrome should open when it launches. The local server |
409 that comes with the SDK listens on port 5103 by default, so the URL when | 407 that comes with the SDK listens on port 5103 by default, so the URL when |
410 you're debugging is typically ``localhost:5103`` (assuming that your | 408 you're debugging is typically ``localhost:5103`` (assuming that your |
411 application's page is called index.html and that you run the local server | 409 application's page is called index.html and that you run the local server |
412 in the directory where that page is located). | 410 in the directory where that page is located). |
413 | 411 |
414 #. Navigate to your application's page in Chrome. (You don't need to do this if | 412 #. 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 | 413 you specified a URL when you launched Chrome in the previous step.) Chrome |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 <http://www.chromium.org/nativeclient>`_ that describe how to do profiling on | 588 <http://www.chromium.org/nativeclient>`_ that describe how to do profiling on |
591 `64-bit Windows | 589 `64-bit Windows |
592 <https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl
-apps-on-64-bit-windows>`_ | 590 <https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl
-apps-on-64-bit-windows>`_ |
593 and `Linux | 591 and `Linux |
594 <http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on
-x86-64>`_ | 592 <http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on
-x86-64>`_ |
595 machines. | 593 machines. |
596 | 594 |
597 | 595 |
598 .. |menu-icon| image:: /images/menu-icon.png | 596 .. |menu-icon| image:: /images/menu-icon.png |
599 .. |puzzle| image:: /images/puzzle.png | 597 .. |puzzle| image:: /images/puzzle.png |
OLD | NEW |