17

I've got 2 stations, one for development and another one for testing. I'd like to be able to run and debug targets that were built under release mode (the code is stripped) on the testing station.

Since the code may not be copied to the testing station for security reasons, I've tried remote debugging as described in the following link - http://lldb.llvm.org/remote.html.

Since both sides of the debugging runs OS X, the settings instructions specify that my local (development) station should run 'lldb-server' along with 'debugserver', and remote (testing) side should run 'platform'.

Unfortunately, I couldn't find all those tools inside the Xcode bundle. I also tried to download lldb source code and create those executable by myself, but I'm still missing the lldb-server target.

I wish I had some clear and comprehensive guide about how to do lldb remote debugging properly from A to Z.

3
  • 1
    Most likely lldb can't find the debug information for your executable on the local system. debugserver doesn't do anything with debug information, that isn't its job, so the lldb will have to find debug information locally for symbolic debugging to work. If you have a local copy of the executable you've built - which for performance reasons you'll want to have around anyway since that will speed up debugging - then try passing the path to the local copy to lldb when you launch it. Commented Jan 7, 2016 at 19:06
  • 1
    Instead of just editing the question, could you add them in an answer and then accept it as the solution? That will make it easier for others to discover if they have the same problem down the line. Commented Apr 8, 2016 at 6:52
  • If you did, could you please write some clear and comprehensive guide about how to do lldb remote debugging properly from A to Z? Commented Nov 15, 2016 at 7:42

2 Answers 2

17
  1. Make sure that Xcode is installed on both machines. (Different versions are OK!)

  2. On the remote machine (running the executable):

    1. Start the app you want to debug
    2. Start debugserver, attach to your app, and listen for connections from the other Mac: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver development-mac.local:16000 --attach="Photo Booth"
  3. On the development machine:

    1. Start lldb by typing lldb
    2. Connect to the debug server: process connect connect://test-mac.local:16000

On the test machine, you should now see the message Waiting for debugger instructions for process 0. After a short while, the (lldb) prompt should appear on your development machine, and you can start debugging as normal.

Unfortunatly, I'm not sure how to connect from Xcode.

Sign up to request clarification or add additional context in comments.

4 Comments

Does it download the binary from the remote? I am trying to debug an application but it gets stuck at connect command. In Activity Monitor I can see that lldb is downloading something but even after an hour, nothing happens.
@VivekKumar I solved by issuing the command platform select remote-macosx before the process connect ... command. @JakobEgger please update your answer.
In my case I had to enter this command to the lldb prompt: platform connect connect://test-mac.local:16000 otherwise lldb was hanging. See the official doc for further details: lldb.llvm.org/use/remote.html
This worked for me, except I had to use IP adresses instead of hostnames.
2

Please give feedback for Apple to update their documentation here

In the mean time, I'm getting more milage using hopperapp with app disassembly. http://hopperapp.com/ There's a free trial - and it has a remote debugger available.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.