Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enclave debugging with gdb #761

Closed
Niederb opened this issue May 24, 2022 · 6 comments
Closed

Enclave debugging with gdb #761

Niederb opened this issue May 24, 2022 · 6 comments
Assignees

Comments

@Niederb
Copy link
Contributor

Niederb commented May 24, 2022

Trying to debug the enclave I get the same error as described here: intel/linux-sgx#533
According to the answer we would have to install these depencencies in order for debug to work:

  • libsgx-enclave-common-dbgsym
  • libsgx-urts-dbgsym
@haerdib haerdib self-assigned this May 24, 2022
@haerdib
Copy link
Contributor

haerdib commented May 24, 2022

Installed on devsgx02. Does it work now?

@Niederb
Copy link
Contributor Author

Niederb commented May 24, 2022

That was quick 😄
It certainly helped. There is now more stack information, but it seems the part I'm interested in is still hidden in '__morestack()'. I will do some more googling...

#3  0x00007fa97fdac153 in CEnclave::ocall(unsigned int, _ocall_table_t const*, void*) () from /usr/lib/x86_64-linux-gnu/libsgx_urts.so
#4  0x00007fa97fda926d in stack_sticker () from /usr/lib/x86_64-linux-gnu/libsgx_urts.so
#5  0x00007fa97fda91a6 in __morestack () from /usr/lib/x86_64-linux-gnu/libsgx_urts.so
#6  0x00007fa97fdac47b in CEnclave::ecall(int, void const*, void*, bool) () from /usr/lib/x86_64-linux-gnu/libsgx_urts.so
#7  0x00007fa97fdae542 in _sgx_ecall(unsigned long, int, void const*, void*, bool) () from /usr/lib/x86_64-linux-gnu/libsgx_urts.so

@haerdib haerdib assigned Niederb and unassigned haerdib May 24, 2022
@Niederb
Copy link
Contributor Author

Niederb commented Jun 2, 2022

@Niederb
Copy link
Contributor Author

Niederb commented Jun 28, 2022

I work now in a VM:

  • I managed to get Intel VTune working for profiling (still not in the enclave though).
  • Also I managed to attach to a worker process for debugging. I had to enable the debug symbols in release mode for that to work:
[profile.release]
debug = true

@Niederb
Copy link
Contributor Author

Niederb commented Jul 6, 2022

Ok, I got the debugger to work now. Here are the steps:

@Niederb
Copy link
Contributor Author

Niederb commented Jul 15, 2022

  • I think the next step would be to reproduce my setup on another machine
  • Also see issue Debug build with Optimizations #883
  • The branch should not be merged
    • Then we can think about how to bring the necessary changes onto master
    • The changes are small anyway so we can also just re-create them if merging becomes complicated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants