summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authornoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-25 22:37:29 +0000
committernoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-25 22:37:29 +0000
commita117af3c334ddbfe9036f302a0dd1bb62bfcf4c6 (patch)
tree64163ce55a4e718478f425e6738db222530ce32d /native_client_sdk
parent348df3f9e1577fe12793d1e4822be32cce77ffe7 (diff)
downloadchromium_src-a117af3c334ddbfe9036f302a0dd1bb62bfcf4c6.zip
chromium_src-a117af3c334ddbfe9036f302a0dd1bb62bfcf4c6.tar.gz
chromium_src-a117af3c334ddbfe9036f302a0dd1bb62bfcf4c6.tar.bz2
Clean up debugging.
Fix up HTML based on comments to cr 9716024 Clean up Makefil BUG=114444 TBR=awatson@chromium.org Review URL: https://chromiumcodereview.appspot.com/9855004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/examples/debugging/Makefile25
-rw-r--r--native_client_sdk/src/examples/debugging/debugging.html48
2 files changed, 46 insertions, 27 deletions
diff --git a/native_client_sdk/src/examples/debugging/Makefile b/native_client_sdk/src/examples/debugging/Makefile
index a896f37..91200cb 100644
--- a/native_client_sdk/src/examples/debugging/Makefile
+++ b/native_client_sdk/src/examples/debugging/Makefile
@@ -25,6 +25,9 @@ CHROME_PATH?=Undefined
# information (-g) for correctness and ease of debugging.
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic
CFLAGS:=-pthread -O0 -g $(WARNINGS) -fno-omit-frame-pointer
+LDFLAGS:=-pthread -lppapi
+CC_SOURCES:=hello_world.c untrusted_crash_dump.c string_stream.c
+PROJECT:=hello_world
#
# Compute path to compiler
@@ -58,13 +61,21 @@ export CYGWIN
# Default target is everything
all : hello_world_x86_32.nexe hello_world_x86_64.nexe
-# Define compile and link rule for 32 bit (-m32) nexe
-hello_world_x86_32.nexe : hello_world.c untrusted_crash_dump.c string_stream.c
- $(CC) -o $@ $^ -m32 -O0 -g $(CFLAGS) -lppapi
+# Define 32 bit compile and link rules for C sources
+x86_32_OBJS:=$(patsubst %.c,%_32.o,$(CC_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.c $(THIS_MAKE)
+ $(CC) -o $@ -c $< -m32 -O0 -g $(CCFLAGS)
-# Define compile and link rule for 64 bit (-m64) nexe
-hello_world_x86_64.nexe : hello_world.c untrusted_crash_dump.c string_stream.c
- $(CC) -o $@ $^ -m64 -O0 -g $(CFLAGS) -lppapi
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CC) -o $@ $^ -m32 -O0 -g $(CCFLAGS) $(LDFLAGS)
+
+# Define 64 bit compile and link rules for C sources
+x86_64_OBJS:=$(patsubst %.c,%_64.o,$(CC_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.c $(THIS_MAKE)
+ $(CC) -o $@ -c $< -m64 -O0 -g $(CCFLAGS)
+
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CC) -o $@ $^ -m64 -O0 -g $(CCFLAGS) $(LDFLAGS)
# Define a phony rule so it always runs, to build nexe and start up server.
.PHONY: RUN
@@ -76,7 +87,7 @@ RUN: all
# Setup environment to use SDK's version of the NaCl plugin, instead of the
# one built into Chrome. This requries launching Chrome which means we must
# be able to find it. It also means that we must determine which versions
-# of the plugin, loader, irt, and any helps we must use.
+# of the plugin, loader, irt, and any other helpers we must use.
#
HELPER_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --helper)
IRTBIN_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --irtbin)
diff --git a/native_client_sdk/src/examples/debugging/debugging.html b/native_client_sdk/src/examples/debugging/debugging.html
index 6636945..72d8a02 100644
--- a/native_client_sdk/src/examples/debugging/debugging.html
+++ b/native_client_sdk/src/examples/debugging/debugging.html
@@ -87,36 +87,43 @@
</form>
</head>
<body onload="pageDidLoad()">
-<h1>Native Client Getting Started: Debugging.</h1>
-<p>This example shows how to trap an untrusted exception, and then send that
-information to the webserver to generate a stack trace. This can only be used
+<h1>Native Client Debugging Example: Generating a Stack Trace.</h1>
+<h2>How the example works</h2>
+<p>This example shows how to trap an untrusted exception (such as a illegal
+memory reference in the NEXE). This debugging technique can only be used
for development since it requires several command-line switches, environment
-variables and a special version of the plugin. The test works, by loading the
-module and communicating with it through PostMessage. Messages from the module
-are sent to the status line and/or the log window. Four seconds after loading,
-the script will send a 'BOOM' message to the module which will cause it to
-dereference an illegal location in memory.</p>
+variables, and a special version of the Native Client plugin. The test works
+by loading the module and communicating with it through PostMessage. Messages
+from the module are sent to the Status line and/or the Log window in the page.
+Four seconds after the module is loaded, the JavaScript on this page sends a
+'BOOM' message to the module that causes the module to dereference an illegal
+location in memory.</p>
-<p>If Chrome is launched correctly with the appropriate command-line arguments
-and environment variables, the Log will show the crash dump facilities were
-turn on and when the crash data arrives, it will be forwarded to the http server
-which will drive the decoder and send a stack trace back to the web page.</p>
+<p>If your setup is correct (you launched Chrome with the appropriate
+command-line arguments and environment variables), the Log window bellow should
+show the that the crash dump facilities are turn on. When the crash data
+arrives from the module, the data is forwarded to the HTTP server, which drives
+a decoder and sends back a stack trace to the web page.</p>
-<p>If setup incorrectly, the page may or may not load. If it does, it will
-send a "LOADED" message to the log and eventual will crash. The script will
-detect this crash by detecting a missed heartbeat the the running application
-would normal send, and then print the current module status.
+<p>If setup incorrectly, the NaCl module may or may not load. If the module
+loads, it sends a "LOADED" message to the log and crash after four seconds.
+Since the stack trace facilities are not enables, the script will determine that
+the module has crashed by detecting a missed heartbeat which the application
+would normally send.
</p>
<h2>Running the example</h2>
-In one console window, to start the server:
+In one terminal window, to start the server:
<ul>
-<li>Set CHROME_PATH to the fully qualified path.</li>
+<li>Set the CHROME_PATH environment variable to the fully qualified path of your
+cChrome executable.</li>
<li>From the example directory type: <b>make RUN</b></li>
</ul>
-In another console window, to start Chrome:
+In another terminal window, to automatically start Chrome with the correct
+environment variables and command-line switches:
<ul>
-<li>Set CHROME_PATH to the fully qualified path.</li>
+<li>Set the CHROME_PATH environment variable to the fully qualified path of your
+cChrome executable.</li>
<li>From the example directory type: <b>make TRACE</b></li>
</ul>
@@ -132,6 +139,7 @@ In another console window, to start Chrome:
src="hello_world.nmf"
type="application/x-nacl" />
</div>
+<hr>
<h2>Status: <code id="statusField">NO-STATUS</code></h2>
<form name="Logging">
<h2>Log</h2>