the Chromium logo

The Chromium Projects

Debugging a Trusted Plugin on Mac

  • 1. 2. 3. 4. 1. 2. 3. 4.
  • 1. 2. 3. 1.
    Make an new Xcode project, use the GUI to make a Bundle project that uses Core Foundation. Add existing NaCl sources DEPS in ppapi from chromium, add the C++ sources - create a Group and add the ppapi files directly. Adding ppapi as a folder reference doesn't work. Set "Header search paths" to point to the chromium ppapi headers (|SDK_root|/third_party), NOT the built-in NaCl headers. Add the SDK root to "Header Search Paths" Build the plugin. Edit hello_world/hello_world.html so that the embed tag has type="application/x-hello-world" and no nacl= attribute. Instead of handling a onload event in the EMBED tag, you have to call moduleDidLoad() directly after the EMBED tag. Make sure to uncheck "Load Symbols Lazily" in the Debugging panel of Xcode preferences. To debug, you have to use Chromium - best is to get a waterfall build from http://build.chromium.org/f/chromium/snapshots/Mac/. This style of debugging is not supported with Google Chrome Dev ChannelIn Xcode, ctrl-click on "Executables" and select "Add Custom Executable…".Call the new custom exec, say, "Chromium Dev"Point it at the .app wrapper for Chromium that you got from the waterfall, e.g. ~/Downloads/chrome-mac/Chromium.app.Add these arguments in the Arguments tab:--user-data-dir=/tmp/nacl-debug-profile--register-pepper-plugins="$HOME/Source/nacl-sdk/src/examples/hello_world/HelloWorld/build/Debug/HelloWorld.bundle;application/x-hello-world"--single-processfile://$HOME/Source/nacl-sdk/src/examples/hello_world/hello_world.html It is possible to debug a plugin using Chrome Dev channel, but it's a little more raw:In a shell, run Chrome like this: Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --user-data-dir=/tmp/nacl-debug-profile --register-pepper-plugins="$HOME/Source/nacl-sdk/src/examples/hello_world/HelloWorld/build/Debug/HelloWorld.bundle;application/x-hello-world" file://$HOME/Source/nacl-sdk/src/examples/hello_world/hello_world.htmlIn Chrome, create a new tab and visit about:memory, this will list the PID of the plugin tab.In Xcode, Run -> Attach To Process, then pick the appropriate PID.Note: if you get various errors about formatting, just click "Continue"