debugging.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Debugging Graphene
  2. ==================
  3. .. highlight:: sh
  4. Running Graphene with GDB
  5. -------------------------
  6. To enable GDB support, the PAL loader and Graphene implement the GDB protocol to
  7. notify the debugger about any loading and unloading of dynamic libraries. The
  8. PAL loader also loads a |nbsp| GDB script to enable GDB features to make the
  9. debugging process easier.
  10. To build Graphene with debug symbols, the source code needs to be compiled with
  11. ``DEBUG=1``. Run the following commands in the source tree::
  12. make clean
  13. make DEBUG=1
  14. To run Graphene with GDB, use one of the following commands to run your
  15. application::
  16. GDB=1 [Graphene Directory]/Runtime/pal_loader [executable|manifest] [arguments]
  17. gdb --args [executable|manifest] [arguments]
  18. Running Graphene-SGX with GDB
  19. -----------------------------
  20. Graphene-SGX also supports GDB from outside the enclave if the enclave is
  21. created in debug mode. Graphene provides a specialized GDB for the application
  22. and the library OS running inside an enclave (using a normal GDB will only debug
  23. the execution *outside* the enclave).
  24. To build Graphene-SGX with debug symbols, the source code needs to be compiled
  25. with ``DEBUG=1``. Run the following commands in the source tree::
  26. make SGX=1 clean
  27. make SGX=1 DEBUG=1
  28. After rebuilding Graphene-SGX with ``DEBUG=1``, you need to re-sign the manifest
  29. of the application. For instance, if you want to debug the ``helloworld``
  30. program, run the following commands::
  31. cd LibOS/shim/test/native
  32. make SGX=1
  33. make SGX=1 sgx-tokens
  34. To run Graphene with GDB, use the Graphene loader (``pal_loader``) and specify
  35. ``GDB=1``::
  36. GDB=1 SGX=1 [Graphene Directory]/Runtime/pal_loader [executable|manifest] [arguments]