Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: native_client_sdk/doc_generated/devguide/devcycle/debugging.html

Issue 530173003: Remove 'Redirecting output to the JavaScript console'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/doc/devguide/devcycle/debugging.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {{+bindTo:partials.standard_nacl_article}} 1 {{+bindTo:partials.standard_nacl_article}}
2 2
3 <section id="debugging"> 3 <section id="debugging">
4 <span id="devcycle-debugging"></span><h1 id="debugging"><span id="devcycle-debug ging"></span>Debugging</h1> 4 <span id="devcycle-debugging"></span><h1 id="debugging"><span id="devcycle-debug ging"></span>Debugging</h1>
5 <p>This document describes tools and techniques you can use to debug, monitor, 5 <p>This document describes tools and techniques you can use to debug, monitor,
6 and measure your application&#8217;s performance.</p> 6 and measure your application&#8217;s performance.</p>
7 <div class="contents local" id="table-of-contents" style="display: none"> 7 <div class="contents local" id="table-of-contents" style="display: none">
8 <p class="topic-title first">Table Of Contents</p> 8 <p class="topic-title first">Table Of Contents</p>
9 <ul class="small-gap"> 9 <ul class="small-gap">
10 <li><p class="first"><a class="reference internal" href="#diagnostic-information " id="id2">Diagnostic information</a></p> 10 <li><p class="first"><a class="reference internal" href="#diagnostic-information " id="id2">Diagnostic information</a></p>
11 <ul class="small-gap"> 11 <ul class="small-gap">
12 <li><a class="reference internal" href="#viewing-process-statistics-with-the-tas k-manager" id="id3">Viewing process statistics with the task manager</a></li> 12 <li><a class="reference internal" href="#viewing-process-statistics-with-the-tas k-manager" id="id3">Viewing process statistics with the task manager</a></li>
13 <li><a class="reference internal" href="#controlling-the-level-of-native-client- error-and-warning-messages" id="id4">Controlling the level of Native Client erro r and warning messages</a></li> 13 <li><a class="reference internal" href="#controlling-the-level-of-native-client- error-and-warning-messages" id="id4">Controlling the level of Native Client erro r and warning messages</a></li>
14 </ul> 14 </ul>
15 </li> 15 </li>
16 <li><p class="first"><a class="reference internal" href="#basic-debugging" id="i d5">Basic debugging</a></p> 16 <li><p class="first"><a class="reference internal" href="#basic-debugging" id="i d5">Basic debugging</a></p>
17 <ul class="small-gap"> 17 <ul class="small-gap">
18 <li><a class="reference internal" href="#writing-messages-to-the-javascript-cons ole" id="id6">Writing messages to the JavaScript console</a></li> 18 <li><a class="reference internal" href="#writing-messages-to-the-javascript-cons ole" id="id6">Writing messages to the JavaScript console</a></li>
19 <li><p class="first"><a class="reference internal" href="#debugging-with-printf" id="id7">Debugging with printf</a></p> 19 <li><p class="first"><a class="reference internal" href="#debugging-with-printf" id="id7">Debugging with printf</a></p>
20 <ul class="small-gap"> 20 <ul class="small-gap">
21 <li><a class="reference internal" href="#redirecting-output-to-log-files" id="id 8">Redirecting output to log files</a></li> 21 <li><a class="reference internal" href="#redirecting-output-to-log-files" id="id 8">Redirecting output to log files</a></li>
22 <li><a class="reference internal" href="#redirecting-output-to-the-javascript-co nsole" id="id9">Redirecting output to the JavaScript console</a></li>
23 </ul> 22 </ul>
24 </li> 23 </li>
25 <li><a class="reference internal" href="#logging-calls-to-pepper-interfaces" id= "id10">Logging calls to Pepper interfaces</a></li> 24 <li><a class="reference internal" href="#logging-calls-to-pepper-interfaces" id= "id9">Logging calls to Pepper interfaces</a></li>
26 <li><a class="reference internal" href="#debugging-with-visual-studio" id="id11" >Debugging with Visual Studio</a></li> 25 <li><a class="reference internal" href="#debugging-with-visual-studio" id="id10" >Debugging with Visual Studio</a></li>
27 <li><p class="first"><a class="reference internal" href="#debugging-with-nacl-gd b" id="id12">Debugging with nacl-gdb</a></p> 26 <li><p class="first"><a class="reference internal" href="#debugging-with-nacl-gd b" id="id11">Debugging with nacl-gdb</a></p>
28 <ul class="small-gap"> 27 <ul class="small-gap">
29 <li><a class="reference internal" href="#debugging-pnacl-pexes-pepper-35-or-late r" id="id13">Debugging PNaCl pexes (Pepper 35 or later)</a></li> 28 <li><a class="reference internal" href="#debugging-pnacl-pexes-pepper-35-or-late r" id="id12">Debugging PNaCl pexes (Pepper 35 or later)</a></li>
30 <li><a class="reference internal" href="#debugging-pnacl-pexes-with-older-pepper -toolchains" id="id14">Debugging PNaCl pexes (with older Pepper toolchains)</a>< /li> 29 <li><a class="reference internal" href="#debugging-pnacl-pexes-with-older-pepper -toolchains" id="id13">Debugging PNaCl pexes (with older Pepper toolchains)</a>< /li>
31 <li><a class="reference internal" href="#running-nacl-gdb" id="id15">Running nac l-gdb</a></li> 30 <li><a class="reference internal" href="#running-nacl-gdb" id="id14">Running nac l-gdb</a></li>
32 </ul> 31 </ul>
33 </li> 32 </li>
34 </ul> 33 </ul>
35 </li> 34 </li>
36 <li><p class="first"><a class="reference internal" href="#debugging-with-other-t ools" id="id16">Debugging with other tools</a></p> 35 <li><p class="first"><a class="reference internal" href="#debugging-with-other-t ools" id="id15">Debugging with other tools</a></p>
37 <ul class="small-gap"> 36 <ul class="small-gap">
38 <li><a class="reference internal" href="#open-source-profiling-tools" id="id17"> Open source profiling tools</a></li> 37 <li><a class="reference internal" href="#open-source-profiling-tools" id="id16"> Open source profiling tools</a></li>
39 </ul> 38 </ul>
40 </li> 39 </li>
41 </ul> 40 </ul>
42 41
43 </div><h2 id="diagnostic-information">Diagnostic information</h2> 42 </div><h2 id="diagnostic-information">Diagnostic information</h2>
44 <h3 id="viewing-process-statistics-with-the-task-manager">Viewing process statis tics with the task manager</h3> 43 <h3 id="viewing-process-statistics-with-the-task-manager">Viewing process statis tics with the task manager</h3>
45 <p>You can use Chrome&#8217;s Task Manager to display information about a Native Client 44 <p>You can use Chrome&#8217;s Task Manager to display information about a Native Client
46 application:</p> 45 application:</p>
47 <ol class="arabic simple"> 46 <ol class="arabic simple">
48 <li>Open the Task Manager by clicking the menu icon <img alt="menu-icon" src="/n ative-client/images/menu-icon.png" /> and choosing 47 <li>Open the Task Manager by clicking the menu icon <img alt="menu-icon" src="/n ative-client/images/menu-icon.png" /> and choosing
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 variable as follows:</p> 108 variable as follows:</p>
110 <ul class="small-gap"> 109 <ul class="small-gap">
111 <li><code>NACLLOG=c:\nacl.log</code></li> 110 <li><code>NACLLOG=c:\nacl.log</code></li>
112 </ul> 111 </ul>
113 <aside class="note"> 112 <aside class="note">
114 <strong>Note:</strong> If you set the <code>NACL_EXE_STDOUT</code>, <code>NACL_E XE_STDERR</code>, or 113 <strong>Note:</strong> If you set the <code>NACL_EXE_STDOUT</code>, <code>NACL_E XE_STDERR</code>, or
115 <code>NACLLOG</code> variables to redirect output to a file, you must run Chrome with 114 <code>NACLLOG</code> variables to redirect output to a file, you must run Chrome with
116 the <code>--no-sandbox</code> flag. You must also be careful that each variable points 115 the <code>--no-sandbox</code> flag. You must also be careful that each variable points
117 to a different file. 116 to a different file.
118 </aside> 117 </aside>
119 <h4 id="redirecting-output-to-the-javascript-console">Redirecting output to the JavaScript console</h4>
120 <p>You can also cause output from printf statements in your C/C++ code to be
121 relayed to the JavaScript side of your application through the Pepper messaging
122 system, where you can then write the output to the JavaScript console. Follow
123 these steps:</p>
124 <ol class="arabic">
125 <li><p class="first">Set the <code>NACL_EXE_STDOUT</code> and <code>NACL_EXE_STD ERR</code> environment variables as
126 follows:</p>
127 <ul class="small-gap">
128 <li><p class="first"><code>NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage</code></ p>
129 </li>
130 <li><p class="first"><code>NACL_EXE_STDERR=DEBUG_ONLY:dev://postmessage</code></ p>
131 </li>
132 </ul>
133 <p>These settings tell Native Client to use <code>PostMessage()</code> to send o utput
134 that your Native Client module writes to stdout and stderr to the JavaScript
135 side of your application.</p>
136 </li>
137 <li><p class="first">Register a JavaScript handler to receive messages from your Native Client
138 module:</p>
139 <pre class="prettyprint">
140 &lt;div id=&quot;nacl_container&quot;&gt;
141 &lt;script type=&quot;text/javascript&quot;&gt;
142 var container = document.getElementById('nacl_container');
143 container.addEventListener('message', handleMessage, true);
144 &lt;/script&gt;
145 &lt;embed id=&quot;nacl_module&quot;
146 src=&quot;my_application.nmf&quot;
147 type=&quot;application/x-nacl&quot; /&gt;
148 &lt;/div&gt;
149 </pre>
150 </li>
151 <li><p class="first">Implement a simple JavaScript handler that logs the message s it receives to
152 the JavaScript console:</p>
153 <pre class="prettyprint">
154 function handleMessage(message_event) {
155 console.log(message_event.data);
156 }
157 </pre>
158 <p>This handler works in the simple case where the only messages your Native
159 Client module sends to JavaScript are messages with the output from stdout
160 and stderr. If your Native Client module also sends other messages to
161 JavaScript, your handler will need to be more complex.</p>
162 <p>Once you&#8217;ve implemented a message handler and set up the environment
163 variables as described above, you can check the JavaScript console to see
164 output that your Native Client module prints to stdout and stderr. Keep in
165 mind that your module makes a call to <code>PostMessage()</code> every time it f lushes
166 stdout or stderr. Your application&#8217;s performance will degrade considerabl y
167 if your module prints and flushes frequently, or if it makes frequent Pepper
168 calls to begin with (e.g., to render).</p>
169 </li>
170 </ol>
171 <h3 id="logging-calls-to-pepper-interfaces">Logging calls to Pepper interfaces</ h3> 118 <h3 id="logging-calls-to-pepper-interfaces">Logging calls to Pepper interfaces</ h3>
172 <p>You can log all Pepper calls your module makes by passing the following flags 119 <p>You can log all Pepper calls your module makes by passing the following flags
173 to Chrome on startup:</p> 120 to Chrome on startup:</p>
174 <pre class="prettyprint"> 121 <pre class="prettyprint">
175 --vmodule=ppb*=4 --enable-logging=stderr 122 --vmodule=ppb*=4 --enable-logging=stderr
176 </pre> 123 </pre>
177 <p>The <code>vmodule</code> flag tells Chrome to log all calls to C Pepper inter faces that 124 <p>The <code>vmodule</code> flag tells Chrome to log all calls to C Pepper inter faces that
178 begin with &#8220;ppb&#8221; (that is, the interfaces that are implemented by th e browser 125 begin with &#8220;ppb&#8221; (that is, the interfaces that are implemented by th e browser
179 and that your module calls). The <code>enable-logging</code> flag tells Chrome t o log 126 and that your module calls). The <code>enable-logging</code> flag tells Chrome t o log
180 the calls to stderr.</p> 127 the calls to stderr.</p>
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 includes pre-built libraries and library source code, making it much easier to 478 includes pre-built libraries and library source code, making it much easier to
532 build a module into a .DLL.</p> 479 build a module into a .DLL.</p>
533 <h3 id="open-source-profiling-tools">Open source profiling tools</h3> 480 <h3 id="open-source-profiling-tools">Open source profiling tools</h3>
534 <p>For the brave-hearted there are open source tools at <a class="reference exte rnal" href="http://www.chromium.org/nativeclient">Chromium.org</a> that describe how to do profiling on 481 <p>For the brave-hearted there are open source tools at <a class="reference exte rnal" href="http://www.chromium.org/nativeclient">Chromium.org</a> that describe how to do profiling on
535 <a class="reference external" href="https://sites.google.com/a/chromium.org/dev/ nativeclient/how-tos/profiling-nacl-apps-on-64-bit-windows">64-bit Windows</a> 482 <a class="reference external" href="https://sites.google.com/a/chromium.org/dev/ nativeclient/how-tos/profiling-nacl-apps-on-64-bit-windows">64-bit Windows</a>
536 and <a class="reference external" href="http://www.chromium.org/nativeclient/how -tos/limited-profiling-with-oprofile-on-x86-64">Linux</a> 483 and <a class="reference external" href="http://www.chromium.org/nativeclient/how -tos/limited-profiling-with-oprofile-on-x86-64">Linux</a>
537 machines.</p> 484 machines.</p>
538 </section> 485 </section>
539 486
540 {{/partials.standard_nacl_article}} 487 {{/partials.standard_nacl_article}}
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/doc/devguide/devcycle/debugging.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698