Skip to content

androidStudioPackages.{stable,beta,canary,dev}: Fix LLDB debugger#112349

Merged
kevincox merged 1 commit intoNixOS:masterfrom
IvarWithoutBones:android-studio-debugger
Feb 10, 2021
Merged

androidStudioPackages.{stable,beta,canary,dev}: Fix LLDB debugger#112349
kevincox merged 1 commit intoNixOS:masterfrom
IvarWithoutBones:android-studio-debugger

Conversation

@IvarWithoutBones
Copy link
Copy Markdown
Member

Motivation for this change

@PixelyIon encountered an issue with Android Studio's LLDB debugger not working on Nix, so together we fixed it.

Fixes: #112266

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@IvarWithoutBones
Copy link
Copy Markdown
Member Author

/marvin opt-in
/status needs_reviewer

@marvin-mk2
Copy link
Copy Markdown

marvin-mk2 bot commented Feb 8, 2021

Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here.

Copy link
Copy Markdown
Contributor

@PixelyIon PixelyIon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues with the Android Studio debugger after applying this PR, it correctly finds all the libraries it needs.

Result of nixpkgs-review pr 112349 run on x86_64-linux 1

4 packages built:
  • android-studio
  • androidStudioPackages.beta
  • androidStudioPackages.canary
  • androidStudioPackages.dev

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 8, 2021
@r-rmcgibbo
Copy link
Copy Markdown

Result of nixpkgs-review pr 112349 at 17717380 run on x86_64-linux 1

4 packages built:
  • android-studio (androidStudioPackages.stable)
  • androidStudioPackages.beta
  • androidStudioPackages.canary
  • androidStudioPackages.dev

@PixelyIon
Copy link
Copy Markdown
Contributor

What was initially thought to be an unrelated issue was caused by Nix, on debugging the following error would occur:

$ adb shell cat /data/local/tmp/lldb-server | run-as skyline.emu sh -c 'cat > /data/data/skyline.emu/lldb/bin/lldb-server && chmod 700 /data/data/skyline.emu/lldb/bin/lldb-server'
$ adb shell cat /data/local/tmp/start_lldb_server.sh | run-as application.package sh -c 'cat > /data/data/application.package/lldb/bin/start_lldb_server.sh && chmod 700 /data/data/application.package/lldb/bin/start_lldb_server.sh'
Starting LLDB server: /data/data/skyline.emu/lldb/bin/start_lldb_server.sh /data/data/skyline.emu/lldb unix-abstract /application.package-0 platform-1612742810312.sock "lldb process:gdb-remote packets"
failed to get reply to handshake packet

As it turns out, a script deployed to the device ${PACKAGE_ROOT}/bin/lldb/android/start_lldb_server.sh was having it's shebang rewritten from /system/bin/sh to /nix/store/dskh7v2h3ly3kdkfk3xmjlqql1zr0hnw-bash-4.4-p23/bin/sh. This has been fixed by adding dontPatchShebangs to the derivation.

There are a few host bash scripts but they should be evaluated correctly due to Android Studio running in FSH, this has been verified for all instances of the scripts present in Android Studio at the moment. It should be additionally noted that Android Studio ships with few scripts that run on the host, it mainly retrieves scripts to run from the packages it downloads.

Copy link
Copy Markdown

@willfaust willfaust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging native applications on Android Studio also works for me with this PR.

Result of nixpkgs-review pr 112349 run on x86_64-linux 1

4 packages built:
  • android-studio
  • androidStudioPackages.beta
  • androidStudioPackages.canary
  • androidStudioPackages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Studio's debugger is broken (android-studio-canary)

5 participants