Chromium Code Reviews| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 void logmsg(const char* pMsg){ | 82 void logmsg(const char* pMsg){ |
| 83 fprintf(stdout,"logmsg: %s\n",pMsg); | 83 fprintf(stdout,"logmsg: %s\n",pMsg); |
| 84 } | 84 } |
| 85 void errormsg(const char* pMsg){ | 85 void errormsg(const char* pMsg){ |
| 86 fprintf(stderr,"logerr: %s\n",pMsg); | 86 fprintf(stderr,"logerr: %s\n",pMsg); |
| 87 } | 87 } |
| 88 | 88 |
| 89 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 |
| 90 but they can also be redirected as described below. | 90 but they can also be redirected as described below. |
| 91 | 91 |
| 92 .. _redirecting-output-to-log: | |
| 92 | 93 |
| 93 Redirecting output to log files | 94 Redirecting output to log files |
| 94 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 95 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 95 | 96 |
| 96 You can redirect stdout and stderr to output files by setting these environment | 97 You can redirect stdout and stderr to output files by setting these environment |
| 97 variables: | 98 variables: |
| 98 | 99 |
| 99 * ``NACL_EXE_STDOUT=c:\nacl_stdout.log`` | 100 * ``NACL_EXE_STDOUT=c:\nacl_stdout.log`` |
| 100 * ``NACL_EXE_STDERR=c:\nacl_stderr.log`` | 101 * ``NACL_EXE_STDERR=c:\nacl_stderr.log`` |
| 101 | 102 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 quit gdb | 507 quit gdb |
| 507 | 508 |
| 508 See the `gdb documentation | 509 See the `gdb documentation |
| 509 <http://sourceware.org/gdb/current/onlinedocs/gdb/#toc_Top>`_ for a | 510 <http://sourceware.org/gdb/current/onlinedocs/gdb/#toc_Top>`_ for a |
| 510 comprehensive list of gdb commands. Note that you can abbreviate most commands | 511 comprehensive list of gdb commands. Note that you can abbreviate most commands |
| 511 to just their first letter (``b`` for break, ``c`` for continue, and so on). | 512 to just their first letter (``b`` for break, ``c`` for continue, and so on). |
| 512 | 513 |
| 513 To interrupt execution of your module, press <Ctrl-c>. When you're done | 514 To interrupt execution of your module, press <Ctrl-c>. When you're done |
| 514 debugging, close the Chrome window and type ``q`` to quit gdb. | 515 debugging, close the Chrome window and type ``q`` to quit gdb. |
| 515 | 516 |
| 516 Debugging with other tools | 517 Non-Standard Debugging |
| 517 ========================== | 518 ====================== |
| 519 | |
| 520 .. _nacl-io-debugging: | |
| 521 | |
| 522 nacl_io | |
| 523 ------- | |
| 524 | |
| 525 The logging system for the :doc:`nacl_io library <../coding/nacl_io>` writes | |
| 526 directly to the ``stderr`` stream of the NaCl process. It deliberately bypasses | |
| 527 the standard library functions implemented in nacl_io to avoid circular calls to | |
| 528 itself. | |
|
Sam Clegg
2014/09/30 17:17:02
I would put this paragraph in the NaCl document ra
Sam Clegg
2014/09/30 17:28:37
Sorry, I meant to write "the nacl_io documentation
jpmedley
2014/10/01 21:17:11
Done.
| |
| 529 | |
| 530 The stderr from the process is by default visible in the terminal that launched | |
| 531 chrome (at least on mac and linux). Be sure that when you launch chrome it | |
| 532 doesn't attach to an existing instance. One simple way to do this is to pass a | |
| 533 new directory to chrome as your user data directory (``chrome | |
| 534 --user-data-dir=<newdir>``). It's also possible to redirect the NaCl's stderr to | |
| 535 other places such as, for example, :ref:`log files | |
| 536 <redirecting-output-to-log>`. | |
|
Sam Clegg
2014/09/30 17:17:02
This second paragraph is just about how to capture
jpmedley
2014/10/01 21:17:11
Done.
| |
| 537 | |
| 538 Alternative Debuggers | |
| 539 --------------------- | |
| 518 | 540 |
| 519 If you cannot use the :ref:`Visual Studio add-in <visual_studio>`, or you want | 541 If you cannot use the :ref:`Visual Studio add-in <visual_studio>`, or you want |
| 520 to use a debugger other than nacl-gdb, you must manually build your module as a | 542 to use a debugger other than nacl-gdb, you must manually build your module as a |
| 521 Pepper plugin (sometimes referred to as a "`trusted | 543 Pepper plugin (sometimes referred to as a "`trusted |
| 522 <http://www.chromium.org/nativeclient/getting-started/getting-started-background -and-basics#TOC-Trusted-vs-Untrusted>`_" | 544 <http://www.chromium.org/nativeclient/getting-started/getting-started-background -and-basics#TOC-Trusted-vs-Untrusted>`_" |
| 523 or "in-process" plugin). Pepper plugins (.DLL files on Windows; .so files on | 545 or "in-process" plugin). Pepper plugins (.DLL files on Windows; .so files on |
| 524 Linux; .bundle files on Mac) are loaded directly in either the Chrome renderer | 546 Linux; .bundle files on Mac) are loaded directly in either the Chrome renderer |
| 525 process or a separate plugin process, rather than in Native Client. Building a | 547 process or a separate plugin process, rather than in Native Client. Building a |
| 526 module as a trusted Pepper plugin allows you to use standard debuggers and | 548 module as a trusted Pepper plugin allows you to use standard debuggers and |
| 527 development tools on your system, but when you're finished developing the | 549 development tools on your system, but when you're finished developing the |
| 528 plugin, you need to port it to Native Client (i.e., build the module with one | 550 plugin, you need to port it to Native Client (i.e., build the module with one |
| 529 of the toolchains in the NaCl SDK so that the module runs in Native Client). | 551 of the toolchains in the NaCl SDK so that the module runs in Native Client). |
| 530 For details on this advanced development technique, see `Debugging a Trusted | 552 For details on this advanced development technique, see `Debugging a Trusted |
| 531 Plugin | 553 Plugin |
| 532 <http://www.chromium.org/nativeclient/how-tos/debugging-documentation/debugging- a-trusted-plugin>`_. | 554 <http://www.chromium.org/nativeclient/how-tos/debugging-documentation/debugging- a-trusted-plugin>`_. |
| 533 Note that starting with the ``pepper_22`` bundle, the NaCl SDK for Windows | 555 Note that starting with the ``pepper_22`` bundle, the NaCl SDK for Windows |
| 534 includes pre-built libraries and library source code, making it much easier to | 556 includes pre-built libraries and library source code, making it much easier to |
| 535 build a module into a .DLL. | 557 build a module into a .DLL. |
| 536 | 558 |
| 537 | 559 |
| 538 .. |menu-icon| image:: /images/menu-icon.png | 560 .. |menu-icon| image:: /images/menu-icon.png |
| 539 .. |puzzle| image:: /images/puzzle.png | 561 .. |puzzle| image:: /images/puzzle.png |
| OLD | NEW |