Using codelite lldb debugger on remote machine

General questions regarding the usage of CodeLite
ssarangi
CodeLite Curious
Posts: 4
Joined: Mon Mar 16, 2015 2:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Using codelite lldb debugger on remote machine

Post by ssarangi »

Hi everyone,
I have been trying out CodeLite and I am trying to use the remote debugging feature of codelite with lldb. I want to debug an application built on mac from a windows system. My Codelite is installed on windows. My question is how do I setup remote debugging on the osx so that I can connect to it from the windows system. I have been trying to find documentation on the wiki page but I haven't found anything except the mention of codelite-lldb which I am not sure how it works. So if anyone can just guide me to the right direction that would be of great help.
Thanks,
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by eranif »

ssarangi wrote:My question is how do I setup remote debugging on the osx so that I can connect to it from the windows system
* Install CodeLite on OSX (so you will have codelite-lldb installed) from our download page
* Manually start codelite-lldb and instruct it to listen on IP:PORT, like this:

(I used here /Users/eran, ofc, replace this with your real path)

Code: Select all

export LLDB_DEBUGSERVER_PATH=/Users/eran/codelite.app/Contents/MacOS/debugserver
/Users/eran/codelite.app/Contents/MacOS/codelite-lldb -t <ip>:<port>
Configure CodeLIte on your Windows machine:
Settings->LLDB Settings->Advanced
Select the options:
Proxy type: Remote proxy process over TCP/IP
Address: the IP of your OSX machine
Port: The port number that codelite-lldb is listening on

When debugging starts, you might be asked to "map" folders (this is needed so CodeLite will be able to open the proper file on the local machine)

Eran
Make sure you have read the HOW TO POST thread
ssarangi
CodeLite Curious
Posts: 4
Joined: Mon Mar 16, 2015 2:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by ssarangi »

Thanks eranif.
eranif wrote:Configure CodeLIte on your Windows machine: Settings->LLDB Settings->Advanced
I setup codelite on both osx and windows as you suggested. Now when I try to set the executable to run, on the windows machine I am actually giving the path on the OSX for the app. However, on trying to start debugging it complains that quick debugging is disabled on LLDB.

So do I have to create a project, sync the source from the mac and then setup lldb to connect to remote ? Thanks for your previous explantion.
ssarangi
CodeLite Curious
Posts: 4
Joined: Mon Mar 16, 2015 2:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by ssarangi »

So I figured out how to launch the app on the mac and codelite now indeed asks me to sync folders.

However, I am seeing a new problem when I start remote debugging.
In project settings, I set the application path to the path on remote machine as well the working directory to the folder containing the app on osx.

However, when I connect to codelite-lldb it picks up the application correctly but then sets the target working directory to project path from Windows.
I don't see any place where I can set the target working directory and I thought specifying the App path and the working directory should have been enough.

Am I missing something ?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by eranif »

I need to test this ... will get back to you ;)

Eran
Make sure you have read the HOW TO POST thread
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by eranif »

Indeed a bug. I fixed this in git master
The new behavior is to use the path as set in the project settings

I uploaded a binary for you to test (you only need to update the Windows binary):
http://downloads.codelite.org/codelite/ ... 64-7.1.exe

Eran
Make sure you have read the HOW TO POST thread
ssarangi
CodeLite Curious
Posts: 4
Joined: Mon Mar 16, 2015 2:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by ssarangi »

Thanks for the quick fix eranif. It indeed managed to go beyond that point however, now what happens is something like this.

1) Set 3 breakpoint on windows
2) codelite-lldb running on remote machine
3) run (immediately all the breakpoints vanish from the windows ui)
4) codelite-lldb reports that 3 breakpoints were set
5) The application runs without hitting the breakpoints though
6) If I try to set another breakpoint, codelite-lldb crashes and exits with code 2.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Using codelite lldb debugger on remote machine

Post by eranif »

ssarangi wrote:1) Set 3 breakpoint on windows
2) codelite-lldb running on remote machine
3) run (immediately all the breakpoints vanish from the windows ui)
4) codelite-lldb reports that 3 breakpoints were set
5) The application runs without hitting the breakpoints though
6) If I try to set another breakpoint, codelite-lldb crashes and exits with code 2.
I have been debugging with codelite-lldb on a remote machine for a while now and it works.
However, things I take for granted, might be unknown to new comers.

For example: the breakpoints are always "vanish" from the local machine (it also happens when debugging locally with codelite-lldb). The reason for this is
that the breakpoints you set in the UI are not really set, its like "I want a breakpoint here" once the debug session starts, CodeLite passes the breakpoints to codelite-lldb
and the later will report if it was successful in placing them.

If no breakpoints were set in the UI again, then it means:
1. codelite-lldb could not set the breakpoints properly (which you reported it does)
2. The mapping between the local and remote machine were unsuccessfull, however, in this case, CodeLite would still have "stopped" it just wouldn't be able to display the correct file

So in order to be able to debug this:

- Please add codelite-lldb log (it prints it to the terminal)
- From CodeLite, go to: Settings->Global Editor Preferences->Misc->Log and set the log level to "Debug"
- Start a debug session and attach codelite.log to this post %appdata%\CodeLite\codelite.log

BTW, If needed, I can upload a new build for OSX + Windows (which works perfectly here...)

Thanks,
Eran
Make sure you have read the HOW TO POST thread
Post Reply