`bazel build` always stripping debugging symbols, regardless of invocation?

2,292 views
Skip to first unread message

chris...@gmail.com

unread,
Feb 14, 2018, 9:02:23 AM2/14/18
to bazel-go-discuss
I'm trying to use gdb on a small golang binary, but I can't seem to prevent debugging symbols from being stripped away. I've tried:

# None of these work
$ bazel build -c dbg //:mytarget
$ bazel build -c dbg --strip=never //:mytarget
$ bazel build --strip=never //:mytarget

All produce a binary in a '<arch>_stripped' directory. All of them throw a warning in gdb about missing debugging symbols.

I'm using bazel v0.10.0 and rules_go v0.9.0. I can't seem to generate a debuggable binary with any flag combination I'd expect, and https://github.com/bazelbuild/rules_go/blob/master/go/modes.rst doesn't show an example so I'm unsure where I've misstepped.

Nathan Chan

unread,
Feb 14, 2018, 10:53:09 AM2/14/18
to chris...@gmail.com, bazel-go-discuss
Hi Christi,

There’s a bug in the current implementation that does not account for —strip == ‘never’. I found it yesterday while debugging for another colleague and have a fix. Will send a pr later today. 

Nathan
--
You received this message because you are subscribed to the Google Groups "bazel-go-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-go-discu...@googlegroups.com.
To post to this group, send email to bazel-go...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-go-discuss/b46cc818-5ec7-481b-ab86-7c35698998ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chris...@gmail.com

unread,
Feb 15, 2018, 10:58:41 AM2/15/18
to bazel-go-discuss
Great, thanks! Mind forwarding along the PR number? I'd like to follow along so I can use that hash when it's merged.

Nathan Chan

unread,
Feb 15, 2018, 4:38:53 PM2/15/18
to chris...@gmail.com, bazel-go-discuss
It was merged yesterday to master. PR #1326
Reply all
Reply to author
Forward
0 new messages