Running the nacl-loader process under various debugging tools

With --nacl-loader-cmd-prefix option you can prepend any text to the command line of the nacl-loader process. This is only supported on POSIX.

Example:
chrome --nacl-loader-cmd-prefix=strace

It can also be used to run NaCl modules under Valgrind. For this, you will need a Debug build of Chromium and a Valgrind-compatible build of the nexe.
Valgrind instructions can be found here.

Create a script (vg.sh) with the following contents:
#!/bin/bash
NACL_FILE=/path/to/nexe/dbg.nexe
/path/to/valgrind/memcheck.sh -v --nacl-file=$NACL_FILE --log-file=vg.log "$@"

memcheck.sh can be found either in nacl-sdk or in a NaCl repository checkout.

Then, run:
chrome --nacl-loader-cmd-prefix=./vg.sh

Comments