-
Notifications
You must be signed in to change notification settings - Fork 85
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
Setting cwd explicitly to ensure lldb remote debugging works on relative paths in debug info etc. #127
Conversation
# NOTE: In order to use this, add this line to `~/.lldbinit`: | ||
# | ||
# command source ~/.lldbinit-source-map | ||
cat <<-END > ~/.lldbinit-source-map | ||
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/" | ||
settings set target.sdk-path $SDKROOT | ||
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS | ||
|
||
platform settings -w "$BAZEL_WORKSPACE_ROOT/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I've only tested this by doing script import os; os.chdir("$BAZEL_WORKSPACE_ROOT")
but this seems nicer if it works 🤔
Do you have to reset this setting in other LLDB sessions? you do for my option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keith do you do script import os; os.chdir("$BAZEL_WORKSPACE_ROOT")
in ~/.lldbinit-source-map
as well like here? It fails for me for some reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this setting works btw, tested in downstream project that uses this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC with the script option lldb-rpc-server kept around some state about that change, where it looks like it doesn't with your change, which is awesome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keith so this is going to be a problem for bazel projects not built using this rules_ios because this script is embedded inside every xcodeproj generated here so running one will overwrite the content from the previous one.
As we are switching to use per scheme .lldbinit file in future, we will eventually pointing this script to a per-project file not user directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC with the script option lldb-rpc-server kept around some state about that change, where it looks like it doesn't with your change, which is awesome
Wanted to learn how u know about the state in this lldb-rpc-server, also i wonder what does platform status
output looks like for you when use the script os.chdir("$BAZEL_WORKSPACE_ROOT")
. This can be invoked in the debugging window with lldb
8e0da5f
to
8cdc04c
Compare
settings set target.source-map ./ "$BAZEL_WORKSPACE_ROOT/" | ||
settings set target.sdk-path $SDKROOT | ||
settings set target.swift-framework-search-paths $FRAMEWORK_SEARCH_PATHS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these trailing newlines intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, let me fix this and merge
…lative paths in debug info etc.
8cdc04c
to
57e637f
Compare
This is important for lldb debugger to work correctly according to https://lldb.llvm.org/use/remote.html#id6
In future we can ask developers to run
platform status
inside lldb to ensure some metadata is correct.Without this change, do
platform shell pwd
in lldb says/
and after this it becomes whatever workspace you are actually in.This might be a solution to some past/existing issues related to lldb debugger.
Testing against downstream project to make sure this works.