Produced debug build is not a optimized for debugging
YaroslavLitvinov opened this issue · comments
Description
I Follow a debug instruction from here: https://gvisor.dev/docs/user_guide/debugging/#debugger
Build a code
make dev BAZEL_OPTIONS="-c dbg"
Attach Delve to a process and add breakpoint:
break gvisor.dev/gvisor/pkg/sentry/fsimpl/fuse.(*inode).newEntry
When it stops at a breakpoint I get warning:
Warning: debugging optimized function
When printing args, variables, I get warning:
(unreadable empty OP stack)
Following command shows no expected debug options, like -N -l
objdump --dwarf /tmp/master/runsc | grep -A 7 'DW_TAG_compile_unit' | grep 'DW_AT_name\|DW_AT_producer'
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
<c> DW_AT_name : gvisor.dev/gvisor/pkg/bpf
<39> DW_AT_producer : Go cmd/compile go1.16.8
<1afc> DW_AT_name : internal/cpu
<1b1c> DW_AT_producer : Go cmd/compile go1.16.8
<22c9> DW_AT_name : gvisor.dev/gvisor/runsc/cli
<22f8> DW_AT_producer : Go cmd/compile go1.16.8
<31cf> DW_AT_name : internal/cpu
<31ef> DW_AT_producer : Go cmd/compile go1.16.8
<3271> DW_AT_name : runtime/internal/sys
<3299> DW_AT_producer : Go cmd/compile go1.16.8
<3d35> DW_AT_name : gvisor.dev/gvisor/runsc/cmd
<3d64> DW_AT_producer : Go cmd/compile go1.16.8
Steps to reproduce
No response
runsc version
No response
docker version (if using docker)
docker version - 20.10.9
bazel
bazel 4.2.1
uname
Linux XXX 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
kubectl (if using Kubernetes)
No response
repo state (if built from source)
release-20210921.0-270-g9768009a7
runsc debug logs (if available)
No response
A friendly reminder that this issue had no activity for 120 days.
This issue has been closed due to lack of activity.
I believe this was fixed at some point.
$ make refresh BAZEL_OPTIONS="-c dbg --define gotags=debug"
...
Target //runsc:runsc up-to-date:
bazel-bin/runsc/runsc_/runsc
INFO: Elapsed time: 23.628s, Critical Path: 14.30s
INFO: 94 processes: 1 internal, 93 linux-sandbox.
INFO: Build completed successfully, 94 total actions
Loading:
Loading:
Loading: 0 packages loaded
Analyzing: target //runsc:runsc (0 packages loaded, 0 targets configured)
INFO: Analyzed target //runsc:runsc (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: Elapsed time: 0.460s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
$ objdump --dwarf bazel-bin/runsc/runsc_/runsc | grep -A 7 'DW_TAG_compile_unit' | grep 'DW_AT_name\|DW_AT_producer'
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
<c> DW_AT_name : gvisor.dev/gvisor/pkg/sentry/fsimpl/mqfs
<48> DW_AT_producer : Go cmd/compile go1.21.1; -N -l regabi
<9924> DW_AT_name : gvisor.dev/gvisor/pkg/errors
<9954> DW_AT_producer : Go cmd/compile go1.21.1; -N -l regabi
<9b27> DW_AT_name : internal/cpu
<9b47> DW_AT_producer : Go cmd/compile go1.21.1; regabi
<9c0a> DW_AT_name : runtime/internal/atomic
<9c35> DW_AT_producer : Go cmd/compile go1.21.1; regabi
<a73a> DW_AT_name : main
...