apache / apache/teaclave-sgx-sdk
vscode debugging wiki instructions fixing
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 268
- PR merge metrics
- No merged PRs in 30d
Description
I've followed the instructions in
https://github.com/baidu/rust-sgx-sdk/wiki/Use-VSCode---rls---rust-analysis---sgx-gdb-for-graphic-developing-(not-in-docker)
However, as I use ssh keys with a password by default (which doesn't work with these instructions), I had to generate a new keyfile for the debugger session from remote host to remote host:
```
ssh-keygen -t rsa
# name the keyfile debugloop_rsa
```
then I added a `.ssh/config` file with
```
Host devsgx devsgx01
HostName devsgx01
IdentityFile ~/.ssh/debugloop_rsa
User abrenzikofer
```
added the debugloop_rsa.pub to authorized_keys
Tested with
```
abrenzikofer@devsgx01> ssh devsgx
```
which works fine.
Then I modify launch.json in vscode (note the modified folders)
```
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "app",
"cwd": "${workspaceRoot}/bin",
"valuesFormatting": "parseText",
"gdbpath": "sgx-gdb",
"ssh": {
"forwardX11": false,
"host": "devsgx01", // your IP
"cwd": "${workspaceRoot}/bin",
// SSH private key on remote machine. Add the pub key to ~/.ssh/authorized_keys
// This ssh configuration is established from host to host, because the current
// vscode session is "within a ssh session established by vscode-ssh".
// I think this might be a bug but can hardly be resolved.
"keyfile": "/home/abrenzikofer/.ssh/debugloop_rsa", // private key
"user": "abrenzikofer",
"bootstrap": "source /opt/intel/sgxsdk/environment",
"port": 22
}
}
]
}
```
Still, the example doesnt work for me (irrespective of debugging):
```
> make
Failed to open file "bin/enclave.signed.so".
Error happened while signing the enclave.
Makefile:157: recipe for target 'bin/enclave.signed.so' failed
make: *** [bin/enclave.signed.so] Error 255
```
Fixing is easy: `mkdir bin` before `make`. should be added to git I guess.
Now debugging starts from vscode, but fails:
```
Running sgx-gdb over ssh...
Source directories searched: /opt/intel/sgx_linux_x64_sdk_2.5.101.50123_nodebug/sgxsdk/lib64/gdb-sgx-plugin:$cdir:$cwd
Setting environment variable "LD_PRELOAD" to null value.
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/abrenzikofer/rust-sgx-sdk/samplecode/hello-rust-vscode-debug/bin/app.
Use `info auto-load python-scripts [REGEXP]' to list them.
No source file named /home/abrenzikofer/rust-sgx-sdk/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs.
No source file named /home/abrenzikofer/rust-sgx-sdk/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs.
Running executable
detect urts is loaded, initializing
Function "notify_gdb_to_update" not defined.
Function "sgx_debug_load_state_add_element" not defined.
Function "sgx_debug_unload_state_remove_element" not defined.
Function "urts_add_tcs" not defined.
Function "random_stack_notify_gdb" not defined.
Python Exception No symbol "g_debug_enclave_info_list" in current context.:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[+] Home dir is /home/abrenzikofer
[-] Open token file /home/abrenzikofer/enclave.token error! Will create one.
[+] Init Enclave Successful 2!
This is a normal world string passed into Enclave!
This is a in-Enclave Rust string!
[+] say_something success...
[Inferior 1 (process 12276) exited normally]
```
I cant set breakpoints which is probably because of the issue you've mentioned with gdb > 7.12. I'm running ubuntu 18.04, gdb `GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked Use VSCode... wiki instructions, then reproduce the sample build and debugging flow using the shown launch.json. Check the Makefile failure at line 157 and the reported Ubuntu 18.04/GDB 8.1 breakpoint behavior. Done means the wiki explains the required bin directory setup and accurately documents the debugging limitations or prerequisites.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- build-system, devtools, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100