Hi
I followed the manual installation guide at https://github.com/google/asylo/blob/master/INSTALL.md
I built the quickstart example using below:
bazel build --config=enc-sim --compilation_mode=dbg -s --strip=never quickstart
(I have also tried bazel build --config=enc-sim --compilation_mode=dbg -s --copt -g3 --strip=never quickstart)
When I try to run quickstart_host_loader under gdb, gdb says "no debugging symbols found"
I notice that the build is still using -g0 . Any pointers on how to make the build using -g3?
SUBCOMMAND: # //asylo/examples/quickstart:quickstart_loader [action 'Compiling asylo/examples/quickstart/demo_driver.cc [for host]']
(cd /home/radhikaj/.cache/bazel/_bazel_radhikaj/6be83c60a36556d0e1d9cc3d23278920/execroot/com_google_asylo && \
exec env - \
PATH=/home/radhikaj/.opam/system/bin:/home/radhikaj/bin:/home/radhikaj/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
PWD=/proc/self/cwd \
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/asylo/examples/quickstart/_objs/quickstart_loader/demo_driver.d '-frandom-seed=bazel-out/host/bin/asylo/examples/quickstart/_objs/quickstart_loader/demo_driver.o' -D__CLANG_SUPPORT_DYN_ANNOTATION__ -iquote . -iquote bazel-out/host/genfiles -iquote bazel-out/host/bin -iquote external/com_google_protobuf -iquote bazel-out/host/genfiles/external/com_google_protobuf -iquote bazel-out/host/bin/external/com_google_protobuf -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -iquote bazel-out/host/bin/external/bazel_tools -iquote external/com_google_absl -iquote bazel-out/host/genfiles/external/com_google_absl -iquote bazel-out/host/bin/external/com_google_absl -iquote external/com_google_asylo -iquote bazel-out/host/genfiles/external/com_google_asylo -iquote bazel-out/host/bin/external/com_google_asylo -iquote external/com_googlesource_code_cctz -iquote bazel-out/host/genfiles/external/com_googlesource_code_cctz -iquote bazel-out/host/bin/external/com_googlesource_code_cctz -iquote external/linux_sgx -iquote bazel-out/host/genfiles/external/linux_sgx -iquote bazel-out/host/bin/external/linux_sgx -iquote external/com_github_gflags_gflags -iquote bazel-out/host/genfiles/external/com_github_gflags_gflags -iquote bazel-out/host/bin/external/com_github_gflags_gflags -isystem external/com_google_protobuf/src -isystem bazel-out/host/genfiles/external/com_google_protobuf/src -isystem bazel-out/host/bin/external/com_google_protobuf/src -isystem external/com_googlesource_code_cctz/include -isystem bazel-out/host/genfiles/external/com_googlesource_code_cctz/include -isystem bazel-out/host/bin/external/com_googlesource_code_cctz/include -isystem external/com_github_gflags_gflags/include -isystem bazel-out/host/genfiles/external/com_github_gflags_gflags/include -isystem bazel-out/host/bin/external/com_github_gflags_gflags/include -g0 -g0 -g3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c asylo/examples/quickstart/demo_driver.cc -o bazel-out/host/bin/asylo/examples/quickstart/_objs/quickstart_loader/demo_driver.o
Thanks
Radhika
Radhika,
This is because the enclave and the loader are built with different toolchains. When building both components in one build invocation, Bazel only passes the build arguments to the toolchain that builds the enclave.
To get debug symbols in the loader, you can build the enclave and the loader separately.
$ bazel build -c dbg //quickstart:quickstart_loader
$ bazel build --config=enc-sim -c dbg //quickstart:demo_enclave
$ gdb bazel-bin/quickstart/quickstart_loader
…
Reading symbols from bazel-bin/quickstart/quickstart_loader...done.
(gdb)
Note, however, that normal GDB doesn’t automatically load the debug symbols for the enclave when the enclave is loaded because it’s not loaded as a normal shared object library. You can use the GDB from Intel’s SGX SDK if you want that behavior.
$ sgx-gdb --args bazel-bin/quickstart/quickstart_loader --enclave_path bazel-bin/quickstart/demo_enclave --message "In GDB"
...
Reading symbols from bazel-bin/quickstart/quickstart_loader...done.
(gdb) b quickstart/demo_enclave.cc:53
...
(gdb) run
…
add-symbol-file ‘.../quickstart/demo_enclave’ ...
…
Thread 1 "quickstart_load" hit Breakpoint 1, ...
53 const StatusOr<std::string> EncryptMessage(const std::string &message) {
(gdb) p message
$1 = “In GDB”
(gdb)
I hope this helps!
- Keith (Asylo team)
--
Visit asylo.dev for the latest information.
---
You received this message because you are subscribed to the Google Groups "Asylo Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to asylo-users...@googlegroups.com.
To post to this group, send email to asylo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/asylo-users/679635b6-2c37-4a36-b5eb-a4890961b02a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/asylo-users/485c129a-1d1e-4ff7-9c43-d926730cd57do%40googlegroups.com.