[lldb-dev] debug server help
gclayton at apple.com
Fri Sep 14 11:35:36 PDT 2012
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) 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?
On Sep 14, 2012, at 2:03 AM, Carlo Kok <ck at remobjects.com> wrote:
> I'm having trouble using the LLDB apis to connect to a remote (OSX) debugserver. It connects, starts the process on the server, then it fails on this command in Process.cpp:
> process_sp = Attach (attach_info, debugger, target, listener, error);
> It tries to do a "qLaunchGDBServer" which returns an error.
> Transcript of the traffic to/from the server:
> I'm running debugserver on OSX using:
> /Applications/Xcode45-DP1.app//Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver -g -v 0.0.0.0:3333
> Using the LLDB apis I'm calling:
> m_arch = new ArchSpec("x86_64-apple-macosx");
> m_debugger = Debugger::CreateInstance(DebuggerLog, this);
> m_platform = PlatformSP(PlatformRemoteGDBServer::CreateInstance(true, m_arch));
> m_debugger->GetPlatformList().Append(m_platform, true);
> m_listener = ListenerSP(new Listener("<list>"));
> ProcessLaunchInfo li;
> li.SetExecutableFile(FileSpec("/Users/ck/a.out", false), true);
> m_process = m_platform->DebugProcess(li, *m_debugger.get(), m_target.get(), *m_listener.get(), m_error);
> What am I missing?
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
More information about the lldb-dev