File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,51 @@ Remove all build artifacts:
6767make clean
6868```
6969
70+ ### Debug with sgx-gdb
71+
72+ The Intel SGX SDK provides ` sgx-gdb ` , a GDB extension for debugging SGX enclaves.
73+
74+ #### Build for Debugging
75+
76+ ** Important** : To use the debugger, you must build with debug symbols:
77+
78+ ``` bash
79+ make clean
80+ make DEBUG=1 all
81+ ```
82+
83+ This builds both the enclave and application with debug information (` -g ` flag).
84+
85+ #### Basic Debugging
86+
87+ To debug the application and enclave:
88+
89+ ``` bash
90+ cd bin
91+ SGX_DEBUG=1 sgx-gdb ./app
92+ ```
93+
94+ #### Memory Usage Analysis
95+
96+ You can use the SGX Enclave Memory Measurement Tool (EMMT) to analyze enclave memory usage:
97+
98+ ``` bash
99+ cd bin
100+ SGX_DEBUG=1 sgx-gdb -ex=" enable sgx_emmt" -ex=r --args ./app
101+ ```
102+
103+ This will show peak memory usage after the enclave exits:
104+
105+ ```
106+ [+] Init Enclave Successful 3077026240004098!
107+ [+] ecall_sample success...
108+ [+] Enclave returned: Hello from enclave: Hello, world!
109+ Enclave: "/path/to/sgx-sdk-rs/samples/hello-rust/bin/enclave.signed.so"
110+ [Peak stack used]: 5 KB
111+ [Peak heap used]: 4 KB
112+ [Peak reserved memory used]: 0 KB
113+ ```
114+
70115## Understanding the Code
71116
72117- ** app/** : Contains the untrusted host application that loads and communicates with the enclave
You can’t perform that action at this time.
0 commit comments