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

Add an OS X debugging workaround. #5334

Merged
merged 1 commit into from
Feb 28, 2017

Conversation

david-german-tri
Copy link
Contributor

@david-german-tri david-german-tri commented Feb 27, 2017

See bazelbuild/bazel#2537

@soonho-tri for feature review


This change is Reviewable

@soonho-tri
Copy link
Member

This is nice and looking great!
I'll test things on my mac this afternoon.


Review status: 0 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@soonho-tri
Copy link
Member

@david-german-tri , I've tried it on my machine. Somehow it didn't work as expected but after some builds, it started working. I've figured out a way to reproduce my issue. PTAL.

The following works:

bazel clean
bazel build --config=apple_debug //drake/common:symbolic_expression_test
lldb ./bazel-bin/drake/common/symbolic_expression_test

The following doesn't work:

bazel clean
bazel build -c dbg //drake/common:symbolic_expression_test
bazel build --config=apple_debug //drake/common:symbolic_expression_test
lldb ./bazel-bin/drake/common/symbolic_expression_test

Review status: 0 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

david-german-tri commented Feb 27, 2017

@soonho-tri Ah, interesting. Disabling the sandbox does not invalidate the cache. Let me see if I can work around that, but if not, I guess we'll document another bazel clean. :-(

@soonho-tri
Copy link
Member

It's be great if we can have --config=apple_debug by default for Mac when we enable -c dbg. If it's difficult to have that in bazel.rc file, I'm happy to have .bazelrc set-up for that (and we can document that here?).


Review status: 0 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

This generates .dSYM files for cc_binary and cc_test rules.

See bazelbuild/bazel#2537
@david-german-tri
Copy link
Contributor Author

Disabling the sandbox does not invalidate the cache. Let me see if I can work around that

done, PTAL

It's be great if we can have --config=apple_debug by default for Mac when we enable -c dbg.

Sadly, no, that's semantically backwards. --config can control the values of other Bazel flags, but --c[ompilation_mode] can't.


Review status: 0 of 4 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@soonho-tri
Copy link
Member

:lgtm: Fantastic!!


Reviewed 4 of 4 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

+@RussTedrake for platform review, since you volunteered on Slack to be the guinea pig


Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@RussTedrake
Copy link
Contributor

:lgtm:

tested. i *think* it worked. lldb shows more symbols. thank you!!

gdb looks like it gets farther than before? (working from memory here):

Reading symbols from bazel-bin/drake/automotive/trajectory_optimization_test...done.

but still barfs when I go to actually run:

(gdb) run
Starting program: /private/var/tmp/_bazel_russt/3e477aa1673e9c80e91d410bb65d1970/execroot/drake-distro/bazel-out/osx-dbg/bin/drake/automotive/trajectory_optimization_test
During startup program terminated with signal ?, Unknown signal.

is there a way to make the clion integration call --config=apple_debug instead of -c dbg?


Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@soonho-tri
Copy link
Member

Hi Russ ,

I think one way is to have the following line at ~/.bazelrc file:

build --config=apple_debug

Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@RussTedrake
Copy link
Contributor

would that mean that it's always compiling in debug mode, though?


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@soonho-tri
Copy link
Member

That's correct.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@soonho-tri
Copy link
Member

FYI, I've asked David this before:

It'd be great if we can have --config=apple_debug by default for Mac when we enable -c dbg.

Sadly, no, that's semantically backwards. --config can control the values of other Bazel flags, but --c[ompilation_mode] can't.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@jwnimmer-tri
Copy link
Collaborator

Note that "Can -c dbg imply --config apple_debug?" and "Can we setup CLion to use --config apple_debug before running the debugger?" are two separate questions.

@soonho-tri
Copy link
Member

@jwnimmer-tri , that's right.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

is there a way to make the clion integration call --config=apple_debug instead of -c dbg?

@RussTedrake @soonho-tri Could you try adding --config=apple_debug to the "Bazel flags" field in your CLion "Run/Debug Configurations"?


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

tested. i think it worked.

If you can breakpoint set -f foo.cc -l 42 now, and you couldn't before, then it worked.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@david-german-tri
Copy link
Contributor Author

gdb looks like it gets farther than before? ... but still barfs when I go to actually run:

I'll try to reproduce this when I'm next in front of a mac with a codesigned gdb.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

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

Successfully merging this pull request may close these issues.

4 participants