[lldb-dev] debug server help

Greg Clayton gclayton at apple.com
Fri Sep 14 12:45:08 PDT 2012


On Sep 14, 2012, at 11:50 AM, Carlo Kok <ck at remobjects.com> wrote:

> Op 14-9-2012 20:35, Greg Clayton schreef:
>> Carlo,
>> 
>> You are trying to connect to a GDB server (which only debugs 1 app)
>> with a client that is expecting a GDB remote _platform_. A platform
>> can list, launch and attach to processes, upload/download files, it
>> does NOT debug. There is a tool in the LLDB sources in
>> lldb/tools/lldb-platform which implements a lldb-platform. It is not
>> ready to be used yet, we have a platform branch where ongoing work is
>> happening:
>> 
>> svn co
>> http://llvm.org/svn/llvm-project/lldb/branches/lldb-platform-work
>> lldb-platform
>> 
>> So we have done a lot of work to start getting the platforms to work
>> as expected.
>> 
>> If you just want to debug, you want to use "process connect" to
>> connect to a process that you want to debug, not a platform. See the
>> CommandObjectProcessConnect::DoExecute() function to see how this is
>> done. Basically if you connect to a remote debugserver and it already
>> has a process it will be good to go. When you use "process connect",
>> it is expected that everything you need to debug is already on the
>> remote host.
>> 
>> So to sum up "platform connect" (see CommandObjectPlatformConnect) is
>> what you tried to do.
>> 
>> Here are some ways you can step through the existing LLDB driver code
>> to see things working:
>> 
>> mac% %
>> /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/debugserver
>> localhost:3333 -- /bin/ls -lAF /tmp/ debugserver-194 for x86_64.
>> Listening to port 12345...
>> 
>> Now on your windows machine:
>> 
>> lldb.exe (lldb) platform select remote-macosx (lldb) target create
>> --arch x86_64-apple-macosx a.out (lldb) process connect
>> connect://192.168.178.2:3333
>> 
>> Does this make sense?
>> 
> 
> It does now, thanks... Is there something that should how to proceed from there? (from code or from lldb cmdline)? (ie what's the next step in debugging , get the process, do the first step, work with symbols?, not asking for all of them, just a starting point)

If you are going to be building an tool that does debugging, I would suggest you compile LLDB into a dll on windwos (LLDB.dll) and work through the public LLDB API (anything that starts with "lldb::SB" (where SB stands for script bridge)). Is there a reasons you were coding with the internal API? What are you trying to do here? What is the main goal? There is a good example about how to setup an event loop to monitor a process you are debugging in:

lldb/examples/python/process_events.py

It is in python, but python also uses the exact same API as is available.

> 
> --
> Carlo Kok
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list