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

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

Issue 438403003: [NaCl SDK Docs] Only generate one top-level <section> element. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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>
(...skipping 22 matching lines...) Expand all
33 </li> 33 </li>
34 </ul> 34 </ul>
35 </li> 35 </li>
36 <li><p class="first"><a class="reference internal" href="#debugging-with-other-t ools" id="id16">Debugging with other tools</a></p> 36 <li><p class="first"><a class="reference internal" href="#debugging-with-other-t ools" id="id16">Debugging with other tools</a></p>
37 <ul class="small-gap"> 37 <ul class="small-gap">
38 <li><a class="reference internal" href="#open-source-profiling-tools" id="id17"> Open source profiling tools</a></li> 38 <li><a class="reference internal" href="#open-source-profiling-tools" id="id17"> Open source profiling tools</a></li>
39 </ul> 39 </ul>
40 </li> 40 </li>
41 </ul> 41 </ul>
42 42
43 </div><section id="diagnostic-information"> 43 </div><h2 id="diagnostic-information">Diagnostic information</h2>
44 <h2 id="diagnostic-information">Diagnostic information</h2>
45 <section id="viewing-process-statistics-with-the-task-manager">
46 <h3 id="viewing-process-statistics-with-the-task-manager">Viewing process statis tics with the task manager</h3> 44 <h3 id="viewing-process-statistics-with-the-task-manager">Viewing process statis tics with the task manager</h3>
47 <p>You can use Chrome&#8217;s Task Manager to display information about a Native Client 45 <p>You can use Chrome&#8217;s Task Manager to display information about a Native Client
48 application:</p> 46 application:</p>
49 <ol class="arabic simple"> 47 <ol class="arabic simple">
50 <li>Open the Task Manager by clicking the menu icon <img alt="menu-icon" src="/n ative-client/images/menu-icon.png" /> and choosing 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
51 <strong>Tools &gt; Task manager</strong>.</li> 49 <strong>Tools &gt; Task manager</strong>.</li>
52 <li>When the Task Manager window appears, verify that the columns displaying 50 <li>When the Task Manager window appears, verify that the columns displaying
53 memory information are visible. If they are not, right click in the header 51 memory information are visible. If they are not, right click in the header
54 row and select the memory items from the popup menu that appears.</li> 52 row and select the memory items from the popup menu that appears.</li>
55 </ol> 53 </ol>
56 <p>A browser window running a Native Client application will have at least two 54 <p>A browser window running a Native Client application will have at least two
57 processes associated with it: a process for the app&#8217;s top level (the rende r 55 processes associated with it: a process for the app&#8217;s top level (the rende r
58 process managing the page including its HTML and any JavaScript) and one or 56 process managing the page including its HTML and any JavaScript) and one or
59 more processes for each instance of a Native Client module embedded in the page 57 more processes for each instance of a Native Client module embedded in the page
60 (each process running native code from one nexe file). The top-level process 58 (each process running native code from one nexe file). The top-level process
61 appears with the application&#8217;s icon and begins with the text &#8220;App:&# 8221;. A Native 59 appears with the application&#8217;s icon and begins with the text &#8220;App:&# 8221;. A Native
62 Client process appears with a Chrome extension icon (a jigsaw puzzle piece 60 Client process appears with a Chrome extension icon (a jigsaw puzzle piece
63 <img alt="puzzle" src="/native-client/images/puzzle.png" />) and begins with the text &#8220;Native Client module&#8221; followed by the URL 61 <img alt="puzzle" src="/native-client/images/puzzle.png" />) and begins with the text &#8220;Native Client module&#8221; followed by the URL
64 of its manifest file.</p> 62 of its manifest file.</p>
65 <p>From the Task Manager you can view the changing memory allocations of all the 63 <p>From the Task Manager you can view the changing memory allocations of all the
66 processes associated with a Native Client application. Each process has its own 64 processes associated with a Native Client application. Each process has its own
67 memory footprint. You can also see the rendering rate displayed as frames per 65 memory footprint. You can also see the rendering rate displayed as frames per
68 second (FPS). Note that the computation of render frames can be performed in 66 second (FPS). Note that the computation of render frames can be performed in
69 any process, but the rendering itself is always done in the top level 67 any process, but the rendering itself is always done in the top level
70 application process, so look for the rendering rate there.</p> 68 application process, so look for the rendering rate there.</p>
71 </section><section id="controlling-the-level-of-native-client-error-and-warning- messages">
72 <h3 id="controlling-the-level-of-native-client-error-and-warning-messages">Contr olling the level of Native Client error and warning messages</h3> 69 <h3 id="controlling-the-level-of-native-client-error-and-warning-messages">Contr olling the level of Native Client error and warning messages</h3>
73 <p>Native Client prints warning and error messages to stdout and stderr. You can 70 <p>Native Client prints warning and error messages to stdout and stderr. You can
74 increase the amount of Native Client&#8217;s diagnostic output by setting the 71 increase the amount of Native Client&#8217;s diagnostic output by setting the
75 following <a class="reference external" href="http://en.wikipedia.org/wiki/Envir onment_variable">environment variables</a>:</p> 72 following <a class="reference external" href="http://en.wikipedia.org/wiki/Envir onment_variable">environment variables</a>:</p>
76 <ul class="small-gap"> 73 <ul class="small-gap">
77 <li>NACL_PLUGIN_DEBUG=1</li> 74 <li>NACL_PLUGIN_DEBUG=1</li>
78 <li>NACL_SRPC_DEBUG=[1-255] (use a higher number for more verbose debug output)< /li> 75 <li>NACL_SRPC_DEBUG=[1-255] (use a higher number for more verbose debug output)< /li>
79 <li>NACLVERBOSITY=[1-255]</li> 76 <li>NACLVERBOSITY=[1-255]</li>
80 </ul> 77 </ul>
81 </section></section><section id="basic-debugging">
82 <h2 id="basic-debugging">Basic debugging</h2> 78 <h2 id="basic-debugging">Basic debugging</h2>
83 <section id="writing-messages-to-the-javascript-console">
84 <h3 id="writing-messages-to-the-javascript-console">Writing messages to the Java Script console</h3> 79 <h3 id="writing-messages-to-the-javascript-console">Writing messages to the Java Script console</h3>
85 <p>You can send messages from your C/C++ code to JavaScript using the PostMessag e 80 <p>You can send messages from your C/C++ code to JavaScript using the PostMessag e
86 call in the <a class="reference internal" href="/native-client/devguide/coding/m essage-system.html"><em>Pepper messaging system</em></a>. When the 81 call in the <a class="reference internal" href="/native-client/devguide/coding/m essage-system.html"><em>Pepper messaging system</em></a>. When the
87 JavaScript code receives a message, its message event handler can call 82 JavaScript code receives a message, its message event handler can call
88 <a class="reference external" href="https://developer.mozilla.org/en/DOM/console .log">console.log()</a> to write 83 <a class="reference external" href="https://developer.mozilla.org/en/DOM/console .log">console.log()</a> to write
89 the message to the JavaScript <a class="reference external" href="/devtools/docs /console-api">console</a> in 84 the message to the JavaScript <a class="reference external" href="/devtools/docs /console-api">console</a> in
90 Chrome&#8217;s Developer Tools.</p> 85 Chrome&#8217;s Developer Tools.</p>
91 </section><section id="debugging-with-printf">
92 <h3 id="debugging-with-printf">Debugging with printf</h3> 86 <h3 id="debugging-with-printf">Debugging with printf</h3>
93 <p>Your C/C++ code can perform inline printf debugging to stdout and stderr by 87 <p>Your C/C++ code can perform inline printf debugging to stdout and stderr by
94 calling fprintf() directly, or by using cover functions like these:</p> 88 calling fprintf() directly, or by using cover functions like these:</p>
95 <pre class="prettyprint"> 89 <pre class="prettyprint">
96 #include &lt;stdio.h&gt; 90 #include &lt;stdio.h&gt;
97 void logmsg(const char* pMsg){ 91 void logmsg(const char* pMsg){
98 fprintf(stdout,&quot;logmsg: %s\n&quot;,pMsg); 92 fprintf(stdout,&quot;logmsg: %s\n&quot;,pMsg);
99 } 93 }
100 void errormsg(const char* pMsg){ 94 void errormsg(const char* pMsg){
101 fprintf(stderr,&quot;logerr: %s\n&quot;,pMsg); 95 fprintf(stderr,&quot;logerr: %s\n&quot;,pMsg);
102 } 96 }
103 </pre> 97 </pre>
104 <p>By default stdout and stderr will appear in Chrome&#8217;s stdout and stderr stream 98 <p>By default stdout and stderr will appear in Chrome&#8217;s stdout and stderr stream
105 but they can also be redirected as described below.</p> 99 but they can also be redirected as described below.</p>
106 <section id="redirecting-output-to-log-files">
107 <h4 id="redirecting-output-to-log-files">Redirecting output to log files</h4> 100 <h4 id="redirecting-output-to-log-files">Redirecting output to log files</h4>
108 <p>You can redirect stdout and stderr to output files by setting these environme nt variables:</p> 101 <p>You can redirect stdout and stderr to output files by setting these environme nt variables:</p>
109 <ul class="small-gap"> 102 <ul class="small-gap">
110 <li><code>NACL_EXE_STDOUT=c:\nacl_stdout.log</code></li> 103 <li><code>NACL_EXE_STDOUT=c:\nacl_stdout.log</code></li>
111 <li><code>NACL_EXE_STDERR=c:\nacl_stderr.log</code></li> 104 <li><code>NACL_EXE_STDERR=c:\nacl_stderr.log</code></li>
112 </ul> 105 </ul>
113 <p>There is another variable, <code>NACLLOG</code>, that you can use to redirect Native 106 <p>There is another variable, <code>NACLLOG</code>, that you can use to redirect Native
114 Client&#8217;s internally-generated messages. This variable is set to stderr by 107 Client&#8217;s internally-generated messages. This variable is set to stderr by
115 default; you can redirect these messages to an output file by setting the 108 default; you can redirect these messages to an output file by setting the
116 variable as follows:</p> 109 variable as follows:</p>
117 <ul class="small-gap"> 110 <ul class="small-gap">
118 <li><code>NACLLOG=c:\nacl.log</code></li> 111 <li><code>NACLLOG=c:\nacl.log</code></li>
119 </ul> 112 </ul>
120 <aside class="note"> 113 <aside class="note">
121 <strong>Note:</strong> If you set the NACL_EXE_STDOUT, NACL_EXE_STDERR, or NACLL OG 114 <strong>Note:</strong> If you set the NACL_EXE_STDOUT, NACL_EXE_STDERR, or NACLL OG
122 variables to redirect output to a file, you must run Chrome with the 115 variables to redirect output to a file, you must run Chrome with the
123 <code>--no-sandbox</code> flag. You must also be careful that each variable poi nts to 116 <code>--no-sandbox</code> flag. You must also be careful that each variable poi nts to
124 a different file. 117 a different file.
125 </aside> 118 </aside>
126 </section><section id="redirecting-output-to-the-javascript-console">
127 <h4 id="redirecting-output-to-the-javascript-console">Redirecting output to the JavaScript console</h4> 119 <h4 id="redirecting-output-to-the-javascript-console">Redirecting output to the JavaScript console</h4>
128 <p>You can also cause output from printf statements in your C/C++ code to be 120 <p>You can also cause output from printf statements in your C/C++ code to be
129 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
130 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
131 these steps:</p> 123 these steps:</p>
132 <ol class="arabic"> 124 <ol class="arabic">
133 <li><p class="first">Set the NACL_EXE_STDOUT and NACL_EXE_STDERR environment var iables as 125 <li><p class="first">Set the NACL_EXE_STDOUT and NACL_EXE_STDERR environment var iables as
134 follows:</p> 126 follows:</p>
135 <ul class="small-gap"> 127 <ul class="small-gap">
136 <li><p class="first">NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage</p> 128 <li><p class="first">NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage</p>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 JavaScript, your handler will need to be more complex.</p> 161 JavaScript, your handler will need to be more complex.</p>
170 <p>Once you&#8217;ve implemented a message handler and set up the environment 162 <p>Once you&#8217;ve implemented a message handler and set up the environment
171 variables as described above, you can check the JavaScript console to see 163 variables as described above, you can check the JavaScript console to see
172 output that your Native Client module prints to stdout and stderr. Keep in 164 output that your Native Client module prints to stdout and stderr. Keep in
173 mind that your module makes a call to PostMessage() every time it flushes 165 mind that your module makes a call to PostMessage() every time it flushes
174 stdout or stderr. Your application&#8217;s performance will degrade considerabl y 166 stdout or stderr. Your application&#8217;s performance will degrade considerabl y
175 if your module prints and flushes frequently, or if it makes frequent Pepper 167 if your module prints and flushes frequently, or if it makes frequent Pepper
176 calls to begin with (e.g., to render).</p> 168 calls to begin with (e.g., to render).</p>
177 </li> 169 </li>
178 </ol> 170 </ol>
179 </section></section><section id="logging-calls-to-pepper-interfaces">
180 <h3 id="logging-calls-to-pepper-interfaces">Logging calls to Pepper interfaces</ h3> 171 <h3 id="logging-calls-to-pepper-interfaces">Logging calls to Pepper interfaces</ h3>
181 <p>You can log all Pepper calls your module makes by passing the following flags 172 <p>You can log all Pepper calls your module makes by passing the following flags
182 to Chrome on startup:</p> 173 to Chrome on startup:</p>
183 <pre class="prettyprint"> 174 <pre class="prettyprint">
184 --vmodule=ppb*=4 --enable-logging=stderr 175 --vmodule=ppb*=4 --enable-logging=stderr
185 </pre> 176 </pre>
186 <p>The <code>vmodule</code> flag tells Chrome to log all calls to C Pepper inter faces that 177 <p>The <code>vmodule</code> flag tells Chrome to log all calls to C Pepper inter faces that
187 begin with &#8220;ppb&#8221; (that is, the interfaces that are implemented by th e browser 178 begin with &#8220;ppb&#8221; (that is, the interfaces that are implemented by th e browser
188 and that your module calls). The <code>enable-logging</code> flag tells Chrome t o log 179 and that your module calls). The <code>enable-logging</code> flag tells Chrome t o log
189 the calls to stderr.</p> 180 the calls to stderr.</p>
190 </section><section id="debugging-with-visual-studio"> 181 <h3 id="debugging-with-visual-studio"><span id="visual-studio"></span>Debugging with Visual Studio</h3>
191 <span id="visual-studio"></span><h3 id="debugging-with-visual-studio"><span id=" visual-studio"></span>Debugging with Visual Studio</h3>
192 <p>If you develop on a Windows platform you can use the <a class="reference inte rnal" href="/native-client/devguide/devcycle/vs-addin.html"><em>Native Client Vi sual 182 <p>If you develop on a Windows platform you can use the <a class="reference inte rnal" href="/native-client/devguide/devcycle/vs-addin.html"><em>Native Client Vi sual
193 Studio add-in</em></a> to write and debug your code. The add-in defines new 183 Studio add-in</em></a> to write and debug your code. The add-in defines new
194 project platforms that let you run your module in two different modes: As a 184 project platforms that let you run your module in two different modes: As a
195 Pepper plugin and as a Native Client module. When running as a Pepper plugin 185 Pepper plugin and as a Native Client module. When running as a Pepper plugin
196 you can use the built-in Visual Studio debugger. When running as a Native 186 you can use the built-in Visual Studio debugger. When running as a Native
197 Client module Visual Studio will launch an instance of nacl-gdb for you and 187 Client module Visual Studio will launch an instance of nacl-gdb for you and
198 link it to the running code.</p> 188 link it to the running code.</p>
199 </section><section id="debugging-with-nacl-gdb"> 189 <h3 id="debugging-with-nacl-gdb"><span id="using-gdb"></span>Debugging with nacl -gdb</h3>
200 <span id="using-gdb"></span><h3 id="debugging-with-nacl-gdb"><span id="using-gdb "></span>Debugging with nacl-gdb</h3>
201 <p>The Native Client SDK includes a command-line debugger that you can use to 190 <p>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 <a class= "reference external" href="http://www.gnu.org/software/gdb/">gdb</a>, and is loc ated at 191 debug Native Client modules. The debugger is based on the GNU debugger <a class= "reference external" href="http://www.gnu.org/software/gdb/">gdb</a>, and is loc ated at
203 <code>toolchain/&lt;platform&gt;_x86_newlib/bin/x86_64-nacl-gdb</code> (where <e m>&lt;platform&gt;</em> 192 <code>toolchain/&lt;platform&gt;_x86_newlib/bin/x86_64-nacl-gdb</code> (where <e m>&lt;platform&gt;</em>
204 is the platform of your development machine: <code>win</code>, <code>mac</code>, or 193 is the platform of your development machine: <code>win</code>, <code>mac</code>, or
205 <code>linux</code>).</p> 194 <code>linux</code>).</p>
206 <p>Note that this same copy of GDB can be used to debug any NaCl program, 195 <p>Note that this same copy of GDB can be used to debug any NaCl program,
207 whether built using newlib or glibc for x86-32, x86-64 or ARM. In the SDK, 196 whether built using newlib or glibc for x86-32, x86-64 or ARM. In the SDK,
208 <code>i686-nacl-gdb</code> is an alias for <code>x86_64-nacl-gdb</code>, and the <code>newlib</code> 197 <code>i686-nacl-gdb</code> is an alias for <code>x86_64-nacl-gdb</code>, and the <code>newlib</code>
209 and <code>glibc</code> toolchains both contain the same version of GDB.</p> 198 and <code>glibc</code> toolchains both contain the same version of GDB.</p>
210 <section id="debugging-pnacl-pexes-with-pepper-35"> 199 <h4 id="debugging-pnacl-pexes-with-pepper-35"><span id="debugging-pnacl-pexes">< /span>Debugging PNaCl pexes (with Pepper 35+)</h4>
211 <span id="debugging-pnacl-pexes"></span><h4 id="debugging-pnacl-pexes-with-peppe r-35"><span id="debugging-pnacl-pexes"></span>Debugging PNaCl pexes (with Pepper 35+)</h4>
212 <p>If you want to use GDB to debug a program that is compiled with the PNaCl 200 <p>If you want to use GDB to debug a program that is compiled with the PNaCl
213 toolchain, you must have a copy of the pexe from <strong>before</strong> running 201 toolchain, you must have a copy of the pexe from <strong>before</strong> running
214 <code>pnacl-finalize</code>. The <code>pnacl-finalize</code> tool converts LLVM bitcode 202 <code>pnacl-finalize</code>. The <code>pnacl-finalize</code> tool converts LLVM bitcode
215 to the stable PNaCl bitcode format, but it also strips out debug 203 to the stable PNaCl bitcode format, but it also strips out debug
216 metadata, which we need for debugging. In this section we&#8217;ll give the 204 metadata, which we need for debugging. In this section we&#8217;ll give the
217 LLVM bitcode file a <code>.bc</code> file extension, and the PNaCl bitcode file 205 LLVM bitcode file a <code>.bc</code> file extension, and the PNaCl bitcode file
218 a <code>.pexe</code> file extension. The actual extension should not matter, but 206 a <code>.pexe</code> file extension. The actual extension should not matter, but
219 it helps distinguish between the two types of files.</p> 207 it helps distinguish between the two types of files.</p>
220 <p><strong>Note</strong> unlike the finalized copy of the pexe, the non-finalize d debug copy 208 <p><strong>Note</strong> unlike the finalized copy of the pexe, the non-finalize d debug copy
221 is not considered stable. This means that a debug copy of the PNaCl 209 is not considered stable. This means that a debug copy of the PNaCl
(...skipping 28 matching lines...) Expand all
250 your local web server serves files from.</p> 238 your local web server serves files from.</p>
251 <p>When you run Chrome with <code>--enable-nacl-debug</code>, Chrome will transl ate 239 <p>When you run Chrome with <code>--enable-nacl-debug</code>, Chrome will transl ate
252 and run the <code>debug_version.bc</code> instead of <code>release_version.pexe< /code>. 240 and run the <code>debug_version.bc</code> instead of <code>release_version.pexe< /code>.
253 Once the debug version is loaded, you are ready to <a class="reference internal" href="#running-nacl-gdb"><em>run nacl-gdb</em></a></p> 241 Once the debug version is loaded, you are ready to <a class="reference internal" href="#running-nacl-gdb"><em>run nacl-gdb</em></a></p>
254 <p>Whether you publish the NMF file containing the debug URL to the release 242 <p>Whether you publish the NMF file containing the debug URL to the release
255 web server, is up to you. One reason to avoid publishing the debug URL 243 web server, is up to you. One reason to avoid publishing the debug URL
256 is that it is only guaranteed to work for the Chrome version that matches 244 is that it is only guaranteed to work for the Chrome version that matches
257 the SDK version. Developers who may have left the <code>--enable-nacl-debug</cod e> 245 the SDK version. Developers who may have left the <code>--enable-nacl-debug</cod e>
258 flag turned on may end up loading the debug copy of your application 246 flag turned on may end up loading the debug copy of your application
259 (which may or may not work, depending on their version of Chrome).</p> 247 (which may or may not work, depending on their version of Chrome).</p>
260 </section><section id="debugging-pnacl-pexes-with-older-pepper-toolchains">
261 <h4 id="debugging-pnacl-pexes-with-older-pepper-toolchains">Debugging PNaCl pexe s (with older Pepper toolchains)</h4> 248 <h4 id="debugging-pnacl-pexes-with-older-pepper-toolchains">Debugging PNaCl pexe s (with older Pepper toolchains)</h4>
262 <p>If you want to use GDB to debug a program that is compiled with the PNaCl 249 <p>If you want to use GDB to debug a program that is compiled with the PNaCl
263 toolchain, you must convert the <code>pexe</code> file to a <code>nexe</code>. (You can skip 250 toolchain, you must convert the <code>pexe</code> file to a <code>nexe</code>. (You can skip
264 this step if you are using the GCC toolchain, or if you are using 251 this step if you are using the GCC toolchain, or if you are using
265 pepper 35 or later.)</p> 252 pepper 35 or later.)</p>
266 <ul class="small-gap"> 253 <ul class="small-gap">
267 <li>Firstly, make sure you are passing the <code>-g</code> <a class="reference i nternal" href="/native-client/devguide/devcycle/building.html#compile-flags"><em >compile option</em></a> to <code>pnacl-clang</code> to enable generating debugg ing info. 254 <li>Firstly, make sure you are passing the <code>-g</code> <a class="reference i nternal" href="/native-client/devguide/devcycle/building.html#compile-flags"><em >compile option</em></a> to <code>pnacl-clang</code> to enable generating debugg ing info.
268 You might also want to omit <code>-O2</code> from the compile-time and link-time 255 You might also want to omit <code>-O2</code> from the compile-time and link-time
269 options.</li> 256 options.</li>
270 <li><p class="first">Secondly, use <code>pnacl-translate</code> to convert your <code>pexe</code> to one or more 257 <li><p class="first">Secondly, use <code>pnacl-translate</code> to convert your <code>pexe</code> to one or more
(...skipping 28 matching lines...) Expand all
299 <li>Copy the <code>nexe</code> and <code>nmf</code> files to the location that y our local web 286 <li>Copy the <code>nexe</code> and <code>nmf</code> files to the location that y our local web
300 server serves files from.</li> 287 server serves files from.</li>
301 </ul> 288 </ul>
302 <aside class="note"> 289 <aside class="note">
303 <strong>Note:</strong> If you know whether Chrome is using the x86-32 or x86-64 290 <strong>Note:</strong> If you know whether Chrome is using the x86-32 or x86-64
304 version of the NaCl sandbox on your system, you can translate the 291 version of the NaCl sandbox on your system, you can translate the
305 <code>pexe</code> once to a single x86-32 or x86-64 <code>nexe</code>. Otherwis e, you 292 <code>pexe</code> once to a single x86-32 or x86-64 <code>nexe</code>. Otherwis e, you
306 might find it easier to translate the <code>pexe</code> to both <code>nexe</code > 293 might find it easier to translate the <code>pexe</code> to both <code>nexe</code >
307 formats as described above. 294 formats as described above.
308 </aside> 295 </aside>
309 </section><section id="running-nacl-gdb"> 296 <h4 id="running-nacl-gdb"><span id="id1"></span>Running nacl-gdb</h4>
310 <span id="id1"></span><h4 id="running-nacl-gdb"><span id="id1"></span>Running na cl-gdb</h4>
311 <p>Before you start using nacl-gdb, make sure you can <a class="reference intern al" href="/native-client/devguide/devcycle/building.html"><em>build</em></a> you r 297 <p>Before you start using nacl-gdb, make sure you can <a class="reference intern al" href="/native-client/devguide/devcycle/building.html"><em>build</em></a> you r
312 module and <a class="reference internal" href="/native-client/devguide/devcycle/ running.html"><em>run</em></a> your application normally. This will verify 298 module and <a class="reference internal" href="/native-client/devguide/devcycle/ running.html"><em>run</em></a> your application normally. This will verify
313 that you have created all the required <a class="reference internal" href="/nati ve-client/devguide/coding/application-structure.html"><em>application parts</em> </a> (.html, .nmf, and .nexe files, shared 299 that you have created all the required <a class="reference internal" href="/nati ve-client/devguide/coding/application-structure.html"><em>application parts</em> </a> (.html, .nmf, and .nexe files, shared
314 libraries, etc.), that your server can access those resources, and that you&#821 7;ve 300 libraries, etc.), that your server can access those resources, and that you&#821 7;ve
315 configured Chrome correctly to run your application. The instructions below 301 configured Chrome correctly to run your application. The instructions below
316 assume that you are using a <a class="reference internal" href="/native-client/d evguide/devcycle/running.html#web-server"><em>local server</em></a> to run your 302 assume that you are using a <a class="reference internal" href="/native-client/d evguide/devcycle/running.html#web-server"><em>local server</em></a> to run your
317 application; one benefit of doing it this way is that you can check the web 303 application; one benefit of doing it this way is that you can check the web
318 server output to confirm that your application is loading the correct 304 server output to confirm that your application is loading the correct
319 resources. However, some people prefer to run their application as an unpacked 305 resources. However, some people prefer to run their application as an unpacked
320 extension, as described in <a class="reference internal" href="/native-client/de vguide/devcycle/running.html"><em>Running Native Client Applications</em></a>.</ p> 306 extension, as described in <a class="reference internal" href="/native-client/de vguide/devcycle/running.html"><em>Running Native Client Applications</em></a>.</ p>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 <dt><code>help &lt;command&gt;</code></dt> 506 <dt><code>help &lt;command&gt;</code></dt>
521 <dd>print documentation for the specified gdb &lt;command&gt;</dd> 507 <dd>print documentation for the specified gdb &lt;command&gt;</dd>
522 <dt><code>quit</code></dt> 508 <dt><code>quit</code></dt>
523 <dd>quit gdb</dd> 509 <dd>quit gdb</dd>
524 </dl> 510 </dl>
525 <p>See the <a class="reference external" href="http://sourceware.org/gdb/current /onlinedocs/gdb/#toc_Top">gdb documentation</a> for a 511 <p>See the <a class="reference external" href="http://sourceware.org/gdb/current /onlinedocs/gdb/#toc_Top">gdb documentation</a> for a
526 comprehensive list of gdb commands. Note that you can abbreviate most commands 512 comprehensive list of gdb commands. Note that you can abbreviate most commands
527 to just their first letter (<code>b</code> for break, <code>c</code> for continu e, and so on).</p> 513 to just their first letter (<code>b</code> for break, <code>c</code> for continu e, and so on).</p>
528 <p>To interrupt execution of your module, press &lt;Ctrl-c&gt;. When you&#8217;r e done 514 <p>To interrupt execution of your module, press &lt;Ctrl-c&gt;. When you&#8217;r e done
529 debugging, close the Chrome window and type <code>q</code> to quit gdb.</p> 515 debugging, close the Chrome window and type <code>q</code> to quit gdb.</p>
530 </section></section></section><section id="debugging-with-other-tools">
531 <h2 id="debugging-with-other-tools">Debugging with other tools</h2> 516 <h2 id="debugging-with-other-tools">Debugging with other tools</h2>
532 <p>If you cannot use the <a class="reference internal" href="#visual-studio"><em >Visual Studio add-in</em></a>, or you want 517 <p>If you cannot use the <a class="reference internal" href="#visual-studio"><em >Visual Studio add-in</em></a>, or you want
533 to use a debugger other than nacl-gdb, you must manually build your module as a 518 to use a debugger other than nacl-gdb, you must manually build your module as a
534 Pepper plugin (sometimes referred to as a &#8220;<a class="reference external" h ref="http://www.chromium.org/nativeclient/getting-started/getting-started-backgr ound-and-basics#TOC-Trusted-vs-Untrusted">trusted</a>&#8221; 519 Pepper plugin (sometimes referred to as a &#8220;<a class="reference external" h ref="http://www.chromium.org/nativeclient/getting-started/getting-started-backgr ound-and-basics#TOC-Trusted-vs-Untrusted">trusted</a>&#8221;
535 or &#8220;in-process&#8221; plugin). Pepper plugins (.DLL files on Windows; .so files on 520 or &#8220;in-process&#8221; plugin). Pepper plugins (.DLL files on Windows; .so files on
536 Linux; .bundle files on Mac) are loaded directly in either the Chrome renderer 521 Linux; .bundle files on Mac) are loaded directly in either the Chrome renderer
537 process or a separate plugin process, rather than in Native Client. Building a 522 process or a separate plugin process, rather than in Native Client. Building a
538 module as a trusted Pepper plugin allows you to use standard debuggers and 523 module as a trusted Pepper plugin allows you to use standard debuggers and
539 development tools on your system, but when you&#8217;re finished developing the 524 development tools on your system, but when you&#8217;re finished developing the
540 plugin, you need to port it to Native Client (i.e., build the module with one 525 plugin, you need to port it to Native Client (i.e., build the module with one
541 of the toolchains in the NaCl SDK so that the module runs in Native Client). 526 of the toolchains in the NaCl SDK so that the module runs in Native Client).
542 For details on this advanced development technique, see <a class="reference exte rnal" href="http://www.chromium.org/nativeclient/how-tos/debugging-documentation /debugging-a-trusted-plugin">Debugging a Trusted 527 For details on this advanced development technique, see <a class="reference exte rnal" href="http://www.chromium.org/nativeclient/how-tos/debugging-documentation /debugging-a-trusted-plugin">Debugging a Trusted
543 Plugin</a>. 528 Plugin</a>.
544 Note that starting with the <code>pepper_22</code> bundle, the NaCl SDK for Wind ows 529 Note that starting with the <code>pepper_22</code> bundle, the NaCl SDK for Wind ows
545 includes pre-built libraries and library source code, making it much easier to 530 includes pre-built libraries and library source code, making it much easier to
546 build a module into a .DLL.</p> 531 build a module into a .DLL.</p>
547 <section id="open-source-profiling-tools">
548 <h3 id="open-source-profiling-tools">Open source profiling tools</h3> 532 <h3 id="open-source-profiling-tools">Open source profiling tools</h3>
549 <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 533 <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
550 <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> 534 <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>
551 and <a class="reference external" href="http://www.chromium.org/nativeclient/how -tos/limited-profiling-with-oprofile-on-x86-64">Linux</a> 535 and <a class="reference external" href="http://www.chromium.org/nativeclient/how -tos/limited-profiling-with-oprofile-on-x86-64">Linux</a>
552 machines.</p> 536 machines.</p>
553 </section></section></section> 537 </section>
554 538
555 {{/partials.standard_nacl_article}} 539 {{/partials.standard_nacl_article}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698