debugging.rst 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 the following command to run your application::
  15. GDB=1 [Graphene Directory]/Runtime/pal_loader [executable|manifest] [arguments]
  16. Running Graphene-SGX with GDB
  17. -----------------------------
  18. Graphene-SGX supports debugging of enclavized applications if the enclave is
  19. created in debug mode. Graphene provides a specialized GDB for the application
  20. and the library OS running inside an enclave (using a normal GDB will only debug
  21. the execution *outside* the enclave).
  22. To build Graphene-SGX with debug symbols, the source code needs to be compiled
  23. with ``DEBUG=1``. Run the following commands in the source tree::
  24. make SGX=1 clean
  25. make SGX=1 DEBUG=1
  26. After rebuilding Graphene-SGX with ``DEBUG=1``, you need to re-sign the manifest
  27. of the application. For instance, if you want to debug the ``helloworld``
  28. program, run the following commands::
  29. cd LibOS/shim/test/native
  30. make SGX=1
  31. make SGX=1 sgx-tokens
  32. To run Graphene with GDB, use the Graphene loader (``pal_loader``) and specify
  33. ``GDB=1``::
  34. GDB=1 SGX=1 [Graphene Directory]/Runtime/pal_loader [executable|manifest] [arguments]