Debugging a Trusted Plugin on Linux
- Get a Chromium check-out. You can usually use the revision from the
nacl-sdk DEPS file.
- You don’t need to build all of chromium, just pepper.
- Go to the src/ directory in your check-out
- type: ‘make ppapi_tests’ to build the pepper tests as well as
any libraries they depend on. You’ll end up with libppapi_cpp.a
- Build trusted version of the code
- For a C plugin you don’t have to link against anything. ppapi C
is all headers.
- For C++, you need libppapi_cpp.a and libppapi_cpp_objects.a.
Link against ppapi_cpp_objects and ppapi_cpp from chrome.
- link order matters: ppapi_cpp_objects has to come before
- Be sure to specify -fno-rtti and -fPIC since chrome does not
build run-time type information by default, and you’ll be
generating a shared library as your plugin.
- For the linking step, be sure to specify -shared
- To load your plugin, your application will need an embed tag. For
trusted plugins this should not have a “nacl” but a regular “type”
attribute, for example: type="application/x-hello-world"
- Unlike with an untrusted plugin, instead of handling a onload event
in the EMBED tag, you have to call moduleDidLoad() directly after
the EMBED tag.
- To debug, you have to use Chromium - best is to get a waterfall for
your platform build from
http://build.chromium.org/f/chromium/snapshots/ You can also finish
the chromium build you checked out but be prepared to wait a while.
This style of debugging is not supported with Google Chrome Dev
- In a shell, launch chrome with the following arguments:
- In Chrome, create a new tab and visit about:memory, this will list
the pid of the plugin tab.
- You can now use gdb to attach to the pid and debug your plugin